@machinemetrics/mm-react-tools 3.1.1 → 3.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 +6400 -6272
- package/dist/mm-react-tools.umd.js +77 -77
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Et,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("react"),require("react-router-dom"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","styled-components"],me):(Et=typeof globalThis<"u"?globalThis:Et||self,me(Et["mm-react-tools"]={},Et.React,Et.reactRouterDom,Et.styled))})(this,function(Et,me,mn,Cp){"use strict";var q2=Object.defineProperty;var U2=(Et,me,mn)=>me in Et?q2(Et,me,{enumerable:!0,configurable:!0,writable:!0,value:mn}):Et[me]=mn;var E=(Et,me,mn)=>U2(Et,typeof me!="symbol"?me+"":me,mn);function lx(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 pi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function al(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?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 ol={exports:{}},qa={};/**
|
|
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 Np;function fx(){if(Np)return
|
|
9
|
+
*/var Np;function fx(){if(Np)return qa;Np=1;var r=me,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 d,y={},g=null,m=null;h!==void 0&&(g=""+h),f.key!==void 0&&(g=""+f.key),f.ref!==void 0&&(m=f.ref);for(d in f)n.call(f,d)&&!a.hasOwnProperty(d)&&(y[d]=f[d]);if(c&&c.defaultProps)for(d in f=c.defaultProps,f)y[d]===void 0&&(y[d]=f[d]);return{$$typeof:e,type:c,key:g,ref:m,props:y,_owner:i.current}}return qa.Fragment=t,qa.jsx=u,qa.jsxs=u,qa}var Ua={};/**
|
|
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 Rp;function hx(){return Rp||(Rp=1,process.env.NODE_ENV!=="production"&&function(){var r=
|
|
18
|
-
`+Ye+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Rp;function hx(){return Rp||(Rp=1,process.env.NODE_ENV!=="production"&&function(){var r=me,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"),d=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=Symbol.iterator,A="@@iterator";function x(R){if(R===null||typeof R!="object")return null;var ae=b&&R[b]||R[A];return typeof ae=="function"?ae:null}var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function O(R){{for(var ae=arguments.length,we=new Array(ae>1?ae-1:0),Pe=1;Pe<ae;Pe++)we[Pe-1]=arguments[Pe];C("error",R,we)}}function C(R,ae,we){{var Pe=w.ReactDebugCurrentFrame,Ue=Pe.getStackAddendum();Ue!==""&&(ae+="%s",we=we.concat([Ue]));var ot=we.map(function(st){return String(st)});ot.unshift("Warning: "+ae),Function.prototype.apply.call(console[R],console,ot)}}var D=!1,F=!1,B=!1,ee=!1,Q=!1,re;re=Symbol.for("react.module.reference");function fe(R){return!!(typeof R=="string"||typeof R=="function"||R===n||R===a||Q||R===i||R===h||R===d||ee||R===m||D||F||B||typeof R=="object"&&R!==null&&(R.$$typeof===g||R.$$typeof===y||R.$$typeof===u||R.$$typeof===c||R.$$typeof===f||R.$$typeof===re||R.getModuleId!==void 0))}function ge(R,ae,we){var Pe=R.displayName;if(Pe)return Pe;var Ue=ae.displayName||ae.name||"";return Ue!==""?we+"("+Ue+")":we}function he(R){return R.displayName||"Context"}function ve(R){if(R==null)return null;if(typeof R.tag=="number"&&O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case n:return"Fragment";case t:return"Portal";case a:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case d:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var ae=R;return he(ae)+".Consumer";case u:var we=R;return he(we._context)+".Provider";case f:return ge(R,R.render,"ForwardRef");case y:var Pe=R.displayName||null;return Pe!==null?Pe:ve(R.type)||"Memo";case g:{var Ue=R,ot=Ue._payload,st=Ue._init;try{return ve(st(ot))}catch{return null}}}return null}var Ie=Object.assign,ye=0,Be,_e,ce,Ae,Me,Oe,tt;function Tt(){}Tt.__reactDisabledLog=!0;function ft(){{if(ye===0){Be=console.log,_e=console.info,ce=console.warn,Ae=console.error,Me=console.group,Oe=console.groupCollapsed,tt=console.groupEnd;var R={configurable:!0,enumerable:!0,value:Tt,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}ye++}}function Pt(){{if(ye--,ye===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ie({},R,{value:Be}),info:Ie({},R,{value:_e}),warn:Ie({},R,{value:ce}),error:Ie({},R,{value:Ae}),group:Ie({},R,{value:Me}),groupCollapsed:Ie({},R,{value:Oe}),groupEnd:Ie({},R,{value:tt})})}ye<0&&O("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var rt=w.ReactCurrentDispatcher,Ye;function pt(R,ae,we){{if(Ye===void 0)try{throw Error()}catch(Ue){var Pe=Ue.stack.trim().match(/\n( *(at )?)/);Ye=Pe&&Pe[1]||""}return`
|
|
18
|
+
`+Ye+R}}var Fe=!1,wt;{var z=typeof WeakMap=="function"?WeakMap:Map;wt=new z}function K(R,ae){if(!R||Fe)return"";{var we=wt.get(R);if(we!==void 0)return we}var Pe;Fe=!0;var Ue=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ot;ot=rt.current,rt.current=null,ft();try{if(ae){var st=function(){throw Error()};if(Object.defineProperty(st.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(st,[])}catch(M){Pe=M}Reflect.construct(R,[],st)}else{try{st.call()}catch(M){Pe=M}R.call(st.prototype)}}else{try{throw Error()}catch(M){Pe=M}R()}}catch(M){if(M&&Pe&&typeof M.stack=="string"){for(var nt=M.stack.split(`
|
|
19
|
+
`),it=Pe.stack.split(`
|
|
20
|
+
`),xt=nt.length-1,_=it.length-1;xt>=1&&_>=0&&nt[xt]!==it[_];)_--;for(;xt>=1&&_>=0;xt--,_--)if(nt[xt]!==it[_]){if(xt!==1||_!==1)do if(xt--,_--,_<0||nt[xt]!==it[_]){var I=`
|
|
21
|
+
`+nt[xt].replace(" at new "," at ");return R.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",R.displayName)),typeof R=="function"&&wt.set(R,I),I}while(xt>=1&&_>=0);break}}}finally{Fe=!1,rt.current=ot,Pt(),Error.prepareStackTrace=Ue}var k=R?R.displayName||R.name:"",P=k?pt(k):"";return typeof R=="function"&&wt.set(R,P),P}function V(R,ae,we){return K(R,!1)}function J(R){var ae=R.prototype;return!!(ae&&ae.isReactComponent)}function X(R,ae,we){if(R==null)return"";if(typeof R=="function")return K(R,J(R));if(typeof R=="string")return pt(R);switch(R){case h:return pt("Suspense");case d:return pt("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case f:return V(R.render);case y:return X(R.type,ae,we);case g:{var Pe=R,Ue=Pe._payload,ot=Pe._init;try{return X(ot(Ue),ae,we)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,Ce={},Ge=w.ReactDebugCurrentFrame;function Ve(R){if(R){var ae=R._owner,we=X(R.type,R._source,ae?ae.type:null);Ge.setExtraStackFrame(we)}else Ge.setExtraStackFrame(null)}function le(R,ae,we,Pe,Ue){{var ot=Function.call.bind(G);for(var st in R)if(ot(R,st)){var nt=void 0;try{if(typeof R[st]!="function"){var it=Error((Pe||"React class")+": "+we+" type `"+st+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[st]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw it.name="Invariant Violation",it}nt=R[st](ae,st,Pe,we,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xt){nt=xt}nt&&!(nt instanceof Error)&&(Ve(Ue),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).",Pe||"React class",we,st,typeof nt),Ve(null)),nt instanceof Error&&!(nt.message in Ce)&&(Ce[nt.message]=!0,Ve(Ue),O("Failed %s type: %s",we,nt.message),Ve(null))}}}var xe=Array.isArray;function Ze(R){return xe(R)}function At(R){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,we=ae&&R[Symbol.toStringTag]||R.constructor.name||"Object";return we}}function _t(R){try{return Qt(R),!1}catch{return!0}}function Qt(R){return""+R}function mt(R){if(_t(R))return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",At(R)),Qt(R)}var Ut=w.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},Mr,zt,Jt;Jt={};function Zt(R){if(G.call(R,"ref")){var ae=Object.getOwnPropertyDescriptor(R,"ref").get;if(ae&&ae.isReactWarning)return!1}return R.ref!==void 0}function W(R){if(G.call(R,"key")){var ae=Object.getOwnPropertyDescriptor(R,"key").get;if(ae&&ae.isReactWarning)return!1}return R.key!==void 0}function H(R,ae){if(typeof R.ref=="string"&&Ut.current&&ae&&Ut.current.stateNode!==ae){var we=ve(Ut.current.type);Jt[we]||(O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ve(Ut.current.type),R.ref),Jt[we]=!0)}}function ze(R,ae){{var we=function(){Mr||(Mr=!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)",ae))};we.isReactWarning=!0,Object.defineProperty(R,"key",{get:we,configurable:!0})}}function We(R,ae){{var we=function(){zt||(zt=!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)",ae))};we.isReactWarning=!0,Object.defineProperty(R,"ref",{get:we,configurable:!0})}}var kt=function(R,ae,we,Pe,Ue,ot,st){var nt={$$typeof:e,type:R,key:ae,ref:we,props:st,_owner:ot};return nt._store={},Object.defineProperty(nt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(nt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Pe}),Object.defineProperty(nt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ue}),Object.freeze&&(Object.freeze(nt.props),Object.freeze(nt)),nt};function Ke(R,ae,we,Pe,Ue){{var ot,st={},nt=null,it=null;we!==void 0&&(mt(we),nt=""+we),W(ae)&&(mt(ae.key),nt=""+ae.key),Zt(ae)&&(it=ae.ref,H(ae,Ue));for(ot in ae)G.call(ae,ot)&&!rr.hasOwnProperty(ot)&&(st[ot]=ae[ot]);if(R&&R.defaultProps){var xt=R.defaultProps;for(ot in xt)st[ot]===void 0&&(st[ot]=xt[ot])}if(nt||it){var _=typeof R=="function"?R.displayName||R.name||"Unknown":R;nt&&ze(st,_),it&&We(st,_)}return kt(R,nt,it,Ue,Pe,Ut.current,st)}}var nr=w.ReactCurrentOwner,dr=w.ReactDebugCurrentFrame;function Mt(R){if(R){var ae=R._owner,we=X(R.type,R._source,ae?ae.type:null);dr.setExtraStackFrame(we)}else dr.setExtraStackFrame(null)}var Ht;Ht=!1;function Ur(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function $r(){{if(nr.current){var R=ve(nr.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function ir(R){return""}var cn={};function Sr(R){{var ae=$r();if(!ae){var we=typeof R=="string"?R:R.displayName||R.name;we&&(ae=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+we+">.")}return ae}}function Er(R,ae){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var we=Sr(ae);if(cn[we])return;cn[we]=!0;var Pe="";R&&R._owner&&R._owner!==nr.current&&(Pe=" It was passed a child from "+ve(R._owner.type)+"."),Mt(R),O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',we,Pe),Mt(null)}}function Or(R,ae){{if(typeof R!="object")return;if(Ze(R))for(var we=0;we<R.length;we++){var Pe=R[we];Ur(Pe)&&Er(Pe,ae)}else if(Ur(R))R._store&&(R._store.validated=!0);else if(R){var Ue=x(R);if(typeof Ue=="function"&&Ue!==R.entries)for(var ot=Ue.call(R),st;!(st=ot.next()).done;)Ur(st.value)&&Er(st.value,ae)}}}function Ar(R){{var ae=R.type;if(ae==null||typeof ae=="string")return;var we;if(typeof ae=="function")we=ae.propTypes;else if(typeof ae=="object"&&(ae.$$typeof===f||ae.$$typeof===y))we=ae.propTypes;else return;if(we){var Pe=ve(ae);le(we,R.props,"prop",Pe,R)}else if(ae.PropTypes!==void 0&&!Ht){Ht=!0;var Ue=ve(ae);O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ue||"Unknown")}typeof ae.getDefaultProps=="function"&&!ae.getDefaultProps.isReactClassApproved&&O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cr(R){{for(var ae=Object.keys(R.props),we=0;we<ae.length;we++){var Pe=ae[we];if(Pe!=="children"&&Pe!=="key"){Mt(R),O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Pe),Mt(null);break}}R.ref!==null&&(Mt(R),O("Invalid attribute `ref` supplied to `React.Fragment`."),Mt(null))}}var Hr={};function kr(R,ae,we,Pe,Ue,ot){{var st=fe(R);if(!st){var nt="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(nt+=" 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 it=ir();it?nt+=it:nt+=$r();var xt;R===null?xt="null":Ze(R)?xt="array":R!==void 0&&R.$$typeof===e?(xt="<"+(ve(R.type)||"Unknown")+" />",nt=" Did you accidentally export a JSX literal instead of a component?"):xt=typeof R,O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xt,nt)}var _=Ke(R,ae,we,Ue,ot);if(_==null)return _;if(st){var I=ae.children;if(I!==void 0)if(Pe)if(Ze(I)){for(var k=0;k<I.length;k++)Or(I[k],R);Object.freeze&&Object.freeze(I)}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 Or(I,R)}if(G.call(ae,"key")){var P=ve(R),M=Object.keys(ae).filter(function(de){return de!=="key"}),U=M.length>0?"{key: someKey, "+M.join(": ..., ")+": ...}":"{key: someKey}";if(!Hr[P+U]){var ie=M.length>0?"{"+M.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} />`,U,
|
|
30
|
+
<%s key={someKey} {...props} />`,U,P,ie,P),Hr[P+U]=!0}}return R===n?cr(_):Ar(_),_}}function Tr(R,ae,we){return kr(R,ae,we,!0)}function Fr(R,ae,we){return kr(R,ae,we,!1)}var ln=Fr,Un=Tr;Ua.Fragment=n,Ua.jsx=ln,Ua.jsxs=Un}()),Ua}process.env.NODE_ENV==="production"?ol.exports=fx():ol.exports=hx();var ar=ol.exports,ul=function(r,e){return ul=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])},ul(r,e)};function Pn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ul(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var j=function(){return j=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},j.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 Li(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(d){try{h(n.next(d))}catch(y){u(y)}}function f(d){try{h(n.throw(d))}catch(y){u(y)}}function h(d){d.done?a(d.value):i(d.value).then(c,f)}h((n=n.apply(r,e||[])).next())})}function ji(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(d){return f([h,d])}}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(d){h=[6,d],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function br(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 cl="Invariant Violation",Dp=Object.setPrototypeOf,dx=Dp===void 0?function(r,e){return r.__proto__=e,r}:Dp,Mp=function(r){Pn(e,r);function e(t){t===void 0&&(t=cl);var n=r.call(this,typeof t=="number"?cl+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=cl,dx(n,e.prototype),n}return e}(Error);function ps(r,e){if(!r)throw new Mp(e)}var Xo=["debug","log","warn","error","silent"],ll=Xo.indexOf("log");function eu(r){return function(){if(Xo.indexOf(r)>=ll){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=eu("debug"),r.log=eu("log"),r.warn=eu("warn"),r.error=eu("error")})(ps||(ps={}));function Fp(r){var e=Xo[ll];return ll=Math.max(0,Xo.indexOf(r)),e}var fl="3.11.9";function Nn(r){try{return r()}catch{}}const hl=Nn(function(){return globalThis})||Nn(function(){return window})||Nn(function(){return self})||Nn(function(){return global})||Nn(function(){return Nn.constructor("return this")()});var Lp=new Map;function tu(r){var e=Lp.get(r)||1;return Lp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function dl(r,e){e===void 0&&(e=0);var t=tu("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function ru(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=pl(i),e||(e=ml(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var je=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||ps(e,pl(t,n)||ml(t,n))},{debug:ru(ps.debug),log:ru(ps.log),warn:ru(ps.warn),error:ru(ps.error)});function Jr(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new Mp(pl(r,e)||ml(r,e))}var jp=Symbol.for("ApolloErrorMessageHandler_"+fl);function qp(r){if(typeof r=="string")return r;try{return dl(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function pl(r,e){if(e===void 0&&(e=[]),!!r)return hl[jp]&&hl[jp](r,e.map(qp))}function ml(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:fl,message:r,args:e.map(qp)})))}var px=globalThis.__DEV__!==!1;function nu(r,e){if(!!!r)throw new Error(e)}function mx(r){return typeof r=="object"&&r!==null}function yx(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const gx=/\r\n|[\n\r]/g;function yl(r,e){let t=0,n=1;for(const i of r.body.matchAll(gx)){if(typeof i.index=="number"||yx(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function vx(r){return Up(r.source,yl(r.source,r.start))}function Up(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
31
|
`,d=n.split(/\r\n|[\n\r]/g),y=d[i];if(y.length>120){const g=Math.floor(f/80),m=f%80,b=[];for(let A=0;A<y.length;A+=80)b.push(y.slice(A,A+80));return h+$p([[`${u} |`,b[0]],...b.slice(1,g+1).map(A=>["|",A]),["|","^".padStart(m)],["|",b[g+1]]])}return h+$p([[`${u-1} |`,d[i-1]],[`${u} |`,y],["|","^".padStart(f)],[`${u+1} |`,d[i+1]]])}function $p(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 bx(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
|
|
32
|
+
`)}function bx(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 gl extends Error{constructor(e,...t){var n,i,a;const{nodes:u,source:c,positions:f,path:h,originalError:d,extensions:y}=bx(t);super(e),this.name="GraphQLError",this.path=h??void 0,this.originalError=d??void 0,this.nodes=Bp(Array.isArray(u)?u:u?[u]:void 0);const g=Bp((n=this.nodes)===null||n===void 0?void 0:n.map(b=>b.loc).filter(b=>b!=null));this.source=c??(g==null||(i=g[0])===null||i===void 0?void 0:i.source),this.positions=f??(g==null?void 0:g.map(b=>b.start)),this.locations=f&&c?f.map(b=>yl(c,b)):g==null?void 0:g.map(b=>yl(b.source,b.start));const m=mx(d==null?void 0:d.extensions)?d==null?void 0:d.extensions:void 0;this.extensions=(a=y??m)!==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}}),d!=null&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,gl):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
|
`+vx(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=`
|
|
35
35
|
|
|
36
|
-
`+Up(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 Bp(r){return r===void 0||r.length===0?void 0:r}function
|
|
36
|
+
`+Up(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 Bp(r){return r===void 0||r.length===0?void 0:r}function Pr(r,e,t){return new gl(`Syntax Error: ${t}`,{source:r,positions:[e]})}class wx{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 Vp{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 Wp={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"]},_x=new Set(Object.keys(Wp));function zp(r){const e=r==null?void 0:r.kind;return typeof e=="string"&&_x.has(e)}var Us;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(Us||(Us={}));var vl;(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"})(vl||(vl={}));var De;(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"})(De||(De={}));function bl(r){return r===9||r===32}function $a(r){return r>=48&&r<=57}function Hp(r){return r>=97&&r<=122||r>=65&&r<=90}function Gp(r){return Hp(r)||r===95}function xx(r){return Hp(r)||$a(r)||r===95}function Sx(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=Ex(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 Ex(r){let e=0;for(;e<r.length&&bl(r.charCodeAt(e));)++e;return e}function Ox(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(m=>m.length===0||bl(m.charCodeAt(0))),u=t.endsWith('\\"""'),c=r.endsWith('"')&&!u,f=r.endsWith("\\"),h=c||f,d=!i||r.length>70||h||a||u;let y="";const g=i&&bl(r.charCodeAt(0));return(d&&!g||a)&&(y+=`
|
|
37
37
|
`),y+=t,(d||h)&&(y+=`
|
|
38
|
-
`),'"""'+y+'"""'}var
|
|
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,d}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($s(h))++a;else if(
|
|
38
|
+
`),'"""'+y+'"""'}var ue;(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"})(ue||(ue={}));class Tx{constructor(e){const t=new Vp(ue.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!==ue.EOF)do if(e.next)e=e.next;else{const t=kx(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===ue.COMMENT);return e}}function Ax(r){return r===ue.BANG||r===ue.DOLLAR||r===ue.AMP||r===ue.PAREN_L||r===ue.PAREN_R||r===ue.SPREAD||r===ue.COLON||r===ue.EQUALS||r===ue.AT||r===ue.BRACKET_L||r===ue.BRACKET_R||r===ue.BRACE_L||r===ue.PIPE||r===ue.BRACE_R}function $s(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function iu(r,e){return Qp(r.charCodeAt(e))&&Jp(r.charCodeAt(e+1))}function Qp(r){return r>=55296&&r<=56319}function Jp(r){return r>=56320&&r<=57343}function ms(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return ue.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 Vp(e,t,n,a,u,i)}function kx(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 Ix(r,i);case 33:return wr(r,ue.BANG,i,i+1);case 36:return wr(r,ue.DOLLAR,i,i+1);case 38:return wr(r,ue.AMP,i,i+1);case 40:return wr(r,ue.PAREN_L,i,i+1);case 41:return wr(r,ue.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return wr(r,ue.SPREAD,i,i+3);break;case 58:return wr(r,ue.COLON,i,i+1);case 61:return wr(r,ue.EQUALS,i,i+1);case 64:return wr(r,ue.AT,i,i+1);case 91:return wr(r,ue.BRACKET_L,i,i+1);case 93:return wr(r,ue.BRACKET_R,i,i+1);case 123:return wr(r,ue.BRACE_L,i,i+1);case 124:return wr(r,ue.PIPE,i,i+1);case 125:return wr(r,ue.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?Mx(r,i):Px(r,i)}if($a(a)||a===45)return Cx(r,i,a);if(Gp(a))return Fx(r,i);throw Pr(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:$s(a)||iu(t,i)?`Unexpected character: ${ms(r,i)}.`:`Invalid character: ${ms(r,i)}.`)}return wr(r,ue.EOF,n,n)}function Ix(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($s(a))++i;else if(iu(t,i))i+=2;else break}return wr(r,ue.COMMENT,e,i,t.slice(e+1,i))}function Cx(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),$a(a))throw Pr(r.source,i,`Invalid number, unexpected digit after 0: ${ms(r,i)}.`)}else i=wl(r,i,a),a=n.charCodeAt(i);if(a===46&&(u=!0,a=n.charCodeAt(++i),i=wl(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=wl(r,i,a),a=n.charCodeAt(i)),a===46||Gp(a))throw Pr(r.source,i,`Invalid number, expected digit but got: ${ms(r,i)}.`);return wr(r,u?ue.FLOAT:ue.INT,e,i,n.slice(e,i))}function wl(r,e,t){if(!$a(t))throw Pr(r.source,e,`Invalid number, expected digit but got: ${ms(r,e)}.`);const n=r.source.body;let i=e+1;for(;$a(n.charCodeAt(i));)++i;return i}function Px(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,ue.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?Nx(r,i):Rx(r,i):Dx(r,i);u+=f.value,i+=f.size,a=i;continue}if(c===10||c===13)break;if($s(c))++i;else if(iu(t,i))i+=2;else throw Pr(r.source,i,`Invalid character within String: ${ms(r,i)}.`)}throw Pr(r.source,i,"Unterminated string.")}function Nx(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||!$s(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Ba(a),n<0)break}throw Pr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function Rx(r,e){const t=r.source.body,n=Yp(t,e+2);if($s(n))return{value:String.fromCodePoint(n),size:6};if(Qp(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=Yp(t,e+8);if(Jp(i))return{value:String.fromCodePoint(n,i),size:12}}throw Pr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function Yp(r,e){return Ba(r.charCodeAt(e))<<12|Ba(r.charCodeAt(e+1))<<8|Ba(r.charCodeAt(e+2))<<4|Ba(r.charCodeAt(e+3))}function Ba(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Dx(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 Pr(r.source,e,`Invalid character escape sequence: "${t.slice(e,e+2)}".`)}function Mx(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 d=wr(r,ue.BLOCK_STRING,e,a+3,Sx(f).join(`
|
|
40
|
+
`));return r.line+=f.length-1,r.lineStart=i,d}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($s(h))++a;else if(iu(t,a))a+=2;else throw Pr(r.source,a,`Invalid character within String: ${ms(r,a)}.`)}throw Pr(r.source,a,"Unterminated string.")}function Fx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(xx(a))++i;else break}return wr(r,ue.NAME,e,i,t.slice(e,i))}const Lx=10,Kp=2;function _l(r){return su(r,[])}function su(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return jx(r,e);default:return String(r)}}function jx(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(qx(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:su(n,t)}else if(Array.isArray(r))return $x(r,t);return Ux(r,t)}function qx(r){return typeof r.toJSON=="function"}function Ux(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>Kp?"["+Bx(r)+"]":"{ "+t.map(([i,a])=>i+": "+su(a,e)).join(", ")+" }"}function $x(r,e){if(r.length===0)return"[]";if(e.length>Kp)return"[Array]";const t=Math.min(Lx,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(su(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function Bx(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 Vx=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=_l(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,68 +48,68 @@ 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 Zp{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||tu(!1,`Body must be a string. Received: ${bl(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||tu(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||tu(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Wx(r){return Vx(r,Zp)}function zx(r,e){return new Hx(r,e).parseDocument()}let Hx=class{constructor(e,t={}){const n=Wx(e)?e:new Zp(e);this._lexer=new Tx(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(oe.NAME);return this.node(e,{kind:Ce.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ce.DOCUMENT,definitions:this.many(oe.SOF,this.parseDefinition,oe.EOF)})}parseDefinition(){if(this.peek(oe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===oe.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(oe.BRACE_L))return this.node(e,{kind:Ce.OPERATION_DEFINITION,operation:Us.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(oe.NAME)&&(n=this.parseName()),this.node(e,{kind:Ce.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(oe.NAME);switch(e.value){case"query":return Us.QUERY;case"mutation":return Us.MUTATION;case"subscription":return Us.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(oe.PAREN_L,this.parseVariableDefinition,oe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ce.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(oe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(oe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(oe.DOLLAR),this.node(e,{kind:Ce.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ce.SELECTION_SET,selections:this.many(oe.BRACE_L,this.parseSelection,oe.BRACE_R)})}parseSelection(){return this.peek(oe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(oe.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:Ce.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(oe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(oe.PAREN_L,t,oe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:Ce.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(oe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(oe.NAME)?this.node(e,{kind:Ce.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ce.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:Ce.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:Ce.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 oe.BRACKET_L:return this.parseList(e);case oe.BRACE_L:return this.parseObject(e);case oe.INT:return this.advanceLexer(),this.node(t,{kind:Ce.INT,value:t.value});case oe.FLOAT:return this.advanceLexer(),this.node(t,{kind:Ce.FLOAT,value:t.value});case oe.STRING:case oe.BLOCK_STRING:return this.parseStringLiteral();case oe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Ce.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Ce.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Ce.NULL});default:return this.node(t,{kind:Ce.ENUM,value:t.value})}case oe.DOLLAR:if(e)if(this.expectToken(oe.DOLLAR),this._lexer.token.kind===oe.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:Ce.STRING,value:e.value,block:e.kind===oe.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Ce.LIST,values:this.any(oe.BRACKET_L,t,oe.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Ce.OBJECT,fields:this.any(oe.BRACE_L,t,oe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:Ce.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(oe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(oe.AT),this.node(t,{kind:Ce.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(oe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(oe.BRACKET_R),t=this.node(e,{kind:Ce.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(oe.BANG)?this.node(e,{kind:Ce.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Ce.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(oe.STRING)||this.peek(oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);return this.node(e,{kind:Ce.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(oe.COLON);const n=this.parseNamedType();return this.node(e,{kind:Ce.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:Ce.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:Ce.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(oe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseFieldDefinition,oe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(oe.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:Ce.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(oe.PAREN_L,this.parseInputValueDef,oe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(oe.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(oe.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:Ce.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:Ce.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:Ce.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(oe.EQUALS)?this.delimitedMany(oe.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:Ce.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(oe.BRACE_L,this.parseEnumValueDefinition,oe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Ce.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,`${iu(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:Ce.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseInputValueDef,oe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Ce.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:Ce.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:Ce.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:Ce.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:Ce.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:Ce.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:Ce.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(oe.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:Ce.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(oe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(yl,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new wx(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 ${Xp(e)}, found ${iu(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===oe.NAME&&t.value===e)this.advanceLexer();else throw Nr(this._lexer.source,t.start,`Expected "${e}", found ${iu(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===oe.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return Nr(this._lexer.source,t.start,`Unexpected ${iu(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!==oe.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Nr(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function iu(r){const e=r.value;return Xp(r.kind)+(e!=null?` "${e}"`:"")}function Xp(r){return Ax(r)?`"${r}"`:r}function Qx(r){return`"${r.replace(Gx,Jx)}"`}const Gx=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Jx(r){return Yx[r.charCodeAt(0)]}const Yx=["\\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"],wl=Object.freeze({});function Rn(r,e,t=Wp){const n=new Map;for(const w of Object.values(Ce))n.set(w,Kx(e,w));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,d,y;const g=[],m=[];do{c++;const w=c===u.length,O=w&&f.length!==0;if(w){if(d=m.length===0?void 0:g[g.length-1],h=y,y=m.pop(),O)if(a){h=h.slice();let R=0;for(const[F,$]of f){const te=F-R;$===null?(h.splice(te,1),R++):h[te]=$}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[R,F]of f)h[R]=F}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,A;zp(h)||tu(!1,`Invalid AST Node: ${bl(h)}.`);const R=w?(b=n.get(h.kind))===null||b===void 0?void 0:b.leave:(A=n.get(h.kind))===null||A===void 0?void 0:A.enter;if(P=R==null?void 0:R.call(e,h,d,y,g,m),P===wl)break;if(P===!1){if(!w){g.pop();continue}}else if(P!==void 0&&(f.push([d,P]),!w))if(zp(P))h=P;else{g.pop();continue}}if(P===void 0&&O&&f.push([d,h]),w)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 Kx(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 Zx(r){return Rn(r,eS)}const Xx=80,eS={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>Le(r.definitions,`
|
|
51
|
+
spurious results.`)}}return!1};class Zp{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||nu(!1,`Body must be a string. Received: ${_l(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||nu(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||nu(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Wx(r){return Vx(r,Zp)}function zx(r,e){return new Hx(r,e).parseDocument()}let Hx=class{constructor(e,t={}){const n=Wx(e)?e:new Zp(e);this._lexer=new Tx(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(ue.NAME);return this.node(e,{kind:De.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:De.DOCUMENT,definitions:this.many(ue.SOF,this.parseDefinition,ue.EOF)})}parseDefinition(){if(this.peek(ue.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===ue.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 Pr(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(ue.BRACE_L))return this.node(e,{kind:De.OPERATION_DEFINITION,operation:Us.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(ue.NAME)&&(n=this.parseName()),this.node(e,{kind:De.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(ue.NAME);switch(e.value){case"query":return Us.QUERY;case"mutation":return Us.MUTATION;case"subscription":return Us.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(ue.PAREN_L,this.parseVariableDefinition,ue.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:De.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(ue.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(ue.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(ue.DOLLAR),this.node(e,{kind:De.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:De.SELECTION_SET,selections:this.many(ue.BRACE_L,this.parseSelection,ue.BRACE_R)})}parseSelection(){return this.peek(ue.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(ue.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:De.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(ue.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(ue.PAREN_L,t,ue.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(ue.COLON),this.node(t,{kind:De.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(ue.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(ue.NAME)?this.node(e,{kind:De.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:De.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:De.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:De.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 ue.BRACKET_L:return this.parseList(e);case ue.BRACE_L:return this.parseObject(e);case ue.INT:return this.advanceLexer(),this.node(t,{kind:De.INT,value:t.value});case ue.FLOAT:return this.advanceLexer(),this.node(t,{kind:De.FLOAT,value:t.value});case ue.STRING:case ue.BLOCK_STRING:return this.parseStringLiteral();case ue.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:De.BOOLEAN,value:!0});case"false":return this.node(t,{kind:De.BOOLEAN,value:!1});case"null":return this.node(t,{kind:De.NULL});default:return this.node(t,{kind:De.ENUM,value:t.value})}case ue.DOLLAR:if(e)if(this.expectToken(ue.DOLLAR),this._lexer.token.kind===ue.NAME){const n=this._lexer.token.value;throw Pr(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:De.STRING,value:e.value,block:e.kind===ue.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:De.LIST,values:this.any(ue.BRACKET_L,t,ue.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:De.OBJECT,fields:this.any(ue.BRACE_L,t,ue.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(ue.COLON),this.node(t,{kind:De.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(ue.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(ue.AT),this.node(t,{kind:De.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(ue.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(ue.BRACKET_R),t=this.node(e,{kind:De.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(ue.BANG)?this.node(e,{kind:De.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:De.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(ue.STRING)||this.peek(ue.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(ue.BRACE_L,this.parseOperationTypeDefinition,ue.BRACE_R);return this.node(e,{kind:De.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(ue.COLON);const n=this.parseNamedType();return this.node(e,{kind:De.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:De.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:De.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(ue.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(ue.BRACE_L,this.parseFieldDefinition,ue.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(ue.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:De.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(ue.PAREN_L,this.parseInputValueDef,ue.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(ue.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(ue.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:De.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:De.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:De.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(ue.EQUALS)?this.delimitedMany(ue.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:De.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(ue.BRACE_L,this.parseEnumValueDefinition,ue.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:De.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 Pr(this._lexer.source,this._lexer.token.start,`${au(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:De.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(ue.BRACE_L,this.parseInputValueDef,ue.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===ue.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(ue.BRACE_L,this.parseOperationTypeDefinition,ue.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:De.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:De.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:De.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:De.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:De.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:De.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:De.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(ue.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:De.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(ue.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(vl,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new wx(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 Pr(this._lexer.source,t.start,`Expected ${Xp(e)}, found ${au(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===ue.NAME&&t.value===e)this.advanceLexer();else throw Pr(this._lexer.source,t.start,`Expected "${e}", found ${au(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===ue.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return Pr(this._lexer.source,t.start,`Unexpected ${au(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!==ue.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Pr(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function au(r){const e=r.value;return Xp(r.kind)+(e!=null?` "${e}"`:"")}function Xp(r){return Ax(r)?`"${r}"`:r}function Gx(r){return`"${r.replace(Qx,Jx)}"`}const Qx=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Jx(r){return Yx[r.charCodeAt(0)]}const Yx=["\\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"],xl=Object.freeze({});function Rn(r,e,t=Wp){const n=new Map;for(const w of Object.values(De))n.set(w,Kx(e,w));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,d,y;const g=[],m=[];do{c++;const w=c===u.length,O=w&&f.length!==0;if(w){if(d=m.length===0?void 0:g[g.length-1],h=y,y=m.pop(),O)if(a){h=h.slice();let D=0;for(const[F,B]of f){const ee=F-D;B===null?(h.splice(ee,1),D++):h[ee]=B}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[D,F]of f)h[D]=F}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 C;if(!Array.isArray(h)){var b,A;zp(h)||nu(!1,`Invalid AST Node: ${_l(h)}.`);const D=w?(b=n.get(h.kind))===null||b===void 0?void 0:b.leave:(A=n.get(h.kind))===null||A===void 0?void 0:A.enter;if(C=D==null?void 0:D.call(e,h,d,y,g,m),C===xl)break;if(C===!1){if(!w){g.pop();continue}}else if(C!==void 0&&(f.push([d,C]),!w))if(zp(C))h=C;else{g.pop();continue}}if(C===void 0&&O&&f.push([d,h]),w)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 Kx(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 Zx(r){return Rn(r,eS)}const Xx=80,eS={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=vt("(",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+vt(" = ",t)+vt(" ",qe(n," "))},SelectionSet:{leave:({selections:r})=>Jn(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=vt("",r,": ")+e;let u=a+vt("(",qe(t,", "),")");return u.length>Xx&&(u=a+vt(`(
|
|
54
|
+
`,ou(qe(t,`
|
|
55
55
|
`)),`
|
|
56
|
-
)`)),
|
|
57
|
-
`)+
|
|
58
|
-
`)+
|
|
59
|
-
`)+
|
|
60
|
-
`)+e+(em(t)?
|
|
61
|
-
`,
|
|
56
|
+
)`)),qe([u,qe(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+vt(" ",qe(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>qe(["...",vt("on ",r),qe(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i})=>`fragment ${r}${vt("(",qe(t,", "),")")} on ${e} ${vt("",qe(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?Ox(r):Gx(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+vt("(",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})=>vt("",r,`
|
|
57
|
+
`)+qe(["schema",qe(e," "),Jn(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>vt("",r,`
|
|
58
|
+
`)+qe(["scalar",e,qe(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>vt("",r,`
|
|
59
|
+
`)+qe(["type",e,vt("implements ",qe(t," & ")),qe(n," "),Jn(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>vt("",r,`
|
|
60
|
+
`)+e+(em(t)?vt(`(
|
|
61
|
+
`,ou(qe(t,`
|
|
62
62
|
`)),`
|
|
63
|
-
)`):
|
|
64
|
-
`)+
|
|
65
|
-
`)+
|
|
66
|
-
`)+
|
|
67
|
-
`)+
|
|
68
|
-
`)+
|
|
69
|
-
`)+
|
|
70
|
-
`)+"directive @"+e+(em(t)?
|
|
71
|
-
`,
|
|
63
|
+
)`):vt("(",qe(t,", "),")"))+": "+n+vt(" ",qe(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>vt("",r,`
|
|
64
|
+
`)+qe([e+": "+t,vt("= ",n),qe(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>vt("",r,`
|
|
65
|
+
`)+qe(["interface",e,vt("implements ",qe(t," & ")),qe(n," "),Jn(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>vt("",r,`
|
|
66
|
+
`)+qe(["union",e,qe(t," "),vt("= ",qe(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>vt("",r,`
|
|
67
|
+
`)+qe(["enum",e,qe(t," "),Jn(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>vt("",r,`
|
|
68
|
+
`)+qe([e,qe(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>vt("",r,`
|
|
69
|
+
`)+qe(["input",e,qe(t," "),Jn(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>vt("",r,`
|
|
70
|
+
`)+"directive @"+e+(em(t)?vt(`(
|
|
71
|
+
`,ou(qe(t,`
|
|
72
72
|
`)),`
|
|
73
|
-
)`):
|
|
74
|
-
`,
|
|
73
|
+
)`):vt("(",qe(t,", "),")"))+(n?" repeatable":"")+" on "+qe(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>qe(["extend schema",qe(r," "),Jn(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,vt("implements ",qe(e," & ")),qe(t," "),Jn(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>qe(["extend interface",r,vt("implements ",qe(e," & ")),qe(t," "),Jn(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>qe(["extend union",r,qe(e," "),vt("= ",qe(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>qe(["extend enum",r,qe(e," "),Jn(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>qe(["extend input",r,qe(e," "),Jn(t)]," ")}};function qe(r,e=""){var t;return(t=r==null?void 0:r.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function Jn(r){return vt(`{
|
|
74
|
+
`,ou(qe(r,`
|
|
75
75
|
`)),`
|
|
76
|
-
}`)}function
|
|
76
|
+
}`)}function vt(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function ou(r){return vt(" ",r.replace(/\n/g,`
|
|
77
77
|
`))}function em(r){var e;return(e=r==null?void 0:r.some(t=>t.includes(`
|
|
78
|
-
`)))!==null&&e!==void 0?e:!1}function tm(r){return r.kind===Ce.FIELD||r.kind===Ce.FRAGMENT_SPREAD||r.kind===Ce.INLINE_FRAGMENT}function Bs(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],Me(u!==void 0,70,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function tS(r){var e=[];return Rn(r,{Directive:function(t){e.push(t.name.value)}}),e}var rS=function(r,e){return qi(r,e,!1)},nS=function(r,e){return qi(r,e,!0)};function qi(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 wl}}),t?!n.size:n.size<i}function rm(r){return r&&qi(["client","export"],r,!0)}function iS(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(iS(t)){var n=t.arguments,i=t.name.value;Me(n&&n.length===1,71,i);var a=n[0];Me(a.name&&a.name.value==="if",72,i);var u=a.value;Me(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),73,i),e.push({directive:t,ifArgument:a})}}),e}const sS=()=>Object.create(null),{forEach:aS,slice:im}=Array.prototype,{hasOwnProperty:oS}=Object.prototype;let Vs=class cx{constructor(e=!0,t=sS){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return aS.call(e,n=>t=t.getChildTrie(n)),oS.call(t,"data")?t.data:t.data=this.makeData(im.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(im.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 cx(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&uS(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}};function uS(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var sm=Nn(function(){return navigator.product})=="ReactNative",ys=typeof WeakMap=="function"&&!(sm&&!global.HermesInternal),_l=typeof WeakSet=="function",au=typeof Symbol=="function"&&typeof Symbol.for=="function",Ba=au&&Symbol.asyncIterator,xl=typeof Nn(function(){return window.document.createElement})=="function",cS=Nn(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,am=(xl||sm)&&!cS;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 um(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"&&(Me(n.length===1,75,n.length),t=n[0].name.value);var i=j(j({},r),{definitions:wr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function Va(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Wa(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 Me(n,76,t),n||null}default:return null}}function lS(){}class Sl{constructor(e=1/0,t=lS){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 El(){}const fS=El,hS=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},dS=typeof WeakMap<"u"?WeakMap:Map,pS=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:El,unregister:El}},mS=10024;class ou{constructor(e=1/0,t=fS){this.max=e,this.dispose=t,this.map=new dS,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<mS;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new hS(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new pS(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 Ol=new WeakSet;function cm(r){r.size<=(r.max||-1)||Ol.has(r)||(Ol.add(r),setTimeout(function(){r.clean(),Ol.delete(r)},100))}var uu=function(r,e){var t=new ou(r,e);return t.set=function(n,i){var a=ou.prototype.set.call(this,n,i);return cm(this),a},t},lm=function(r,e){var t=new Sl(r,e);return t.set=function(n,i){var a=Sl.prototype.set.call(this,n,i);return cm(this),a},t},yS=Symbol.for("apollo.cacheSize"),Yn=j({},ll[yS]),gs={};function Tl(r,e){gs[r]=e}var gS=globalThis.__DEV__!==!1?_S:void 0,vS=globalThis.__DEV__!==!1?xS:void 0,bS=globalThis.__DEV__!==!1?fm:void 0;function wS(){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 _S(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:wS(),sizes:j({print:(r=gs.print)===null||r===void 0?void 0:r.call(gs),parser:(e=gs.parser)===null||e===void 0?void 0:e.call(gs),canonicalStringify:(t=gs.canonicalStringify)===null||t===void 0?void 0:t.call(gs),links:kl(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:dm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function fm(){return{cache:{fragmentQueryDocuments:Ui(this.getFragmentDoc)}}}function xS(){var r=this.config.fragments;return j(j({},fm.apply(this)),{addTypenameDocumentTransform:dm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:Ui(this.storeReader.executeSelectionSet),executeSubSelectedArray:Ui(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:Ui(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:Ui(r==null?void 0:r.findFragmentSpreads),lookup:Ui(r==null?void 0:r.lookup),transform:Ui(r==null?void 0:r.transform)}})}function SS(r){return!!r&&"dirtyKey"in r}function Ui(r){return SS(r)?r.size:void 0}function hm(r){return r!=null}function dm(r){return Al(r).map(function(e){return{cache:e}})}function Al(r){return r?wr(wr([Ui(r==null?void 0:r.performWork)],Al(r==null?void 0:r.left),!0),Al(r==null?void 0:r.right),!0).filter(hm):[]}function kl(r){var e;return r?wr(wr([(e=r==null?void 0:r.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],kl(r==null?void 0:r.left),!0),kl(r==null?void 0:r.right),!0).filter(hm):[]}var pi=Object.assign(function(e){return JSON.stringify(e,ES)},{reset:function(){Ws=new lm(Yn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&Tl("canonicalStringify",function(){return Ws.size});var Ws;pi.reset();function ES(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(OS))return e;var i=JSON.stringify(n),a=Ws.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=Ws.get(u)||n,Ws.set(i,a),Ws.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function OS(r,e,t){return e===0||t[e-1]<=r}function $i(r){return{__ref:String(r)}}function Ct(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function pm(r){return er(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function TS(r){return r.kind==="StringValue"}function AS(r){return r.kind==="BooleanValue"}function kS(r){return r.kind==="IntValue"}function IS(r){return r.kind==="FloatValue"}function PS(r){return r.kind==="Variable"}function CS(r){return r.kind==="ObjectValue"}function NS(r){return r.kind==="ListValue"}function RS(r){return r.kind==="EnumValue"}function DS(r){return r.kind==="NullValue"}function vs(r,e,t,n){if(kS(t)||IS(t))r[e.value]=Number(t.value);else if(AS(t)||TS(t))r[e.value]=t.value;else if(CS(t)){var i={};t.fields.map(function(u){return vs(i,u.name,u.value,n)}),r[e.value]=i}else if(PS(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(NS(t))r[e.value]=t.values.map(function(u){var c={};return vs(c,e,u,n),c[e.value]});else if(RS(t))r[e.value]=t.value;else if(DS(t))r[e.value]=null;else throw Yr(85,e.value,t.kind)}function mm(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 vs(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 vs(n,a,u,e)})),Il(r.name.value,n,t)}var FS=["connection","include","skip","client","rest","export","nonreactive"],za=pi,Il=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(za(i),")")}else return t.connection.key;var a=r;if(e){var u=za(e);a+="(".concat(u,")")}return t&&Object.keys(t).forEach(function(c){FS.indexOf(c)===-1&&(t[c]&&Object.keys(t[c]).length?a+="@".concat(c,"(").concat(za(t[c]),")"):a+="@".concat(c))}),a},{setStringify:function(r){var e=za;return za=r,e}});function Ha(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return vs(t,i,a,e)}),t}return null}function mi(r){return r.alias?r.alias.value:r.name.value}function cu(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var u=a[i];if(yi(u)){if(u.name.value==="__typename")return r[mi(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=cu(r,Wa(u,t).selectionSet,t);if(typeof h=="string")return h}}function yi(r){return r.kind==="Field"}function ym(r){return r.kind==="InlineFragment"}function bs(r){Me(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 Me(e.length<=1,79,e.length),r}function ws(r){return bs(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function lu(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 Pl(r){var e=ws(r);return Me(e&&e.operation==="query",80),e}function gm(r){Me(r.kind==="Document",81),Me(r.definitions.length<=1,82);var e=r.definitions[0];return Me(e.kind==="FragmentDefinition",83),e}function Bi(r){bs(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 fu(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&vs(e,n.variable.name,n.defaultValue)}),e}const MS=()=>Object.create(null),{forEach:LS,slice:jS}=Array.prototype,{hasOwnProperty:qS}=Object.prototype;class Cl{constructor(e=!0,t=MS){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return LS.call(e,n=>t=t.getChildTrie(n)),qS.call(t,"data")?t.data:t.data=this.makeData(jS.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&&vm(e[n])?t.weak:t.strong;t=a&&a.get(e[n])}return t&&t.data}getChildTrie(e){const t=this.weakness&&vm(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 Cl(this.weakness,this.makeData)),n}}function vm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}let qr=null;const bm={};let US=1;const $S=()=>class{constructor(){this.id=["slot",US++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=qr;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===bm)break;return e!==qr&&(qr.slots[this.id]=t),!0}return qr&&(qr.slots[this.id]=bm),!1}getValue(){if(this.hasValue())return qr.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},u=qr;qr={parent:u,slots:a};try{return t.apply(i,n)}finally{qr=u}}static bind(e){const t=qr;return function(){const n=qr;try{return qr=t,e.apply(this,arguments)}finally{qr=n}}}static noContext(e,t,n){if(qr){const i=qr;try{return qr=null,e.apply(n,t)}finally{qr=i}}else return e.apply(n,t)}};function wm(r){try{return r()}catch{}}const Nl="@wry/context:Slot",_m=wm(()=>globalThis)||wm(()=>global)||Object.create(null),xm=_m[Nl]||Array[Nl]||function(r){try{Object.defineProperty(_m,Nl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}($S()),hu=new xm,{hasOwnProperty:BS}=Object.prototype,Rl=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function Dl(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ga=[],VS=100;function zs(r,e){if(!r)throw new Error(e||"assertion failure")}function Sm(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Em(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Om(r){return r.slice(0)}class du{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,++du.count}peek(){if(this.value.length===1&&!Vi(this))return Tm(this),this.value[0]}recompute(e){return zs(!this.recomputing,"already recomputing"),Tm(this),Vi(this)?WS(this,e):Em(this.value)}setDirty(){this.dirty||(this.dirty=!0,Am(this),Dl(this))}dispose(){this.setDirty(),Nm(this),Fl(this,(e,t)=>{e.setDirty(),Rm(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Ga.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Rl(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ga.push(this.deps),this.deps=null)}}du.count=0;function Tm(r){const e=hu.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Vi(r)?Im(e,r):Pm(e,r),e}function WS(r,e){return Nm(r),hu.withValue(r,zS,[r,e]),QS(r,e)&&HS(r),Em(r.value)}function zS(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=Om(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!Sm(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Vi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function HS(r){r.dirty=!1,!Vi(r)&&km(r)}function Am(r){Fl(r,Im)}function km(r){Fl(r,Pm)}function Fl(r,e){const t=r.parents.size;if(t){const n=Rl(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function Im(r,e){zs(r.childValues.has(e)),zs(Vi(e));const t=!Vi(r);if(!r.dirtyChildren)r.dirtyChildren=Ga.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Am(r)}function Pm(r,e){zs(r.childValues.has(e)),zs(!Vi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,Om(e.value)):Sm(t,e.value)||r.setDirty(),Cm(r,e),!Vi(r)&&km(r)}function Cm(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ga.length<VS&&Ga.push(t),r.dirtyChildren=null))}function Nm(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{Rm(r,t)}),r.forgetDeps(),zs(r.dirtyChildren===null)}function Rm(r,e){e.parents.delete(r),r.childValues.delete(e),Cm(r,e)}function QS(r,e){if(typeof r.subscribe=="function")try{Dl(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const GS={setDirty:!0,dispose:!0,forget:!0};function Dm(r){const e=new Map;function t(n){const i=hu.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&&BS.call(GS,a)?a:"setDirty";Rl(u).forEach(f=>f[c]()),e.delete(i),Dl(u)}},t}let Fm;function JS(...r){return(Fm||(Fm=new Cl(typeof WeakMap=="function"))).lookupArray(r)}const Ml=new Set;function Ja(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=JS,normalizeResult:i,subscribe:a,cache:u=Sl}=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 du(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),Ml.add(c),hu.hasValue()||(Ml.forEach(A=>A.clean()),Ml.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 YS(r){return r}var pu=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=_l?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(YS,{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 Vs(ys);this.performWork=Ja(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return Me(Array.isArray(i),69),t.lookupArray(i)},max:Yn["documentTransform.cache"],cache:ou})}},r.prototype.performWork=function(e){return bs(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}(),Ya,Hs=Object.assign(function(r){var e=Ya.get(r);return e||(e=Zx(r),Ya.set(r,e)),e},{reset:function(){Ya=new uu(Yn.print||2e3)}});Hs.reset(),globalThis.__DEV__!==!1&&Tl("print",function(){return Ya?Ya.size:0});var ur=Array.isArray;function mn(r){return Array.isArray(r)&&r.length>0}var Mm={kind:Ce.FIELD,name:{kind:Ce.NAME,value:"__typename"}};function Lm(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Ce.FRAGMENT_SPREAD&&Lm(e[t.name.value],e)})}function Ll(r){return Lm(ws(r)||gm(r),Va(Qa(r)))?null:r}function KS(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 jm(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 mu(r,e){bs(e);for(var t=jm(""),n=jm(""),i=function(w){for(var O=0,P=void 0;O<w.length&&(P=w[O]);++O)if(!ur(P)){if(P.kind===Ce.OPERATION_DEFINITION)return t(P.name&&P.name.value);if(P.kind===Ce.FRAGMENT_DEFINITION)return n(P.name.value)}return globalThis.__DEV__!==!1&&Me.error(86),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===Ce.OPERATION_DEFINITION&&++a;var c=KS(r),f=function(w){return mn(w)&&w.map(c).some(function(O){return O&&O.remove})},h=new Map,d=!1,y={enter:function(w){if(f(w.directives))return d=!0,null}},g=Rn(e,{Field:y,InlineFragment:y,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,O,P,R,F){var $=i(F);$&&$.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,O,P,R,F){if(f(w.directives))return d=!0,null;var $=i(F);$&&$.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,O,P,R){h.set(JSON.stringify(R),w)},leave:function(w,O,P,R){var F=h.get(JSON.stringify(R));if(w===F)return w;if(a>0&&w.selectionSet.selections.every(function($){return $.kind===Ce.FIELD&&$.name.value==="__typename"}))return n(w.name.value).removed=!0,d=!0,null}},Directive:{leave:function(w){if(c(w))return d=!0,null}}});if(!d)return e;var m=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(O){m(n(O)).transitiveVars.forEach(function(P){w.transitiveVars.add(P)})})),w},b=new Set;g.definitions.forEach(function(w){w.kind===Ce.OPERATION_DEFINITION?m(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(O){b.add(O)}):w.kind===Ce.FRAGMENT_DEFINITION&&a===0&&!n(w.name.value).removed&&b.add(w.name.value)}),b.forEach(function(w){m(n(w)).fragmentSpreads.forEach(function(O){b.add(O)})});var A=function(w){return!!(!b.has(w)||n(w).removed)},x={enter:function(w){if(A(w.name.value))return null}};return Ll(Rn(g,{FragmentSpread:x,FragmentDefinition:x,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var O=m(t(w.name&&w.name.value)).transitiveVars;if(O.size<w.variableDefinitions.length)return j(j({},w),{variableDefinitions:w.variableDefinitions.filter(function(P){return O.has(P.variable.name.value)})})}}}}))}var yu=Object.assign(function(r){return Rn(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Ce.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(c){return yi(c)&&(c.name.value==="__typename"||c.name.value.lastIndexOf("__",0)===0)});if(!a){var u=n;if(!(yi(u)&&u.directives&&u.directives.some(function(c){return c.name.value==="export"})))return j(j({},e),{selections:wr(wr([],i,!0),[Mm],!1)})}}}}}})},{added:function(r){return r===Mm}}),ZS={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&&Me.warn(87),e}};function XS(r){return mu([ZS],bs(r))}function eE(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===Ce.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function tE(r,e){var t=eE(r);return Ll(Rn(e,{OperationDefinition:{enter:function(n){return j(j({},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 rE(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return Ll(Rn(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function qm(r){var e=Bi(r),t=e.operation;if(t==="query")return r;var n=Rn(r,{OperationDefinition:{enter:function(i){return j(j({},i),{operation:"query"})}}});return n}function jl(r){bs(r);var e=mu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function ql(r,e){var t;return((t=ws(r))===null||t===void 0?void 0:t.operation)===e}function nE(r){return ql(r,"mutation")}function iE(r){return ql(r,"query")}function sE(r){return ql(r,"subscription")}var aE=Object.prototype.hasOwnProperty;function Ka(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Za(r)}function Za(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new gi,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var oE=function(r,e,t){return this.merge(r[t],e[t])},gi=function(){function r(e){e===void 0&&(e=oE),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(aE.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=j({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function uE(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?wr(wr([],e,!0),t,!0):t}}}function cE(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 lE(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 j(j({},Ul(e)),{edges:a,pageInfo:j(j({},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=hE()),!t)return e;var c=t.edges?t.edges.map(function(J){return a(J=j({},J))&&(J.cursor=u("cursor",J)),J}):[];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=Ka(t,{pageInfo:{startCursor:m}}));var b=g&&g.cursor;b&&!d&&(t=Ka(t,{pageInfo:{endCursor:b}}))}var A=e.edges,x=[];if(i&&i.after){var w=A.findIndex(function(J){return J.cursor===i.after});w>=0&&(A=A.slice(0,w+1))}else if(i&&i.before){var w=A.findIndex(function(ue){return ue.cursor===i.before});x=w<0?A:A.slice(w),A=[]}else t.edges&&(A=[]);var O=wr(wr(wr([],A,!0),c,!0),x,!0),P=j(j({},t.pageInfo),e.pageInfo);if(t.pageInfo){var R=t.pageInfo,F=R.hasPreviousPage,$=R.hasNextPage,h=R.startCursor,d=R.endCursor,te=on(R,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(P,te),A.length||(F!==void 0&&(P.hasPreviousPage=F),h!==void 0&&(P.startCursor=h)),x.length||($!==void 0&&(P.hasNextPage=$),d!==void 0&&(P.endCursor=d))}return j(j(j({},Ul(e)),Ul(t)),{edges:O,pageInfo:P})}}}var Ul=function(r){return on(r,fE)},fE=["edges","pageInfo"];function hE(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function dE(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=pE(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 pE(r,e){if(r){if(typeof r=="string")return Um(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 Um(r,e)}}function Um(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 $m(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 $l(r,e,t){return e&&$m(r.prototype,e),t&&$m(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Bl=function(){return typeof Symbol=="function"},Vl=function(r){return Bl()&&!!Symbol[r]},Wl=function(r){return Vl(r)?Symbol[r]:"@@"+r};Bl()&&!Vl("observable")&&(Symbol.observable=Symbol("observable"));var mE=Wl("iterator"),zl=Wl("observable"),Bm=Wl("species");function gu(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Xa(r){var e=r.constructor;return e!==void 0&&(e=e[Bm],e===null&&(e=void 0)),e!==void 0?e:Nt}function yE(r){return r instanceof Nt}function Qs(r){Qs.log?Qs.log(r):setTimeout(function(){throw r})}function vu(r){Promise.resolve().then(function(){try{r()}catch(e){Qs(e)}})}function Vm(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=gu(e,"unsubscribe");t&&t.call(e)}}catch(n){Qs(n)}}function Hl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function gE(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Wm(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Wm(r,e,t){r._state="running";var n=r._observer;try{var i=gu(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Hl(r),i)i.call(n,t);else throw t;break;case"complete":Hl(r),i&&i.call(n);break}}catch(a){Qs(a)}r._state==="closed"?Vm(r):r._state==="running"&&(r._state="ready")}function Ql(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}],vu(function(){return gE(r)});return}Wm(r,e,t)}}var vE=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new bE(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"&&(Hl(this),Vm(this))},$l(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),bE=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){Ql(this._subscription,"next",n)},e.error=function(n){Ql(this._subscription,"error",n)},e.complete=function(){Ql(this._subscription,"complete")},$l(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),Nt=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 vE(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=Xa(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=Xa(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=Xa(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=Xa(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=Xa(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[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=gu(n,zl);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return yE(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(Vl("iterator")&&(a=gu(n,mE),a))return new i(function(c){vu(function(){if(!c.closed){for(var f=dE(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){vu(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){vu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},$l(r,null,[{key:Bm,get:function(){return this}}]),r}();Bl()&&Object.defineProperty(Nt,Symbol("extensions"),{value:{symbol:zl,hostReportError:Qs},configurable:!0});function wE(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function _E(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function zm(r){return"status"in r}function xE(r){if(zm(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 SE=Object.prototype.toString;function Gl(r){return Jl(r)}function Jl(r,e){switch(SE.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]=Jl(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]=Jl(r[i],e)}),n}default:return r}}function EE(r){var e=new Set([r]);return e.forEach(function(t){er(t)&&OE(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){er(t[n])&&e.add(t[n])})}),r}function OE(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 Gs(r){return globalThis.__DEV__!==!1&&EE(r),r}function Js(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function bu(r,e,t){return new Nt(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 Yl(r){function e(t){Object.defineProperty(r,t,{value:Nt})}return au&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Hm(r){return r&&typeof r.then=="function"}var _s=function(r){Cn(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),Js(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),Js(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?Hm(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"),Js(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 Nt(t)]),Hm(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}(Nt);Yl(_s);function xs(r){return"incremental"in r}function Qm(r){return"hasNext"in r&&"data"in r}function Gm(r){return xs(r)||Qm(r)}function Jm(r){return er(r)&&"payload"in r}function Kl(r,e){var t=r,n=new gi;return xs(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 eo(r){var e=wu(r);return mn(e)}function wu(r){var e=mn(r.errors)?r.errors.slice(0):[];return xs(r)&&mn(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Wi(){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 zi(r,e){return Wi(r,e,e.variables&&{variables:Wi(j(j({},r&&r.variables),e.variables))})}function Ym(r,e){return Zl(r,e)}function Zl(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=Zl(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=Zl(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function TE(r){return Ym(r,"__typename")}const AE=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:lm,AutoCleanedWeakCache:uu,Concast:_s,DEV:px,DeepMerger:gi,DocumentTransform:pu,Observable:Nt,addTypenameToDocument:yu,argumentsObjectFromField:Ha,asyncMap:bu,buildQueryFromSelectionSet:qm,cacheSizes:Yn,canUseAsyncIteratorSymbol:Ba,canUseDOM:xl,canUseLayoutEffect:am,canUseSymbol:au,canUseWeakMap:ys,canUseWeakSet:_l,canonicalStringify:pi,checkDocument:bs,cloneDeep:Gl,compact:Wi,concatPagination:uE,createFragmentMap:Va,createFulfilledPromise:wE,createRejectedPromise:_E,fixObservableSubclass:Yl,getDefaultValues:fu,getDirectiveNames:tS,getFragmentDefinition:gm,getFragmentDefinitions:Qa,getFragmentFromSelection:Wa,getFragmentQueryDocument:um,getGraphQLErrorsFromResult:wu,getInclusionDirectives:nm,getMainDefinition:Bi,getOperationDefinition:ws,getOperationName:lu,getQueryDefinition:Pl,getStoreKeyName:Il,getTypenameFromResult:cu,graphQLResultHasError:eo,hasAllDirectives:nS,hasAnyDirectives:rS,hasClientExports:rm,hasDirectives:qi,isApolloPayloadResult:Jm,isArray:ur,isDocumentNode:pm,isExecutionPatchIncrementalResult:xs,isExecutionPatchInitialResult:Qm,isExecutionPatchResult:Gm,isField:yi,isInlineFragment:ym,isMutationOperation:nE,isNonEmptyArray:mn,isNonNullObject:er,isPlainObject:om,isQueryOperation:iE,isReference:Ct,isStatefulPromise:zm,isSubscriptionOperation:sE,iterateObserversSafely:Js,makeReference:$i,makeUniqueId:Xo,maybe:Nn,maybeDeepFreeze:Gs,mergeDeep:Ka,mergeDeepArray:Za,mergeIncrementalData:Kl,mergeOptions:zi,offsetLimitPagination:cE,omitDeep:Ym,print:Hs,relayStylePagination:lE,removeArgumentsFromDocument:tE,removeClientSetsFromDocument:jl,removeConnectionDirectiveFromDocument:XS,removeDirectivesFromDocument:mu,removeFragmentSpreadFromDocument:rE,resultKeyNameFromField:mi,shouldInclude:Bs,storeKeyNameFromField:mm,stringifyForDisplay:fl,stripTypename:TE,valueToObjectRepresentation:vs,wrapPromiseWithState:xE},Symbol.toStringTag,{value:"Module"}));function _u(r){return new Nt(function(e){e.error(r)})}function kE(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&Me.warn(43):(e=!0,t(i))},error:n})})}function IE(r){return new Nt(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var Xl=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 PE(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 CE(r,e){var t=j({},r),n=function(a){typeof a=="function"?t=j(j({},t),a(t)):t=j(j({},t),a)},i=function(){return j({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function NE(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?lu(e.query)||void 0:""),e}function RE(r,e){var t=j({},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 Km(r,e){return e?e(r):Nt.of()}function to(r){return typeof r=="function"?new Kr(r):r}function xu(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 Nt.of()})},r.from=function(e){return e.length===0?r.empty():e.map(to).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=to(t),a=to(n||new r(Km)),u;return xu(i)&&xu(a)?u=new r(function(c){return e(c)?i.request(c)||Nt.of():a.request(c)||Nt.of()}):u=new r(function(c,f){return e(c)?i.request(c,f)||Nt.of():a.request(c,f)||Nt.of()}),Object.assign(u,{left:i,right:a})},r.execute=function(e,t){return e.request(CE(t.context,NE(PE(t))))||Nt.of()},r.concat=function(e,t){var n=to(e);if(xu(n))return globalThis.__DEV__!==!1&&Me.warn(36,n),n;var i=to(t),a;return xu(i)?a=new r(function(u){return n.request(u,function(c){return i.request(c)||Nt.of()})||Nt.of()}):a=new r(function(u,c){return n.request(u,function(f){return i.request(f,c)||Nt.of()})||Nt.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(Km)))},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}(),DE=Kr.empty,FE=Kr.from,ME=Kr.split,LE=Kr.concat,Su=Kr.execute;function jE(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function qE(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 Ba&&(d[Symbol.asyncIterator]=function(){return this}),d}function UE(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 Ba&&(t[Symbol.asyncIterator]=function(){return this}),t}function Zm(r){var e={next:function(){return r.read()}};return Ba&&(e[Symbol.asyncIterator]=function(){return this}),e}function $E(r){return!!r.body}function BE(r){return!!r.getReader}function VE(r){return!!(Ba&&r[Symbol.asyncIterator])}function WE(r){return!!r.stream}function zE(r){return!!r.arrayBuffer}function HE(r){return!!r.pipe}function QE(r){var e=r;if($E(r)&&(e=r.body),VE(e))return jE(e);if(BE(e))return Zm(e.getReader());if(WE(e))return Zm(e.stream().getReader());if(zE(e))return UE(e.arrayBuffer());if(HE(e))return qE(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var ef=Symbol();function GE(r){return r.extensions?Array.isArray(r.extensions[ef]):!1}function tf(r){return r.hasOwnProperty("graphQLErrors")}var JE=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=
|
|
78
|
+
`)))!==null&&e!==void 0?e:!1}function tm(r){return r.kind===De.FIELD||r.kind===De.FRAGMENT_SPREAD||r.kind===De.INLINE_FRAGMENT}function Bs(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],je(u!==void 0,70,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function tS(r){var e=[];return Rn(r,{Directive:function(t){e.push(t.name.value)}}),e}var rS=function(r,e){return qi(r,e,!1)},nS=function(r,e){return qi(r,e,!0)};function qi(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 xl}}),t?!n.size:n.size<i}function rm(r){return r&&qi(["client","export"],r,!0)}function iS(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(iS(t)){var n=t.arguments,i=t.name.value;je(n&&n.length===1,71,i);var a=n[0];je(a.name&&a.name.value==="if",72,i);var u=a.value;je(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),73,i),e.push({directive:t,ifArgument:a})}}),e}const sS=()=>Object.create(null),{forEach:aS,slice:im}=Array.prototype,{hasOwnProperty:oS}=Object.prototype;let Vs=class cx{constructor(e=!0,t=sS){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return aS.call(e,n=>t=t.getChildTrie(n)),oS.call(t,"data")?t.data:t.data=this.makeData(im.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(im.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 cx(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&uS(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}};function uS(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var sm=Nn(function(){return navigator.product})=="ReactNative",ys=typeof WeakMap=="function"&&!(sm&&!global.HermesInternal),Sl=typeof WeakSet=="function",uu=typeof Symbol=="function"&&typeof Symbol.for=="function",Va=uu&&Symbol.asyncIterator,El=typeof Nn(function(){return window.document.createElement})=="function",cS=Nn(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,am=(El||sm)&&!cS;function Kt(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 um(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw Jr(74,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(je(n.length===1,75,n.length),t=n[0].name.value);var i=j(j({},r),{definitions:br([{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 je(n,76,t),n||null}default:return null}}function lS(){}class Ol{constructor(e=1/0,t=lS){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 Tl(){}const fS=Tl,hS=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},dS=typeof WeakMap<"u"?WeakMap:Map,pS=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:Tl,unregister:Tl}},mS=10024;class cu{constructor(e=1/0,t=fS){this.max=e,this.dispose=t,this.map=new dS,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<mS;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new hS(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new pS(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 Al=new WeakSet;function cm(r){r.size<=(r.max||-1)||Al.has(r)||(Al.add(r),setTimeout(function(){r.clean(),Al.delete(r)},100))}var lu=function(r,e){var t=new cu(r,e);return t.set=function(n,i){var a=cu.prototype.set.call(this,n,i);return cm(this),a},t},lm=function(r,e){var t=new Ol(r,e);return t.set=function(n,i){var a=Ol.prototype.set.call(this,n,i);return cm(this),a},t},yS=Symbol.for("apollo.cacheSize"),Yn=j({},hl[yS]),gs={};function kl(r,e){gs[r]=e}var gS=globalThis.__DEV__!==!1?_S:void 0,vS=globalThis.__DEV__!==!1?xS:void 0,bS=globalThis.__DEV__!==!1?fm:void 0;function wS(){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 _S(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:wS(),sizes:j({print:(r=gs.print)===null||r===void 0?void 0:r.call(gs),parser:(e=gs.parser)===null||e===void 0?void 0:e.call(gs),canonicalStringify:(t=gs.canonicalStringify)===null||t===void 0?void 0:t.call(gs),links:Cl(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:dm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function fm(){return{cache:{fragmentQueryDocuments:Ui(this.getFragmentDoc)}}}function xS(){var r=this.config.fragments;return j(j({},fm.apply(this)),{addTypenameDocumentTransform:dm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:Ui(this.storeReader.executeSelectionSet),executeSubSelectedArray:Ui(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:Ui(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:Ui(r==null?void 0:r.findFragmentSpreads),lookup:Ui(r==null?void 0:r.lookup),transform:Ui(r==null?void 0:r.transform)}})}function SS(r){return!!r&&"dirtyKey"in r}function Ui(r){return SS(r)?r.size:void 0}function hm(r){return r!=null}function dm(r){return Il(r).map(function(e){return{cache:e}})}function Il(r){return r?br(br([Ui(r==null?void 0:r.performWork)],Il(r==null?void 0:r.left),!0),Il(r==null?void 0:r.right),!0).filter(hm):[]}function Cl(r){var e;return r?br(br([(e=r==null?void 0:r.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],Cl(r==null?void 0:r.left),!0),Cl(r==null?void 0:r.right),!0).filter(hm):[]}var mi=Object.assign(function(e){return JSON.stringify(e,ES)},{reset:function(){Ws=new lm(Yn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&kl("canonicalStringify",function(){return Ws.size});var Ws;mi.reset();function ES(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(OS))return e;var i=JSON.stringify(n),a=Ws.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=Ws.get(u)||n,Ws.set(i,a),Ws.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function OS(r,e,t){return e===0||t[e-1]<=r}function $i(r){return{__ref:String(r)}}function Nt(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function pm(r){return Kt(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function TS(r){return r.kind==="StringValue"}function AS(r){return r.kind==="BooleanValue"}function kS(r){return r.kind==="IntValue"}function IS(r){return r.kind==="FloatValue"}function CS(r){return r.kind==="Variable"}function PS(r){return r.kind==="ObjectValue"}function NS(r){return r.kind==="ListValue"}function RS(r){return r.kind==="EnumValue"}function DS(r){return r.kind==="NullValue"}function vs(r,e,t,n){if(kS(t)||IS(t))r[e.value]=Number(t.value);else if(AS(t)||TS(t))r[e.value]=t.value;else if(PS(t)){var i={};t.fields.map(function(u){return vs(i,u.name,u.value,n)}),r[e.value]=i}else if(CS(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(NS(t))r[e.value]=t.values.map(function(u){var c={};return vs(c,e,u,n),c[e.value]});else if(RS(t))r[e.value]=t.value;else if(DS(t))r[e.value]=null;else throw Jr(85,e.value,t.kind)}function mm(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 vs(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 vs(n,a,u,e)})),Pl(r.name.value,n,t)}var MS=["connection","include","skip","client","rest","export","nonreactive"],Ha=mi,Pl=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){MS.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 vs(t,i,a,e)}),t}return null}function yi(r){return r.alias?r.alias.value:r.name.value}function fu(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=fu(r,za(u,t).selectionSet,t);if(typeof h=="string")return h}}function gi(r){return r.kind==="Field"}function ym(r){return r.kind==="InlineFragment"}function bs(r){je(r&&r.kind==="Document",77);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw Jr(78,t.kind);return t});return je(e.length<=1,79,e.length),r}function ws(r){return bs(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function hu(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 Nl(r){var e=ws(r);return je(e&&e.operation==="query",80),e}function gm(r){je(r.kind==="Document",81),je(r.definitions.length<=1,82);var e=r.definitions[0];return je(e.kind==="FragmentDefinition",83),e}function Bi(r){bs(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(84)}function du(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&vs(e,n.variable.name,n.defaultValue)}),e}const FS=()=>Object.create(null),{forEach:LS,slice:jS}=Array.prototype,{hasOwnProperty:qS}=Object.prototype;class Rl{constructor(e=!0,t=FS){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return LS.call(e,n=>t=t.getChildTrie(n)),qS.call(t,"data")?t.data:t.data=this.makeData(jS.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&&vm(e[n])?t.weak:t.strong;t=a&&a.get(e[n])}return t&&t.data}getChildTrie(e){const t=this.weakness&&vm(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 Rl(this.weakness,this.makeData)),n}}function vm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}let jr=null;const bm={};let US=1;const $S=()=>class{constructor(){this.id=["slot",US++,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===bm)break;return e!==jr&&(jr.slots[this.id]=t),!0}return jr&&(jr.slots[this.id]=bm),!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 wm(r){try{return r()}catch{}}const Dl="@wry/context:Slot",_m=wm(()=>globalThis)||wm(()=>global)||Object.create(null),xm=_m[Dl]||Array[Dl]||function(r){try{Object.defineProperty(_m,Dl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}($S()),pu=new xm,{hasOwnProperty:BS}=Object.prototype,Ml=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function Fl(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ja=[],VS=100;function zs(r,e){if(!r)throw new Error(e||"assertion failure")}function Sm(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Em(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Om(r){return r.slice(0)}class mu{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,++mu.count}peek(){if(this.value.length===1&&!Vi(this))return Tm(this),this.value[0]}recompute(e){return zs(!this.recomputing,"already recomputing"),Tm(this),Vi(this)?WS(this,e):Em(this.value)}setDirty(){this.dirty||(this.dirty=!0,Am(this),Fl(this))}dispose(){this.setDirty(),Nm(this),Ll(this,(e,t)=>{e.setDirty(),Rm(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&&(Ml(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ja.push(this.deps),this.deps=null)}}mu.count=0;function Tm(r){const e=pu.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Vi(r)?Im(e,r):Cm(e,r),e}function WS(r,e){return Nm(r),pu.withValue(r,zS,[r,e]),GS(r,e)&&HS(r),Em(r.value)}function zS(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=Om(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!Sm(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Vi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function HS(r){r.dirty=!1,!Vi(r)&&km(r)}function Am(r){Ll(r,Im)}function km(r){Ll(r,Cm)}function Ll(r,e){const t=r.parents.size;if(t){const n=Ml(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function Im(r,e){zs(r.childValues.has(e)),zs(Vi(e));const t=!Vi(r);if(!r.dirtyChildren)r.dirtyChildren=Ja.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Am(r)}function Cm(r,e){zs(r.childValues.has(e)),zs(!Vi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,Om(e.value)):Sm(t,e.value)||r.setDirty(),Pm(r,e),!Vi(r)&&km(r)}function Pm(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ja.length<VS&&Ja.push(t),r.dirtyChildren=null))}function Nm(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{Rm(r,t)}),r.forgetDeps(),zs(r.dirtyChildren===null)}function Rm(r,e){e.parents.delete(r),r.childValues.delete(e),Pm(r,e)}function GS(r,e){if(typeof r.subscribe=="function")try{Fl(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const QS={setDirty:!0,dispose:!0,forget:!0};function Dm(r){const e=new Map;function t(n){const i=pu.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&&BS.call(QS,a)?a:"setDirty";Ml(u).forEach(f=>f[c]()),e.delete(i),Fl(u)}},t}let Mm;function JS(...r){return(Mm||(Mm=new Rl(typeof WeakMap=="function"))).lookupArray(r)}const jl=new Set;function Ya(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=JS,normalizeResult:i,subscribe:a,cache:u=Ol}=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 mu(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),pu.hasValue()||(jl.forEach(A=>A.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 YS(r){return r}var yu=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=Sl?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(YS,{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 Vs(ys);this.performWork=Ya(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return je(Array.isArray(i),69),t.lookupArray(i)},max:Yn["documentTransform.cache"],cache:cu})}},r.prototype.performWork=function(e){return bs(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,Hs=Object.assign(function(r){var e=Ka.get(r);return e||(e=Zx(r),Ka.set(r,e)),e},{reset:function(){Ka=new lu(Yn.print||2e3)}});Hs.reset(),globalThis.__DEV__!==!1&&kl("print",function(){return Ka?Ka.size:0});var or=Array.isArray;function yn(r){return Array.isArray(r)&&r.length>0}var Fm={kind:De.FIELD,name:{kind:De.NAME,value:"__typename"}};function Lm(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===De.FRAGMENT_SPREAD&&Lm(e[t.name.value],e)})}function ql(r){return Lm(ws(r)||gm(r),Wa(Qa(r)))?null:r}function KS(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 jm(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 gu(r,e){bs(e);for(var t=jm(""),n=jm(""),i=function(w){for(var O=0,C=void 0;O<w.length&&(C=w[O]);++O)if(!or(C)){if(C.kind===De.OPERATION_DEFINITION)return t(C.name&&C.name.value);if(C.kind===De.FRAGMENT_DEFINITION)return n(C.name.value)}return globalThis.__DEV__!==!1&&je.error(86),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===De.OPERATION_DEFINITION&&++a;var c=KS(r),f=function(w){return yn(w)&&w.map(c).some(function(O){return O&&O.remove})},h=new Map,d=!1,y={enter:function(w){if(f(w.directives))return d=!0,null}},g=Rn(e,{Field:y,InlineFragment:y,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,O,C,D,F){var B=i(F);B&&B.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,O,C,D,F){if(f(w.directives))return d=!0,null;var B=i(F);B&&B.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,O,C,D){h.set(JSON.stringify(D),w)},leave:function(w,O,C,D){var F=h.get(JSON.stringify(D));if(w===F)return w;if(a>0&&w.selectionSet.selections.every(function(B){return B.kind===De.FIELD&&B.name.value==="__typename"}))return n(w.name.value).removed=!0,d=!0,null}},Directive:{leave:function(w){if(c(w))return d=!0,null}}});if(!d)return e;var m=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(O){m(n(O)).transitiveVars.forEach(function(C){w.transitiveVars.add(C)})})),w},b=new Set;g.definitions.forEach(function(w){w.kind===De.OPERATION_DEFINITION?m(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(O){b.add(O)}):w.kind===De.FRAGMENT_DEFINITION&&a===0&&!n(w.name.value).removed&&b.add(w.name.value)}),b.forEach(function(w){m(n(w)).fragmentSpreads.forEach(function(O){b.add(O)})});var A=function(w){return!!(!b.has(w)||n(w).removed)},x={enter:function(w){if(A(w.name.value))return null}};return ql(Rn(g,{FragmentSpread:x,FragmentDefinition:x,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var O=m(t(w.name&&w.name.value)).transitiveVars;if(O.size<w.variableDefinitions.length)return j(j({},w),{variableDefinitions:w.variableDefinitions.filter(function(C){return O.has(C.variable.name.value)})})}}}}))}var vu=Object.assign(function(r){return Rn(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===De.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 j(j({},e),{selections:br(br([],i,!0),[Fm],!1)})}}}}}})},{added:function(r){return r===Fm}}),ZS={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&&je.warn(87),e}};function XS(r){return gu([ZS],bs(r))}function eE(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===De.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function tE(r,e){var t=eE(r);return ql(Rn(e,{OperationDefinition:{enter:function(n){return j(j({},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 rE(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return ql(Rn(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function qm(r){var e=Bi(r),t=e.operation;if(t==="query")return r;var n=Rn(r,{OperationDefinition:{enter:function(i){return j(j({},i),{operation:"query"})}}});return n}function Ul(r){bs(r);var e=gu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function $l(r,e){var t;return((t=ws(r))===null||t===void 0?void 0:t.operation)===e}function nE(r){return $l(r,"mutation")}function iE(r){return $l(r,"query")}function sE(r){return $l(r,"subscription")}var aE=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 oE=function(r,e,t){return this.merge(r[t],e[t])},vi=function(){function r(e){e===void 0&&(e=oE),this.reconciler=e,this.isObject=Kt,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 Kt(t)&&Kt(e)?(Object.keys(t).forEach(function(u){if(aE.call(e,u)){var c=e[u];if(t[u]!==c){var f=n.reconciler.apply(n,br([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 Kt(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=j({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function uE(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?br(br([],e,!0),t,!0):t}}}function cE(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 lE(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 j(j({},Bl(e)),{edges:a,pageInfo:j(j({},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=hE()),!t)return e;var c=t.edges?t.edges.map(function(Q){return a(Q=j({},Q))&&(Q.cursor=u("cursor",Q)),Q}):[];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 A=e.edges,x=[];if(i&&i.after){var w=A.findIndex(function(Q){return Q.cursor===i.after});w>=0&&(A=A.slice(0,w+1))}else if(i&&i.before){var w=A.findIndex(function(re){return re.cursor===i.before});x=w<0?A:A.slice(w),A=[]}else t.edges&&(A=[]);var O=br(br(br([],A,!0),c,!0),x,!0),C=j(j({},t.pageInfo),e.pageInfo);if(t.pageInfo){var D=t.pageInfo,F=D.hasPreviousPage,B=D.hasNextPage,h=D.startCursor,d=D.endCursor,ee=an(D,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(C,ee),A.length||(F!==void 0&&(C.hasPreviousPage=F),h!==void 0&&(C.startCursor=h)),x.length||(B!==void 0&&(C.hasNextPage=B),d!==void 0&&(C.endCursor=d))}return j(j(j({},Bl(e)),Bl(t)),{edges:O,pageInfo:C})}}}var Bl=function(r){return an(r,fE)},fE=["edges","pageInfo"];function hE(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function dE(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=pE(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 pE(r,e){if(r){if(typeof r=="string")return Um(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 Um(r,e)}}function Um(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 $m(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 Vl(r,e,t){return e&&$m(r.prototype,e),t&&$m(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Wl=function(){return typeof Symbol=="function"},zl=function(r){return Wl()&&!!Symbol[r]},Hl=function(r){return zl(r)?Symbol[r]:"@@"+r};Wl()&&!zl("observable")&&(Symbol.observable=Symbol("observable"));var mE=Hl("iterator"),Gl=Hl("observable"),Bm=Hl("species");function bu(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[Bm],e===null&&(e=void 0)),e!==void 0?e:Rt}function yE(r){return r instanceof Rt}function Gs(r){Gs.log?Gs.log(r):setTimeout(function(){throw r})}function wu(r){Promise.resolve().then(function(){try{r()}catch(e){Gs(e)}})}function Vm(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=bu(e,"unsubscribe");t&&t.call(e)}}catch(n){Gs(n)}}function Ql(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function gE(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Wm(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Wm(r,e,t){r._state="running";var n=r._observer;try{var i=bu(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Ql(r),i)i.call(n,t);else throw t;break;case"complete":Ql(r),i&&i.call(n);break}}catch(a){Gs(a)}r._state==="closed"?Vm(r):r._state==="running"&&(r._state="ready")}function Jl(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}],wu(function(){return gE(r)});return}Wm(r,e,t)}}var vE=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new bE(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"&&(Ql(this),Vm(this))},Vl(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),bE=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){Jl(this._subscription,"next",n)},e.error=function(n){Jl(this._subscription,"error",n)},e.complete=function(){Jl(this._subscription,"complete")},Vl(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 vE(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[Gl]=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=bu(n,Gl);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return yE(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(zl("iterator")&&(a=bu(n,mE),a))return new i(function(c){wu(function(){if(!c.closed){for(var f=dE(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){wu(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){wu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},Vl(r,null,[{key:Bm,get:function(){return this}}]),r}();Wl()&&Object.defineProperty(Rt,Symbol("extensions"),{value:{symbol:Gl,hostReportError:Gs},configurable:!0});function wE(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function _E(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function zm(r){return"status"in r}function xE(r){if(zm(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 SE=Object.prototype.toString;function Yl(r){return Kl(r)}function Kl(r,e){switch(SE.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]=Kl(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]=Kl(r[i],e)}),n}default:return r}}function EE(r){var e=new Set([r]);return e.forEach(function(t){Kt(t)&&OE(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){Kt(t[n])&&e.add(t[n])})}),r}function OE(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 Qs(r){return globalThis.__DEV__!==!1&&EE(r),r}function Js(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function _u(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 Zl(r){function e(t){Object.defineProperty(r,t,{value:Rt})}return uu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Hm(r){return r&&typeof r.then=="function"}var _s=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),Js(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),Js(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?Hm(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"),Js(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)]),Hm(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);Zl(_s);function xs(r){return"incremental"in r}function Gm(r){return"hasNext"in r&&"data"in r}function Qm(r){return xs(r)||Gm(r)}function Jm(r){return Kt(r)&&"payload"in r}function Xl(r,e){var t=r,n=new vi;return xs(e)&&yn(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=xu(r);return yn(e)}function xu(r){var e=yn(r.errors)?r.errors.slice(0):[];return xs(r)&&yn(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Wi(){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 zi(r,e){return Wi(r,e,e.variables&&{variables:Wi(j(j({},r&&r.variables),e.variables))})}function Ym(r,e){return ef(r,e)}function ef(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=ef(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=ef(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function TE(r){return Ym(r,"__typename")}const AE=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:lm,AutoCleanedWeakCache:lu,Concast:_s,DEV:px,DeepMerger:vi,DocumentTransform:yu,Observable:Rt,addTypenameToDocument:vu,argumentsObjectFromField:Ga,asyncMap:_u,buildQueryFromSelectionSet:qm,cacheSizes:Yn,canUseAsyncIteratorSymbol:Va,canUseDOM:El,canUseLayoutEffect:am,canUseSymbol:uu,canUseWeakMap:ys,canUseWeakSet:Sl,canonicalStringify:mi,checkDocument:bs,cloneDeep:Yl,compact:Wi,concatPagination:uE,createFragmentMap:Wa,createFulfilledPromise:wE,createRejectedPromise:_E,fixObservableSubclass:Zl,getDefaultValues:du,getDirectiveNames:tS,getFragmentDefinition:gm,getFragmentDefinitions:Qa,getFragmentFromSelection:za,getFragmentQueryDocument:um,getGraphQLErrorsFromResult:xu,getInclusionDirectives:nm,getMainDefinition:Bi,getOperationDefinition:ws,getOperationName:hu,getQueryDefinition:Nl,getStoreKeyName:Pl,getTypenameFromResult:fu,graphQLResultHasError:to,hasAllDirectives:nS,hasAnyDirectives:rS,hasClientExports:rm,hasDirectives:qi,isApolloPayloadResult:Jm,isArray:or,isDocumentNode:pm,isExecutionPatchIncrementalResult:xs,isExecutionPatchInitialResult:Gm,isExecutionPatchResult:Qm,isField:gi,isInlineFragment:ym,isMutationOperation:nE,isNonEmptyArray:yn,isNonNullObject:Kt,isPlainObject:om,isQueryOperation:iE,isReference:Nt,isStatefulPromise:zm,isSubscriptionOperation:sE,iterateObserversSafely:Js,makeReference:$i,makeUniqueId:tu,maybe:Nn,maybeDeepFreeze:Qs,mergeDeep:Za,mergeDeepArray:Xa,mergeIncrementalData:Xl,mergeOptions:zi,offsetLimitPagination:cE,omitDeep:Ym,print:Hs,relayStylePagination:lE,removeArgumentsFromDocument:tE,removeClientSetsFromDocument:Ul,removeConnectionDirectiveFromDocument:XS,removeDirectivesFromDocument:gu,removeFragmentSpreadFromDocument:rE,resultKeyNameFromField:yi,shouldInclude:Bs,storeKeyNameFromField:mm,stringifyForDisplay:dl,stripTypename:TE,valueToObjectRepresentation:vs,wrapPromiseWithState:xE},Symbol.toStringTag,{value:"Module"}));function Su(r){return new Rt(function(e){e.error(r)})}function kE(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&je.warn(43):(e=!0,t(i))},error:n})})}function IE(r){return new Rt(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var tf=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 CE(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(44,i)}return r}function PE(r,e){var t=j({},r),n=function(a){typeof a=="function"?t=j(j({},t),a(t)):t=j(j({},t),a)},i=function(){return j({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function NE(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?hu(e.query)||void 0:""),e}function RE(r,e){var t=j({},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 Km(r,e){return e?e(r):Rt.of()}function ro(r){return typeof r=="function"?new Yr(r):r}function Eu(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 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(Km)),u;return Eu(i)&&Eu(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(PE(t.context,NE(CE(t))))||Rt.of()},r.concat=function(e,t){var n=ro(e);if(Eu(n))return globalThis.__DEV__!==!1&&je.warn(36,n),n;var i=ro(t),a;return Eu(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(Km)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw Jr(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}(),DE=Yr.empty,ME=Yr.from,FE=Yr.split,LE=Yr.concat,Ou=Yr.execute;function jE(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function qE(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 UE(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 Zm(r){var e={next:function(){return r.read()}};return Va&&(e[Symbol.asyncIterator]=function(){return this}),e}function $E(r){return!!r.body}function BE(r){return!!r.getReader}function VE(r){return!!(Va&&r[Symbol.asyncIterator])}function WE(r){return!!r.stream}function zE(r){return!!r.arrayBuffer}function HE(r){return!!r.pipe}function GE(r){var e=r;if($E(r)&&(e=r.body),VE(e))return jE(e);if(BE(e))return Zm(e.getReader());if(WE(e))return Zm(e.stream().getReader());if(zE(e))return UE(e.arrayBuffer());if(HE(e))return qE(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var rf=Symbol();function QE(r){return r.extensions?Array.isArray(r.extensions[rf]):!1}function nf(r){return r.hasOwnProperty("graphQLErrors")}var JE=function(r){var e=br(br(br([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return Kt(t)&&t.message||"Error message not found."}).join(`
|
|
80
|
+
`)},gn=function(r){Pn(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||JE(h),h.extraInfo=f,h.cause=br(br(br([u],n||[],!0),i||[],!0),a||[],!0).find(function(d){return!!d})||null,h.__proto__=e.prototype,h}return e}(Error),Xm=Object.prototype.hasOwnProperty;function YE(r,e){return Li(this,void 0,void 0,function(){var t,n,i,a,u,c,f,h,d,y,g,m,b,A,x,w,O,C,D,F,B,ee,Q,re;return ji(this,function(fe){switch(fe.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=(re=r.headers)===null||re===void 0?void 0:re.get("content-type"),i="boundary=",a=n!=null&&n.includes(i)?n==null?void 0:n.substring((n==null?void 0:n.indexOf(i))+i.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u=`\r
|
|
81
|
+
--`.concat(a),c="",f=GE(r),h=!0,fe.label=1;case 1:return h?[4,f.next()]:[3,3];case 2:for(d=fe.sent(),y=d.value,g=d.done,m=typeof y=="string"?y:t.decode(y),b=c.length-u.length+1,h=!g,c+=m,A=c.indexOf(u,b);A>-1;){if(x=void 0,ee=[c.slice(0,A),c.slice(A+u.length)],x=ee[0],c=ee[1],w=x.indexOf(`\r
|
|
82
82
|
\r
|
|
83
|
-
`),O=KE(x.slice(0,w)),
|
|
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 ey(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Xl(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 ZE(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function ty(r){return function(e){return e.text().then(function(t){return ey(e,t)}).then(function(t){return!Array.isArray(t)&&!Xm.call(t,"data")&&!Xm.call(t,"errors")&&Xl(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Eu=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},XE={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},eO={accept:"*/*","content-type":"application/json"},tO={method:"POST"},ry={http:XE,headers:eO,options:tO},rf=function(r,e){return e(r)};function rO(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),nf.apply(void 0,wr([r,rf],t,!1))}function nf(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(y){i=j(j(j({},i),y.options),{headers:j(j({},i.headers),y.headers)}),y.credentials&&(i.credentials=y.credentials),a=j(j({},a),y.http)}),i.headers&&(i.headers=nO(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,Hs)),{options:i,body:d}}function nO(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 ny=function(r){if(!r&&typeof fetch>"u")throw Yr(38)},iO=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},iy=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=Eu(e.variables,"Variables map")}catch(y){return{parseError:y}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Eu(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 ay=Nn(function(){return fetch}),sf=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?rf: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&&ny(n||ay);var g={http:{includeExtensions:u,preserveHeaderCase:c},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Kr(function(m){var b=iy(m,t),A=m.getContext(),x={};if(A.clientAwareness){var w=A.clientAwareness,O=w.name,P=w.version;O&&(x["apollographql-client-name"]=O),P&&(x["apollographql-client-version"]=P)}var R=j(j({},x),A.headers),F={http:A.http,options:A.fetchOptions,credentials:A.credentials,headers:R};if(qi(["client"],m.query)){var $=jl(m.query);if(!$)return _u(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=$}var te=nf(m,a,ry,g,F),J=te.options,ue=te.body;ue.variables&&!d&&(ue.variables=RE(ue.variables,m.query));var fe;!J.signal&&typeof AbortController<"u"&&(fe=new AbortController,J.signal=fe.signal);var qe=function(Te){return Te.kind==="OperationDefinition"&&Te.operation==="mutation"},ve=function(Te){return Te.kind==="OperationDefinition"&&Te.operation==="subscription"},De=ve(Bi(m.query)),je=qi(["defer"],m.query);if(f&&!m.query.definitions.some(qe)&&(J.method="GET"),je||De){J.headers=J.headers||{};var ge="multipart/mixed;";De&&je&&globalThis.__DEV__!==!1&&Me.warn(39),De?ge+="boundary=graphql;subscriptionSpec=1.0,application/json":je&&(ge+="deferSpec=20220824,application/json"),J.headers.accept=ge}if(J.method==="GET"){var Je=sy(b,ue),be=Je.newURI,ce=Je.parseError;if(ce)return _u(ce);b=be}else try{J.body=Eu(ue,"Payload")}catch(Te){return _u(Te)}return new Nt(function(Te){var Ne=n||Nn(function(){return fetch})||ay,Ee=Te.next.bind(Te);return Ne(b,J).then(function(nt){var Ot;m.setContext({response:nt});var ht=(Ot=nt.headers)===null||Ot===void 0?void 0:Ot.get("content-type");return ht!==null&&/^multipart\/mixed/i.test(ht)?YE(nt,Ee):ty(m)(nt).then(Ee)}).then(function(){fe=void 0,Te.complete()}).catch(function(nt){fe=void 0,ZE(nt,Te)}),function(){fe&&fe.abort()}})})},oy=function(r){Cn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,sf(t).request)||this;return n.options=t,n}return e}(Kr);const{toString:uy,hasOwnProperty:sO}=Object.prototype,cy=Function.prototype.toString,af=new Map;function Mt(r,e){try{return of(r,e)}finally{af.clear()}}function of(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(fy(r,e))return!0;const i=ly(r),a=ly(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!sO.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!of(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(fy(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&&!of(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=cy.call(r);return i!==cy.call(e)?!1:!uO(i,oO)}}return!1}function ly(r){return Object.keys(r).filter(aO,r)}function aO(r){return this[r]!==void 0}const oO="{ [native code] }";function uO(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function fy(r,e){let t=af.get(r);if(t){if(t.has(e))return!0}else af.set(r,t=new Set);return t.add(e),!1}function hy(r,e,t,n){var i=e.data,a=on(e,["data"]),u=t.data,c=on(t,["data"]);return Mt(a,c)&&Ou(Bi(r).selectionSet,i,u,{fragmentMap:Va(Qa(r)),variables:n})}function Ou(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),!Bs(a,n.variables))||dy(a))return!0;if(yi(a)){var u=mi(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return Mt(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(!Ou(h,c[m],f[m],n))return!1;return!0}return Ou(h,c,f,n)}else{var b=Wa(a,n.fragmentMap);if(b)return dy(b)?!0:Ou(b.selectionSet,e,t,n)}})}function dy(r){return!!r.directives&&r.directives.some(cO)}function cO(r){return r.name.value==="nonreactive"}var uf=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Ja(um,{max:Yn["cache.fragmentQueryDocuments"]||1e3,cache:ou})}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(j(j({},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=j(j({},f),{returnPartialData:!0,id:typeof a>"u"||typeof a=="string"?a:this.identify(a),query:h,optimistic:c}),y;return new Nt(function(g){return t.watch(j(j({},d),{immediate:!0,callback:function(m){if(!(y&&hy(h,{data:y==null?void 0:y.result},{data:m.result}))){var b={data:m.result,complete:!!m.complete};m.missing&&(b.missing=Za(m.missing.map(function(A){return A.missing}))),y=m,g.next(b)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(j(j({},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(j(j({},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(j(j({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(uf.prototype.getMemoryInternals=bS);var cf;cf||(cf={});var lf=function(r){Cn(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 ro(r){return r==null}function ff(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ro(n)?ro(i)?void 0:{_id:i}:{id:n}),ro(n)&&!ro(i)&&(n=i),!ro(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var py={dataIdFromObject:ff,addTypename:!0,resultCaching:!0,canonizeResults:!1};function lO(r){return Wi(py,r)}function my(r){var e=r.canonizeResults;return e===void 0?py.canonizeResults:e}function fO(r,e){return Ct(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var yy=/^[_a-z][_0-9a-z]*/i;function Hi(r){var e=r.match(yy);return e?e[0]:r}function hf(r,e,t){return er(e)?ur(e)?e.every(function(n){return hf(r,n,t)}):r.selections.every(function(n){if(yi(n)&&Bs(n,t)){var i=mi(n);return Rr.call(e,i)&&(!n.selectionSet||hf(n.selectionSet,e[i],t))}return!0}):!1}function Ys(r){return er(r)&&!Ct(r)&&!ur(r)}function hO(){return new gi}function gy(r,e){var t=Va(Qa(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Tu=Object.create(null),df=function(){return Tu},vy=Object.create(null),no=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 Gs(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 $i(i);if(Ct(i))return i;var u=n.policies.identify(i)[0];if(u){var c=$i(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return j({},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;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){Me(typeof i=="string",1);var c=new gi(pO).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=Hi(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:Tu,INVALIDATE:vy,isReference:Ct,toReference:this.toReference,canRead:this.canRead,readField:function(h,d){return n.policies.readField(typeof h=="string"?{fieldName:h,from:d||$i(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var d=Hi(h),y=i[h];if(y!==void 0){var g=typeof t=="function"?t:t[h]||t[d];if(g){var m=g===df?Tu:g(Gs(y),j(j({},f),{fieldName:d,storeFieldName:h,storage:n.getStorage(e,h)}));if(m===vy)n.group.dirty(e,h);else if(m===Tu&&(m=void 0),m!==y&&(a[h]=m,u=!0,y=m,globalThis.__DEV__!==!1)){var b=function(F){if(n.lookup(F.__ref)===void 0)return globalThis.__DEV__!==!1&&Me.warn(2,F),!0};if(Ct(m))b(m);else if(Array.isArray(m))for(var A=!1,x=void 0,w=0,O=m;w<O.length;w++){var P=O[w];if(Ct(P)){if(A=!0,b(P))break}else if(typeof P=="object"&&P){var R=n.policies.identify(P)[0];R&&(x=P)}if(A&&x!==void 0){globalThis.__DEV__!==!1&&Me.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]=df,i):df)}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){Ct(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}(),by=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?Dm():null,this.keyMaker=new Vs(ys)},r.prototype.depend=function(e,t){if(this.d){this.d(pf(e,t));var n=Hi(t);n!==t&&this.d(pf(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(pf(e,t),t==="__exists"?"forget":"setDirty")},r}();function pf(r,e){return e+"#"+r}function wy(r,e){io(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Cn(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 by(c))||this;return h.stump=new dO(h),h.storageTrie=new Vs(ys),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})(no||(no={}));var Qi=function(r){Cn(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){Mt(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 j(j({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Rr.call(this.data,t)?j(j({},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}(no),dO=function(r){Cn(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new by(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 pO(r,e,t){var n=r[t],i=e[t];return Mt(n,i)?n:i}function io(r){return!!(r instanceof no&&r.group.caching)}function mO(r){return er(r)?ur(r)?r.slice(0):j({__proto__:Object.getPrototypeOf(r)},r):r}var _y=function(){function r(){this.known=new(_l?WeakSet:Set),this.pool=new Vs(ys),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=mO(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 xy(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var yO=function(){function r(e){var t=this;this.knownResults=new(ys?WeakMap:Map),this.config=Wi(e,{addTypename:e.addTypename!==!1,canonizeResults:my(e)}),this.canon=e.canon||new _y,this.executeSelectionSet=Ja(function(n){var i,a=n.context.canonizeResults,u=xy(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?j(j({},c),{result:t.canon.admit(c.result)}):c:(wy(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Yn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:xy,makeCacheKey:function(n,i,a,u){if(io(a.store))return a.store.makeCacheKey(n,Ct(i)?i.__ref:i,a.varString,u)}}),this.executeSubSelectedArray=Ja(function(n){return wy(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(io(u.store))return u.store.makeCacheKey(i,a,u.varString)}})}return r.prototype.resetCanon=function(){this.canon=new _y},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=j(j({},fu(Pl(n))),u);var g=$i(a),m=this.executeSelectionSet({selectionSet:Bi(n).selectionSet,objectOrReference:g,enclosingRef:g,context:j({store:t,query:n,policies:y,variables:u,varString:pi(u),canonizeResults:d},gy(n,this.config.fragments))}),b;if(m.missing&&(b=[new lf(gO(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(io(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,d=h.getFieldValue(i,"__typename"),y=[],g,m=new gi;this.config.addTypename&&typeof d=="string"&&!f.rootIdsByTypename[d]&&y.push({__typename:d});function b(P,R){var F;return P.missing&&(g=m.merge(g,(F={},F[R]=P.missing,F))),P.result}var A=new Set(n.selections);A.forEach(function(P){var R,F;if(Bs(P,c))if(yi(P)){var $=f.readField({fieldName:P.name.value,field:P,variables:u.variables,from:i},u),te=mi(P);$===void 0?yu.added(P)||(g=m.merge(g,(R={},R[te]="Can't find field '".concat(P.name.value,"' on ").concat(Ct(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),R))):ur($)?$.length>0&&($=b(t.executeSubSelectedArray({field:P,array:$,enclosingRef:a,context:u}),te)):P.selectionSet?$!=null&&($=b(t.executeSelectionSet({selectionSet:P.selectionSet,objectOrReference:$,enclosingRef:Ct($)?$:a,context:u}),te)):u.canonizeResults&&($=t.canon.pass($)),$!==void 0&&y.push((F={},F[te]=$,F))}else{var J=Wa(P,u.lookupFragment);if(!J&&P.kind===Ce.FRAGMENT_SPREAD)throw Yr(9,P.name.value);J&&f.fragmentMatches(J,d)&&J.selectionSet.selections.forEach(A.add,A)}});var x=Za(y),w={result:x,missing:g},O=u.canonizeResults?this.canon.admit(w):Gs(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 gi;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:Ct(d)?d:a,context:u}),y):(globalThis.__DEV__!==!1&&vO(u.store,n,d),d)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function gO(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function vO(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){er(i)&&(Me(!Ct(i),10,fO(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var mf=new xm,Sy=new WeakMap;function so(r){var e=Sy.get(r);return e||Sy.set(r,e={vars:new Set,dep:Dm()}),e}function Ey(r){so(r).vars.forEach(function(e){return e.forgetCache(r)})}function bO(r){so(r).vars.forEach(function(e){return e.attachCache(r)})}function Oy(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(f){so(f).dep.dirty(n),wO(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=mf.getValue();c&&(i(c),so(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),so(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function wO(r){r.broadcastWatches&&r.broadcastWatches()}var Ty=Object.create(null);function yf(r){var e=JSON.stringify(r);return Ty[e]||(Ty[e]=Object.create(null))}function Ay(r){var e=yf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=gf(r,function(u){var c=Ks(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&Rr.call(t,u[0])&&(c=Ks(t,u,Py)),Me(c!==void 0,4,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function ky(r){var e=yf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=gf(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(w){return w.name.value===g}),b=m&&Ha(m,a);return b&&Ks(b,h.slice(1))}return}if(y==="$"){var A=d.slice(1);if(a&&Rr.call(a,A)){var x=h.slice(0);return x[0]=A,Ks(a,x)}return}if(t)return Ks(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function gf(r,e){var t=new gi;return Iy(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 Iy(r){var e=yf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ur(i)?(Iy(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 Py(r,e){return r[e]}function Ks(r,e,t){return t=t||Py,Cy(e.reduce(function n(i,a){return ur(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function Cy(r){return er(r)?ur(r)?r.map(Cy):gf(Object.keys(r).sort(),function(e){return Ks(r,e)}):r}function vf(r){return r.args!==void 0?r.args:r.field?Ha(r.field,r.variables):null}var _O=function(){},Ny=function(r,e){return e.fieldName},Ry=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Dy=function(r,e){return e},xO=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=j({dataIdFromObject:ff},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=j(j({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var g=bf(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(j(j({},e),u),c);if(ur(y))d=Ay(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?Ry:h===!1?Dy:f.merge}c(i,t.merge),i.keyFn=a===!1?_O:ur(a)?Ay(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?Ny:ur(y)?ky(y):typeof y=="function"?y:h.keyFn,typeof g=="function"&&(h.read=g),c(h,m)}h.read&&h.merge&&(h.keyFn=h.keyFn||Ny)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(Me(!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(yy);(!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 A=a.getSupertypeSet(b,!1);A&&A.size&&f.indexOf(A)<0&&f.push(A)},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&&Me.warn(6,t,u),c.add(u)),!0;m.forEach(h),d&&g===f.length-1&&hf(e.selectionSet,n,i)&&(d=!1,y=!0,this.fuzzySubtypes.forEach(function(b,A){var x=t.match(b);x&&x[0]===t&&h(A)}))}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=vf(e);u;){var h=u(f,c);if(ur(h))u=ky(h);else{a=h||n;break}}return a===void 0&&(a=e.field?mm(e.field,e.variables):Il(n,vf(e))),a===!1?n:n===Hi(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=Hi(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),d=h&&h.read;if(d){var y=Fy(this,n,e,t,t.store.getStorage(Ct(n)?n.__ref:n,u));return mf.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===Ry?My(i.store)(e,t):f===Dy?t:(i.overwrite&&(e=void 0),f(e,t,Fy(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function Fy(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Hi(a),c=t.variables||n.variables,f=n.store,h=f.toReference,d=f.canRead;return{args:vf(t),field:t.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:Ct,toReference:h,storage:i,cache:r.cache,canRead:d,readField:function(){return r.readField(bf(arguments,e,c),n)},mergeObjects:My(n.store)}}function bf(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=j({},n),Rr.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&Me.warn(7,fl(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function My(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(Ct(t)&&Ys(n))return r.merge(t.__ref,n),t;if(Ys(t)&&Ct(n))return r.merge(t,n.__ref),n;if(Ys(t)&&Ys(n))return j(j({},t),n)}return n}}function wf(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:j(j({},r),{clientOnly:e,deferred:t})),i}var SO=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=ws(i),d=hO();c=j(j({},fu(h)),c);var y=j(j({store:e,written:Object.create(null),merge:function(m,b){return d.merge(m,b)},variables:c,varString:pi(c)},gy(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(!Ct(g))throw Yr(11,a);return y.incomingById.forEach(function(m,b){var A=m.storeObject,x=m.mergeTree,w=m.fieldNodeSet,O=$i(b);if(x&&x.map.size){var P=n.applyMerges(x,O,A,y);if(Ct(P))return;A=P}if(globalThis.__DEV__!==!1&&!y.overwrite){var R=Object.create(null);w.forEach(function(te){te.selectionSet&&(R[te.name.value]=!0)});var F=function(te){return R[Hi(te)]===!0},$=function(te){var J=x&&x.map.get(te);return!!(J&&J.info&&J.info.merge)};Object.keys(A).forEach(function(te){F(te)&&!$(te)&&EO(O,A,te,y.store)})}e.merge(b,A)}),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]||cu(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof d=="string"&&(h.__typename=d);var y=function(){var P=bf(arguments,h,u.variables);if(Ct(P.from)){var R=u.incomingById.get(P.from.__ref);if(R){var F=f.readField(j(j({},P),{from:R.storeObject}),u);if(F!==void 0)return F}}return f.readField(P,u)},g=new Set;this.flattenFields(a,i,u,d).forEach(function(P,R){var F,$=mi(R),te=i[$];if(g.add(R),te!==void 0){var J=f.getStoreFieldName({typename:d,fieldName:R.name.value,field:R,variables:P.variables}),ue=jy(c,J),fe=t.processFieldValue(te,R,R.selectionSet?wf(P,!1,!1):P,ue),qe=void 0;R.selectionSet&&(Ct(fe)||Ys(fe))&&(qe=y("__typename",fe));var ve=f.getMergeFunction(d,R.name.value,qe);ve?ue.info={field:R,typename:d,merge:ve}:qy(c,J),h=P.merge(h,(F={},F[J]=fe,F))}else globalThis.__DEV__!==!1&&!P.clientOnly&&!P.deferred&&!yu.added(R)&&!f.getReadFunction(d,R.name.value)&&globalThis.__DEV__!==!1&&Me.error(12,mi(R),i)});try{var m=f.identify(i,{typename:d,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:y}),b=m[0],A=m[1];n=n||b,A&&(h=u.merge(h,A))}catch(P){if(!n)throw P}if(typeof n=="string"){var x=$i(n),w=u.written[n]||(u.written[n]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(i,x,a,u)))return x;var O=u.incomingById.get(n);return O?(O.storeObject=u.merge(O.storeObject,h),O.mergeTree=_f(O.mergeTree,c),g.forEach(function(P){return O.fieldNodeSet.add(P)})):u.incomingById.set(n,{storeObject:h,mergeTree:Au(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?Gl(e):e:ur(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,jy(i,c));return qy(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=cu(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new Vs(!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(Bs(g,n.variables)){var m=d.clientOnly,b=d.deferred;if(!(m&&b)&&mn(g.directives)&&g.directives.forEach(function(w){var O=w.name.value;if(O==="client"&&(m=!0),O==="defer"){var P=Ha(w,n.variables);(!P||P.if!==!1)&&(b=!0)}}),yi(g)){var A=a.get(g);A&&(m=m&&A.clientOnly,b=b&&A.deferred),a.set(g,wf(n,m,b))}else{var x=Wa(g,n.lookupFragment);if(!x&&g.kind===Ce.FRAGMENT_SPREAD)throw Yr(13,g.name.value);x&&u.fragmentMatches(x,i,t,n.variables)&&f(x.selectionSet,wf(n,m,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=!ur(n)&&(Ct(t)||Ys(t))?t:void 0,h=n;f&&!a&&(a=[Ct(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),A=y(h,m);if(A!==void 0){a&&a.push(m);var x=c.applyMerges(g,b,A,i,a);x!==A&&(d=d||new Map,d.set(m,x)),a&&Me(a.pop()===m)}}),d&&(n=ur(h)?h.slice(0):j({},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}(),Ly=[];function jy(r,e){var t=r.map;return t.has(e)||t.set(e,Ly.pop()||{map:new Map}),t.get(e)}function _f(r,e){if(r===e||!e||Au(e))return r;if(!r||Au(r))return e;var t=r.info&&e.info?j(j({},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,_f(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,_f(e.map.get(c),r.map.get(c)))})}return a}function Au(r){return!r||!(r.info||r.map.size)}function qy(r,e){var t=r.map,n=t.get(e);n&&Au(n)&&(Ly.push(n),t.delete(e))}var Uy=new Set;function EO(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&&!Ct(a)&&!Mt(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=Hi(t),h="".concat(c,".").concat(f);if(!Uy.has(h)){Uy.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&&Me.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,j({},a),j({},u))}}}}var xf=function(r){Cn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new pu(yu),n.assumeImmutableResults=!0,n.makeVar=Oy,n.txCount=0,n.config=lO(t),n.addTypename=!!n.config.addTypename,n.policies=new xO({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 no.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 SO(this,this.storeReader=new yO({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:my(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Ja(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(io(c)){var f=u.optimistic,h=u.id,d=u.variables;return c.makeCacheKey(u.query,u.callback,pi({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(j(j({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof lf)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(j(j({},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||bO(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Ey(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;pi.reset(),Hs.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&&Me.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Rr.call(t,"id"))return!1;t=j(j({},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(),Ey(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,A=m.optimisticData;++n.txCount,g&&(n.data=n.optimisticData=g);try{return h=i(n)}finally{--n.txCount,n.data=b,n.optimisticData=A}},y=new Set;return f&&!this.txCount&&this.broadcastWatches(j(j({},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(j(j({},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||!Mt(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(uf);globalThis.__DEV__!==!1&&(xf.prototype.getMemoryInternals=vS);var Et;(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"})(Et||(Et={}));function ao(r){return r?r<7:!1}function OO(r){return r===7||r===8}var $y=Object.assign,TO=Object.hasOwnProperty,ku=function(r){Cn(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,u=r.call(this,function(x){try{var w=x._subscription._observer;w&&!w.error&&(w.error=AO)}catch{}var O=!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),O&&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=Sf(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=j(j({},a),{initialFetchPolicy:b,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var A=ws(u.query);return u.queryName=A&&A.name&&A.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||Et.ready,a=j(j({},n),{loading:ao(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(Sf(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),Mt(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===Et.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=Et.ready,a.loading=!1)):a.partial=!0,globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Vy(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?!hy(this.query,this.last.result,t,this.variables):!Mt(this.last.result,t);return i||n&&!Mt(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Mt(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&&TO.call(t,"variables")){var u=Pl(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&Me.warn(20,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!Mt(this.options.variables,t)&&(i.variables=this.options.variables=j(j({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,Et.refetch)},e.prototype.fetchMore=function(t){var n=this,i=j(j({},t.query?t:j(j(j(j({},this.options),{query:this.options.query}),t),{variables:j(j({},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=Et.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set,h=t==null?void 0:t.updateQuery,d=this.options.fetchPolicy!=="no-cache";return d||Me(h,21),this.queryManager.fetchQuery(a,i,Et.fetchMore).then(function(y){if(n.queryManager.removeQuery(a),u.networkStatus===Et.fetchMore&&(u.networkStatus=c),d)n.queryManager.cache.batch({update:function(b){var A=t.updateQuery;A?b.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(x){return A(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(j(j({},g),{data:m}),n.variables)}return y}).finally(function(){d&&!f.has(n.query)&&By(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&&Me.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=Wi(this.options,t||{});$y(this.options,n)},e.prototype.setVariables=function(t){return Mt(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},Et.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)){Me(a,23);var u=i||(this.pollingInfo={});u.interval=a;var c=function(){var h,d;t.pollingInfo&&(!ao(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"},Et.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&&!Mt(n,this.last.variables)&&(i=void 0),this.last=j({result:this.queryManager.assumeImmutableResults?t:Gl(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===Et.refetch||n===Et.fetchMore||n===Et.poll,u=this.options.variables,c=this.options.fetchPolicy,f=Wi(this.options,t||{}),h=a?f:$y(this.options,f),d=this.transformDocument(h.query);this.lastQuery=d,a||(this.updatePolling(),t&&t.variables&&!Mt(t.variables,u)&&h.fetchPolicy!=="standby"&&(h.fetchPolicy===c||typeof h.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=Et.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Sf(h.fetchPolicy));var y=function(){i.concast===b&&(i.waitForOwnResult=!1)},g=h.variables&&j({},h.variables),m=this.fetch(h,n,d),b=m.concast,A=m.fromLink,x={next:function(w){Mt(i.variables,g)&&(y(),i.reportResult(w,g))},error:function(w){Mt(i.variables,g)&&(tf(w)||(w=new yn({networkError:w})),y(),i.reportError(w,g))}};return!a&&(A||!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)&&Js(this.observers,"next",t)},e.prototype.reportError=function(t,n){var i=j(j({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:Et.error,loading:!1});this.updateLastResult(i,n),Js(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}(Nt);Yl(ku);function By(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 AO(r){globalThis.__DEV__!==!1&&Me.error(24,r.message,r.stack)}function Vy(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&Me.debug(25,r)}function Sf(r){return r==="network-only"||r==="no-cache"||r==="standby"}var Zs=new(ys?WeakMap:Map);function Ef(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Zs.set(r,(Zs.get(r)+1)%1e15),t.apply(this,arguments)})}function Wy(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Of=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;Zs.has(n)||(Zs.set(n,0),Ef(n,"evict"),Ef(n,"modify"),Ef(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||Et.loading;return this.variables&&this.networkStatus!==Et.loading&&!Mt(this.variables,e.variables)&&(t=Et.setVariables),Mt(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(){Wy(this),this.dirty=!1},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&Mt(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&&!Mt(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():By(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;Wy(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(ao(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=j(j({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Mt(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===Zs.get(this.cache)&&Mt(t,n.variables)&&Mt(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u=new gi,c=mn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&mn(e.incremental)){var f=Kl(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&&(Tf(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:Zs.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&&Mt(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=Et.ready},r.prototype.markError=function(e){return this.networkStatus=Et.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Tf(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!eo(r);return!n&&t&&r.data&&(n=!0),n}var kO=Object.prototype.hasOwnProperty,zy=Object.create(null),IO=function(){function r(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new uu(Yn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Vs(!1);var n=new pu(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 Li(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,A=b===void 0?[]:b,x=t.awaitRefetchQueries,w=x===void 0?!1:x,O=t.update,P=t.onQueryUpdated,R=t.fetchPolicy,F=R===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":R,$=t.errorPolicy,te=$===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":$,J=t.keepRootFields,ue=t.context;return ji(this,function(fe){switch(fe.label){case 0:return Me(d,27),Me(F==="network-only"||F==="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,ue)]:[3,2];case 1:y=fe.sent(),fe.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:F,errorPolicy:te,context:ue,updateQueries:m,update:O,keepRootFields:J}),this.broadcastQueries(),c=this,[2,new Promise(function(qe,ve){return bu(c.getObservableFromLink(d,j(j({},ue),{optimisticResponse:u?g:void 0}),y,{},!1),function(De){if(eo(De)&&te==="none")throw new yn({graphQLErrors:wu(De)});a&&(a.loading=!1,a.error=null);var je=j({},De);return typeof A=="function"&&(A=A(je)),te==="ignore"&&eo(je)&&delete je.errors,c.markMutationResult({mutationId:n,result:je,document:d,variables:y,fetchPolicy:F,errorPolicy:te,context:ue,update:O,updateQueries:m,awaitRefetchQueries:w,refetchQueries:A,removeOptimistic:u?n:void 0,onQueryUpdated:P,keepRootFields:J})}).subscribe({next:function(De){c.broadcastQueries(),(!("hasNext"in De)||De.hasNext===!1)&&qe(De)},error:function(De){a&&(a.loading=!1,a.error=De),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),ve(De instanceof yn?De:new yn({networkError:De}))}})})]}})})},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&&Tf(i,e.errorPolicy)){if(xs(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),xs(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=Kl(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||!kO.call(h,b))){var A=h[b],x=n.queries.get(g),w=x.document,O=x.variables,P=t.diff({query:w,variables:O,returnPartialData:!0,optimistic:!1}),R=P.result,F=P.complete;if(F&&R){var $=A(R,{mutationResult:i,queryName:w&&lu(w)||void 0,queryVariables:O});$&&a.push({result:$,dataId:"ROOT_QUERY",query:w,variables:O})}}})}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(A){return y.write(A)});var g=e.update,m=!Gm(i)||xs(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=j(j({},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(A,x){var w=x.fieldName,O=x.DELETE;return w==="__typename"?A:O}})},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:zy}):e;return i===zy?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(j(j({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&Me.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:rm(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:qi(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:mu([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:fu(ws(e)),asQuery:j(j({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?j(j({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return j(j({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=j(j({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new Of(this),i=new ku({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()),Me(e.query,29),Me(e.query.kind==="Document",30),Me(!e.returnPartialData,31),Me(!e.pollInterval,32),this.fetchQuery(t,j(j({},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=Et.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):pm(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=Xo("legacyOneTimeQuery"),f=t.getQuery(c).init({document:u.query,variables:u.variables}),h=new ku({queryManager:t,queryInfo:f,options:j(j({},u),{fetchPolicy:"network-only"})});Me(h.queryId===c),f.setObservableQuery(h),n.set(c,h)}),globalThis.__DEV__!==!1&&i.size&&i.forEach(function(u,c){u||globalThis.__DEV__!==!1&&Me.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(A){i!=="no-cache"&&(Tf(A,u)&&t.cache.write({query:n,result:A.data,dataId:"ROOT_SUBSCRIPTION",variables:b}),t.broadcastQueries());var x=eo(A),w=GE(A);if(x||w){var O={};if(x&&(O.graphQLErrors=A.errors),w&&(O.protocolErrors=A.extensions[ef]),u==="none"||w)throw new yn(O)}return u==="ignore"&&delete A.errors,A})};if(this.getDocumentInfo(n).hasClientExports){var m=this.localState.addExportedVariables(n,c,h).then(g);return new Nt(function(b){var A=null;return m.then(function(x){return A=x.subscribe(b)},b.error),function(){return A&&A.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,A={query:d,variables:n,operationName:lu(d)||void 0,context:this.prepareContext(j(j({},t),{forceFetch:!a})),extensions:i};if(t=A.context,a){var x=Hs(d),w=pi(n),O=m.lookup(x,w);if(f=O.observable,!f){var P=new _s([Su(b,A)]);f=O.observable=P,P.beforeNext(function(){m.remove(x,w)})}}else f=new _s([Su(b,A)])}else f=new _s([Nt.of({data:{}})]),t=this.prepareContext(t);return y&&(f=bu(f,function(R){return u.localState.runResolvers({document:y,remoteResult:R,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 bu(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=wu(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:Et.ready};return f&&h==="none"&&(d.data=void 0),f&&h!=="ignore"&&(d.errors=c,d.networkStatus=Et.error),d},function(u){var c=tf(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=Et.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,A=t.notifyOnNetworkStatusChange,x=A===void 0?!1:A,w=t.context,O=w===void 0?{}:w,P=Object.assign({},t,{query:i,variables:u,fetchPolicy:d,errorPolicy:g,returnPartialData:b,notifyOnNetworkStatusChange:x,context:O}),R=function(ue){P.variables=ue;var fe=a.fetchQueryByPolicy(c,P,n);return P.fetchPolicy!=="standby"&&fe.sources.length>0&&c.observableQuery&&c.observableQuery.applyNextFetchPolicy("after-fetch",t),fe},F=function(){return a.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(ue){F(),setTimeout(function(){return $.cancel(ue)})});var $,te;if(this.getDocumentInfo(P.query).hasClientExports)$=new _s(this.localState.addExportedVariables(P.query,P.variables,P.context).then(R).then(function(ue){return ue.sources})),te=!0;else{var J=R(P.variables);te=J.fromLink,$=new _s(J.sources)}return $.promise.then(F,F),{concast:$,fromLink:te}},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?Xo("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 A=g.watcher instanceof Of&&g.watcher.observableQuery;if(A){if(h){d.delete(A.queryId);var x=h(A,m,b);return x===!0&&(x=A.refetch()),x!==!1&&y.set(A,x),x}h!==null&&d.set(A.queryId,{oq:A,lastDiff:b,diff:m})}}}),d.size&&d.forEach(function(g,m){var b=g.oq,A=g.lastDiff,x=g.diff,w;if(h){if(!x){var O=b.queryInfo;O.reset(),x=O.getDiff()}w=h(b,x,A)}(!h||w===!0)&&(w=b.refetch()),w!==!1&&y.set(b,w),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()},A=function(R,F){F===void 0&&(F=e.networkStatus||Et.loading);var $=R.result;globalThis.__DEV__!==!1&&!d&&!Mt($,{})&&Vy(R.missing);var te=function(J){return Nt.of(j({data:J,loading:ao(F),networkStatus:F},R.complete?null:{partial:!0}))};return $&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:$},context:y,variables:u,onlyRunForcedResolvers:!0}).then(function(J){return te(J.data||void 0)}):h==="none"&&F===Et.refetch&&Array.isArray(R.missing)?te(void 0):te($)},x=c==="no-cache"?0:n===Et.refetch&&f!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,x,{query:a,variables:u,context:y,fetchPolicy:c,errorPolicy:h})},O=g&&typeof m=="number"&&m!==n&&ao(n);switch(c){default:case"cache-first":{var P=b();return P.complete?{fromLink:!1,sources:[A(P,e.markReady())]}:d||O?{fromLink:!0,sources:[A(P),w()]}:{fromLink:!0,sources:[w()]}}case"cache-and-network":{var P=b();return P.complete||d||O?{fromLink:!0,sources:[A(P),w()]}:{fromLink:!0,sources:[w()]}}case"cache-only":return{fromLink:!1,sources:[A(b(),e.markReady())]};case"network-only":return O?{fromLink:!0,sources:[A(b()),w()]}:{fromLink:!0,sources:[w()]};case"no-cache":return O?{fromLink:!0,sources:[A(e.getDiff()),w()]}:{fromLink:!0,sources:[w()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Of(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return j(j(j({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),PO=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=Ka(t.resolvers,n)}):this.resolvers=Ka(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 Li(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 j(j({},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 qi(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return jl(e)},r.prototype.prepareContext=function(e){var t=this.cache;return j(j({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return Li(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 j(j({},n),u.exportedVariables)})]:[2,j({},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 wl}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:qm(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return Li(this,arguments,void 0,function(n,i,a,u,c,f){var h,d,y,g,m,b,A,x,w,O,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(R){return h=Bi(n),d=Qa(n),y=Va(d),g=this.collectSelectionsToResolve(h,y),m=h.operation,b=m?m.charAt(0).toUpperCase()+m.slice(1):"Query",A=this,x=A.cache,w=A.client,O={fragmentMap:y,context:j(j({},a),{cache:x,client:w}),variables:u,fragmentMatcher:c,defaultOperationType:b,exportedVariables:{},selectionsToResolve:g,onlyRunForcedResolvers:f},P=!1,[2,this.resolveSelectionSet(h.selectionSet,P,i,O).then(function(F){return{result:F,exportedVariables:O.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Li(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 Li(d,void 0,void 0,function(){var m,b;return ji(this,function(A){return!t&&!i.selectionsToResolve.has(g)?[2]:Bs(g,c)?yi(g)?[2,this.resolveField(g,t,n,i).then(function(x){var w;typeof x<"u"&&f.push((w={},w[mi(g)]=x,w))})]:(ym(g)?m=g:(m=a[g.name.value],Me(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 Za(f)})]})})},r.prototype.resolveField=function(e,t,n,i){return Li(this,void 0,void 0,function(){var a,u,c,f,h,d,y,g,m,b=this;return ji(this,function(A){return n?(a=i.variables,u=e.name.value,c=mi(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(mf.withValue(this.cache,m,[n,Ha(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,d.then(function(x){var w,O;if(x===void 0&&(x=h),e.directives&&e.directives.forEach(function(R){R.name.value==="export"&&R.arguments&&R.arguments.forEach(function(F){F.name.value==="as"&&F.value.kind==="StringValue"&&(i.exportedVariables[F.value.value]=x)})}),!e.selectionSet||x==null)return x;var P=(O=(w=e.directives)===null||w===void 0?void 0:w.some(function(R){return R.name.value==="client"}))!==null&&O!==void 0?O:!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)&&tm(m)&&c.add(m)})},FragmentSpread:function(f,h,d,y,g){var m=t[f.name.value];Me(m,19,f.name.value);var b=a(m);b.size>0&&(g.forEach(function(A){n(A)&&tm(A)&&c.add(A)}),c.add(f),b.forEach(function(A){c.add(A)}))}})}return i.get(u)}return a(e)},r}(),Hy=!1,Af=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,A=e.defaultOptions,x=e.defaultContext,w=e.assumeImmutableResults,O=w===void 0?u.assumeImmutableResults:w,P=e.resolvers,R=e.typeDefs,F=e.fragmentMatcher,$=e.name,te=e.version,J=e.devtools,ue=e.link;ue||(ue=n?new oy({uri:n,credentials:i,headers:a}):Kr.empty()),this.link=ue,this.cache=u,this.disableNetworkFetches=h||y>0,this.queryDeduplication=b,this.defaultOptions=A||Object.create(null),this.typeDefs=R,this.devtoolsConfig=j(j({},J),{enabled:(J==null?void 0:J.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=cl,this.localState=new PO({cache:u,client:this,resolvers:P,fragmentMatcher:F}),this.queryManager=new IO({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:x,documentTransform:c,queryDeduplication:b,ssrMode:h,clientAwareness:{name:$,version:te},localState:this.localState,assumeImmutableResults:O,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,!Hy&&globalThis.__DEV__!==!1&&(Hy=!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&&Me.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=zi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=zi(this.defaultOptions.query,e)),Me(e.fetchPolicy!=="cache-and-network",16),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=zi(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 Su(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&&Me.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&&(Af.prototype.getMemoryInternals=gS);var Iu=new Map,kf=new Map,Qy=!0,Pu=!1;function Gy(r){return r.replace(/[\s,]+/g," ").trim()}function CO(r){return Gy(r.source.body.substring(r.start,r.end))}function NO(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=CO(n.loc),u=kf.get(i);u&&!u.has(a)?Qy&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
83
|
+
`),O=KE(x.slice(0,w)),C=O["content-type"],C&&C.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");if(D=x.slice(w),D){if(F=ey(r,D),Object.keys(F).length>1||"data"in F||"incremental"in F||"errors"in F||"payload"in F)if(Jm(F)){if(B={},"payload"in F){if(Object.keys(F).length===1&&F.payload===null)return[2];B=j({},F.payload)}"errors"in F&&(B=j(j({},B),{extensions:j(j({},"extensions"in B?B.extensions:null),(Q={},Q[rf]=F.errors,Q))})),e(B)}else e(F);else if(Object.keys(F).length===1&&"hasNext"in F&&!F.hasNext)return[2]}A=c.indexOf(u)}return[3,1];case 3:return[2]}})})}function KE(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 ey(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};tf(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 ZE(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function ty(r){return function(e){return e.text().then(function(t){return ey(e,t)}).then(function(t){return!Array.isArray(t)&&!Xm.call(t,"data")&&!Xm.call(t,"errors")&&tf(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Tu=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=Jr(40,e,i.message);throw n.parseError=i,n}return t},XE={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},eO={accept:"*/*","content-type":"application/json"},tO={method:"POST"},ry={http:XE,headers:eO,options:tO},sf=function(r,e){return e(r)};function rO(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),af.apply(void 0,br([r,sf],t,!1))}function af(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(y){i=j(j(j({},i),y.options),{headers:j(j({},i.headers),y.headers)}),y.credentials&&(i.credentials=y.credentials),a=j(j({},a),y.http)}),i.headers&&(i.headers=nO(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,Hs)),{options:i,body:d}}function nO(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 ny=function(r){if(!r&&typeof fetch>"u")throw Jr(38)},iO=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},iy=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=Tu(e.variables,"Variables map")}catch(y){return{parseError:y}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Tu(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 ay=Nn(function(){return fetch}),of=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?sf:i,u=r.includeExtensions,c=r.preserveHeaderCase,f=r.useGETForQueries,h=r.includeUnusedVariables,d=h===void 0?!1:h,y=an(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&ny(n||ay);var g={http:{includeExtensions:u,preserveHeaderCase:c},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Yr(function(m){var b=iy(m,t),A=m.getContext(),x={};if(A.clientAwareness){var w=A.clientAwareness,O=w.name,C=w.version;O&&(x["apollographql-client-name"]=O),C&&(x["apollographql-client-version"]=C)}var D=j(j({},x),A.headers),F={http:A.http,options:A.fetchOptions,credentials:A.credentials,headers:D};if(qi(["client"],m.query)){var B=Ul(m.query);if(!B)return Su(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=B}var ee=af(m,a,ry,g,F),Q=ee.options,re=ee.body;re.variables&&!d&&(re.variables=RE(re.variables,m.query));var fe;!Q.signal&&typeof AbortController<"u"&&(fe=new AbortController,Q.signal=fe.signal);var ge=function(Ae){return Ae.kind==="OperationDefinition"&&Ae.operation==="mutation"},he=function(Ae){return Ae.kind==="OperationDefinition"&&Ae.operation==="subscription"},ve=he(Bi(m.query)),Ie=qi(["defer"],m.query);if(f&&!m.query.definitions.some(ge)&&(Q.method="GET"),Ie||ve){Q.headers=Q.headers||{};var ye="multipart/mixed;";ve&&Ie&&globalThis.__DEV__!==!1&&je.warn(39),ve?ye+="boundary=graphql;subscriptionSpec=1.0,application/json":Ie&&(ye+="deferSpec=20220824,application/json"),Q.headers.accept=ye}if(Q.method==="GET"){var Be=sy(b,re),_e=Be.newURI,ce=Be.parseError;if(ce)return Su(ce);b=_e}else try{Q.body=Tu(re,"Payload")}catch(Ae){return Su(Ae)}return new Rt(function(Ae){var Me=n||Nn(function(){return fetch})||ay,Oe=Ae.next.bind(Ae);return Me(b,Q).then(function(tt){var Tt;m.setContext({response:tt});var ft=(Tt=tt.headers)===null||Tt===void 0?void 0:Tt.get("content-type");return ft!==null&&/^multipart\/mixed/i.test(ft)?YE(tt,Oe):ty(m)(tt).then(Oe)}).then(function(){fe=void 0,Ae.complete()}).catch(function(tt){fe=void 0,ZE(tt,Ae)}),function(){fe&&fe.abort()}})})},oy=function(r){Pn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,of(t).request)||this;return n.options=t,n}return e}(Yr);const{toString:uy,hasOwnProperty:sO}=Object.prototype,cy=Function.prototype.toString,uf=new Map;function Lt(r,e){try{return cf(r,e)}finally{uf.clear()}}function cf(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(fy(r,e))return!0;const i=ly(r),a=ly(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!sO.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!cf(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(fy(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&&!cf(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=cy.call(r);return i!==cy.call(e)?!1:!uO(i,oO)}}return!1}function ly(r){return Object.keys(r).filter(aO,r)}function aO(r){return this[r]!==void 0}const oO="{ [native code] }";function uO(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function fy(r,e){let t=uf.get(r);if(t){if(t.has(e))return!0}else uf.set(r,t=new Set);return t.add(e),!1}function hy(r,e,t,n){var i=e.data,a=an(e,["data"]),u=t.data,c=an(t,["data"]);return Lt(a,c)&&Au(Bi(r).selectionSet,i,u,{fragmentMap:Wa(Qa(r)),variables:n})}function Au(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),!Bs(a,n.variables))||dy(a))return!0;if(gi(a)){var u=yi(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return Lt(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(!Au(h,c[m],f[m],n))return!1;return!0}return Au(h,c,f,n)}else{var b=za(a,n.fragmentMap);if(b)return dy(b)?!0:Au(b.selectionSet,e,t,n)}})}function dy(r){return!!r.directives&&r.directives.some(cO)}function cO(r){return r.name.value==="nonreactive"}var lf=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Ya(um,{max:Yn["cache.fragmentQueryDocuments"]||1e3,cache:cu})}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(j(j({},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),d=j(j({},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(j(j({},d),{immediate:!0,callback:function(m){if(!(y&&hy(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(A){return A.missing}))),y=m,g.next(b)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(j(j({},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(j(j({},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(j(j({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(lf.prototype.getMemoryInternals=bS);var ff;ff||(ff={});var hf=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),Nr=Object.prototype.hasOwnProperty;function no(r){return r==null}function df(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 py={dataIdFromObject:df,addTypename:!0,resultCaching:!0,canonizeResults:!1};function lO(r){return Wi(py,r)}function my(r){var e=r.canonizeResults;return e===void 0?py.canonizeResults:e}function fO(r,e){return Nt(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var yy=/^[_a-z][_0-9a-z]*/i;function Hi(r){var e=r.match(yy);return e?e[0]:r}function pf(r,e,t){return Kt(e)?or(e)?e.every(function(n){return pf(r,n,t)}):r.selections.every(function(n){if(gi(n)&&Bs(n,t)){var i=yi(n);return Nr.call(e,i)&&(!n.selectionSet||pf(n.selectionSet,e[i],t))}return!0}):!1}function Ys(r){return Kt(r)&&!Nt(r)&&!or(r)}function hO(){return new vi}function gy(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 ku=Object.create(null),mf=function(){return ku},vy=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 Qs(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 $i(i);if(Nt(i))return i;var u=n.policies.identify(i)[0];if(u){var c=$i(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return j({},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),Nr.call(this.data,e)){var n=this.data[e];if(n&&Nr.call(n,t))return n[t]}if(t==="__typename"&&Nr.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Gi)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Nr.call(this.data,e))return this.data[e];if(this instanceof Gi)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){je(typeof i=="string",1);var c=new vi(pO).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=Hi(h);d!==h&&!n.policies.hasKeyArgs(c.__typename,d)&&(f[d]=1),c[h]===void 0&&!(n instanceof Gi)&&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:ku,INVALIDATE:vy,isReference:Nt,toReference:this.toReference,canRead:this.canRead,readField:function(h,d){return n.policies.readField(typeof h=="string"?{fieldName:h,from:d||$i(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var d=Hi(h),y=i[h];if(y!==void 0){var g=typeof t=="function"?t:t[h]||t[d];if(g){var m=g===mf?ku:g(Qs(y),j(j({},f),{fieldName:d,storeFieldName:h,storage:n.getStorage(e,h)}));if(m===vy)n.group.dirty(e,h);else if(m===ku&&(m=void 0),m!==y&&(a[h]=m,u=!0,y=m,globalThis.__DEV__!==!1)){var b=function(F){if(n.lookup(F.__ref)===void 0)return globalThis.__DEV__!==!1&&je.warn(2,F),!0};if(Nt(m))b(m);else if(Array.isArray(m))for(var A=!1,x=void 0,w=0,O=m;w<O.length;w++){var C=O[w];if(Nt(C)){if(A=!0,b(C))break}else if(typeof C=="object"&&C){var D=n.policies.identify(C)[0];D&&(x=C)}if(A&&x!==void 0){globalThis.__DEV__!==!1&&je.warn(3,x);break}}}}y!==void 0&&(c=!1)}}),u)return this.merge(e,a),c&&(this instanceof Gi?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]=mf,i):mf)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Nr.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Gi&&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){Nr.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&&Nr.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 Gi?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){Nr.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 Gi;)a=a.parent;i.forEach(function(u){return a.delete(u)})}return i},r.prototype.findChildRefIds=function(e){if(!Nr.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),Kt(a)&&Object.keys(a).forEach(function(u){var c=a[u];Kt(c)&&i.add(c)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),by=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?Dm():null,this.keyMaker=new Vs(ys)},r.prototype.depend=function(e,t){if(this.d){this.d(yf(e,t));var n=Hi(t);n!==t&&this.d(yf(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(yf(e,t),t==="__exists"?"forget":"setDirty")},r}();function yf(r,e){return e+"#"+r}function wy(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 by(c))||this;return h.stump=new dO(h),h.storageTrie=new Vs(ys),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 Gi=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){Lt(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 j(j({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Nr.call(this.data,t)?j(j({},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),dO=function(r){Pn(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new by(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}(Gi);function pO(r,e,t){var n=r[t],i=e[t];return Lt(n,i)?n:i}function so(r){return!!(r instanceof io&&r.group.caching)}function mO(r){return Kt(r)?or(r)?r.slice(0):j({__proto__:Object.getPrototypeOf(r)},r):r}var _y=function(){function r(){this.known=new(Sl?WeakSet:Set),this.pool=new Vs(ys),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return Kt(e)&&this.known.has(e)},r.prototype.pass=function(e){if(Kt(e)){var t=mO(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(Kt(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 xy(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var yO=function(){function r(e){var t=this;this.knownResults=new(ys?WeakMap:Map),this.config=Wi(e,{addTypename:e.addTypename!==!1,canonizeResults:my(e)}),this.canon=e.canon||new _y,this.executeSelectionSet=Ya(function(n){var i,a=n.context.canonizeResults,u=xy(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?j(j({},c),{result:t.canon.admit(c.result)}):c:(wy(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Yn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:xy,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 wy(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 _y},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=j(j({},du(Nl(n))),u);var g=$i(a),m=this.executeSelectionSet({selectionSet:Bi(n).selectionSet,objectOrReference:g,enclosingRef:g,context:j({store:t,query:n,policies:y,variables:u,varString:mi(u),canonizeResults:d},gy(n,this.config.fragments))}),b;if(m.missing&&(b=[new hf(gO(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(C,D){var F;return C.missing&&(g=m.merge(g,(F={},F[D]=C.missing,F))),C.result}var A=new Set(n.selections);A.forEach(function(C){var D,F;if(Bs(C,c))if(gi(C)){var B=f.readField({fieldName:C.name.value,field:C,variables:u.variables,from:i},u),ee=yi(C);B===void 0?vu.added(C)||(g=m.merge(g,(D={},D[ee]="Can't find field '".concat(C.name.value,"' on ").concat(Nt(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),D))):or(B)?B.length>0&&(B=b(t.executeSubSelectedArray({field:C,array:B,enclosingRef:a,context:u}),ee)):C.selectionSet?B!=null&&(B=b(t.executeSelectionSet({selectionSet:C.selectionSet,objectOrReference:B,enclosingRef:Nt(B)?B:a,context:u}),ee)):u.canonizeResults&&(B=t.canon.pass(B)),B!==void 0&&y.push((F={},F[ee]=B,F))}else{var Q=za(C,u.lookupFragment);if(!Q&&C.kind===De.FRAGMENT_SPREAD)throw Jr(9,C.name.value);Q&&f.fragmentMatches(Q,d)&&Q.selectionSet.selections.forEach(A.add,A)}});var x=Xa(y),w={result:x,missing:g},O=u.canonizeResults?this.canon.admit(w):Qs(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(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:or(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&&vO(u.store,n,d),d)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function gO(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function vO(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){Kt(i)&&(je(!Nt(i),10,fO(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var gf=new xm,Sy=new WeakMap;function ao(r){var e=Sy.get(r);return e||Sy.set(r,e={vars:new Set,dep:Dm()}),e}function Ey(r){ao(r).vars.forEach(function(e){return e.forgetCache(r)})}function bO(r){ao(r).vars.forEach(function(e){return e.attachCache(r)})}function Oy(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),wO(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=gf.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 wO(r){r.broadcastWatches&&r.broadcastWatches()}var Ty=Object.create(null);function vf(r){var e=JSON.stringify(r);return Ty[e]||(Ty[e]=Object.create(null))}function Ay(r){var e=vf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=bf(r,function(u){var c=Ks(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&Nr.call(t,u[0])&&(c=Ks(t,u,Cy)),je(c!==void 0,4,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function ky(r){var e=vf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=bf(r,function(h){var d=h[0],y=d.charAt(0);if(y==="@"){if(i&&yn(i.directives)){var g=d.slice(1),m=i.directives.find(function(w){return w.name.value===g}),b=m&&Ga(m,a);return b&&Ks(b,h.slice(1))}return}if(y==="$"){var A=d.slice(1);if(a&&Nr.call(a,A)){var x=h.slice(0);return x[0]=A,Ks(a,x)}return}if(t)return Ks(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function bf(r,e){var t=new vi;return Iy(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 Iy(r){var e=vf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){or(i)?(Iy(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 Cy(r,e){return r[e]}function Ks(r,e,t){return t=t||Cy,Py(e.reduce(function n(i,a){return or(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function Py(r){return Kt(r)?or(r)?r.map(Py):bf(Object.keys(r).sort(),function(e){return Ks(r,e)}):r}function wf(r){return r.args!==void 0?r.args:r.field?Ga(r.field,r.variables):null}var _O=function(){},Ny=function(r,e){return e.fieldName},Ry=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Dy=function(r,e){return e},xO=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=j({dataIdFromObject:df},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=j(j({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var g=_f(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(j(j({},e),u),c);if(or(y))d=Ay(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=an(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),u&&t.setRootTypename("Mutation",n),c&&t.setRootTypename("Subscription",n),Nr.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?Ry:h===!1?Dy:f.merge}c(i,t.merge),i.keyFn=a===!1?_O:or(a)?Ay(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?Ny:or(y)?ky(y):typeof y=="function"?y:h.keyFn,typeof g=="function"&&(h.read=g),c(h,m)}h.read&&h.merge&&(h.keyFn=h.keyFn||Ny)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(je(!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(yy);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Nr.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 A=a.getSupertypeSet(b,!1);A&&A.size&&f.indexOf(A)<0&&f.push(A)},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&&je.warn(6,t,u),c.add(u)),!0;m.forEach(h),d&&g===f.length-1&&pf(e.selectionSet,n,i)&&(d=!1,y=!0,this.fuzzySubtypes.forEach(function(b,A){var x=t.match(b);x&&x[0]===t&&h(A)}))}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=wf(e);u;){var h=u(f,c);if(or(h))u=ky(h);else{a=h||n;break}}return a===void 0&&(a=e.field?mm(e.field,e.variables):Pl(n,wf(e))),a===!1?n:n===Hi(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=Hi(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),d=h&&h.read;if(d){var y=My(this,n,e,t,t.store.getStorage(Nt(n)?n.__ref:n,u));return gf.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===Ry?Fy(i.store)(e,t):f===Dy?t:(i.overwrite&&(e=void 0),f(e,t,My(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function My(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Hi(a),c=t.variables||n.variables,f=n.store,h=f.toReference,d=f.canRead;return{args:wf(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(_f(arguments,e,c),n)},mergeObjects:Fy(n.store)}}function _f(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=j({},n),Nr.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&je.warn(7,dl(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function Fy(r){return function(t,n){if(or(t)||or(n))throw Jr(8);if(Kt(t)&&Kt(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),u=i&&a&&i!==a;if(u)return n;if(Nt(t)&&Ys(n))return r.merge(t.__ref,n),t;if(Ys(t)&&Nt(n))return r.merge(t,n.__ref),n;if(Ys(t)&&Ys(n))return j(j({},t),n)}return n}}function xf(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:j(j({},r),{clientOnly:e,deferred:t})),i}var SO=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=ws(i),d=hO();c=j(j({},du(h)),c);var y=j(j({store:e,written:Object.create(null),merge:function(m,b){return d.merge(m,b)},variables:c,varString:mi(c)},gy(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 Jr(11,a);return y.incomingById.forEach(function(m,b){var A=m.storeObject,x=m.mergeTree,w=m.fieldNodeSet,O=$i(b);if(x&&x.map.size){var C=n.applyMerges(x,O,A,y);if(Nt(C))return;A=C}if(globalThis.__DEV__!==!1&&!y.overwrite){var D=Object.create(null);w.forEach(function(ee){ee.selectionSet&&(D[ee.name.value]=!0)});var F=function(ee){return D[Hi(ee)]===!0},B=function(ee){var Q=x&&x.map.get(ee);return!!(Q&&Q.info&&Q.info.merge)};Object.keys(A).forEach(function(ee){F(ee)&&!B(ee)&&EO(O,A,ee,y.store)})}e.merge(b,A)}),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]||fu(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof d=="string"&&(h.__typename=d);var y=function(){var C=_f(arguments,h,u.variables);if(Nt(C.from)){var D=u.incomingById.get(C.from.__ref);if(D){var F=f.readField(j(j({},C),{from:D.storeObject}),u);if(F!==void 0)return F}}return f.readField(C,u)},g=new Set;this.flattenFields(a,i,u,d).forEach(function(C,D){var F,B=yi(D),ee=i[B];if(g.add(D),ee!==void 0){var Q=f.getStoreFieldName({typename:d,fieldName:D.name.value,field:D,variables:C.variables}),re=jy(c,Q),fe=t.processFieldValue(ee,D,D.selectionSet?xf(C,!1,!1):C,re),ge=void 0;D.selectionSet&&(Nt(fe)||Ys(fe))&&(ge=y("__typename",fe));var he=f.getMergeFunction(d,D.name.value,ge);he?re.info={field:D,typename:d,merge:he}:qy(c,Q),h=C.merge(h,(F={},F[Q]=fe,F))}else globalThis.__DEV__!==!1&&!C.clientOnly&&!C.deferred&&!vu.added(D)&&!f.getReadFunction(d,D.name.value)&&globalThis.__DEV__!==!1&&je.error(12,yi(D),i)});try{var m=f.identify(i,{typename:d,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:y}),b=m[0],A=m[1];n=n||b,A&&(h=u.merge(h,A))}catch(C){if(!n)throw C}if(typeof n=="string"){var x=$i(n),w=u.written[n]||(u.written[n]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(i,x,a,u)))return x;var O=u.incomingById.get(n);return O?(O.storeObject=u.merge(O.storeObject,h),O.mergeTree=Sf(O.mergeTree,c),g.forEach(function(C){return O.fieldNodeSet.add(C)})):u.incomingById.set(n,{storeObject:h,mergeTree:Iu(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?Yl(e):e:or(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,jy(i,c));return qy(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=fu(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new Vs(!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(Bs(g,n.variables)){var m=d.clientOnly,b=d.deferred;if(!(m&&b)&&yn(g.directives)&&g.directives.forEach(function(w){var O=w.name.value;if(O==="client"&&(m=!0),O==="defer"){var C=Ga(w,n.variables);(!C||C.if!==!1)&&(b=!0)}}),gi(g)){var A=a.get(g);A&&(m=m&&A.clientOnly,b=b&&A.deferred),a.set(g,xf(n,m,b))}else{var x=za(g,n.lookupFragment);if(!x&&g.kind===De.FRAGMENT_SPREAD)throw Jr(13,g.name.value);x&&u.fragmentMatches(x,i,t,n.variables)&&f(x.selectionSet,xf(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=!or(n)&&(Nt(t)||Ys(t))?t:void 0,h=n;f&&!a&&(a=[Nt(f)?f.__ref:f]);var d,y=function(g,m){return or(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),A=y(h,m);if(A!==void 0){a&&a.push(m);var x=c.applyMerges(g,b,A,i,a);x!==A&&(d=d||new Map,d.set(m,x)),a&&je(a.pop()===m)}}),d&&(n=or(h)?h.slice(0):j({},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}(),Ly=[];function jy(r,e){var t=r.map;return t.has(e)||t.set(e,Ly.pop()||{map:new Map}),t.get(e)}function Sf(r,e){if(r===e||!e||Iu(e))return r;if(!r||Iu(r))return e;var t=r.info&&e.info?j(j({},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,Sf(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,Sf(e.map.get(c),r.map.get(c)))})}return a}function Iu(r){return!r||!(r.info||r.map.size)}function qy(r,e){var t=r.map,n=t.get(e);n&&Iu(n)&&(Ly.push(n),t.delete(e))}var Uy=new Set;function EO(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)&&!Lt(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=Hi(t),h="".concat(c,".").concat(f);if(!Uy.has(h)){Uy.add(h);var d=[];!or(a)&&!or(u)&&[a,u].forEach(function(y){var g=n.getFieldValue(y,"__typename");typeof g=="string"&&!d.includes(g)&&d.push(g)}),globalThis.__DEV__!==!1&&je.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,j({},a),j({},u))}}}}var Ef=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 yu(vu),n.assumeImmutableResults=!0,n.makeVar=Oy,n.txCount=0,n.config=lO(t),n.addTypename=!!n.config.addTypename,n.policies=new xO({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 SO(this,this.storeReader=new yO({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:my(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(j(j({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof hf)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(Nr.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(j(j({},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||bO(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Ey(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;mi.reset(),Hs.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&&je.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Nr.call(t,"id"))return!1;t=j(j({},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(),Ey(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,A=m.optimisticData;++n.txCount,g&&(n.data=n.optimisticData=g);try{return h=i(n)}finally{--n.txCount,n.data=b,n.optimisticData=A}},y=new Set;return f&&!this.txCount&&this.broadcastWatches(j(j({},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(j(j({},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||!Lt(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(lf);globalThis.__DEV__!==!1&&(Ef.prototype.getMemoryInternals=vS);var Ot;(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"})(Ot||(Ot={}));function oo(r){return r?r<7:!1}function OO(r){return r===7||r===8}var $y=Object.assign,TO=Object.hasOwnProperty,Cu=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 w=x._subscription._observer;w&&!w.error&&(w.error=AO)}catch{}var O=!u.observers.size;u.observers.add(x);var C=u.last;return C&&C.error?x.error&&x.error(C.error):C&&C.result&&x.next&&x.next(C.result),O&&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=Of(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=j(j({},a),{initialFetchPolicy:b,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var A=ws(u.query);return u.queryName=A&&A.name&&A.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||Ot.ready,a=j(j({},n),{loading:oo(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(Of(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),Lt(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===Ot.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=Ot.ready,a.loading=!1)):a.partial=!0,globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Vy(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?!hy(this.query,this.last.result,t,this.variables):!Lt(this.last.result,t);return i||n&&!Lt(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Lt(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&&TO.call(t,"variables")){var u=Nl(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&je.warn(20,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!Lt(this.options.variables,t)&&(i.variables=this.options.variables=j(j({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,Ot.refetch)},e.prototype.fetchMore=function(t){var n=this,i=j(j({},t.query?t:j(j(j(j({},this.options),{query:this.options.query}),t),{variables:j(j({},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=Ot.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set,h=t==null?void 0:t.updateQuery,d=this.options.fetchPolicy!=="no-cache";return d||je(h,21),this.queryManager.fetchQuery(a,i,Ot.fetchMore).then(function(y){if(n.queryManager.removeQuery(a),u.networkStatus===Ot.fetchMore&&(u.networkStatus=c),d)n.queryManager.cache.batch({update:function(b){var A=t.updateQuery;A?b.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(x){return A(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(j(j({},g),{data:m}),n.variables)}return y}).finally(function(){d&&!f.has(n.query)&&By(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&&je.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=Wi(this.options,t||{});$y(this.options,n)},e.prototype.setVariables=function(t){return Lt(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},Ot.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)){je(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"},Ot.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&&!Lt(n,this.last.variables)&&(i=void 0),this.last=j({result:this.queryManager.assumeImmutableResults?t:Yl(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===Ot.refetch||n===Ot.fetchMore||n===Ot.poll,u=this.options.variables,c=this.options.fetchPolicy,f=Wi(this.options,t||{}),h=a?f:$y(this.options,f),d=this.transformDocument(h.query);this.lastQuery=d,a||(this.updatePolling(),t&&t.variables&&!Lt(t.variables,u)&&h.fetchPolicy!=="standby"&&(h.fetchPolicy===c||typeof h.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=Ot.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Of(h.fetchPolicy));var y=function(){i.concast===b&&(i.waitForOwnResult=!1)},g=h.variables&&j({},h.variables),m=this.fetch(h,n,d),b=m.concast,A=m.fromLink,x={next:function(w){Lt(i.variables,g)&&(y(),i.reportResult(w,g))},error:function(w){Lt(i.variables,g)&&(nf(w)||(w=new gn({networkError:w})),y(),i.reportError(w,g))}};return!a&&(A||!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)&&Js(this.observers,"next",t)},e.prototype.reportError=function(t,n){var i=j(j({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:Ot.error,loading:!1});this.updateLastResult(i,n),Js(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);Zl(Cu);function By(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 AO(r){globalThis.__DEV__!==!1&&je.error(24,r.message,r.stack)}function Vy(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&je.debug(25,r)}function Of(r){return r==="network-only"||r==="no-cache"||r==="standby"}var Zs=new(ys?WeakMap:Map);function Tf(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Zs.set(r,(Zs.get(r)+1)%1e15),t.apply(this,arguments)})}function Wy(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Af=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;Zs.has(n)||(Zs.set(n,0),Tf(n,"evict"),Tf(n,"modify"),Tf(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||Ot.loading;return this.variables&&this.networkStatus!==Ot.loading&&!Lt(this.variables,e.variables)&&(t=Ot.setVariables),Lt(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(){Wy(this),this.dirty=!1},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&Lt(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&&!Lt(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():By(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;Wy(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=j(j({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Lt(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===Zs.get(this.cache)&&Lt(t,n.variables)&&Lt(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u=new vi,c=yn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&yn(e.incremental)){var f=Xl(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&&(kf(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:Zs.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&&Lt(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=Ot.ready},r.prototype.markError=function(e){return this.networkStatus=Ot.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function kf(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 kO=Object.prototype.hasOwnProperty,zy=Object.create(null),IO=function(){function r(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new lu(Yn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Vs(!1);var n=new yu(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(Jr(26))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){return Li(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,A=b===void 0?[]:b,x=t.awaitRefetchQueries,w=x===void 0?!1:x,O=t.update,C=t.onQueryUpdated,D=t.fetchPolicy,F=D===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":D,B=t.errorPolicy,ee=B===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":B,Q=t.keepRootFields,re=t.context;return ji(this,function(fe){switch(fe.label){case 0:return je(d,27),je(F==="network-only"||F==="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,re)]:[3,2];case 1:y=fe.sent(),fe.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:F,errorPolicy:ee,context:re,updateQueries:m,update:O,keepRootFields:Q}),this.broadcastQueries(),c=this,[2,new Promise(function(ge,he){return _u(c.getObservableFromLink(d,j(j({},re),{optimisticResponse:u?g:void 0}),y,{},!1),function(ve){if(to(ve)&&ee==="none")throw new gn({graphQLErrors:xu(ve)});a&&(a.loading=!1,a.error=null);var Ie=j({},ve);return typeof A=="function"&&(A=A(Ie)),ee==="ignore"&&to(Ie)&&delete Ie.errors,c.markMutationResult({mutationId:n,result:Ie,document:d,variables:y,fetchPolicy:F,errorPolicy:ee,context:re,update:O,updateQueries:m,awaitRefetchQueries:w,refetchQueries:A,removeOptimistic:u?n:void 0,onQueryUpdated:C,keepRootFields:Q})}).subscribe({next:function(ve){c.broadcastQueries(),(!("hasNext"in ve)||ve.hasNext===!1)&&ge(ve)},error:function(ve){a&&(a.loading=!1,a.error=ve),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),he(ve instanceof gn?ve:new gn({networkError:ve}))}})})]}})})},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&&kf(i,e.errorPolicy)){if(xs(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),xs(i)&&yn(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=Xl(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||!kO.call(h,b))){var A=h[b],x=n.queries.get(g),w=x.document,O=x.variables,C=t.diff({query:w,variables:O,returnPartialData:!0,optimistic:!1}),D=C.result,F=C.complete;if(F&&D){var B=A(D,{mutationResult:i,queryName:w&&hu(w)||void 0,queryVariables:O});B&&a.push({result:B,dataId:"ROOT_QUERY",query:w,variables:O})}}})}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(A){return y.write(A)});var g=e.update,m=!Qm(i)||xs(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=j(j({},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(A,x){var w=x.fieldName,O=x.DELETE;return w==="__typename"?A:O}})},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:zy}):e;return i===zy?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(j(j({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&je.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:rm(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:qi(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:gu([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:du(ws(e)),asQuery:j(j({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?j(j({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return j(j({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=j(j({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new Af(this),i=new Cu({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()),je(e.query,29),je(e.query.kind==="Document",30),je(!e.returnPartialData,31),je(!e.pollInterval,32),this.fetchQuery(t,j(j({},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(Jr(33)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=Ot.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):pm(u)?i.set(t.transform(u),!1):Kt(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=tu("legacyOneTimeQuery"),f=t.getQuery(c).init({document:u.query,variables:u.variables}),h=new Cu({queryManager:t,queryInfo:f,options:j(j({},u),{fetchPolicy:"network-only"})});je(h.queryId===c),f.setObservableQuery(h),n.set(c,h)}),globalThis.__DEV__!==!1&&i.size&&i.forEach(function(u,c){u||globalThis.__DEV__!==!1&&je.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(A){i!=="no-cache"&&(kf(A,u)&&t.cache.write({query:n,result:A.data,dataId:"ROOT_SUBSCRIPTION",variables:b}),t.broadcastQueries());var x=to(A),w=QE(A);if(x||w){var O={};if(x&&(O.graphQLErrors=A.errors),w&&(O.protocolErrors=A.extensions[rf]),u==="none"||w)throw new gn(O)}return u==="ignore"&&delete A.errors,A})};if(this.getDocumentInfo(n).hasClientExports){var m=this.localState.addExportedVariables(n,c,h).then(g);return new Rt(function(b){var A=null;return m.then(function(x){return A=x.subscribe(b)},b.error),function(){return A&&A.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,A={query:d,variables:n,operationName:hu(d)||void 0,context:this.prepareContext(j(j({},t),{forceFetch:!a})),extensions:i};if(t=A.context,a){var x=Hs(d),w=mi(n),O=m.lookup(x,w);if(f=O.observable,!f){var C=new _s([Ou(b,A)]);f=O.observable=C,C.beforeNext(function(){m.remove(x,w)})}}else f=new _s([Ou(b,A)])}else f=new _s([Rt.of({data:{}})]),t=this.prepareContext(t);return y&&(f=_u(f,function(D){return u.localState.runResolvers({document:y,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 _u(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=xu(u),f=c.length>0,h=n.errorPolicy;if(i>=e.lastRequestId){if(f&&h==="none")throw e.markError(new gn({graphQLErrors:c}));e.markResult(u,a,n,t),e.markReady()}var d={data:u.data,loading:!1,networkStatus:Ot.ready};return f&&h==="none"&&(d.data=void 0),f&&h!=="ignore"&&(d.errors=c,d.networkStatus=Ot.error),d},function(u){var c=nf(u)?u:new gn({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=Ot.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,A=t.notifyOnNetworkStatusChange,x=A===void 0?!1:A,w=t.context,O=w===void 0?{}:w,C=Object.assign({},t,{query:i,variables:u,fetchPolicy:d,errorPolicy:g,returnPartialData:b,notifyOnNetworkStatusChange:x,context:O}),D=function(re){C.variables=re;var fe=a.fetchQueryByPolicy(c,C,n);return C.fetchPolicy!=="standby"&&fe.sources.length>0&&c.observableQuery&&c.observableQuery.applyNextFetchPolicy("after-fetch",t),fe},F=function(){return a.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(re){F(),setTimeout(function(){return B.cancel(re)})});var B,ee;if(this.getDocumentInfo(C.query).hasClientExports)B=new _s(this.localState.addExportedVariables(C.query,C.variables,C.context).then(D).then(function(re){return re.sources})),ee=!0;else{var Q=D(C.variables);ee=Q.fromLink,B=new _s(Q.sources)}return B.promise.then(F,F),{concast:B,fromLink:ee}},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?tu("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 A=g.watcher instanceof Af&&g.watcher.observableQuery;if(A){if(h){d.delete(A.queryId);var x=h(A,m,b);return x===!0&&(x=A.refetch()),x!==!1&&y.set(A,x),x}h!==null&&d.set(A.queryId,{oq:A,lastDiff:b,diff:m})}}}),d.size&&d.forEach(function(g,m){var b=g.oq,A=g.lastDiff,x=g.diff,w;if(h){if(!x){var O=b.queryInfo;O.reset(),x=O.getDiff()}w=h(b,x,A)}(!h||w===!0)&&(w=b.refetch()),w!==!1&&y.set(b,w),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()},A=function(D,F){F===void 0&&(F=e.networkStatus||Ot.loading);var B=D.result;globalThis.__DEV__!==!1&&!d&&!Lt(B,{})&&Vy(D.missing);var ee=function(Q){return Rt.of(j({data:Q,loading:oo(F),networkStatus:F},D.complete?null:{partial:!0}))};return B&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:B},context:y,variables:u,onlyRunForcedResolvers:!0}).then(function(Q){return ee(Q.data||void 0)}):h==="none"&&F===Ot.refetch&&Array.isArray(D.missing)?ee(void 0):ee(B)},x=c==="no-cache"?0:n===Ot.refetch&&f!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,x,{query:a,variables:u,context:y,fetchPolicy:c,errorPolicy:h})},O=g&&typeof m=="number"&&m!==n&&oo(n);switch(c){default:case"cache-first":{var C=b();return C.complete?{fromLink:!1,sources:[A(C,e.markReady())]}:d||O?{fromLink:!0,sources:[A(C),w()]}:{fromLink:!0,sources:[w()]}}case"cache-and-network":{var C=b();return C.complete||d||O?{fromLink:!0,sources:[A(C),w()]}:{fromLink:!0,sources:[w()]}}case"cache-only":return{fromLink:!1,sources:[A(b(),e.markReady())]};case"network-only":return O?{fromLink:!0,sources:[A(b()),w()]}:{fromLink:!0,sources:[w()]};case"no-cache":return O?{fromLink:!0,sources:[A(e.getDiff()),w()]}:{fromLink:!0,sources:[w()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Af(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return j(j(j({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),CO=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 Li(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 j(j({},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 qi(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return Ul(e)},r.prototype.prepareContext=function(e){var t=this.cache;return j(j({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return Li(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 j(j({},n),u.exportedVariables)})]:[2,j({},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 xl}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:qm(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return Li(this,arguments,void 0,function(n,i,a,u,c,f){var h,d,y,g,m,b,A,x,w,O,C;return a===void 0&&(a={}),u===void 0&&(u={}),c===void 0&&(c=function(){return!0}),f===void 0&&(f=!1),ji(this,function(D){return h=Bi(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",A=this,x=A.cache,w=A.client,O={fragmentMap:y,context:j(j({},a),{cache:x,client:w}),variables:u,fragmentMatcher:c,defaultOperationType:b,exportedVariables:{},selectionsToResolve:g,onlyRunForcedResolvers:f},C=!1,[2,this.resolveSelectionSet(h.selectionSet,C,i,O).then(function(F){return{result:F,exportedVariables:O.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Li(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 Li(d,void 0,void 0,function(){var m,b;return ji(this,function(A){return!t&&!i.selectionsToResolve.has(g)?[2]:Bs(g,c)?gi(g)?[2,this.resolveField(g,t,n,i).then(function(x){var w;typeof x<"u"&&f.push((w={},w[yi(g)]=x,w))})]:(ym(g)?m=g:(m=a[g.name.value],je(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 Li(this,void 0,void 0,function(){var a,u,c,f,h,d,y,g,m,b=this;return ji(this,function(A){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(gf.withValue(this.cache,m,[n,Ga(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,d.then(function(x){var w,O;if(x===void 0&&(x=h),e.directives&&e.directives.forEach(function(D){D.name.value==="export"&&D.arguments&&D.arguments.forEach(function(F){F.name.value==="as"&&F.value.kind==="StringValue"&&(i.exportedVariables[F.value.value]=x)})}),!e.selectionSet||x==null)return x;var C=(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(x))return b.resolveSubSelectedArray(e,t||C,x,i);if(e.selectionSet)return b.resolveSelectionSet(e.selectionSet,t||C,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)&&tm(m)&&c.add(m)})},FragmentSpread:function(f,h,d,y,g){var m=t[f.name.value];je(m,19,f.name.value);var b=a(m);b.size>0&&(g.forEach(function(A){n(A)&&tm(A)&&c.add(A)}),c.add(f),b.forEach(function(A){c.add(A)}))}})}return i.get(u)}return a(e)},r}(),Hy=!1,If=function(){function r(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Jr(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,A=e.defaultOptions,x=e.defaultContext,w=e.assumeImmutableResults,O=w===void 0?u.assumeImmutableResults:w,C=e.resolvers,D=e.typeDefs,F=e.fragmentMatcher,B=e.name,ee=e.version,Q=e.devtools,re=e.link;re||(re=n?new oy({uri:n,credentials:i,headers:a}):Yr.empty()),this.link=re,this.cache=u,this.disableNetworkFetches=h||y>0,this.queryDeduplication=b,this.defaultOptions=A||Object.create(null),this.typeDefs=D,this.devtoolsConfig=j(j({},Q),{enabled:(Q==null?void 0:Q.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=fl,this.localState=new CO({cache:u,client:this,resolvers:C,fragmentMatcher:F}),this.queryManager=new IO({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:x,documentTransform:c,queryDeduplication:b,ssrMode:h,clientAwareness:{name:B,version:ee},localState:this.localState,assumeImmutableResults:O,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,!Hy&&globalThis.__DEV__!==!1&&(Hy=!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&&je.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=zi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=zi(this.defaultOptions.query,e)),je(e.fetchPolicy!=="cache-and-network",16),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=zi(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 Ou(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&&je.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&&(If.prototype.getMemoryInternals=gS);var Pu=new Map,Cf=new Map,Gy=!0,Nu=!1;function Qy(r){return r.replace(/[\s,]+/g," ").trim()}function PO(r){return Qy(r.source.body.substring(r.start,r.end))}function NO(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=PO(n.loc),u=Cf.get(i);u&&!u.has(a)?Gy&&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||kf.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),j(j({},r),{definitions:t})}function RO(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 DO(r){var e=Gy(r);if(!Iu.has(e)){var t=zx(r,{experimentalFragmentVariables:Pu,allowLegacyFragmentVariables:Pu});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Iu.set(e,RO(NO(t)))}return Iu.get(e)}function Gi(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]}),DO(n)}function Jy(){Iu.clear(),kf.clear()}function Yy(){Qy=!1}function Ky(){Pu=!0}function Zy(){Pu=!1}var oo={gql:Gi,resetCaches:Jy,disableFragmentWarnings:Yy,enableExperimentalFragmentVariables:Ky,disableExperimentalFragmentVariables:Zy};(function(r){r.gql=oo.gql,r.resetCaches=oo.resetCaches,r.disableFragmentWarnings=oo.disableFragmentWarnings,r.enableExperimentalFragmentVariables=oo.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=oo.disableExperimentalFragmentVariables})(Gi||(Gi={})),Gi.default=Gi,Mp(globalThis.__DEV__!==!1?"log":"silent");const FO=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:uf,ApolloClient:Af,ApolloError:yn,ApolloLink:Kr,get Cache(){return cf},DocumentTransform:pu,HttpLink:oy,InMemoryCache:xf,MissingFieldError:lf,get NetworkStatus(){return Et},Observable:Nt,ObservableQuery:ku,checkFetcher:ny,concat:LE,createHttpLink:sf,createSignalIfSupported:iO,defaultDataIdFromObject:ff,defaultPrinter:rf,disableExperimentalFragmentVariables:Zy,disableFragmentWarnings:Yy,empty:DE,enableExperimentalFragmentVariables:Ky,execute:Su,fallbackHttpConfig:ry,from:FE,fromError:_u,fromPromise:IE,get gql(){return Gi},isApolloError:tf,isNetworkRequestSettled:OO,isReference:Ct,makeReference:$i,makeVar:Oy,mergeOptions:zi,parseAndCheckHttpResponse:ty,resetCaches:Jy,rewriteURIForGET:sy,selectHttpOptionsAndBody:rO,selectHttpOptionsAndBodyInternal:nf,selectURI:iy,serializeFetchParameter:Eu,setLogVerbosity:Mp,split:ME,throwServerError:Xl,toPromise:kE},Symbol.toStringTag,{value:"Module"}));var Xy={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,pe)})(Xy);var ut=Xy.exports;const eg=lx({__proto__:null,default:Cp(ut)},[ut]);var tg=au?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function If(){Me("createContext"in eg,46);var r=ut.createContext[tg];return r||(Object.defineProperty(ut.createContext,tg,{value:r=ut.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var MO=function(r){var e=r.client,t=r.children,n=If(),i=ut.useContext(n),a=ut.useMemo(function(){return j(j({},i),{client:e||i.client})},[i,e]);return Me(a.client,47),ut.createElement(n.Provider,{value:a},t)};function rg(r){var e=ut.useContext(If()),t=r||e.client;return Me(!!t,50),t}var ng=!1,LO="useSyncExternalStore",jO=eg[LO],ig=jO||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!ng&&n!==e()&&(ng=!0,globalThis.__DEV__!==!1&&Me.error(60));var i=ut.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return am?ut.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),Pf(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),ut.useEffect(function(){return Pf(a)&&u({inst:a}),r(function(){Pf(a)&&u({inst:a})})},[r]),n};function Pf(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 Ss;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 ag(r){Ss||(Ss=new uu(Yn.parser||1e3));var e=Ss.get(r);if(e)return e;var t,n,i;Me(!!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}}Me(!a.length||u.length||c.length||f.length,63),Me(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;Me(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 Ss.set(r,b),b}ag.resetCache=function(){Ss=void 0},globalThis.__DEV__!==!1&&Tl("parser",function(){return Ss?Ss.size:0});function og(r,e){var t=ag(r),n=sg(e),i=sg(t.type);Me(t.type===e,66,n,n,i)}function qO(r,e){var t=ut.useRef();return(!t.current||!Mt(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var Cf=xl?ut.useLayoutEffect:ut.useEffect,UO=Object.prototype.hasOwnProperty;function ug(){}var Cu=Symbol();function $O(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(Nf(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=ut.useState(a),c=u[0],f=u[1];function h(y){var g,m;Object.assign(c.observable,(g={},g[Cu]=y,g));var b=c.resultData;f(j(j({},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 BO(r,e){var t=rg(e.client),n=ut.useContext(If()).renderPromises,i=!!n,a=t.disableNetworkFetches,u=e.ssr!==!1&&!e.skip,c=e.partialRefetch,f=cg(t,r,e,i),h=$O(t,r,e,n,f),d=h[0],y=d.observable,g=d.resultData,m=h[1],b=f(y);zO(g,y,t,e,b);var A=ut.useMemo(function(){return GO(y)},[y]);WO(y,n,u);var x=VO(g,y,t,e,b,a,c,i,{onCompleted:e.onCompleted||ug,onError:e.onError||ug});return{result:x,obsQueryFields:A,observable:y,resultData:g,client:t,onQueryExecuted:m}}function VO(r,e,t,n,i,a,u,c,f){var h=ut.useRef(f);ut.useEffect(function(){h.current=f});var d=(c||a)&&n.ssr===!1&&!n.skip?hg:n.skip||i.fetchPolicy==="standby"?dg:void 0,y=r.previousData,g=ut.useMemo(function(){return d&&Nu(d,y,e,t)},[t,e,d,y]);return ig(ut.useCallback(function(m){if(c)return function(){};var b=function(){var w=r.current,O=e.getCurrentResult();w&&w.loading===O.loading&&w.networkStatus===O.networkStatus&&Mt(w.data,O.data)||Rf(O,r,e,t,u,m,h.current)},A=function(w){if(x.current.unsubscribe(),x.current=e.resubscribeAfterError(b,A),!UO.call(w,"graphQLErrors"))throw w;var O=r.current;(!O||O&&O.loading||!Mt(w,O.error))&&Rf({data:O&&O.data,error:w,loading:!1,networkStatus:Et.error},r,e,t,u,m,h.current)},x={current:e.subscribe(b,A)};return function(){setTimeout(function(){return x.current.unsubscribe()})}},[a,c,e,r,u,t]),function(){return g||lg(r,e,h.current,u,t)},function(){return g||lg(r,e,h.current,u,t)})}function WO(r,e,t){e&&t&&(e.registerSSRObservable(r),r.getCurrentResult().loading&&e.addObservableQueryPromise(r))}function zO(r,e,t,n,i){var a;e[Cu]&&!Mt(e[Cu],i)&&(e.reobserve(Nf(e,t,n,i)),r.previousData=((a=r.current)===null||a===void 0?void 0:a.data)||r.previousData,r.current=void 0),e[Cu]=i}function cg(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||Df(a,r.defaultOptions),f.fetchPolicy="standby"):f.fetchPolicy||(f.fetchPolicy=(c==null?void 0:c.options.initialFetchPolicy)||Df(a,r.defaultOptions)),f}}function Nf(r,e,t,n){var i=[],a=e.defaultOptions.watchQuery;return a&&i.push(a),t.defaultOptions&&i.push(t.defaultOptions),i.push(Wi(r&&r.options,n)),i.reduce(zi)}function Rf(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=Nu(QO(r,t,i),e.previousData,t,n),a(),HO(r,c==null?void 0:c.networkStatus,u)}function HO(r,e,t){if(!r.loading){var n=fg(r);Promise.resolve().then(function(){n?t.onError(n):r.data&&e!==r.networkStatus&&r.networkStatus===Et.ready&&t.onCompleted(r.data)}).catch(function(i){globalThis.__DEV__!==!1&&Me.warn(i)})}}function lg(r,e,t,n,i){return r.current||Rf(e.getCurrentResult(),r,e,i,n,function(){},t),r.current}function Df(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 fg(r){return mn(r.errors)?new yn({graphQLErrors:r.errors}):r.error}function Nu(r,e,t,n){var i=r.data;r.partial;var a=on(r,["data","partial"]),u=j(j({data:i},a),{client:n,observable:t,variables:t.variables,called:r!==hg&&r!==dg,previousData:e});return u}function QO(r,e,t){return r.partial&&t&&!r.loading&&(!r.data||Object.keys(r.data).length===0)&&e.options.fetchPolicy!=="cache-only"?(e.refetch(),j(j({},r),{loading:!0,networkStatus:Et.refetch})):r}var hg=Gs({loading:!0,data:void 0,error:void 0,networkStatus:Et.loading}),dg=Gs({loading:!1,data:void 0,error:void 0,networkStatus:Et.ready});function GO(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 JO=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function YO(r,e){var t,n=ut.useRef(),i=ut.useRef(),a=ut.useRef(),u=zi(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=j(j({},u),{skip:!n.current}),h=BO(c,f),d=h.obsQueryFields,y=h.result,g=h.client,m=h.resultData,b=h.observable,A=h.onQueryExecuted,x=b.options.initialFetchPolicy||Df(f.defaultOptions,g.defaultOptions),w=ut.useReducer(function(J){return J+1},0)[1],O=ut.useMemo(function(){for(var J={},ue=function(De){var je=d[De];J[De]=function(){return n.current||(n.current=Object.create(null),w()),je.apply(this,arguments)}},fe=0,qe=JO;fe<qe.length;fe++){var ve=qe[fe];ue(ve)}return J},[w,d]),P=!!n.current,R=ut.useMemo(function(){return j(j(j({},y),O),{called:P})},[y,O,P]),F=ut.useCallback(function(J){n.current=J?j(j({},J),{fetchPolicy:J.fetchPolicy||x}):{fetchPolicy:x};var ue=zi(i.current,j({query:a.current},n.current)),fe=KO(m,b,g,c,j(j({},ue),{skip:!1}),A).then(function(qe){return Object.assign(qe,O)});return fe.catch(function(){}),fe},[g,c,O,x,b,m,A]),$=ut.useRef(F);Cf(function(){$.current=F});var te=ut.useCallback(function(){for(var J=[],ue=0;ue<arguments.length;ue++)J[ue]=arguments[ue];return $.current.apply($,J)},[]);return[te,R]}function KO(r,e,t,n,i,a){var u=i.query||n,c=cg(t,u,i,!1)(e),f=e.reobserveAsConcast(Nf(e,t,i,c));return a(c),new Promise(function(h){var d;f.subscribe({next:function(y){d=y},error:function(){h(Nu(e.getCurrentResult(),r.previousData,e,t))},complete:function(){h(Nu(d,r.previousData,e,t))}})})}function ZO(r,e){e===void 0&&(e=Object.create(null));var t=ut.useRef(!1),n=rg(e.client);og(r,ui.Subscription),t.current||(t.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&Me.warn(e.onData?53:54),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&Me.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=qO(function(){return e.variables},[e.variables]),g=function(){return XO(n,r,y,a,u,f,h)},m=ut.useState(e.skip?null:g),b=m[0],A=m[1],x=ut.useRef(g);Cf(function(){x.current=g}),i?b&&A(b=null):(!b||(n!==b.__.client||r!==b.__.query||a!==b.__.fetchPolicy||u!==b.__.errorPolicy||!Mt(y,b.__.variables))&&(typeof c=="function"?!!c(e):c)!==!1)&&A(b=g());var w=ut.useRef(e);ut.useEffect(function(){w.current=e});var O=!i&&!d,P=ut.useMemo(function(){return{loading:O,error:void 0,data:void 0,variables:y}},[O,y]),R=ut.useRef(d);Cf(function(){R.current=d});var F=ig(ut.useCallback(function(te){if(!b)return function(){};var J=!1,ue=b.__.variables,fe=b.__.client,qe=b.subscribe({next:function(ve){var De,je;if(!J){var ge={loading:!1,data:ve.data,error:fg(ve),variables:ue};b.__.setResult(ge),R.current||te(),ge.error?(je=(De=w.current).onError)===null||je===void 0||je.call(De,ge.error):w.current.onData?w.current.onData({client:fe,data:ge}):w.current.onSubscriptionData&&w.current.onSubscriptionData({client:fe,subscriptionData:ge})}},error:function(ve){var De,je;ve=ve instanceof yn?ve:new yn({protocolErrors:[ve]}),J||(b.__.setResult({loading:!1,data:void 0,error:ve,variables:ue}),R.current||te(),(je=(De=w.current).onError)===null||je===void 0||je.call(De,ve))},complete:function(){J||(w.current.onComplete?w.current.onComplete():w.current.onSubscriptionComplete&&w.current.onSubscriptionComplete())}});return function(){J=!0,setTimeout(function(){qe.unsubscribe()})}},[b]),function(){return b&&!i&&!d?b.__.result:P},function(){return P}),$=ut.useCallback(function(){Me(!w.current.skip,57),A(x.current())},[w,x]);return ut.useMemo(function(){return j(j({},F),{restart:$})},[F,$])}function XO(r,e,t,n,i,a,u){var c={query:e,variables:t,fetchPolicy:n,errorPolicy:i,context:a,extensions:u},f=j(j({},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 Nt(function(d){h||(h=r.subscribe(c));var y=h.subscribe(d);return function(){return y.unsubscribe()}}),{__:f})}class Es extends Error{}class e1 extends Es{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class t1 extends Es{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class r1 extends Es{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Xs extends Es{}class pg extends Es{constructor(e){super(`Invalid unit ${e}`)}}class Wr extends Es{}class Ji extends Es{constructor(){super("Zone is an abstract class")}}const Oe="numeric",Kn="short",gn="long",Ru={year:Oe,month:Oe,day:Oe},mg={year:Oe,month:Kn,day:Oe},n1={year:Oe,month:Kn,day:Oe,weekday:Kn},yg={year:Oe,month:gn,day:Oe},gg={year:Oe,month:gn,day:Oe,weekday:gn},vg={hour:Oe,minute:Oe},bg={hour:Oe,minute:Oe,second:Oe},wg={hour:Oe,minute:Oe,second:Oe,timeZoneName:Kn},_g={hour:Oe,minute:Oe,second:Oe,timeZoneName:gn},xg={hour:Oe,minute:Oe,hourCycle:"h23"},Sg={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23"},Eg={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:Kn},Og={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:gn},Tg={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe},Ag={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe,second:Oe},kg={year:Oe,month:Kn,day:Oe,hour:Oe,minute:Oe},Ig={year:Oe,month:Kn,day:Oe,hour:Oe,minute:Oe,second:Oe},i1={year:Oe,month:Kn,day:Oe,weekday:Kn,hour:Oe,minute:Oe},Pg={year:Oe,month:gn,day:Oe,hour:Oe,minute:Oe,timeZoneName:Kn},Cg={year:Oe,month:gn,day:Oe,hour:Oe,minute:Oe,second:Oe,timeZoneName:Kn},Ng={year:Oe,month:gn,day:Oe,weekday:gn,hour:Oe,minute:Oe,timeZoneName:gn},Rg={year:Oe,month:gn,day:Oe,weekday:gn,hour:Oe,minute:Oe,second:Oe,timeZoneName:gn};class uo{get type(){throw new Ji}get name(){throw new Ji}get ianaName(){return this.name}get isUniversal(){throw new Ji}offsetName(e,t){throw new Ji}formatOffset(e,t){throw new Ji}offset(e){throw new Ji}equals(e){throw new Ji}get isValid(){throw new Ji}}let Ff=null;class Du extends uo{static get instance(){return Ff===null&&(Ff=new Du),Ff}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return iv(e,t,n)}formatOffset(e,t){return ho(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Fu={};function s1(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 a1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function o1(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 u1(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=a1[a];a==="era"?n[c]=u:tt(c)||(n[c]=parseInt(u,10))}return n}let Mu={};class vi extends uo{static create(e){return Mu[e]||(Mu[e]=new vi(e)),Mu[e]}static resetCache(){Mu={},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=vi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return iv(e,t,n,this.name)}formatOffset(e,t){return ho(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=s1(this.name);let[i,a,u,c,f,h,d]=n.formatToParts?u1(n,t):o1(n,t);c==="BC"&&(i=-Math.abs(i)+1);const g=$u({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 Dg={};function c1(r,e={}){const t=JSON.stringify([r,e]);let n=Dg[t];return n||(n=new Intl.ListFormat(r,e),Dg[t]=n),n}let Mf={};function Lf(r,e={}){const t=JSON.stringify([r,e]);let n=Mf[t];return n||(n=new Intl.DateTimeFormat(r,e),Mf[t]=n),n}let jf={};function l1(r,e={}){const t=JSON.stringify([r,e]);let n=jf[t];return n||(n=new Intl.NumberFormat(r,e),jf[t]=n),n}let qf={};function f1(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=qf[i];return a||(a=new Intl.RelativeTimeFormat(r,e),qf[i]=a),a}let co=null;function h1(){return co||(co=new Intl.DateTimeFormat().resolvedOptions().locale,co)}let Fg={};function d1(r){let e=Fg[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Fg[r]=e}return e}function p1(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=Lf(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=Lf(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function m1(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function y1(r){const e=[];for(let t=1;t<=12;t++){const n=rt.utc(2009,t,1);e.push(r(n))}return e}function g1(r){const e=[];for(let t=1;t<=7;t++){const n=rt.utc(2016,11,13+t);e.push(r(n))}return e}function Lu(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function v1(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 b1{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=l1(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):Qf(e,3);return xr(t,this.padTo)}}}class w1{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&&vi.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=Lf(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 _1{constructor(e,t,n){this.opts={style:"long",...n},!t&&ev()&&(this.rtf=f1(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):W1(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const x1={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":h1()),f=t||fr.defaultNumberingSystem,h=n||fr.defaultOutputCalendar,d=zf(i)||fr.defaultWeekSettings;return new Lt(c,f,h,d,u)}static resetCache(){co=null,Mf={},jf={},qf={}}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]=p1(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=m1(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=v1(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,zf(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 Lu(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]=y1(a=>this.extract(a,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return Lu(this,e,lv,()=>{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]=g1(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Lu(this,void 0,()=>fv,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[rt.utc(2016,11,13,9),rt.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Lu(this,e,hv,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[rt.utc(-40,1,1),rt.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 b1(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new w1(e,this.intl,t)}relFormatter(e={}){return new _1(this.intl,this.isEnglish(),e)}listFormatter(e={}){return c1(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:tv()?d1(this.locale):x1}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 Uf=null;class Zr extends uo{static get utcInstance(){return Uf===null&&(Uf=new Zr(0)),Uf}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(Bu(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ho(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ho(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return ho(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 S1 extends uo{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 Yi(r,e){if(tt(r)||r===null)return e;if(r instanceof uo)return r;if(I1(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Du.instance:t==="utc"||t==="gmt"?Zr.utcInstance:Zr.parseSpecifier(t)||vi.create(r)}else return Ki(r)?Zr.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new S1(r)}const $f={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Mg={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]},E1=$f.hanidec.replace(/[\[|\]]/g,"").split("");function O1(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($f.hanidec)!==-1)e+=E1.indexOf(r[t]);else for(const i in Mg){const[a,u]=Mg[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}let ea={};function T1(){ea={}}function Zn({numberingSystem:r},e=""){const t=r||"latn";return ea[t]||(ea[t]={}),ea[t][e]||(ea[t][e]=new RegExp(`${$f[t]}${e}`)),ea[t][e]}let Lg=()=>Date.now(),jg="system",qg=null,Ug=null,$g=null,Bg=60,Vg,Wg=null;class fr{static get now(){return Lg}static set now(e){Lg=e}static set defaultZone(e){jg=e}static get defaultZone(){return Yi(jg,Du.instance)}static get defaultLocale(){return qg}static set defaultLocale(e){qg=e}static get defaultNumberingSystem(){return Ug}static set defaultNumberingSystem(e){Ug=e}static get defaultOutputCalendar(){return $g}static set defaultOutputCalendar(e){$g=e}static get defaultWeekSettings(){return Wg}static set defaultWeekSettings(e){Wg=zf(e)}static get twoDigitCutoffYear(){return Bg}static set twoDigitCutoffYear(e){Bg=e%100}static get throwOnInvalid(){return Vg}static set throwOnInvalid(e){Vg=e}static resetCaches(){Lt.resetCache(),vi.resetCache(),rt.resetCache(),T1()}}class Xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const zg=[0,31,59,90,120,151,181,212,243,273,304,334],Hg=[0,31,60,91,121,152,182,213,244,274,305,335];function Dn(r,e){return new Xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Bf(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 Qg(r,e,t){return t+(lo(r)?Hg:zg)[e-1]}function Gg(r,e){const t=lo(r)?Hg:zg,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function Vf(r,e){return(r-e+7)%7+1}function ju(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=Qg(n,i,a),c=Vf(Bf(n,i,a),t);let f=Math.floor((u-c+14-e)/7),h;return f<1?(h=n-1,f=fo(h,e,t)):f>fo(n,e,t)?(h=n+1,f=1):h=n,{weekYear:h,weekNumber:f,weekday:c,...Wu(r)}}function Jg(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=Vf(Bf(n,1,e),t),c=ra(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=ra(h)):f>c?(h=n+1,f-=ra(n)):h=n;const{month:d,day:y}=Gg(h,f);return{year:h,month:d,day:y,...Wu(r)}}function Wf(r){const{year:e,month:t,day:n}=r,i=Qg(e,t,n);return{year:e,ordinal:i,...Wu(r)}}function Yg(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Gg(e,t);return{year:e,month:n,day:i,...Wu(r)}}function Kg(r,e){if(!tt(r.localWeekday)||!tt(r.localWeekNumber)||!tt(r.localWeekYear)){if(!tt(r.weekday)||!tt(r.weekNumber)||!tt(r.weekYear))throw new Xs("Cannot mix locale-based week fields with ISO-based week fields");return tt(r.localWeekday)||(r.weekday=r.localWeekday),tt(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),tt(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 A1(r,e=4,t=1){const n=qu(r.weekYear),i=Fn(r.weekNumber,1,fo(r.weekYear,e,t)),a=Fn(r.weekday,1,7);return n?i?a?!1:Dn("weekday",r.weekday):Dn("week",r.weekNumber):Dn("weekYear",r.weekYear)}function k1(r){const e=qu(r.year),t=Fn(r.ordinal,1,ra(r.year));return e?t?!1:Dn("ordinal",r.ordinal):Dn("year",r.year)}function Zg(r){const e=qu(r.year),t=Fn(r.month,1,12),n=Fn(r.day,1,Uu(r.year,r.month));return e?t?n?!1:Dn("day",r.day):Dn("month",r.month):Dn("year",r.year)}function Xg(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Fn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Fn(t,0,59),c=Fn(n,0,59),f=Fn(i,0,999);return a?u?c?f?!1:Dn("millisecond",i):Dn("second",n):Dn("minute",t):Dn("hour",e)}function tt(r){return typeof r>"u"}function Ki(r){return typeof r=="number"}function qu(r){return typeof r=="number"&&r%1===0}function I1(r){return typeof r=="string"}function P1(r){return Object.prototype.toString.call(r)==="[object Date]"}function ev(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function tv(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function C1(r){return Array.isArray(r)?r:[r]}function rv(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 N1(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function ta(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function zf(r){if(r==null)return null;if(typeof r!="object")throw new Wr("Week settings must be an object");if(!Fn(r.firstDay,1,7)||!Fn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Fn(e,1,7)))throw new Wr("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Fn(r,e,t){return qu(r)&&r>=e&&r<=t}function R1(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 Zi(r){if(!(tt(r)||r===null||r===""))return parseInt(r,10)}function Os(r){if(!(tt(r)||r===null||r===""))return parseFloat(r)}function Hf(r){if(!(tt(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Qf(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function lo(r){return r%4===0&&(r%100!==0||r%400===0)}function ra(r){return lo(r)?366:365}function Uu(r,e){const t=R1(e-1,12)+1,n=r+(e-t)/12;return t===2?lo(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function $u(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 nv(r,e,t){return-Vf(Bf(r,1,e),t)+e-1}function fo(r,e=4,t=1){const n=nv(r,e,t),i=nv(r+1,e,t);return(ra(r)-n+i)/7}function Gf(r){return r>99?r:r>fr.twoDigitCutoffYear?1900+r:2e3+r}function iv(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 Bu(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 Vu(r,e){const t={};for(const n in r)if(ta(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=sv(i)}return t}function ho(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 Wu(r){return N1(r,["hour","minute","second","millisecond"])}const D1=["January","February","March","April","May","June","July","August","September","October","November","December"],av=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],F1=["J","F","M","A","M","J","J","A","S","O","N","D"];function ov(r){switch(r){case"narrow":return[...F1];case"short":return[...av];case"long":return[...D1];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 uv=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],cv=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],M1=["M","T","W","T","F","S","S"];function lv(r){switch(r){case"narrow":return[...M1];case"short":return[...cv];case"long":return[...uv];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const fv=["AM","PM"],L1=["Before Christ","Anno Domini"],j1=["BC","AD"],q1=["B","A"];function hv(r){switch(r){case"narrow":return[...q1];case"short":return[...j1];case"long":return[...L1];default:return null}}function U1(r){return fv[r.hour<12?0:1]}function $1(r,e){return lv(e)[r.weekday-1]}function B1(r,e){return ov(e)[r.month-1]}function V1(r,e){return hv(e)[r.year<0?0:1]}function W1(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 dv(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const z1={D:Ru,DD:mg,DDD:yg,DDDD:gg,t:vg,tt:bg,ttt:wg,tttt:_g,T:xg,TT:Sg,TTT:Eg,TTTT:Og,f:Tg,ff:kg,fff:Pg,ffff:Ng,F:Ag,FF:Ig,FFF:Cg,FFFF:Rg};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 z1[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?U1(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(m,b)=>n?B1(e,m):a(b?{month:m}:{month:m,day:"numeric"},"month"),h=(m,b)=>n?$1(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?V1(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 dv(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 dv(a,i(c))}}const pv=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function na(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function ia(...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 sa(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 mv(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=Zi(e[t+i]);return[n,null,t+i]}}const yv=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,H1=`(?:${yv.source}?(?:\\[(${pv.source})\\])?)?`,Jf=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,gv=RegExp(`${Jf.source}${H1}`),Yf=RegExp(`(?:T${gv.source})?`),Q1=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,G1=/(\d{4})-?W(\d\d)(?:-?(\d))?/,J1=/(\d{4})-?(\d{3})/,Y1=mv("weekYear","weekNumber","weekDay"),K1=mv("year","ordinal"),Z1=/(\d{4})-(\d\d)-(\d\d)/,vv=RegExp(`${Jf.source} ?(?:${yv.source}|(${pv.source}))?`),X1=RegExp(`(?: ${vv.source})?`);function aa(r,e,t){const n=r[e];return tt(n)?t:Zi(n)}function eT(r,e){return[{year:aa(r,e),month:aa(r,e+1,1),day:aa(r,e+2,1)},null,e+3]}function oa(r,e){return[{hours:aa(r,e,0),minutes:aa(r,e+1,0),seconds:aa(r,e+2,0),milliseconds:Hf(r[e+3])},null,e+4]}function po(r,e){const t=!r[e]&&!r[e+1],n=Bu(r[e+1],r[e+2]),i=t?null:Zr.instance(n);return[{},i,e+3]}function mo(r,e){const t=r[e]?vi.create(r[e]):null;return[{},t,e+1]}const tT=RegExp(`^T?${Jf.source}$`),rT=/^-?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 nT(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(Os(t)),months:g(Os(n)),weeks:g(Os(i)),days:g(Os(a)),hours:g(Os(u)),minutes:g(Os(c)),seconds:g(Os(f),f==="-0"),milliseconds:g(Hf(h),y)}]}const iT={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 Kf(r,e,t,n,i,a,u){const c={year:e.length===2?Gf(Zi(e)):Zi(e),month:av.indexOf(t)+1,day:Zi(n),hour:Zi(i),minute:Zi(a)};return u&&(c.second=Zi(u)),r&&(c.weekday=r.length>3?uv.indexOf(r)+1:cv.indexOf(r)+1),c}const sT=/^(?:(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 aT(r){const[,e,t,n,i,a,u,c,f,h,d,y]=r,g=Kf(e,i,n,t,a,u,c);let m;return f?m=iT[f]:h?m=0:m=Bu(d,y),[g,new Zr(m)]}function oT(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const uT=/^(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$/,cT=/^(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$/,lT=/^(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 bv(r){const[,e,t,n,i,a,u,c]=r;return[Kf(e,i,n,t,a,u,c),Zr.utcInstance]}function fT(r){const[,e,t,n,i,a,u,c]=r;return[Kf(e,c,t,n,i,a,u),Zr.utcInstance]}const hT=na(Q1,Yf),dT=na(G1,Yf),pT=na(J1,Yf),mT=na(gv),wv=ia(eT,oa,po,mo),yT=ia(Y1,oa,po,mo),gT=ia(K1,oa,po,mo),vT=ia(oa,po,mo);function bT(r){return sa(r,[hT,wv],[dT,yT],[pT,gT],[mT,vT])}function wT(r){return sa(oT(r),[sT,aT])}function _T(r){return sa(r,[uT,bv],[cT,bv],[lT,fT])}function xT(r){return sa(r,[rT,nT])}const ST=ia(oa);function ET(r){return sa(r,[tT,ST])}const OT=na(Z1,X1),TT=na(vv),AT=ia(oa,po,mo);function kT(r){return sa(r,[OT,wv],[TT,AT])}const _v="Invalid Duration",xv={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}},IT={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},...xv},Mn=146097/400,ua=146097/4800,PT={years:{quarters:4,months:12,weeks:Mn/7,days:Mn,hours:Mn*24,minutes:Mn*24*60,seconds:Mn*24*60*60,milliseconds:Mn*24*60*60*1e3},quarters:{months:3,weeks:Mn/28,days:Mn/4,hours:Mn*24/4,minutes:Mn*24*60/4,seconds:Mn*24*60*60/4,milliseconds:Mn*24*60*60*1e3/4},months:{weeks:ua/7,days:ua,hours:ua*24,minutes:ua*24*60,seconds:ua*24*60*60,milliseconds:ua*24*60*60*1e3},...xv},Ts=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],CT=Ts.slice(0).reverse();function Xi(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 Sv(r,e){let t=e.milliseconds??0;for(const n of CT.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function Ev(r,e){const t=Sv(r,e)<0?-1:1;Ts.reduceRight((n,i)=>{if(tt(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),Ts.reduce((n,i)=>{if(tt(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function NT(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?PT:IT;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 kt.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 kt({values:Vu(e,kt.normalizeUnit),loc:Lt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Ki(e))return kt.fromMillis(e);if(kt.isDuration(e))return e;if(typeof e=="object")return kt.fromObject(e);throw new Wr(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=xT(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]=ET(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 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 r1(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 pg(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):_v}toHuman(e={}){if(!this.isValid)return _v;const t=Ts.map(n=>{const i=this.values[n];return tt(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+=Qf(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},rt.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?Sv(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 Ts)(ta(t.values,i)||ta(this.values,i))&&(n[i]=t.get(i)+this.get(i));return Xi(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]=sv(e(this.values[n],n));return Xi(this,{values:t},!0)}get(e){return this[kt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Vu(e,kt.normalizeUnit)};return Xi(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 Xi(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Ev(this.matrix,e),Xi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=NT(this.normalize().shiftToAll().toObject());return Xi(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 Ts)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;Ki(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else Ki(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 Ev(this.matrix,t),Xi(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 Xi(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 Ts)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ca="Invalid Interval";function RT(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 t1(n);return new hr({invalid:n})}static fromDateTimes(e,t){const n=go(e),i=go(t),a=RT(n,i);return a??new hr({start:n,end:i})}static after(e,t){const n=kt.fromDurationLike(t),i=go(e);return hr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=kt.fromDurationLike(t),i=go(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=rt.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=rt.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 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(go).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()})`:ca}[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=Ru,t={}){return this.isValid?zr.create(this.s.loc.clone(t),e).formatInterval(this):ca}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ca}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ca}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ca}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ca}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 zu{static hasDST(e=fr.defaultZone){const t=rt.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return vi.isValidZone(e)}static normalizeZone(e){return Yi(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:ev(),localeWeek:tv()}}}function Ov(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 DT(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=Ov(f,h);return(d-d%7)/7}],["days",Ov]],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 FT(r,e,t,n){let[i,a,u,c]=DT(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=kt.fromObject(a,n);return h.length>0?kt.fromMillis(f,n).shiftTo(...h).plus(d):d}const MT="missing Intl.DateTimeFormat.formatToParts support";function Dt(r,e=t=>t){return{regex:r,deser:([t])=>e(O1(t))}}const Tv="[ ]",Av=new RegExp(Tv,"g");function LT(r){return r.replace(/\./g,"\\.?").replace(Av,Tv)}function kv(r){return r.replace(/\./g,"").replace(Av," ").toLowerCase()}function ei(r,e){return r===null?null:{regex:RegExp(r.map(LT).join("|")),deser:([t])=>r.findIndex(n=>kv(t)===kv(n))+e}}function Iv(r,e){return{regex:r,deser:([,t,n])=>Bu(t,n),groups:e}}function Hu(r){return{regex:r,deser:([e])=>e}}function jT(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qT(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(jT(x.val)),deser:([w])=>w,literal:!0}),A=(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 Dt(h);case"yy":return Dt(y,Gf);case"yyyy":return Dt(a);case"yyyyy":return Dt(g);case"yyyyyy":return Dt(u);case"M":return Dt(c);case"MM":return Dt(n);case"MMM":return ei(e.months("short",!0),1);case"MMMM":return ei(e.months("long",!0),1);case"L":return Dt(c);case"LL":return Dt(n);case"LLL":return ei(e.months("short",!1),1);case"LLLL":return ei(e.months("long",!1),1);case"d":return Dt(c);case"dd":return Dt(n);case"o":return Dt(f);case"ooo":return Dt(i);case"HH":return Dt(n);case"H":return Dt(c);case"hh":return Dt(n);case"h":return Dt(c);case"mm":return Dt(n);case"m":return Dt(c);case"q":return Dt(c);case"qq":return Dt(n);case"s":return Dt(c);case"ss":return Dt(n);case"S":return Dt(f);case"SSS":return Dt(i);case"u":return Hu(d);case"uu":return Hu(c);case"uuu":return Dt(t);case"a":return ei(e.meridiems(),0);case"kkkk":return Dt(a);case"kk":return Dt(y,Gf);case"W":return Dt(c);case"WW":return Dt(n);case"E":case"c":return Dt(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 Iv(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return Iv(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Hu(/[a-z_+-/]{1,256}?/i);case" ":return Hu(/[^\S\n\r]/);default:return m(x)}})(r)||{invalidReason:MT};return A.token=r,A}const UT={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 $T(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=UT[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function BT(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function VT(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(ta(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 WT(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 tt(r.z)||(t=vi.create(r.z)),tt(r.Z)||(t||(t=new Zr(r.Z)),n=r.Z),tt(r.q)||(r.M=(r.q-1)*3+1),tt(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),tt(r.u)||(r.S=Hf(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let Zf=null;function zT(){return Zf||(Zf=rt.fromMillis(1555555555555)),Zf}function HT(r,e){if(r.literal)return r;const t=zr.macroTokenToFormatOpts(r.val),n=Rv(t,e);return n==null||n.includes(void 0)?r:n}function Pv(r,e){return Array.prototype.concat(...r.map(t=>HT(t,e)))}class Cv{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Pv(zr.parseFormat(t),e),this.units=this.tokens.map(n=>qT(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=BT(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=VT(e,this.regex,this.handlers),[i,a,u]=n?WT(n):[null,null,void 0];if(ta(n,"a")&&ta(n,"H"))throw new Xs("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 Nv(r,e,t){return new Cv(r,t).explainFromTokens(e)}function QT(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=Nv(r,e,t);return[n,i,a,u]}function Rv(r,e){if(!r)return null;const n=zr.create(e,r).dtFormatter(zT()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>$T(u,r,a))}const Xf="Invalid DateTime",Dv=864e13;function yo(r){return new Xn("unsupported zone",`the zone "${r.name}" is not supported`)}function eh(r){return r.weekData===null&&(r.weekData=ju(r.c)),r.weekData}function th(r){return r.localWeekData===null&&(r.localWeekData=ju(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function As(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new rt({...t,...e,old:t})}function Fv(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 Gu(r,e,t){return Fv($u(r),e,t)}function Mv(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,Uu(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=$u(a);let[f,h]=Fv(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function la(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=rt.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return rt.invalid(new Xn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Ju(r,e,t=!0){return r.isValid?zr.create(Lt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function rh(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 Lv(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 jv={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},GT={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},JT={ordinal:1,hour:0,minute:0,second:0,millisecond:0},qv=["year","month","day","hour","minute","second","millisecond"],YT=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],KT=["year","ordinal","hour","minute","second","millisecond"];function ZT(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 pg(r);return e}function Uv(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ZT(r)}}function XT(r){return Ku[r]||(Yu===void 0&&(Yu=fr.now()),Ku[r]=r.offset(Yu)),Ku[r]}function $v(r,e){const t=Yi(e.zone,fr.defaultZone);if(!t.isValid)return rt.invalid(yo(t));const n=Lt.fromObject(e);let i,a;if(tt(r.year))i=fr.now();else{for(const f of qv)tt(r[f])&&(r[f]=jv[f]);const u=Zg(r)||Xg(r);if(u)return rt.invalid(u);const c=XT(t);[i,a]=Gu(r,c,t)}return new rt({ts:i,zone:t,loc:n,o:a})}function Bv(r,e,t){const n=tt(t.round)?!0:t.round,i=(u,c)=>(u=Qf(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 Vv(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 Yu,Ku={};class rt{constructor(e){const t=e.zone||fr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Xn("invalid input"):null)||(t.isValid?null:yo(t));this.ts=tt(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=Ki(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 rt({})}static local(){const[e,t]=Vv(arguments),[n,i,a,u,c,f,h]=t;return $v({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=Vv(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Zr.utcInstance,$v({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=P1(e)?e.valueOf():NaN;if(Number.isNaN(n))return rt.invalid("invalid input");const i=Yi(t.zone,fr.defaultZone);return i.isValid?new rt({ts:n,zone:i,loc:Lt.fromObject(t)}):rt.invalid(yo(i))}static fromMillis(e,t={}){if(Ki(e))return e<-Dv||e>Dv?rt.invalid("Timestamp out of range"):new rt({ts:e,zone:Yi(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(Ki(e))return new rt({ts:e*1e3,zone:Yi(t.zone,fr.defaultZone),loc:Lt.fromObject(t)});throw new Wr("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Yi(t.zone,fr.defaultZone);if(!n.isValid)return rt.invalid(yo(n));const i=Lt.fromObject(t),a=Vu(e,Uv),{minDaysInFirstWeek:u,startOfWeek:c}=Kg(a,i),f=fr.now(),h=tt(t.specificOffset)?n.offset(f):t.specificOffset,d=!tt(a.ordinal),y=!tt(a.year),g=!tt(a.month)||!tt(a.day),m=y||g,b=a.weekYear||a.weekNumber;if((m||d)&&b)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new Xs("Can't mix ordinal dates with month/day");const A=b||a.weekday&&!m;let x,w,O=Qu(f,h);A?(x=YT,w=GT,O=ju(O,u,c)):d?(x=KT,w=JT,O=Wf(O)):(x=qv,w=jv);let P=!1;for(const fe of x){const qe=a[fe];tt(qe)?P?a[fe]=w[fe]:a[fe]=O[fe]:P=!0}const R=A?A1(a,u,c):d?k1(a):Zg(a),F=R||Xg(a);if(F)return rt.invalid(F);const $=A?Jg(a,u,c):d?Yg(a):a,[te,J]=Gu($,h,n),ue=new rt({ts:te,zone:n,o:J,loc:i});return a.weekday&&m&&e.weekday!==ue.weekday?rt.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${ue.toISO()}`):ue.isValid?ue:rt.invalid(ue.invalid)}static fromISO(e,t={}){const[n,i]=bT(e);return la(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=wT(e);return la(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=_T(e);return la(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(tt(e)||tt(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]=QT(u,e,t);return d?rt.invalid(d):la(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return rt.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=kT(e);return la(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 e1(n);return new rt({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=Rv(e,Lt.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return Pv(zr.parseFormat(e),Lt.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Yu=void 0,Ku={}}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?eh(this).weekYear:NaN}get weekNumber(){return this.isValid?eh(this).weekNumber:NaN}get weekday(){return this.isValid?eh(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?th(this).weekday:NaN}get localWeekNumber(){return this.isValid?th(this).weekNumber:NaN}get localWeekYear(){return this.isValid?th(this).weekYear:NaN}get ordinal(){return this.isValid?Wf(this.c).ordinal:NaN}get monthShort(){return this.isValid?zu.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?zu.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?zu.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?zu.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=$u(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?[As(this,{ts:f}),As(this,{ts:h})]:[this]}get isInLeapYear(){return lo(this.year)}get daysInMonth(){return Uu(this.year,this.month)}get daysInYear(){return this.isValid?ra(this.year):NaN}get weeksInWeekYear(){return this.isValid?fo(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?fo(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=Yi(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]=Gu(u,a,e)}return As(this,{ts:i,zone:e})}else return rt.invalid(yo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return As(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Vu(e,Uv),{minDaysInFirstWeek:n,startOfWeek:i}=Kg(t,this.loc),a=!tt(t.weekYear)||!tt(t.weekNumber)||!tt(t.weekday),u=!tt(t.ordinal),c=!tt(t.year),f=!tt(t.month)||!tt(t.day),h=c||f,d=t.weekYear||t.weekNumber;if((h||u)&&d)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new Xs("Can't mix ordinal dates with month/day");let y;a?y=Jg({...ju(this.c,n,i),...t},n,i):tt(t.ordinal)?(y={...this.toObject(),...t},tt(t.day)&&(y.day=Math.min(Uu(y.year,y.month),y.day))):y=Yg({...Wf(this.c),...t});const[g,m]=Gu(y,this.o,this.zone);return As(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e);return As(this,Mv(this,t))}minus(e){if(!this.isValid)return this;const t=kt.fromDurationLike(e).negate();return As(this,Mv(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?zr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Xf}toLocaleString(e=Ru,t={}){return this.isValid?zr.create(this.loc.clone(t),e).formatDateTime(this):Xf}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=rh(this,u);return c+="T",c+=Lv(this,u,t,n,i,a),c}toISODate({format:e="extended"}={}){return this.isValid?rh(this,e==="extended"):null}toISOWeekDate(){return Ju(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":"")+Lv(this,u==="extended",t,e,n,a):null}toRFC2822(){return Ju(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ju(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?rh(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")),Ju(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Xf}[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=C1(t).map(kt.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=FT(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(rt.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||rt.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),Bv(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?Bv(e.base||rt.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(rt.isDateTime))throw new Wr("min requires all arguments be DateTimes");return rv(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(rt.isDateTime))throw new Wr("max requires all arguments be DateTimes");return rv(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 Nv(u,e,t)}static fromStringExplain(e,t,n={}){return rt.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 Cv(a,e)}static fromFormatParser(e,t,n={}){if(tt(e)||tt(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?rt.invalid(d):la(c,f,n,`format ${t.format}`,e,h)}static get DATE_SHORT(){return Ru}static get DATE_MED(){return mg}static get DATE_MED_WITH_WEEKDAY(){return n1}static get DATE_FULL(){return yg}static get DATE_HUGE(){return gg}static get TIME_SIMPLE(){return vg}static get TIME_WITH_SECONDS(){return bg}static get TIME_WITH_SHORT_OFFSET(){return wg}static get TIME_WITH_LONG_OFFSET(){return _g}static get TIME_24_SIMPLE(){return xg}static get TIME_24_WITH_SECONDS(){return Sg}static get TIME_24_WITH_SHORT_OFFSET(){return Eg}static get TIME_24_WITH_LONG_OFFSET(){return Og}static get DATETIME_SHORT(){return Tg}static get DATETIME_SHORT_WITH_SECONDS(){return Ag}static get DATETIME_MED(){return kg}static get DATETIME_MED_WITH_SECONDS(){return Ig}static get DATETIME_MED_WITH_WEEKDAY(){return i1}static get DATETIME_FULL(){return Pg}static get DATETIME_FULL_WITH_SECONDS(){return Cg}static get DATETIME_HUGE(){return Ng}static get DATETIME_HUGE_WITH_SECONDS(){return Rg}}function go(r){if(rt.isDateTime(r))return r;if(r&&r.valueOf&&Ki(r.valueOf()))return rt.fromJSDate(r);if(r&&typeof r=="object")return rt.fromObject(r);throw new Wr(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var Zu={exports:{}};/**
|
|
86
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):u||Cf.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),j(j({},r),{definitions:t})}function RO(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 DO(r){var e=Qy(r);if(!Pu.has(e)){var t=zx(r,{experimentalFragmentVariables:Nu,allowLegacyFragmentVariables:Nu});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Pu.set(e,RO(NO(t)))}return Pu.get(e)}function Qi(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]}),DO(n)}function Jy(){Pu.clear(),Cf.clear()}function Yy(){Gy=!1}function Ky(){Nu=!0}function Zy(){Nu=!1}var uo={gql:Qi,resetCaches:Jy,disableFragmentWarnings:Yy,enableExperimentalFragmentVariables:Ky,disableExperimentalFragmentVariables:Zy};(function(r){r.gql=uo.gql,r.resetCaches=uo.resetCaches,r.disableFragmentWarnings=uo.disableFragmentWarnings,r.enableExperimentalFragmentVariables=uo.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=uo.disableExperimentalFragmentVariables})(Qi||(Qi={})),Qi.default=Qi,Fp(globalThis.__DEV__!==!1?"log":"silent");const MO=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:lf,ApolloClient:If,ApolloError:gn,ApolloLink:Yr,get Cache(){return ff},DocumentTransform:yu,HttpLink:oy,InMemoryCache:Ef,MissingFieldError:hf,get NetworkStatus(){return Ot},Observable:Rt,ObservableQuery:Cu,checkFetcher:ny,concat:LE,createHttpLink:of,createSignalIfSupported:iO,defaultDataIdFromObject:df,defaultPrinter:sf,disableExperimentalFragmentVariables:Zy,disableFragmentWarnings:Yy,empty:DE,enableExperimentalFragmentVariables:Ky,execute:Ou,fallbackHttpConfig:ry,from:ME,fromError:Su,fromPromise:IE,get gql(){return Qi},isApolloError:nf,isNetworkRequestSettled:OO,isReference:Nt,makeReference:$i,makeVar:Oy,mergeOptions:zi,parseAndCheckHttpResponse:ty,resetCaches:Jy,rewriteURIForGET:sy,selectHttpOptionsAndBody:rO,selectHttpOptionsAndBodyInternal:af,selectURI:iy,serializeFetchParameter:Tu,setLogVerbosity:Fp,split:FE,throwServerError:tf,toPromise:kE},Symbol.toStringTag,{value:"Module"}));var Xy={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,me)})(Xy);var ct=Xy.exports;const eg=lx({__proto__:null,default:Pp(ct)},[ct]);var tg=uu?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Pf(){je("createContext"in eg,46);var r=ct.createContext[tg];return r||(Object.defineProperty(ct.createContext,tg,{value:r=ct.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var FO=function(r){var e=r.client,t=r.children,n=Pf(),i=ct.useContext(n),a=ct.useMemo(function(){return j(j({},i),{client:e||i.client})},[i,e]);return je(a.client,47),ct.createElement(n.Provider,{value:a},t)};function rg(r){var e=ct.useContext(Pf()),t=r||e.client;return je(!!t,50),t}var ng=!1,LO="useSyncExternalStore",jO=eg[LO],ig=jO||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!ng&&n!==e()&&(ng=!0,globalThis.__DEV__!==!1&&je.error(60));var i=ct.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return am?ct.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),Nf(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),ct.useEffect(function(){return Nf(a)&&u({inst:a}),r(function(){Nf(a)&&u({inst:a})})},[r]),n};function Nf(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 Ss;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 ag(r){Ss||(Ss=new lu(Yn.parser||1e3));var e=Ss.get(r);if(e)return e;var t,n,i;je(!!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}}je(!a.length||u.length||c.length||f.length,63),je(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;je(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 Ss.set(r,b),b}ag.resetCache=function(){Ss=void 0},globalThis.__DEV__!==!1&&kl("parser",function(){return Ss?Ss.size:0});function og(r,e){var t=ag(r),n=sg(e),i=sg(t.type);je(t.type===e,66,n,n,i)}function qO(r,e){var t=ct.useRef();return(!t.current||!Lt(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var Rf=El?ct.useLayoutEffect:ct.useEffect,UO=Object.prototype.hasOwnProperty;function ug(){}var Ru=Symbol();function $O(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=ct.useState(a),c=u[0],f=u[1];function h(y){var g,m;Object.assign(c.observable,(g={},g[Ru]=y,g));var b=c.resultData;f(j(j({},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 BO(r,e){var t=rg(e.client),n=ct.useContext(Pf()).renderPromises,i=!!n,a=t.disableNetworkFetches,u=e.ssr!==!1&&!e.skip,c=e.partialRefetch,f=cg(t,r,e,i),h=$O(t,r,e,n,f),d=h[0],y=d.observable,g=d.resultData,m=h[1],b=f(y);zO(g,y,t,e,b);var A=ct.useMemo(function(){return QO(y)},[y]);WO(y,n,u);var x=VO(g,y,t,e,b,a,c,i,{onCompleted:e.onCompleted||ug,onError:e.onError||ug});return{result:x,obsQueryFields:A,observable:y,resultData:g,client:t,onQueryExecuted:m}}function VO(r,e,t,n,i,a,u,c,f){var h=ct.useRef(f);ct.useEffect(function(){h.current=f});var d=(c||a)&&n.ssr===!1&&!n.skip?hg:n.skip||i.fetchPolicy==="standby"?dg:void 0,y=r.previousData,g=ct.useMemo(function(){return d&&Du(d,y,e,t)},[t,e,d,y]);return ig(ct.useCallback(function(m){if(c)return function(){};var b=function(){var w=r.current,O=e.getCurrentResult();w&&w.loading===O.loading&&w.networkStatus===O.networkStatus&&Lt(w.data,O.data)||Mf(O,r,e,t,u,m,h.current)},A=function(w){if(x.current.unsubscribe(),x.current=e.resubscribeAfterError(b,A),!UO.call(w,"graphQLErrors"))throw w;var O=r.current;(!O||O&&O.loading||!Lt(w,O.error))&&Mf({data:O&&O.data,error:w,loading:!1,networkStatus:Ot.error},r,e,t,u,m,h.current)},x={current:e.subscribe(b,A)};return function(){setTimeout(function(){return x.current.unsubscribe()})}},[a,c,e,r,u,t]),function(){return g||lg(r,e,h.current,u,t)},function(){return g||lg(r,e,h.current,u,t)})}function WO(r,e,t){e&&t&&(e.registerSSRObservable(r),r.getCurrentResult().loading&&e.addObservableQueryPromise(r))}function zO(r,e,t,n,i){var a;e[Ru]&&!Lt(e[Ru],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[Ru]=i}function cg(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||Ff(a,r.defaultOptions),f.fetchPolicy="standby"):f.fetchPolicy||(f.fetchPolicy=(c==null?void 0:c.options.initialFetchPolicy)||Ff(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(Wi(r&&r.options,n)),i.reduce(zi)}function Mf(r,e,t,n,i,a,u){var c=e.current;c&&c.data&&(e.previousData=c.data),!r.error&&yn(r.errors)&&(r.error=new gn({graphQLErrors:r.errors})),e.current=Du(GO(r,t,i),e.previousData,t,n),a(),HO(r,c==null?void 0:c.networkStatus,u)}function HO(r,e,t){if(!r.loading){var n=fg(r);Promise.resolve().then(function(){n?t.onError(n):r.data&&e!==r.networkStatus&&r.networkStatus===Ot.ready&&t.onCompleted(r.data)}).catch(function(i){globalThis.__DEV__!==!1&&je.warn(i)})}}function lg(r,e,t,n,i){return r.current||Mf(e.getCurrentResult(),r,e,i,n,function(){},t),r.current}function Ff(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 fg(r){return yn(r.errors)?new gn({graphQLErrors:r.errors}):r.error}function Du(r,e,t,n){var i=r.data;r.partial;var a=an(r,["data","partial"]),u=j(j({data:i},a),{client:n,observable:t,variables:t.variables,called:r!==hg&&r!==dg,previousData:e});return u}function GO(r,e,t){return r.partial&&t&&!r.loading&&(!r.data||Object.keys(r.data).length===0)&&e.options.fetchPolicy!=="cache-only"?(e.refetch(),j(j({},r),{loading:!0,networkStatus:Ot.refetch})):r}var hg=Qs({loading:!0,data:void 0,error:void 0,networkStatus:Ot.loading}),dg=Qs({loading:!1,data:void 0,error:void 0,networkStatus:Ot.ready});function QO(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 JO=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function YO(r,e){var t,n=ct.useRef(),i=ct.useRef(),a=ct.useRef(),u=zi(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=j(j({},u),{skip:!n.current}),h=BO(c,f),d=h.obsQueryFields,y=h.result,g=h.client,m=h.resultData,b=h.observable,A=h.onQueryExecuted,x=b.options.initialFetchPolicy||Ff(f.defaultOptions,g.defaultOptions),w=ct.useReducer(function(Q){return Q+1},0)[1],O=ct.useMemo(function(){for(var Q={},re=function(ve){var Ie=d[ve];Q[ve]=function(){return n.current||(n.current=Object.create(null),w()),Ie.apply(this,arguments)}},fe=0,ge=JO;fe<ge.length;fe++){var he=ge[fe];re(he)}return Q},[w,d]),C=!!n.current,D=ct.useMemo(function(){return j(j(j({},y),O),{called:C})},[y,O,C]),F=ct.useCallback(function(Q){n.current=Q?j(j({},Q),{fetchPolicy:Q.fetchPolicy||x}):{fetchPolicy:x};var re=zi(i.current,j({query:a.current},n.current)),fe=KO(m,b,g,c,j(j({},re),{skip:!1}),A).then(function(ge){return Object.assign(ge,O)});return fe.catch(function(){}),fe},[g,c,O,x,b,m,A]),B=ct.useRef(F);Rf(function(){B.current=F});var ee=ct.useCallback(function(){for(var Q=[],re=0;re<arguments.length;re++)Q[re]=arguments[re];return B.current.apply(B,Q)},[]);return[ee,D]}function KO(r,e,t,n,i,a){var u=i.query||n,c=cg(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(Du(e.getCurrentResult(),r.previousData,e,t))},complete:function(){h(Du(d,r.previousData,e,t))}})})}function ZO(r,e){e===void 0&&(e=Object.create(null));var t=ct.useRef(!1),n=rg(e.client);og(r,ui.Subscription),t.current||(t.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&je.warn(e.onData?53:54),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&je.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=qO(function(){return e.variables},[e.variables]),g=function(){return XO(n,r,y,a,u,f,h)},m=ct.useState(e.skip?null:g),b=m[0],A=m[1],x=ct.useRef(g);Rf(function(){x.current=g}),i?b&&A(b=null):(!b||(n!==b.__.client||r!==b.__.query||a!==b.__.fetchPolicy||u!==b.__.errorPolicy||!Lt(y,b.__.variables))&&(typeof c=="function"?!!c(e):c)!==!1)&&A(b=g());var w=ct.useRef(e);ct.useEffect(function(){w.current=e});var O=!i&&!d,C=ct.useMemo(function(){return{loading:O,error:void 0,data:void 0,variables:y}},[O,y]),D=ct.useRef(d);Rf(function(){D.current=d});var F=ig(ct.useCallback(function(ee){if(!b)return function(){};var Q=!1,re=b.__.variables,fe=b.__.client,ge=b.subscribe({next:function(he){var ve,Ie;if(!Q){var ye={loading:!1,data:he.data,error:fg(he),variables:re};b.__.setResult(ye),D.current||ee(),ye.error?(Ie=(ve=w.current).onError)===null||Ie===void 0||Ie.call(ve,ye.error):w.current.onData?w.current.onData({client:fe,data:ye}):w.current.onSubscriptionData&&w.current.onSubscriptionData({client:fe,subscriptionData:ye})}},error:function(he){var ve,Ie;he=he instanceof gn?he:new gn({protocolErrors:[he]}),Q||(b.__.setResult({loading:!1,data:void 0,error:he,variables:re}),D.current||ee(),(Ie=(ve=w.current).onError)===null||Ie===void 0||Ie.call(ve,he))},complete:function(){Q||(w.current.onComplete?w.current.onComplete():w.current.onSubscriptionComplete&&w.current.onSubscriptionComplete())}});return function(){Q=!0,setTimeout(function(){ge.unsubscribe()})}},[b]),function(){return b&&!i&&!d?b.__.result:C},function(){return C}),B=ct.useCallback(function(){je(!w.current.skip,57),A(x.current())},[w,x]);return ct.useMemo(function(){return j(j({},F),{restart:B})},[F,B])}function XO(r,e,t,n,i,a,u){var c={query:e,variables:t,fetchPolicy:n,errorPolicy:i,context:a,extensions:u},f=j(j({},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 Es extends Error{}class e1 extends Es{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class t1 extends Es{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class r1 extends Es{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Xs extends Es{}class pg extends Es{constructor(e){super(`Invalid unit ${e}`)}}class Wr extends Es{}class Ji extends Es{constructor(){super("Zone is an abstract class")}}const Te="numeric",Kn="short",vn="long",Mu={year:Te,month:Te,day:Te},mg={year:Te,month:Kn,day:Te},n1={year:Te,month:Kn,day:Te,weekday:Kn},yg={year:Te,month:vn,day:Te},gg={year:Te,month:vn,day:Te,weekday:vn},vg={hour:Te,minute:Te},bg={hour:Te,minute:Te,second:Te},wg={hour:Te,minute:Te,second:Te,timeZoneName:Kn},_g={hour:Te,minute:Te,second:Te,timeZoneName:vn},xg={hour:Te,minute:Te,hourCycle:"h23"},Sg={hour:Te,minute:Te,second:Te,hourCycle:"h23"},Eg={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Kn},Og={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:vn},Tg={year:Te,month:Te,day:Te,hour:Te,minute:Te},Ag={year:Te,month:Te,day:Te,hour:Te,minute:Te,second:Te},kg={year:Te,month:Kn,day:Te,hour:Te,minute:Te},Ig={year:Te,month:Kn,day:Te,hour:Te,minute:Te,second:Te},i1={year:Te,month:Kn,day:Te,weekday:Kn,hour:Te,minute:Te},Cg={year:Te,month:vn,day:Te,hour:Te,minute:Te,timeZoneName:Kn},Pg={year:Te,month:vn,day:Te,hour:Te,minute:Te,second:Te,timeZoneName:Kn},Ng={year:Te,month:vn,day:Te,weekday:vn,hour:Te,minute:Te,timeZoneName:vn},Rg={year:Te,month:vn,day:Te,weekday:vn,hour:Te,minute:Te,second:Te,timeZoneName:vn};class co{get type(){throw new Ji}get name(){throw new Ji}get ianaName(){return this.name}get isUniversal(){throw new Ji}offsetName(e,t){throw new Ji}formatOffset(e,t){throw new Ji}offset(e){throw new Ji}equals(e){throw new Ji}get isValid(){throw new Ji}}let Lf=null;class Fu extends co{static get instance(){return Lf===null&&(Lf=new Fu),Lf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return iv(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 Lu={};function s1(r){return Lu[r]||(Lu[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"})),Lu[r]}const a1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function o1(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 u1(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=a1[a];a==="era"?n[c]=u:Xe(c)||(n[c]=parseInt(u,10))}return n}let ju={};class bi extends co{static create(e){return ju[e]||(ju[e]=new bi(e)),ju[e]}static resetCache(){ju={},Lu={}}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 iv(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=s1(this.name);let[i,a,u,c,f,h,d]=n.formatToParts?u1(n,t):o1(n,t);c==="BC"&&(i=-Math.abs(i)+1);const g=Vu({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 Dg={};function c1(r,e={}){const t=JSON.stringify([r,e]);let n=Dg[t];return n||(n=new Intl.ListFormat(r,e),Dg[t]=n),n}let jf={};function qf(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 Uf={};function l1(r,e={}){const t=JSON.stringify([r,e]);let n=Uf[t];return n||(n=new Intl.NumberFormat(r,e),Uf[t]=n),n}let $f={};function f1(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=$f[i];return a||(a=new Intl.RelativeTimeFormat(r,e),$f[i]=a),a}let lo=null;function h1(){return lo||(lo=new Intl.DateTimeFormat().resolvedOptions().locale,lo)}let Mg={};function d1(r){let e=Mg[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Mg[r]=e}return e}function p1(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=qf(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=qf(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function m1(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function y1(r){const e=[];for(let t=1;t<=12;t++){const n=et.utc(2009,t,1);e.push(r(n))}return e}function g1(r){const e=[];for(let t=1;t<=7;t++){const n=et.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 v1(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 b1{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=l1(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):Jf(e,3);return _r(t,this.padTo)}}}class w1{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=qf(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 _1{constructor(e,t,n){this.opts={style:"long",...n},!t&&ev()&&(this.rtf=f1(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):W1(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const x1={firstDay:1,minimalDays:4,weekend:[6,7]};class jt{static fromOpts(e){return jt.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":h1()),f=t||fr.defaultNumberingSystem,h=n||fr.defaultOutputCalendar,d=Gf(i)||fr.defaultWeekSettings;return new jt(c,f,h,d,u)}static resetCache(){lo=null,jf={},Uf={},$f={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return jt.create(e,t,n,i)}constructor(e,t,n,i,a){const[u,c,f]=p1(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=m1(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=v1(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:jt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Gf(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]=y1(a=>this.extract(a,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return qu(this,e,lv,()=>{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]=g1(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return qu(this,void 0,()=>fv,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[et.utc(2016,11,13,9),et.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return qu(this,e,hv,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[et.utc(-40,1,1),et.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 b1(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new w1(e,this.intl,t)}relFormatter(e={}){return new _1(this.intl,this.isEnglish(),e)}listFormatter(e={}){return c1(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:tv()?d1(this.locale):x1}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 Bf=null;class Kr extends co{static get utcInstance(){return Bf===null&&(Bf=new Kr(0)),Bf}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(Wu(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 S1 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 Yi(r,e){if(Xe(r)||r===null)return e;if(r instanceof co)return r;if(I1(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Fu.instance:t==="utc"||t==="gmt"?Kr.utcInstance:Kr.parseSpecifier(t)||bi.create(r)}else return Ki(r)?Kr.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new S1(r)}const Vf={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Fg={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]},E1=Vf.hanidec.replace(/[\[|\]]/g,"").split("");function O1(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(Vf.hanidec)!==-1)e+=E1.indexOf(r[t]);else for(const i in Fg){const[a,u]=Fg[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}let ea={};function T1(){ea={}}function Zn({numberingSystem:r},e=""){const t=r||"latn";return ea[t]||(ea[t]={}),ea[t][e]||(ea[t][e]=new RegExp(`${Vf[t]}${e}`)),ea[t][e]}let Lg=()=>Date.now(),jg="system",qg=null,Ug=null,$g=null,Bg=60,Vg,Wg=null;class fr{static get now(){return Lg}static set now(e){Lg=e}static set defaultZone(e){jg=e}static get defaultZone(){return Yi(jg,Fu.instance)}static get defaultLocale(){return qg}static set defaultLocale(e){qg=e}static get defaultNumberingSystem(){return Ug}static set defaultNumberingSystem(e){Ug=e}static get defaultOutputCalendar(){return $g}static set defaultOutputCalendar(e){$g=e}static get defaultWeekSettings(){return Wg}static set defaultWeekSettings(e){Wg=Gf(e)}static get twoDigitCutoffYear(){return Bg}static set twoDigitCutoffYear(e){Bg=e%100}static get throwOnInvalid(){return Vg}static set throwOnInvalid(e){Vg=e}static resetCaches(){jt.resetCache(),bi.resetCache(),et.resetCache(),T1()}}class Xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const zg=[0,31,59,90,120,151,181,212,243,273,304,334],Hg=[0,31,60,91,121,152,182,213,244,274,305,335];function Dn(r,e){return new Xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Wf(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 Gg(r,e,t){return t+(fo(r)?Hg:zg)[e-1]}function Qg(r,e){const t=fo(r)?Hg:zg,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function zf(r,e){return(r-e+7)%7+1}function Uu(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=Gg(n,i,a),c=zf(Wf(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,...Hu(r)}}function Jg(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=zf(Wf(n,1,e),t),c=ra(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=ra(h)):f>c?(h=n+1,f-=ra(n)):h=n;const{month:d,day:y}=Qg(h,f);return{year:h,month:d,day:y,...Hu(r)}}function Hf(r){const{year:e,month:t,day:n}=r,i=Gg(e,t,n);return{year:e,ordinal:i,...Hu(r)}}function Yg(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Qg(e,t);return{year:e,month:n,day:i,...Hu(r)}}function Kg(r,e){if(!Xe(r.localWeekday)||!Xe(r.localWeekNumber)||!Xe(r.localWeekYear)){if(!Xe(r.weekday)||!Xe(r.weekNumber)||!Xe(r.weekYear))throw new Xs("Cannot mix locale-based week fields with ISO-based week fields");return Xe(r.localWeekday)||(r.weekday=r.localWeekday),Xe(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),Xe(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 A1(r,e=4,t=1){const n=$u(r.weekYear),i=Mn(r.weekNumber,1,ho(r.weekYear,e,t)),a=Mn(r.weekday,1,7);return n?i?a?!1:Dn("weekday",r.weekday):Dn("week",r.weekNumber):Dn("weekYear",r.weekYear)}function k1(r){const e=$u(r.year),t=Mn(r.ordinal,1,ra(r.year));return e?t?!1:Dn("ordinal",r.ordinal):Dn("year",r.year)}function Zg(r){const e=$u(r.year),t=Mn(r.month,1,12),n=Mn(r.day,1,Bu(r.year,r.month));return e?t?n?!1:Dn("day",r.day):Dn("month",r.month):Dn("year",r.year)}function Xg(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Mn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Mn(t,0,59),c=Mn(n,0,59),f=Mn(i,0,999);return a?u?c?f?!1:Dn("millisecond",i):Dn("second",n):Dn("minute",t):Dn("hour",e)}function Xe(r){return typeof r>"u"}function Ki(r){return typeof r=="number"}function $u(r){return typeof r=="number"&&r%1===0}function I1(r){return typeof r=="string"}function C1(r){return Object.prototype.toString.call(r)==="[object Date]"}function ev(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function tv(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function P1(r){return Array.isArray(r)?r:[r]}function rv(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 N1(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function ta(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Gf(r){if(r==null)return null;if(typeof r!="object")throw new Wr("Week settings must be an object");if(!Mn(r.firstDay,1,7)||!Mn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Mn(e,1,7)))throw new Wr("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Mn(r,e,t){return $u(r)&&r>=e&&r<=t}function R1(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 Zi(r){if(!(Xe(r)||r===null||r===""))return parseInt(r,10)}function Os(r){if(!(Xe(r)||r===null||r===""))return parseFloat(r)}function Qf(r){if(!(Xe(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Jf(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 ra(r){return fo(r)?366:365}function Bu(r,e){const t=R1(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 Vu(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 nv(r,e,t){return-zf(Wf(r,1,e),t)+e-1}function ho(r,e=4,t=1){const n=nv(r,e,t),i=nv(r+1,e,t);return(ra(r)-n+i)/7}function Yf(r){return r>99?r:r>fr.twoDigitCutoffYear?1900+r:2e3+r}function iv(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 Wu(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 zu(r,e){const t={};for(const n in r)if(ta(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}${_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 Hu(r){return N1(r,["hour","minute","second","millisecond"])}const D1=["January","February","March","April","May","June","July","August","September","October","November","December"],av=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],M1=["J","F","M","A","M","J","J","A","S","O","N","D"];function ov(r){switch(r){case"narrow":return[...M1];case"short":return[...av];case"long":return[...D1];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 uv=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],cv=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],F1=["M","T","W","T","F","S","S"];function lv(r){switch(r){case"narrow":return[...F1];case"short":return[...cv];case"long":return[...uv];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const fv=["AM","PM"],L1=["Before Christ","Anno Domini"],j1=["BC","AD"],q1=["B","A"];function hv(r){switch(r){case"narrow":return[...q1];case"short":return[...j1];case"long":return[...L1];default:return null}}function U1(r){return fv[r.hour<12?0:1]}function $1(r,e){return lv(e)[r.weekday-1]}function B1(r,e){return ov(e)[r.month-1]}function V1(r,e){return hv(e)[r.year<0?0:1]}function W1(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 dv(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const z1={D:Mu,DD:mg,DDD:yg,DDDD:gg,t:vg,tt:bg,ttt:wg,tttt:_g,T:xg,TT:Sg,TTT:Eg,TTTT:Og,f:Tg,ff:kg,fff:Cg,ffff:Ng,F:Ag,FF:Ig,FFF:Pg,FFFF:Rg};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 z1[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 _r(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?U1(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(m,b)=>n?B1(e,m):a(b?{month:m}:{month:m,day:"numeric"},"month"),h=(m,b)=>n?$1(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?V1(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 dv(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 dv(a,i(c))}}const pv=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function na(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function ia(...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 sa(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 mv(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=Zi(e[t+i]);return[n,null,t+i]}}const yv=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,H1=`(?:${yv.source}?(?:\\[(${pv.source})\\])?)?`,Kf=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,gv=RegExp(`${Kf.source}${H1}`),Zf=RegExp(`(?:T${gv.source})?`),G1=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Q1=/(\d{4})-?W(\d\d)(?:-?(\d))?/,J1=/(\d{4})-?(\d{3})/,Y1=mv("weekYear","weekNumber","weekDay"),K1=mv("year","ordinal"),Z1=/(\d{4})-(\d\d)-(\d\d)/,vv=RegExp(`${Kf.source} ?(?:${yv.source}|(${pv.source}))?`),X1=RegExp(`(?: ${vv.source})?`);function aa(r,e,t){const n=r[e];return Xe(n)?t:Zi(n)}function eT(r,e){return[{year:aa(r,e),month:aa(r,e+1,1),day:aa(r,e+2,1)},null,e+3]}function oa(r,e){return[{hours:aa(r,e,0),minutes:aa(r,e+1,0),seconds:aa(r,e+2,0),milliseconds:Qf(r[e+3])},null,e+4]}function mo(r,e){const t=!r[e]&&!r[e+1],n=Wu(r[e+1],r[e+2]),i=t?null:Kr.instance(n);return[{},i,e+3]}function yo(r,e){const t=r[e]?bi.create(r[e]):null;return[{},t,e+1]}const tT=RegExp(`^T?${Kf.source}$`),rT=/^-?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 nT(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(Os(t)),months:g(Os(n)),weeks:g(Os(i)),days:g(Os(a)),hours:g(Os(u)),minutes:g(Os(c)),seconds:g(Os(f),f==="-0"),milliseconds:g(Qf(h),y)}]}const iT={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 Xf(r,e,t,n,i,a,u){const c={year:e.length===2?Yf(Zi(e)):Zi(e),month:av.indexOf(t)+1,day:Zi(n),hour:Zi(i),minute:Zi(a)};return u&&(c.second=Zi(u)),r&&(c.weekday=r.length>3?uv.indexOf(r)+1:cv.indexOf(r)+1),c}const sT=/^(?:(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 aT(r){const[,e,t,n,i,a,u,c,f,h,d,y]=r,g=Xf(e,i,n,t,a,u,c);let m;return f?m=iT[f]:h?m=0:m=Wu(d,y),[g,new Kr(m)]}function oT(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const uT=/^(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$/,cT=/^(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$/,lT=/^(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 bv(r){const[,e,t,n,i,a,u,c]=r;return[Xf(e,i,n,t,a,u,c),Kr.utcInstance]}function fT(r){const[,e,t,n,i,a,u,c]=r;return[Xf(e,c,t,n,i,a,u),Kr.utcInstance]}const hT=na(G1,Zf),dT=na(Q1,Zf),pT=na(J1,Zf),mT=na(gv),wv=ia(eT,oa,mo,yo),yT=ia(Y1,oa,mo,yo),gT=ia(K1,oa,mo,yo),vT=ia(oa,mo,yo);function bT(r){return sa(r,[hT,wv],[dT,yT],[pT,gT],[mT,vT])}function wT(r){return sa(oT(r),[sT,aT])}function _T(r){return sa(r,[uT,bv],[cT,bv],[lT,fT])}function xT(r){return sa(r,[rT,nT])}const ST=ia(oa);function ET(r){return sa(r,[tT,ST])}const OT=na(Z1,X1),TT=na(vv),AT=ia(oa,mo,yo);function kT(r){return sa(r,[OT,wv],[TT,AT])}const _v="Invalid Duration",xv={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}},IT={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},...xv},Fn=146097/400,ua=146097/4800,CT={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:ua/7,days:ua,hours:ua*24,minutes:ua*24*60,seconds:ua*24*60*60,milliseconds:ua*24*60*60*1e3},...xv},Ts=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],PT=Ts.slice(0).reverse();function Xi(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 It(n)}function Sv(r,e){let t=e.milliseconds??0;for(const n of PT.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function Ev(r,e){const t=Sv(r,e)<0?-1:1;Ts.reduceRight((n,i)=>{if(Xe(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),Ts.reduce((n,i)=>{if(Xe(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function NT(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class It{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?CT:IT;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||jt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return It.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 It({values:zu(e,It.normalizeUnit),loc:jt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Ki(e))return It.fromMillis(e);if(It.isDuration(e))return e;if(typeof e=="object")return It.fromObject(e);throw new Wr(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=xT(e);return n?It.fromObject(n,t):It.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=ET(e);return n?It.fromObject(n,t):It.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 r1(n);return new It({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 pg(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):_v}toHuman(e={}){if(!this.isValid)return _v;const t=Ts.map(n=>{const i=this.values[n];return Xe(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+=Jf(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},et.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?Sv(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=It.fromDurationLike(e),n={};for(const i of Ts)(ta(t.values,i)||ta(this.values,i))&&(n[i]=t.get(i)+this.get(i));return Xi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=It.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 Xi(this,{values:t},!0)}get(e){return this[It.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...zu(e,It.normalizeUnit)};return Xi(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 Xi(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Ev(this.matrix,e),Xi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=NT(this.normalize().shiftToAll().toObject());return Xi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(u=>It.normalizeUnit(u));const t={},n={},i=this.toObject();let a;for(const u of Ts)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;Ki(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else Ki(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 Ev(this.matrix,t),Xi(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 Xi(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 Ts)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ca="Invalid Interval";function RT(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 t1(n);return new hr({invalid:n})}static fromDateTimes(e,t){const n=vo(e),i=vo(t),a=RT(n,i);return a??new hr({start:n,end:i})}static after(e,t){const n=It.fromDurationLike(t),i=vo(e);return hr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=It.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=et.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=et.fromISO(i,t),f=c.isValid}catch{f=!1}if(u&&f)return hr.fromDateTimes(a,c);if(u){const h=It.fromISO(i,t);if(h.isValid)return hr.after(a,h)}else if(f){const h=It.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=It.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()})`:ca}[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):ca}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ca}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ca}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ca}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ca}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):It.invalid(this.invalidReason)}mapEndpoints(e){return hr.fromDateTimes(e(this.s),e(this.e))}}class Gu{static hasDST(e=fr.defaultZone){const t=et.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 Yi(e,fr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||jt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||jt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||jt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||jt.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||jt.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||jt.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||jt.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return jt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return jt.create(t,null,"gregory").eras(e)}static features(){return{relative:ev(),localeWeek:tv()}}}function Ov(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(It.fromMillis(n).as("days"))}function DT(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=Ov(f,h);return(d-d%7)/7}],["days",Ov]],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 MT(r,e,t,n){let[i,a,u,c]=DT(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=It.fromObject(a,n);return h.length>0?It.fromMillis(f,n).shiftTo(...h).plus(d):d}const FT="missing Intl.DateTimeFormat.formatToParts support";function Dt(r,e=t=>t){return{regex:r,deser:([t])=>e(O1(t))}}const Tv="[ ]",Av=new RegExp(Tv,"g");function LT(r){return r.replace(/\./g,"\\.?").replace(Av,Tv)}function kv(r){return r.replace(/\./g,"").replace(Av," ").toLowerCase()}function ei(r,e){return r===null?null:{regex:RegExp(r.map(LT).join("|")),deser:([t])=>r.findIndex(n=>kv(t)===kv(n))+e}}function Iv(r,e){return{regex:r,deser:([,t,n])=>Wu(t,n),groups:e}}function Qu(r){return{regex:r,deser:([e])=>e}}function jT(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qT(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(jT(x.val)),deser:([w])=>w,literal:!0}),A=(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 Dt(h);case"yy":return Dt(y,Yf);case"yyyy":return Dt(a);case"yyyyy":return Dt(g);case"yyyyyy":return Dt(u);case"M":return Dt(c);case"MM":return Dt(n);case"MMM":return ei(e.months("short",!0),1);case"MMMM":return ei(e.months("long",!0),1);case"L":return Dt(c);case"LL":return Dt(n);case"LLL":return ei(e.months("short",!1),1);case"LLLL":return ei(e.months("long",!1),1);case"d":return Dt(c);case"dd":return Dt(n);case"o":return Dt(f);case"ooo":return Dt(i);case"HH":return Dt(n);case"H":return Dt(c);case"hh":return Dt(n);case"h":return Dt(c);case"mm":return Dt(n);case"m":return Dt(c);case"q":return Dt(c);case"qq":return Dt(n);case"s":return Dt(c);case"ss":return Dt(n);case"S":return Dt(f);case"SSS":return Dt(i);case"u":return Qu(d);case"uu":return Qu(c);case"uuu":return Dt(t);case"a":return ei(e.meridiems(),0);case"kkkk":return Dt(a);case"kk":return Dt(y,Yf);case"W":return Dt(c);case"WW":return Dt(n);case"E":case"c":return Dt(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 Iv(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return Iv(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Qu(/[a-z_+-/]{1,256}?/i);case" ":return Qu(/[^\S\n\r]/);default:return m(x)}})(r)||{invalidReason:FT};return A.token=r,A}const UT={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 $T(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=UT[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function BT(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function VT(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(ta(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 WT(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 Xe(r.z)||(t=bi.create(r.z)),Xe(r.Z)||(t||(t=new Kr(r.Z)),n=r.Z),Xe(r.q)||(r.M=(r.q-1)*3+1),Xe(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),Xe(r.u)||(r.S=Qf(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let eh=null;function zT(){return eh||(eh=et.fromMillis(1555555555555)),eh}function HT(r,e){if(r.literal)return r;const t=zr.macroTokenToFormatOpts(r.val),n=Rv(t,e);return n==null||n.includes(void 0)?r:n}function Cv(r,e){return Array.prototype.concat(...r.map(t=>HT(t,e)))}class Pv{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Cv(zr.parseFormat(t),e),this.units=this.tokens.map(n=>qT(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=BT(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=VT(e,this.regex,this.handlers),[i,a,u]=n?WT(n):[null,null,void 0];if(ta(n,"a")&&ta(n,"H"))throw new Xs("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 Nv(r,e,t){return new Pv(r,t).explainFromTokens(e)}function GT(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=Nv(r,e,t);return[n,i,a,u]}function Rv(r,e){if(!r)return null;const n=zr.create(e,r).dtFormatter(zT()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>$T(u,r,a))}const th="Invalid DateTime",Dv=864e13;function go(r){return new Xn("unsupported zone",`the zone "${r.name}" is not supported`)}function rh(r){return r.weekData===null&&(r.weekData=Uu(r.c)),r.weekData}function nh(r){return r.localWeekData===null&&(r.localWeekData=Uu(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function As(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new et({...t,...e,old:t})}function Mv(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 Ju(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 Yu(r,e,t){return Mv(Vu(r),e,t)}function Fv(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,Bu(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},u=It.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=Vu(a);let[f,h]=Mv(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function la(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=et.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return et.invalid(new Xn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Ku(r,e,t=!0){return r.isValid?zr.create(jt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function ih(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=_r(r.c.year,t?6:4),e?(n+="-",n+=_r(r.c.month),n+="-",n+=_r(r.c.day)):(n+=_r(r.c.month),n+=_r(r.c.day)),n}function Lv(r,e,t,n,i,a){let u=_r(r.c.hour);return e?(u+=":",u+=_r(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=":")):u+=_r(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=_r(r.c.second),(r.c.millisecond!==0||!n)&&(u+=".",u+=_r(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!a?u+="Z":r.o<0?(u+="-",u+=_r(Math.trunc(-r.o/60)),u+=":",u+=_r(Math.trunc(-r.o%60))):(u+="+",u+=_r(Math.trunc(r.o/60)),u+=":",u+=_r(Math.trunc(r.o%60)))),a&&(u+="["+r.zone.ianaName+"]"),u}const jv={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},QT={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},JT={ordinal:1,hour:0,minute:0,second:0,millisecond:0},qv=["year","month","day","hour","minute","second","millisecond"],YT=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],KT=["year","ordinal","hour","minute","second","millisecond"];function ZT(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 pg(r);return e}function Uv(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ZT(r)}}function XT(r){return Xu[r]||(Zu===void 0&&(Zu=fr.now()),Xu[r]=r.offset(Zu)),Xu[r]}function $v(r,e){const t=Yi(e.zone,fr.defaultZone);if(!t.isValid)return et.invalid(go(t));const n=jt.fromObject(e);let i,a;if(Xe(r.year))i=fr.now();else{for(const f of qv)Xe(r[f])&&(r[f]=jv[f]);const u=Zg(r)||Xg(r);if(u)return et.invalid(u);const c=XT(t);[i,a]=Yu(r,c,t)}return new et({ts:i,zone:t,loc:n,o:a})}function Bv(r,e,t){const n=Xe(t.round)?!0:t.round,i=(u,c)=>(u=Jf(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 Vv(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 Zu,Xu={};class et{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=Xe(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=Ki(e.o)&&!e.old?e.o:t.offset(this.ts);i=Ju(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||jt.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new et({})}static local(){const[e,t]=Vv(arguments),[n,i,a,u,c,f,h]=t;return $v({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=Vv(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Kr.utcInstance,$v({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=C1(e)?e.valueOf():NaN;if(Number.isNaN(n))return et.invalid("invalid input");const i=Yi(t.zone,fr.defaultZone);return i.isValid?new et({ts:n,zone:i,loc:jt.fromObject(t)}):et.invalid(go(i))}static fromMillis(e,t={}){if(Ki(e))return e<-Dv||e>Dv?et.invalid("Timestamp out of range"):new et({ts:e,zone:Yi(t.zone,fr.defaultZone),loc:jt.fromObject(t)});throw new Wr(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Ki(e))return new et({ts:e*1e3,zone:Yi(t.zone,fr.defaultZone),loc:jt.fromObject(t)});throw new Wr("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Yi(t.zone,fr.defaultZone);if(!n.isValid)return et.invalid(go(n));const i=jt.fromObject(t),a=zu(e,Uv),{minDaysInFirstWeek:u,startOfWeek:c}=Kg(a,i),f=fr.now(),h=Xe(t.specificOffset)?n.offset(f):t.specificOffset,d=!Xe(a.ordinal),y=!Xe(a.year),g=!Xe(a.month)||!Xe(a.day),m=y||g,b=a.weekYear||a.weekNumber;if((m||d)&&b)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new Xs("Can't mix ordinal dates with month/day");const A=b||a.weekday&&!m;let x,w,O=Ju(f,h);A?(x=YT,w=QT,O=Uu(O,u,c)):d?(x=KT,w=JT,O=Hf(O)):(x=qv,w=jv);let C=!1;for(const fe of x){const ge=a[fe];Xe(ge)?C?a[fe]=w[fe]:a[fe]=O[fe]:C=!0}const D=A?A1(a,u,c):d?k1(a):Zg(a),F=D||Xg(a);if(F)return et.invalid(F);const B=A?Jg(a,u,c):d?Yg(a):a,[ee,Q]=Yu(B,h,n),re=new et({ts:ee,zone:n,o:Q,loc:i});return a.weekday&&m&&e.weekday!==re.weekday?et.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${re.toISO()}`):re.isValid?re:et.invalid(re.invalid)}static fromISO(e,t={}){const[n,i]=bT(e);return la(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=wT(e);return la(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=_T(e);return la(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(Xe(e)||Xe(t))throw new Wr("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:a=null}=n,u=jt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,f,h,d]=GT(u,e,t);return d?et.invalid(d):la(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return et.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=kT(e);return la(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 e1(n);return new et({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=Rv(e,jt.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return Cv(zr.parseFormat(e),jt.fromObject(t)).map(i=>i.val).join("")}static resetCache(){Zu=void 0,Xu={}}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?rh(this).weekYear:NaN}get weekNumber(){return this.isValid?rh(this).weekNumber:NaN}get weekday(){return this.isValid?rh(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?nh(this).weekday:NaN}get localWeekNumber(){return this.isValid?nh(this).weekNumber:NaN}get localWeekYear(){return this.isValid?nh(this).weekYear:NaN}get ordinal(){return this.isValid?Hf(this.c).ordinal:NaN}get monthShort(){return this.isValid?Gu.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Gu.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Gu.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Gu.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=Vu(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=Ju(f,u),y=Ju(h,c);return d.hour===y.hour&&d.minute===y.minute&&d.second===y.second&&d.millisecond===y.millisecond?[As(this,{ts:f}),As(this,{ts:h})]:[this]}get isInLeapYear(){return fo(this.year)}get daysInMonth(){return Bu(this.year,this.month)}get daysInYear(){return this.isValid?ra(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(Kr.instance(e),t)}toLocal(){return this.setZone(fr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=Yi(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]=Yu(u,a,e)}return As(this,{ts:i,zone:e})}else return et.invalid(go(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return As(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=zu(e,Uv),{minDaysInFirstWeek:n,startOfWeek:i}=Kg(t,this.loc),a=!Xe(t.weekYear)||!Xe(t.weekNumber)||!Xe(t.weekday),u=!Xe(t.ordinal),c=!Xe(t.year),f=!Xe(t.month)||!Xe(t.day),h=c||f,d=t.weekYear||t.weekNumber;if((h||u)&&d)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new Xs("Can't mix ordinal dates with month/day");let y;a?y=Jg({...Uu(this.c,n,i),...t},n,i):Xe(t.ordinal)?(y={...this.toObject(),...t},Xe(t.day)&&(y.day=Math.min(Bu(y.year,y.month),y.day))):y=Yg({...Hf(this.c),...t});const[g,m]=Yu(y,this.o,this.zone);return As(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;const t=It.fromDurationLike(e);return As(this,Fv(this,t))}minus(e){if(!this.isValid)return this;const t=It.fromDurationLike(e).negate();return As(this,Fv(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=It.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):th}toLocaleString(e=Mu,t={}){return this.isValid?zr.create(this.loc.clone(t),e).formatDateTime(this):th}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=ih(this,u);return c+="T",c+=Lv(this,u,t,n,i,a),c}toISODate({format:e="extended"}={}){return this.isValid?ih(this,e==="extended"):null}toISOWeekDate(){return Ku(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":"")+Lv(this,u==="extended",t,e,n,a):null}toRFC2822(){return Ku(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ku(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ih(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")),Ku(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():th}[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 It.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=P1(t).map(It.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=MT(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(et.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||et.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),Bv(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?Bv(e.base||et.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(et.isDateTime))throw new Wr("min requires all arguments be DateTimes");return rv(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(et.isDateTime))throw new Wr("max requires all arguments be DateTimes");return rv(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:a=null}=n,u=jt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return Nv(u,e,t)}static fromStringExplain(e,t,n={}){return et.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,a=jt.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new Pv(a,e)}static fromFormatParser(e,t,n={}){if(Xe(e)||Xe(t))throw new Wr("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:a=null}=n,u=jt.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?et.invalid(d):la(c,f,n,`format ${t.format}`,e,h)}static get DATE_SHORT(){return Mu}static get DATE_MED(){return mg}static get DATE_MED_WITH_WEEKDAY(){return n1}static get DATE_FULL(){return yg}static get DATE_HUGE(){return gg}static get TIME_SIMPLE(){return vg}static get TIME_WITH_SECONDS(){return bg}static get TIME_WITH_SHORT_OFFSET(){return wg}static get TIME_WITH_LONG_OFFSET(){return _g}static get TIME_24_SIMPLE(){return xg}static get TIME_24_WITH_SECONDS(){return Sg}static get TIME_24_WITH_SHORT_OFFSET(){return Eg}static get TIME_24_WITH_LONG_OFFSET(){return Og}static get DATETIME_SHORT(){return Tg}static get DATETIME_SHORT_WITH_SECONDS(){return Ag}static get DATETIME_MED(){return kg}static get DATETIME_MED_WITH_SECONDS(){return Ig}static get DATETIME_MED_WITH_WEEKDAY(){return i1}static get DATETIME_FULL(){return Cg}static get DATETIME_FULL_WITH_SECONDS(){return Pg}static get DATETIME_HUGE(){return Ng}static get DATETIME_HUGE_WITH_SECONDS(){return Rg}}function vo(r){if(et.isDateTime(r))return r;if(r&&r.valueOf&&Ki(r.valueOf()))return et.fromJSDate(r);if(r&&typeof r=="object")return et.fromObject(r);throw new Wr(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var ec={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
|
-
*/Zu.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,A=2,x=1,w=2,O=4,P=8,R=16,F=32,$=64,te=128,J=256,ue=512,fe=30,qe="...",ve=800,De=16,je=1,ge=2,Je=3,be=1/0,ce=9007199254740991,Te=17976931348623157e292,Ne=NaN,Ee=4294967295,nt=Ee-1,Ot=Ee>>>1,ht=[["ary",te],["bind",x],["bindKey",w],["curry",P],["curryRight",R],["flip",ue],["partial",F],["partialRight",$],["rearg",J]],Pt="[object Arguments]",Xe="[object Array]",Ye="[object AsyncFunction]",dt="[object Boolean]",Re="[object Date]",_t="[object DOMException]",H="[object Error]",Y="[object Function]",B="[object GeneratorFunction]",Z="[object Map]",X="[object Number]",Q="[object Null]",we="[object Object]",ze="[object Promise]",Be="[object Proxy]",le="[object RegExp]",_e="[object Set]",et="[object String]",Tt="[object Symbol]",At="[object Undefined]",Yt="[object WeakMap]",xt="[object WeakSet]",Wt="[object ArrayBuffer]",Qt="[object DataView]",Er="[object Float32Array]",zt="[object Float64Array]",ir="[object Int8Array]",dr="[object Int16Array]",Ar="[object Int32Array]",Ht="[object Uint8Array]",W="[object Uint8ClampedArray]",z="[object Uint16Array]",it="[object Uint32Array]",yt=/\b__p \+= '';/g,ct=/\b(__p \+=) '' \+/g,Ve=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Kt=/&(?:amp|lt|gt|quot|#39);/g,Zt=/[&<>"']/g,Gt=RegExp(Kt.source),kr=RegExp(Zt.source),Hr=/<%-([\s\S]+?)%>/g,Mr=/<%([\s\S]+?)%>/g,Ut=/<%=([\s\S]+?)%>/g,Or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$r=/^\w*$/,Lr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sr=/[\\^$.*+?()[\]{}|]/g,Qr=RegExp(sr.source),Tr=/^\s+/,gr=/\s/,Ir=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Sn=/\{\n\/\* \[wrapped with (.+)\] \*/,Un=/,? & /,D=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,me=/\\(\\)?/g,ke=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$e=/\w*$/,ot=/^[-+]0x[0-9a-f]+$/i,He=/^0b[01]+$/i,Ke=/^\[object .+?Constructor\]$/,Ze=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,I=/($^)/,k=/['\n\r\u2028\u2029\\]/g,C="\\ud800-\\udfff",M="\\u0300-\\u036f",U="\\ufe20-\\ufe2f",ne="\\u20d0-\\u20ff",he=M+U+ne,G="\\u2700-\\u27bf",re="a-z\\xdf-\\xf6\\xf8-\\xff",Fe="\\xac\\xb1\\xd7\\xf7",gt="\\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",Ai="A-Z\\xc0-\\xd6\\xd8-\\xde",Bb="\\ufe0e\\ufe0f",Vb=Fe+gt+tr+En,wd="['’]",MP="["+C+"]",Wb="["+Vb+"]",vc="["+he+"]",zb="\\d+",LP="["+G+"]",Hb="["+re+"]",Qb="[^"+C+Vb+zb+G+re+Ai+"]",_d="\\ud83c[\\udffb-\\udfff]",jP="(?:"+vc+"|"+_d+")",Gb="[^"+C+"]",xd="(?:\\ud83c[\\udde6-\\uddff]){2}",Sd="[\\ud800-\\udbff][\\udc00-\\udfff]",Ea="["+Ai+"]",Jb="\\u200d",Yb="(?:"+Hb+"|"+Qb+")",qP="(?:"+Ea+"|"+Qb+")",Kb="(?:"+wd+"(?:d|ll|m|re|s|t|ve))?",Zb="(?:"+wd+"(?:D|LL|M|RE|S|T|VE))?",Xb=jP+"?",ew="["+Bb+"]?",UP="(?:"+Jb+"(?:"+[Gb,xd,Sd].join("|")+")"+ew+Xb+")*",$P="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",BP="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tw=ew+Xb+UP,VP="(?:"+[LP,xd,Sd].join("|")+")"+tw,WP="(?:"+[Gb+vc+"?",vc,xd,Sd,MP].join("|")+")",zP=RegExp(wd,"g"),HP=RegExp(vc,"g"),Ed=RegExp(_d+"(?="+_d+")|"+WP+tw,"g"),QP=RegExp([Ea+"?"+Hb+"+"+Kb+"(?="+[Wb,Ea,"$"].join("|")+")",qP+"+"+Zb+"(?="+[Wb,Ea+Yb,"$"].join("|")+")",Ea+"?"+Yb+"+"+Kb,Ea+"+"+Zb,BP,$P,zb,VP].join("|"),"g"),GP=RegExp("["+Jb+C+he+Bb+"]"),JP=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,YP=["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"],KP=-1,rr={};rr[Er]=rr[zt]=rr[ir]=rr[dr]=rr[Ar]=rr[Ht]=rr[W]=rr[z]=rr[it]=!0,rr[Pt]=rr[Xe]=rr[Wt]=rr[dt]=rr[Qt]=rr[Re]=rr[H]=rr[Y]=rr[Z]=rr[X]=rr[we]=rr[le]=rr[_e]=rr[et]=rr[Yt]=!1;var Xt={};Xt[Pt]=Xt[Xe]=Xt[Wt]=Xt[Qt]=Xt[dt]=Xt[Re]=Xt[Er]=Xt[zt]=Xt[ir]=Xt[dr]=Xt[Ar]=Xt[Z]=Xt[X]=Xt[we]=Xt[le]=Xt[_e]=Xt[et]=Xt[Tt]=Xt[Ht]=Xt[W]=Xt[z]=Xt[it]=!0,Xt[H]=Xt[Y]=Xt[Yt]=!1;var ZP={À:"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"},XP={"&":"&","<":"<",">":">",'"':""","'":"'"},eC={"&":"&","<":"<",">":">",""":'"',"'":"'"},tC={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rC=parseFloat,nC=parseInt,rw=typeof di=="object"&&di&&di.Object===Object&&di,iC=typeof self=="object"&&self&&self.Object===Object&&self,Br=rw||iC||Function("return this")(),Od=e&&!e.nodeType&&e,Cs=Od&&!0&&r&&!r.nodeType&&r,nw=Cs&&Cs.exports===Od,Td=nw&&rw.process,$n=function(){try{var q=Cs&&Cs.require&&Cs.require("util").types;return q||Td&&Td.binding&&Td.binding("util")}catch{}}(),iw=$n&&$n.isArrayBuffer,sw=$n&&$n.isDate,aw=$n&&$n.isMap,ow=$n&&$n.isRegExp,uw=$n&&$n.isSet,cw=$n&&$n.isTypedArray;function On(q,ee,K){switch(K.length){case 0:return q.call(ee);case 1:return q.call(ee,K[0]);case 2:return q.call(ee,K[0],K[1]);case 3:return q.call(ee,K[0],K[1],K[2])}return q.apply(ee,K)}function sC(q,ee,K,Pe){for(var st=-1,Ft=q==null?0:q.length;++st<Ft;){var Pr=q[st];ee(Pe,Pr,K(Pr),q)}return Pe}function Bn(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe&&ee(q[K],K,q)!==!1;);return q}function aC(q,ee){for(var K=q==null?0:q.length;K--&&ee(q[K],K,q)!==!1;);return q}function lw(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe;)if(!ee(q[K],K,q))return!1;return!0}function ss(q,ee){for(var K=-1,Pe=q==null?0:q.length,st=0,Ft=[];++K<Pe;){var Pr=q[K];ee(Pr,K,q)&&(Ft[st++]=Pr)}return Ft}function bc(q,ee){var K=q==null?0:q.length;return!!K&&Oa(q,ee,0)>-1}function Ad(q,ee,K){for(var Pe=-1,st=q==null?0:q.length;++Pe<st;)if(K(ee,q[Pe]))return!0;return!1}function ar(q,ee){for(var K=-1,Pe=q==null?0:q.length,st=Array(Pe);++K<Pe;)st[K]=ee(q[K],K,q);return st}function as(q,ee){for(var K=-1,Pe=ee.length,st=q.length;++K<Pe;)q[st+K]=ee[K];return q}function kd(q,ee,K,Pe){var st=-1,Ft=q==null?0:q.length;for(Pe&&Ft&&(K=q[++st]);++st<Ft;)K=ee(K,q[st],st,q);return K}function oC(q,ee,K,Pe){var st=q==null?0:q.length;for(Pe&&st&&(K=q[--st]);st--;)K=ee(K,q[st],st,q);return K}function Id(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe;)if(ee(q[K],K,q))return!0;return!1}var uC=Pd("length");function cC(q){return q.split("")}function lC(q){return q.match(D)||[]}function fw(q,ee,K){var Pe;return K(q,function(st,Ft,Pr){if(ee(st,Ft,Pr))return Pe=Ft,!1}),Pe}function wc(q,ee,K,Pe){for(var st=q.length,Ft=K+(Pe?1:-1);Pe?Ft--:++Ft<st;)if(ee(q[Ft],Ft,q))return Ft;return-1}function Oa(q,ee,K){return ee===ee?xC(q,ee,K):wc(q,hw,K)}function fC(q,ee,K,Pe){for(var st=K-1,Ft=q.length;++st<Ft;)if(Pe(q[st],ee))return st;return-1}function hw(q){return q!==q}function dw(q,ee){var K=q==null?0:q.length;return K?Nd(q,ee)/K:Ne}function Pd(q){return function(ee){return ee==null?t:ee[q]}}function Cd(q){return function(ee){return q==null?t:q[ee]}}function pw(q,ee,K,Pe,st){return st(q,function(Ft,Pr,Jt){K=Pe?(Pe=!1,Ft):ee(K,Ft,Pr,Jt)}),K}function hC(q,ee){var K=q.length;for(q.sort(ee);K--;)q[K]=q[K].value;return q}function Nd(q,ee){for(var K,Pe=-1,st=q.length;++Pe<st;){var Ft=ee(q[Pe]);Ft!==t&&(K=K===t?Ft:K+Ft)}return K}function Rd(q,ee){for(var K=-1,Pe=Array(q);++K<q;)Pe[K]=ee(K);return Pe}function dC(q,ee){return ar(ee,function(K){return[K,q[K]]})}function mw(q){return q&&q.slice(0,bw(q)+1).replace(Tr,"")}function Tn(q){return function(ee){return q(ee)}}function Dd(q,ee){return ar(ee,function(K){return q[K]})}function Mo(q,ee){return q.has(ee)}function yw(q,ee){for(var K=-1,Pe=q.length;++K<Pe&&Oa(ee,q[K],0)>-1;);return K}function gw(q,ee){for(var K=q.length;K--&&Oa(ee,q[K],0)>-1;);return K}function pC(q,ee){for(var K=q.length,Pe=0;K--;)q[K]===ee&&++Pe;return Pe}var mC=Cd(ZP),yC=Cd(XP);function gC(q){return"\\"+tC[q]}function vC(q,ee){return q==null?t:q[ee]}function Ta(q){return GP.test(q)}function bC(q){return JP.test(q)}function wC(q){for(var ee,K=[];!(ee=q.next()).done;)K.push(ee.value);return K}function Fd(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe,st){K[++ee]=[st,Pe]}),K}function vw(q,ee){return function(K){return q(ee(K))}}function os(q,ee){for(var K=-1,Pe=q.length,st=0,Ft=[];++K<Pe;){var Pr=q[K];(Pr===ee||Pr===d)&&(q[K]=d,Ft[st++]=K)}return Ft}function _c(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe){K[++ee]=Pe}),K}function _C(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe){K[++ee]=[Pe,Pe]}),K}function xC(q,ee,K){for(var Pe=K-1,st=q.length;++Pe<st;)if(q[Pe]===ee)return Pe;return-1}function SC(q,ee,K){for(var Pe=K+1;Pe--;)if(q[Pe]===ee)return Pe;return Pe}function Aa(q){return Ta(q)?OC(q):uC(q)}function ii(q){return Ta(q)?TC(q):cC(q)}function bw(q){for(var ee=q.length;ee--&&gr.test(q.charAt(ee)););return ee}var EC=Cd(eC);function OC(q){for(var ee=Ed.lastIndex=0;Ed.test(q);)++ee;return ee}function TC(q){return q.match(Ed)||[]}function AC(q){return q.match(QP)||[]}var kC=function q(ee){ee=ee==null?Br:ka.defaults(Br.Object(),ee,ka.pick(Br,YP));var K=ee.Array,Pe=ee.Date,st=ee.Error,Ft=ee.Function,Pr=ee.Math,Jt=ee.Object,Md=ee.RegExp,IC=ee.String,Vn=ee.TypeError,xc=K.prototype,PC=Ft.prototype,Ia=Jt.prototype,Sc=ee["__core-js_shared__"],Ec=PC.toString,$t=Ia.hasOwnProperty,CC=0,ww=function(){var s=/[^.]+$/.exec(Sc&&Sc.keys&&Sc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Oc=Ia.toString,NC=Ec.call(Jt),RC=Br._,DC=Md("^"+Ec.call($t).replace(sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Tc=nw?ee.Buffer:t,us=ee.Symbol,Ac=ee.Uint8Array,_w=Tc?Tc.allocUnsafe:t,kc=vw(Jt.getPrototypeOf,Jt),xw=Jt.create,Sw=Ia.propertyIsEnumerable,Ic=xc.splice,Ew=us?us.isConcatSpreadable:t,Lo=us?us.iterator:t,Ns=us?us.toStringTag:t,Pc=function(){try{var s=Ls(Jt,"defineProperty");return s({},"",{}),s}catch{}}(),FC=ee.clearTimeout!==Br.clearTimeout&&ee.clearTimeout,MC=Pe&&Pe.now!==Br.Date.now&&Pe.now,LC=ee.setTimeout!==Br.setTimeout&&ee.setTimeout,Cc=Pr.ceil,Nc=Pr.floor,Ld=Jt.getOwnPropertySymbols,jC=Tc?Tc.isBuffer:t,Ow=ee.isFinite,qC=xc.join,UC=vw(Jt.keys,Jt),Cr=Pr.max,Gr=Pr.min,$C=Pe.now,BC=ee.parseInt,Tw=Pr.random,VC=xc.reverse,jd=Ls(ee,"DataView"),jo=Ls(ee,"Map"),qd=Ls(ee,"Promise"),Pa=Ls(ee,"Set"),qo=Ls(ee,"WeakMap"),Uo=Ls(Jt,"create"),Rc=qo&&new qo,Ca={},WC=js(jd),zC=js(jo),HC=js(qd),QC=js(Pa),GC=js(qo),Dc=us?us.prototype:t,$o=Dc?Dc.valueOf:t,Aw=Dc?Dc.toString:t;function S(s){if(pr(s)&&!at(s)&&!(s instanceof wt)){if(s instanceof Wn)return s;if($t.call(s,"__wrapped__"))return k_(s)}return new Wn(s)}var Na=function(){function s(){}return function(o){if(!lr(o))return{};if(xw)return xw(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function Fc(){}function Wn(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}S.templateSettings={escape:Hr,evaluate:Mr,interpolate:Ut,variable:"",imports:{_:S}},S.prototype=Fc.prototype,S.prototype.constructor=S,Wn.prototype=Na(Fc.prototype),Wn.prototype.constructor=Wn;function wt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ee,this.__views__=[]}function JC(){var s=new wt(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 YC(){if(this.__filtered__){var s=new wt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function KC(){var s=this.__wrapped__.value(),o=this.__dir__,l=at(s),p=o<0,v=l?s.length:0,T=cR(0,v,this.__views__),N=T.start,L=T.end,V=L-N,ie=p?L:N-1,ae=this.__iteratees__,de=ae.length,Ae=0,Ue=Gr(V,this.__takeCount__);if(!l||!p&&v==V&&Ue==V)return Kw(s,this.__actions__);var Qe=[];e:for(;V--&&Ae<Ue;){ie+=o;for(var ft=-1,Ge=s[ie];++ft<de;){var vt=ae[ft],St=vt.iteratee,In=vt.type,an=St(Ge);if(In==ge)Ge=an;else if(!an){if(In==je)continue e;break e}}Qe[Ae++]=Ge}return Qe}wt.prototype=Na(Fc.prototype),wt.prototype.constructor=wt;function Rs(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 ZC(){this.__data__=Uo?Uo(null):{},this.size=0}function XC(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function eN(s){var o=this.__data__;if(Uo){var l=o[s];return l===f?t:l}return $t.call(o,s)?o[s]:t}function tN(s){var o=this.__data__;return Uo?o[s]!==t:$t.call(o,s)}function rN(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=Uo&&o===t?f:o,this}Rs.prototype.clear=ZC,Rs.prototype.delete=XC,Rs.prototype.get=eN,Rs.prototype.has=tN,Rs.prototype.set=rN;function ki(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 nN(){this.__data__=[],this.size=0}function iN(s){var o=this.__data__,l=Mc(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():Ic.call(o,l,1),--this.size,!0}function sN(s){var o=this.__data__,l=Mc(o,s);return l<0?t:o[l][1]}function aN(s){return Mc(this.__data__,s)>-1}function oN(s,o){var l=this.__data__,p=Mc(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}ki.prototype.clear=nN,ki.prototype.delete=iN,ki.prototype.get=sN,ki.prototype.has=aN,ki.prototype.set=oN;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 uN(){this.size=0,this.__data__={hash:new Rs,map:new(jo||ki),string:new Rs}}function cN(s){var o=Gc(this,s).delete(s);return this.size-=o?1:0,o}function lN(s){return Gc(this,s).get(s)}function fN(s){return Gc(this,s).has(s)}function hN(s,o){var l=Gc(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Ii.prototype.clear=uN,Ii.prototype.delete=cN,Ii.prototype.get=lN,Ii.prototype.has=fN,Ii.prototype.set=hN;function Ds(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Ii;++o<l;)this.add(s[o])}function dN(s){return this.__data__.set(s,f),this}function pN(s){return this.__data__.has(s)}Ds.prototype.add=Ds.prototype.push=dN,Ds.prototype.has=pN;function si(s){var o=this.__data__=new ki(s);this.size=o.size}function mN(){this.__data__=new ki,this.size=0}function yN(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function gN(s){return this.__data__.get(s)}function vN(s){return this.__data__.has(s)}function bN(s,o){var l=this.__data__;if(l instanceof ki){var p=l.__data__;if(!jo||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Ii(p)}return l.set(s,o),this.size=l.size,this}si.prototype.clear=mN,si.prototype.delete=yN,si.prototype.get=gN,si.prototype.has=vN,si.prototype.set=bN;function kw(s,o){var l=at(s),p=!l&&qs(s),v=!l&&!p&&ds(s),T=!l&&!p&&!v&&Ma(s),N=l||p||v||T,L=N?Rd(s.length,IC):[],V=L.length;for(var ie in s)(o||$t.call(s,ie))&&!(N&&(ie=="length"||v&&(ie=="offset"||ie=="parent")||T&&(ie=="buffer"||ie=="byteLength"||ie=="byteOffset")||Ri(ie,V)))&&L.push(ie);return L}function Iw(s){var o=s.length;return o?s[Yd(0,o-1)]:t}function wN(s,o){return Jc(ln(s),Fs(o,0,s.length))}function _N(s){return Jc(ln(s))}function Ud(s,o,l){(l!==t&&!ai(s[o],l)||l===t&&!(o in s))&&Pi(s,o,l)}function Bo(s,o,l){var p=s[o];(!($t.call(s,o)&&ai(p,l))||l===t&&!(o in s))&&Pi(s,o,l)}function Mc(s,o){for(var l=s.length;l--;)if(ai(s[l][0],o))return l;return-1}function xN(s,o,l,p){return cs(s,function(v,T,N){o(p,v,l(v),N)}),p}function Pw(s,o){return s&&fi(o,jr(o),s)}function SN(s,o){return s&&fi(o,hn(o),s)}function Pi(s,o,l){o=="__proto__"&&Pc?Pc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function $d(s,o){for(var l=-1,p=o.length,v=K(p),T=s==null;++l<p;)v[l]=T?t:_p(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,T){var N,L=o&y,V=o&g,ie=o&m;if(l&&(N=v?l(s,p,v,T):l(s)),N!==t)return N;if(!lr(s))return s;var ae=at(s);if(ae){if(N=fR(s),!L)return ln(s,N)}else{var de=Jr(s),Ae=de==Y||de==B;if(ds(s))return e_(s,L);if(de==we||de==Pt||Ae&&!v){if(N=V||Ae?{}:b_(s),!L)return V?eR(s,SN(N,s)):XN(s,Pw(N,s))}else{if(!Xt[de])return v?s:{};N=hR(s,de,L)}}T||(T=new si);var Ue=T.get(s);if(Ue)return Ue;T.set(s,N),G_(s)?s.forEach(function(Ge){N.add(zn(Ge,o,l,Ge,s,T))}):H_(s)&&s.forEach(function(Ge,vt){N.set(vt,zn(Ge,o,l,vt,s,T))});var Qe=ie?V?op:ap:V?hn:jr,ft=ae?t:Qe(s);return Bn(ft||s,function(Ge,vt){ft&&(vt=Ge,Ge=s[vt]),Bo(N,vt,zn(Ge,o,l,vt,s,T))}),N}function EN(s){var o=jr(s);return function(l){return Cw(l,s,o)}}function Cw(s,o,l){var p=l.length;if(s==null)return!p;for(s=Jt(s);p--;){var v=l[p],T=o[v],N=s[v];if(N===t&&!(v in s)||!T(N))return!1}return!0}function Nw(s,o,l){if(typeof s!="function")throw new Vn(u);return Jo(function(){s.apply(t,l)},o)}function Vo(s,o,l,p){var v=-1,T=bc,N=!0,L=s.length,V=[],ie=o.length;if(!L)return V;l&&(o=ar(o,Tn(l))),p?(T=Ad,N=!1):o.length>=i&&(T=Mo,N=!1,o=new Ds(o));e:for(;++v<L;){var ae=s[v],de=l==null?ae:l(ae);if(ae=p||ae!==0?ae:0,N&&de===de){for(var Ae=ie;Ae--;)if(o[Ae]===de)continue e;V.push(ae)}else T(o,de,p)||V.push(ae)}return V}var cs=s_(li),Rw=s_(Vd,!0);function ON(s,o){var l=!0;return cs(s,function(p,v,T){return l=!!o(p,v,T),l}),l}function Lc(s,o,l){for(var p=-1,v=s.length;++p<v;){var T=s[p],N=o(T);if(N!=null&&(L===t?N===N&&!kn(N):l(N,L)))var L=N,V=T}return V}function TN(s,o,l,p){var v=s.length;for(l=lt(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:lt(p),p<0&&(p+=v),p=l>p?0:Y_(p);l<p;)s[l++]=o;return s}function Dw(s,o){var l=[];return cs(s,function(p,v,T){o(p,v,T)&&l.push(p)}),l}function Vr(s,o,l,p,v){var T=-1,N=s.length;for(l||(l=pR),v||(v=[]);++T<N;){var L=s[T];o>0&&l(L)?o>1?Vr(L,o-1,l,p,v):as(v,L):p||(v[v.length]=L)}return v}var Bd=a_(),Fw=a_(!0);function li(s,o){return s&&Bd(s,o,jr)}function Vd(s,o){return s&&Fw(s,o,jr)}function jc(s,o){return ss(o,function(l){return Di(s[l])})}function Ms(s,o){o=fs(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[hi(o[l++])];return l&&l==p?s:t}function Mw(s,o,l){var p=o(s);return at(s)?p:as(p,l(s))}function nn(s){return s==null?s===t?At:Q:Ns&&Ns in Jt(s)?uR(s):_R(s)}function Wd(s,o){return s>o}function AN(s,o){return s!=null&&$t.call(s,o)}function kN(s,o){return s!=null&&o in Jt(s)}function IN(s,o,l){return s>=Gr(o,l)&&s<Cr(o,l)}function zd(s,o,l){for(var p=l?Ad:bc,v=s[0].length,T=s.length,N=T,L=K(T),V=1/0,ie=[];N--;){var ae=s[N];N&&o&&(ae=ar(ae,Tn(o))),V=Gr(ae.length,V),L[N]=!l&&(o||v>=120&&ae.length>=120)?new Ds(N&&ae):t}ae=s[0];var de=-1,Ae=L[0];e:for(;++de<v&&ie.length<V;){var Ue=ae[de],Qe=o?o(Ue):Ue;if(Ue=l||Ue!==0?Ue:0,!(Ae?Mo(Ae,Qe):p(ie,Qe,l))){for(N=T;--N;){var ft=L[N];if(!(ft?Mo(ft,Qe):p(s[N],Qe,l)))continue e}Ae&&Ae.push(Qe),ie.push(Ue)}}return ie}function PN(s,o,l,p){return li(s,function(v,T,N){o(p,l(v),T,N)}),p}function Wo(s,o,l){o=fs(o,s),s=S_(s,o);var p=s==null?s:s[hi(Qn(o))];return p==null?t:On(p,s,l)}function Lw(s){return pr(s)&&nn(s)==Pt}function CN(s){return pr(s)&&nn(s)==Wt}function NN(s){return pr(s)&&nn(s)==Re}function zo(s,o,l,p,v){return s===o?!0:s==null||o==null||!pr(s)&&!pr(o)?s!==s&&o!==o:RN(s,o,l,p,zo,v)}function RN(s,o,l,p,v,T){var N=at(s),L=at(o),V=N?Xe:Jr(s),ie=L?Xe:Jr(o);V=V==Pt?we:V,ie=ie==Pt?we:ie;var ae=V==we,de=ie==we,Ae=V==ie;if(Ae&&ds(s)){if(!ds(o))return!1;N=!0,ae=!1}if(Ae&&!ae)return T||(T=new si),N||Ma(s)?y_(s,o,l,p,v,T):aR(s,o,V,l,p,v,T);if(!(l&b)){var Ue=ae&&$t.call(s,"__wrapped__"),Qe=de&&$t.call(o,"__wrapped__");if(Ue||Qe){var ft=Ue?s.value():s,Ge=Qe?o.value():o;return T||(T=new si),v(ft,Ge,l,p,T)}}return Ae?(T||(T=new si),oR(s,o,l,p,v,T)):!1}function DN(s){return pr(s)&&Jr(s)==Z}function Hd(s,o,l,p){var v=l.length,T=v,N=!p;if(s==null)return!T;for(s=Jt(s);v--;){var L=l[v];if(N&&L[2]?L[1]!==s[L[0]]:!(L[0]in s))return!1}for(;++v<T;){L=l[v];var V=L[0],ie=s[V],ae=L[1];if(N&&L[2]){if(ie===t&&!(V in s))return!1}else{var de=new si;if(p)var Ae=p(ie,ae,V,s,o,de);if(!(Ae===t?zo(ae,ie,b|A,p,de):Ae))return!1}}return!0}function jw(s){if(!lr(s)||yR(s))return!1;var o=Di(s)?DC:Ke;return o.test(js(s))}function FN(s){return pr(s)&&nn(s)==le}function MN(s){return pr(s)&&Jr(s)==_e}function LN(s){return pr(s)&&tl(s.length)&&!!rr[nn(s)]}function qw(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?at(s)?Bw(s[0],s[1]):$w(s):ox(s)}function Qd(s){if(!Go(s))return UC(s);var o=[];for(var l in Jt(s))$t.call(s,l)&&l!="constructor"&&o.push(l);return o}function jN(s){if(!lr(s))return wR(s);var o=Go(s),l=[];for(var p in s)p=="constructor"&&(o||!$t.call(s,p))||l.push(p);return l}function Gd(s,o){return s<o}function Uw(s,o){var l=-1,p=fn(s)?K(s.length):[];return cs(s,function(v,T,N){p[++l]=o(v,T,N)}),p}function $w(s){var o=cp(s);return o.length==1&&o[0][2]?__(o[0][0],o[0][1]):function(l){return l===s||Hd(l,s,o)}}function Bw(s,o){return fp(s)&&w_(o)?__(hi(s),o):function(l){var p=_p(l,s);return p===t&&p===o?xp(l,s):zo(o,p,b|A)}}function qc(s,o,l,p,v){s!==o&&Bd(o,function(T,N){if(v||(v=new si),lr(T))qN(s,o,N,l,qc,p,v);else{var L=p?p(dp(s,N),T,N+"",s,o,v):t;L===t&&(L=T),Ud(s,N,L)}},hn)}function qN(s,o,l,p,v,T,N){var L=dp(s,l),V=dp(o,l),ie=N.get(V);if(ie){Ud(s,l,ie);return}var ae=T?T(L,V,l+"",s,o,N):t,de=ae===t;if(de){var Ae=at(V),Ue=!Ae&&ds(V),Qe=!Ae&&!Ue&&Ma(V);ae=V,Ae||Ue||Qe?at(L)?ae=L:vr(L)?ae=ln(L):Ue?(de=!1,ae=e_(V,!0)):Qe?(de=!1,ae=t_(V,!0)):ae=[]:Yo(V)||qs(V)?(ae=L,qs(L)?ae=K_(L):(!lr(L)||Di(L))&&(ae=b_(V))):de=!1}de&&(N.set(V,ae),v(ae,V,p,T,N),N.delete(V)),Ud(s,l,ae)}function Vw(s,o){var l=s.length;if(l)return o+=o<0?l:0,Ri(o,l)?s[o]:t}function Ww(s,o,l){o.length?o=ar(o,function(T){return at(T)?function(N){return Ms(N,T.length===1?T[0]:T)}:T}):o=[dn];var p=-1;o=ar(o,Tn(We()));var v=Uw(s,function(T,N,L){var V=ar(o,function(ie){return ie(T)});return{criteria:V,index:++p,value:T}});return hC(v,function(T,N){return ZN(T,N,l)})}function UN(s,o){return zw(s,o,function(l,p){return xp(s,p)})}function zw(s,o,l){for(var p=-1,v=o.length,T={};++p<v;){var N=o[p],L=Ms(s,N);l(L,N)&&Ho(T,fs(N,s),L)}return T}function $N(s){return function(o){return Ms(o,s)}}function Jd(s,o,l,p){var v=p?fC:Oa,T=-1,N=o.length,L=s;for(s===o&&(o=ln(o)),l&&(L=ar(s,Tn(l)));++T<N;)for(var V=0,ie=o[T],ae=l?l(ie):ie;(V=v(L,ae,V,p))>-1;)L!==s&&Ic.call(L,V,1),Ic.call(s,V,1);return s}function Hw(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==T){var T=v;Ri(v)?Ic.call(s,v,1):Xd(s,v)}}return s}function Yd(s,o){return s+Nc(Tw()*(o-s+1))}function BN(s,o,l,p){for(var v=-1,T=Cr(Cc((o-s)/(l||1)),0),N=K(T);T--;)N[p?T:++v]=s,s+=l;return N}function Kd(s,o){var l="";if(!s||o<1||o>ce)return l;do o%2&&(l+=s),o=Nc(o/2),o&&(s+=s);while(o);return l}function pt(s,o){return pp(x_(s,o,dn),s+"")}function VN(s){return Iw(La(s))}function WN(s,o){var l=La(s);return Jc(l,Fs(o,0,l.length))}function Ho(s,o,l,p){if(!lr(s))return s;o=fs(o,s);for(var v=-1,T=o.length,N=T-1,L=s;L!=null&&++v<T;){var V=hi(o[v]),ie=l;if(V==="__proto__"||V==="constructor"||V==="prototype")return s;if(v!=N){var ae=L[V];ie=p?p(ae,V,L):t,ie===t&&(ie=lr(ae)?ae:Ri(o[v+1])?[]:{})}Bo(L,V,ie),L=L[V]}return s}var Qw=Rc?function(s,o){return Rc.set(s,o),s}:dn,zN=Pc?function(s,o){return Pc(s,"toString",{configurable:!0,enumerable:!1,value:Ep(o),writable:!0})}:dn;function HN(s){return Jc(La(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 T=K(v);++p<v;)T[p]=s[p+o];return T}function QN(s,o){var l;return cs(s,function(p,v,T){return l=o(p,v,T),!l}),!!l}function Uc(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=Ot){for(;p<v;){var T=p+v>>>1,N=s[T];N!==null&&!kn(N)&&(l?N<=o:N<o)?p=T+1:v=T}return v}return Zd(s,o,dn,l)}function Zd(s,o,l,p){var v=0,T=s==null?0:s.length;if(T===0)return 0;o=l(o);for(var N=o!==o,L=o===null,V=kn(o),ie=o===t;v<T;){var ae=Nc((v+T)/2),de=l(s[ae]),Ae=de!==t,Ue=de===null,Qe=de===de,ft=kn(de);if(N)var Ge=p||Qe;else ie?Ge=Qe&&(p||Ae):L?Ge=Qe&&Ae&&(p||!Ue):V?Ge=Qe&&Ae&&!Ue&&(p||!ft):Ue||ft?Ge=!1:Ge=p?de<=o:de<o;Ge?v=ae+1:T=ae}return Gr(T,nt)}function Gw(s,o){for(var l=-1,p=s.length,v=0,T=[];++l<p;){var N=s[l],L=o?o(N):N;if(!l||!ai(L,V)){var V=L;T[v++]=N===0?0:N}}return T}function Jw(s){return typeof s=="number"?s:kn(s)?Ne:+s}function An(s){if(typeof s=="string")return s;if(at(s))return ar(s,An)+"";if(kn(s))return Aw?Aw.call(s):"";var o=s+"";return o=="0"&&1/s==-be?"-0":o}function ls(s,o,l){var p=-1,v=bc,T=s.length,N=!0,L=[],V=L;if(l)N=!1,v=Ad;else if(T>=i){var ie=o?null:iR(s);if(ie)return _c(ie);N=!1,v=Mo,V=new Ds}else V=o?[]:L;e:for(;++p<T;){var ae=s[p],de=o?o(ae):ae;if(ae=l||ae!==0?ae:0,N&&de===de){for(var Ae=V.length;Ae--;)if(V[Ae]===de)continue e;o&&V.push(de),L.push(ae)}else v(V,de,l)||(V!==L&&V.push(de),L.push(ae))}return L}function Xd(s,o){return o=fs(o,s),s=S_(s,o),s==null||delete s[hi(Qn(o))]}function Yw(s,o,l,p){return Ho(s,o,l(Ms(s,o)),p)}function $c(s,o,l,p){for(var v=s.length,T=p?v:-1;(p?T--:++T<v)&&o(s[T],T,s););return l?Hn(s,p?0:T,p?T+1:v):Hn(s,p?T+1:0,p?v:T)}function Kw(s,o){var l=s;return l instanceof wt&&(l=l.value()),kd(o,function(p,v){return v.func.apply(v.thisArg,as([p],v.args))},l)}function ep(s,o,l){var p=s.length;if(p<2)return p?ls(s[0]):[];for(var v=-1,T=K(p);++v<p;)for(var N=s[v],L=-1;++L<p;)L!=v&&(T[v]=Vo(T[v]||N,s[L],o,l));return ls(Vr(T,1),o,l)}function Zw(s,o,l){for(var p=-1,v=s.length,T=o.length,N={};++p<v;){var L=p<T?o[p]:t;l(N,s[p],L)}return N}function tp(s){return vr(s)?s:[]}function rp(s){return typeof s=="function"?s:dn}function fs(s,o){return at(s)?s:fp(s,o)?[s]:A_(qt(s))}var GN=pt;function hs(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:Hn(s,o,l)}var Xw=FC||function(s){return Br.clearTimeout(s)};function e_(s,o){if(o)return s.slice();var l=s.length,p=_w?_w(l):new s.constructor(l);return s.copy(p),p}function np(s){var o=new s.constructor(s.byteLength);return new Ac(o).set(new Ac(s)),o}function JN(s,o){var l=o?np(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function YN(s){var o=new s.constructor(s.source,$e.exec(s));return o.lastIndex=s.lastIndex,o}function KN(s){return $o?Jt($o.call(s)):{}}function t_(s,o){var l=o?np(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function r_(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,T=kn(s),N=o!==t,L=o===null,V=o===o,ie=kn(o);if(!L&&!ie&&!T&&s>o||T&&N&&V&&!L&&!ie||p&&N&&V||!l&&V||!v)return 1;if(!p&&!T&&!ie&&s<o||ie&&l&&v&&!p&&!T||L&&l&&v||!N&&v||!V)return-1}return 0}function ZN(s,o,l){for(var p=-1,v=s.criteria,T=o.criteria,N=v.length,L=l.length;++p<N;){var V=r_(v[p],T[p]);if(V){if(p>=L)return V;var ie=l[p];return V*(ie=="desc"?-1:1)}}return s.index-o.index}function n_(s,o,l,p){for(var v=-1,T=s.length,N=l.length,L=-1,V=o.length,ie=Cr(T-N,0),ae=K(V+ie),de=!p;++L<V;)ae[L]=o[L];for(;++v<N;)(de||v<T)&&(ae[l[v]]=s[v]);for(;ie--;)ae[L++]=s[v++];return ae}function i_(s,o,l,p){for(var v=-1,T=s.length,N=-1,L=l.length,V=-1,ie=o.length,ae=Cr(T-L,0),de=K(ae+ie),Ae=!p;++v<ae;)de[v]=s[v];for(var Ue=v;++V<ie;)de[Ue+V]=o[V];for(;++N<L;)(Ae||v<T)&&(de[Ue+l[N]]=s[v++]);return de}function ln(s,o){var l=-1,p=s.length;for(o||(o=K(p));++l<p;)o[l]=s[l];return o}function fi(s,o,l,p){var v=!l;l||(l={});for(var T=-1,N=o.length;++T<N;){var L=o[T],V=p?p(l[L],s[L],L,l,s):t;V===t&&(V=s[L]),v?Pi(l,L,V):Bo(l,L,V)}return l}function XN(s,o){return fi(s,lp(s),o)}function eR(s,o){return fi(s,g_(s),o)}function Bc(s,o){return function(l,p){var v=at(l)?sC:xN,T=o?o():{};return v(l,s,We(p,2),T)}}function Ra(s){return pt(function(o,l){var p=-1,v=l.length,T=v>1?l[v-1]:t,N=v>2?l[2]:t;for(T=s.length>3&&typeof T=="function"?(v--,T):t,N&&sn(l[0],l[1],N)&&(T=v<3?t:T,v=1),o=Jt(o);++p<v;){var L=l[p];L&&s(o,L,p,T)}return o})}function s_(s,o){return function(l,p){if(l==null)return l;if(!fn(l))return s(l,p);for(var v=l.length,T=o?v:-1,N=Jt(l);(o?T--:++T<v)&&p(N[T],T,N)!==!1;);return l}}function a_(s){return function(o,l,p){for(var v=-1,T=Jt(o),N=p(o),L=N.length;L--;){var V=N[s?L:++v];if(l(T[V],V,T)===!1)break}return o}}function tR(s,o,l){var p=o&x,v=Qo(s);function T(){var N=this&&this!==Br&&this instanceof T?v:s;return N.apply(p?l:this,arguments)}return T}function o_(s){return function(o){o=qt(o);var l=Ta(o)?ii(o):t,p=l?l[0]:o.charAt(0),v=l?hs(l,1).join(""):o.slice(1);return p[s]()+v}}function Da(s){return function(o){return kd(sx(ix(o).replace(zP,"")),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=Na(s.prototype),p=s.apply(l,o);return lr(p)?p:l}}function rR(s,o,l){var p=Qo(s);function v(){for(var T=arguments.length,N=K(T),L=T,V=Fa(v);L--;)N[L]=arguments[L];var ie=T<3&&N[0]!==V&&N[T-1]!==V?[]:os(N,V);if(T-=ie.length,T<l)return h_(s,o,Vc,v.placeholder,t,N,ie,t,t,l-T);var ae=this&&this!==Br&&this instanceof v?p:s;return On(ae,this,N)}return v}function u_(s){return function(o,l,p){var v=Jt(o);if(!fn(o)){var T=We(l,3);o=jr(o),l=function(L){return T(v[L],L,v)}}var N=s(o,l,p);return N>-1?v[T?o[N]:N]:t}}function c_(s){return Ni(function(o){var l=o.length,p=l,v=Wn.prototype.thru;for(s&&o.reverse();p--;){var T=o[p];if(typeof T!="function")throw new Vn(u);if(v&&!N&&Qc(T)=="wrapper")var N=new Wn([],!0)}for(p=N?p:l;++p<l;){T=o[p];var L=Qc(T),V=L=="wrapper"?up(T):t;V&&hp(V[0])&&V[1]==(te|P|F|J)&&!V[4].length&&V[9]==1?N=N[Qc(V[0])].apply(N,V[3]):N=T.length==1&&hp(T)?N[L]():N.thru(T)}return function(){var ie=arguments,ae=ie[0];if(N&&ie.length==1&&at(ae))return N.plant(ae).value();for(var de=0,Ae=l?o[de].apply(this,ie):ae;++de<l;)Ae=o[de].call(this,Ae);return Ae}})}function Vc(s,o,l,p,v,T,N,L,V,ie){var ae=o&te,de=o&x,Ae=o&w,Ue=o&(P|R),Qe=o&ue,ft=Ae?t:Qo(s);function Ge(){for(var vt=arguments.length,St=K(vt),In=vt;In--;)St[In]=arguments[In];if(Ue)var an=Fa(Ge),Pn=pC(St,an);if(p&&(St=n_(St,p,v,Ue)),T&&(St=i_(St,T,N,Ue)),vt-=Pn,Ue&&vt<ie){var br=os(St,an);return h_(s,o,Vc,Ge.placeholder,l,St,br,L,V,ie-vt)}var oi=de?l:this,Mi=Ae?oi[s]:s;return vt=St.length,L?St=xR(St,L):Qe&&vt>1&&St.reverse(),ae&&V<vt&&(St.length=V),this&&this!==Br&&this instanceof Ge&&(Mi=ft||Qo(Mi)),Mi.apply(oi,St)}return Ge}function l_(s,o){return function(l,p){return PN(l,s,o(p),{})}}function Wc(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=Jw(l),p=Jw(p)),v=s(l,p)}return v}}function ip(s){return Ni(function(o){return o=ar(o,Tn(We())),pt(function(l){var p=this;return s(o,function(v){return On(v,p,l)})})})}function zc(s,o){o=o===t?" ":An(o);var l=o.length;if(l<2)return l?Kd(o,s):o;var p=Kd(o,Cc(s/Aa(o)));return Ta(o)?hs(ii(p),0,s).join(""):p.slice(0,s)}function nR(s,o,l,p){var v=o&x,T=Qo(s);function N(){for(var L=-1,V=arguments.length,ie=-1,ae=p.length,de=K(ae+V),Ae=this&&this!==Br&&this instanceof N?T:s;++ie<ae;)de[ie]=p[ie];for(;V--;)de[ie++]=arguments[++L];return On(Ae,v?l:this,de)}return N}function f_(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),BN(o,l,p,s)}}function Hc(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=Gn(o),l=Gn(l)),s(o,l)}}function h_(s,o,l,p,v,T,N,L,V,ie){var ae=o&P,de=ae?N:t,Ae=ae?t:N,Ue=ae?T:t,Qe=ae?t:T;o|=ae?F:$,o&=~(ae?$:F),o&O||(o&=~(x|w));var ft=[s,o,v,Ue,de,Qe,Ae,L,V,ie],Ge=l.apply(t,ft);return hp(s)&&E_(Ge,ft),Ge.placeholder=p,O_(Ge,s,o)}function sp(s){var o=Pr[s];return function(l,p){if(l=Gn(l),p=p==null?0:Gr(lt(p),292),p&&Ow(l)){var v=(qt(l)+"e").split("e"),T=o(v[0]+"e"+(+v[1]+p));return v=(qt(T)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var iR=Pa&&1/_c(new Pa([,-0]))[1]==be?function(s){return new Pa(s)}:Ap;function d_(s){return function(o){var l=Jr(o);return l==Z?Fd(o):l==_e?_C(o):dC(o,s(o))}}function Ci(s,o,l,p,v,T,N,L){var V=o&w;if(!V&&typeof s!="function")throw new Vn(u);var ie=p?p.length:0;if(ie||(o&=~(F|$),p=v=t),N=N===t?N:Cr(lt(N),0),L=L===t?L:lt(L),ie-=v?v.length:0,o&$){var ae=p,de=v;p=v=t}var Ae=V?t:up(s),Ue=[s,o,l,p,v,ae,de,T,N,L];if(Ae&&bR(Ue,Ae),s=Ue[0],o=Ue[1],l=Ue[2],p=Ue[3],v=Ue[4],L=Ue[9]=Ue[9]===t?V?0:s.length:Cr(Ue[9]-ie,0),!L&&o&(P|R)&&(o&=~(P|R)),!o||o==x)var Qe=tR(s,o,l);else o==P||o==R?Qe=rR(s,o,L):(o==F||o==(x|F))&&!v.length?Qe=nR(s,o,l,p):Qe=Vc.apply(t,Ue);var ft=Ae?Qw:E_;return O_(ft(Qe,Ue),s,o)}function p_(s,o,l,p){return s===t||ai(s,Ia[l])&&!$t.call(p,l)?o:s}function m_(s,o,l,p,v,T){return lr(s)&&lr(o)&&(T.set(o,s),qc(s,o,t,m_,T),T.delete(o)),s}function sR(s){return Yo(s)?t:s}function y_(s,o,l,p,v,T){var N=l&b,L=s.length,V=o.length;if(L!=V&&!(N&&V>L))return!1;var ie=T.get(s),ae=T.get(o);if(ie&&ae)return ie==o&&ae==s;var de=-1,Ae=!0,Ue=l&A?new Ds:t;for(T.set(s,o),T.set(o,s);++de<L;){var Qe=s[de],ft=o[de];if(p)var Ge=N?p(ft,Qe,de,o,s,T):p(Qe,ft,de,s,o,T);if(Ge!==t){if(Ge)continue;Ae=!1;break}if(Ue){if(!Id(o,function(vt,St){if(!Mo(Ue,St)&&(Qe===vt||v(Qe,vt,l,p,T)))return Ue.push(St)})){Ae=!1;break}}else if(!(Qe===ft||v(Qe,ft,l,p,T))){Ae=!1;break}}return T.delete(s),T.delete(o),Ae}function aR(s,o,l,p,v,T,N){switch(l){case Qt:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Wt:return!(s.byteLength!=o.byteLength||!T(new Ac(s),new Ac(o)));case dt:case Re:case X:return ai(+s,+o);case H:return s.name==o.name&&s.message==o.message;case le:case et:return s==o+"";case Z:var L=Fd;case _e:var V=p&b;if(L||(L=_c),s.size!=o.size&&!V)return!1;var ie=N.get(s);if(ie)return ie==o;p|=A,N.set(s,o);var ae=y_(L(s),L(o),p,v,T,N);return N.delete(s),ae;case Tt:if($o)return $o.call(s)==$o.call(o)}return!1}function oR(s,o,l,p,v,T){var N=l&b,L=ap(s),V=L.length,ie=ap(o),ae=ie.length;if(V!=ae&&!N)return!1;for(var de=V;de--;){var Ae=L[de];if(!(N?Ae in o:$t.call(o,Ae)))return!1}var Ue=T.get(s),Qe=T.get(o);if(Ue&&Qe)return Ue==o&&Qe==s;var ft=!0;T.set(s,o),T.set(o,s);for(var Ge=N;++de<V;){Ae=L[de];var vt=s[Ae],St=o[Ae];if(p)var In=N?p(St,vt,Ae,o,s,T):p(vt,St,Ae,s,o,T);if(!(In===t?vt===St||v(vt,St,l,p,T):In)){ft=!1;break}Ge||(Ge=Ae=="constructor")}if(ft&&!Ge){var an=s.constructor,Pn=o.constructor;an!=Pn&&"constructor"in s&&"constructor"in o&&!(typeof an=="function"&&an instanceof an&&typeof Pn=="function"&&Pn instanceof Pn)&&(ft=!1)}return T.delete(s),T.delete(o),ft}function Ni(s){return pp(x_(s,t,C_),s+"")}function ap(s){return Mw(s,jr,lp)}function op(s){return Mw(s,hn,g_)}var up=Rc?function(s){return Rc.get(s)}:Ap;function Qc(s){for(var o=s.name+"",l=Ca[o],p=$t.call(Ca,o)?l.length:0;p--;){var v=l[p],T=v.func;if(T==null||T==s)return v.name}return o}function Fa(s){var o=$t.call(S,"placeholder")?S:s;return o.placeholder}function We(){var s=S.iteratee||Op;return s=s===Op?qw:s,arguments.length?s(arguments[0],arguments[1]):s}function Gc(s,o){var l=s.__data__;return mR(o)?l[typeof o=="string"?"string":"hash"]:l.map}function cp(s){for(var o=jr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,w_(v)]}return o}function Ls(s,o){var l=vC(s,o);return jw(l)?l:t}function uR(s){var o=$t.call(s,Ns),l=s[Ns];try{s[Ns]=t;var p=!0}catch{}var v=Oc.call(s);return p&&(o?s[Ns]=l:delete s[Ns]),v}var lp=Ld?function(s){return s==null?[]:(s=Jt(s),ss(Ld(s),function(o){return Sw.call(s,o)}))}:kp,g_=Ld?function(s){for(var o=[];s;)as(o,lp(s)),s=kc(s);return o}:kp,Jr=nn;(jd&&Jr(new jd(new ArrayBuffer(1)))!=Qt||jo&&Jr(new jo)!=Z||qd&&Jr(qd.resolve())!=ze||Pa&&Jr(new Pa)!=_e||qo&&Jr(new qo)!=Yt)&&(Jr=function(s){var o=nn(s),l=o==we?s.constructor:t,p=l?js(l):"";if(p)switch(p){case WC:return Qt;case zC:return Z;case HC:return ze;case QC:return _e;case GC:return Yt}return o});function cR(s,o,l){for(var p=-1,v=l.length;++p<v;){var T=l[p],N=T.size;switch(T.type){case"drop":s+=N;break;case"dropRight":o-=N;break;case"take":o=Gr(o,s+N);break;case"takeRight":s=Cr(s,o-N);break}}return{start:s,end:o}}function lR(s){var o=s.match(Sn);return o?o[1].split(Un):[]}function v_(s,o,l){o=fs(o,s);for(var p=-1,v=o.length,T=!1;++p<v;){var N=hi(o[p]);if(!(T=s!=null&&l(s,N)))break;s=s[N]}return T||++p!=v?T:(v=s==null?0:s.length,!!v&&tl(v)&&Ri(N,v)&&(at(s)||qs(s)))}function fR(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 b_(s){return typeof s.constructor=="function"&&!Go(s)?Na(kc(s)):{}}function hR(s,o,l){var p=s.constructor;switch(o){case Wt:return np(s);case dt:case Re:return new p(+s);case Qt:return JN(s,l);case Er:case zt:case ir:case dr:case Ar:case Ht:case W:case z:case it:return t_(s,l);case Z:return new p;case X:case et:return new p(s);case le:return YN(s);case _e:return new p;case Tt:return KN(s)}}function dR(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
|
+
*/ec.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,A=2,x=1,w=2,O=4,C=8,D=16,F=32,B=64,ee=128,Q=256,re=512,fe=30,ge="...",he=800,ve=16,Ie=1,ye=2,Be=3,_e=1/0,ce=9007199254740991,Ae=17976931348623157e292,Me=NaN,Oe=4294967295,tt=Oe-1,Tt=Oe>>>1,ft=[["ary",ee],["bind",x],["bindKey",w],["curry",C],["curryRight",D],["flip",re],["partial",F],["partialRight",B],["rearg",Q]],Pt="[object Arguments]",rt="[object Array]",Ye="[object AsyncFunction]",pt="[object Boolean]",Fe="[object Date]",wt="[object DOMException]",z="[object Error]",K="[object Function]",V="[object GeneratorFunction]",J="[object Map]",X="[object Number]",G="[object Null]",Ce="[object Object]",Ge="[object Promise]",Ve="[object Proxy]",le="[object RegExp]",xe="[object Set]",Ze="[object String]",At="[object Symbol]",_t="[object Undefined]",Qt="[object WeakMap]",mt="[object WeakSet]",Ut="[object ArrayBuffer]",rr="[object DataView]",Mr="[object Float32Array]",zt="[object Float64Array]",Jt="[object Int8Array]",Zt="[object Int16Array]",W="[object Int32Array]",H="[object Uint8Array]",ze="[object Uint8ClampedArray]",We="[object Uint16Array]",kt="[object Uint32Array]",Ke=/\b__p \+= '';/g,nr=/\b(__p \+=) '' \+/g,dr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Mt=/&(?:amp|lt|gt|quot|#39);/g,Ht=/[&<>"']/g,Ur=RegExp(Mt.source),$r=RegExp(Ht.source),ir=/<%-([\s\S]+?)%>/g,cn=/<%([\s\S]+?)%>/g,Sr=/<%=([\s\S]+?)%>/g,Er=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Or=/^\w*$/,Ar=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cr=/[\\^$.*+?()[\]{}|]/g,Hr=RegExp(cr.source),kr=/^\s+/,Tr=/\s/,Fr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ln=/\{\n\/\* \[wrapped with (.+)\] \*/,Un=/,? & /,R=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,we=/\\(\\)?/g,Pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,ot=/^[-+]0x[0-9a-f]+$/i,st=/^0b[01]+$/i,nt=/^\[object .+?Constructor\]$/,it=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,I=/($^)/,k=/['\n\r\u2028\u2029\\]/g,P="\\ud800-\\udfff",M="\\u0300-\\u036f",U="\\ufe20-\\ufe2f",ie="\\u20d0-\\u20ff",de=M+U+ie,Y="\\u2700-\\u27bf",ne="a-z\\xdf-\\xf6\\xf8-\\xff",Le="\\xac\\xb1\\xd7\\xf7",yt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\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",Ai="A-Z\\xc0-\\xd6\\xd8-\\xde",Bb="\\ufe0e\\ufe0f",Vb=Le+yt+Xt+En,wd="['’]",qC="["+P+"]",Wb="["+Vb+"]",wc="["+de+"]",zb="\\d+",UC="["+Y+"]",Hb="["+ne+"]",Gb="[^"+P+Vb+zb+Y+ne+Ai+"]",_d="\\ud83c[\\udffb-\\udfff]",$C="(?:"+wc+"|"+_d+")",Qb="[^"+P+"]",xd="(?:\\ud83c[\\udde6-\\uddff]){2}",Sd="[\\ud800-\\udbff][\\udc00-\\udfff]",Oa="["+Ai+"]",Jb="\\u200d",Yb="(?:"+Hb+"|"+Gb+")",BC="(?:"+Oa+"|"+Gb+")",Kb="(?:"+wd+"(?:d|ll|m|re|s|t|ve))?",Zb="(?:"+wd+"(?:D|LL|M|RE|S|T|VE))?",Xb=$C+"?",ew="["+Bb+"]?",VC="(?:"+Jb+"(?:"+[Qb,xd,Sd].join("|")+")"+ew+Xb+")*",WC="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zC="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tw=ew+Xb+VC,HC="(?:"+[UC,xd,Sd].join("|")+")"+tw,GC="(?:"+[Qb+wc+"?",wc,xd,Sd,qC].join("|")+")",QC=RegExp(wd,"g"),JC=RegExp(wc,"g"),Ed=RegExp(_d+"(?="+_d+")|"+GC+tw,"g"),YC=RegExp([Oa+"?"+Hb+"+"+Kb+"(?="+[Wb,Oa,"$"].join("|")+")",BC+"+"+Zb+"(?="+[Wb,Oa+Yb,"$"].join("|")+")",Oa+"?"+Yb+"+"+Kb,Oa+"+"+Zb,zC,WC,zb,HC].join("|"),"g"),KC=RegExp("["+Jb+P+de+Bb+"]"),ZC=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,XC=["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"],eP=-1,er={};er[Mr]=er[zt]=er[Jt]=er[Zt]=er[W]=er[H]=er[ze]=er[We]=er[kt]=!0,er[Pt]=er[rt]=er[Ut]=er[pt]=er[rr]=er[Fe]=er[z]=er[K]=er[J]=er[X]=er[Ce]=er[le]=er[xe]=er[Ze]=er[Qt]=!1;var Yt={};Yt[Pt]=Yt[rt]=Yt[Ut]=Yt[rr]=Yt[pt]=Yt[Fe]=Yt[Mr]=Yt[zt]=Yt[Jt]=Yt[Zt]=Yt[W]=Yt[J]=Yt[X]=Yt[Ce]=Yt[le]=Yt[xe]=Yt[Ze]=Yt[At]=Yt[H]=Yt[ze]=Yt[We]=Yt[kt]=!0,Yt[z]=Yt[K]=Yt[Qt]=!1;var tP={À:"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"},rP={"&":"&","<":"<",">":">",'"':""","'":"'"},nP={"&":"&","<":"<",">":">",""":'"',"'":"'"},iP={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sP=parseFloat,aP=parseInt,rw=typeof pi=="object"&&pi&&pi.Object===Object&&pi,oP=typeof self=="object"&&self&&self.Object===Object&&self,Br=rw||oP||Function("return this")(),Od=e&&!e.nodeType&&e,Ps=Od&&!0&&r&&!r.nodeType&&r,nw=Ps&&Ps.exports===Od,Td=nw&&rw.process,$n=function(){try{var q=Ps&&Ps.require&&Ps.require("util").types;return q||Td&&Td.binding&&Td.binding("util")}catch{}}(),iw=$n&&$n.isArrayBuffer,sw=$n&&$n.isDate,aw=$n&&$n.isMap,ow=$n&&$n.isRegExp,uw=$n&&$n.isSet,cw=$n&&$n.isTypedArray;function On(q,te,Z){switch(Z.length){case 0:return q.call(te);case 1:return q.call(te,Z[0]);case 2:return q.call(te,Z[0],Z[1]);case 3:return q.call(te,Z[0],Z[1],Z[2])}return q.apply(te,Z)}function uP(q,te,Z,Re){for(var at=-1,Ft=q==null?0:q.length;++at<Ft;){var Ir=q[at];te(Re,Ir,Z(Ir),q)}return Re}function Bn(q,te){for(var Z=-1,Re=q==null?0:q.length;++Z<Re&&te(q[Z],Z,q)!==!1;);return q}function cP(q,te){for(var Z=q==null?0:q.length;Z--&&te(q[Z],Z,q)!==!1;);return q}function lw(q,te){for(var Z=-1,Re=q==null?0:q.length;++Z<Re;)if(!te(q[Z],Z,q))return!1;return!0}function ss(q,te){for(var Z=-1,Re=q==null?0:q.length,at=0,Ft=[];++Z<Re;){var Ir=q[Z];te(Ir,Z,q)&&(Ft[at++]=Ir)}return Ft}function _c(q,te){var Z=q==null?0:q.length;return!!Z&&Ta(q,te,0)>-1}function Ad(q,te,Z){for(var Re=-1,at=q==null?0:q.length;++Re<at;)if(Z(te,q[Re]))return!0;return!1}function sr(q,te){for(var Z=-1,Re=q==null?0:q.length,at=Array(Re);++Z<Re;)at[Z]=te(q[Z],Z,q);return at}function as(q,te){for(var Z=-1,Re=te.length,at=q.length;++Z<Re;)q[at+Z]=te[Z];return q}function kd(q,te,Z,Re){var at=-1,Ft=q==null?0:q.length;for(Re&&Ft&&(Z=q[++at]);++at<Ft;)Z=te(Z,q[at],at,q);return Z}function lP(q,te,Z,Re){var at=q==null?0:q.length;for(Re&&at&&(Z=q[--at]);at--;)Z=te(Z,q[at],at,q);return Z}function Id(q,te){for(var Z=-1,Re=q==null?0:q.length;++Z<Re;)if(te(q[Z],Z,q))return!0;return!1}var fP=Cd("length");function hP(q){return q.split("")}function dP(q){return q.match(R)||[]}function fw(q,te,Z){var Re;return Z(q,function(at,Ft,Ir){if(te(at,Ft,Ir))return Re=Ft,!1}),Re}function xc(q,te,Z,Re){for(var at=q.length,Ft=Z+(Re?1:-1);Re?Ft--:++Ft<at;)if(te(q[Ft],Ft,q))return Ft;return-1}function Ta(q,te,Z){return te===te?OP(q,te,Z):xc(q,hw,Z)}function pP(q,te,Z,Re){for(var at=Z-1,Ft=q.length;++at<Ft;)if(Re(q[at],te))return at;return-1}function hw(q){return q!==q}function dw(q,te){var Z=q==null?0:q.length;return Z?Nd(q,te)/Z:Me}function Cd(q){return function(te){return te==null?t:te[q]}}function Pd(q){return function(te){return q==null?t:q[te]}}function pw(q,te,Z,Re,at){return at(q,function(Ft,Ir,Gt){Z=Re?(Re=!1,Ft):te(Z,Ft,Ir,Gt)}),Z}function mP(q,te){var Z=q.length;for(q.sort(te);Z--;)q[Z]=q[Z].value;return q}function Nd(q,te){for(var Z,Re=-1,at=q.length;++Re<at;){var Ft=te(q[Re]);Ft!==t&&(Z=Z===t?Ft:Z+Ft)}return Z}function Rd(q,te){for(var Z=-1,Re=Array(q);++Z<q;)Re[Z]=te(Z);return Re}function yP(q,te){return sr(te,function(Z){return[Z,q[Z]]})}function mw(q){return q&&q.slice(0,bw(q)+1).replace(kr,"")}function Tn(q){return function(te){return q(te)}}function Dd(q,te){return sr(te,function(Z){return q[Z]})}function jo(q,te){return q.has(te)}function yw(q,te){for(var Z=-1,Re=q.length;++Z<Re&&Ta(te,q[Z],0)>-1;);return Z}function gw(q,te){for(var Z=q.length;Z--&&Ta(te,q[Z],0)>-1;);return Z}function gP(q,te){for(var Z=q.length,Re=0;Z--;)q[Z]===te&&++Re;return Re}var vP=Pd(tP),bP=Pd(rP);function wP(q){return"\\"+iP[q]}function _P(q,te){return q==null?t:q[te]}function Aa(q){return KC.test(q)}function xP(q){return ZC.test(q)}function SP(q){for(var te,Z=[];!(te=q.next()).done;)Z.push(te.value);return Z}function Md(q){var te=-1,Z=Array(q.size);return q.forEach(function(Re,at){Z[++te]=[at,Re]}),Z}function vw(q,te){return function(Z){return q(te(Z))}}function os(q,te){for(var Z=-1,Re=q.length,at=0,Ft=[];++Z<Re;){var Ir=q[Z];(Ir===te||Ir===d)&&(q[Z]=d,Ft[at++]=Z)}return Ft}function Sc(q){var te=-1,Z=Array(q.size);return q.forEach(function(Re){Z[++te]=Re}),Z}function EP(q){var te=-1,Z=Array(q.size);return q.forEach(function(Re){Z[++te]=[Re,Re]}),Z}function OP(q,te,Z){for(var Re=Z-1,at=q.length;++Re<at;)if(q[Re]===te)return Re;return-1}function TP(q,te,Z){for(var Re=Z+1;Re--;)if(q[Re]===te)return Re;return Re}function ka(q){return Aa(q)?kP(q):fP(q)}function ii(q){return Aa(q)?IP(q):hP(q)}function bw(q){for(var te=q.length;te--&&Tr.test(q.charAt(te)););return te}var AP=Pd(nP);function kP(q){for(var te=Ed.lastIndex=0;Ed.test(q);)++te;return te}function IP(q){return q.match(Ed)||[]}function CP(q){return q.match(YC)||[]}var PP=function q(te){te=te==null?Br:Ia.defaults(Br.Object(),te,Ia.pick(Br,XC));var Z=te.Array,Re=te.Date,at=te.Error,Ft=te.Function,Ir=te.Math,Gt=te.Object,Fd=te.RegExp,NP=te.String,Vn=te.TypeError,Ec=Z.prototype,RP=Ft.prototype,Ca=Gt.prototype,Oc=te["__core-js_shared__"],Tc=RP.toString,Bt=Ca.hasOwnProperty,DP=0,ww=function(){var s=/[^.]+$/.exec(Oc&&Oc.keys&&Oc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Ac=Ca.toString,MP=Tc.call(Gt),FP=Br._,LP=Fd("^"+Tc.call(Bt).replace(cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kc=nw?te.Buffer:t,us=te.Symbol,Ic=te.Uint8Array,_w=kc?kc.allocUnsafe:t,Cc=vw(Gt.getPrototypeOf,Gt),xw=Gt.create,Sw=Ca.propertyIsEnumerable,Pc=Ec.splice,Ew=us?us.isConcatSpreadable:t,qo=us?us.iterator:t,Ns=us?us.toStringTag:t,Nc=function(){try{var s=Ls(Gt,"defineProperty");return s({},"",{}),s}catch{}}(),jP=te.clearTimeout!==Br.clearTimeout&&te.clearTimeout,qP=Re&&Re.now!==Br.Date.now&&Re.now,UP=te.setTimeout!==Br.setTimeout&&te.setTimeout,Rc=Ir.ceil,Dc=Ir.floor,Ld=Gt.getOwnPropertySymbols,$P=kc?kc.isBuffer:t,Ow=te.isFinite,BP=Ec.join,VP=vw(Gt.keys,Gt),Cr=Ir.max,Gr=Ir.min,WP=Re.now,zP=te.parseInt,Tw=Ir.random,HP=Ec.reverse,jd=Ls(te,"DataView"),Uo=Ls(te,"Map"),qd=Ls(te,"Promise"),Pa=Ls(te,"Set"),$o=Ls(te,"WeakMap"),Bo=Ls(Gt,"create"),Mc=$o&&new $o,Na={},GP=js(jd),QP=js(Uo),JP=js(qd),YP=js(Pa),KP=js($o),Fc=us?us.prototype:t,Vo=Fc?Fc.valueOf:t,Aw=Fc?Fc.toString:t;function S(s){if(pr(s)&&!ut(s)&&!(s instanceof bt)){if(s instanceof Wn)return s;if(Bt.call(s,"__wrapped__"))return k_(s)}return new Wn(s)}var Ra=function(){function s(){}return function(o){if(!lr(o))return{};if(xw)return xw(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function Lc(){}function Wn(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}S.templateSettings={escape:ir,evaluate:cn,interpolate:Sr,variable:"",imports:{_:S}},S.prototype=Lc.prototype,S.prototype.constructor=S,Wn.prototype=Ra(Lc.prototype),Wn.prototype.constructor=Wn;function bt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Oe,this.__views__=[]}function ZP(){var s=new bt(this.__wrapped__);return s.__actions__=fn(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=fn(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=fn(this.__views__),s}function XP(){if(this.__filtered__){var s=new bt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function eN(){var s=this.__wrapped__.value(),o=this.__dir__,l=ut(s),p=o<0,v=l?s.length:0,T=hR(0,v,this.__views__),N=T.start,L=T.end,$=L-N,se=p?L:N-1,oe=this.__iteratees__,pe=oe.length,ke=0,$e=Gr($,this.__takeCount__);if(!l||!p&&v==$&&$e==$)return Kw(s,this.__actions__);var Qe=[];e:for(;$--&&ke<$e;){se+=o;for(var ht=-1,Je=s[se];++ht<pe;){var gt=oe[ht],St=gt.iteratee,In=gt.type,sn=St(Je);if(In==ye)Je=sn;else if(!sn){if(In==Ie)continue e;break e}}Qe[ke++]=Je}return Qe}bt.prototype=Ra(Lc.prototype),bt.prototype.constructor=bt;function Rs(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 tN(){this.__data__=Bo?Bo(null):{},this.size=0}function rN(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function nN(s){var o=this.__data__;if(Bo){var l=o[s];return l===f?t:l}return Bt.call(o,s)?o[s]:t}function iN(s){var o=this.__data__;return Bo?o[s]!==t:Bt.call(o,s)}function sN(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=Bo&&o===t?f:o,this}Rs.prototype.clear=tN,Rs.prototype.delete=rN,Rs.prototype.get=nN,Rs.prototype.has=iN,Rs.prototype.set=sN;function ki(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 aN(){this.__data__=[],this.size=0}function oN(s){var o=this.__data__,l=jc(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():Pc.call(o,l,1),--this.size,!0}function uN(s){var o=this.__data__,l=jc(o,s);return l<0?t:o[l][1]}function cN(s){return jc(this.__data__,s)>-1}function lN(s,o){var l=this.__data__,p=jc(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}ki.prototype.clear=aN,ki.prototype.delete=oN,ki.prototype.get=uN,ki.prototype.has=cN,ki.prototype.set=lN;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 fN(){this.size=0,this.__data__={hash:new Rs,map:new(Uo||ki),string:new Rs}}function hN(s){var o=Yc(this,s).delete(s);return this.size-=o?1:0,o}function dN(s){return Yc(this,s).get(s)}function pN(s){return Yc(this,s).has(s)}function mN(s,o){var l=Yc(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Ii.prototype.clear=fN,Ii.prototype.delete=hN,Ii.prototype.get=dN,Ii.prototype.has=pN,Ii.prototype.set=mN;function Ds(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Ii;++o<l;)this.add(s[o])}function yN(s){return this.__data__.set(s,f),this}function gN(s){return this.__data__.has(s)}Ds.prototype.add=Ds.prototype.push=yN,Ds.prototype.has=gN;function si(s){var o=this.__data__=new ki(s);this.size=o.size}function vN(){this.__data__=new ki,this.size=0}function bN(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function wN(s){return this.__data__.get(s)}function _N(s){return this.__data__.has(s)}function xN(s,o){var l=this.__data__;if(l instanceof ki){var p=l.__data__;if(!Uo||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Ii(p)}return l.set(s,o),this.size=l.size,this}si.prototype.clear=vN,si.prototype.delete=bN,si.prototype.get=wN,si.prototype.has=_N,si.prototype.set=xN;function kw(s,o){var l=ut(s),p=!l&&qs(s),v=!l&&!p&&ds(s),T=!l&&!p&&!v&&La(s),N=l||p||v||T,L=N?Rd(s.length,NP):[],$=L.length;for(var se in s)(o||Bt.call(s,se))&&!(N&&(se=="length"||v&&(se=="offset"||se=="parent")||T&&(se=="buffer"||se=="byteLength"||se=="byteOffset")||Ri(se,$)))&&L.push(se);return L}function Iw(s){var o=s.length;return o?s[Yd(0,o-1)]:t}function SN(s,o){return Kc(fn(s),Ms(o,0,s.length))}function EN(s){return Kc(fn(s))}function Ud(s,o,l){(l!==t&&!ai(s[o],l)||l===t&&!(o in s))&&Ci(s,o,l)}function Wo(s,o,l){var p=s[o];(!(Bt.call(s,o)&&ai(p,l))||l===t&&!(o in s))&&Ci(s,o,l)}function jc(s,o){for(var l=s.length;l--;)if(ai(s[l][0],o))return l;return-1}function ON(s,o,l,p){return cs(s,function(v,T,N){o(p,v,l(v),N)}),p}function Cw(s,o){return s&&hi(o,Lr(o),s)}function TN(s,o){return s&&hi(o,dn(o),s)}function Ci(s,o,l){o=="__proto__"&&Nc?Nc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function $d(s,o){for(var l=-1,p=o.length,v=Z(p),T=s==null;++l<p;)v[l]=T?t:_p(s,o[l]);return v}function Ms(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,T){var N,L=o&y,$=o&g,se=o&m;if(l&&(N=v?l(s,p,v,T):l(s)),N!==t)return N;if(!lr(s))return s;var oe=ut(s);if(oe){if(N=pR(s),!L)return fn(s,N)}else{var pe=Qr(s),ke=pe==K||pe==V;if(ds(s))return e_(s,L);if(pe==Ce||pe==Pt||ke&&!v){if(N=$||ke?{}:b_(s),!L)return $?nR(s,TN(N,s)):rR(s,Cw(N,s))}else{if(!Yt[pe])return v?s:{};N=mR(s,pe,L)}}T||(T=new si);var $e=T.get(s);if($e)return $e;T.set(s,N),Q_(s)?s.forEach(function(Je){N.add(zn(Je,o,l,Je,s,T))}):H_(s)&&s.forEach(function(Je,gt){N.set(gt,zn(Je,o,l,gt,s,T))});var Qe=se?$?op:ap:$?dn:Lr,ht=oe?t:Qe(s);return Bn(ht||s,function(Je,gt){ht&&(gt=Je,Je=s[gt]),Wo(N,gt,zn(Je,o,l,gt,s,T))}),N}function AN(s){var o=Lr(s);return function(l){return Pw(l,s,o)}}function Pw(s,o,l){var p=l.length;if(s==null)return!p;for(s=Gt(s);p--;){var v=l[p],T=o[v],N=s[v];if(N===t&&!(v in s)||!T(N))return!1}return!0}function Nw(s,o,l){if(typeof s!="function")throw new Vn(u);return Ko(function(){s.apply(t,l)},o)}function zo(s,o,l,p){var v=-1,T=_c,N=!0,L=s.length,$=[],se=o.length;if(!L)return $;l&&(o=sr(o,Tn(l))),p?(T=Ad,N=!1):o.length>=i&&(T=jo,N=!1,o=new Ds(o));e:for(;++v<L;){var oe=s[v],pe=l==null?oe:l(oe);if(oe=p||oe!==0?oe:0,N&&pe===pe){for(var ke=se;ke--;)if(o[ke]===pe)continue e;$.push(oe)}else T(o,pe,p)||$.push(oe)}return $}var cs=s_(fi),Rw=s_(Vd,!0);function kN(s,o){var l=!0;return cs(s,function(p,v,T){return l=!!o(p,v,T),l}),l}function qc(s,o,l){for(var p=-1,v=s.length;++p<v;){var T=s[p],N=o(T);if(N!=null&&(L===t?N===N&&!kn(N):l(N,L)))var L=N,$=T}return $}function IN(s,o,l,p){var v=s.length;for(l=lt(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:lt(p),p<0&&(p+=v),p=l>p?0:Y_(p);l<p;)s[l++]=o;return s}function Dw(s,o){var l=[];return cs(s,function(p,v,T){o(p,v,T)&&l.push(p)}),l}function Vr(s,o,l,p,v){var T=-1,N=s.length;for(l||(l=gR),v||(v=[]);++T<N;){var L=s[T];o>0&&l(L)?o>1?Vr(L,o-1,l,p,v):as(v,L):p||(v[v.length]=L)}return v}var Bd=a_(),Mw=a_(!0);function fi(s,o){return s&&Bd(s,o,Lr)}function Vd(s,o){return s&&Mw(s,o,Lr)}function Uc(s,o){return ss(o,function(l){return Di(s[l])})}function Fs(s,o){o=fs(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 Fw(s,o,l){var p=o(s);return ut(s)?p:as(p,l(s))}function rn(s){return s==null?s===t?_t:G:Ns&&Ns in Gt(s)?fR(s):ER(s)}function Wd(s,o){return s>o}function CN(s,o){return s!=null&&Bt.call(s,o)}function PN(s,o){return s!=null&&o in Gt(s)}function NN(s,o,l){return s>=Gr(o,l)&&s<Cr(o,l)}function zd(s,o,l){for(var p=l?Ad:_c,v=s[0].length,T=s.length,N=T,L=Z(T),$=1/0,se=[];N--;){var oe=s[N];N&&o&&(oe=sr(oe,Tn(o))),$=Gr(oe.length,$),L[N]=!l&&(o||v>=120&&oe.length>=120)?new Ds(N&&oe):t}oe=s[0];var pe=-1,ke=L[0];e:for(;++pe<v&&se.length<$;){var $e=oe[pe],Qe=o?o($e):$e;if($e=l||$e!==0?$e:0,!(ke?jo(ke,Qe):p(se,Qe,l))){for(N=T;--N;){var ht=L[N];if(!(ht?jo(ht,Qe):p(s[N],Qe,l)))continue e}ke&&ke.push(Qe),se.push($e)}}return se}function RN(s,o,l,p){return fi(s,function(v,T,N){o(p,l(v),T,N)}),p}function Ho(s,o,l){o=fs(o,s),s=S_(s,o);var p=s==null?s:s[di(Gn(o))];return p==null?t:On(p,s,l)}function Lw(s){return pr(s)&&rn(s)==Pt}function DN(s){return pr(s)&&rn(s)==Ut}function MN(s){return pr(s)&&rn(s)==Fe}function Go(s,o,l,p,v){return s===o?!0:s==null||o==null||!pr(s)&&!pr(o)?s!==s&&o!==o:FN(s,o,l,p,Go,v)}function FN(s,o,l,p,v,T){var N=ut(s),L=ut(o),$=N?rt:Qr(s),se=L?rt:Qr(o);$=$==Pt?Ce:$,se=se==Pt?Ce:se;var oe=$==Ce,pe=se==Ce,ke=$==se;if(ke&&ds(s)){if(!ds(o))return!1;N=!0,oe=!1}if(ke&&!oe)return T||(T=new si),N||La(s)?y_(s,o,l,p,v,T):cR(s,o,$,l,p,v,T);if(!(l&b)){var $e=oe&&Bt.call(s,"__wrapped__"),Qe=pe&&Bt.call(o,"__wrapped__");if($e||Qe){var ht=$e?s.value():s,Je=Qe?o.value():o;return T||(T=new si),v(ht,Je,l,p,T)}}return ke?(T||(T=new si),lR(s,o,l,p,v,T)):!1}function LN(s){return pr(s)&&Qr(s)==J}function Hd(s,o,l,p){var v=l.length,T=v,N=!p;if(s==null)return!T;for(s=Gt(s);v--;){var L=l[v];if(N&&L[2]?L[1]!==s[L[0]]:!(L[0]in s))return!1}for(;++v<T;){L=l[v];var $=L[0],se=s[$],oe=L[1];if(N&&L[2]){if(se===t&&!($ in s))return!1}else{var pe=new si;if(p)var ke=p(se,oe,$,s,o,pe);if(!(ke===t?Go(oe,se,b|A,p,pe):ke))return!1}}return!0}function jw(s){if(!lr(s)||bR(s))return!1;var o=Di(s)?LP:nt;return o.test(js(s))}function jN(s){return pr(s)&&rn(s)==le}function qN(s){return pr(s)&&Qr(s)==xe}function UN(s){return pr(s)&&nl(s.length)&&!!er[rn(s)]}function qw(s){return typeof s=="function"?s:s==null?pn:typeof s=="object"?ut(s)?Bw(s[0],s[1]):$w(s):ox(s)}function Gd(s){if(!Yo(s))return VP(s);var o=[];for(var l in Gt(s))Bt.call(s,l)&&l!="constructor"&&o.push(l);return o}function $N(s){if(!lr(s))return SR(s);var o=Yo(s),l=[];for(var p in s)p=="constructor"&&(o||!Bt.call(s,p))||l.push(p);return l}function Qd(s,o){return s<o}function Uw(s,o){var l=-1,p=hn(s)?Z(s.length):[];return cs(s,function(v,T,N){p[++l]=o(v,T,N)}),p}function $w(s){var o=cp(s);return o.length==1&&o[0][2]?__(o[0][0],o[0][1]):function(l){return l===s||Hd(l,s,o)}}function Bw(s,o){return fp(s)&&w_(o)?__(di(s),o):function(l){var p=_p(l,s);return p===t&&p===o?xp(l,s):Go(o,p,b|A)}}function $c(s,o,l,p,v){s!==o&&Bd(o,function(T,N){if(v||(v=new si),lr(T))BN(s,o,N,l,$c,p,v);else{var L=p?p(dp(s,N),T,N+"",s,o,v):t;L===t&&(L=T),Ud(s,N,L)}},dn)}function BN(s,o,l,p,v,T,N){var L=dp(s,l),$=dp(o,l),se=N.get($);if(se){Ud(s,l,se);return}var oe=T?T(L,$,l+"",s,o,N):t,pe=oe===t;if(pe){var ke=ut($),$e=!ke&&ds($),Qe=!ke&&!$e&&La($);oe=$,ke||$e||Qe?ut(L)?oe=L:gr(L)?oe=fn(L):$e?(pe=!1,oe=e_($,!0)):Qe?(pe=!1,oe=t_($,!0)):oe=[]:Zo($)||qs($)?(oe=L,qs(L)?oe=K_(L):(!lr(L)||Di(L))&&(oe=b_($))):pe=!1}pe&&(N.set($,oe),v(oe,$,p,T,N),N.delete($)),Ud(s,l,oe)}function Vw(s,o){var l=s.length;if(l)return o+=o<0?l:0,Ri(o,l)?s[o]:t}function Ww(s,o,l){o.length?o=sr(o,function(T){return ut(T)?function(N){return Fs(N,T.length===1?T[0]:T)}:T}):o=[pn];var p=-1;o=sr(o,Tn(He()));var v=Uw(s,function(T,N,L){var $=sr(o,function(se){return se(T)});return{criteria:$,index:++p,value:T}});return mP(v,function(T,N){return tR(T,N,l)})}function VN(s,o){return zw(s,o,function(l,p){return xp(s,p)})}function zw(s,o,l){for(var p=-1,v=o.length,T={};++p<v;){var N=o[p],L=Fs(s,N);l(L,N)&&Qo(T,fs(N,s),L)}return T}function WN(s){return function(o){return Fs(o,s)}}function Jd(s,o,l,p){var v=p?pP:Ta,T=-1,N=o.length,L=s;for(s===o&&(o=fn(o)),l&&(L=sr(s,Tn(l)));++T<N;)for(var $=0,se=o[T],oe=l?l(se):se;($=v(L,oe,$,p))>-1;)L!==s&&Pc.call(L,$,1),Pc.call(s,$,1);return s}function Hw(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==T){var T=v;Ri(v)?Pc.call(s,v,1):Xd(s,v)}}return s}function Yd(s,o){return s+Dc(Tw()*(o-s+1))}function zN(s,o,l,p){for(var v=-1,T=Cr(Rc((o-s)/(l||1)),0),N=Z(T);T--;)N[p?T:++v]=s,s+=l;return N}function Kd(s,o){var l="";if(!s||o<1||o>ce)return l;do o%2&&(l+=s),o=Dc(o/2),o&&(s+=s);while(o);return l}function dt(s,o){return pp(x_(s,o,pn),s+"")}function HN(s){return Iw(ja(s))}function GN(s,o){var l=ja(s);return Kc(l,Ms(o,0,l.length))}function Qo(s,o,l,p){if(!lr(s))return s;o=fs(o,s);for(var v=-1,T=o.length,N=T-1,L=s;L!=null&&++v<T;){var $=di(o[v]),se=l;if($==="__proto__"||$==="constructor"||$==="prototype")return s;if(v!=N){var oe=L[$];se=p?p(oe,$,L):t,se===t&&(se=lr(oe)?oe:Ri(o[v+1])?[]:{})}Wo(L,$,se),L=L[$]}return s}var Gw=Mc?function(s,o){return Mc.set(s,o),s}:pn,QN=Nc?function(s,o){return Nc(s,"toString",{configurable:!0,enumerable:!1,value:Ep(o),writable:!0})}:pn;function JN(s){return Kc(ja(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 T=Z(v);++p<v;)T[p]=s[p+o];return T}function YN(s,o){var l;return cs(s,function(p,v,T){return l=o(p,v,T),!l}),!!l}function Bc(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=Tt){for(;p<v;){var T=p+v>>>1,N=s[T];N!==null&&!kn(N)&&(l?N<=o:N<o)?p=T+1:v=T}return v}return Zd(s,o,pn,l)}function Zd(s,o,l,p){var v=0,T=s==null?0:s.length;if(T===0)return 0;o=l(o);for(var N=o!==o,L=o===null,$=kn(o),se=o===t;v<T;){var oe=Dc((v+T)/2),pe=l(s[oe]),ke=pe!==t,$e=pe===null,Qe=pe===pe,ht=kn(pe);if(N)var Je=p||Qe;else se?Je=Qe&&(p||ke):L?Je=Qe&&ke&&(p||!$e):$?Je=Qe&&ke&&!$e&&(p||!ht):$e||ht?Je=!1:Je=p?pe<=o:pe<o;Je?v=oe+1:T=oe}return Gr(T,tt)}function Qw(s,o){for(var l=-1,p=s.length,v=0,T=[];++l<p;){var N=s[l],L=o?o(N):N;if(!l||!ai(L,$)){var $=L;T[v++]=N===0?0:N}}return T}function Jw(s){return typeof s=="number"?s:kn(s)?Me:+s}function An(s){if(typeof s=="string")return s;if(ut(s))return sr(s,An)+"";if(kn(s))return Aw?Aw.call(s):"";var o=s+"";return o=="0"&&1/s==-_e?"-0":o}function ls(s,o,l){var p=-1,v=_c,T=s.length,N=!0,L=[],$=L;if(l)N=!1,v=Ad;else if(T>=i){var se=o?null:oR(s);if(se)return Sc(se);N=!1,v=jo,$=new Ds}else $=o?[]:L;e:for(;++p<T;){var oe=s[p],pe=o?o(oe):oe;if(oe=l||oe!==0?oe:0,N&&pe===pe){for(var ke=$.length;ke--;)if($[ke]===pe)continue e;o&&$.push(pe),L.push(oe)}else v($,pe,l)||($!==L&&$.push(pe),L.push(oe))}return L}function Xd(s,o){return o=fs(o,s),s=S_(s,o),s==null||delete s[di(Gn(o))]}function Yw(s,o,l,p){return Qo(s,o,l(Fs(s,o)),p)}function Vc(s,o,l,p){for(var v=s.length,T=p?v:-1;(p?T--:++T<v)&&o(s[T],T,s););return l?Hn(s,p?0:T,p?T+1:v):Hn(s,p?T+1:0,p?v:T)}function Kw(s,o){var l=s;return l instanceof bt&&(l=l.value()),kd(o,function(p,v){return v.func.apply(v.thisArg,as([p],v.args))},l)}function ep(s,o,l){var p=s.length;if(p<2)return p?ls(s[0]):[];for(var v=-1,T=Z(p);++v<p;)for(var N=s[v],L=-1;++L<p;)L!=v&&(T[v]=zo(T[v]||N,s[L],o,l));return ls(Vr(T,1),o,l)}function Zw(s,o,l){for(var p=-1,v=s.length,T=o.length,N={};++p<v;){var L=p<T?o[p]:t;l(N,s[p],L)}return N}function tp(s){return gr(s)?s:[]}function rp(s){return typeof s=="function"?s:pn}function fs(s,o){return ut(s)?s:fp(s,o)?[s]:A_($t(s))}var KN=dt;function hs(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:Hn(s,o,l)}var Xw=jP||function(s){return Br.clearTimeout(s)};function e_(s,o){if(o)return s.slice();var l=s.length,p=_w?_w(l):new s.constructor(l);return s.copy(p),p}function np(s){var o=new s.constructor(s.byteLength);return new Ic(o).set(new Ic(s)),o}function ZN(s,o){var l=o?np(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function XN(s){var o=new s.constructor(s.source,Ue.exec(s));return o.lastIndex=s.lastIndex,o}function eR(s){return Vo?Gt(Vo.call(s)):{}}function t_(s,o){var l=o?np(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function r_(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,T=kn(s),N=o!==t,L=o===null,$=o===o,se=kn(o);if(!L&&!se&&!T&&s>o||T&&N&&$&&!L&&!se||p&&N&&$||!l&&$||!v)return 1;if(!p&&!T&&!se&&s<o||se&&l&&v&&!p&&!T||L&&l&&v||!N&&v||!$)return-1}return 0}function tR(s,o,l){for(var p=-1,v=s.criteria,T=o.criteria,N=v.length,L=l.length;++p<N;){var $=r_(v[p],T[p]);if($){if(p>=L)return $;var se=l[p];return $*(se=="desc"?-1:1)}}return s.index-o.index}function n_(s,o,l,p){for(var v=-1,T=s.length,N=l.length,L=-1,$=o.length,se=Cr(T-N,0),oe=Z($+se),pe=!p;++L<$;)oe[L]=o[L];for(;++v<N;)(pe||v<T)&&(oe[l[v]]=s[v]);for(;se--;)oe[L++]=s[v++];return oe}function i_(s,o,l,p){for(var v=-1,T=s.length,N=-1,L=l.length,$=-1,se=o.length,oe=Cr(T-L,0),pe=Z(oe+se),ke=!p;++v<oe;)pe[v]=s[v];for(var $e=v;++$<se;)pe[$e+$]=o[$];for(;++N<L;)(ke||v<T)&&(pe[$e+l[N]]=s[v++]);return pe}function fn(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 T=-1,N=o.length;++T<N;){var L=o[T],$=p?p(l[L],s[L],L,l,s):t;$===t&&($=s[L]),v?Ci(l,L,$):Wo(l,L,$)}return l}function rR(s,o){return hi(s,lp(s),o)}function nR(s,o){return hi(s,g_(s),o)}function Wc(s,o){return function(l,p){var v=ut(l)?uP:ON,T=o?o():{};return v(l,s,He(p,2),T)}}function Da(s){return dt(function(o,l){var p=-1,v=l.length,T=v>1?l[v-1]:t,N=v>2?l[2]:t;for(T=s.length>3&&typeof T=="function"?(v--,T):t,N&&nn(l[0],l[1],N)&&(T=v<3?t:T,v=1),o=Gt(o);++p<v;){var L=l[p];L&&s(o,L,p,T)}return o})}function s_(s,o){return function(l,p){if(l==null)return l;if(!hn(l))return s(l,p);for(var v=l.length,T=o?v:-1,N=Gt(l);(o?T--:++T<v)&&p(N[T],T,N)!==!1;);return l}}function a_(s){return function(o,l,p){for(var v=-1,T=Gt(o),N=p(o),L=N.length;L--;){var $=N[s?L:++v];if(l(T[$],$,T)===!1)break}return o}}function iR(s,o,l){var p=o&x,v=Jo(s);function T(){var N=this&&this!==Br&&this instanceof T?v:s;return N.apply(p?l:this,arguments)}return T}function o_(s){return function(o){o=$t(o);var l=Aa(o)?ii(o):t,p=l?l[0]:o.charAt(0),v=l?hs(l,1).join(""):o.slice(1);return p[s]()+v}}function Ma(s){return function(o){return kd(sx(ix(o).replace(QC,"")),s,"")}}function Jo(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 sR(s,o,l){var p=Jo(s);function v(){for(var T=arguments.length,N=Z(T),L=T,$=Fa(v);L--;)N[L]=arguments[L];var se=T<3&&N[0]!==$&&N[T-1]!==$?[]:os(N,$);if(T-=se.length,T<l)return h_(s,o,zc,v.placeholder,t,N,se,t,t,l-T);var oe=this&&this!==Br&&this instanceof v?p:s;return On(oe,this,N)}return v}function u_(s){return function(o,l,p){var v=Gt(o);if(!hn(o)){var T=He(l,3);o=Lr(o),l=function(L){return T(v[L],L,v)}}var N=s(o,l,p);return N>-1?v[T?o[N]:N]:t}}function c_(s){return Ni(function(o){var l=o.length,p=l,v=Wn.prototype.thru;for(s&&o.reverse();p--;){var T=o[p];if(typeof T!="function")throw new Vn(u);if(v&&!N&&Jc(T)=="wrapper")var N=new Wn([],!0)}for(p=N?p:l;++p<l;){T=o[p];var L=Jc(T),$=L=="wrapper"?up(T):t;$&&hp($[0])&&$[1]==(ee|C|F|Q)&&!$[4].length&&$[9]==1?N=N[Jc($[0])].apply(N,$[3]):N=T.length==1&&hp(T)?N[L]():N.thru(T)}return function(){var se=arguments,oe=se[0];if(N&&se.length==1&&ut(oe))return N.plant(oe).value();for(var pe=0,ke=l?o[pe].apply(this,se):oe;++pe<l;)ke=o[pe].call(this,ke);return ke}})}function zc(s,o,l,p,v,T,N,L,$,se){var oe=o&ee,pe=o&x,ke=o&w,$e=o&(C|D),Qe=o&re,ht=ke?t:Jo(s);function Je(){for(var gt=arguments.length,St=Z(gt),In=gt;In--;)St[In]=arguments[In];if($e)var sn=Fa(Je),Cn=gP(St,sn);if(p&&(St=n_(St,p,v,$e)),T&&(St=i_(St,T,N,$e)),gt-=Cn,$e&><se){var vr=os(St,sn);return h_(s,o,zc,Je.placeholder,l,St,vr,L,$,se-gt)}var oi=pe?l:this,Fi=ke?oi[s]:s;return gt=St.length,L?St=OR(St,L):Qe&>>1&&St.reverse(),oe&&$<gt&&(St.length=$),this&&this!==Br&&this instanceof Je&&(Fi=ht||Jo(Fi)),Fi.apply(oi,St)}return Je}function l_(s,o){return function(l,p){return RN(l,s,o(p),{})}}function Hc(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=Jw(l),p=Jw(p)),v=s(l,p)}return v}}function ip(s){return Ni(function(o){return o=sr(o,Tn(He())),dt(function(l){var p=this;return s(o,function(v){return On(v,p,l)})})})}function Gc(s,o){o=o===t?" ":An(o);var l=o.length;if(l<2)return l?Kd(o,s):o;var p=Kd(o,Rc(s/ka(o)));return Aa(o)?hs(ii(p),0,s).join(""):p.slice(0,s)}function aR(s,o,l,p){var v=o&x,T=Jo(s);function N(){for(var L=-1,$=arguments.length,se=-1,oe=p.length,pe=Z(oe+$),ke=this&&this!==Br&&this instanceof N?T:s;++se<oe;)pe[se]=p[se];for(;$--;)pe[se++]=arguments[++L];return On(ke,v?l:this,pe)}return N}function f_(s){return function(o,l,p){return p&&typeof p!="number"&&nn(o,l,p)&&(l=p=t),o=Mi(o),l===t?(l=o,o=0):l=Mi(l),p=p===t?o<l?1:-1:Mi(p),zN(o,l,p,s)}}function Qc(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=Qn(o),l=Qn(l)),s(o,l)}}function h_(s,o,l,p,v,T,N,L,$,se){var oe=o&C,pe=oe?N:t,ke=oe?t:N,$e=oe?T:t,Qe=oe?t:T;o|=oe?F:B,o&=~(oe?B:F),o&O||(o&=~(x|w));var ht=[s,o,v,$e,pe,Qe,ke,L,$,se],Je=l.apply(t,ht);return hp(s)&&E_(Je,ht),Je.placeholder=p,O_(Je,s,o)}function sp(s){var o=Ir[s];return function(l,p){if(l=Qn(l),p=p==null?0:Gr(lt(p),292),p&&Ow(l)){var v=($t(l)+"e").split("e"),T=o(v[0]+"e"+(+v[1]+p));return v=($t(T)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var oR=Pa&&1/Sc(new Pa([,-0]))[1]==_e?function(s){return new Pa(s)}:Ap;function d_(s){return function(o){var l=Qr(o);return l==J?Md(o):l==xe?EP(o):yP(o,s(o))}}function Pi(s,o,l,p,v,T,N,L){var $=o&w;if(!$&&typeof s!="function")throw new Vn(u);var se=p?p.length:0;if(se||(o&=~(F|B),p=v=t),N=N===t?N:Cr(lt(N),0),L=L===t?L:lt(L),se-=v?v.length:0,o&B){var oe=p,pe=v;p=v=t}var ke=$?t:up(s),$e=[s,o,l,p,v,oe,pe,T,N,L];if(ke&&xR($e,ke),s=$e[0],o=$e[1],l=$e[2],p=$e[3],v=$e[4],L=$e[9]=$e[9]===t?$?0:s.length:Cr($e[9]-se,0),!L&&o&(C|D)&&(o&=~(C|D)),!o||o==x)var Qe=iR(s,o,l);else o==C||o==D?Qe=sR(s,o,L):(o==F||o==(x|F))&&!v.length?Qe=aR(s,o,l,p):Qe=zc.apply(t,$e);var ht=ke?Gw:E_;return O_(ht(Qe,$e),s,o)}function p_(s,o,l,p){return s===t||ai(s,Ca[l])&&!Bt.call(p,l)?o:s}function m_(s,o,l,p,v,T){return lr(s)&&lr(o)&&(T.set(o,s),$c(s,o,t,m_,T),T.delete(o)),s}function uR(s){return Zo(s)?t:s}function y_(s,o,l,p,v,T){var N=l&b,L=s.length,$=o.length;if(L!=$&&!(N&&$>L))return!1;var se=T.get(s),oe=T.get(o);if(se&&oe)return se==o&&oe==s;var pe=-1,ke=!0,$e=l&A?new Ds:t;for(T.set(s,o),T.set(o,s);++pe<L;){var Qe=s[pe],ht=o[pe];if(p)var Je=N?p(ht,Qe,pe,o,s,T):p(Qe,ht,pe,s,o,T);if(Je!==t){if(Je)continue;ke=!1;break}if($e){if(!Id(o,function(gt,St){if(!jo($e,St)&&(Qe===gt||v(Qe,gt,l,p,T)))return $e.push(St)})){ke=!1;break}}else if(!(Qe===ht||v(Qe,ht,l,p,T))){ke=!1;break}}return T.delete(s),T.delete(o),ke}function cR(s,o,l,p,v,T,N){switch(l){case rr:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Ut:return!(s.byteLength!=o.byteLength||!T(new Ic(s),new Ic(o)));case pt:case Fe:case X:return ai(+s,+o);case z:return s.name==o.name&&s.message==o.message;case le:case Ze:return s==o+"";case J:var L=Md;case xe:var $=p&b;if(L||(L=Sc),s.size!=o.size&&!$)return!1;var se=N.get(s);if(se)return se==o;p|=A,N.set(s,o);var oe=y_(L(s),L(o),p,v,T,N);return N.delete(s),oe;case At:if(Vo)return Vo.call(s)==Vo.call(o)}return!1}function lR(s,o,l,p,v,T){var N=l&b,L=ap(s),$=L.length,se=ap(o),oe=se.length;if($!=oe&&!N)return!1;for(var pe=$;pe--;){var ke=L[pe];if(!(N?ke in o:Bt.call(o,ke)))return!1}var $e=T.get(s),Qe=T.get(o);if($e&&Qe)return $e==o&&Qe==s;var ht=!0;T.set(s,o),T.set(o,s);for(var Je=N;++pe<$;){ke=L[pe];var gt=s[ke],St=o[ke];if(p)var In=N?p(St,gt,ke,o,s,T):p(gt,St,ke,s,o,T);if(!(In===t?gt===St||v(gt,St,l,p,T):In)){ht=!1;break}Je||(Je=ke=="constructor")}if(ht&&!Je){var sn=s.constructor,Cn=o.constructor;sn!=Cn&&"constructor"in s&&"constructor"in o&&!(typeof sn=="function"&&sn instanceof sn&&typeof Cn=="function"&&Cn instanceof Cn)&&(ht=!1)}return T.delete(s),T.delete(o),ht}function Ni(s){return pp(x_(s,t,P_),s+"")}function ap(s){return Fw(s,Lr,lp)}function op(s){return Fw(s,dn,g_)}var up=Mc?function(s){return Mc.get(s)}:Ap;function Jc(s){for(var o=s.name+"",l=Na[o],p=Bt.call(Na,o)?l.length:0;p--;){var v=l[p],T=v.func;if(T==null||T==s)return v.name}return o}function Fa(s){var o=Bt.call(S,"placeholder")?S:s;return o.placeholder}function He(){var s=S.iteratee||Op;return s=s===Op?qw:s,arguments.length?s(arguments[0],arguments[1]):s}function Yc(s,o){var l=s.__data__;return vR(o)?l[typeof o=="string"?"string":"hash"]:l.map}function cp(s){for(var o=Lr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,w_(v)]}return o}function Ls(s,o){var l=_P(s,o);return jw(l)?l:t}function fR(s){var o=Bt.call(s,Ns),l=s[Ns];try{s[Ns]=t;var p=!0}catch{}var v=Ac.call(s);return p&&(o?s[Ns]=l:delete s[Ns]),v}var lp=Ld?function(s){return s==null?[]:(s=Gt(s),ss(Ld(s),function(o){return Sw.call(s,o)}))}:kp,g_=Ld?function(s){for(var o=[];s;)as(o,lp(s)),s=Cc(s);return o}:kp,Qr=rn;(jd&&Qr(new jd(new ArrayBuffer(1)))!=rr||Uo&&Qr(new Uo)!=J||qd&&Qr(qd.resolve())!=Ge||Pa&&Qr(new Pa)!=xe||$o&&Qr(new $o)!=Qt)&&(Qr=function(s){var o=rn(s),l=o==Ce?s.constructor:t,p=l?js(l):"";if(p)switch(p){case GP:return rr;case QP:return J;case JP:return Ge;case YP:return xe;case KP:return Qt}return o});function hR(s,o,l){for(var p=-1,v=l.length;++p<v;){var T=l[p],N=T.size;switch(T.type){case"drop":s+=N;break;case"dropRight":o-=N;break;case"take":o=Gr(o,s+N);break;case"takeRight":s=Cr(s,o-N);break}}return{start:s,end:o}}function dR(s){var o=s.match(ln);return o?o[1].split(Un):[]}function v_(s,o,l){o=fs(o,s);for(var p=-1,v=o.length,T=!1;++p<v;){var N=di(o[p]);if(!(T=s!=null&&l(s,N)))break;s=s[N]}return T||++p!=v?T:(v=s==null?0:s.length,!!v&&nl(v)&&Ri(N,v)&&(ut(s)||qs(s)))}function pR(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&Bt.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function b_(s){return typeof s.constructor=="function"&&!Yo(s)?Ra(Cc(s)):{}}function mR(s,o,l){var p=s.constructor;switch(o){case Ut:return np(s);case pt:case Fe:return new p(+s);case rr:return ZN(s,l);case Mr:case zt:case Jt:case Zt:case W:case H:case ze:case We:case kt:return t_(s,l);case J:return new p;case X:case Ze:return new p(s);case le:return XN(s);case xe:return new p;case At:return eR(s)}}function yR(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(Fr,`{
|
|
94
94
|
/* [wrapped with `+o+`] */
|
|
95
|
-
`)}function pR(s){return at(s)||qs(s)||!!(Ew&&s&&s[Ew])}function Ri(s,o){var l=typeof s;return o=o??ce,!!o&&(l=="number"||l!="symbol"&&mt.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)&&Ri(o,l.length):p=="string"&&o in l)?ai(l[o],s):!1}function fp(s,o){if(at(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 mR(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function hp(s){var o=Qc(s),l=S[o];if(typeof l!="function"||!(o in wt.prototype))return!1;if(s===l)return!0;var p=up(l);return!!p&&s===p[0]}function yR(s){return!!ww&&ww in s}var gR=Sc?Di:Ip;function Go(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Ia;return s===l}function w_(s){return s===s&&!lr(s)}function __(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Jt(l))}}function vR(s){var o=Xc(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function bR(s,o){var l=s[1],p=o[1],v=l|p,T=v<(x|w|te),N=p==te&&l==P||p==te&&l==J&&s[7].length<=o[8]||p==(te|J)&&o[7].length<=o[8]&&l==P;if(!(T||N))return s;p&x&&(s[2]=o[2],v|=l&x?0:O);var L=o[3];if(L){var V=s[3];s[3]=V?n_(V,L,o[4]):L,s[4]=V?os(s[3],d):o[4]}return L=o[5],L&&(V=s[5],s[5]=V?i_(V,L,o[6]):L,s[6]=V?os(s[5],d):o[6]),L=o[7],L&&(s[7]=L),p&te&&(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 wR(s){var o=[];if(s!=null)for(var l in Jt(s))o.push(l);return o}function _R(s){return Oc.call(s)}function x_(s,o,l){return o=Cr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,T=Cr(p.length-o,0),N=K(T);++v<T;)N[v]=p[o+v];v=-1;for(var L=K(o+1);++v<o;)L[v]=p[v];return L[o]=l(N),On(s,this,L)}}function S_(s,o){return o.length<2?s:Ms(s,Hn(o,0,-1))}function xR(s,o){for(var l=s.length,p=Gr(o.length,l),v=ln(s);p--;){var T=o[p];s[p]=Ri(T,l)?v[T]:t}return s}function dp(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var E_=T_(Qw),Jo=LC||function(s,o){return Br.setTimeout(s,o)},pp=T_(zN);function O_(s,o,l){var p=o+"";return pp(s,dR(p,SR(lR(p),l)))}function T_(s){var o=0,l=0;return function(){var p=$C(),v=De-(p-l);if(l=p,v>0){if(++o>=ve)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Jc(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var T=Yd(l,v),N=s[T];s[T]=s[l],s[l]=N}return s.length=o,s}var A_=vR(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Lr,function(l,p,v,T){o.push(v?T.replace(me,"$1"):p||l)}),o});function hi(s){if(typeof s=="string"||kn(s))return s;var o=s+"";return o=="0"&&1/s==-be?"-0":o}function js(s){if(s!=null){try{return Ec.call(s)}catch{}try{return s+""}catch{}}return""}function SR(s,o){return Bn(ht,function(l){var p="_."+l[0];o&l[1]&&!bc(s,p)&&s.push(p)}),s.sort()}function k_(s){if(s instanceof wt)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 ER(s,o,l){(l?sn(s,o,l):o===t)?o=1:o=Cr(lt(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,T=0,N=K(Cc(p/o));v<p;)N[T++]=Hn(s,v,v+=o);return N}function OR(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var T=s[o];T&&(v[p++]=T)}return v}function TR(){var s=arguments.length;if(!s)return[];for(var o=K(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return as(at(l)?ln(l):[l],Vr(o,1))}var AR=pt(function(s,o){return vr(s)?Vo(s,Vr(o,1,vr,!0)):[]}),kR=pt(function(s,o){var l=Qn(o);return vr(l)&&(l=t),vr(s)?Vo(s,Vr(o,1,vr,!0),We(l,2)):[]}),IR=pt(function(s,o){var l=Qn(o);return vr(l)&&(l=t),vr(s)?Vo(s,Vr(o,1,vr,!0),t,l):[]});function PR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),Hn(s,o<0?0:o,p)):[]}function CR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),o=p-o,Hn(s,0,o<0?0:o)):[]}function NR(s,o){return s&&s.length?$c(s,We(o,3),!0,!0):[]}function RR(s,o){return s&&s.length?$c(s,We(o,3),!0):[]}function DR(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),TN(s,o,l,p)):[]}function I_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:lt(l);return v<0&&(v=Cr(p+v,0)),wc(s,We(o,3),v)}function P_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=lt(l),v=l<0?Cr(p+v,0):Gr(v,p-1)),wc(s,We(o,3),v,!0)}function C_(s){var o=s==null?0:s.length;return o?Vr(s,1):[]}function FR(s){var o=s==null?0:s.length;return o?Vr(s,be):[]}function MR(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:lt(o),Vr(s,o)):[]}function LR(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 N_(s){return s&&s.length?s[0]:t}function jR(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:lt(l);return v<0&&(v=Cr(p+v,0)),Oa(s,o,v)}function qR(s){var o=s==null?0:s.length;return o?Hn(s,0,-1):[]}var UR=pt(function(s){var o=ar(s,tp);return o.length&&o[0]===s[0]?zd(o):[]}),$R=pt(function(s){var o=Qn(s),l=ar(s,tp);return o===Qn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?zd(l,We(o,2)):[]}),BR=pt(function(s){var o=Qn(s),l=ar(s,tp);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?zd(l,t,o):[]});function VR(s,o){return s==null?"":qC.call(s,o)}function Qn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function WR(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=lt(l),v=v<0?Cr(p+v,0):Gr(v,p-1)),o===o?SC(s,o,v):wc(s,hw,v,!0)}function zR(s,o){return s&&s.length?Vw(s,lt(o)):t}var HR=pt(R_);function R_(s,o){return s&&s.length&&o&&o.length?Jd(s,o):s}function QR(s,o,l){return s&&s.length&&o&&o.length?Jd(s,o,We(l,2)):s}function GR(s,o,l){return s&&s.length&&o&&o.length?Jd(s,o,t,l):s}var JR=Ni(function(s,o){var l=s==null?0:s.length,p=$d(s,o);return Hw(s,ar(o,function(v){return Ri(v,l)?+v:v}).sort(r_)),p});function YR(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],T=s.length;for(o=We(o,3);++p<T;){var N=s[p];o(N,p,s)&&(l.push(N),v.push(p))}return Hw(s,v),l}function mp(s){return s==null?s:VC.call(s)}function KR(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:lt(o),l=l===t?p:lt(l)),Hn(s,o,l)):[]}function ZR(s,o){return Uc(s,o)}function XR(s,o,l){return Zd(s,o,We(l,2))}function eD(s,o){var l=s==null?0:s.length;if(l){var p=Uc(s,o);if(p<l&&ai(s[p],o))return p}return-1}function tD(s,o){return Uc(s,o,!0)}function rD(s,o,l){return Zd(s,o,We(l,2),!0)}function nD(s,o){var l=s==null?0:s.length;if(l){var p=Uc(s,o,!0)-1;if(ai(s[p],o))return p}return-1}function iD(s){return s&&s.length?Gw(s):[]}function sD(s,o){return s&&s.length?Gw(s,We(o,2)):[]}function aD(s){var o=s==null?0:s.length;return o?Hn(s,1,o):[]}function oD(s,o,l){return s&&s.length?(o=l||o===t?1:lt(o),Hn(s,0,o<0?0:o)):[]}function uD(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),o=p-o,Hn(s,o<0?0:o,p)):[]}function cD(s,o){return s&&s.length?$c(s,We(o,3),!1,!0):[]}function lD(s,o){return s&&s.length?$c(s,We(o,3)):[]}var fD=pt(function(s){return ls(Vr(s,1,vr,!0))}),hD=pt(function(s){var o=Qn(s);return vr(o)&&(o=t),ls(Vr(s,1,vr,!0),We(o,2))}),dD=pt(function(s){var o=Qn(s);return o=typeof o=="function"?o:t,ls(Vr(s,1,vr,!0),t,o)});function pD(s){return s&&s.length?ls(s):[]}function mD(s,o){return s&&s.length?ls(s,We(o,2)):[]}function yD(s,o){return o=typeof o=="function"?o:t,s&&s.length?ls(s,t,o):[]}function yp(s){if(!(s&&s.length))return[];var o=0;return s=ss(s,function(l){if(vr(l))return o=Cr(l.length,o),!0}),Rd(o,function(l){return ar(s,Pd(l))})}function D_(s,o){if(!(s&&s.length))return[];var l=yp(s);return o==null?l:ar(l,function(p){return On(o,t,p)})}var gD=pt(function(s,o){return vr(s)?Vo(s,o):[]}),vD=pt(function(s){return ep(ss(s,vr))}),bD=pt(function(s){var o=Qn(s);return vr(o)&&(o=t),ep(ss(s,vr),We(o,2))}),wD=pt(function(s){var o=Qn(s);return o=typeof o=="function"?o:t,ep(ss(s,vr),t,o)}),_D=pt(yp);function xD(s,o){return Zw(s||[],o||[],Bo)}function SD(s,o){return Zw(s||[],o||[],Ho)}var ED=pt(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,D_(s,l)});function F_(s){var o=S(s);return o.__chain__=!0,o}function OD(s,o){return o(s),s}function Yc(s,o){return o(s)}var TD=Ni(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(T){return $d(T,s)};return o>1||this.__actions__.length||!(p instanceof wt)||!Ri(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Yc,args:[v],thisArg:t}),new Wn(p,this.__chain__).thru(function(T){return o&&!T.length&&T.push(t),T}))});function AD(){return F_(this)}function kD(){return new Wn(this.value(),this.__chain__)}function ID(){this.__values__===t&&(this.__values__=J_(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function PD(){return this}function CD(s){for(var o,l=this;l instanceof Fc;){var p=k_(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 ND(){var s=this.__wrapped__;if(s instanceof wt){var o=s;return this.__actions__.length&&(o=new wt(this)),o=o.reverse(),o.__actions__.push({func:Yc,args:[mp],thisArg:t}),new Wn(o,this.__chain__)}return this.thru(mp)}function RD(){return Kw(this.__wrapped__,this.__actions__)}var DD=Bc(function(s,o,l){$t.call(s,l)?++s[l]:Pi(s,l,1)});function FD(s,o,l){var p=at(s)?lw:ON;return l&&sn(s,o,l)&&(o=t),p(s,We(o,3))}function MD(s,o){var l=at(s)?ss:Dw;return l(s,We(o,3))}var LD=u_(I_),jD=u_(P_);function qD(s,o){return Vr(Kc(s,o),1)}function UD(s,o){return Vr(Kc(s,o),be)}function $D(s,o,l){return l=l===t?1:lt(l),Vr(Kc(s,o),l)}function M_(s,o){var l=at(s)?Bn:cs;return l(s,We(o,3))}function L_(s,o){var l=at(s)?aC:Rw;return l(s,We(o,3))}var BD=Bc(function(s,o,l){$t.call(s,l)?s[l].push(o):Pi(s,l,[o])});function VD(s,o,l,p){s=fn(s)?s:La(s),l=l&&!p?lt(l):0;var v=s.length;return l<0&&(l=Cr(v+l,0)),rl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Oa(s,o,l)>-1}var WD=pt(function(s,o,l){var p=-1,v=typeof o=="function",T=fn(s)?K(s.length):[];return cs(s,function(N){T[++p]=v?On(o,N,l):Wo(N,o,l)}),T}),zD=Bc(function(s,o,l){Pi(s,l,o)});function Kc(s,o){var l=at(s)?ar:Uw;return l(s,We(o,3))}function HD(s,o,l,p){return s==null?[]:(at(o)||(o=o==null?[]:[o]),l=p?t:l,at(l)||(l=l==null?[]:[l]),Ww(s,o,l))}var QD=Bc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function GD(s,o,l){var p=at(s)?kd:pw,v=arguments.length<3;return p(s,We(o,4),l,v,cs)}function JD(s,o,l){var p=at(s)?oC:pw,v=arguments.length<3;return p(s,We(o,4),l,v,Rw)}function YD(s,o){var l=at(s)?ss:Dw;return l(s,el(We(o,3)))}function KD(s){var o=at(s)?Iw:VN;return o(s)}function ZD(s,o,l){(l?sn(s,o,l):o===t)?o=1:o=lt(o);var p=at(s)?wN:WN;return p(s,o)}function XD(s){var o=at(s)?_N:HN;return o(s)}function eF(s){if(s==null)return 0;if(fn(s))return rl(s)?Aa(s):s.length;var o=Jr(s);return o==Z||o==_e?s.size:Qd(s).length}function tF(s,o,l){var p=at(s)?Id:QN;return l&&sn(s,o,l)&&(o=t),p(s,We(o,3))}var rF=pt(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]]),Ww(s,Vr(o,1),[])}),Zc=MC||function(){return Br.Date.now()};function nF(s,o){if(typeof o!="function")throw new Vn(u);return s=lt(s),function(){if(--s<1)return o.apply(this,arguments)}}function j_(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Ci(s,te,t,t,t,t,o)}function q_(s,o){var l;if(typeof o!="function")throw new Vn(u);return s=lt(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var gp=pt(function(s,o,l){var p=x;if(l.length){var v=os(l,Fa(gp));p|=F}return Ci(s,p,o,l,v)}),U_=pt(function(s,o,l){var p=x|w;if(l.length){var v=os(l,Fa(U_));p|=F}return Ci(o,p,s,l,v)});function $_(s,o,l){o=l?t:o;var p=Ci(s,P,t,t,t,t,t,o);return p.placeholder=$_.placeholder,p}function B_(s,o,l){o=l?t:o;var p=Ci(s,R,t,t,t,t,t,o);return p.placeholder=B_.placeholder,p}function V_(s,o,l){var p,v,T,N,L,V,ie=0,ae=!1,de=!1,Ae=!0;if(typeof s!="function")throw new Vn(u);o=Gn(o)||0,lr(l)&&(ae=!!l.leading,de="maxWait"in l,T=de?Cr(Gn(l.maxWait)||0,o):T,Ae="trailing"in l?!!l.trailing:Ae);function Ue(br){var oi=p,Mi=v;return p=v=t,ie=br,N=s.apply(Mi,oi),N}function Qe(br){return ie=br,L=Jo(vt,o),ae?Ue(br):N}function ft(br){var oi=br-V,Mi=br-ie,ux=o-oi;return de?Gr(ux,T-Mi):ux}function Ge(br){var oi=br-V,Mi=br-ie;return V===t||oi>=o||oi<0||de&&Mi>=T}function vt(){var br=Zc();if(Ge(br))return St(br);L=Jo(vt,ft(br))}function St(br){return L=t,Ae&&p?Ue(br):(p=v=t,N)}function In(){L!==t&&Xw(L),ie=0,p=V=v=L=t}function an(){return L===t?N:St(Zc())}function Pn(){var br=Zc(),oi=Ge(br);if(p=arguments,v=this,V=br,oi){if(L===t)return Qe(V);if(de)return Xw(L),L=Jo(vt,o),Ue(V)}return L===t&&(L=Jo(vt,o)),N}return Pn.cancel=In,Pn.flush=an,Pn}var iF=pt(function(s,o){return Nw(s,1,o)}),sF=pt(function(s,o,l){return Nw(s,Gn(o)||0,l)});function aF(s){return Ci(s,ue)}function Xc(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],T=l.cache;if(T.has(v))return T.get(v);var N=s.apply(this,p);return l.cache=T.set(v,N)||T,N};return l.cache=new(Xc.Cache||Ii),l}Xc.Cache=Ii;function el(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 oF(s){return q_(2,s)}var uF=GN(function(s,o){o=o.length==1&&at(o[0])?ar(o[0],Tn(We())):ar(Vr(o,1),Tn(We()));var l=o.length;return pt(function(p){for(var v=-1,T=Gr(p.length,l);++v<T;)p[v]=o[v].call(this,p[v]);return On(s,this,p)})}),vp=pt(function(s,o){var l=os(o,Fa(vp));return Ci(s,F,t,o,l)}),W_=pt(function(s,o){var l=os(o,Fa(W_));return Ci(s,$,t,o,l)}),cF=Ni(function(s,o){return Ci(s,J,t,t,t,o)});function lF(s,o){if(typeof s!="function")throw new Vn(u);return o=o===t?o:lt(o),pt(s,o)}function fF(s,o){if(typeof s!="function")throw new Vn(u);return o=o==null?0:Cr(lt(o),0),pt(function(l){var p=l[o],v=hs(l,0,o);return p&&as(v,p),On(s,this,v)})}function hF(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),V_(s,o,{leading:p,maxWait:o,trailing:v})}function dF(s){return j_(s,1)}function pF(s,o){return vp(rp(o),s)}function mF(){if(!arguments.length)return[];var s=arguments[0];return at(s)?s:[s]}function yF(s){return zn(s,m)}function gF(s,o){return o=typeof o=="function"?o:t,zn(s,m,o)}function vF(s){return zn(s,y|m)}function bF(s,o){return o=typeof o=="function"?o:t,zn(s,y|m,o)}function wF(s,o){return o==null||Cw(s,o,jr(o))}function ai(s,o){return s===o||s!==s&&o!==o}var _F=Hc(Wd),xF=Hc(function(s,o){return s>=o}),qs=Lw(function(){return arguments}())?Lw:function(s){return pr(s)&&$t.call(s,"callee")&&!Sw.call(s,"callee")},at=K.isArray,SF=iw?Tn(iw):CN;function fn(s){return s!=null&&tl(s.length)&&!Di(s)}function vr(s){return pr(s)&&fn(s)}function EF(s){return s===!0||s===!1||pr(s)&&nn(s)==dt}var ds=jC||Ip,OF=sw?Tn(sw):NN;function TF(s){return pr(s)&&s.nodeType===1&&!Yo(s)}function AF(s){if(s==null)return!0;if(fn(s)&&(at(s)||typeof s=="string"||typeof s.splice=="function"||ds(s)||Ma(s)||qs(s)))return!s.length;var o=Jr(s);if(o==Z||o==_e)return!s.size;if(Go(s))return!Qd(s).length;for(var l in s)if($t.call(s,l))return!1;return!0}function kF(s,o){return zo(s,o)}function IF(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?zo(s,o,t,l):!!p}function bp(s){if(!pr(s))return!1;var o=nn(s);return o==H||o==_t||typeof s.message=="string"&&typeof s.name=="string"&&!Yo(s)}function PF(s){return typeof s=="number"&&Ow(s)}function Di(s){if(!lr(s))return!1;var o=nn(s);return o==Y||o==B||o==Ye||o==Be}function z_(s){return typeof s=="number"&&s==lt(s)}function tl(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ce}function lr(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function pr(s){return s!=null&&typeof s=="object"}var H_=aw?Tn(aw):DN;function CF(s,o){return s===o||Hd(s,o,cp(o))}function NF(s,o,l){return l=typeof l=="function"?l:t,Hd(s,o,cp(o),l)}function RF(s){return Q_(s)&&s!=+s}function DF(s){if(gR(s))throw new st(a);return jw(s)}function FF(s){return s===null}function MF(s){return s==null}function Q_(s){return typeof s=="number"||pr(s)&&nn(s)==X}function Yo(s){if(!pr(s)||nn(s)!=we)return!1;var o=kc(s);if(o===null)return!0;var l=$t.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Ec.call(l)==NC}var wp=ow?Tn(ow):FN;function LF(s){return z_(s)&&s>=-ce&&s<=ce}var G_=uw?Tn(uw):MN;function rl(s){return typeof s=="string"||!at(s)&&pr(s)&&nn(s)==et}function kn(s){return typeof s=="symbol"||pr(s)&&nn(s)==Tt}var Ma=cw?Tn(cw):LN;function jF(s){return s===t}function qF(s){return pr(s)&&Jr(s)==Yt}function UF(s){return pr(s)&&nn(s)==xt}var $F=Hc(Gd),BF=Hc(function(s,o){return s<=o});function J_(s){if(!s)return[];if(fn(s))return rl(s)?ii(s):ln(s);if(Lo&&s[Lo])return wC(s[Lo]());var o=Jr(s),l=o==Z?Fd:o==_e?_c:La;return l(s)}function Fi(s){if(!s)return s===0?s:0;if(s=Gn(s),s===be||s===-be){var o=s<0?-1:1;return o*Te}return s===s?s:0}function lt(s){var o=Fi(s),l=o%1;return o===o?l?o-l:o:0}function Y_(s){return s?Fs(lt(s),0,Ee):0}function Gn(s){if(typeof s=="number")return s;if(kn(s))return Ne;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=mw(s);var l=He.test(s);return l||Ze.test(s)?nC(s.slice(2),l?2:8):ot.test(s)?Ne:+s}function K_(s){return fi(s,hn(s))}function VF(s){return s?Fs(lt(s),-ce,ce):s===0?s:0}function qt(s){return s==null?"":An(s)}var WF=Ra(function(s,o){if(Go(o)||fn(o)){fi(o,jr(o),s);return}for(var l in o)$t.call(o,l)&&Bo(s,l,o[l])}),Z_=Ra(function(s,o){fi(o,hn(o),s)}),nl=Ra(function(s,o,l,p){fi(o,hn(o),s,p)}),zF=Ra(function(s,o,l,p){fi(o,jr(o),s,p)}),HF=Ni($d);function QF(s,o){var l=Na(s);return o==null?l:Pw(l,o)}var GF=pt(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 T=o[l],N=hn(T),L=-1,V=N.length;++L<V;){var ie=N[L],ae=s[ie];(ae===t||ai(ae,Ia[ie])&&!$t.call(s,ie))&&(s[ie]=T[ie])}return s}),JF=pt(function(s){return s.push(t,m_),On(X_,t,s)});function YF(s,o){return fw(s,We(o,3),li)}function KF(s,o){return fw(s,We(o,3),Vd)}function ZF(s,o){return s==null?s:Bd(s,We(o,3),hn)}function XF(s,o){return s==null?s:Fw(s,We(o,3),hn)}function eM(s,o){return s&&li(s,We(o,3))}function tM(s,o){return s&&Vd(s,We(o,3))}function rM(s){return s==null?[]:jc(s,jr(s))}function nM(s){return s==null?[]:jc(s,hn(s))}function _p(s,o,l){var p=s==null?t:Ms(s,o);return p===t?l:p}function iM(s,o){return s!=null&&v_(s,o,AN)}function xp(s,o){return s!=null&&v_(s,o,kN)}var sM=l_(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Oc.call(o)),s[o]=l},Ep(dn)),aM=l_(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Oc.call(o)),$t.call(s,o)?s[o].push(l):s[o]=[l]},We),oM=pt(Wo);function jr(s){return fn(s)?kw(s):Qd(s)}function hn(s){return fn(s)?kw(s,!0):jN(s)}function uM(s,o){var l={};return o=We(o,3),li(s,function(p,v,T){Pi(l,o(p,v,T),p)}),l}function cM(s,o){var l={};return o=We(o,3),li(s,function(p,v,T){Pi(l,v,o(p,v,T))}),l}var lM=Ra(function(s,o,l){qc(s,o,l)}),X_=Ra(function(s,o,l,p){qc(s,o,l,p)}),fM=Ni(function(s,o){var l={};if(s==null)return l;var p=!1;o=ar(o,function(T){return T=fs(T,s),p||(p=T.length>1),T}),fi(s,op(s),l),p&&(l=zn(l,y|g|m,sR));for(var v=o.length;v--;)Xd(l,o[v]);return l});function hM(s,o){return ex(s,el(We(o)))}var dM=Ni(function(s,o){return s==null?{}:UN(s,o)});function ex(s,o){if(s==null)return{};var l=ar(op(s),function(p){return[p]});return o=We(o),zw(s,l,function(p,v){return o(p,v[0])})}function pM(s,o,l){o=fs(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var T=s==null?t:s[hi(o[p])];T===t&&(p=v,T=l),s=Di(T)?T.call(s):T}return s}function mM(s,o,l){return s==null?s:Ho(s,o,l)}function yM(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Ho(s,o,l,p)}var tx=d_(jr),rx=d_(hn);function gM(s,o,l){var p=at(s),v=p||ds(s)||Ma(s);if(o=We(o,4),l==null){var T=s&&s.constructor;v?l=p?new T:[]:lr(s)?l=Di(T)?Na(kc(s)):{}:l={}}return(v?Bn:li)(s,function(N,L,V){return o(l,N,L,V)}),l}function vM(s,o){return s==null?!0:Xd(s,o)}function bM(s,o,l){return s==null?s:Yw(s,o,rp(l))}function wM(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Yw(s,o,rp(l),p)}function La(s){return s==null?[]:Dd(s,jr(s))}function _M(s){return s==null?[]:Dd(s,hn(s))}function xM(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=Gn(l),l=l===l?l:0),o!==t&&(o=Gn(o),o=o===o?o:0),Fs(Gn(s),o,l)}function SM(s,o,l){return o=Fi(o),l===t?(l=o,o=0):l=Fi(l),s=Gn(s),IN(s,o,l)}function EM(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=Tw();return Gr(s+v*(o-s+rC("1e-"+((v+"").length-1))),o)}return Yd(s,o)}var OM=Da(function(s,o,l){return o=o.toLowerCase(),s+(l?nx(o):o)});function nx(s){return Sp(qt(s).toLowerCase())}function ix(s){return s=qt(s),s&&s.replace(_,mC).replace(HP,"")}function TM(s,o,l){s=qt(s),o=An(o);var p=s.length;l=l===t?p:Fs(lt(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function AM(s){return s=qt(s),s&&kr.test(s)?s.replace(Zt,yC):s}function kM(s){return s=qt(s),s&&Qr.test(s)?s.replace(sr,"\\$&"):s}var IM=Da(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),PM=Da(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),CM=o_("toLowerCase");function NM(s,o,l){s=qt(s),o=lt(o);var p=o?Aa(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return zc(Nc(v),l)+s+zc(Cc(v),l)}function RM(s,o,l){s=qt(s),o=lt(o);var p=o?Aa(s):0;return o&&p<o?s+zc(o-p,l):s}function DM(s,o,l){s=qt(s),o=lt(o);var p=o?Aa(s):0;return o&&p<o?zc(o-p,l)+s:s}function FM(s,o,l){return l||o==null?o=0:o&&(o=+o),BC(qt(s).replace(Tr,""),o||0)}function MM(s,o,l){return(l?sn(s,o,l):o===t)?o=1:o=lt(o),Kd(qt(s),o)}function LM(){var s=arguments,o=qt(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var jM=Da(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function qM(s,o,l){return l&&typeof l!="number"&&sn(s,o,l)&&(o=l=t),l=l===t?Ee:l>>>0,l?(s=qt(s),s&&(typeof o=="string"||o!=null&&!wp(o))&&(o=An(o),!o&&Ta(s))?hs(ii(s),0,l):s.split(o,l)):[]}var UM=Da(function(s,o,l){return s+(l?" ":"")+Sp(o)});function $M(s,o,l){return s=qt(s),l=l==null?0:Fs(lt(l),0,s.length),o=An(o),s.slice(l,l+o.length)==o}function BM(s,o,l){var p=S.templateSettings;l&&sn(s,o,l)&&(o=t),s=qt(s),o=nl({},o,p,p_);var v=nl({},o.imports,p.imports,p_),T=jr(v),N=Dd(v,T),L,V,ie=0,ae=o.interpolate||I,de="__p += '",Ae=Md((o.escape||I).source+"|"+ae.source+"|"+(ae===Ut?ke:I).source+"|"+(o.evaluate||I).source+"|$","g"),Ue="//# sourceURL="+($t.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++KP+"]")+`
|
|
96
|
-
`;s.replace(
|
|
97
|
-
__e(`+
|
|
98
|
-
'`),
|
|
99
|
-
`+
|
|
100
|
-
__p += '`),St&&(
|
|
95
|
+
`)}function gR(s){return ut(s)||qs(s)||!!(Ew&&s&&s[Ew])}function Ri(s,o){var l=typeof s;return o=o??ce,!!o&&(l=="number"||l!="symbol"&&xt.test(s))&&s>-1&&s%1==0&&s<o}function nn(s,o,l){if(!lr(l))return!1;var p=typeof o;return(p=="number"?hn(l)&&Ri(o,l.length):p=="string"&&o in l)?ai(l[o],s):!1}function fp(s,o){if(ut(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||kn(s)?!0:Or.test(s)||!Er.test(s)||o!=null&&s in Gt(o)}function vR(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function hp(s){var o=Jc(s),l=S[o];if(typeof l!="function"||!(o in bt.prototype))return!1;if(s===l)return!0;var p=up(l);return!!p&&s===p[0]}function bR(s){return!!ww&&ww in s}var wR=Oc?Di:Ip;function Yo(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Ca;return s===l}function w_(s){return s===s&&!lr(s)}function __(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Gt(l))}}function _R(s){var o=tl(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function xR(s,o){var l=s[1],p=o[1],v=l|p,T=v<(x|w|ee),N=p==ee&&l==C||p==ee&&l==Q&&s[7].length<=o[8]||p==(ee|Q)&&o[7].length<=o[8]&&l==C;if(!(T||N))return s;p&x&&(s[2]=o[2],v|=l&x?0:O);var L=o[3];if(L){var $=s[3];s[3]=$?n_($,L,o[4]):L,s[4]=$?os(s[3],d):o[4]}return L=o[5],L&&($=s[5],s[5]=$?i_($,L,o[6]):L,s[6]=$?os(s[5],d):o[6]),L=o[7],L&&(s[7]=L),p&ee&&(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 SR(s){var o=[];if(s!=null)for(var l in Gt(s))o.push(l);return o}function ER(s){return Ac.call(s)}function x_(s,o,l){return o=Cr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,T=Cr(p.length-o,0),N=Z(T);++v<T;)N[v]=p[o+v];v=-1;for(var L=Z(o+1);++v<o;)L[v]=p[v];return L[o]=l(N),On(s,this,L)}}function S_(s,o){return o.length<2?s:Fs(s,Hn(o,0,-1))}function OR(s,o){for(var l=s.length,p=Gr(o.length,l),v=fn(s);p--;){var T=o[p];s[p]=Ri(T,l)?v[T]:t}return s}function dp(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var E_=T_(Gw),Ko=UP||function(s,o){return Br.setTimeout(s,o)},pp=T_(QN);function O_(s,o,l){var p=o+"";return pp(s,yR(p,TR(dR(p),l)))}function T_(s){var o=0,l=0;return function(){var p=WP(),v=ve-(p-l);if(l=p,v>0){if(++o>=he)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Kc(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var T=Yd(l,v),N=s[T];s[T]=s[l],s[l]=N}return s.length=o,s}var A_=_R(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Ar,function(l,p,v,T){o.push(v?T.replace(we,"$1"):p||l)}),o});function di(s){if(typeof s=="string"||kn(s))return s;var o=s+"";return o=="0"&&1/s==-_e?"-0":o}function js(s){if(s!=null){try{return Tc.call(s)}catch{}try{return s+""}catch{}}return""}function TR(s,o){return Bn(ft,function(l){var p="_."+l[0];o&l[1]&&!_c(s,p)&&s.push(p)}),s.sort()}function k_(s){if(s instanceof bt)return s.clone();var o=new Wn(s.__wrapped__,s.__chain__);return o.__actions__=fn(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function AR(s,o,l){(l?nn(s,o,l):o===t)?o=1:o=Cr(lt(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,T=0,N=Z(Rc(p/o));v<p;)N[T++]=Hn(s,v,v+=o);return N}function kR(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var T=s[o];T&&(v[p++]=T)}return v}function IR(){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 as(ut(l)?fn(l):[l],Vr(o,1))}var CR=dt(function(s,o){return gr(s)?zo(s,Vr(o,1,gr,!0)):[]}),PR=dt(function(s,o){var l=Gn(o);return gr(l)&&(l=t),gr(s)?zo(s,Vr(o,1,gr,!0),He(l,2)):[]}),NR=dt(function(s,o){var l=Gn(o);return gr(l)&&(l=t),gr(s)?zo(s,Vr(o,1,gr,!0),t,l):[]});function RR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),Hn(s,o<0?0:o,p)):[]}function DR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),o=p-o,Hn(s,0,o<0?0:o)):[]}function MR(s,o){return s&&s.length?Vc(s,He(o,3),!0,!0):[]}function FR(s,o){return s&&s.length?Vc(s,He(o,3),!0):[]}function LR(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&nn(s,o,l)&&(l=0,p=v),IN(s,o,l,p)):[]}function I_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:lt(l);return v<0&&(v=Cr(p+v,0)),xc(s,He(o,3),v)}function C_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=lt(l),v=l<0?Cr(p+v,0):Gr(v,p-1)),xc(s,He(o,3),v,!0)}function P_(s){var o=s==null?0:s.length;return o?Vr(s,1):[]}function jR(s){var o=s==null?0:s.length;return o?Vr(s,_e):[]}function qR(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:lt(o),Vr(s,o)):[]}function UR(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 N_(s){return s&&s.length?s[0]:t}function $R(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:lt(l);return v<0&&(v=Cr(p+v,0)),Ta(s,o,v)}function BR(s){var o=s==null?0:s.length;return o?Hn(s,0,-1):[]}var VR=dt(function(s){var o=sr(s,tp);return o.length&&o[0]===s[0]?zd(o):[]}),WR=dt(function(s){var o=Gn(s),l=sr(s,tp);return o===Gn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?zd(l,He(o,2)):[]}),zR=dt(function(s){var o=Gn(s),l=sr(s,tp);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?zd(l,t,o):[]});function HR(s,o){return s==null?"":BP.call(s,o)}function Gn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function GR(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=lt(l),v=v<0?Cr(p+v,0):Gr(v,p-1)),o===o?TP(s,o,v):xc(s,hw,v,!0)}function QR(s,o){return s&&s.length?Vw(s,lt(o)):t}var JR=dt(R_);function R_(s,o){return s&&s.length&&o&&o.length?Jd(s,o):s}function YR(s,o,l){return s&&s.length&&o&&o.length?Jd(s,o,He(l,2)):s}function KR(s,o,l){return s&&s.length&&o&&o.length?Jd(s,o,t,l):s}var ZR=Ni(function(s,o){var l=s==null?0:s.length,p=$d(s,o);return Hw(s,sr(o,function(v){return Ri(v,l)?+v:v}).sort(r_)),p});function XR(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],T=s.length;for(o=He(o,3);++p<T;){var N=s[p];o(N,p,s)&&(l.push(N),v.push(p))}return Hw(s,v),l}function mp(s){return s==null?s:HP.call(s)}function eD(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&nn(s,o,l)?(o=0,l=p):(o=o==null?0:lt(o),l=l===t?p:lt(l)),Hn(s,o,l)):[]}function tD(s,o){return Bc(s,o)}function rD(s,o,l){return Zd(s,o,He(l,2))}function nD(s,o){var l=s==null?0:s.length;if(l){var p=Bc(s,o);if(p<l&&ai(s[p],o))return p}return-1}function iD(s,o){return Bc(s,o,!0)}function sD(s,o,l){return Zd(s,o,He(l,2),!0)}function aD(s,o){var l=s==null?0:s.length;if(l){var p=Bc(s,o,!0)-1;if(ai(s[p],o))return p}return-1}function oD(s){return s&&s.length?Qw(s):[]}function uD(s,o){return s&&s.length?Qw(s,He(o,2)):[]}function cD(s){var o=s==null?0:s.length;return o?Hn(s,1,o):[]}function lD(s,o,l){return s&&s.length?(o=l||o===t?1:lt(o),Hn(s,0,o<0?0:o)):[]}function fD(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:lt(o),o=p-o,Hn(s,o<0?0:o,p)):[]}function hD(s,o){return s&&s.length?Vc(s,He(o,3),!1,!0):[]}function dD(s,o){return s&&s.length?Vc(s,He(o,3)):[]}var pD=dt(function(s){return ls(Vr(s,1,gr,!0))}),mD=dt(function(s){var o=Gn(s);return gr(o)&&(o=t),ls(Vr(s,1,gr,!0),He(o,2))}),yD=dt(function(s){var o=Gn(s);return o=typeof o=="function"?o:t,ls(Vr(s,1,gr,!0),t,o)});function gD(s){return s&&s.length?ls(s):[]}function vD(s,o){return s&&s.length?ls(s,He(o,2)):[]}function bD(s,o){return o=typeof o=="function"?o:t,s&&s.length?ls(s,t,o):[]}function yp(s){if(!(s&&s.length))return[];var o=0;return s=ss(s,function(l){if(gr(l))return o=Cr(l.length,o),!0}),Rd(o,function(l){return sr(s,Cd(l))})}function D_(s,o){if(!(s&&s.length))return[];var l=yp(s);return o==null?l:sr(l,function(p){return On(o,t,p)})}var wD=dt(function(s,o){return gr(s)?zo(s,o):[]}),_D=dt(function(s){return ep(ss(s,gr))}),xD=dt(function(s){var o=Gn(s);return gr(o)&&(o=t),ep(ss(s,gr),He(o,2))}),SD=dt(function(s){var o=Gn(s);return o=typeof o=="function"?o:t,ep(ss(s,gr),t,o)}),ED=dt(yp);function OD(s,o){return Zw(s||[],o||[],Wo)}function TD(s,o){return Zw(s||[],o||[],Qo)}var AD=dt(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,D_(s,l)});function M_(s){var o=S(s);return o.__chain__=!0,o}function kD(s,o){return o(s),s}function Zc(s,o){return o(s)}var ID=Ni(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(T){return $d(T,s)};return o>1||this.__actions__.length||!(p instanceof bt)||!Ri(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Zc,args:[v],thisArg:t}),new Wn(p,this.__chain__).thru(function(T){return o&&!T.length&&T.push(t),T}))});function CD(){return M_(this)}function PD(){return new Wn(this.value(),this.__chain__)}function ND(){this.__values__===t&&(this.__values__=J_(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function RD(){return this}function DD(s){for(var o,l=this;l instanceof Lc;){var p=k_(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 MD(){var s=this.__wrapped__;if(s instanceof bt){var o=s;return this.__actions__.length&&(o=new bt(this)),o=o.reverse(),o.__actions__.push({func:Zc,args:[mp],thisArg:t}),new Wn(o,this.__chain__)}return this.thru(mp)}function FD(){return Kw(this.__wrapped__,this.__actions__)}var LD=Wc(function(s,o,l){Bt.call(s,l)?++s[l]:Ci(s,l,1)});function jD(s,o,l){var p=ut(s)?lw:kN;return l&&nn(s,o,l)&&(o=t),p(s,He(o,3))}function qD(s,o){var l=ut(s)?ss:Dw;return l(s,He(o,3))}var UD=u_(I_),$D=u_(C_);function BD(s,o){return Vr(Xc(s,o),1)}function VD(s,o){return Vr(Xc(s,o),_e)}function WD(s,o,l){return l=l===t?1:lt(l),Vr(Xc(s,o),l)}function F_(s,o){var l=ut(s)?Bn:cs;return l(s,He(o,3))}function L_(s,o){var l=ut(s)?cP:Rw;return l(s,He(o,3))}var zD=Wc(function(s,o,l){Bt.call(s,l)?s[l].push(o):Ci(s,l,[o])});function HD(s,o,l,p){s=hn(s)?s:ja(s),l=l&&!p?lt(l):0;var v=s.length;return l<0&&(l=Cr(v+l,0)),il(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Ta(s,o,l)>-1}var GD=dt(function(s,o,l){var p=-1,v=typeof o=="function",T=hn(s)?Z(s.length):[];return cs(s,function(N){T[++p]=v?On(o,N,l):Ho(N,o,l)}),T}),QD=Wc(function(s,o,l){Ci(s,l,o)});function Xc(s,o){var l=ut(s)?sr:Uw;return l(s,He(o,3))}function JD(s,o,l,p){return s==null?[]:(ut(o)||(o=o==null?[]:[o]),l=p?t:l,ut(l)||(l=l==null?[]:[l]),Ww(s,o,l))}var YD=Wc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function KD(s,o,l){var p=ut(s)?kd:pw,v=arguments.length<3;return p(s,He(o,4),l,v,cs)}function ZD(s,o,l){var p=ut(s)?lP:pw,v=arguments.length<3;return p(s,He(o,4),l,v,Rw)}function XD(s,o){var l=ut(s)?ss:Dw;return l(s,rl(He(o,3)))}function eM(s){var o=ut(s)?Iw:HN;return o(s)}function tM(s,o,l){(l?nn(s,o,l):o===t)?o=1:o=lt(o);var p=ut(s)?SN:GN;return p(s,o)}function rM(s){var o=ut(s)?EN:JN;return o(s)}function nM(s){if(s==null)return 0;if(hn(s))return il(s)?ka(s):s.length;var o=Qr(s);return o==J||o==xe?s.size:Gd(s).length}function iM(s,o,l){var p=ut(s)?Id:YN;return l&&nn(s,o,l)&&(o=t),p(s,He(o,3))}var sM=dt(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]]),Ww(s,Vr(o,1),[])}),el=qP||function(){return Br.Date.now()};function aM(s,o){if(typeof o!="function")throw new Vn(u);return s=lt(s),function(){if(--s<1)return o.apply(this,arguments)}}function j_(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Pi(s,ee,t,t,t,t,o)}function q_(s,o){var l;if(typeof o!="function")throw new Vn(u);return s=lt(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var gp=dt(function(s,o,l){var p=x;if(l.length){var v=os(l,Fa(gp));p|=F}return Pi(s,p,o,l,v)}),U_=dt(function(s,o,l){var p=x|w;if(l.length){var v=os(l,Fa(U_));p|=F}return Pi(o,p,s,l,v)});function $_(s,o,l){o=l?t:o;var p=Pi(s,C,t,t,t,t,t,o);return p.placeholder=$_.placeholder,p}function B_(s,o,l){o=l?t:o;var p=Pi(s,D,t,t,t,t,t,o);return p.placeholder=B_.placeholder,p}function V_(s,o,l){var p,v,T,N,L,$,se=0,oe=!1,pe=!1,ke=!0;if(typeof s!="function")throw new Vn(u);o=Qn(o)||0,lr(l)&&(oe=!!l.leading,pe="maxWait"in l,T=pe?Cr(Qn(l.maxWait)||0,o):T,ke="trailing"in l?!!l.trailing:ke);function $e(vr){var oi=p,Fi=v;return p=v=t,se=vr,N=s.apply(Fi,oi),N}function Qe(vr){return se=vr,L=Ko(gt,o),oe?$e(vr):N}function ht(vr){var oi=vr-$,Fi=vr-se,ux=o-oi;return pe?Gr(ux,T-Fi):ux}function Je(vr){var oi=vr-$,Fi=vr-se;return $===t||oi>=o||oi<0||pe&&Fi>=T}function gt(){var vr=el();if(Je(vr))return St(vr);L=Ko(gt,ht(vr))}function St(vr){return L=t,ke&&p?$e(vr):(p=v=t,N)}function In(){L!==t&&Xw(L),se=0,p=$=v=L=t}function sn(){return L===t?N:St(el())}function Cn(){var vr=el(),oi=Je(vr);if(p=arguments,v=this,$=vr,oi){if(L===t)return Qe($);if(pe)return Xw(L),L=Ko(gt,o),$e($)}return L===t&&(L=Ko(gt,o)),N}return Cn.cancel=In,Cn.flush=sn,Cn}var oM=dt(function(s,o){return Nw(s,1,o)}),uM=dt(function(s,o,l){return Nw(s,Qn(o)||0,l)});function cM(s){return Pi(s,re)}function tl(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],T=l.cache;if(T.has(v))return T.get(v);var N=s.apply(this,p);return l.cache=T.set(v,N)||T,N};return l.cache=new(tl.Cache||Ii),l}tl.Cache=Ii;function rl(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 lM(s){return q_(2,s)}var fM=KN(function(s,o){o=o.length==1&&ut(o[0])?sr(o[0],Tn(He())):sr(Vr(o,1),Tn(He()));var l=o.length;return dt(function(p){for(var v=-1,T=Gr(p.length,l);++v<T;)p[v]=o[v].call(this,p[v]);return On(s,this,p)})}),vp=dt(function(s,o){var l=os(o,Fa(vp));return Pi(s,F,t,o,l)}),W_=dt(function(s,o){var l=os(o,Fa(W_));return Pi(s,B,t,o,l)}),hM=Ni(function(s,o){return Pi(s,Q,t,t,t,o)});function dM(s,o){if(typeof s!="function")throw new Vn(u);return o=o===t?o:lt(o),dt(s,o)}function pM(s,o){if(typeof s!="function")throw new Vn(u);return o=o==null?0:Cr(lt(o),0),dt(function(l){var p=l[o],v=hs(l,0,o);return p&&as(v,p),On(s,this,v)})}function mM(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),V_(s,o,{leading:p,maxWait:o,trailing:v})}function yM(s){return j_(s,1)}function gM(s,o){return vp(rp(o),s)}function vM(){if(!arguments.length)return[];var s=arguments[0];return ut(s)?s:[s]}function bM(s){return zn(s,m)}function wM(s,o){return o=typeof o=="function"?o:t,zn(s,m,o)}function _M(s){return zn(s,y|m)}function xM(s,o){return o=typeof o=="function"?o:t,zn(s,y|m,o)}function SM(s,o){return o==null||Pw(s,o,Lr(o))}function ai(s,o){return s===o||s!==s&&o!==o}var EM=Qc(Wd),OM=Qc(function(s,o){return s>=o}),qs=Lw(function(){return arguments}())?Lw:function(s){return pr(s)&&Bt.call(s,"callee")&&!Sw.call(s,"callee")},ut=Z.isArray,TM=iw?Tn(iw):DN;function hn(s){return s!=null&&nl(s.length)&&!Di(s)}function gr(s){return pr(s)&&hn(s)}function AM(s){return s===!0||s===!1||pr(s)&&rn(s)==pt}var ds=$P||Ip,kM=sw?Tn(sw):MN;function IM(s){return pr(s)&&s.nodeType===1&&!Zo(s)}function CM(s){if(s==null)return!0;if(hn(s)&&(ut(s)||typeof s=="string"||typeof s.splice=="function"||ds(s)||La(s)||qs(s)))return!s.length;var o=Qr(s);if(o==J||o==xe)return!s.size;if(Yo(s))return!Gd(s).length;for(var l in s)if(Bt.call(s,l))return!1;return!0}function PM(s,o){return Go(s,o)}function NM(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?Go(s,o,t,l):!!p}function bp(s){if(!pr(s))return!1;var o=rn(s);return o==z||o==wt||typeof s.message=="string"&&typeof s.name=="string"&&!Zo(s)}function RM(s){return typeof s=="number"&&Ow(s)}function Di(s){if(!lr(s))return!1;var o=rn(s);return o==K||o==V||o==Ye||o==Ve}function z_(s){return typeof s=="number"&&s==lt(s)}function nl(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ce}function lr(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function pr(s){return s!=null&&typeof s=="object"}var H_=aw?Tn(aw):LN;function DM(s,o){return s===o||Hd(s,o,cp(o))}function MM(s,o,l){return l=typeof l=="function"?l:t,Hd(s,o,cp(o),l)}function FM(s){return G_(s)&&s!=+s}function LM(s){if(wR(s))throw new at(a);return jw(s)}function jM(s){return s===null}function qM(s){return s==null}function G_(s){return typeof s=="number"||pr(s)&&rn(s)==X}function Zo(s){if(!pr(s)||rn(s)!=Ce)return!1;var o=Cc(s);if(o===null)return!0;var l=Bt.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Tc.call(l)==MP}var wp=ow?Tn(ow):jN;function UM(s){return z_(s)&&s>=-ce&&s<=ce}var Q_=uw?Tn(uw):qN;function il(s){return typeof s=="string"||!ut(s)&&pr(s)&&rn(s)==Ze}function kn(s){return typeof s=="symbol"||pr(s)&&rn(s)==At}var La=cw?Tn(cw):UN;function $M(s){return s===t}function BM(s){return pr(s)&&Qr(s)==Qt}function VM(s){return pr(s)&&rn(s)==mt}var WM=Qc(Qd),zM=Qc(function(s,o){return s<=o});function J_(s){if(!s)return[];if(hn(s))return il(s)?ii(s):fn(s);if(qo&&s[qo])return SP(s[qo]());var o=Qr(s),l=o==J?Md:o==xe?Sc:ja;return l(s)}function Mi(s){if(!s)return s===0?s:0;if(s=Qn(s),s===_e||s===-_e){var o=s<0?-1:1;return o*Ae}return s===s?s:0}function lt(s){var o=Mi(s),l=o%1;return o===o?l?o-l:o:0}function Y_(s){return s?Ms(lt(s),0,Oe):0}function Qn(s){if(typeof s=="number")return s;if(kn(s))return Me;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=mw(s);var l=st.test(s);return l||it.test(s)?aP(s.slice(2),l?2:8):ot.test(s)?Me:+s}function K_(s){return hi(s,dn(s))}function HM(s){return s?Ms(lt(s),-ce,ce):s===0?s:0}function $t(s){return s==null?"":An(s)}var GM=Da(function(s,o){if(Yo(o)||hn(o)){hi(o,Lr(o),s);return}for(var l in o)Bt.call(o,l)&&Wo(s,l,o[l])}),Z_=Da(function(s,o){hi(o,dn(o),s)}),sl=Da(function(s,o,l,p){hi(o,dn(o),s,p)}),QM=Da(function(s,o,l,p){hi(o,Lr(o),s,p)}),JM=Ni($d);function YM(s,o){var l=Ra(s);return o==null?l:Cw(l,o)}var KM=dt(function(s,o){s=Gt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&nn(o[0],o[1],v)&&(p=1);++l<p;)for(var T=o[l],N=dn(T),L=-1,$=N.length;++L<$;){var se=N[L],oe=s[se];(oe===t||ai(oe,Ca[se])&&!Bt.call(s,se))&&(s[se]=T[se])}return s}),ZM=dt(function(s){return s.push(t,m_),On(X_,t,s)});function XM(s,o){return fw(s,He(o,3),fi)}function eF(s,o){return fw(s,He(o,3),Vd)}function tF(s,o){return s==null?s:Bd(s,He(o,3),dn)}function rF(s,o){return s==null?s:Mw(s,He(o,3),dn)}function nF(s,o){return s&&fi(s,He(o,3))}function iF(s,o){return s&&Vd(s,He(o,3))}function sF(s){return s==null?[]:Uc(s,Lr(s))}function aF(s){return s==null?[]:Uc(s,dn(s))}function _p(s,o,l){var p=s==null?t:Fs(s,o);return p===t?l:p}function oF(s,o){return s!=null&&v_(s,o,CN)}function xp(s,o){return s!=null&&v_(s,o,PN)}var uF=l_(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Ac.call(o)),s[o]=l},Ep(pn)),cF=l_(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Ac.call(o)),Bt.call(s,o)?s[o].push(l):s[o]=[l]},He),lF=dt(Ho);function Lr(s){return hn(s)?kw(s):Gd(s)}function dn(s){return hn(s)?kw(s,!0):$N(s)}function fF(s,o){var l={};return o=He(o,3),fi(s,function(p,v,T){Ci(l,o(p,v,T),p)}),l}function hF(s,o){var l={};return o=He(o,3),fi(s,function(p,v,T){Ci(l,v,o(p,v,T))}),l}var dF=Da(function(s,o,l){$c(s,o,l)}),X_=Da(function(s,o,l,p){$c(s,o,l,p)}),pF=Ni(function(s,o){var l={};if(s==null)return l;var p=!1;o=sr(o,function(T){return T=fs(T,s),p||(p=T.length>1),T}),hi(s,op(s),l),p&&(l=zn(l,y|g|m,uR));for(var v=o.length;v--;)Xd(l,o[v]);return l});function mF(s,o){return ex(s,rl(He(o)))}var yF=Ni(function(s,o){return s==null?{}:VN(s,o)});function ex(s,o){if(s==null)return{};var l=sr(op(s),function(p){return[p]});return o=He(o),zw(s,l,function(p,v){return o(p,v[0])})}function gF(s,o,l){o=fs(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var T=s==null?t:s[di(o[p])];T===t&&(p=v,T=l),s=Di(T)?T.call(s):T}return s}function vF(s,o,l){return s==null?s:Qo(s,o,l)}function bF(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Qo(s,o,l,p)}var tx=d_(Lr),rx=d_(dn);function wF(s,o,l){var p=ut(s),v=p||ds(s)||La(s);if(o=He(o,4),l==null){var T=s&&s.constructor;v?l=p?new T:[]:lr(s)?l=Di(T)?Ra(Cc(s)):{}:l={}}return(v?Bn:fi)(s,function(N,L,$){return o(l,N,L,$)}),l}function _F(s,o){return s==null?!0:Xd(s,o)}function xF(s,o,l){return s==null?s:Yw(s,o,rp(l))}function SF(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Yw(s,o,rp(l),p)}function ja(s){return s==null?[]:Dd(s,Lr(s))}function EF(s){return s==null?[]:Dd(s,dn(s))}function OF(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),Ms(Qn(s),o,l)}function TF(s,o,l){return o=Mi(o),l===t?(l=o,o=0):l=Mi(l),s=Qn(s),NN(s,o,l)}function AF(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=Mi(s),o===t?(o=s,s=0):o=Mi(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=Tw();return Gr(s+v*(o-s+sP("1e-"+((v+"").length-1))),o)}return Yd(s,o)}var kF=Ma(function(s,o,l){return o=o.toLowerCase(),s+(l?nx(o):o)});function nx(s){return Sp($t(s).toLowerCase())}function ix(s){return s=$t(s),s&&s.replace(_,vP).replace(JC,"")}function IF(s,o,l){s=$t(s),o=An(o);var p=s.length;l=l===t?p:Ms(lt(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function CF(s){return s=$t(s),s&&$r.test(s)?s.replace(Ht,bP):s}function PF(s){return s=$t(s),s&&Hr.test(s)?s.replace(cr,"\\$&"):s}var NF=Ma(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),RF=Ma(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),DF=o_("toLowerCase");function MF(s,o,l){s=$t(s),o=lt(o);var p=o?ka(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return Gc(Dc(v),l)+s+Gc(Rc(v),l)}function FF(s,o,l){s=$t(s),o=lt(o);var p=o?ka(s):0;return o&&p<o?s+Gc(o-p,l):s}function LF(s,o,l){s=$t(s),o=lt(o);var p=o?ka(s):0;return o&&p<o?Gc(o-p,l)+s:s}function jF(s,o,l){return l||o==null?o=0:o&&(o=+o),zP($t(s).replace(kr,""),o||0)}function qF(s,o,l){return(l?nn(s,o,l):o===t)?o=1:o=lt(o),Kd($t(s),o)}function UF(){var s=arguments,o=$t(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var $F=Ma(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function BF(s,o,l){return l&&typeof l!="number"&&nn(s,o,l)&&(o=l=t),l=l===t?Oe:l>>>0,l?(s=$t(s),s&&(typeof o=="string"||o!=null&&!wp(o))&&(o=An(o),!o&&Aa(s))?hs(ii(s),0,l):s.split(o,l)):[]}var VF=Ma(function(s,o,l){return s+(l?" ":"")+Sp(o)});function WF(s,o,l){return s=$t(s),l=l==null?0:Ms(lt(l),0,s.length),o=An(o),s.slice(l,l+o.length)==o}function zF(s,o,l){var p=S.templateSettings;l&&nn(s,o,l)&&(o=t),s=$t(s),o=sl({},o,p,p_);var v=sl({},o.imports,p.imports,p_),T=Lr(v),N=Dd(v,T),L,$,se=0,oe=o.interpolate||I,pe="__p += '",ke=Fd((o.escape||I).source+"|"+oe.source+"|"+(oe===Sr?Pe:I).source+"|"+(o.evaluate||I).source+"|$","g"),$e="//# sourceURL="+(Bt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eP+"]")+`
|
|
96
|
+
`;s.replace(ke,function(Je,gt,St,In,sn,Cn){return St||(St=In),pe+=s.slice(se,Cn).replace(k,wP),gt&&(L=!0,pe+=`' +
|
|
97
|
+
__e(`+gt+`) +
|
|
98
|
+
'`),sn&&($=!0,pe+=`';
|
|
99
|
+
`+sn+`;
|
|
100
|
+
__p += '`),St&&(pe+=`' +
|
|
101
101
|
((__t = (`+St+`)) == null ? '' : __t) +
|
|
102
|
-
'`),
|
|
103
|
-
`;var Qe
|
|
104
|
-
`+
|
|
102
|
+
'`),se=Cn+Je.length,Je}),pe+=`';
|
|
103
|
+
`;var Qe=Bt.call(o,"variable")&&o.variable;if(!Qe)pe=`with (obj) {
|
|
104
|
+
`+pe+`
|
|
105
105
|
}
|
|
106
|
-
`;else if(
|
|
106
|
+
`;else if(ae.test(Qe))throw new at(c);pe=($?pe.replace(Ke,""):pe).replace(nr,"$1").replace(dr,"$1;"),pe="function("+(Qe||"obj")+`) {
|
|
107
107
|
`+(Qe?"":`obj || (obj = {});
|
|
108
|
-
`)+"var __t, __p = ''"+(L?", __e = _.escape":"")+(
|
|
108
|
+
`)+"var __t, __p = ''"+(L?", __e = _.escape":"")+($?`, __j = Array.prototype.join;
|
|
109
109
|
function print() { __p += __j.call(arguments, '') }
|
|
110
110
|
`:`;
|
|
111
|
-
`)+
|
|
112
|
-
}`;var ft=ax(function(){return Ft(T,Ue+"return "+de).apply(t,N)});if(ft.source=de,bp(ft))throw ft;return ft}function VM(s){return qt(s).toLowerCase()}function WM(s){return qt(s).toUpperCase()}function zM(s,o,l){if(s=qt(s),s&&(l||o===t))return mw(s);if(!s||!(o=An(o)))return s;var p=ii(s),v=ii(o),T=yw(p,v),N=gw(p,v)+1;return hs(p,T,N).join("")}function HM(s,o,l){if(s=qt(s),s&&(l||o===t))return s.slice(0,bw(s)+1);if(!s||!(o=An(o)))return s;var p=ii(s),v=gw(p,ii(o))+1;return hs(p,0,v).join("")}function QM(s,o,l){if(s=qt(s),s&&(l||o===t))return s.replace(Tr,"");if(!s||!(o=An(o)))return s;var p=ii(s),v=yw(p,ii(o));return hs(p,v).join("")}function GM(s,o){var l=fe,p=qe;if(lr(o)){var v="separator"in o?o.separator:v;l="length"in o?lt(o.length):l,p="omission"in o?An(o.omission):p}s=qt(s);var T=s.length;if(Ta(s)){var N=ii(s);T=N.length}if(l>=T)return s;var L=l-Aa(p);if(L<1)return p;var V=N?hs(N,0,L).join(""):s.slice(0,L);if(v===t)return V+p;if(N&&(L+=V.length-L),wp(v)){if(s.slice(L).search(v)){var ie,ae=V;for(v.global||(v=Md(v.source,qt($e.exec(v))+"g")),v.lastIndex=0;ie=v.exec(ae);)var de=ie.index;V=V.slice(0,de===t?L:de)}}else if(s.indexOf(An(v),L)!=L){var Ae=V.lastIndexOf(v);Ae>-1&&(V=V.slice(0,Ae))}return V+p}function JM(s){return s=qt(s),s&&Gt.test(s)?s.replace(Kt,EC):s}var YM=Da(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Sp=o_("toUpperCase");function sx(s,o,l){return s=qt(s),o=l?t:o,o===t?bC(s)?AC(s):lC(s):s.match(o)||[]}var ax=pt(function(s,o){try{return On(s,t,o)}catch(l){return bp(l)?l:new st(l)}}),KM=Ni(function(s,o){return Bn(o,function(l){l=hi(l),Pi(s,l,gp(s[l],s))}),s});function ZM(s){var o=s==null?0:s.length,l=We();return s=o?ar(s,function(p){if(typeof p[1]!="function")throw new Vn(u);return[l(p[0]),p[1]]}):[],pt(function(p){for(var v=-1;++v<o;){var T=s[v];if(On(T[0],this,p))return On(T[1],this,p)}})}function XM(s){return EN(zn(s,y))}function Ep(s){return function(){return s}}function e2(s,o){return s==null||s!==s?o:s}var t2=c_(),r2=c_(!0);function dn(s){return s}function Op(s){return qw(typeof s=="function"?s:zn(s,y))}function n2(s){return $w(zn(s,y))}function i2(s,o){return Bw(s,zn(o,y))}var s2=pt(function(s,o){return function(l){return Wo(l,s,o)}}),a2=pt(function(s,o){return function(l){return Wo(s,l,o)}});function Tp(s,o,l){var p=jr(o),v=jc(o,p);l==null&&!(lr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=jc(o,jr(o)));var T=!(lr(l)&&"chain"in l)||!!l.chain,N=Di(s);return Bn(v,function(L){var V=o[L];s[L]=V,N&&(s.prototype[L]=function(){var ie=this.__chain__;if(T||ie){var ae=s(this.__wrapped__),de=ae.__actions__=ln(this.__actions__);return de.push({func:V,args:arguments,thisArg:s}),ae.__chain__=ie,ae}return V.apply(s,as([this.value()],arguments))})}),s}function o2(){return Br._===this&&(Br._=RC),this}function Ap(){}function u2(s){return s=lt(s),pt(function(o){return Vw(o,s)})}var c2=ip(ar),l2=ip(lw),f2=ip(Id);function ox(s){return fp(s)?Pd(hi(s)):$N(s)}function h2(s){return function(o){return s==null?t:Ms(s,o)}}var d2=f_(),p2=f_(!0);function kp(){return[]}function Ip(){return!1}function m2(){return{}}function y2(){return""}function g2(){return!0}function v2(s,o){if(s=lt(s),s<1||s>ce)return[];var l=Ee,p=Gr(s,Ee);o=We(o),s-=Ee;for(var v=Rd(p,o);++l<s;)o(l);return v}function b2(s){return at(s)?ar(s,hi):kn(s)?[s]:ln(A_(qt(s)))}function w2(s){var o=++CC;return qt(s)+o}var _2=Wc(function(s,o){return s+o},0),x2=sp("ceil"),S2=Wc(function(s,o){return s/o},1),E2=sp("floor");function O2(s){return s&&s.length?Lc(s,dn,Wd):t}function T2(s,o){return s&&s.length?Lc(s,We(o,2),Wd):t}function A2(s){return dw(s,dn)}function k2(s,o){return dw(s,We(o,2))}function I2(s){return s&&s.length?Lc(s,dn,Gd):t}function P2(s,o){return s&&s.length?Lc(s,We(o,2),Gd):t}var C2=Wc(function(s,o){return s*o},1),N2=sp("round"),R2=Wc(function(s,o){return s-o},0);function D2(s){return s&&s.length?Nd(s,dn):0}function F2(s,o){return s&&s.length?Nd(s,We(o,2)):0}return S.after=nF,S.ary=j_,S.assign=WF,S.assignIn=Z_,S.assignInWith=nl,S.assignWith=zF,S.at=HF,S.before=q_,S.bind=gp,S.bindAll=KM,S.bindKey=U_,S.castArray=mF,S.chain=F_,S.chunk=ER,S.compact=OR,S.concat=TR,S.cond=ZM,S.conforms=XM,S.constant=Ep,S.countBy=DD,S.create=QF,S.curry=$_,S.curryRight=B_,S.debounce=V_,S.defaults=GF,S.defaultsDeep=JF,S.defer=iF,S.delay=sF,S.difference=AR,S.differenceBy=kR,S.differenceWith=IR,S.drop=PR,S.dropRight=CR,S.dropRightWhile=NR,S.dropWhile=RR,S.fill=DR,S.filter=MD,S.flatMap=qD,S.flatMapDeep=UD,S.flatMapDepth=$D,S.flatten=C_,S.flattenDeep=FR,S.flattenDepth=MR,S.flip=aF,S.flow=t2,S.flowRight=r2,S.fromPairs=LR,S.functions=rM,S.functionsIn=nM,S.groupBy=BD,S.initial=qR,S.intersection=UR,S.intersectionBy=$R,S.intersectionWith=BR,S.invert=sM,S.invertBy=aM,S.invokeMap=WD,S.iteratee=Op,S.keyBy=zD,S.keys=jr,S.keysIn=hn,S.map=Kc,S.mapKeys=uM,S.mapValues=cM,S.matches=n2,S.matchesProperty=i2,S.memoize=Xc,S.merge=lM,S.mergeWith=X_,S.method=s2,S.methodOf=a2,S.mixin=Tp,S.negate=el,S.nthArg=u2,S.omit=fM,S.omitBy=hM,S.once=oF,S.orderBy=HD,S.over=c2,S.overArgs=uF,S.overEvery=l2,S.overSome=f2,S.partial=vp,S.partialRight=W_,S.partition=QD,S.pick=dM,S.pickBy=ex,S.property=ox,S.propertyOf=h2,S.pull=HR,S.pullAll=R_,S.pullAllBy=QR,S.pullAllWith=GR,S.pullAt=JR,S.range=d2,S.rangeRight=p2,S.rearg=cF,S.reject=YD,S.remove=YR,S.rest=lF,S.reverse=mp,S.sampleSize=ZD,S.set=mM,S.setWith=yM,S.shuffle=XD,S.slice=KR,S.sortBy=rF,S.sortedUniq=iD,S.sortedUniqBy=sD,S.split=qM,S.spread=fF,S.tail=aD,S.take=oD,S.takeRight=uD,S.takeRightWhile=cD,S.takeWhile=lD,S.tap=OD,S.throttle=hF,S.thru=Yc,S.toArray=J_,S.toPairs=tx,S.toPairsIn=rx,S.toPath=b2,S.toPlainObject=K_,S.transform=gM,S.unary=dF,S.union=fD,S.unionBy=hD,S.unionWith=dD,S.uniq=pD,S.uniqBy=mD,S.uniqWith=yD,S.unset=vM,S.unzip=yp,S.unzipWith=D_,S.update=bM,S.updateWith=wM,S.values=La,S.valuesIn=_M,S.without=gD,S.words=sx,S.wrap=pF,S.xor=vD,S.xorBy=bD,S.xorWith=wD,S.zip=_D,S.zipObject=xD,S.zipObjectDeep=SD,S.zipWith=ED,S.entries=tx,S.entriesIn=rx,S.extend=Z_,S.extendWith=nl,Tp(S,S),S.add=_2,S.attempt=ax,S.camelCase=OM,S.capitalize=nx,S.ceil=x2,S.clamp=xM,S.clone=yF,S.cloneDeep=vF,S.cloneDeepWith=bF,S.cloneWith=gF,S.conformsTo=wF,S.deburr=ix,S.defaultTo=e2,S.divide=S2,S.endsWith=TM,S.eq=ai,S.escape=AM,S.escapeRegExp=kM,S.every=FD,S.find=LD,S.findIndex=I_,S.findKey=YF,S.findLast=jD,S.findLastIndex=P_,S.findLastKey=KF,S.floor=E2,S.forEach=M_,S.forEachRight=L_,S.forIn=ZF,S.forInRight=XF,S.forOwn=eM,S.forOwnRight=tM,S.get=_p,S.gt=_F,S.gte=xF,S.has=iM,S.hasIn=xp,S.head=N_,S.identity=dn,S.includes=VD,S.indexOf=jR,S.inRange=SM,S.invoke=oM,S.isArguments=qs,S.isArray=at,S.isArrayBuffer=SF,S.isArrayLike=fn,S.isArrayLikeObject=vr,S.isBoolean=EF,S.isBuffer=ds,S.isDate=OF,S.isElement=TF,S.isEmpty=AF,S.isEqual=kF,S.isEqualWith=IF,S.isError=bp,S.isFinite=PF,S.isFunction=Di,S.isInteger=z_,S.isLength=tl,S.isMap=H_,S.isMatch=CF,S.isMatchWith=NF,S.isNaN=RF,S.isNative=DF,S.isNil=MF,S.isNull=FF,S.isNumber=Q_,S.isObject=lr,S.isObjectLike=pr,S.isPlainObject=Yo,S.isRegExp=wp,S.isSafeInteger=LF,S.isSet=G_,S.isString=rl,S.isSymbol=kn,S.isTypedArray=Ma,S.isUndefined=jF,S.isWeakMap=qF,S.isWeakSet=UF,S.join=VR,S.kebabCase=IM,S.last=Qn,S.lastIndexOf=WR,S.lowerCase=PM,S.lowerFirst=CM,S.lt=$F,S.lte=BF,S.max=O2,S.maxBy=T2,S.mean=A2,S.meanBy=k2,S.min=I2,S.minBy=P2,S.stubArray=kp,S.stubFalse=Ip,S.stubObject=m2,S.stubString=y2,S.stubTrue=g2,S.multiply=C2,S.nth=zR,S.noConflict=o2,S.noop=Ap,S.now=Zc,S.pad=NM,S.padEnd=RM,S.padStart=DM,S.parseInt=FM,S.random=EM,S.reduce=GD,S.reduceRight=JD,S.repeat=MM,S.replace=LM,S.result=pM,S.round=N2,S.runInContext=q,S.sample=KD,S.size=eF,S.snakeCase=jM,S.some=tF,S.sortedIndex=ZR,S.sortedIndexBy=XR,S.sortedIndexOf=eD,S.sortedLastIndex=tD,S.sortedLastIndexBy=rD,S.sortedLastIndexOf=nD,S.startCase=UM,S.startsWith=$M,S.subtract=R2,S.sum=D2,S.sumBy=F2,S.template=BM,S.times=v2,S.toFinite=Fi,S.toInteger=lt,S.toLength=Y_,S.toLower=VM,S.toNumber=Gn,S.toSafeInteger=VF,S.toString=qt,S.toUpper=WM,S.trim=zM,S.trimEnd=HM,S.trimStart=QM,S.truncate=GM,S.unescape=JM,S.uniqueId=w2,S.upperCase=YM,S.upperFirst=Sp,S.each=M_,S.eachRight=L_,S.first=N_,Tp(S,function(){var s={};return li(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){wt.prototype[s]=function(l){l=l===t?1:Cr(lt(l),0);var p=this.__filtered__&&!o?new wt(this):this.clone();return p.__filtered__?p.__takeCount__=Gr(l,p.__takeCount__):p.__views__.push({size:Gr(l,Ee),type:s+(p.__dir__<0?"Right":"")}),p},wt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Bn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==je||l==Je;wt.prototype[s]=function(v){var T=this.clone();return T.__iteratees__.push({iteratee:We(v,3),type:l}),T.__filtered__=T.__filtered__||p,T}}),Bn(["head","last"],function(s,o){var l="take"+(o?"Right":"");wt.prototype[s]=function(){return this[l](1).value()[0]}}),Bn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");wt.prototype[s]=function(){return this.__filtered__?new wt(this):this[l](1)}}),wt.prototype.compact=function(){return this.filter(dn)},wt.prototype.find=function(s){return this.filter(s).head()},wt.prototype.findLast=function(s){return this.reverse().find(s)},wt.prototype.invokeMap=pt(function(s,o){return typeof s=="function"?new wt(this):this.map(function(l){return Wo(l,s,o)})}),wt.prototype.reject=function(s){return this.filter(el(We(s)))},wt.prototype.slice=function(s,o){s=lt(s);var l=this;return l.__filtered__&&(s>0||o<0)?new wt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=lt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},wt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},wt.prototype.toArray=function(){return this.take(Ee)},li(wt.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],T=p||/^find/.test(o);v&&(S.prototype[o]=function(){var N=this.__wrapped__,L=p?[1]:arguments,V=N instanceof wt,ie=L[0],ae=V||at(N),de=function(vt){var St=v.apply(S,as([vt],L));return p&&Ae?St[0]:St};ae&&l&&typeof ie=="function"&&ie.length!=1&&(V=ae=!1);var Ae=this.__chain__,Ue=!!this.__actions__.length,Qe=T&&!Ae,ft=V&&!Ue;if(!T&&ae){N=ft?N:new wt(this);var Ge=s.apply(N,L);return Ge.__actions__.push({func:Yc,args:[de],thisArg:t}),new Wn(Ge,Ae)}return Qe&&ft?s.apply(this,L):(Ge=this.thru(de),Qe?p?Ge.value()[0]:Ge.value():Ge)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(s){var o=xc[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 T=this.value();return o.apply(at(T)?T:[],v)}return this[l](function(N){return o.apply(at(N)?N:[],v)})}}),li(wt.prototype,function(s,o){var l=S[o];if(l){var p=l.name+"";$t.call(Ca,p)||(Ca[p]=[]),Ca[p].push({name:o,func:l})}}),Ca[Vc(t,w).name]=[{name:"wrapper",func:t}],wt.prototype.clone=JC,wt.prototype.reverse=YC,wt.prototype.value=KC,S.prototype.at=TD,S.prototype.chain=AD,S.prototype.commit=kD,S.prototype.next=ID,S.prototype.plant=CD,S.prototype.reverse=ND,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=RD,S.prototype.first=S.prototype.head,Lo&&(S.prototype[Lo]=PD),S},ka=kC();Cs?((Cs.exports=ka)._=ka,Od._=ka):Br._=ka}).call(di)}(Zu,Zu.exports);var eA=Zu.exports;const bi=Cp(eA),Wv=pe.createContext(),zv=pe.createContext(),Hv=pe.createContext(),tA=({children:r})=>{const[e,t]=pn.useSearchParams(),[n,i]=pe.useState(Object.fromEntries(e.entries())),[a,u]=pe.useState({});pe.useEffect(()=>{const h=Object.fromEntries(e.entries());i(h)},[e]),pe.useEffect(()=>{Object.keys(a).length>0&&(t(h=>{const d=new URLSearchParams(h);return Object.entries(a).forEach(([y,g])=>{g==null||g===""?d.delete(y):d.set(y,g)}),d}),u({}))},[a,t]);const c=h=>{i(d=>({...d,...h})),u(d=>({...d,...h}))},f=pe.useMemo(()=>[Object.fromEntries(e.entries()),c],[e]);return or.jsx(Hv.Provider,{value:f,children:r})},nh=pe.createContext(),rA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=pe.useContext(Hv),c=i[r]??e;return[c&&t(c),d=>{if(typeof d=="function"){const g=i[r];d=d(t(g??e))}const y=n(d);a({[r]:y})}]},vo=async(r,e,t)=>{pe.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},nA=(r,e,t)=>{const n=pe.useRef(r);pe.useEffect(()=>{n.current=r},[r]);const i=pe.useCallback(bi.throttle(()=>{n.current()},e),[]);pe.useEffect(i,[...t])},bo=(r,e=null,t)=>{const n=pe.useRef(r);pe.useEffect(()=>{n.current=r},[r]),vo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},Qv=(r,e,t)=>{const[n,i]=pe.useState(),[a,u]=pe.useState(!0),[c,f]=pe.useState(),{urls:h,request:d}=ti();return bo(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}},iA=(r,e)=>{const[t,n]=pe.useState(),[i,a]=pe.useState(!0),[u,c]=pe.useState(null),[f,h]=pe.useState(),{urls:d,request:y}=ti();return pe.useEffect(()=>{a(u===null||u>0)},[u]),bo(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}},sA=({machineRef:r,key:e,skip:t})=>{const[n,i]=pe.useState(),[a,u]=pe.useState(),[c,f]=pe.useState(),[h,d]=pe.useState(),[y,g]=pe.useState(),[m,b]=pe.useState(),A=Gi`
|
|
111
|
+
`)+pe+`return __p
|
|
112
|
+
}`;var ht=ax(function(){return Ft(T,$e+"return "+pe).apply(t,N)});if(ht.source=pe,bp(ht))throw ht;return ht}function HF(s){return $t(s).toLowerCase()}function GF(s){return $t(s).toUpperCase()}function QF(s,o,l){if(s=$t(s),s&&(l||o===t))return mw(s);if(!s||!(o=An(o)))return s;var p=ii(s),v=ii(o),T=yw(p,v),N=gw(p,v)+1;return hs(p,T,N).join("")}function JF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,bw(s)+1);if(!s||!(o=An(o)))return s;var p=ii(s),v=gw(p,ii(o))+1;return hs(p,0,v).join("")}function YF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(kr,"");if(!s||!(o=An(o)))return s;var p=ii(s),v=yw(p,ii(o));return hs(p,v).join("")}function KF(s,o){var l=fe,p=ge;if(lr(o)){var v="separator"in o?o.separator:v;l="length"in o?lt(o.length):l,p="omission"in o?An(o.omission):p}s=$t(s);var T=s.length;if(Aa(s)){var N=ii(s);T=N.length}if(l>=T)return s;var L=l-ka(p);if(L<1)return p;var $=N?hs(N,0,L).join(""):s.slice(0,L);if(v===t)return $+p;if(N&&(L+=$.length-L),wp(v)){if(s.slice(L).search(v)){var se,oe=$;for(v.global||(v=Fd(v.source,$t(Ue.exec(v))+"g")),v.lastIndex=0;se=v.exec(oe);)var pe=se.index;$=$.slice(0,pe===t?L:pe)}}else if(s.indexOf(An(v),L)!=L){var ke=$.lastIndexOf(v);ke>-1&&($=$.slice(0,ke))}return $+p}function ZF(s){return s=$t(s),s&&Ur.test(s)?s.replace(Mt,AP):s}var XF=Ma(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Sp=o_("toUpperCase");function sx(s,o,l){return s=$t(s),o=l?t:o,o===t?xP(s)?CP(s):dP(s):s.match(o)||[]}var ax=dt(function(s,o){try{return On(s,t,o)}catch(l){return bp(l)?l:new at(l)}}),e2=Ni(function(s,o){return Bn(o,function(l){l=di(l),Ci(s,l,gp(s[l],s))}),s});function t2(s){var o=s==null?0:s.length,l=He();return s=o?sr(s,function(p){if(typeof p[1]!="function")throw new Vn(u);return[l(p[0]),p[1]]}):[],dt(function(p){for(var v=-1;++v<o;){var T=s[v];if(On(T[0],this,p))return On(T[1],this,p)}})}function r2(s){return AN(zn(s,y))}function Ep(s){return function(){return s}}function n2(s,o){return s==null||s!==s?o:s}var i2=c_(),s2=c_(!0);function pn(s){return s}function Op(s){return qw(typeof s=="function"?s:zn(s,y))}function a2(s){return $w(zn(s,y))}function o2(s,o){return Bw(s,zn(o,y))}var u2=dt(function(s,o){return function(l){return Ho(l,s,o)}}),c2=dt(function(s,o){return function(l){return Ho(s,l,o)}});function Tp(s,o,l){var p=Lr(o),v=Uc(o,p);l==null&&!(lr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=Uc(o,Lr(o)));var T=!(lr(l)&&"chain"in l)||!!l.chain,N=Di(s);return Bn(v,function(L){var $=o[L];s[L]=$,N&&(s.prototype[L]=function(){var se=this.__chain__;if(T||se){var oe=s(this.__wrapped__),pe=oe.__actions__=fn(this.__actions__);return pe.push({func:$,args:arguments,thisArg:s}),oe.__chain__=se,oe}return $.apply(s,as([this.value()],arguments))})}),s}function l2(){return Br._===this&&(Br._=FP),this}function Ap(){}function f2(s){return s=lt(s),dt(function(o){return Vw(o,s)})}var h2=ip(sr),d2=ip(lw),p2=ip(Id);function ox(s){return fp(s)?Cd(di(s)):WN(s)}function m2(s){return function(o){return s==null?t:Fs(s,o)}}var y2=f_(),g2=f_(!0);function kp(){return[]}function Ip(){return!1}function v2(){return{}}function b2(){return""}function w2(){return!0}function _2(s,o){if(s=lt(s),s<1||s>ce)return[];var l=Oe,p=Gr(s,Oe);o=He(o),s-=Oe;for(var v=Rd(p,o);++l<s;)o(l);return v}function x2(s){return ut(s)?sr(s,di):kn(s)?[s]:fn(A_($t(s)))}function S2(s){var o=++DP;return $t(s)+o}var E2=Hc(function(s,o){return s+o},0),O2=sp("ceil"),T2=Hc(function(s,o){return s/o},1),A2=sp("floor");function k2(s){return s&&s.length?qc(s,pn,Wd):t}function I2(s,o){return s&&s.length?qc(s,He(o,2),Wd):t}function C2(s){return dw(s,pn)}function P2(s,o){return dw(s,He(o,2))}function N2(s){return s&&s.length?qc(s,pn,Qd):t}function R2(s,o){return s&&s.length?qc(s,He(o,2),Qd):t}var D2=Hc(function(s,o){return s*o},1),M2=sp("round"),F2=Hc(function(s,o){return s-o},0);function L2(s){return s&&s.length?Nd(s,pn):0}function j2(s,o){return s&&s.length?Nd(s,He(o,2)):0}return S.after=aM,S.ary=j_,S.assign=GM,S.assignIn=Z_,S.assignInWith=sl,S.assignWith=QM,S.at=JM,S.before=q_,S.bind=gp,S.bindAll=e2,S.bindKey=U_,S.castArray=vM,S.chain=M_,S.chunk=AR,S.compact=kR,S.concat=IR,S.cond=t2,S.conforms=r2,S.constant=Ep,S.countBy=LD,S.create=YM,S.curry=$_,S.curryRight=B_,S.debounce=V_,S.defaults=KM,S.defaultsDeep=ZM,S.defer=oM,S.delay=uM,S.difference=CR,S.differenceBy=PR,S.differenceWith=NR,S.drop=RR,S.dropRight=DR,S.dropRightWhile=MR,S.dropWhile=FR,S.fill=LR,S.filter=qD,S.flatMap=BD,S.flatMapDeep=VD,S.flatMapDepth=WD,S.flatten=P_,S.flattenDeep=jR,S.flattenDepth=qR,S.flip=cM,S.flow=i2,S.flowRight=s2,S.fromPairs=UR,S.functions=sF,S.functionsIn=aF,S.groupBy=zD,S.initial=BR,S.intersection=VR,S.intersectionBy=WR,S.intersectionWith=zR,S.invert=uF,S.invertBy=cF,S.invokeMap=GD,S.iteratee=Op,S.keyBy=QD,S.keys=Lr,S.keysIn=dn,S.map=Xc,S.mapKeys=fF,S.mapValues=hF,S.matches=a2,S.matchesProperty=o2,S.memoize=tl,S.merge=dF,S.mergeWith=X_,S.method=u2,S.methodOf=c2,S.mixin=Tp,S.negate=rl,S.nthArg=f2,S.omit=pF,S.omitBy=mF,S.once=lM,S.orderBy=JD,S.over=h2,S.overArgs=fM,S.overEvery=d2,S.overSome=p2,S.partial=vp,S.partialRight=W_,S.partition=YD,S.pick=yF,S.pickBy=ex,S.property=ox,S.propertyOf=m2,S.pull=JR,S.pullAll=R_,S.pullAllBy=YR,S.pullAllWith=KR,S.pullAt=ZR,S.range=y2,S.rangeRight=g2,S.rearg=hM,S.reject=XD,S.remove=XR,S.rest=dM,S.reverse=mp,S.sampleSize=tM,S.set=vF,S.setWith=bF,S.shuffle=rM,S.slice=eD,S.sortBy=sM,S.sortedUniq=oD,S.sortedUniqBy=uD,S.split=BF,S.spread=pM,S.tail=cD,S.take=lD,S.takeRight=fD,S.takeRightWhile=hD,S.takeWhile=dD,S.tap=kD,S.throttle=mM,S.thru=Zc,S.toArray=J_,S.toPairs=tx,S.toPairsIn=rx,S.toPath=x2,S.toPlainObject=K_,S.transform=wF,S.unary=yM,S.union=pD,S.unionBy=mD,S.unionWith=yD,S.uniq=gD,S.uniqBy=vD,S.uniqWith=bD,S.unset=_F,S.unzip=yp,S.unzipWith=D_,S.update=xF,S.updateWith=SF,S.values=ja,S.valuesIn=EF,S.without=wD,S.words=sx,S.wrap=gM,S.xor=_D,S.xorBy=xD,S.xorWith=SD,S.zip=ED,S.zipObject=OD,S.zipObjectDeep=TD,S.zipWith=AD,S.entries=tx,S.entriesIn=rx,S.extend=Z_,S.extendWith=sl,Tp(S,S),S.add=E2,S.attempt=ax,S.camelCase=kF,S.capitalize=nx,S.ceil=O2,S.clamp=OF,S.clone=bM,S.cloneDeep=_M,S.cloneDeepWith=xM,S.cloneWith=wM,S.conformsTo=SM,S.deburr=ix,S.defaultTo=n2,S.divide=T2,S.endsWith=IF,S.eq=ai,S.escape=CF,S.escapeRegExp=PF,S.every=jD,S.find=UD,S.findIndex=I_,S.findKey=XM,S.findLast=$D,S.findLastIndex=C_,S.findLastKey=eF,S.floor=A2,S.forEach=F_,S.forEachRight=L_,S.forIn=tF,S.forInRight=rF,S.forOwn=nF,S.forOwnRight=iF,S.get=_p,S.gt=EM,S.gte=OM,S.has=oF,S.hasIn=xp,S.head=N_,S.identity=pn,S.includes=HD,S.indexOf=$R,S.inRange=TF,S.invoke=lF,S.isArguments=qs,S.isArray=ut,S.isArrayBuffer=TM,S.isArrayLike=hn,S.isArrayLikeObject=gr,S.isBoolean=AM,S.isBuffer=ds,S.isDate=kM,S.isElement=IM,S.isEmpty=CM,S.isEqual=PM,S.isEqualWith=NM,S.isError=bp,S.isFinite=RM,S.isFunction=Di,S.isInteger=z_,S.isLength=nl,S.isMap=H_,S.isMatch=DM,S.isMatchWith=MM,S.isNaN=FM,S.isNative=LM,S.isNil=qM,S.isNull=jM,S.isNumber=G_,S.isObject=lr,S.isObjectLike=pr,S.isPlainObject=Zo,S.isRegExp=wp,S.isSafeInteger=UM,S.isSet=Q_,S.isString=il,S.isSymbol=kn,S.isTypedArray=La,S.isUndefined=$M,S.isWeakMap=BM,S.isWeakSet=VM,S.join=HR,S.kebabCase=NF,S.last=Gn,S.lastIndexOf=GR,S.lowerCase=RF,S.lowerFirst=DF,S.lt=WM,S.lte=zM,S.max=k2,S.maxBy=I2,S.mean=C2,S.meanBy=P2,S.min=N2,S.minBy=R2,S.stubArray=kp,S.stubFalse=Ip,S.stubObject=v2,S.stubString=b2,S.stubTrue=w2,S.multiply=D2,S.nth=QR,S.noConflict=l2,S.noop=Ap,S.now=el,S.pad=MF,S.padEnd=FF,S.padStart=LF,S.parseInt=jF,S.random=AF,S.reduce=KD,S.reduceRight=ZD,S.repeat=qF,S.replace=UF,S.result=gF,S.round=M2,S.runInContext=q,S.sample=eM,S.size=nM,S.snakeCase=$F,S.some=iM,S.sortedIndex=tD,S.sortedIndexBy=rD,S.sortedIndexOf=nD,S.sortedLastIndex=iD,S.sortedLastIndexBy=sD,S.sortedLastIndexOf=aD,S.startCase=VF,S.startsWith=WF,S.subtract=F2,S.sum=L2,S.sumBy=j2,S.template=zF,S.times=_2,S.toFinite=Mi,S.toInteger=lt,S.toLength=Y_,S.toLower=HF,S.toNumber=Qn,S.toSafeInteger=HM,S.toString=$t,S.toUpper=GF,S.trim=QF,S.trimEnd=JF,S.trimStart=YF,S.truncate=KF,S.unescape=ZF,S.uniqueId=S2,S.upperCase=XF,S.upperFirst=Sp,S.each=F_,S.eachRight=L_,S.first=N_,Tp(S,function(){var s={};return fi(S,function(o,l){Bt.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){bt.prototype[s]=function(l){l=l===t?1:Cr(lt(l),0);var p=this.__filtered__&&!o?new bt(this):this.clone();return p.__filtered__?p.__takeCount__=Gr(l,p.__takeCount__):p.__views__.push({size:Gr(l,Oe),type:s+(p.__dir__<0?"Right":"")}),p},bt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Bn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==Ie||l==Be;bt.prototype[s]=function(v){var T=this.clone();return T.__iteratees__.push({iteratee:He(v,3),type:l}),T.__filtered__=T.__filtered__||p,T}}),Bn(["head","last"],function(s,o){var l="take"+(o?"Right":"");bt.prototype[s]=function(){return this[l](1).value()[0]}}),Bn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");bt.prototype[s]=function(){return this.__filtered__?new bt(this):this[l](1)}}),bt.prototype.compact=function(){return this.filter(pn)},bt.prototype.find=function(s){return this.filter(s).head()},bt.prototype.findLast=function(s){return this.reverse().find(s)},bt.prototype.invokeMap=dt(function(s,o){return typeof s=="function"?new bt(this):this.map(function(l){return Ho(l,s,o)})}),bt.prototype.reject=function(s){return this.filter(rl(He(s)))},bt.prototype.slice=function(s,o){s=lt(s);var l=this;return l.__filtered__&&(s>0||o<0)?new bt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=lt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},bt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},bt.prototype.toArray=function(){return this.take(Oe)},fi(bt.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],T=p||/^find/.test(o);v&&(S.prototype[o]=function(){var N=this.__wrapped__,L=p?[1]:arguments,$=N instanceof bt,se=L[0],oe=$||ut(N),pe=function(gt){var St=v.apply(S,as([gt],L));return p&&ke?St[0]:St};oe&&l&&typeof se=="function"&&se.length!=1&&($=oe=!1);var ke=this.__chain__,$e=!!this.__actions__.length,Qe=T&&!ke,ht=$&&!$e;if(!T&&oe){N=ht?N:new bt(this);var Je=s.apply(N,L);return Je.__actions__.push({func:Zc,args:[pe],thisArg:t}),new Wn(Je,ke)}return Qe&&ht?s.apply(this,L):(Je=this.thru(pe),Qe?p?Je.value()[0]:Je.value():Je)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Ec[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 T=this.value();return o.apply(ut(T)?T:[],v)}return this[l](function(N){return o.apply(ut(N)?N:[],v)})}}),fi(bt.prototype,function(s,o){var l=S[o];if(l){var p=l.name+"";Bt.call(Na,p)||(Na[p]=[]),Na[p].push({name:o,func:l})}}),Na[zc(t,w).name]=[{name:"wrapper",func:t}],bt.prototype.clone=ZP,bt.prototype.reverse=XP,bt.prototype.value=eN,S.prototype.at=ID,S.prototype.chain=CD,S.prototype.commit=PD,S.prototype.next=ND,S.prototype.plant=DD,S.prototype.reverse=MD,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=FD,S.prototype.first=S.prototype.head,qo&&(S.prototype[qo]=RD),S},Ia=PP();Ps?((Ps.exports=Ia)._=Ia,Od._=Ia):Br._=Ia}).call(pi)}(ec,ec.exports);var eA=ec.exports;const ci=Pp(eA),Wv=me.createContext(),zv=me.createContext(),Hv=me.createContext(),tA=({children:r})=>{const[e,t]=mn.useSearchParams(),[n,i]=me.useState(Object.fromEntries(e.entries())),[a,u]=me.useState({});me.useEffect(()=>{const h=Object.fromEntries(e.entries());i(h)},[e]),me.useEffect(()=>{Object.keys(a).length>0&&(t(h=>{const d=new URLSearchParams(h);return Object.entries(a).forEach(([y,g])=>{g==null||g===""?d.delete(y):d.set(y,g)}),d}),u({}))},[a,t]);const c=h=>{i(d=>({...d,...h})),u(d=>({...d,...h}))},f=me.useMemo(()=>[Object.fromEntries(e.entries()),c],[e]);return ar.jsx(Hv.Provider,{value:f,children:r})},fa=me.createContext(),rA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=me.useContext(Hv),c=i[r]??e;return[c&&t(c),d=>{if(typeof d=="function"){const g=i[r];d=d(t(g??e))}const y=n(d);a({[r]:y})}]},bo=async(r,e,t)=>{me.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},nA=(r,e,t)=>{const n=me.useRef(r);me.useEffect(()=>{n.current=r},[r]);const i=me.useCallback(ci.throttle(()=>{n.current()},e),[]);me.useEffect(i,[...t])},wo=(r,e=null,t)=>{const n=me.useRef(r);me.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])},Gv=(r,e,t)=>{const[n,i]=me.useState(),[a,u]=me.useState(!0),[c,f]=me.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}},iA=(r,e)=>{const[t,n]=me.useState(),[i,a]=me.useState(!0),[u,c]=me.useState(null),[f,h]=me.useState(),{urls:d,request:y}=ti();return me.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}},sA=({machineRef:r,key:e,skip:t})=>{const[n,i]=me.useState(),[a,u]=me.useState(),[c,f]=me.useState(),[h,d]=me.useState(),[y,g]=me.useState(),[m,b]=me.useState(),A=Qi`
|
|
113
113
|
subscription MMToolsQuantityStreamSubscription {
|
|
114
114
|
currentQuantities(
|
|
115
115
|
where: { machineRef: { _eq: ${y} }, key: { _eq: "${m}" } }
|
|
@@ -118,48 +118,48 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
118
118
|
eventTime
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
`,{data:x}=ZO(A,{skip:t}),[w,O]=
|
|
121
|
+
`,{data:x}=ZO(A,{skip:t}),[w,O]=me.useState();me.useEffect(()=>{r!==y&&g(r),e!==m&&b(e),d(),i(),f(),u()},[r,e,m,y]),me.useEffect(()=>{if(F||!r||!e)return;const B=h||et.utc().minus({hours:1}).format(),ee=Qi`
|
|
122
122
|
query MMToolsQuantityStreamQuery {
|
|
123
|
-
quantities(args:{machineRef:${y}, metricKey:"${m}", windowStart:"${
|
|
123
|
+
quantities(args:{machineRef:${y}, metricKey:"${m}", windowStart:"${B}"}, order_by:{eventTime:asc}) {
|
|
124
124
|
value
|
|
125
125
|
eventTime
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
`;O(te)},[y,m,h]),pe.useEffect(()=>{w&&P()},[w,x]);const[P,{data:R,loading:F}]=YO(w,{fetchPolicy:"no-cache"});return pe.useEffect(()=>{if(!R||!R.quantities)return;const $=bi.last(R.quantities);if($&&d($.eventTime),!n)i(R.quantities);else{const te=bi.drop(R.quantities);i([...n,...te])}},[R]),{data:n,error:c,loading:a}},aA=r=>{const[e,t]=pe.useState(),[n,i]=pe.useState(!0),[a,u]=pe.useState(),{urls:c,request:f}=ti();return vo(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}},oA=r=>{const[e,t]=pe.useState(),{urls:n,request:i,clientId:a}=ti(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=Qv("/templates");return pe.useEffect(()=>{if(!c)return;const m=bi.filter(c.templates,{namespace:u});t(m)},[c]),[async({name:m,public:b,config:A})=>{const x={name:m,public:b,namespace:u,config:JSON.stringify(A)},w=JSON.stringify(x),O=await i(`${n.apiUrl}/templates`,{method:"POST",body:w});return t([...e,O.template]),O.template},async(m,{name:b,public:A,config:x})=>{const w={name:b,public:A,namespace:u,config:JSON.stringify(x)},O=JSON.stringify(w),P=await i(`${n.apiUrl}/templates/${m}`,{method:"PUT",body:O}),R=bi.findIndex(e,{id:m}),F=e.slice(0,R),$=e.slice(R+1);return t([...F,P.template,...$]),P.template},async m=>{await i(`${n.apiUrl}/templates/${m}`,{method:"DELETE"}),t(bi.reject(e,{id:m}))},{templates:e,loading:f,error:h}]},uA=()=>{const[r,e]=pe.useState(),[t,n]=pe.useState(),{urls:i}=ti();return pe.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]),pe.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=()=>pe.useContext(zv),cA=()=>pe.useContext(nh),lA=()=>pe.useContext(Wv),fA=()=>{const{login:r,isAuthenticated:e}=ti();return vo(async()=>{e===!1&&await r()},[e]),e?or.jsx(pn.Outlet,{}):or.jsx("div",{})},Gv="%[a-f0-9]{2}",Jv=new RegExp("("+Gv+")|([^%]+?)","gi"),Yv=new RegExp("("+Gv+")+","gi");function ih(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([],ih(t),ih(n))}function hA(r){try{return decodeURIComponent(r)}catch{let e=r.match(Jv)||[];for(let t=1;t<e.length;t++)r=ih(e,t).join(""),e=r.match(Jv)||[];return r}}function dA(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=Yv.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=hA(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Yv.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 pA(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return dA(r)}}function mA(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 Kv(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 yA=r=>r==null,gA=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),sh=Symbol("encodeFragmentIdentifier");function vA(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 bA(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&&wi(n,r).includes(r.arrayFormatSeparator);n=u?wi(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>wi(f,r)):n===null?n:wi(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&wi(n,r);return}const u=n===null?[]:wi(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 Zv(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?gA(r):encodeURIComponent(r):r}function wi(r,e){return e.decode?pA(r):r}function Xv(r){return Array.isArray(r)?r.sort():typeof r=="object"?Xv(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function e0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function wA(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function t0(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 ah(r){r=e0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function oh(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},Zv(e.arrayFormatSeparator);const t=bA(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]=Kv(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:wi(c,e),t(wi(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]=t0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=t0(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)?Xv(u):u,i},Object.create(null))}function r0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},Zv(e.arrayFormatSeparator);const t=u=>e.skipNull&&yA(r[u])||e.skipEmptyString&&r[u]==="",n=vA(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 n0(r,e){var i;e={decode:!0,...e};let[t,n]=Kv(r,"#");return t===void 0&&(t=r),{url:((i=t==null?void 0:t.split("?"))==null?void 0:i[0])??"",query:oh(ah(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:wi(n,e)}:{}}}function i0(r,e){e={encode:!0,strict:!0,[sh]:!0,...e};const t=e0(r.url).split("?")[0]||"",n=ah(r.url),i={...oh(n,{sort:!1}),...r.query};let a=r0(i,e);a&&(a=`?${a}`);let u=wA(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[sh]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function s0(r,e,t){t={parseFragmentIdentifier:!0,[sh]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=n0(r,t);return i0({url:n,query:mA(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 s0(r,n,t)}const xA=Object.freeze(Object.defineProperty({__proto__:null,exclude:_A,extract:ah,parse:oh,parseUrl:n0,pick:s0,stringify:r0,stringifyUrl:i0},Symbol.toStringTag,{value:"Module"})),Ur=[];for(let r=0;r<256;++r)Ur.push((r+256).toString(16).slice(1));function SA(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 uh;const EA=new Uint8Array(16);function OA(){if(!uh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");uh=crypto.getRandomValues.bind(crypto)}return uh(EA)}const a0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function TA(r,e,t){if(a0.randomUUID&&!e&&!r)return a0.randomUUID();r=r||{};const n=r.random||(r.rng||OA)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,SA(n)}const ch="mm-auth-state",lh="mm-auth-destination",fh="mm-auth-access-token",_i=window.localStorage,AA=()=>_i.getItem(fh),kA=r=>{r?_i.setItem(fh,r):_i.removeItem(fh)},IA=()=>_i.getItem(lh),o0=r=>{r?_i.setItem(lh,r):_i.removeItem(lh)},PA=()=>_i.getItem(ch),u0=r=>{r?_i.setItem(ch,r):_i.removeItem(ch)},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 CA(r){return er(r)&&"code"in r&&"reason"in r}function NA(r){var e;return er(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var RA=function(r){Cn(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 Nt(function(i){return n.client.subscribe(j(j({},t),{query:Hs(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=CA(a);return u||NA(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 ks(r){return un(r)==="object"}function DA(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function l0(r,e){return r.length<124?r:e}const FA="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 f0(r){if(!ks(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&&!ks(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(!ks(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&&!ks(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&&!ks(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(!ks(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(!DA(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 MA(r,e){return f0(typeof r=="string"?JSON.parse(r,e):r)}function wo(r,e){return f0(r),JSON.stringify(r,e)}var fa=function(r){return this instanceof fa?(this.v=r,this):new fa(r)},LA=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,A){a.push([g,m,b,A])>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 fa?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 jA(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(Je){let be=1e3;for(let ce=0;ce<Je;ce++)be*=2;await new Promise(ce=>setTimeout(ce,be+Math.floor(Math.random()*2700+300)))},shouldRetry:y=hh,isFatalConnectionProblem:g,on:m,webSocketImpl:b,generateID:A=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Je=>{const be=Math.random()*16|0;return(Je=="x"?be:be&3|8).toString(16)})},jsonMessageReplacer:x,jsonMessageReviver:w}=r;let O;if(b){if(!UA(b))throw new Error("Invalid WebSocket implementation provided");O=b}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const P=O,R=(()=>{const ge=(()=>{const be={};return{on(ce,Te){return be[ce]=Te,()=>{delete be[ce]}},emit(ce){var Te;"id"in ce&&((Te=be[ce.id])===null||Te===void 0||Te.call(be,ce))}}})(),Je={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(be,ce){const Te=Je[be];return Te.push(ce),()=>{Te.splice(Te.indexOf(ce),1)}},emit(be,...ce){for(const Te of[...Je[be]])Te(...ce)}}})();function F(ge){const Je=[R.on("error",be=>{Je.forEach(ce=>ce()),ge(be)}),R.on("closed",be=>{Je.forEach(ce=>ce()),ge(be)})]}let $,te=0,J,ue=!1,fe=0,qe=!1;async function ve(){clearTimeout(J);const[ge,Je]=await($??($=new Promise((Te,Ne)=>(async()=>{if(ue){if(await d(fe),!te)return $=void 0,Ne({code:1e3,reason:"All Subscriptions Gone"});fe++}R.emit("connecting",ue);const Ee=new P(typeof e=="function"?await e():e,FA);let nt,Ot;function ht(){isFinite(u)&&u>0&&(clearTimeout(Ot),Ot=setTimeout(()=>{Ee.readyState===P.OPEN&&(Ee.send(wo({type:mr.Ping})),R.emit("ping",!1,void 0))},u))}F(Xe=>{$=void 0,clearTimeout(nt),clearTimeout(Ot),Ne(Xe),Xe instanceof h0&&(Ee.close(4499,"Terminated"),Ee.onerror=null,Ee.onclose=null)}),Ee.onerror=Xe=>R.emit("error",Xe),Ee.onclose=Xe=>R.emit("closed",Xe),Ee.onopen=async()=>{try{R.emit("opened",Ee);const Xe=typeof t=="function"?await t():t;if(Ee.readyState!==P.OPEN)return;Ee.send(wo(Xe?{type:mr.ConnectionInit,payload:Xe}:{type:mr.ConnectionInit},x)),isFinite(f)&&f>0&&(nt=setTimeout(()=>{Ee.close(vn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),ht()}catch(Xe){R.emit("error",Xe),Ee.close(vn.InternalClientError,l0(Xe instanceof Error?Xe.message:new Error(Xe).message,"Internal client error"))}};let Pt=!1;Ee.onmessage=({data:Xe})=>{try{const Ye=MA(Xe,w);if(R.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){R.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?ht():c||(Ee.send(wo(Ye.payload?{type:mr.Pong,payload:Ye.payload}:{type:mr.Pong})),R.emit("pong",!1,Ye.payload));return}if(Pt)return;if(Ye.type!==mr.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(nt),Pt=!0,R.emit("connected",Ee,Ye.payload,ue),ue=!1,fe=0,Te([Ee,new Promise((dt,Re)=>F(Re))])}catch(Ye){Ee.onmessage=null,R.emit("error",Ye),Ee.close(vn.BadResponse,l0(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));ge.readyState===P.CLOSING&&await Je;let be=()=>{};const ce=new Promise(Te=>be=Te);return[ge,be,Promise.race([ce.then(()=>{if(!te){const Te=()=>ge.close(1e3,"Normal Closure");isFinite(a)&&a>0?J=setTimeout(()=>{ge.readyState===P.OPEN&&Te()},a):Te()}}),Je])]}function De(ge){if(hh(ge)&&(qA(ge.code)||[vn.InternalServerError,vn.InternalClientError,vn.BadRequest,vn.BadResponse,vn.Unauthorized,vn.SubprotocolNotAcceptable,vn.SubscriberAlreadyExists,vn.TooManyInitialisationRequests].includes(ge.code)))throw ge;if(qe)return!1;if(hh(ge)&&ge.code===1e3)return te>0;if(!h||fe>=h||!y(ge)||g!=null&&g(ge))throw ge;return ue=!0}n||(async()=>{for(te++;;)try{const[,,ge]=await ve();await ge}catch(ge){try{if(!De(ge))return}catch(Je){return i==null?void 0:i(Je)}}})();function je(ge,Je){const be=A(ge);let ce=!1,Te=!1,Ne=()=>{te--,ce=!0};return(async()=>{for(te++;;)try{const[Ee,nt,Ot]=await ve();if(ce)return nt();const ht=R.onMessage(be,Pt=>{switch(Pt.type){case mr.Next:{Je.next(Pt.payload);return}case mr.Error:{Te=!0,ce=!0,Je.error(Pt.payload),Ne();return}case mr.Complete:{ce=!0,Ne();return}}});Ee.send(wo({id:be,type:mr.Subscribe,payload:ge},x)),Ne=()=>{!ce&&Ee.readyState===P.OPEN&&Ee.send(wo({id:be,type:mr.Complete},x)),te--,ce=!0,nt()},await Ot.finally(ht);return}catch(Ee){if(!De(Ee))return}})().then(()=>{Te||Je.complete()}).catch(Ee=>{Je.error(Ee)}),()=>{ce||Ne()}}return{on:R.on,subscribe:je,iterate(ge){const Je=[],be={done:!1,error:null,resolve:()=>{}},ce=je(ge,{next(Ne){Je.push(Ne),be.resolve()},error(Ne){be.done=!0,be.error=Ne,be.resolve()},complete(){be.done=!0,be.resolve()}}),Te=function(){return LA(this,arguments,function*(){for(;;){for(Je.length||(yield fa(new Promise(nt=>be.resolve=nt)));Je.length;)yield yield fa(Je.shift());if(be.error)throw be.error;if(be.done)return yield fa(void 0)}})}();return Te.throw=async Ne=>(be.done||(be.done=!0,be.error=Ne,be.resolve()),{done:!0,value:void 0}),Te.return=async()=>(ce(),{done:!0,value:void 0}),Te},async dispose(){if(qe=!0,$){const[ge]=await $;ge.close(1e3,"Normal Closure")}},terminate(){$&&R.emit("closed",new h0)}}}class h0 extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function hh(r){return ks(r)&&"code"in r&&"reason"in r}function qA(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function UA(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function d0(r){return new Kr(function(e,t){var n=on(e,[]);return new Nt(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 p0(r){return new Kr(function(e,t){return new Nt(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){Cn(e,r);function e(t){var n=r.call(this)||this;return n.link=p0(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Kr);var dh={exports:{}};const $A=il(FO),BA=il(AE);var ph,m0;function VA(){return m0||(m0=1,ph=Error),ph}var mh,y0;function WA(){return y0||(y0=1,mh=EvalError),mh}var yh,g0;function zA(){return g0||(g0=1,yh=RangeError),yh}var gh,v0;function HA(){return v0||(v0=1,gh=ReferenceError),gh}var vh,b0;function w0(){return b0||(b0=1,vh=SyntaxError),vh}var bh,_0;function _o(){return _0||(_0=1,bh=TypeError),bh}var wh,x0;function QA(){return x0||(x0=1,wh=URIError),wh}var _h,S0;function GA(){return S0||(S0=1,_h=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(t 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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),_h}var xh,E0;function JA(){if(E0)return xh;E0=1;var r=typeof Symbol<"u"&&Symbol,e=GA();return xh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},xh}var Sh,O0;function YA(){if(O0)return Sh;O0=1;var r={__proto__:null,foo:{}},e=Object;return Sh=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},Sh}var Eh,T0;function KA(){if(T0)return Eh;T0=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 Eh=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 w=h.apply(this,i(d,arguments));return Object(w)===w?w:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),b=[],A=0;A<m;A++)b[A]="$"+A;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},Eh}var Oh,A0;function Th(){if(A0)return Oh;A0=1;var r=KA();return Oh=Function.prototype.bind||r,Oh}var Ah,k0;function ZA(){if(k0)return Ah;k0=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=Th();return Ah=t.call(r,e),Ah}var kh,I0;function ha(){if(I0)return kh;I0=1;var r,e=VA(),t=WA(),n=zA(),i=HA(),a=w0(),u=_o(),c=QA(),f=Function,h=function(be){try{return f('"use strict"; return ('+be+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var y=function(){throw new u},g=d?function(){try{return arguments.callee,y}catch{try{return d(arguments,"callee").get}catch{return y}}}():y,m=JA()(),b=YA()(),A=Object.getPrototypeOf||(b?function(be){return be.__proto__}:null),x={},w=typeof Uint8Array>"u"||!A?r:A(Uint8Array),O={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":m&&A?A([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":x,"%AsyncGenerator%":x,"%AsyncGeneratorFunction%":x,"%AsyncIteratorPrototype%":x,"%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%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":f,"%GeneratorFunction%":x,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&A?A(A([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!A?r:A(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!A?r:A(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&A?A(""[Symbol.iterator]()):r,"%Symbol%":m?Symbol:r,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":u,"%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%":c,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(A)try{null.error}catch(be){var P=A(A(be));O["%Error.prototype%"]=P}var R=function be(ce){var Te;if(ce==="%AsyncFunction%")Te=h("async function () {}");else if(ce==="%GeneratorFunction%")Te=h("function* () {}");else if(ce==="%AsyncGeneratorFunction%")Te=h("async function* () {}");else if(ce==="%AsyncGenerator%"){var Ne=be("%AsyncGeneratorFunction%");Ne&&(Te=Ne.prototype)}else if(ce==="%AsyncIteratorPrototype%"){var Ee=be("%AsyncGenerator%");Ee&&A&&(Te=A(Ee.prototype))}return O[ce]=Te,Te},F={__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"]},$=Th(),te=ZA(),J=$.call(Function.call,Array.prototype.concat),ue=$.call(Function.apply,Array.prototype.splice),fe=$.call(Function.call,String.prototype.replace),qe=$.call(Function.call,String.prototype.slice),ve=$.call(Function.call,RegExp.prototype.exec),De=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,je=/\\(\\)?/g,ge=function(ce){var Te=qe(ce,0,1),Ne=qe(ce,-1);if(Te==="%"&&Ne!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(Ne==="%"&&Te!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Ee=[];return fe(ce,De,function(nt,Ot,ht,Pt){Ee[Ee.length]=ht?fe(Pt,je,"$1"):Ot||nt}),Ee},Je=function(ce,Te){var Ne=ce,Ee;if(te(F,Ne)&&(Ee=F[Ne],Ne="%"+Ee[0]+"%"),te(O,Ne)){var nt=O[Ne];if(nt===x&&(nt=R(Ne)),typeof nt>"u"&&!Te)throw new u("intrinsic "+ce+" exists, but is not available. Please file an issue!");return{alias:Ee,name:Ne,value:nt}}throw new a("intrinsic "+ce+" does not exist!")};return kh=function(ce,Te){if(typeof ce!="string"||ce.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Te!="boolean")throw new u('"allowMissing" argument must be a boolean');if(ve(/^%?[^%]*%?$/,ce)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Ne=ge(ce),Ee=Ne.length>0?Ne[0]:"",nt=Je("%"+Ee+"%",Te),Ot=nt.name,ht=nt.value,Pt=!1,Xe=nt.alias;Xe&&(Ee=Xe[0],ue(Ne,J([0,1],Xe)));for(var Ye=1,dt=!0;Ye<Ne.length;Ye+=1){var Re=Ne[Ye],_t=qe(Re,0,1),H=qe(Re,-1);if((_t==='"'||_t==="'"||_t==="`"||H==='"'||H==="'"||H==="`")&&_t!==H)throw new a("property names with quotes must have matching quotes");if((Re==="constructor"||!dt)&&(Pt=!0),Ee+="."+Re,Ot="%"+Ee+"%",te(O,Ot))ht=O[Ot];else if(ht!=null){if(!(Re in ht)){if(!Te)throw new u("base intrinsic for "+ce+" exists, but the property is not available.");return}if(d&&Ye+1>=Ne.length){var Y=d(ht,Re);dt=!!Y,dt&&"get"in Y&&!("originalValue"in Y.get)?ht=Y.get:ht=ht[Re]}else dt=te(ht,Re),ht=ht[Re];dt&&!Pt&&(O[Ot]=ht)}}return ht},kh}var Ih={exports:{}},Ph,P0;function Ch(){if(P0)return Ph;P0=1;var r=ha(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Ph=e,Ph}var Nh,C0;function N0(){if(C0)return Nh;C0=1;var r=ha(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Nh=e,Nh}var Rh,R0;function XA(){if(R0)return Rh;R0=1;var r=Ch(),e=w0(),t=_o(),n=N0();return Rh=function(a,u,c){if(!a||typeof a!="object"&&typeof a!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var f=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!n&&n(a,u);if(r)r(a,u,{configurable:d===null&&g?g.configurable:!d,enumerable:f===null&&g?g.enumerable:!f,value:c,writable:h===null&&g?g.writable:!h});else if(y||!f&&!h&&!d)a[u]=c;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Rh}var Dh,D0;function ek(){if(D0)return Dh;D0=1;var r=Ch(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Dh=e,Dh}var Fh,F0;function tk(){if(F0)return Fh;F0=1;var r=ha(),e=XA(),t=ek()(),n=N0(),i=_o(),a=r("%Math.floor%");return Fh=function(c,f){if(typeof c!="function")throw new i("`fn` is not a function");if(typeof f!="number"||f<0||f>4294967295||a(f)!==f)throw new i("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],d=!0,y=!0;if("length"in c&&n){var g=n(c,"length");g&&!g.configurable&&(d=!1),g&&!g.writable&&(y=!1)}return(d||y||!h)&&(t?e(c,"length",f,!0,!0):e(c,"length",f)),c},Fh}var M0;function rk(){return M0||(M0=1,function(r){var e=Th(),t=ha(),n=tk(),i=_o(),a=t("%Function.prototype.apply%"),u=t("%Function.prototype.call%"),c=t("%Reflect.apply%",!0)||e.call(u,a),f=Ch(),h=t("%Math.max%");r.exports=function(g){if(typeof g!="function")throw new i("a function is required");var m=c(e,u,arguments);return n(m,1+h(0,g.length-(arguments.length-1)),!0)};var d=function(){return c(e,a,arguments)};f?f(r.exports,"apply",{value:d}):r.exports.apply=d}(Ih)),Ih.exports}var Mh,L0;function nk(){if(L0)return Mh;L0=1;var r=ha(),e=rk(),t=e(r("String.prototype.indexOf"));return Mh=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e(u):u},Mh}const ik=il(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Lh,j0;function sk(){if(j0)return Lh;j0=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,A=Object.prototype.toString,x=Function.prototype.toString,w=String.prototype.match,O=String.prototype.slice,P=String.prototype.replace,R=String.prototype.toUpperCase,F=String.prototype.toLowerCase,$=RegExp.prototype.test,te=Array.prototype.concat,J=Array.prototype.join,ue=Array.prototype.slice,fe=Math.floor,qe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ve=Object.getOwnPropertySymbols,De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,je=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ge=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===je||!0)?Symbol.toStringTag:null,Je=Object.prototype.propertyIsEnumerable,be=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(W){return W.__proto__}:null);function ce(W,z){if(W===1/0||W===-1/0||W!==W||W&&W>-1e3&&W<1e3||$.call(/e/,z))return z;var it=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof W=="number"){var yt=W<0?-fe(-W):fe(W);if(yt!==W){var ct=String(yt),Ve=O.call(z,ct.length+1);return P.call(ct,it,"$&_")+"."+P.call(P.call(Ve,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(z,it,"$&_")}var Te=ik,Ne=Te.custom,Ee=B(Ne)?Ne:null,nt={__proto__:null,double:'"',single:"'"},Ot={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Lh=function W(z,it,yt,ct){var Ve=it||{};if(Q(Ve,"quoteStyle")&&!Q(nt,Ve.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Q(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 Kt=Q(Ve,"customInspect")?Ve.customInspect:!0;if(typeof Kt!="boolean"&&Kt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Q(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(Q(Ve,"numericSeparator")&&typeof Ve.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Zt=Ve.numericSeparator;if(typeof z>"u")return"undefined";if(z===null)return"null";if(typeof z=="boolean")return z?"true":"false";if(typeof z=="string")return xt(z,Ve);if(typeof z=="number"){if(z===0)return 1/0/z>0?"0":"-0";var Gt=String(z);return Zt?ce(z,Gt):Gt}if(typeof z=="bigint"){var kr=String(z)+"n";return Zt?ce(z,kr):kr}var Hr=typeof Ve.depth>"u"?5:Ve.depth;if(typeof yt>"u"&&(yt=0),yt>=Hr&&Hr>0&&typeof z=="object")return Xe(z)?"[Array]":"[Object]";var Mr=dr(Ve,yt);if(typeof ct>"u")ct=[];else if(Be(ct,z)>=0)return"[Circular]";function Ut(He,Ke,Ze){if(Ke&&(ct=ue.call(ct),ct.push(Ke)),Ze){var mt={depth:Ve.depth};return Q(Ve,"quoteStyle")&&(mt.quoteStyle=Ve.quoteStyle),W(He,mt,yt+1,ct)}return W(He,Ve,yt+1,ct)}if(typeof z=="function"&&!dt(z)){var Or=ze(z),$r=Ht(z,Ut);return"[Function"+(Or?": "+Or:" (anonymous)")+"]"+($r.length>0?" { "+J.call($r,", ")+" }":"")}if(B(z)){var Lr=je?P.call(String(z),/^(Symbol\(.*\))_[^)]*$/,"$1"):De.call(z);return typeof z=="object"&&!je?Qt(Lr):Lr}if(Yt(z)){for(var sr="<"+F.call(String(z.nodeName)),Qr=z.attributes||[],Tr=0;Tr<Qr.length;Tr++)sr+=" "+Qr[Tr].name+"="+ht(Pt(Qr[Tr].value),"double",Ve);return sr+=">",z.childNodes&&z.childNodes.length&&(sr+="..."),sr+="</"+F.call(String(z.nodeName))+">",sr}if(Xe(z)){if(z.length===0)return"[]";var gr=Ht(z,Ut);return Mr&&!ir(gr)?"["+Ar(gr,Mr)+"]":"[ "+J.call(gr,", ")+" ]"}if(Re(z)){var Ir=Ht(z,Ut);return!("cause"in Error.prototype)&&"cause"in z&&!Je.call(z,"cause")?"{ ["+String(z)+"] "+J.call(te.call("[cause]: "+Ut(z.cause),Ir),", ")+" }":Ir.length===0?"["+String(z)+"]":"{ ["+String(z)+"] "+J.call(Ir,", ")+" }"}if(typeof z=="object"&&Kt){if(Ee&&typeof z[Ee]=="function"&&Te)return Te(z,{depth:Hr-yt});if(Kt!=="symbol"&&typeof z.inspect=="function")return z.inspect()}if(le(z)){var Sn=[];return n&&n.call(z,function(He,Ke){Sn.push(Ut(Ke,z,!0)+" => "+Ut(He,z))}),zt("Map",t.call(z),Sn,Mr)}if(Tt(z)){var Un=[];return c&&c.call(z,function(He){Un.push(Ut(He,z))}),zt("Set",u.call(z),Un,Mr)}if(_e(z))return Er("WeakMap");if(At(z))return Er("WeakSet");if(et(z))return Er("WeakRef");if(H(z))return Qt(Ut(Number(z)));if(Z(z))return Qt(Ut(qe.call(z)));if(Y(z))return Qt(b.call(z));if(_t(z))return Qt(Ut(String(z)));if(typeof window<"u"&&z===window)return"{ [object Window] }";if(typeof globalThis<"u"&&z===globalThis||typeof di<"u"&&z===di)return"{ [object globalThis] }";if(!Ye(z)&&!dt(z)){var D=Ht(z,Ut),se=be?be(z)===Object.prototype:z instanceof Object||z.constructor===Object,me=z instanceof Object?"":"null prototype",ke=!se&&ge&&Object(z)===z&&ge in z?O.call(we(z),8,-1):me?"Object":"",$e=se||typeof z.constructor!="function"?"":z.constructor.name?z.constructor.name+" ":"",ot=$e+(ke||me?"["+J.call(te.call([],ke||[],me||[]),": ")+"] ":"");return D.length===0?ot+"{}":Mr?ot+"{"+Ar(D,Mr)+"}":ot+"{ "+J.call(D,", ")+" }"}return String(z)};function ht(W,z,it){var yt=it.quoteStyle||z,ct=nt[yt];return ct+W+ct}function Pt(W){return P.call(String(W),/"/g,""")}function Xe(W){return we(W)==="[object Array]"&&(!ge||!(typeof W=="object"&&ge in W))}function Ye(W){return we(W)==="[object Date]"&&(!ge||!(typeof W=="object"&&ge in W))}function dt(W){return we(W)==="[object RegExp]"&&(!ge||!(typeof W=="object"&&ge in W))}function Re(W){return we(W)==="[object Error]"&&(!ge||!(typeof W=="object"&&ge in W))}function _t(W){return we(W)==="[object String]"&&(!ge||!(typeof W=="object"&&ge in W))}function H(W){return we(W)==="[object Number]"&&(!ge||!(typeof W=="object"&&ge in W))}function Y(W){return we(W)==="[object Boolean]"&&(!ge||!(typeof W=="object"&&ge in W))}function B(W){if(je)return W&&typeof W=="object"&&W instanceof Symbol;if(typeof W=="symbol")return!0;if(!W||typeof W!="object"||!De)return!1;try{return De.call(W),!0}catch{}return!1}function Z(W){if(!W||typeof W!="object"||!qe)return!1;try{return qe.call(W),!0}catch{}return!1}var X=Object.prototype.hasOwnProperty||function(W){return W in this};function Q(W,z){return X.call(W,z)}function we(W){return A.call(W)}function ze(W){if(W.name)return W.name;var z=w.call(x.call(W),/^function\s*([\w$]+)/);return z?z[1]:null}function Be(W,z){if(W.indexOf)return W.indexOf(z);for(var it=0,yt=W.length;it<yt;it++)if(W[it]===z)return it;return-1}function le(W){if(!t||!W||typeof W!="object")return!1;try{t.call(W);try{u.call(W)}catch{return!0}return W instanceof Map}catch{}return!1}function _e(W){if(!h||!W||typeof W!="object")return!1;try{h.call(W,h);try{y.call(W,y)}catch{return!0}return W instanceof WeakMap}catch{}return!1}function et(W){if(!m||!W||typeof W!="object")return!1;try{return m.call(W),!0}catch{}return!1}function Tt(W){if(!u||!W||typeof W!="object")return!1;try{u.call(W);try{t.call(W)}catch{return!0}return W instanceof Set}catch{}return!1}function At(W){if(!y||!W||typeof W!="object")return!1;try{y.call(W,y);try{h.call(W,h)}catch{return!0}return W instanceof WeakSet}catch{}return!1}function Yt(W){return!W||typeof W!="object"?!1:typeof HTMLElement<"u"&&W instanceof HTMLElement?!0:typeof W.nodeName=="string"&&typeof W.getAttribute=="function"}function xt(W,z){if(W.length>z.maxStringLength){var it=W.length-z.maxStringLength,yt="... "+it+" more character"+(it>1?"s":"");return xt(O.call(W,0,z.maxStringLength),z)+yt}var ct=Ot[z.quoteStyle||"single"];ct.lastIndex=0;var Ve=P.call(P.call(W,ct,"\\$1"),/[\x00-\x1f]/g,Wt);return ht(Ve,"single",z)}function Wt(W){var z=W.charCodeAt(0),it={8:"b",9:"t",10:"n",12:"f",13:"r"}[z];return it?"\\"+it:"\\x"+(z<16?"0":"")+R.call(z.toString(16))}function Qt(W){return"Object("+W+")"}function Er(W){return W+" { ? }"}function zt(W,z,it,yt){var ct=yt?Ar(it,yt):J.call(it,", ");return W+" ("+z+") {"+ct+"}"}function ir(W){for(var z=0;z<W.length;z++)if(Be(W[z],`
|
|
129
|
-
`)>=0)return!1;return!0}function
|
|
130
|
-
`+
|
|
131
|
-
`+z.prev}function Ht(W,z){var it=Xe(W),yt=[];if(it){yt.length=W.length;for(var ct=0;ct<W.length;ct++)yt[ct]=Q(W,ct)?z(W[ct],W):""}var Ve=typeof ve=="function"?ve(W):[],Kt;if(je){Kt={};for(var Zt=0;Zt<Ve.length;Zt++)Kt["$"+Ve[Zt]]=Ve[Zt]}for(var Gt in W)Q(W,Gt)&&(it&&String(Number(Gt))===Gt&&Gt<W.length||je&&Kt["$"+Gt]instanceof Symbol||($.call(/[^\w$]/,Gt)?yt.push(z(Gt,W)+": "+z(W[Gt],W)):yt.push(Gt+": "+z(W[Gt],W))));if(typeof ve=="function")for(var kr=0;kr<Ve.length;kr++)Je.call(W,Ve[kr])&&yt.push("["+z(Ve[kr])+"]: "+z(W[Ve[kr]],W));return yt}return Lh}var jh,q0;function ak(){if(q0)return jh;q0=1;var r=ha(),e=nk(),t=sk(),n=_o(),i=r("%WeakMap%",!0),a=r("%Map%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("Map.prototype.get",!0),d=e("Map.prototype.set",!0),y=e("Map.prototype.has",!0),g=function(x,w){for(var O=x,P;(P=O.next)!==null;O=P)if(P.key===w)return O.next=P.next,P.next=x.next,x.next=P,P},m=function(x,w){var O=g(x,w);return O&&O.value},b=function(x,w,O){var P=g(x,w);P?P.value=O:x.next={key:w,next:x.next,value:O}},A=function(x,w){return!!g(x,w)};return jh=function(){var w,O,P,R={assert:function(F){if(!R.has(F))throw new n("Side channel does not contain "+t(F))},get:function(F){if(i&&F&&(typeof F=="object"||typeof F=="function")){if(w)return u(w,F)}else if(a){if(O)return h(O,F)}else if(P)return m(P,F)},has:function(F){if(i&&F&&(typeof F=="object"||typeof F=="function")){if(w)return f(w,F)}else if(a){if(O)return y(O,F)}else if(P)return A(P,F);return!1},set:function(F,$){i&&F&&(typeof F=="object"||typeof F=="function")?(w||(w=new i),c(w,F,$)):a?(O||(O=new a),d(O,F,$)):(P||(P={key:{},next:null}),b(P,F,$))}};return R},jh}var qh,U0;function Uh(){if(U0)return qh;U0=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return qh={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},qh}var $h,$0;function B0(){if($0)return $h;$0=1;var r=Uh(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var x=[],w=0;w<256;++w)x.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return x}(),i=function(w){for(;w.length>1;){var O=w.pop(),P=O.obj[O.prop];if(t(P)){for(var R=[],F=0;F<P.length;++F)typeof P[F]<"u"&&R.push(P[F]);O.obj[O.prop]=R}}},a=function(w,O){for(var P=O&&O.plainObjects?Object.create(null):{},R=0;R<w.length;++R)typeof w[R]<"u"&&(P[R]=w[R]);return P},u=function x(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 R=w;return t(w)&&!t(O)&&(R=a(w,P)),t(w)&&t(O)?(O.forEach(function(F,$){if(e.call(w,$)){var te=w[$];te&&typeof te=="object"&&F&&typeof F=="object"?w[$]=x(te,F,P):w.push(F)}else w[$]=F}),w):Object.keys(O).reduce(function(F,$){var te=O[$];return e.call(F,$)?F[$]=x(F[$],te,P):F[$]=te,F},R)},c=function(w,O){return Object.keys(O).reduce(function(P,R){return P[R]=O[R],P},w)},f=function(x,w,O){var P=x.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,d=function(w,O,P,R,F){if(w.length===0)return w;var $=w;if(typeof w=="symbol"?$=Symbol.prototype.toString.call(w):typeof w!="string"&&($=String(w)),P==="iso-8859-1")return escape($).replace(/%u[0-9a-f]{4}/gi,function(De){return"%26%23"+parseInt(De.slice(2),16)+"%3B"});for(var te="",J=0;J<$.length;J+=h){for(var ue=$.length>=h?$.slice(J,J+h):$,fe=[],qe=0;qe<ue.length;++qe){var ve=ue.charCodeAt(qe);if(ve===45||ve===46||ve===95||ve===126||ve>=48&&ve<=57||ve>=65&&ve<=90||ve>=97&&ve<=122||F===r.RFC1738&&(ve===40||ve===41)){fe[fe.length]=ue.charAt(qe);continue}if(ve<128){fe[fe.length]=n[ve];continue}if(ve<2048){fe[fe.length]=n[192|ve>>6]+n[128|ve&63];continue}if(ve<55296||ve>=57344){fe[fe.length]=n[224|ve>>12]+n[128|ve>>6&63]+n[128|ve&63];continue}qe+=1,ve=65536+((ve&1023)<<10|ue.charCodeAt(qe)&1023),fe[fe.length]=n[240|ve>>18]+n[128|ve>>12&63]+n[128|ve>>6&63]+n[128|ve&63]}te+=fe.join("")}return te},y=function(w){for(var O=[{obj:{o:w},prop:"o"}],P=[],R=0;R<O.length;++R)for(var F=O[R],$=F.obj[F.prop],te=Object.keys($),J=0;J<te.length;++J){var ue=te[J],fe=$[ue];typeof fe=="object"&&fe!==null&&P.indexOf(fe)===-1&&(O.push({obj:$,prop:ue}),P.push(fe))}return i(O),w},g=function(w){return Object.prototype.toString.call(w)==="[object RegExp]"},m=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)},A=function(w,O){if(t(w)){for(var P=[],R=0;R<w.length;R+=1)P.push(O(w[R]));return P}return O(w)};return $h={arrayToObject:a,assign:c,combine:b,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:A,merge:u},$h}var Bh,V0;function ok(){if(V0)return Bh;V0=1;var r=ak(),e=B0(),t=Uh(),n=Object.prototype.hasOwnProperty,i={brackets:function(x){return x+"[]"},comma:"comma",indices:function(x,w){return x+"["+w+"]"},repeat:function(x){return x}},a=Array.isArray,u=Array.prototype.push,c=function(A,x){u.apply(A,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 A(x,w,O,P,R,F,$,te,J,ue,fe,qe,ve,De,je,ge,Je,be){for(var ce=x,Te=be,Ne=0,Ee=!1;(Te=Te.get(g))!==void 0&&!Ee;){var nt=Te.get(x);if(Ne+=1,typeof nt<"u"){if(nt===Ne)throw new RangeError("Cyclic object value");Ee=!0}typeof Te.get(g)>"u"&&(Ne=0)}if(typeof ue=="function"?ce=ue(w,ce):ce instanceof Date?ce=ve(ce):O==="comma"&&a(ce)&&(ce=e.maybeMap(ce,function(X){return X instanceof Date?ve(X):X})),ce===null){if(F)return J&&!ge?J(w,d.encoder,Je,"key",De):w;ce=""}if(y(ce)||e.isBuffer(ce)){if(J){var Ot=ge?w:J(w,d.encoder,Je,"key",De);return[je(Ot)+"="+je(J(ce,d.encoder,Je,"value",De))]}return[je(w)+"="+je(String(ce))]}var ht=[];if(typeof ce>"u")return ht;var Pt;if(O==="comma"&&a(ce))ge&&J&&(ce=e.maybeMap(ce,J)),Pt=[{value:ce.length>0?ce.join(",")||null:void 0}];else if(a(ue))Pt=ue;else{var Xe=Object.keys(ce);Pt=fe?Xe.sort(fe):Xe}var Ye=te?w.replace(/\./g,"%2E"):w,dt=P&&a(ce)&&ce.length===1?Ye+"[]":Ye;if(R&&a(ce)&&ce.length===0)return dt+"[]";for(var Re=0;Re<Pt.length;++Re){var _t=Pt[Re],H=typeof _t=="object"&&typeof _t.value<"u"?_t.value:ce[_t];if(!($&&H===null)){var Y=qe&&te?_t.replace(/\./g,"%2E"):_t,B=a(ce)?typeof O=="function"?O(dt,Y):dt:dt+(qe?"."+Y:"["+Y+"]");be.set(x,Ne);var Z=r();Z.set(g,be),c(ht,A(H,B,O,P,R,F,$,te,O==="comma"&&ge&&a(ce)?null:J,ue,fe,qe,ve,De,je,ge,Je,Z))}}return ht},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 w=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 O=t.default;if(typeof x.format<"u"){if(!n.call(t.formatters,x.format))throw new TypeError("Unknown format option provided.");O=x.format}var P=t.formatters[O],R=d.filter;(typeof x.filter=="function"||a(x.filter))&&(R=x.filter);var F;if(x.arrayFormat in i?F=x.arrayFormat:"indices"in x?F=x.indices?"indices":"repeat":F=d.arrayFormat,"commaRoundTrip"in x&&typeof x.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var $=typeof x.allowDots>"u"?x.encodeDotInKeys===!0?!0:d.allowDots:!!x.allowDots;return{addQueryPrefix:typeof x.addQueryPrefix=="boolean"?x.addQueryPrefix:d.addQueryPrefix,allowDots:$,allowEmptyArrays:typeof x.allowEmptyArrays=="boolean"?!!x.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:F,charset:w,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:R,format:O,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 Bh=function(A,x){var w=A,O=b(x),P,R;typeof O.filter=="function"?(R=O.filter,w=R("",w)):a(O.filter)&&(R=O.filter,P=R);var F=[];if(typeof w!="object"||w===null)return"";var $=i[O.arrayFormat],te=$==="comma"&&O.commaRoundTrip;P||(P=Object.keys(w)),O.sort&&P.sort(O.sort);for(var J=r(),ue=0;ue<P.length;++ue){var fe=P[ue];O.skipNulls&&w[fe]===null||c(F,m(w[fe],fe,$,te,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,J))}var qe=F.join(O.delimiter),ve=O.addQueryPrefix===!0?"?":"";return O.charsetSentinel&&(O.charset==="iso-8859-1"?ve+="utf8=%26%2310003%3B&":ve+="utf8=%E2%9C%93&"),qe.length>0?ve+qe:""},Bh}var Vh,W0;function uk(){if(W0)return Vh;W0=1;var r=B0(),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 A={__proto__:null},x=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;x=x.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var w=b.parameterLimit===1/0?void 0:b.parameterLimit,O=x.split(b.delimiter,w),P=-1,R,F=b.charset;if(b.charsetSentinel)for(R=0;R<O.length;++R)O[R].indexOf("utf8=")===0&&(O[R]===c?F="utf-8":O[R]===u&&(F="iso-8859-1"),P=R,R=O.length);for(R=0;R<O.length;++R)if(R!==P){var $=O[R],te=$.indexOf("]="),J=te===-1?$.indexOf("="):te+1,ue,fe;J===-1?(ue=b.decoder($,n.decoder,F,"key"),fe=b.strictNullHandling?null:""):(ue=b.decoder($.slice(0,J),n.decoder,F,"key"),fe=r.maybeMap(a($.slice(J+1),b),function(ve){return b.decoder(ve,n.decoder,F,"value")})),fe&&b.interpretNumericEntities&&F==="iso-8859-1"&&(fe=i(fe)),$.indexOf("[]=")>-1&&(fe=t(fe)?[fe]:fe);var qe=e.call(A,ue);qe&&b.duplicates==="combine"?A[ue]=r.combine(A[ue],fe):(!qe||b.duplicates==="last")&&(A[ue]=fe)}return A},h=function(g,m,b,A){for(var x=A?m:a(m,b),w=g.length-1;w>=0;--w){var O,P=g[w];if(P==="[]"&&b.parseArrays)O=b.allowEmptyArrays&&(x===""||b.strictNullHandling&&x===null)?[]:[].concat(x);else{O=b.plainObjects?Object.create(null):{};var R=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,F=b.decodeDotInKeys?R.replace(/%2E/g,"."):R,$=parseInt(F,10);!b.parseArrays&&F===""?O={0:x}:!isNaN($)&&P!==F&&String($)===F&&$>=0&&b.parseArrays&&$<=b.arrayLimit?(O=[],O[$]=x):F!=="__proto__"&&(O[F]=x)}x=O}return x},d=function(m,b,A,x){if(m){var w=A.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,O=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,R=A.depth>0&&O.exec(w),F=R?w.slice(0,R.index):w,$=[];if(F){if(!A.plainObjects&&e.call(Object.prototype,F)&&!A.allowPrototypes)return;$.push(F)}for(var te=0;A.depth>0&&(R=P.exec(w))!==null&&te<A.depth;){if(te+=1,!A.plainObjects&&e.call(Object.prototype,R[1].slice(1,-1))&&!A.allowPrototypes)return;$.push(R[1])}if(R){if(A.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+A.depth+" and strictDepth is true");$.push("["+w.slice(R.index)+"]")}return h($,b,A,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,A=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(A!=="combine"&&A!=="first"&&A!=="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:A,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 Vh=function(g,m){var b=y(m);if(g===""||g===null||typeof g>"u")return b.plainObjects?Object.create(null):{};for(var A=typeof g=="string"?f(g,b):g,x=b.plainObjects?Object.create(null):{},w=Object.keys(A),O=0;O<w.length;++O){var P=w[O],R=d(P,A[P],b,typeof g=="string");x=r.merge(x,R,b)}return b.allowSparse===!0?x:r.compact(x)},Vh}var Wh,z0;function ck(){if(z0)return Wh;z0=1;var r=ok(),e=uk(),t=Uh();return Wh={formats:t,parse:e,stringify:r},Wh}(function(r,e){(function(t,n){n(e,$A,BA,ck())})(di,function(t,n,i,a){var u=function(H,Y,B,Z){function X(Q){return Q instanceof B?Q:new B(function(we){we(Q)})}return new(B||(B=Promise))(function(Q,we){function ze(_e){try{le(Z.next(_e))}catch(et){we(et)}}function Be(_e){try{le(Z.throw(_e))}catch(et){we(et)}}function le(_e){_e.done?Q(_e.value):X(_e.value).then(ze,Be)}le((Z=Z.apply(H,Y||[])).next())})},c=function(H,Y){var B={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Z,X,Q,we;return we={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(we[Symbol.iterator]=function(){return this}),we;function ze(le){return function(_e){return Be([le,_e])}}function Be(le){if(Z)throw new TypeError("Generator is already executing.");for(;B;)try{if(Z=1,X&&(Q=le[0]&2?X.return:le[0]?X.throw||((Q=X.return)&&Q.call(X),0):X.next)&&!(Q=Q.call(X,le[1])).done)return Q;switch(X=0,Q&&(le=[le[0]&2,Q.value]),le[0]){case 0:case 1:Q=le;break;case 4:return B.label++,{value:le[1],done:!1};case 5:B.label++,X=le[1],le=[0];continue;case 7:le=B.ops.pop(),B.trys.pop();continue;default:if(Q=B.trys,!(Q=Q.length>0&&Q[Q.length-1])&&(le[0]===6||le[0]===2)){B=0;continue}if(le[0]===3&&(!Q||le[1]>Q[0]&&le[1]<Q[3])){B.label=le[1];break}if(le[0]===6&&B.label<Q[1]){B.label=Q[1],Q=le;break}if(Q&&B.label<Q[2]){B.label=Q[2],B.ops.push(le);break}Q[2]&&B.ops.pop(),B.trys.pop();continue}le=Y.call(H,B)}catch(_e){le=[6,_e],X=0}finally{Z=Q=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}};function f(H,Y){if(H.directives&&H.directives.length){var B={};return H.directives.forEach(function(Z){B[Z.name.value]=i.argumentsObjectFromField(Z,Y)}),B}return null}var h=Object.prototype.hasOwnProperty;function d(H,Y){Y!==null&&typeof Y=="object"&&Object.keys(Y).forEach(function(B){var Z=Y[B];h.call(H,B)?d(H[B],Z):H[B]=Z})}function y(H,Y,B,Z,X,Q){Q===void 0&&(Q={});var we=i.getMainDefinition(Y),ze=i.getFragmentDefinitions(Y),Be=i.createFragmentMap(ze),le=Q.resultMapper,_e=Q.fragmentMatcher||function(){return!0},et={fragmentMap:Be,contextValue:Z,variableValues:X,resultMapper:le,resolver:H,fragmentMatcher:_e};return g(we.selectionSet,B,et)}function g(H,Y,B){return u(this,void 0,void 0,function(){var Z,X,Q,we,ze,Be=this;return c(this,function(le){switch(le.label){case 0:return Z=B.fragmentMap,X=B.contextValue,Q=B.variableValues,we={},ze=function(_e){return u(Be,void 0,void 0,function(){var et,Tt,At,Yt,xt;return c(this,function(Wt){switch(Wt.label){case 0:return i.shouldInclude(_e,Q)?i.isField(_e)?[4,m(_e,Y,B)]:[3,2]:[2];case 1:return et=Wt.sent(),Tt=i.resultKeyNameFromField(_e),et!==void 0&&(we[Tt]===void 0?we[Tt]=et:d(we[Tt],et)),[2];case 2:if(i.isInlineFragment(_e))At=_e;else if(At=Z[_e.name.value],!At)throw new Error("No fragment named "+_e.name.value);return Yt=At.typeCondition.name.value,B.fragmentMatcher(Y,Yt,X)?[4,g(At.selectionSet,Y,B)]:[3,4];case 3:xt=Wt.sent(),d(we,xt),Wt.label=4;case 4:return[2]}})})},[4,Promise.all(H.selections.map(ze))];case 1:return le.sent(),B.resultMapper?[2,B.resultMapper(we,Y)]:[2,we]}})})}function m(H,Y,B){return u(this,void 0,void 0,function(){var Z,X,Q,we,ze,Be,le;return c(this,function(_e){switch(_e.label){case 0:return Z=B.variableValues,X=B.contextValue,Q=B.resolver,we=H.name.value,ze=i.argumentsObjectFromField(H,Z),Be={isLeaf:!H.selectionSet,resultKey:i.resultKeyNameFromField(H),directives:f(H,Z),field:H},[4,Q(we,Y,ze,X,Be)];case 1:return le=_e.sent(),H.selectionSet?le==null?[2,le]:Array.isArray(le)?[2,b(H,le,B)]:[2,g(H.selectionSet,le,B)]:[2,le]}})})}function b(H,Y,B){return Promise.all(Y.map(function(Z){return Z===null?null:Array.isArray(Z)?b(H,Z,B):g(H.selectionSet,Z,B)}))}var A=function(){var H=function(Y,B){return H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Z,X){Z.__proto__=X}||function(Z,X){for(var Q in X)X.hasOwnProperty(Q)&&(Z[Q]=X[Q])},H(Y,B)};return function(Y,B){H(Y,B);function Z(){this.constructor=Y}Y.prototype=B===null?Object.create(B):(Z.prototype=B.prototype,new Z)}}(),x=function(){return x=Object.assign||function(H){for(var Y,B=1,Z=arguments.length;B<Z;B++){Y=arguments[B];for(var X in Y)Object.prototype.hasOwnProperty.call(Y,X)&&(H[X]=Y[X])}return H},x.apply(this,arguments)},w=function(H,Y,B,Z){function X(Q){return Q instanceof B?Q:new B(function(we){we(Q)})}return new(B||(B=Promise))(function(Q,we){function ze(_e){try{le(Z.next(_e))}catch(et){we(et)}}function Be(_e){try{le(Z.throw(_e))}catch(et){we(et)}}function le(_e){_e.done?Q(_e.value):X(_e.value).then(ze,Be)}le((Z=Z.apply(H,Y||[])).next())})},O=function(H,Y){var B={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Z,X,Q,we;return we={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(we[Symbol.iterator]=function(){return this}),we;function ze(le){return function(_e){return Be([le,_e])}}function Be(le){if(Z)throw new TypeError("Generator is already executing.");for(;B;)try{if(Z=1,X&&(Q=le[0]&2?X.return:le[0]?X.throw||((Q=X.return)&&Q.call(X),0):X.next)&&!(Q=Q.call(X,le[1])).done)return Q;switch(X=0,Q&&(le=[le[0]&2,Q.value]),le[0]){case 0:case 1:Q=le;break;case 4:return B.label++,{value:le[1],done:!1};case 5:B.label++,X=le[1],le=[0];continue;case 7:le=B.ops.pop(),B.trys.pop();continue;default:if(Q=B.trys,!(Q=Q.length>0&&Q[Q.length-1])&&(le[0]===6||le[0]===2)){B=0;continue}if(le[0]===3&&(!Q||le[1]>Q[0]&&le[1]<Q[3])){B.label=le[1];break}if(le[0]===6&&B.label<Q[1]){B.label=Q[1],Q=le;break}if(Q&&B.label<Q[2]){B.label=Q[2],B.ops.push(le);break}Q[2]&&B.ops.pop(),B.trys.pop();continue}le=Y.call(H,B)}catch(_e){le=[6,_e],X=0}finally{Z=Q=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}},P=function(){for(var H=0,Y=0,B=arguments.length;Y<B;Y++)H+=arguments[Y].length;for(var Z=Array(H),X=0,Y=0;Y<B;Y++)for(var Q=arguments[Y],we=0,ze=Q.length;we<ze;we++,X++)Z[X]=Q[we];return Z},R=function(H){var Y=H.replace(/\s/g,""),B=Y.replace(/\[(.*)\]/,function(Z,X,Q,we){return((X!=null&&X.length)>0?X:null)||Y});return B},F=function(H,Y,B,Z){if(Array.isArray(H)){var X=R(Y);return H.map(function(Q){return F(Q,X,B,Z)})}return H==null||typeof H=="number"||typeof H=="boolean"||typeof H=="string"?H:B(H,Y,B,Z)},$=function(H){return H.directives&&H.directives.length?H.directives.find(function(Y){return Y.name.value==="rest"}):null};function te(H,Y,B,Z,X){return X==null||Y==null||typeof Y=="number"||typeof Y=="boolean"||typeof Y=="string"||X.selections.forEach(function(Q){if(i.isInlineFragment(Q))te(H,Y,B,Z,Q.selectionSet);else if(Q.kind==="FragmentSpread"){var we=Z[Q.name.value];te(H,Y,B,Z,we.selectionSet)}else if(i.isField(Q)){var ze=i.resultKeyNameFromField(Q);ze===H&&$(Q)!=null?J(Y,B,Z,Q.selectionSet):te(H,Y,B,Z,Q.selectionSet)}else return function(Be){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Y}function J(H,Y,B,Z){if(!(H==null||typeof H=="number"||typeof H=="boolean"||typeof H=="string")){if(Array.isArray(H)){H.forEach(function(X){return J(X,Y,B,Z)});return}Z.selections.forEach(function(X){if(i.isInlineFragment(X))J(H,Y,B,X.selectionSet);else if(X.kind==="FragmentSpread"){var Q=B[X.name.value];J(H,Y,B,Q.selectionSet)}else if(i.isField(X)){var we=H[X.name.value];X.name.value==="__typename"||(typeof we>"u"?H[X.name.value]=null:we!=null&&typeof we=="object"&&X.selectionSet!=null&&J(we,Y,B,X.selectionSet))}else return function(ze){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var ue=function(H,Y){var B=H[Y||Xe]||H[Xe];return typeof B=="string"?{uri:B}:x({responseTransformer:null},B)},fe=function(H,Y,B){return B===void 0||Y===void 0?H:H.replace(":"+Y,B)},qe=function(){function H(){}return H.replacerForPath=function(Y){if(Y in H.cache)return H.cache[Y];var B=Y.indexOf("?"),Z=Y.split(H.argReplacement),X=[],Q=!1;Z.reduce(function(ze,Be){if(Be===""||Be==="{}")return ze+Be.length;var le=ze+Be.length;if(Be[0]==="{"&&Be[Be.length-1]==="}"){var _e=Be.slice(1,Be.length-1).split(".");X.push(function(et,Tt){try{var At=ve(et,_e);return!Tt||typeof At!="object"||At==null?String(At):a.stringify(At)}catch{var Yt=[Y,_e.join(".")].join("|");return Yt in H.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."),H.warnTable[Yt]=!0),""}})}else X.push(Be),!Q&&le>=B&&(Q=!0,X.push(!0));return le},0);var we=function(ze){var Be=!1,le=X.reduce(function(_e,et){return typeof et=="string"?_e+et:typeof et=="boolean"?(Be=!0,_e):_e+et(ze,Be)},"");return le};return H.cache[Y]=we},H.cache={},H.warnTable={},H.argReplacement=/({[._a-zA-Z0-9]*})/,H}();function ve(H,Y){if(Y.length===0)return H;var B=P(Y),Z=B.shift();return ve(H[Z],B)}var De=["__typename"],je=typeof globalThis=="object"&&globalThis||di,ge=function(H,Y,B){B===void 0&&(B=[]);var Z=null;return Y.length!=2?Z=function(X,Q){return Y(X)}:Z=Y,Array.isArray(H)?H.map(function(X,Q){return ge(X,Z,P(B,[String(Q)]))}):H==null||typeof H!="object"||H.constructor!==Object||je.FileList&&H instanceof FileList||je.File&&H instanceof File?H:Object.keys(H).reduce(function(X,Q){var we=H[Q];if(De.indexOf(Q)!==-1)return X[Q]=we,X;var ze=P(B,[Q]);return X[Z(Q,ze)]=ge(we,Z,ze),X},{})},Je=function(H){return H},be=function(H){return H instanceof Headers?H:new Headers(H||{})},ce=function(){for(var H=[],Y=0;Y<arguments.length;Y++)H[Y]=arguments[Y];return H.reduce(function(B,Z){return Z&&(Z.forEach||(Z=be(Z)),Z.forEach(function(X,Q){B.append(Q,X)})),B},new Headers)},Te=function(H,Y,B){var Z=new Headers;return H.forEach(function(X,Q){Y.indexOf(Q)===-1&&Z.append(Q,X)}),ce(Z,B||new Headers)},Ne=function(H){return function(Y,B){return Te(Y,H,B)}},Ee=["GET","POST","PUT","PATCH","DELETE"],nt=function(H,Y){switch(Y){case"query":if(Ee.indexOf(H.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+H+'".');case"mutation":if(Ee.indexOf(H.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 B=Y;return B}},Ot=function(H,Y,B){var Z=new Error(B);throw Z.response=H,Z.statusCode=H.status,Z.result=Y,Z},ht=function(H,Y){return H==null||typeof H!="object"?H:Array.isArray(H)?H.map(function(B){return ht(B,Y)}):(H.__typename=Y,H)},Pt=function(H,Y,B,Z,X){return w(void 0,void 0,void 0,function(){var Q,we,ze,Be,le,_e,et,Tt,At,Yt,xt,Wt,Qt,Er,zt,ir,dr,Ar,Ht,W,z,it,yt,ct,Ve,Kt,Zt,Gt,kr,Hr,Mr,Ut,Or,$r,Lr,sr,Qr,Tr,gr,Ir,Sn,Un,D,se,me,ke,$e,ot,He,Ke;return O(this,function(Ze){switch(Ze.label){case 0:if(Q=X.directives,we=X.isLeaf,ze=X.resultKey,Be=Z.exportVariablesByNode,le=Be.get(Y)||{},_e=function(mt){return mt instanceof Array?mt.forEach(_e):Be.set(mt,x({},le)),mt},et=(Y||{})[ze],Tt=(Y||{})[H],Y&&Q&&Q.export&&(le[Q.export.as]=Tt),At=Q&&Q.type,!we&&At){if(Q.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return _e(Tt),[2,ht(Tt,Q.type.name)]}if(Yt=!Q||!Q.rest,Yt)return[2,_e(et||Tt)];if(xt=Z.credentials,Wt=Z.endpoints,Qt=Z.headers,Er=Z.customFetch,zt=Z.operationType,ir=Z.typePatcher,dr=Z.mainDefinition,Ar=Z.fragmentDefinitions,Ht=Z.fieldNameNormalizer,W=Z.fieldNameDenormalizer,z=Z.serializers,it=Z.responseTransformer,yt=i.createFragmentMap(Ar),ct=Q.rest,Ve=ct.path,Kt=ct.endpoint,Zt=ct.pathBuilder,Gt=ue(Wt,Kt),kr=Ve==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||(Ve.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Zt=function(mt){var _=mt.args,I=mt.exportVariables,k=x(x({},_),I),C=Object.keys(k).reduce(function(M,U){return fe(M,U,k[U])},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}):Zt=qe.replacerForPath(Ve)),Hr={args:B,exportVariables:le,context:Z,"@rest":Q.rest,replacer:Zt},Mr=Zt(Hr),Ut=Q.rest,Or=Ut.method,$r=Ut.type,Lr=Ut.bodyBuilder,sr=Ut.bodyKey,Qr=Ut.fieldNameDenormalizer,Tr=Ut.fieldNameNormalizer,gr=Ut.bodySerializer,Or||(Or="GET"),sr||(sr="input"),Ir=void 0,Sn=void 0,["GET","DELETE"].indexOf(Or)===-1){if(!Lr){if(Un=Hr.exportVariables[sr]||Hr.args&&Hr.args[sr],!Un)throw new Error("[GraphQL "+Or+" "+zt+" using a REST call without a body]. No `"+sr+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Lr=function(mt){return Un}}if(Ir=ge(Lr(Hr),Qr||W||Je),D=void 0,typeof gr=="string"){if(!z.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.'));D=z[gr](Ir,Qt)}else D=gr?gr(Ir,Qt):z[Ye](Ir,Qt);Ir=D.body,Sn=new Headers(D.headers)}return nt(Or,zt||"query"),se=x({method:Or,headers:Sn||Qt,body:Ir},xt?{credentials:xt}:{}),me=""+Gt.uri+Mr,[4,(Er||fetch)(me,se)];case 1:return ke=Ze.sent(),Z.responses.push(ke),ke.ok?(ke.status===204||ke.headers.get("Content-Length")==="0"?$e={}:$e=ke,[3,9]):[3,2];case 2:return ke.status!==404?[3,3]:($e=null,[3,9]);case 3:ot=void 0,Ze.label=4;case 4:return Ze.trys.push([4,6,,8]),[4,ke.clone().json()];case 5:return ot=Ze.sent(),[3,8];case 6:return Ze.sent(),[4,ke.clone().text()];case 7:return ot=Ze.sent(),[3,8];case 8:Ot(ke,ot,"Response not successful: Received status code "+ke.status),Ze.label=9;case 9:if(He=Gt.responseTransformer||it,!He)return[3,14];Ze.label=10;case 10:return Ze.trys.push([10,12,,13]),[4,He($e,$r)];case 11:return $e=Ze.sent(),[3,13];case 12:throw Ke=Ze.sent(),console.warn("An error occurred in a responseTransformer:"),Ke;case 13:return[3,16];case 14:return $e&&$e.json?[4,$e.json()]:[3,16];case 15:$e=Ze.sent(),Ze.label=16;case 16:return $e=ge($e,Tr||Ht||Je),$e=te(ze,$e,dr,yt,dr.selectionSet),$e=F($e,$r,ir,{resolverParams:{fieldName:H,root:Y,args:B,context:Z,info:X}}),[2,_e($e)]}})})},Xe="",Ye="",dt=function(H,Y){return Y.has("content-type")||Y.append("Content-Type","application/json"),{body:JSON.stringify(H),headers:Y}},Re={test:function(H){return H.name.value==="rest"},remove:!0},_t=function(H){A(Y,H);function Y(B){var Z,X=B.uri,Q=B.endpoints,we=B.headers,ze=B.fieldNameNormalizer,Be=B.fieldNameDenormalizer,le=B.typePatcher,_e=B.customFetch,et=B.credentials,Tt=B.bodySerializers,At=B.defaultSerializer,Yt=B.responseTransformer,xt=H.call(this)||this,Wt={};if(Wt[Xe]=X||"",xt.endpoints=Object.assign({},Q||Wt),X==null&&Q==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(X!=null){var Qt=(Q||{})[Xe];if(Qt!=null&&Qt!=X)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");xt.endpoints[Xe]=X}if(xt.endpoints[Xe]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),le==null)xt.typePatcher=function(zt,ir,dr){return x({__typename:ir},zt)};else if(!Array.isArray(le)&&typeof le=="object"&&Object.keys(le).map(function(zt){return le[zt]}).reduce(function(zt,ir){return zt&&typeof ir=="function"},!0)){var Er=le;xt.typePatcher=function(zt,ir,dr,Ar){var Ht=zt.__typename||ir;if(Array.isArray(zt))return zt.map(function(z){return dr(z,Ht,dr,Ar)});var W=Er[Ht]||function(z){return z};return x({__typename:Ht},W(zt,Ht,dr,Ar))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return Tt&&Tt.hasOwnProperty(Ye)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),xt.responseTransformer=Yt||null,xt.fieldNameNormalizer=ze||null,xt.fieldNameDenormalizer=Be||null,xt.headers=be(we),xt.credentials=et||null,xt.customFetch=_e,xt.serializers=x((Z={},Z[Ye]=At||dt,Z),Tt||{}),xt.processedDocuments=new Map,xt}return Y.prototype.removeRestSetsFromDocument=function(B){var Z=this.processedDocuments.get(B);if(Z)return Z;i.checkDocument(B);var X=i.removeDirectivesFromDocument([Re],B);return this.processedDocuments.set(B,X),X},Y.prototype.request=function(B,Z){var X=B.query,Q=B.variables,we=B.getContext,ze=B.setContext,Be=we(),le=i.hasDirectives(["rest"],X);if(!le)return Z(B);var _e=this.removeRestSetsFromDocument(X),et=Be.headersMergePolicy;et==null&&Array.isArray(Be.headersToOverride)?et=Ne(Be.headersToOverride):et==null&&(et=ce);var Tt=et(this.headers,Be.headers);Tt.has("Accept")||Tt.append("Accept","application/json");var At=Be.credentials||this.credentials,Yt=i.addTypenameToDocument(X),xt=i.getMainDefinition(X),Wt=i.getFragmentDefinitions(X),Qt=(xt||{}).operation||"query",Er={headers:Tt,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:At,customFetch:this.customFetch,operationType:Qt,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:xt,fragmentDefinitions:Wt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},zt={},ir;return _e&&Z?(B.query=_e,ir=Z(B)):ir=n.Observable.of({data:{}}),ir.flatMap(function(dr){var Ar=dr.data,Ht=dr.errors;return new n.Observable(function(W){y(Pt,Yt,Ar,Er,Q,zt).then(function(z){ze({restResponses:(Be.restResponses||[]).concat(Er.responses)}),W.next({data:z,errors:Ht}),W.complete()}).catch(function(z){z.name!=="AbortError"&&(z.result&&z.result.errors&&W.next(z.result),W.error(z))})})})},Y}(n.ApolloLink);t.RestLink=_t,t.PathBuilder=qe,Object.defineProperty(t,"__esModule",{value:!0})})})(dh,dh.exports);var lk=dh.exports;const Xu=pe.createContext(),fk=()=>{const{urls:r,isAuthenticated:e,login:t}=ti(),{children:n,isEmbedded:i,setIsEmbedded:a}=pe.useContext(Xu),u=pn.useNavigate(),c=pn.useLocation(),[f,h]=pe.useState(!1),d=r.sandboxUrl||r.appUrl,[y,g]=pe.useState(),[m,b]=pe.useState({});pe.useEffect(()=>{if(e===null||!c||c.pathname!=="/mm-embedded-interop")return;if(e===!1){t();return}const F=new URLSearchParams(c.search).get("id");F&&g(F),a(!0)},[c,e]),pn.useBlocker(({nextLocation:R})=>{var F;return i?(F=R.state)!=null&&F.fromParent?(h(!0),!1):(A(`${R.pathname}${R.search}`),!0):!1}),pe.useEffect(()=>{if(!i)return;const R=F=>{F.metaKey&&F.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:y},d)};return window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}},[i]),pe.useEffect(()=>{if(!i)return;const R=({origin:F,data:$})=>{if(F===d)switch($.type){case"navigate":u($.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":b($.context);break}};return window.addEventListener("message",R),!f&&e&&window.parent.postMessage({type:"ready",instanceId:y},d),()=>{window.removeEventListener("message",R)}},[u,f,i,e]);const A=R=>{!f&&!e||window.parent.postMessage({type:"set-path",instanceId:y,path:R},d)},x=R=>{f&&window.parent.postMessage({type:"set-summary",instanceId:y,summary:R},d)},w=R=>{f&&window.parent.postMessage({type:"toast",instanceId:y,message:R},d)},O=R=>{f&&window.parent.postMessage({type:"popup",instanceId:y,message:R},d)},P=pe.useMemo(()=>({isEmbedded:i,navigateParent:A,setSummary:x,toast:w,popup:O,context:m}),[i,A,x,w,O,m]);return or.jsx(nh.Provider,{value:P,children:c.pathname!=="/mm-embedded-interop"?n:or.jsx(or.Fragment,{})})},hk=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=pe.useContext(Xu),[a,u]=pe.useState(),[c,f]=pe.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};pe.useEffect(()=>{const g=new RA(jA({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=p0(({operation:P,networkError:R,forward:F})=>(Bi(P.query).operation==="subscription"&&R&&g.client.terminate(),F(P))),A=d0(async(P,{headers:R})=>({headers:{...R,Authorization:`Bearer ${e.current}`,...d()}})).concat(sf({uri:`https:${h()}`,fetch:window.fetch})),x=m.split(({query:P})=>{const R=Bi(P);return R.kind==="OperationDefinition"&&R.operation==="subscription"},g,A),O=d0(async(P,{headers:R})=>({headers:{...R,Authorization:`Bearer ${t}`}})).concat(new lk.RestLink({uri:r.apiUrl}));f(Kr.from([O,x]))},[]),pe.useEffect(()=>{c&&u(new Af({link:c,cache:new xf}))},[c]);const y=pe.useMemo(()=>({link:c}),[c]);return or.jsx(Wv.Provider,{value:y,children:a?or.jsx(MO,{client:a,children:or.jsx(tA,{children:or.jsx(fk,{children:i})})}):or.jsx(or.Fragment,{})})},dk=Pp.div`
|
|
128
|
+
`;O(ee)},[y,m,h]),me.useEffect(()=>{w&&C()},[w,x]);const[C,{data:D,loading:F}]=YO(w,{fetchPolicy:"no-cache"});return me.useEffect(()=>{if(!D||!D.quantities)return;const B=ci.last(D.quantities);if(B&&d(B.eventTime),!n)i(D.quantities);else{const ee=ci.drop(D.quantities);i([...n,...ee])}},[D]),{data:n,error:c,loading:a}},aA=r=>{const[e,t]=me.useState(),[n,i]=me.useState(!0),[a,u]=me.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}},oA=r=>{const[e,t]=me.useState(),{urls:n,request:i,clientId:a}=ti(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=Gv("/templates");return me.useEffect(()=>{if(!c)return;const m=ci.filter(c.templates,{namespace:u});t(m)},[c]),[async({name:m,public:b,config:A})=>{const x={name:m,public:b,namespace:u,config:JSON.stringify(A)},w=JSON.stringify(x),O=await i(`${n.apiUrl}/templates`,{method:"POST",body:w});return t([...e,O.template]),O.template},async(m,{name:b,public:A,config:x})=>{const w={name:b,public:A,namespace:u,config:JSON.stringify(x)},O=JSON.stringify(w),C=await i(`${n.apiUrl}/templates/${m}`,{method:"PUT",body:O}),D=ci.findIndex(e,{id:m}),F=e.slice(0,D),B=e.slice(D+1);return t([...F,C.template,...B]),C.template},async m=>{await i(`${n.apiUrl}/templates/${m}`,{method:"DELETE"}),t(ci.reject(e,{id:m}))},{templates:e,loading:f,error:h}]},uA=()=>{const[r,e]=me.useState(),[t,n]=me.useState(),{urls:i}=ti();return me.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]),me.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=()=>me.useContext(zv),cA=()=>(console.warn("useMMEmbeddedApp is deprecated. Use useMMAppTools and useMMAppContext."),me.useContext(fa)),lA=()=>me.useContext(fa),fA=()=>{const{context:r}=me.useContext(fa);return r},hA=(r,e,t=[])=>{const{addSetting:n}=me.useContext(fa);me.useEffect(()=>{n(r,e)},[...t])},dA=()=>me.useContext(Wv),pA=()=>{const{login:r,isAuthenticated:e}=ti();return bo(async()=>{e===!1&&await r()},[e]),e?ar.jsx(mn.Outlet,{}):ar.jsx("div",{})},Qv="%[a-f0-9]{2}",Jv=new RegExp("("+Qv+")|([^%]+?)","gi"),Yv=new RegExp("("+Qv+")+","gi");function sh(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([],sh(t),sh(n))}function mA(r){try{return decodeURIComponent(r)}catch{let e=r.match(Jv)||[];for(let t=1;t<e.length;t++)r=sh(e,t).join(""),e=r.match(Jv)||[];return r}}function yA(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=Yv.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=mA(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Yv.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 gA(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return yA(r)}}function vA(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 Kv(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 bA=r=>r==null,wA=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),ah=Symbol("encodeFragmentIdentifier");function _A(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,[xr(e,r),"[",i,"]"].join("")]:[...t,[xr(e,r),"[",xr(i,r),"]=",xr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[xr(e,r),"[]"].join("")]:[...t,[xr(e,r),"[]=",xr(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,[xr(e,r),":list="].join("")]:[...t,[xr(e,r),":list=",xr(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?[[xr(t,r),e,xr(i,r)].join("")]:[[n,xr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,xr(e,r)]:[...t,[xr(e,r),"=",xr(n,r)].join("")]}}function xA(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&&wi(n,r).includes(r.arrayFormatSeparator);n=u?wi(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>wi(f,r)):n===null?n:wi(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&wi(n,r);return}const u=n===null?[]:wi(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 Zv(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function xr(r,e){return e.encode?e.strict?wA(r):encodeURIComponent(r):r}function wi(r,e){return e.decode?gA(r):r}function Xv(r){return Array.isArray(r)?r.sort():typeof r=="object"?Xv(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function e0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function SA(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function t0(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 oh(r){r=e0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function uh(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},Zv(e.arrayFormatSeparator);const t=xA(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]=Kv(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:wi(c,e),t(wi(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]=t0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=t0(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)?Xv(u):u,i},Object.create(null))}function r0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},Zv(e.arrayFormatSeparator);const t=u=>e.skipNull&&bA(r[u])||e.skipEmptyString&&r[u]==="",n=_A(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?xr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?xr(u,e)+"[]":c.reduce(n(u),[]).join("&"):xr(u,e)+"="+xr(c,e)}).filter(u=>u.length>0).join("&")}function n0(r,e){var i;e={decode:!0,...e};let[t,n]=Kv(r,"#");return t===void 0&&(t=r),{url:((i=t==null?void 0:t.split("?"))==null?void 0:i[0])??"",query:uh(oh(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:wi(n,e)}:{}}}function i0(r,e){e={encode:!0,strict:!0,[ah]:!0,...e};const t=e0(r.url).split("?")[0]||"",n=oh(r.url),i={...uh(n,{sort:!1}),...r.query};let a=r0(i,e);a&&(a=`?${a}`);let u=SA(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[ah]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function s0(r,e,t){t={parseFragmentIdentifier:!0,[ah]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=n0(r,t);return i0({url:n,query:vA(i,e),fragmentIdentifier:a},t)}function EA(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return s0(r,n,t)}const OA=Object.freeze(Object.defineProperty({__proto__:null,exclude:EA,extract:oh,parse:uh,parseUrl:n0,pick:s0,stringify:r0,stringifyUrl:i0},Symbol.toStringTag,{value:"Module"})),qr=[];for(let r=0;r<256;++r)qr.push((r+256).toString(16).slice(1));function TA(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 ch;const AA=new Uint8Array(16);function kA(){if(!ch){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ch=crypto.getRandomValues.bind(crypto)}return ch(AA)}const a0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function IA(r,e,t){if(a0.randomUUID&&!e&&!r)return a0.randomUUID();r=r||{};const n=r.random||(r.rng||kA)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,TA(n)}const lh="mm-auth-state",fh="mm-auth-destination",hh="mm-auth-access-token",_i=window.localStorage,CA=()=>_i.getItem(hh),PA=r=>{r?_i.setItem(hh,r):_i.removeItem(hh)},NA=()=>_i.getItem(fh),o0=r=>{r?_i.setItem(fh,r):_i.removeItem(fh)},RA=()=>_i.getItem(lh),u0=r=>{r?_i.setItem(lh,r):_i.removeItem(lh)},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 DA(r){return Kt(r)&&"code"in r&&"reason"in r}function MA(r){var e;return Kt(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var FA=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(j(j({},t),{query:Hs(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=DA(a);return u||MA(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new gn({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Yr);function on(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function ks(r){return on(r)==="object"}function LA(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function l0(r,e){return r.length<124?r:e}const jA="graphql-transport-ws";var bn;(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"})(bn||(bn={}));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 f0(r){if(!ks(r))throw new Error(`Message is expected to be an object, but got ${on(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 ${on(r.type)}`);switch(r.type){case mr.ConnectionInit:case mr.ConnectionAck:case mr.Ping:case mr.Pong:{if(r.payload!=null&&!ks(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 ${on(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!ks(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${on(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 ${on(r.payload.query)}`);if(r.payload.variables!=null&&!ks(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 ${on(r.payload.variables)}`);if(r.payload.operationName!=null&&on(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 ${on(r.payload.operationName)}`);if(r.payload.extensions!=null&&!ks(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 ${on(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 ${on(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!ks(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${on(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 ${on(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!LA(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 ${on(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 qA(r,e){return f0(typeof r=="string"?JSON.parse(r,e):r)}function _o(r,e){return f0(r),JSON.stringify(r,e)}var ha=function(r){return this instanceof ha?(this.v=r,this):new ha(r)},UA=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,A){a.push([g,m,b,A])>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 $A(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(Be){let _e=1e3;for(let ce=0;ce<Be;ce++)_e*=2;await new Promise(ce=>setTimeout(ce,_e+Math.floor(Math.random()*2700+300)))},shouldRetry:y=dh,isFatalConnectionProblem:g,on:m,webSocketImpl:b,generateID:A=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Be=>{const _e=Math.random()*16|0;return(Be=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:x,jsonMessageReviver:w}=r;let O;if(b){if(!VA(b))throw new Error("Invalid WebSocket implementation provided");O=b}else typeof WebSocket<"u"?O=WebSocket:typeof global<"u"?O=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const C=O,D=(()=>{const ye=(()=>{const _e={};return{on(ce,Ae){return _e[ce]=Ae,()=>{delete _e[ce]}},emit(ce){var Ae;"id"in ce&&((Ae=_e[ce.id])===null||Ae===void 0||Ae.call(_e,ce))}}})(),Be={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?[ye.emit,m.message]:[ye.emit],closed:m!=null&&m.closed?[m.closed]:[],error:m!=null&&m.error?[m.error]:[]};return{onMessage:ye.on,on(_e,ce){const Ae=Be[_e];return Ae.push(ce),()=>{Ae.splice(Ae.indexOf(ce),1)}},emit(_e,...ce){for(const Ae of[...Be[_e]])Ae(...ce)}}})();function F(ye){const Be=[D.on("error",_e=>{Be.forEach(ce=>ce()),ye(_e)}),D.on("closed",_e=>{Be.forEach(ce=>ce()),ye(_e)})]}let B,ee=0,Q,re=!1,fe=0,ge=!1;async function he(){clearTimeout(Q);const[ye,Be]=await(B??(B=new Promise((Ae,Me)=>(async()=>{if(re){if(await d(fe),!ee)return B=void 0,Me({code:1e3,reason:"All Subscriptions Gone"});fe++}D.emit("connecting",re);const Oe=new C(typeof e=="function"?await e():e,jA);let tt,Tt;function ft(){isFinite(u)&&u>0&&(clearTimeout(Tt),Tt=setTimeout(()=>{Oe.readyState===C.OPEN&&(Oe.send(_o({type:mr.Ping})),D.emit("ping",!1,void 0))},u))}F(rt=>{B=void 0,clearTimeout(tt),clearTimeout(Tt),Me(rt),rt instanceof h0&&(Oe.close(4499,"Terminated"),Oe.onerror=null,Oe.onclose=null)}),Oe.onerror=rt=>D.emit("error",rt),Oe.onclose=rt=>D.emit("closed",rt),Oe.onopen=async()=>{try{D.emit("opened",Oe);const rt=typeof t=="function"?await t():t;if(Oe.readyState!==C.OPEN)return;Oe.send(_o(rt?{type:mr.ConnectionInit,payload:rt}:{type:mr.ConnectionInit},x)),isFinite(f)&&f>0&&(tt=setTimeout(()=>{Oe.close(bn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),ft()}catch(rt){D.emit("error",rt),Oe.close(bn.InternalClientError,l0(rt instanceof Error?rt.message:new Error(rt).message,"Internal client error"))}};let Pt=!1;Oe.onmessage=({data:rt})=>{try{const Ye=qA(rt,w);if(D.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){D.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?ft():c||(Oe.send(_o(Ye.payload?{type:mr.Pong,payload:Ye.payload}:{type:mr.Pong})),D.emit("pong",!1,Ye.payload));return}if(Pt)return;if(Ye.type!==mr.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(tt),Pt=!0,D.emit("connected",Oe,Ye.payload,re),re=!1,fe=0,Ae([Oe,new Promise((pt,Fe)=>F(Fe))])}catch(Ye){Oe.onmessage=null,D.emit("error",Ye),Oe.close(bn.BadResponse,l0(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));ye.readyState===C.CLOSING&&await Be;let _e=()=>{};const ce=new Promise(Ae=>_e=Ae);return[ye,_e,Promise.race([ce.then(()=>{if(!ee){const Ae=()=>ye.close(1e3,"Normal Closure");isFinite(a)&&a>0?Q=setTimeout(()=>{ye.readyState===C.OPEN&&Ae()},a):Ae()}}),Be])]}function ve(ye){if(dh(ye)&&(BA(ye.code)||[bn.InternalServerError,bn.InternalClientError,bn.BadRequest,bn.BadResponse,bn.Unauthorized,bn.SubprotocolNotAcceptable,bn.SubscriberAlreadyExists,bn.TooManyInitialisationRequests].includes(ye.code)))throw ye;if(ge)return!1;if(dh(ye)&&ye.code===1e3)return ee>0;if(!h||fe>=h||!y(ye)||g!=null&&g(ye))throw ye;return re=!0}n||(async()=>{for(ee++;;)try{const[,,ye]=await he();await ye}catch(ye){try{if(!ve(ye))return}catch(Be){return i==null?void 0:i(Be)}}})();function Ie(ye,Be){const _e=A(ye);let ce=!1,Ae=!1,Me=()=>{ee--,ce=!0};return(async()=>{for(ee++;;)try{const[Oe,tt,Tt]=await he();if(ce)return tt();const ft=D.onMessage(_e,Pt=>{switch(Pt.type){case mr.Next:{Be.next(Pt.payload);return}case mr.Error:{Ae=!0,ce=!0,Be.error(Pt.payload),Me();return}case mr.Complete:{ce=!0,Me();return}}});Oe.send(_o({id:_e,type:mr.Subscribe,payload:ye},x)),Me=()=>{!ce&&Oe.readyState===C.OPEN&&Oe.send(_o({id:_e,type:mr.Complete},x)),ee--,ce=!0,tt()},await Tt.finally(ft);return}catch(Oe){if(!ve(Oe))return}})().then(()=>{Ae||Be.complete()}).catch(Oe=>{Be.error(Oe)}),()=>{ce||Me()}}return{on:D.on,subscribe:Ie,iterate(ye){const Be=[],_e={done:!1,error:null,resolve:()=>{}},ce=Ie(ye,{next(Me){Be.push(Me),_e.resolve()},error(Me){_e.done=!0,_e.error=Me,_e.resolve()},complete(){_e.done=!0,_e.resolve()}}),Ae=function(){return UA(this,arguments,function*(){for(;;){for(Be.length||(yield ha(new Promise(tt=>_e.resolve=tt)));Be.length;)yield yield ha(Be.shift());if(_e.error)throw _e.error;if(_e.done)return yield ha(void 0)}})}();return Ae.throw=async Me=>(_e.done||(_e.done=!0,_e.error=Me,_e.resolve()),{done:!0,value:void 0}),Ae.return=async()=>(ce(),{done:!0,value:void 0}),Ae},async dispose(){if(ge=!0,B){const[ye]=await B;ye.close(1e3,"Normal Closure")}},terminate(){B&&D.emit("closed",new h0)}}}class h0 extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function dh(r){return ks(r)&&"code"in r&&"reason"in r}function BA(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function VA(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function d0(r){return new Yr(function(e,t){var n=an(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 p0(r){return new Yr(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=p0(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Yr);var ph={exports:{}};const WA=al(MO),zA=al(AE);var mh,m0;function HA(){return m0||(m0=1,mh=Error),mh}var yh,y0;function GA(){return y0||(y0=1,yh=EvalError),yh}var gh,g0;function QA(){return g0||(g0=1,gh=RangeError),gh}var vh,v0;function JA(){return v0||(v0=1,vh=ReferenceError),vh}var bh,b0;function w0(){return b0||(b0=1,bh=SyntaxError),bh}var wh,_0;function xo(){return _0||(_0=1,wh=TypeError),wh}var _h,x0;function YA(){return x0||(x0=1,_h=URIError),_h}var xh,S0;function KA(){return S0||(S0=1,xh=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(t 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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),xh}var Sh,E0;function ZA(){if(E0)return Sh;E0=1;var r=typeof Symbol<"u"&&Symbol,e=KA();return Sh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Sh}var Eh,O0;function XA(){if(O0)return Eh;O0=1;var r={__proto__:null,foo:{}},e=Object;return Eh=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},Eh}var Oh,T0;function ek(){if(T0)return Oh;T0=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 Oh=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 w=h.apply(this,i(d,arguments));return Object(w)===w?w:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),b=[],A=0;A<m;A++)b[A]="$"+A;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},Oh}var Th,A0;function Ah(){if(A0)return Th;A0=1;var r=ek();return Th=Function.prototype.bind||r,Th}var kh,k0;function tk(){if(k0)return kh;k0=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=Ah();return kh=t.call(r,e),kh}var Ih,I0;function da(){if(I0)return Ih;I0=1;var r,e=HA(),t=GA(),n=QA(),i=JA(),a=w0(),u=xo(),c=YA(),f=Function,h=function(_e){try{return f('"use strict"; return ('+_e+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var y=function(){throw new u},g=d?function(){try{return arguments.callee,y}catch{try{return d(arguments,"callee").get}catch{return y}}}():y,m=ZA()(),b=XA()(),A=Object.getPrototypeOf||(b?function(_e){return _e.__proto__}:null),x={},w=typeof Uint8Array>"u"||!A?r:A(Uint8Array),O={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":m&&A?A([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":x,"%AsyncGenerator%":x,"%AsyncGeneratorFunction%":x,"%AsyncIteratorPrototype%":x,"%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%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":f,"%GeneratorFunction%":x,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&A?A(A([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!A?r:A(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!A?r:A(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&A?A(""[Symbol.iterator]()):r,"%Symbol%":m?Symbol:r,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":u,"%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%":c,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(A)try{null.error}catch(_e){var C=A(A(_e));O["%Error.prototype%"]=C}var D=function _e(ce){var Ae;if(ce==="%AsyncFunction%")Ae=h("async function () {}");else if(ce==="%GeneratorFunction%")Ae=h("function* () {}");else if(ce==="%AsyncGeneratorFunction%")Ae=h("async function* () {}");else if(ce==="%AsyncGenerator%"){var Me=_e("%AsyncGeneratorFunction%");Me&&(Ae=Me.prototype)}else if(ce==="%AsyncIteratorPrototype%"){var Oe=_e("%AsyncGenerator%");Oe&&A&&(Ae=A(Oe.prototype))}return O[ce]=Ae,Ae},F={__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"]},B=Ah(),ee=tk(),Q=B.call(Function.call,Array.prototype.concat),re=B.call(Function.apply,Array.prototype.splice),fe=B.call(Function.call,String.prototype.replace),ge=B.call(Function.call,String.prototype.slice),he=B.call(Function.call,RegExp.prototype.exec),ve=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ie=/\\(\\)?/g,ye=function(ce){var Ae=ge(ce,0,1),Me=ge(ce,-1);if(Ae==="%"&&Me!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(Me==="%"&&Ae!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Oe=[];return fe(ce,ve,function(tt,Tt,ft,Pt){Oe[Oe.length]=ft?fe(Pt,Ie,"$1"):Tt||tt}),Oe},Be=function(ce,Ae){var Me=ce,Oe;if(ee(F,Me)&&(Oe=F[Me],Me="%"+Oe[0]+"%"),ee(O,Me)){var tt=O[Me];if(tt===x&&(tt=D(Me)),typeof tt>"u"&&!Ae)throw new u("intrinsic "+ce+" exists, but is not available. Please file an issue!");return{alias:Oe,name:Me,value:tt}}throw new a("intrinsic "+ce+" does not exist!")};return Ih=function(ce,Ae){if(typeof ce!="string"||ce.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Ae!="boolean")throw new u('"allowMissing" argument must be a boolean');if(he(/^%?[^%]*%?$/,ce)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Me=ye(ce),Oe=Me.length>0?Me[0]:"",tt=Be("%"+Oe+"%",Ae),Tt=tt.name,ft=tt.value,Pt=!1,rt=tt.alias;rt&&(Oe=rt[0],re(Me,Q([0,1],rt)));for(var Ye=1,pt=!0;Ye<Me.length;Ye+=1){var Fe=Me[Ye],wt=ge(Fe,0,1),z=ge(Fe,-1);if((wt==='"'||wt==="'"||wt==="`"||z==='"'||z==="'"||z==="`")&&wt!==z)throw new a("property names with quotes must have matching quotes");if((Fe==="constructor"||!pt)&&(Pt=!0),Oe+="."+Fe,Tt="%"+Oe+"%",ee(O,Tt))ft=O[Tt];else if(ft!=null){if(!(Fe in ft)){if(!Ae)throw new u("base intrinsic for "+ce+" exists, but the property is not available.");return}if(d&&Ye+1>=Me.length){var K=d(ft,Fe);pt=!!K,pt&&"get"in K&&!("originalValue"in K.get)?ft=K.get:ft=ft[Fe]}else pt=ee(ft,Fe),ft=ft[Fe];pt&&!Pt&&(O[Tt]=ft)}}return ft},Ih}var Ch={exports:{}},Ph,C0;function Nh(){if(C0)return Ph;C0=1;var r=da(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Ph=e,Ph}var Rh,P0;function N0(){if(P0)return Rh;P0=1;var r=da(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Rh=e,Rh}var Dh,R0;function rk(){if(R0)return Dh;R0=1;var r=Nh(),e=w0(),t=xo(),n=N0();return Dh=function(a,u,c){if(!a||typeof a!="object"&&typeof a!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var f=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!n&&n(a,u);if(r)r(a,u,{configurable:d===null&&g?g.configurable:!d,enumerable:f===null&&g?g.enumerable:!f,value:c,writable:h===null&&g?g.writable:!h});else if(y||!f&&!h&&!d)a[u]=c;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Dh}var Mh,D0;function nk(){if(D0)return Mh;D0=1;var r=Nh(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Mh=e,Mh}var Fh,M0;function ik(){if(M0)return Fh;M0=1;var r=da(),e=rk(),t=nk()(),n=N0(),i=xo(),a=r("%Math.floor%");return Fh=function(c,f){if(typeof c!="function")throw new i("`fn` is not a function");if(typeof f!="number"||f<0||f>4294967295||a(f)!==f)throw new i("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],d=!0,y=!0;if("length"in c&&n){var g=n(c,"length");g&&!g.configurable&&(d=!1),g&&!g.writable&&(y=!1)}return(d||y||!h)&&(t?e(c,"length",f,!0,!0):e(c,"length",f)),c},Fh}var F0;function sk(){return F0||(F0=1,function(r){var e=Ah(),t=da(),n=ik(),i=xo(),a=t("%Function.prototype.apply%"),u=t("%Function.prototype.call%"),c=t("%Reflect.apply%",!0)||e.call(u,a),f=Nh(),h=t("%Math.max%");r.exports=function(g){if(typeof g!="function")throw new i("a function is required");var m=c(e,u,arguments);return n(m,1+h(0,g.length-(arguments.length-1)),!0)};var d=function(){return c(e,a,arguments)};f?f(r.exports,"apply",{value:d}):r.exports.apply=d}(Ch)),Ch.exports}var Lh,L0;function ak(){if(L0)return Lh;L0=1;var r=da(),e=sk(),t=e(r("String.prototype.indexOf"));return Lh=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e(u):u},Lh}const ok=al(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var jh,j0;function uk(){if(j0)return jh;j0=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,A=Object.prototype.toString,x=Function.prototype.toString,w=String.prototype.match,O=String.prototype.slice,C=String.prototype.replace,D=String.prototype.toUpperCase,F=String.prototype.toLowerCase,B=RegExp.prototype.test,ee=Array.prototype.concat,Q=Array.prototype.join,re=Array.prototype.slice,fe=Math.floor,ge=typeof BigInt=="function"?BigInt.prototype.valueOf:null,he=Object.getOwnPropertySymbols,ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ie=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ie||!0)?Symbol.toStringTag:null,Be=Object.prototype.propertyIsEnumerable,_e=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(W){return W.__proto__}:null);function ce(W,H){if(W===1/0||W===-1/0||W!==W||W&&W>-1e3&&W<1e3||B.call(/e/,H))return H;var ze=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof W=="number"){var We=W<0?-fe(-W):fe(W);if(We!==W){var kt=String(We),Ke=O.call(H,kt.length+1);return C.call(kt,ze,"$&_")+"."+C.call(C.call(Ke,/([0-9]{3})/g,"$&_"),/_$/,"")}}return C.call(H,ze,"$&_")}var Ae=ok,Me=Ae.custom,Oe=z(Me)?Me:null;jh=function W(H,ze,We,kt){var Ke=ze||{};if(J(Ke,"quoteStyle")&&Ke.quoteStyle!=="single"&&Ke.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(J(Ke,"maxStringLength")&&(typeof Ke.maxStringLength=="number"?Ke.maxStringLength<0&&Ke.maxStringLength!==1/0:Ke.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var nr=J(Ke,"customInspect")?Ke.customInspect:!0;if(typeof nr!="boolean"&&nr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(J(Ke,"indent")&&Ke.indent!==null&&Ke.indent!==" "&&!(parseInt(Ke.indent,10)===Ke.indent&&Ke.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(J(Ke,"numericSeparator")&&typeof Ke.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var dr=Ke.numericSeparator;if(typeof H>"u")return"undefined";if(H===null)return"null";if(typeof H=="boolean")return H?"true":"false";if(typeof H=="string")return _t(H,Ke);if(typeof H=="number"){if(H===0)return 1/0/H>0?"0":"-0";var Mt=String(H);return dr?ce(H,Mt):Mt}if(typeof H=="bigint"){var Ht=String(H)+"n";return dr?ce(H,Ht):Ht}var Ur=typeof Ke.depth>"u"?5:Ke.depth;if(typeof We>"u"&&(We=0),We>=Ur&&Ur>0&&typeof H=="object")return ft(H)?"[Array]":"[Object]";var $r=zt(Ke,We);if(typeof kt>"u")kt=[];else if(Ce(kt,H)>=0)return"[Circular]";function ir(Ue,ot,st){if(ot&&(kt=re.call(kt),kt.push(ot)),st){var nt={depth:Ke.depth};return J(Ke,"quoteStyle")&&(nt.quoteStyle=Ke.quoteStyle),W(Ue,nt,We+1,kt)}return W(Ue,Ke,We+1,kt)}if(typeof H=="function"&&!rt(H)){var cn=G(H),Sr=Zt(H,ir);return"[Function"+(cn?": "+cn:" (anonymous)")+"]"+(Sr.length>0?" { "+Q.call(Sr,", ")+" }":"")}if(z(H)){var Er=Ie?C.call(String(H),/^(Symbol\(.*\))_[^)]*$/,"$1"):ve.call(H);return typeof H=="object"&&!Ie?mt(Er):Er}if(At(H)){for(var Or="<"+F.call(String(H.nodeName)),Ar=H.attributes||[],cr=0;cr<Ar.length;cr++)Or+=" "+Ar[cr].name+"="+tt(Tt(Ar[cr].value),"double",Ke);return Or+=">",H.childNodes&&H.childNodes.length&&(Or+="..."),Or+="</"+F.call(String(H.nodeName))+">",Or}if(ft(H)){if(H.length===0)return"[]";var Hr=Zt(H,ir);return $r&&!Mr(Hr)?"["+Jt(Hr,$r)+"]":"[ "+Q.call(Hr,", ")+" ]"}if(Ye(H)){var kr=Zt(H,ir);return!("cause"in Error.prototype)&&"cause"in H&&!Be.call(H,"cause")?"{ ["+String(H)+"] "+Q.call(ee.call("[cause]: "+ir(H.cause),kr),", ")+" }":kr.length===0?"["+String(H)+"]":"{ ["+String(H)+"] "+Q.call(kr,", ")+" }"}if(typeof H=="object"&&nr){if(Oe&&typeof H[Oe]=="function"&&Ae)return Ae(H,{depth:Ur-We});if(nr!=="symbol"&&typeof H.inspect=="function")return H.inspect()}if(Ge(H)){var Tr=[];return n&&n.call(H,function(Ue,ot){Tr.push(ir(ot,H,!0)+" => "+ir(Ue,H))}),rr("Map",t.call(H),Tr,$r)}if(xe(H)){var Fr=[];return c&&c.call(H,function(Ue){Fr.push(ir(Ue,H))}),rr("Set",u.call(H),Fr,$r)}if(Ve(H))return Ut("WeakMap");if(Ze(H))return Ut("WeakSet");if(le(H))return Ut("WeakRef");if(Fe(H))return mt(ir(Number(H)));if(K(H))return mt(ir(ge.call(H)));if(wt(H))return mt(b.call(H));if(pt(H))return mt(ir(String(H)));if(typeof window<"u"&&H===window)return"{ [object Window] }";if(typeof globalThis<"u"&&H===globalThis||typeof pi<"u"&&H===pi)return"{ [object globalThis] }";if(!Pt(H)&&!rt(H)){var ln=Zt(H,ir),Un=_e?_e(H)===Object.prototype:H instanceof Object||H.constructor===Object,R=H instanceof Object?"":"null prototype",ae=!Un&&ye&&Object(H)===H&&ye in H?O.call(X(H),8,-1):R?"Object":"",we=Un||typeof H.constructor!="function"?"":H.constructor.name?H.constructor.name+" ":"",Pe=we+(ae||R?"["+Q.call(ee.call([],ae||[],R||[]),": ")+"] ":"");return ln.length===0?Pe+"{}":$r?Pe+"{"+Jt(ln,$r)+"}":Pe+"{ "+Q.call(ln,", ")+" }"}return String(H)};function tt(W,H,ze){var We=(ze.quoteStyle||H)==="double"?'"':"'";return We+W+We}function Tt(W){return C.call(String(W),/"/g,""")}function ft(W){return X(W)==="[object Array]"&&(!ye||!(typeof W=="object"&&ye in W))}function Pt(W){return X(W)==="[object Date]"&&(!ye||!(typeof W=="object"&&ye in W))}function rt(W){return X(W)==="[object RegExp]"&&(!ye||!(typeof W=="object"&&ye in W))}function Ye(W){return X(W)==="[object Error]"&&(!ye||!(typeof W=="object"&&ye in W))}function pt(W){return X(W)==="[object String]"&&(!ye||!(typeof W=="object"&&ye in W))}function Fe(W){return X(W)==="[object Number]"&&(!ye||!(typeof W=="object"&&ye in W))}function wt(W){return X(W)==="[object Boolean]"&&(!ye||!(typeof W=="object"&&ye in W))}function z(W){if(Ie)return W&&typeof W=="object"&&W instanceof Symbol;if(typeof W=="symbol")return!0;if(!W||typeof W!="object"||!ve)return!1;try{return ve.call(W),!0}catch{}return!1}function K(W){if(!W||typeof W!="object"||!ge)return!1;try{return ge.call(W),!0}catch{}return!1}var V=Object.prototype.hasOwnProperty||function(W){return W in this};function J(W,H){return V.call(W,H)}function X(W){return A.call(W)}function G(W){if(W.name)return W.name;var H=w.call(x.call(W),/^function\s*([\w$]+)/);return H?H[1]:null}function Ce(W,H){if(W.indexOf)return W.indexOf(H);for(var ze=0,We=W.length;ze<We;ze++)if(W[ze]===H)return ze;return-1}function Ge(W){if(!t||!W||typeof W!="object")return!1;try{t.call(W);try{u.call(W)}catch{return!0}return W instanceof Map}catch{}return!1}function Ve(W){if(!h||!W||typeof W!="object")return!1;try{h.call(W,h);try{y.call(W,y)}catch{return!0}return W instanceof WeakMap}catch{}return!1}function le(W){if(!m||!W||typeof W!="object")return!1;try{return m.call(W),!0}catch{}return!1}function xe(W){if(!u||!W||typeof W!="object")return!1;try{u.call(W);try{t.call(W)}catch{return!0}return W instanceof Set}catch{}return!1}function Ze(W){if(!y||!W||typeof W!="object")return!1;try{y.call(W,y);try{h.call(W,h)}catch{return!0}return W instanceof WeakSet}catch{}return!1}function At(W){return!W||typeof W!="object"?!1:typeof HTMLElement<"u"&&W instanceof HTMLElement?!0:typeof W.nodeName=="string"&&typeof W.getAttribute=="function"}function _t(W,H){if(W.length>H.maxStringLength){var ze=W.length-H.maxStringLength,We="... "+ze+" more character"+(ze>1?"s":"");return _t(O.call(W,0,H.maxStringLength),H)+We}var kt=C.call(C.call(W,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Qt);return tt(kt,"single",H)}function Qt(W){var H=W.charCodeAt(0),ze={8:"b",9:"t",10:"n",12:"f",13:"r"}[H];return ze?"\\"+ze:"\\x"+(H<16?"0":"")+D.call(H.toString(16))}function mt(W){return"Object("+W+")"}function Ut(W){return W+" { ? }"}function rr(W,H,ze,We){var kt=We?Jt(ze,We):Q.call(ze,", ");return W+" ("+H+") {"+kt+"}"}function Mr(W){for(var H=0;H<W.length;H++)if(Ce(W[H],`
|
|
129
|
+
`)>=0)return!1;return!0}function zt(W,H){var ze;if(W.indent===" ")ze=" ";else if(typeof W.indent=="number"&&W.indent>0)ze=Q.call(Array(W.indent+1)," ");else return null;return{base:ze,prev:Q.call(Array(H+1),ze)}}function Jt(W,H){if(W.length===0)return"";var ze=`
|
|
130
|
+
`+H.prev+H.base;return ze+Q.call(W,","+ze)+`
|
|
131
|
+
`+H.prev}function Zt(W,H){var ze=ft(W),We=[];if(ze){We.length=W.length;for(var kt=0;kt<W.length;kt++)We[kt]=J(W,kt)?H(W[kt],W):""}var Ke=typeof he=="function"?he(W):[],nr;if(Ie){nr={};for(var dr=0;dr<Ke.length;dr++)nr["$"+Ke[dr]]=Ke[dr]}for(var Mt in W)J(W,Mt)&&(ze&&String(Number(Mt))===Mt&&Mt<W.length||Ie&&nr["$"+Mt]instanceof Symbol||(B.call(/[^\w$]/,Mt)?We.push(H(Mt,W)+": "+H(W[Mt],W)):We.push(Mt+": "+H(W[Mt],W))));if(typeof he=="function")for(var Ht=0;Ht<Ke.length;Ht++)Be.call(W,Ke[Ht])&&We.push("["+H(Ke[Ht])+"]: "+H(W[Ke[Ht]],W));return We}return jh}var qh,q0;function ck(){if(q0)return qh;q0=1;var r=da(),e=ak(),t=uk(),n=xo(),i=r("%WeakMap%",!0),a=r("%Map%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("Map.prototype.get",!0),d=e("Map.prototype.set",!0),y=e("Map.prototype.has",!0),g=function(x,w){for(var O=x,C;(C=O.next)!==null;O=C)if(C.key===w)return O.next=C.next,C.next=x.next,x.next=C,C},m=function(x,w){var O=g(x,w);return O&&O.value},b=function(x,w,O){var C=g(x,w);C?C.value=O:x.next={key:w,next:x.next,value:O}},A=function(x,w){return!!g(x,w)};return qh=function(){var w,O,C,D={assert:function(F){if(!D.has(F))throw new n("Side channel does not contain "+t(F))},get:function(F){if(i&&F&&(typeof F=="object"||typeof F=="function")){if(w)return u(w,F)}else if(a){if(O)return h(O,F)}else if(C)return m(C,F)},has:function(F){if(i&&F&&(typeof F=="object"||typeof F=="function")){if(w)return f(w,F)}else if(a){if(O)return y(O,F)}else if(C)return A(C,F);return!1},set:function(F,B){i&&F&&(typeof F=="object"||typeof F=="function")?(w||(w=new i),c(w,F,B)):a?(O||(O=new a),d(O,F,B)):(C||(C={key:{},next:null}),b(C,F,B))}};return D},qh}var Uh,U0;function $h(){if(U0)return Uh;U0=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Uh={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},Uh}var Bh,$0;function B0(){if($0)return Bh;$0=1;var r=$h(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var x=[],w=0;w<256;++w)x.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return x}(),i=function(w){for(;w.length>1;){var O=w.pop(),C=O.obj[O.prop];if(t(C)){for(var D=[],F=0;F<C.length;++F)typeof C[F]<"u"&&D.push(C[F]);O.obj[O.prop]=D}}},a=function(w,O){for(var C=O&&O.plainObjects?Object.create(null):{},D=0;D<w.length;++D)typeof w[D]<"u"&&(C[D]=w[D]);return C},u=function x(w,O,C){if(!O)return w;if(typeof O!="object"){if(t(w))w.push(O);else if(w&&typeof w=="object")(C&&(C.plainObjects||C.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,C)),t(w)&&t(O)?(O.forEach(function(F,B){if(e.call(w,B)){var ee=w[B];ee&&typeof ee=="object"&&F&&typeof F=="object"?w[B]=x(ee,F,C):w.push(F)}else w[B]=F}),w):Object.keys(O).reduce(function(F,B){var ee=O[B];return e.call(F,B)?F[B]=x(F[B],ee,C):F[B]=ee,F},D)},c=function(w,O){return Object.keys(O).reduce(function(C,D){return C[D]=O[D],C},w)},f=function(x,w,O){var C=x.replace(/\+/g," ");if(O==="iso-8859-1")return C.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(C)}catch{return C}},h=1024,d=function(w,O,C,D,F){if(w.length===0)return w;var B=w;if(typeof w=="symbol"?B=Symbol.prototype.toString.call(w):typeof w!="string"&&(B=String(w)),C==="iso-8859-1")return escape(B).replace(/%u[0-9a-f]{4}/gi,function(ve){return"%26%23"+parseInt(ve.slice(2),16)+"%3B"});for(var ee="",Q=0;Q<B.length;Q+=h){for(var re=B.length>=h?B.slice(Q,Q+h):B,fe=[],ge=0;ge<re.length;++ge){var he=re.charCodeAt(ge);if(he===45||he===46||he===95||he===126||he>=48&&he<=57||he>=65&&he<=90||he>=97&&he<=122||F===r.RFC1738&&(he===40||he===41)){fe[fe.length]=re.charAt(ge);continue}if(he<128){fe[fe.length]=n[he];continue}if(he<2048){fe[fe.length]=n[192|he>>6]+n[128|he&63];continue}if(he<55296||he>=57344){fe[fe.length]=n[224|he>>12]+n[128|he>>6&63]+n[128|he&63];continue}ge+=1,he=65536+((he&1023)<<10|re.charCodeAt(ge)&1023),fe[fe.length]=n[240|he>>18]+n[128|he>>12&63]+n[128|he>>6&63]+n[128|he&63]}ee+=fe.join("")}return ee},y=function(w){for(var O=[{obj:{o:w},prop:"o"}],C=[],D=0;D<O.length;++D)for(var F=O[D],B=F.obj[F.prop],ee=Object.keys(B),Q=0;Q<ee.length;++Q){var re=ee[Q],fe=B[re];typeof fe=="object"&&fe!==null&&C.indexOf(fe)===-1&&(O.push({obj:B,prop:re}),C.push(fe))}return i(O),w},g=function(w){return Object.prototype.toString.call(w)==="[object RegExp]"},m=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)},A=function(w,O){if(t(w)){for(var C=[],D=0;D<w.length;D+=1)C.push(O(w[D]));return C}return O(w)};return Bh={arrayToObject:a,assign:c,combine:b,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:A,merge:u},Bh}var Vh,V0;function lk(){if(V0)return Vh;V0=1;var r=ck(),e=B0(),t=$h(),n=Object.prototype.hasOwnProperty,i={brackets:function(x){return x+"[]"},comma:"comma",indices:function(x,w){return x+"["+w+"]"},repeat:function(x){return x}},a=Array.isArray,u=Array.prototype.push,c=function(A,x){u.apply(A,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 A(x,w,O,C,D,F,B,ee,Q,re,fe,ge,he,ve,Ie,ye,Be,_e){for(var ce=x,Ae=_e,Me=0,Oe=!1;(Ae=Ae.get(g))!==void 0&&!Oe;){var tt=Ae.get(x);if(Me+=1,typeof tt<"u"){if(tt===Me)throw new RangeError("Cyclic object value");Oe=!0}typeof Ae.get(g)>"u"&&(Me=0)}if(typeof re=="function"?ce=re(w,ce):ce instanceof Date?ce=he(ce):O==="comma"&&a(ce)&&(ce=e.maybeMap(ce,function(X){return X instanceof Date?he(X):X})),ce===null){if(F)return Q&&!ye?Q(w,d.encoder,Be,"key",ve):w;ce=""}if(y(ce)||e.isBuffer(ce)){if(Q){var Tt=ye?w:Q(w,d.encoder,Be,"key",ve);return[Ie(Tt)+"="+Ie(Q(ce,d.encoder,Be,"value",ve))]}return[Ie(w)+"="+Ie(String(ce))]}var ft=[];if(typeof ce>"u")return ft;var Pt;if(O==="comma"&&a(ce))ye&&Q&&(ce=e.maybeMap(ce,Q)),Pt=[{value:ce.length>0?ce.join(",")||null:void 0}];else if(a(re))Pt=re;else{var rt=Object.keys(ce);Pt=fe?rt.sort(fe):rt}var Ye=ee?w.replace(/\./g,"%2E"):w,pt=C&&a(ce)&&ce.length===1?Ye+"[]":Ye;if(D&&a(ce)&&ce.length===0)return pt+"[]";for(var Fe=0;Fe<Pt.length;++Fe){var wt=Pt[Fe],z=typeof wt=="object"&&typeof wt.value<"u"?wt.value:ce[wt];if(!(B&&z===null)){var K=ge&&ee?wt.replace(/\./g,"%2E"):wt,V=a(ce)?typeof O=="function"?O(pt,K):pt:pt+(ge?"."+K:"["+K+"]");_e.set(x,Me);var J=r();J.set(g,_e),c(ft,A(z,V,O,C,D,F,B,ee,O==="comma"&&ye&&a(ce)?null:Q,re,fe,ge,he,ve,Ie,ye,Be,J))}}return ft},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 w=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 O=t.default;if(typeof x.format<"u"){if(!n.call(t.formatters,x.format))throw new TypeError("Unknown format option provided.");O=x.format}var C=t.formatters[O],D=d.filter;(typeof x.filter=="function"||a(x.filter))&&(D=x.filter);var F;if(x.arrayFormat in i?F=x.arrayFormat:"indices"in x?F=x.indices?"indices":"repeat":F=d.arrayFormat,"commaRoundTrip"in x&&typeof x.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var B=typeof x.allowDots>"u"?x.encodeDotInKeys===!0?!0:d.allowDots:!!x.allowDots;return{addQueryPrefix:typeof x.addQueryPrefix=="boolean"?x.addQueryPrefix:d.addQueryPrefix,allowDots:B,allowEmptyArrays:typeof x.allowEmptyArrays=="boolean"?!!x.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:F,charset:w,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:D,format:O,formatter:C,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 Vh=function(A,x){var w=A,O=b(x),C,D;typeof O.filter=="function"?(D=O.filter,w=D("",w)):a(O.filter)&&(D=O.filter,C=D);var F=[];if(typeof w!="object"||w===null)return"";var B=i[O.arrayFormat],ee=B==="comma"&&O.commaRoundTrip;C||(C=Object.keys(w)),O.sort&&C.sort(O.sort);for(var Q=r(),re=0;re<C.length;++re){var fe=C[re];O.skipNulls&&w[fe]===null||c(F,m(w[fe],fe,B,ee,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 ge=F.join(O.delimiter),he=O.addQueryPrefix===!0?"?":"";return O.charsetSentinel&&(O.charset==="iso-8859-1"?he+="utf8=%26%2310003%3B&":he+="utf8=%E2%9C%93&"),ge.length>0?he+ge:""},Vh}var Wh,W0;function fk(){if(W0)return Wh;W0=1;var r=B0(),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 A={__proto__:null},x=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;x=x.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var w=b.parameterLimit===1/0?void 0:b.parameterLimit,O=x.split(b.delimiter,w),C=-1,D,F=b.charset;if(b.charsetSentinel)for(D=0;D<O.length;++D)O[D].indexOf("utf8=")===0&&(O[D]===c?F="utf-8":O[D]===u&&(F="iso-8859-1"),C=D,D=O.length);for(D=0;D<O.length;++D)if(D!==C){var B=O[D],ee=B.indexOf("]="),Q=ee===-1?B.indexOf("="):ee+1,re,fe;Q===-1?(re=b.decoder(B,n.decoder,F,"key"),fe=b.strictNullHandling?null:""):(re=b.decoder(B.slice(0,Q),n.decoder,F,"key"),fe=r.maybeMap(a(B.slice(Q+1),b),function(he){return b.decoder(he,n.decoder,F,"value")})),fe&&b.interpretNumericEntities&&F==="iso-8859-1"&&(fe=i(fe)),B.indexOf("[]=")>-1&&(fe=t(fe)?[fe]:fe);var ge=e.call(A,re);ge&&b.duplicates==="combine"?A[re]=r.combine(A[re],fe):(!ge||b.duplicates==="last")&&(A[re]=fe)}return A},h=function(g,m,b,A){for(var x=A?m:a(m,b),w=g.length-1;w>=0;--w){var O,C=g[w];if(C==="[]"&&b.parseArrays)O=b.allowEmptyArrays&&(x===""||b.strictNullHandling&&x===null)?[]:[].concat(x);else{O=b.plainObjects?Object.create(null):{};var D=C.charAt(0)==="["&&C.charAt(C.length-1)==="]"?C.slice(1,-1):C,F=b.decodeDotInKeys?D.replace(/%2E/g,"."):D,B=parseInt(F,10);!b.parseArrays&&F===""?O={0:x}:!isNaN(B)&&C!==F&&String(B)===F&&B>=0&&b.parseArrays&&B<=b.arrayLimit?(O=[],O[B]=x):F!=="__proto__"&&(O[F]=x)}x=O}return x},d=function(m,b,A,x){if(m){var w=A.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,O=/(\[[^[\]]*])/,C=/(\[[^[\]]*])/g,D=A.depth>0&&O.exec(w),F=D?w.slice(0,D.index):w,B=[];if(F){if(!A.plainObjects&&e.call(Object.prototype,F)&&!A.allowPrototypes)return;B.push(F)}for(var ee=0;A.depth>0&&(D=C.exec(w))!==null&&ee<A.depth;){if(ee+=1,!A.plainObjects&&e.call(Object.prototype,D[1].slice(1,-1))&&!A.allowPrototypes)return;B.push(D[1])}if(D){if(A.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+A.depth+" and strictDepth is true");B.push("["+w.slice(D.index)+"]")}return h(B,b,A,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,A=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(A!=="combine"&&A!=="first"&&A!=="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:A,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 Wh=function(g,m){var b=y(m);if(g===""||g===null||typeof g>"u")return b.plainObjects?Object.create(null):{};for(var A=typeof g=="string"?f(g,b):g,x=b.plainObjects?Object.create(null):{},w=Object.keys(A),O=0;O<w.length;++O){var C=w[O],D=d(C,A[C],b,typeof g=="string");x=r.merge(x,D,b)}return b.allowSparse===!0?x:r.compact(x)},Wh}var zh,z0;function hk(){if(z0)return zh;z0=1;var r=lk(),e=fk(),t=$h();return zh={formats:t,parse:e,stringify:r},zh}(function(r,e){(function(t,n){n(e,WA,zA,hk())})(pi,function(t,n,i,a){var u=function(z,K,V,J){function X(G){return G instanceof V?G:new V(function(Ce){Ce(G)})}return new(V||(V=Promise))(function(G,Ce){function Ge(xe){try{le(J.next(xe))}catch(Ze){Ce(Ze)}}function Ve(xe){try{le(J.throw(xe))}catch(Ze){Ce(Ze)}}function le(xe){xe.done?G(xe.value):X(xe.value).then(Ge,Ve)}le((J=J.apply(z,K||[])).next())})},c=function(z,K){var V={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},J,X,G,Ce;return Ce={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(Ce[Symbol.iterator]=function(){return this}),Ce;function Ge(le){return function(xe){return Ve([le,xe])}}function Ve(le){if(J)throw new TypeError("Generator is already executing.");for(;V;)try{if(J=1,X&&(G=le[0]&2?X.return:le[0]?X.throw||((G=X.return)&&G.call(X),0):X.next)&&!(G=G.call(X,le[1])).done)return G;switch(X=0,G&&(le=[le[0]&2,G.value]),le[0]){case 0:case 1:G=le;break;case 4:return V.label++,{value:le[1],done:!1};case 5:V.label++,X=le[1],le=[0];continue;case 7:le=V.ops.pop(),V.trys.pop();continue;default:if(G=V.trys,!(G=G.length>0&&G[G.length-1])&&(le[0]===6||le[0]===2)){V=0;continue}if(le[0]===3&&(!G||le[1]>G[0]&&le[1]<G[3])){V.label=le[1];break}if(le[0]===6&&V.label<G[1]){V.label=G[1],G=le;break}if(G&&V.label<G[2]){V.label=G[2],V.ops.push(le);break}G[2]&&V.ops.pop(),V.trys.pop();continue}le=K.call(z,V)}catch(xe){le=[6,xe],X=0}finally{J=G=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}};function f(z,K){if(z.directives&&z.directives.length){var V={};return z.directives.forEach(function(J){V[J.name.value]=i.argumentsObjectFromField(J,K)}),V}return null}var h=Object.prototype.hasOwnProperty;function d(z,K){K!==null&&typeof K=="object"&&Object.keys(K).forEach(function(V){var J=K[V];h.call(z,V)?d(z[V],J):z[V]=J})}function y(z,K,V,J,X,G){G===void 0&&(G={});var Ce=i.getMainDefinition(K),Ge=i.getFragmentDefinitions(K),Ve=i.createFragmentMap(Ge),le=G.resultMapper,xe=G.fragmentMatcher||function(){return!0},Ze={fragmentMap:Ve,contextValue:J,variableValues:X,resultMapper:le,resolver:z,fragmentMatcher:xe};return g(Ce.selectionSet,V,Ze)}function g(z,K,V){return u(this,void 0,void 0,function(){var J,X,G,Ce,Ge,Ve=this;return c(this,function(le){switch(le.label){case 0:return J=V.fragmentMap,X=V.contextValue,G=V.variableValues,Ce={},Ge=function(xe){return u(Ve,void 0,void 0,function(){var Ze,At,_t,Qt,mt;return c(this,function(Ut){switch(Ut.label){case 0:return i.shouldInclude(xe,G)?i.isField(xe)?[4,m(xe,K,V)]:[3,2]:[2];case 1:return Ze=Ut.sent(),At=i.resultKeyNameFromField(xe),Ze!==void 0&&(Ce[At]===void 0?Ce[At]=Ze:d(Ce[At],Ze)),[2];case 2:if(i.isInlineFragment(xe))_t=xe;else if(_t=J[xe.name.value],!_t)throw new Error("No fragment named "+xe.name.value);return Qt=_t.typeCondition.name.value,V.fragmentMatcher(K,Qt,X)?[4,g(_t.selectionSet,K,V)]:[3,4];case 3:mt=Ut.sent(),d(Ce,mt),Ut.label=4;case 4:return[2]}})})},[4,Promise.all(z.selections.map(Ge))];case 1:return le.sent(),V.resultMapper?[2,V.resultMapper(Ce,K)]:[2,Ce]}})})}function m(z,K,V){return u(this,void 0,void 0,function(){var J,X,G,Ce,Ge,Ve,le;return c(this,function(xe){switch(xe.label){case 0:return J=V.variableValues,X=V.contextValue,G=V.resolver,Ce=z.name.value,Ge=i.argumentsObjectFromField(z,J),Ve={isLeaf:!z.selectionSet,resultKey:i.resultKeyNameFromField(z),directives:f(z,J),field:z},[4,G(Ce,K,Ge,X,Ve)];case 1:return le=xe.sent(),z.selectionSet?le==null?[2,le]:Array.isArray(le)?[2,b(z,le,V)]:[2,g(z.selectionSet,le,V)]:[2,le]}})})}function b(z,K,V){return Promise.all(K.map(function(J){return J===null?null:Array.isArray(J)?b(z,J,V):g(z.selectionSet,J,V)}))}var A=function(){var z=function(K,V){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,X){J.__proto__=X}||function(J,X){for(var G in X)X.hasOwnProperty(G)&&(J[G]=X[G])},z(K,V)};return function(K,V){z(K,V);function J(){this.constructor=K}K.prototype=V===null?Object.create(V):(J.prototype=V.prototype,new J)}}(),x=function(){return x=Object.assign||function(z){for(var K,V=1,J=arguments.length;V<J;V++){K=arguments[V];for(var X in K)Object.prototype.hasOwnProperty.call(K,X)&&(z[X]=K[X])}return z},x.apply(this,arguments)},w=function(z,K,V,J){function X(G){return G instanceof V?G:new V(function(Ce){Ce(G)})}return new(V||(V=Promise))(function(G,Ce){function Ge(xe){try{le(J.next(xe))}catch(Ze){Ce(Ze)}}function Ve(xe){try{le(J.throw(xe))}catch(Ze){Ce(Ze)}}function le(xe){xe.done?G(xe.value):X(xe.value).then(Ge,Ve)}le((J=J.apply(z,K||[])).next())})},O=function(z,K){var V={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},J,X,G,Ce;return Ce={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(Ce[Symbol.iterator]=function(){return this}),Ce;function Ge(le){return function(xe){return Ve([le,xe])}}function Ve(le){if(J)throw new TypeError("Generator is already executing.");for(;V;)try{if(J=1,X&&(G=le[0]&2?X.return:le[0]?X.throw||((G=X.return)&&G.call(X),0):X.next)&&!(G=G.call(X,le[1])).done)return G;switch(X=0,G&&(le=[le[0]&2,G.value]),le[0]){case 0:case 1:G=le;break;case 4:return V.label++,{value:le[1],done:!1};case 5:V.label++,X=le[1],le=[0];continue;case 7:le=V.ops.pop(),V.trys.pop();continue;default:if(G=V.trys,!(G=G.length>0&&G[G.length-1])&&(le[0]===6||le[0]===2)){V=0;continue}if(le[0]===3&&(!G||le[1]>G[0]&&le[1]<G[3])){V.label=le[1];break}if(le[0]===6&&V.label<G[1]){V.label=G[1],G=le;break}if(G&&V.label<G[2]){V.label=G[2],V.ops.push(le);break}G[2]&&V.ops.pop(),V.trys.pop();continue}le=K.call(z,V)}catch(xe){le=[6,xe],X=0}finally{J=G=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}},C=function(){for(var z=0,K=0,V=arguments.length;K<V;K++)z+=arguments[K].length;for(var J=Array(z),X=0,K=0;K<V;K++)for(var G=arguments[K],Ce=0,Ge=G.length;Ce<Ge;Ce++,X++)J[X]=G[Ce];return J},D=function(z){var K=z.replace(/\s/g,""),V=K.replace(/\[(.*)\]/,function(J,X,G,Ce){return((X!=null&&X.length)>0?X:null)||K});return V},F=function(z,K,V,J){if(Array.isArray(z)){var X=D(K);return z.map(function(G){return F(G,X,V,J)})}return z==null||typeof z=="number"||typeof z=="boolean"||typeof z=="string"?z:V(z,K,V,J)},B=function(z){return z.directives&&z.directives.length?z.directives.find(function(K){return K.name.value==="rest"}):null};function ee(z,K,V,J,X){return X==null||K==null||typeof K=="number"||typeof K=="boolean"||typeof K=="string"||X.selections.forEach(function(G){if(i.isInlineFragment(G))ee(z,K,V,J,G.selectionSet);else if(G.kind==="FragmentSpread"){var Ce=J[G.name.value];ee(z,K,V,J,Ce.selectionSet)}else if(i.isField(G)){var Ge=i.resultKeyNameFromField(G);Ge===z&&B(G)!=null?Q(K,V,J,G.selectionSet):ee(z,K,V,J,G.selectionSet)}else return function(Ve){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),K}function Q(z,K,V,J){if(!(z==null||typeof z=="number"||typeof z=="boolean"||typeof z=="string")){if(Array.isArray(z)){z.forEach(function(X){return Q(X,K,V,J)});return}J.selections.forEach(function(X){if(i.isInlineFragment(X))Q(z,K,V,X.selectionSet);else if(X.kind==="FragmentSpread"){var G=V[X.name.value];Q(z,K,V,G.selectionSet)}else if(i.isField(X)){var Ce=z[X.name.value];X.name.value==="__typename"||(typeof Ce>"u"?z[X.name.value]=null:Ce!=null&&typeof Ce=="object"&&X.selectionSet!=null&&Q(Ce,K,V,X.selectionSet))}else return function(Ge){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var re=function(z,K){var V=z[K||rt]||z[rt];return typeof V=="string"?{uri:V}:x({responseTransformer:null},V)},fe=function(z,K,V){return V===void 0||K===void 0?z:z.replace(":"+K,V)},ge=function(){function z(){}return z.replacerForPath=function(K){if(K in z.cache)return z.cache[K];var V=K.indexOf("?"),J=K.split(z.argReplacement),X=[],G=!1;J.reduce(function(Ge,Ve){if(Ve===""||Ve==="{}")return Ge+Ve.length;var le=Ge+Ve.length;if(Ve[0]==="{"&&Ve[Ve.length-1]==="}"){var xe=Ve.slice(1,Ve.length-1).split(".");X.push(function(Ze,At){try{var _t=he(Ze,xe);return!At||typeof _t!="object"||_t==null?String(_t):a.stringify(_t)}catch{var Qt=[K,xe.join(".")].join("|");return Qt in z.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."),z.warnTable[Qt]=!0),""}})}else X.push(Ve),!G&&le>=V&&(G=!0,X.push(!0));return le},0);var Ce=function(Ge){var Ve=!1,le=X.reduce(function(xe,Ze){return typeof Ze=="string"?xe+Ze:typeof Ze=="boolean"?(Ve=!0,xe):xe+Ze(Ge,Ve)},"");return le};return z.cache[K]=Ce},z.cache={},z.warnTable={},z.argReplacement=/({[._a-zA-Z0-9]*})/,z}();function he(z,K){if(K.length===0)return z;var V=C(K),J=V.shift();return he(z[J],V)}var ve=["__typename"],Ie=typeof globalThis=="object"&&globalThis||pi,ye=function(z,K,V){V===void 0&&(V=[]);var J=null;return K.length!=2?J=function(X,G){return K(X)}:J=K,Array.isArray(z)?z.map(function(X,G){return ye(X,J,C(V,[String(G)]))}):z==null||typeof z!="object"||z.constructor!==Object||Ie.FileList&&z instanceof FileList||Ie.File&&z instanceof File?z:Object.keys(z).reduce(function(X,G){var Ce=z[G];if(ve.indexOf(G)!==-1)return X[G]=Ce,X;var Ge=C(V,[G]);return X[J(G,Ge)]=ye(Ce,J,Ge),X},{})},Be=function(z){return z},_e=function(z){return z instanceof Headers?z:new Headers(z||{})},ce=function(){for(var z=[],K=0;K<arguments.length;K++)z[K]=arguments[K];return z.reduce(function(V,J){return J&&(J.forEach||(J=_e(J)),J.forEach(function(X,G){V.append(G,X)})),V},new Headers)},Ae=function(z,K,V){var J=new Headers;return z.forEach(function(X,G){K.indexOf(G)===-1&&J.append(G,X)}),ce(J,V||new Headers)},Me=function(z){return function(K,V){return Ae(K,z,V)}},Oe=["GET","POST","PUT","PATCH","DELETE"],tt=function(z,K){switch(K){case"query":if(Oe.indexOf(z.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+z+'".');case"mutation":if(Oe.indexOf(z.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 V=K;return V}},Tt=function(z,K,V){var J=new Error(V);throw J.response=z,J.statusCode=z.status,J.result=K,J},ft=function(z,K){return z==null||typeof z!="object"?z:Array.isArray(z)?z.map(function(V){return ft(V,K)}):(z.__typename=K,z)},Pt=function(z,K,V,J,X){return w(void 0,void 0,void 0,function(){var G,Ce,Ge,Ve,le,xe,Ze,At,_t,Qt,mt,Ut,rr,Mr,zt,Jt,Zt,W,H,ze,We,kt,Ke,nr,dr,Mt,Ht,Ur,$r,ir,cn,Sr,Er,Or,Ar,cr,Hr,kr,Tr,Fr,ln,Un,R,ae,we,Pe,Ue,ot,st,nt;return O(this,function(it){switch(it.label){case 0:if(G=X.directives,Ce=X.isLeaf,Ge=X.resultKey,Ve=J.exportVariablesByNode,le=Ve.get(K)||{},xe=function(xt){return xt instanceof Array?xt.forEach(xe):Ve.set(xt,x({},le)),xt},Ze=(K||{})[Ge],At=(K||{})[z],K&&G&&G.export&&(le[G.export.as]=At),_t=G&&G.type,!Ce&&_t){if(G.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return xe(At),[2,ft(At,G.type.name)]}if(Qt=!G||!G.rest,Qt)return[2,xe(Ze||At)];if(mt=J.credentials,Ut=J.endpoints,rr=J.headers,Mr=J.customFetch,zt=J.operationType,Jt=J.typePatcher,Zt=J.mainDefinition,W=J.fragmentDefinitions,H=J.fieldNameNormalizer,ze=J.fieldNameDenormalizer,We=J.serializers,kt=J.responseTransformer,Ke=i.createFragmentMap(W),nr=G.rest,dr=nr.path,Mt=nr.endpoint,Ht=nr.pathBuilder,Ur=re(Ut,Mt),$r=dr==null&&Ht==null,$r)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Ht||(dr.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Ht=function(xt){var _=xt.args,I=xt.exportVariables,k=x(x({},_),I),P=Object.keys(k).reduce(function(M,U){return fe(M,U,k[U])},dr);if(P.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 P}):Ht=ge.replacerForPath(dr)),ir={args:V,exportVariables:le,context:J,"@rest":G.rest,replacer:Ht},cn=Ht(ir),Sr=G.rest,Er=Sr.method,Or=Sr.type,Ar=Sr.bodyBuilder,cr=Sr.bodyKey,Hr=Sr.fieldNameDenormalizer,kr=Sr.fieldNameNormalizer,Tr=Sr.bodySerializer,Er||(Er="GET"),cr||(cr="input"),Fr=void 0,ln=void 0,["GET","DELETE"].indexOf(Er)===-1){if(!Ar){if(Un=ir.exportVariables[cr]||ir.args&&ir.args[cr],!Un)throw new Error("[GraphQL "+Er+" "+zt+" using a REST call without a body]. No `"+cr+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Ar=function(xt){return Un}}if(Fr=ye(Ar(ir),Hr||ze||Be),R=void 0,typeof Tr=="string"){if(!We.hasOwnProperty(Tr))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+Tr+' in the "bodySerializers" property of the RestLink.'));R=We[Tr](Fr,rr)}else R=Tr?Tr(Fr,rr):We[Ye](Fr,rr);Fr=R.body,ln=new Headers(R.headers)}return tt(Er,zt||"query"),ae=x({method:Er,headers:ln||rr,body:Fr},mt?{credentials:mt}:{}),we=""+Ur.uri+cn,[4,(Mr||fetch)(we,ae)];case 1:return Pe=it.sent(),J.responses.push(Pe),Pe.ok?(Pe.status===204||Pe.headers.get("Content-Length")==="0"?Ue={}:Ue=Pe,[3,9]):[3,2];case 2:return Pe.status!==404?[3,3]:(Ue=null,[3,9]);case 3:ot=void 0,it.label=4;case 4:return it.trys.push([4,6,,8]),[4,Pe.clone().json()];case 5:return ot=it.sent(),[3,8];case 6:return it.sent(),[4,Pe.clone().text()];case 7:return ot=it.sent(),[3,8];case 8:Tt(Pe,ot,"Response not successful: Received status code "+Pe.status),it.label=9;case 9:if(st=Ur.responseTransformer||kt,!st)return[3,14];it.label=10;case 10:return it.trys.push([10,12,,13]),[4,st(Ue,Or)];case 11:return Ue=it.sent(),[3,13];case 12:throw nt=it.sent(),console.warn("An error occurred in a responseTransformer:"),nt;case 13:return[3,16];case 14:return Ue&&Ue.json?[4,Ue.json()]:[3,16];case 15:Ue=it.sent(),it.label=16;case 16:return Ue=ye(Ue,kr||H||Be),Ue=ee(Ge,Ue,Zt,Ke,Zt.selectionSet),Ue=F(Ue,Or,Jt,{resolverParams:{fieldName:z,root:K,args:V,context:J,info:X}}),[2,xe(Ue)]}})})},rt="",Ye="",pt=function(z,K){return K.has("content-type")||K.append("Content-Type","application/json"),{body:JSON.stringify(z),headers:K}},Fe={test:function(z){return z.name.value==="rest"},remove:!0},wt=function(z){A(K,z);function K(V){var J,X=V.uri,G=V.endpoints,Ce=V.headers,Ge=V.fieldNameNormalizer,Ve=V.fieldNameDenormalizer,le=V.typePatcher,xe=V.customFetch,Ze=V.credentials,At=V.bodySerializers,_t=V.defaultSerializer,Qt=V.responseTransformer,mt=z.call(this)||this,Ut={};if(Ut[rt]=X||"",mt.endpoints=Object.assign({},G||Ut),X==null&&G==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(X!=null){var rr=(G||{})[rt];if(rr!=null&&rr!=X)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");mt.endpoints[rt]=X}if(mt.endpoints[rt]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),le==null)mt.typePatcher=function(zt,Jt,Zt){return x({__typename:Jt},zt)};else if(!Array.isArray(le)&&typeof le=="object"&&Object.keys(le).map(function(zt){return le[zt]}).reduce(function(zt,Jt){return zt&&typeof Jt=="function"},!0)){var Mr=le;mt.typePatcher=function(zt,Jt,Zt,W){var H=zt.__typename||Jt;if(Array.isArray(zt))return zt.map(function(We){return Zt(We,H,Zt,W)});var ze=Mr[H]||function(We){return We};return x({__typename:H},ze(zt,H,Zt,W))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return At&&At.hasOwnProperty(Ye)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),mt.responseTransformer=Qt||null,mt.fieldNameNormalizer=Ge||null,mt.fieldNameDenormalizer=Ve||null,mt.headers=_e(Ce),mt.credentials=Ze||null,mt.customFetch=xe,mt.serializers=x((J={},J[Ye]=_t||pt,J),At||{}),mt.processedDocuments=new Map,mt}return K.prototype.removeRestSetsFromDocument=function(V){var J=this.processedDocuments.get(V);if(J)return J;i.checkDocument(V);var X=i.removeDirectivesFromDocument([Fe],V);return this.processedDocuments.set(V,X),X},K.prototype.request=function(V,J){var X=V.query,G=V.variables,Ce=V.getContext,Ge=V.setContext,Ve=Ce(),le=i.hasDirectives(["rest"],X);if(!le)return J(V);var xe=this.removeRestSetsFromDocument(X),Ze=Ve.headersMergePolicy;Ze==null&&Array.isArray(Ve.headersToOverride)?Ze=Me(Ve.headersToOverride):Ze==null&&(Ze=ce);var At=Ze(this.headers,Ve.headers);At.has("Accept")||At.append("Accept","application/json");var _t=Ve.credentials||this.credentials,Qt=i.addTypenameToDocument(X),mt=i.getMainDefinition(X),Ut=i.getFragmentDefinitions(X),rr=(mt||{}).operation||"query",Mr={headers:At,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:_t,customFetch:this.customFetch,operationType:rr,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:mt,fragmentDefinitions:Ut,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},zt={},Jt;return xe&&J?(V.query=xe,Jt=J(V)):Jt=n.Observable.of({data:{}}),Jt.flatMap(function(Zt){var W=Zt.data,H=Zt.errors;return new n.Observable(function(ze){y(Pt,Qt,W,Mr,G,zt).then(function(We){Ge({restResponses:(Ve.restResponses||[]).concat(Mr.responses)}),ze.next({data:We,errors:H}),ze.complete()}).catch(function(We){We.name!=="AbortError"&&(We.result&&We.result.errors&&ze.next(We.result),ze.error(We))})})})},K}(n.ApolloLink);t.RestLink=wt,t.PathBuilder=ge,Object.defineProperty(t,"__esModule",{value:!0})})})(ph,ph.exports);var dk=ph.exports;const tc=me.createContext(),pk=()=>{const{isAuthenticated:r,login:e}=ti(),{children:t,isEmbedded:n,setIsEmbedded:i}=me.useContext(tc),a=mn.useNavigate(),u=mn.useLocation(),[c,f]=me.useState(!1),[h,d]=me.useState(),[y,g]=me.useState(),[m,b]=me.useState({}),[A,x]=me.useState({}),[w,O]=me.useState({}),[C,D]=me.useState(!1);me.useEffect(()=>{if(!(!u||u.pathname!=="/mm-embedded-login")){if(r){window.close();return}r===!1&&e()}},[u]),me.useEffect(()=>{var Ie,ye;if(r===null||!u||u.pathname!=="/mm-embedded-interop")return;const ge=new URLSearchParams(u.search),he=ge.get("id"),ve=ge.get("origin");if(ve){const Be=(Ie=new URL(ve))==null?void 0:Ie.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Be))d(ve);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(ve){const Be={instanceId:he,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login`,origin:ve};if(((ye=new URL(ve))==null?void 0:ye.protocol)==="http:"){window.parent.postMessage({type:"login",...Be},ve);return}e({mm_instanceId:Be.instanceId,mm_authUrl:Be.authUrl,mm_origin:Be.origin});return}e();return}he&&g(he),he&&ve&&i(!0)},[u,r]),mn.useBlocker(({nextLocation:ge})=>{var he;return n?(he=ge.state)!=null&&he.fromParent?(f(!0),!1):(F(`${ge.pathname}${ge.search}`),!0):!1}),me.useEffect(()=>{if(!n||!h)return;const ge=he=>{he.metaKey&&he.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:y},h)};return window.addEventListener("keydown",ge),()=>{window.removeEventListener("keydown",ge)}},[n,h]),me.useEffect(()=>{if(!n||!h)return;const ge=({origin:he,data:ve})=>{var Ie,ye;if(he===h)switch(ve.type){case"navigate":a(ve.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":b(ve.context||{});break;case"set-configuring":D(ve.isConfiguring);break;case"load-options":(Ie=A[ve.name])==null||Ie.call(A,{filter:ve.filter});break;case"validate":(ye=w[ve.name])==null||ye.call(w,{value:ve.value});break}};return window.addEventListener("message",ge),!c&&r&&window.parent.postMessage({type:"ready",instanceId:y},h),()=>{window.removeEventListener("message",ge)}},[a,c,n,r,h,A,w]);const F=ge=>{!c&&!r||window.parent.postMessage({type:"set-path",instanceId:y,path:ge},h)},B=ge=>{c&&window.parent.postMessage({type:"set-summary",instanceId:y,summary:ge},h)},ee=ge=>{c&&window.parent.postMessage({type:"toast",instanceId:y,message:ge},h)},Q=ge=>{c&&window.parent.postMessage({type:"popup",instanceId:y,message:ge},h)},re=async(ge,he)=>{c&&(he.validate&&typeof he.validate=="function"&&O(ve=>{const Ie=async ye=>{const Be=await he.validate(ye);window.parent.postMessage({type:"set-validation",instanceId:y,name:ge,validation:Be},h)};return ve[ge]&&Ie({value:""}),{...ve,[ge]:Ie}}),he.options&&x(ve=>{const Ie=async ye=>{const _e=await(typeof he.options=="function"?he.options:()=>he.options)(ye);window.parent.postMessage({type:"set-options",instanceId:y,name:ge,options:_e},h)};return ve[ge]&&Ie({filter:""}),{...ve,[ge]:Ie}}),window.parent.postMessage({type:"add-setting",instanceId:y,setting:{name:ge,...he,options:void 0,validate:void 0}},h))},fe=me.useMemo(()=>({isEmbedded:n,isConfiguring:C,navigateParent:F,setSummary:B,toast:ee,popup:Q,context:m,addSetting:re}),[n,C,F,B,ee,Q,m,re]);return ar.jsx(fa.Provider,{value:fe,children:u.pathname!=="/mm-embedded-interop"&&u.pathname!=="/mm-embedded-login"?t:ar.jsx(ar.Fragment,{})})},mk=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=me.useContext(tc),[a,u]=me.useState(),[c,f]=me.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};me.useEffect(()=>{const g=new FA($A({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=p0(({operation:C,networkError:D,forward:F})=>(Bi(C.query).operation==="subscription"&&D&&g.client.terminate(),F(C))),A=d0(async(C,{headers:D})=>({headers:{...D,Authorization:`Bearer ${e.current}`,...d()}})).concat(of({uri:`https:${h()}`,fetch:window.fetch})),x=m.split(({query:C})=>{const D=Bi(C);return D.kind==="OperationDefinition"&&D.operation==="subscription"},g,A),O=d0(async(C,{headers:D})=>({headers:{...D,Authorization:`Bearer ${t}`}})).concat(new dk.RestLink({uri:r.apiUrl}));f(Yr.from([O,x]))},[]),me.useEffect(()=>{c&&u(new If({link:c,cache:new Ef}))},[c]);const y=me.useMemo(()=>({link:c}),[c]);return ar.jsx(Wv.Provider,{value:y,children:a?ar.jsx(FO,{client:a,children:ar.jsx(tA,{children:ar.jsx(pk,{children:i})})}):ar.jsx(ar.Fragment,{})})},yk=Cp.div`
|
|
132
132
|
text-align: center;
|
|
133
133
|
padding-top: 200px;
|
|
134
|
-
`,H0=({loadError:r})=>{const e=
|
|
134
|
+
`,H0=({loadError:r})=>{const e=NA();return r?ar.jsx(yk,{children:r}):(o0(),ar.jsx(mn.Navigate,{replace:!0,to:e||"/"}))},gk=Cp.div`
|
|
135
135
|
font-size: 20px;
|
|
136
136
|
text-align: center;
|
|
137
137
|
margin-top: 300px;
|
|
138
|
-
`,mk=()=>{const[r,e]=pe.useState(),{isAuthenticated:t}=ti(),{authorize:n,isEmbedded:i}=pe.useContext(Xu);return vo(async a=>{try{await n(a)}catch(u){console.log(u),e("Login Failed. Try again.")}},[]),r?or.jsx(H0,{loadError:r}):t?or.jsx(H0,{}):or.jsx(pk,{children:i?"":"Authorizing"})},zh={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://development.graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"},demo:{loginUrl:"https://login-demo.machinemetrics.com",appUrl:"https://demo.machinemetrics.com",apiUrl:"https://api-demo.machinemetrics.com",graphQLUrl:"https://development.graphql.machinemetrics.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://development.graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},yk=pn.createBrowserRouter([{path:"/authorize/mm/callback",element:or.jsx(mk,{})},{path:"/*",element:or.jsx(hk,{})}]),gk=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,graphQLRoleOverride:u,urls:c})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");const[f,h]=pe.useState(!1);let d;if(zh[a])d=zh[a];else{const J=bi.keys(zh).join(", ");throw Error(`MMProvider releaseStage must be one of the following: ${J}`)}d=bi.merge(d,c);const[y,g]=pe.useState(AA());pe.useEffect(()=>{kA(y)},[y]);const m=()=>{const J=TA();u0(J),o0(window.location.pathname+window.location.search);const fe=(ve=>bi.map(ve,(De,je)=>`${je}=${De}`).join("&"))({response_type:"code",state:J,scope:t,ttl:1209600,client_id:n,redirect_uri:`${window.location.origin}/authorize/mm/callback`}),qe=`${d.loginUrl}/oauth/authorize?${fe}`;window.location=qe},b=async J=>{const ue=xA.parse(window.location.search),fe=ue.code;if(ue.state!==PA())throw Error("Oops");const qe={grant_type:"authorization_code",client_id:n,client_secret:i,code:fe,redirect_uri:`${window.location.origin}/authorize/mm/callback`},ve=await c0(`${d.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(qe),signal:J});g(ve.access_token),u0()},A=()=>{g()},x=async(J,ue={})=>{ue.headers={...ue.headers,"Content-Type":"application/json",Authorization:`Bearer ${y}`};const fe=await c0(J,ue);if(fe.error&&fe.error.status===401)throw await w(),Error("UNAUTHORIZED");return fe},w=async()=>{await x(`${d.loginUrl}/logout`,{method:"DELETE"}),A()},[O,P]=pe.useState(),R=pe.useRef(),F=pe.useRef();bo(async()=>{if(!y){R.current=null,P(!1);return}try{const J=await x(`${d.apiUrl}/user-token?graphql=1`);R.current=J,P(!0)}catch{}},1e3*60*4.5,[y]),bo(async()=>{if(!y){F.current=null;return}try{const J=await x(`${d.apiUrl}/nats-token`);F.current=J}catch{}},1e3*60*9.5,[y]);const $=pe.useMemo(()=>({clientId:n,accessToken:y,jwtRef:R,natsCredsRef:F,isAuthenticated:O,login:m,logout:w,request:x,urls:d}),[y,n,O,R,m,w,F,x,d]),te=pe.useMemo(()=>({children:e,graphQLRoleOverride:u,authorize:b,isEmbedded:f,setIsEmbedded:h}),[e,u,b,f,h]);return or.jsx(zv.Provider,{value:$,children:or.jsx(Xu.Provider,{value:te,children:or.jsx(pn.RouterProvider,{router:yk})})})},bn=new Uint8Array(0),xi=new TextEncoder,cn=new TextDecoder;function vk(...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 xo(...r){const e=[];for(let t=0;t<r.length;t++)e.push(xi.encode(r[t]));return e.length===0?bn:e.length===1?e[0]:vk(...e)}function Q0(r){return!r||r.length===0?"":cn.decode(r)}const G0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",J0=36,bk=0xcfd41b9100000,Y0=33,wk=333,K0=22;function _k(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function xk(r){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(r):_k(r)}class Sk{constructor(){E(this,"buf");E(this,"seq");E(this,"inc");E(this,"inited");this.buf=new Uint8Array(K0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*bk),this.inc=Math.floor(Math.random()*(wk-Y0)+Y0)}setPre(){const e=new Uint8Array(12);xk(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=G0.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=K0-1;t>=12;t--)this.buf[t]=G0.charCodeAt(e%J0),e=Math.floor(e/J0)}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 Is=new Sk;var Si;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Si||(Si={}));var da;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(da||(da={}));var ye;(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"})(ye||(ye={}));function Ek(r){return typeof r.code=="string"}class Z0{constructor(){E(this,"messages");this.messages=new Map,this.messages.set(ye.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ye.BadJson,"Bad JSON"),this.messages.set(ye.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return Ok.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const Ok=new Z0;class Ie 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=Z0.getMessage(t);return new Ie(i,t,n)}isAuthError(){return this.code===ye.AuthenticationExpired||this.code===ye.AuthorizationViolation||this.code===ye.AccountExpired}isAuthTimeout(){return this.code===ye.AuthenticationTimeout}isPermissionError(){return this.code===ye.PermissionsViolation}isProtocolError(){return this.code===ye.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 So;(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"})(So||(So={}));const ec="Nats-Service-Error",tc="Nats-Service-Error-Code";class rc extends Error{constructor(t,n){super(n);E(this,"code");this.code=t}static isServiceError(t){return rc.toServiceError(t)!==null}static toServiceError(t){var i,a;const n=((i=t==null?void 0:t.headers)==null?void 0:i.get(tc))||"";if(n!==""){const u=parseInt(n)||400,c=((a=t==null?void 0:t.headers)==null?void 0:a.get(ec))||"";return new rc(u,c.length?c:n)}return null}}function Ei(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}.${Is.next()}`}const Hh="127.0.0.1";var es;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(es||(es={}));function nc(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 ic(r){return cn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function pa(r,e=!0){const t=e?Ie.errorForCode(ye.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Ie.errorForCode(ye.Timeout):t)},r)});return Object.assign(a,n)}function ma(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 nr(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function X0(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 Tk(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Qh(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 Tk(t>e?r[e]:r[t])}}}function cr(r){return r*1e6}function Gh(r){return Math.floor(r/1e6)}function eb(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 Ie(`'${r[a]}' is not a valid character for a header key`,ye.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 Oi(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new ts(r,e)}const Jh="NATS/1.0";class ts{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 ts,i=cn.decode(e).split(`\r
|
|
138
|
+
`,vk=()=>{const[r,e]=me.useState(),{isAuthenticated:t}=ti(),{authorize:n,isEmbedded:i}=me.useContext(tc);return bo(async a=>{try{await n(a)}catch(u){console.log(u),e("Login Failed. Try again.")}},[]),r?ar.jsx(H0,{loadError:r}):t?ar.jsx(H0,{}):ar.jsx(gk,{children:i?"":"Authorizing"})},So={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://development.graphql.machinemetrics.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://development.graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},bk=mn.createBrowserRouter([{path:"/authorize/mm/callback",element:ar.jsx(vk,{})},{path:"/*",element:ar.jsx(mk,{})}]),wk=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,graphQLRoleOverride:u,urls:c})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");const[f,h]=me.useState(!1);let d;if(So[a])d=So[a];else if(!d){const Q=ci.keys(So).join(", "),re=ci.keys(So[Object.keys(So)[0]]);throw Error(`MMProvider releaseStage must be one of the following: ${Q}, or the following urls need to be provided: ${re}.`)}d=ci.merge(d,c);const[y,g]=me.useState(CA());me.useEffect(()=>{PA(y)},[y]);const m=Q=>{const re=IA();u0(re),o0(window.location.pathname+window.location.search);const ge=(ve=>ci.map(ve,(Ie,ye)=>`${ye}=${Ie}`).join("&"))({response_type:"code",state:re,scope:t,ttl:1209600,client_id:n,redirect_uri:`${window.location.origin}/authorize/mm/callback`,...Q}),he=`${d.loginUrl}/oauth/authorize?${ge}`;window.location=he},b=async Q=>{const re=OA.parse(window.location.search),fe=re.code;if(re.state!==RA())throw Error("Oops");const ge={grant_type:"authorization_code",client_id:n,client_secret:i,code:fe,redirect_uri:`${window.location.origin}/authorize/mm/callback`},he=await c0(`${d.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(ge),signal:Q});g(he.access_token),u0()},A=()=>{g()},x=async(Q,re={})=>{re.headers={...re.headers,"Content-Type":"application/json",Authorization:`Bearer ${y}`};const fe=await c0(Q,re);if(fe.error&&fe.error.status===401)throw await w(),Error("UNAUTHORIZED");return fe},w=async()=>{await x(`${d.loginUrl}/logout`,{method:"DELETE"}),A()},[O,C]=me.useState(),D=me.useRef(),F=me.useRef();wo(async()=>{if(!y){D.current=null,C(!1);return}try{const Q=await x(`${d.apiUrl}/user-token?graphql=1`);D.current=Q,C(!0)}catch{}},1e3*60*4.5,[y]),wo(async()=>{if(!y){F.current=null;return}try{const Q=await x(`${d.apiUrl}/nats-token`);F.current=Q}catch{}},1e3*60*9.5,[y]);const B=me.useMemo(()=>({clientId:n,accessToken:y,jwtRef:D,natsCredsRef:F,isAuthenticated:O,login:m,logout:w,request:x,urls:d}),[y,n,O,D,m,w,F,x,d]),ee=me.useMemo(()=>({children:e,graphQLRoleOverride:u,authorize:b,isEmbedded:f,setIsEmbedded:h}),[e,u,b,f,h]);return ar.jsx(zv.Provider,{value:B,children:ar.jsx(tc.Provider,{value:ee,children:ar.jsx(mn.RouterProvider,{router:bk})})})},wn=new Uint8Array(0),xi=new TextEncoder,un=new TextDecoder;function _k(...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 Eo(...r){const e=[];for(let t=0;t<r.length;t++)e.push(xi.encode(r[t]));return e.length===0?wn:e.length===1?e[0]:_k(...e)}function G0(r){return!r||r.length===0?"":un.decode(r)}const Q0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",J0=36,xk=0xcfd41b9100000,Y0=33,Sk=333,K0=22;function Ek(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function Ok(r){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(r):Ek(r)}class Tk{constructor(){E(this,"buf");E(this,"seq");E(this,"inc");E(this,"inited");this.buf=new Uint8Array(K0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*xk),this.inc=Math.floor(Math.random()*(Sk-Y0)+Y0)}setPre(){const e=new Uint8Array(12);Ok(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=Q0.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=K0-1;t>=12;t--)this.buf[t]=Q0.charCodeAt(e%J0),e=Math.floor(e/J0)}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 Is=new Tk;var Si;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Si||(Si={}));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 Ak(r){return typeof r.code=="string"}class Z0{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 kk.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const kk=new Z0;class Ne 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=Z0.getMessage(t);return new Ne(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 _n;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(_n||(_n={}));var ri;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(ri||(ri={}));var Oo;(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"})(Oo||(Oo={}));const rc="Nats-Service-Error",nc="Nats-Service-Error-Code";class ic extends Error{constructor(t,n){super(n);E(this,"code");this.code=t}static isServiceError(t){return ic.toServiceError(t)!==null}static toServiceError(t){var i,a;const n=((i=t==null?void 0:t.headers)==null?void 0:i.get(nc))||"";if(n!==""){const u=parseInt(n)||400,c=((a=t==null?void 0:t.headers)==null?void 0:a.get(rc))||"";return new ic(u,c.length?c:n)}return null}}function Ei(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}.${Is.next()}`}const Hh="127.0.0.1";var es;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(es||(es={}));function sc(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 ac(r){return un.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ma(r,e=!0){const t=e?Ne.errorForCode(be.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Ne.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 tr(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function X0(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 Ik(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Gh(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 Ik(t>e?r[e]:r[t])}}}function ur(r){return r*1e6}function Qh(r){return Math.floor(r/1e6)}function eb(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 Ne(`'${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 Oi(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new ts(r,e)}const Jh="NATS/1.0";class ts{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 ts,i=un.decode(e).split(`\r
|
|
139
139
|
`),a=i[0];if(a!==Jh){let u=a.replace(Jh,"").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=Jh;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 xi.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new
|
|
142
|
+
`}encode(){return xi.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new Ne("invalid header value - \\r and \\n are not allowed.",be.BadHeader);return e.trim()}keys(){const e=[];for(const t of this.headers.keys())e.push(t);return e}findKeys(e,t=_n.Exact){const n=this.keys();switch(t){case _n.Exact:return n.filter(i=>i===e);case _n.CanonicalMIME:return e=eb(e),n.filter(i=>i===e);default:{const i=e.toLowerCase();return n.filter(a=>i===a.toLowerCase())}}}get(e,t=_n.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=_n.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=_n.Exact){return this.findKeys(e,t).length>0}set(e,t,n=_n.Exact){this.delete(e,n),this.append(e,t,n)}append(e,t,n=_n.Exact){const i=eb(e);n===_n.CanonicalMIME&&(e=i);const a=this.findKeys(e,n);e=a.length>0?a[0]:e;const u=ts.validHeaderValue(t);let c=this.headers.get(e);c||(c=[],this.headers.set(e,c)),c.push(u)}values(e,t=_n.Exact){const n=[];return this.findKeys(e,t).forEach(a=>{const u=this.headers.get(a);u&&n.push(...u)}),n}delete(e,t=_n.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 ts;for(const n in e)t.headers.set(n,e[n]);return t}}function tb(){return{encode(r){return xi.encode(r)},decode(r){return un.decode(r)}}}function Ln(r){return{encode(e){try{return e===void 0&&(e=null),xi.encode(JSON.stringify(e))}catch(t){throw Ne.errorForCode(be.BadJson,t)}},decode(e){try{return JSON.parse(un.decode(e),r)}catch(t){throw Ne.errorForCode(be.BadJson,t)}}}}function rb(r){var e;return r&&r.data.length===0&&((e=r.headers)==null?void 0:e.code)===503?Ne.errorForCode(be.NoResponders):null}class Yh{constructor(e,t,n){E(this,"_headers");E(this,"_msg");E(this,"_rdata");E(this,"_reply");E(this,"_subject");E(this,"publisher");this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject?this._subject:(this._subject=un.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=un.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=ts.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=wn,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){var i;const e=this._msg.subject.length,t=((i=this._msg.reply)==null?void 0:i.length)||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return Ln(e).decode(this.data)}string(){return un.decode(this.data)}requestInfo(){var t;const e=(t=this.headers)==null?void 0:t.get("Nats-Request-Info");return e?JSON.parse(e,function(n,i){return(n==="start"||n==="stop")&&i!==""?new Date(Date.parse(i)):i}):null}}E(Yh,"jc");function ga(r){return oc("durable",r)}function Zr(r){return oc("stream",r)}function oc(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 Eo(r,e=""){if(e==="")throw Error(`${r} name required`);const t=Ak(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function Ak(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 Kh(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function Zh(r){var e;return Kh(r)&&((e=r.headers)==null?void 0:e.description)==="Idle Heartbeat"}function kk(r,e,t){const n=Oi(r,e),i={hdr:1,sid:0,size:0},a=new Yh(i,bn,{});return a._headers=n,a._subject=t,a}function ga(r){if(r.data.length!==0)return null;const e=r.headers;return e?nb(e.code,e.description):null}var jn;(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"})(jn||(jn={}));function Ik(r){return r.code!==ye.JetStream409?!1:[jn.MaxBatchExceeded,jn.MaxExpiresExceeded,jn.MaxBytesExceeded,jn.MaxMessageSizeExceeded,jn.PushConsumer,jn.IdleHeartbeatMissed,jn.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function nb(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Ie(e,ye.JetStream404NoMessages);case 408:return new Ie(e,ye.JetStream408RequestTimeout);case 409:{const t=e.startsWith(jn.IdleHeartbeatMissed)?ye.JetStreamIdleHeartBeat:ye.JetStream409;return new Ie(e,t)}case 503:return Ie.errorForCode(ye.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=ye.Unknown),new Ie(e,`${r}`)}}class Dr{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=nr(),this.yields=[],this.iterClosed=nr(),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 Ie("unsupported iterator",ye.ApiError);if(this.yielding)throw new Ie("already yielding",ye.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=nr())}}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 Xh{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 ed;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(ed||(ed={}));var Oo;(function(r){r.Old="old",r.New="new"})(Oo||(Oo={}));var td;(function(r){r.File="file",r.Memory="memory"})(td||(td={}));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 Fr;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Fr||(Fr={}));var va;(function(r){r.Instant="instant",r.Original="original"})(va||(va={}));var rs;(function(r){r.None="none",r.S2="s2"})(rs||(rs={}));var ac;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(ac||(ac={}));function Pk(r,e={}){return Object.assign({name:r,deliver_policy:yr.All,ack_policy:Fr.Explicit,ack_wait:cr(30*1e3),replay_policy:va.Instant},e)}var ib;(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"})(ib||(ib={}));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 ba;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(ba||(ba={}));var sb;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(sb||(sb={}));const _n="KV_";class Ck{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=Pk("",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?Fr.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 ya(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=Fr.None,this}ackAll(){return this.config.ack_policy=Fr.All,this}ackExplicit(){return this.config.ack_policy=Fr.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=va.Instant,this}replayOriginal(){return this.config.replay_policy=va.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 ns(r){return new Ck(r)}function ab(r){return typeof r.getOpts=="function"}class Nk{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 To{static encode(e){return To.toB64URLEncoding(Nk.encode(e))}static decode(e,t=!1){return To.decode(To.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class wa{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=""),xi.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 ob(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 Rk(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,ob(u))},toUint8Array(u){const[c,f]=ob(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 A=0;A<d;A+=16383)m=A+16383,y[g++]=a(u,A,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 ub=[],cb=[],rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";for(let r=0,e=rd.length;r<e;++r)ub[r]=rd[r],cb[rd.charCodeAt(r)]=r;const{byteLength:z2,toUint8Array:Dk,fromUint8Array:Fk}=Rk(ub,cb,!0),Mk=new TextDecoder,Lk=new TextEncoder;function jk(r){return r.reduce((e,t)=>`${e}${t<16?"0":""}${t.toString(16)}`,"")}function qk(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 Uk(r,e="utf8"){if(/^utf-?8$/i.test(e))return Mk.decode(r);if(/^base64$/i.test(e))return Fk(r);if(/^hex(?:adecimal)?$/i.test(e))return jk(r);throw new TypeError("Unsupported string encoding.")}function $k(r,e="utf8"){if(/^utf-?8$/i.test(e))return Lk.encode(r);if(/^base64$/i.test(e))return Dk(r);if(/^hex(?:adecimal)?$/i.test(e))return qk(r);throw new TypeError("Unsupported string encoding.")}class lb{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=$k(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?Uk(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 fb{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=Is.next(),n&&(this.ctx=new Error)}}class Bk extends fb{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=nr(),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 To(r,e=""){if(e==="")throw Error(`${r} name required`);const t=Ck(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function Ck(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 Kh(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function Zh(r){var e;return Kh(r)&&((e=r.headers)==null?void 0:e.description)==="Idle Heartbeat"}function Pk(r,e,t){const n=Oi(r,e),i={hdr:1,sid:0,size:0},a=new Yh(i,wn,{});return a._headers=n,a._subject=t,a}function va(r){if(r.data.length!==0)return null;const e=r.headers;return e?nb(e.code,e.description):null}var jn;(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"})(jn||(jn={}));function Nk(r){return r.code!==be.JetStream409?!1:[jn.MaxBatchExceeded,jn.MaxExpiresExceeded,jn.MaxBytesExceeded,jn.MaxMessageSizeExceeded,jn.PushConsumer,jn.IdleHeartbeatMissed,jn.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function nb(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Ne(e,be.JetStream404NoMessages);case 408:return new Ne(e,be.JetStream408RequestTimeout);case 409:{const t=e.startsWith(jn.IdleHeartbeatMissed)?be.JetStreamIdleHeartBeat:be.JetStream409;return new Ne(e,t)}case 503:return Ne.errorForCode(be.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=be.Unknown),new Ne(e,`${r}`)}}class Rr{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=tr(),this.yields=[],this.iterClosed=tr(),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 Ne("unsupported iterator",be.ApiError);if(this.yielding)throw new Ne("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=tr())}}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 Xh{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 ed;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(ed||(ed={}));var Ao;(function(r){r.Old="old",r.New="new"})(Ao||(Ao={}));var td;(function(r){r.File="file",r.Memory="memory"})(td||(td={}));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 rs;(function(r){r.None="none",r.S2="s2"})(rs||(rs={}));var uc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(uc||(uc={}));function Rk(r,e={}){return Object.assign({name:r,deliver_policy:yr.All,ack_policy:Dr.Explicit,ack_wait:ur(30*1e3),replay_policy:ba.Instant},e)}var ib;(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"})(ib||(ib={}));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 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 sb;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(sb||(sb={}));const xn="KV_";class Dk{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=Rk("",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=ur(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=ur(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=ur(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=ur(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 ns(r){return new Dk(r)}function ab(r){return typeof r.getOpts=="function"}class Mk{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 ko{static encode(e){return ko.toB64URLEncoding(Mk.encode(e))}static decode(e,t=!1){return ko.decode(ko.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=""),xi.encode(e)}static toAscii(e){return un.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 ob(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 Fk(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,ob(u))},toUint8Array(u){const[c,f]=ob(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 A=0;A<d;A+=16383)m=A+16383,y[g++]=a(u,A,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 ub=[],cb=[],rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";for(let r=0,e=rd.length;r<e;++r)ub[r]=rd[r],cb[rd.charCodeAt(r)]=r;const{byteLength:Q2,toUint8Array:Lk,fromUint8Array:jk}=Fk(ub,cb,!0),qk=new TextDecoder,Uk=new TextEncoder;function $k(r){return r.reduce((e,t)=>`${e}${t<16?"0":""}${t.toString(16)}`,"")}function Bk(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 Vk(r,e="utf8"){if(/^utf-?8$/i.test(e))return qk.decode(r);if(/^base64$/i.test(e))return jk(r);if(/^hex(?:adecimal)?$/i.test(e))return $k(r);throw new TypeError("Unsupported string encoding.")}function Wk(r,e="utf8"){if(/^utf-?8$/i.test(e))return Uk.encode(r);if(/^base64$/i.test(e))return Lk(r);if(/^hex(?:adecimal)?$/i.test(e))return Bk(r);throw new TypeError("Unsupported string encoding.")}class lb{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=Wk(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?Vk(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 fb{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=Is.next(),n&&(this.ctx=new Error)}}class zk extends fb{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=tr(),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+=`
|
|
145
145
|
|
|
146
|
-
${this.ctx.stack}`),this.cancel(t)):(this.callback(null,n),this.opts.strategy===ri.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ri.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ri.SentinelMsg&&n&&n.data.length===0&&this.cancel())}}class hb extends fb{constructor(t,n,i={timeout:1e3},a=!0){super(t,n,a);E(this,"deferred");E(this,"timer");this.deferred=
|
|
146
|
+
${this.ctx.stack}`),this.cancel(t)):(this.callback(null,n),this.opts.strategy===ri.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ri.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ri.SentinelMsg&&n&&n.data.length===0&&this.cancel())}}class hb extends fb{constructor(t,n,i={timeout:1e3},a=!0){super(t,n,a);E(this,"deferred");E(this,"timer");this.deferred=tr(),this.timer=ma(i.timeout,a)}resolver(t,n){this.timer&&this.timer.cancel(),t?(this.ctx&&(t.stack+=`
|
|
147
147
|
|
|
148
|
-
${this.ctx.stack}`),this.deferred.reject(t)):this.deferred.resolve(n),this.cancel()}cancel(t){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(t||
|
|
149
|
-
`,uc=wa.fromAscii(oc),Jk=new Uint8Array(uc)[0],Yk=new Uint8Array(uc)[1];function Kk(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===Jk&&r[t]===Yk)return t+1}return 0}function Zk(r){const e=Kk(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return cn.decode(n)}return""}const Xk=4,pb=48,eI=65,tI=97;function rI(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 nI(r)!==void 0}function nI(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return mb(r);case":":return iI(r)}}function mb(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}=sI(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return rI(e[0],e[1],e[2],e[3])}function iI(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}=aI(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=mb(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+=Xk;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 sI(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)-pb),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 aI(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)-pb;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-tI+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-eI+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 oI(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function ud(r){return!oI(r)}function uI(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 cI(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=uI(r),ud(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=ud(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 Io{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=cI(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}://${ud(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Io(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&X0(t),this.resolves=t,t}}class lI{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 Io(i))}),this.randomize&&(this.servers=X0(this.servers))),this.servers.length===0&&this.addServer(`${Hh}:${db()}`,!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 Io(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 Io(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 fI{constructor(){E(this,"baseInbox");E(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Ei(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=rb(t)),i.resolver(e,t))}}}close(){const e=Ie.errorForCode(ye.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class hI{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:da.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=nr();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 dI extends Error{constructor(e){super(e),this.name="AssertionError"}}function pI(r,e="Assertion failed."){if(!r)throw new dI(e)}const yb=32*1024,cd=2**32-2;function cc(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{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){pI(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=cc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(xi.encode(e))}write(e){const t=this._grow(e.byteLength);return cc(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)cc(this._buf.subarray(this._off),this._buf);else{if(i+e>cd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,cd));cc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,cd)),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(yb);for(;;){const i=this.capacity-this.length<yb,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 gb(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const mI=48;class vb{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=xe.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 xe.OP_START:switch(n){case Se.M:case Se.m:this.state=xe.OP_M,this.hdr=-1,this.ma=gb();break;case Se.H:case Se.h:this.state=xe.OP_H,this.hdr=0,this.ma=gb();break;case Se.P:case Se.p:this.state=xe.OP_P;break;case Se.PLUS:this.state=xe.OP_PLUS;break;case Se.MINUS:this.state=xe.OP_MINUS;break;case Se.I:case Se.i:this.state=xe.OP_I;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_H:switch(n){case Se.M:case Se.m:this.state=xe.OP_M;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_M:switch(n){case Se.S:case Se.s:this.state=xe.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MS:switch(n){case Se.G:case Se.g:this.state=xe.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MSG:switch(n){case Se.SPACE:case Se.TAB:this.state=xe.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MSG_SPC:switch(n){case Se.SPACE:case Se.TAB:continue;default:this.state=xe.MSG_ARG,this.as=t}break;case xe.MSG_ARG:switch(n){case Se.CR:this.drop=1;break;case Se.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=xe.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case xe.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=xe.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=xe.MSG_END);break;case xe.MSG_END:switch(n){case Se.NL:this.drop=0,this.as=t+1,this.state=xe.OP_START;break;default:continue}break;case xe.OP_PLUS:switch(n){case Se.O:case Se.o:this.state=xe.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PLUS_O:switch(n){case Se.K:case Se.k:this.state=xe.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PLUS_OK:switch(n){case Se.NL:this.dispatcher.push({kind:tn.OK}),this.drop=0,this.state=xe.OP_START;break}break;case xe.OP_MINUS:switch(n){case Se.E:case Se.e:this.state=xe.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MINUS_E:switch(n){case Se.R:case Se.r:this.state=xe.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MINUS_ER:switch(n){case Se.R:case Se.r:this.state=xe.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MINUS_ERR:switch(n){case Se.SPACE:case Se.TAB:this.state=xe.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_MINUS_ERR_SPC:switch(n){case Se.SPACE:case Se.TAB:continue;default:this.state=xe.MINUS_ERR_ARG,this.as=t}break;case xe.MINUS_ERR_ARG:switch(n){case Se.CR:this.drop=1;break;case Se.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=xe.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case xe.OP_P:switch(n){case Se.I:case Se.i:this.state=xe.OP_PI;break;case Se.O:case Se.o:this.state=xe.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PO:switch(n){case Se.N:case Se.n:this.state=xe.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PON:switch(n){case Se.G:case Se.g:this.state=xe.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PONG:switch(n){case Se.NL:this.dispatcher.push({kind:tn.PONG}),this.drop=0,this.state=xe.OP_START;break}break;case xe.OP_PI:switch(n){case Se.N:case Se.n:this.state=xe.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PIN:switch(n){case Se.G:case Se.g:this.state=xe.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_PING:switch(n){case Se.NL:this.dispatcher.push({kind:tn.PING}),this.drop=0,this.state=xe.OP_START;break}break;case xe.OP_I:switch(n){case Se.N:case Se.n:this.state=xe.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_IN:switch(n){case Se.F:case Se.f:this.state=xe.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_INF:switch(n){case Se.O:case Se.o:this.state=xe.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_INFO:switch(n){case Se.SPACE:case Se.TAB:this.state=xe.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case xe.OP_INFO_SPC:switch(n){case Se.SPACE:case Se.TAB:continue;default:this.state=xe.INFO_ARG,this.as=t}break;case xe.INFO_ARG:switch(n){case Se.CR:this.drop=1;break;case Se.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=xe.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===xe.MSG_ARG||this.state===xe.MINUS_ERR_ARG||this.state===xe.INFO_ARG)&&!this.argBuf&&(this.argBuf=new ld(e.subarray(this.as,t-this.drop))),this.state===xe.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 Se.SPACE:case Se.TAB:case Se.CR:case Se.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 Se.SPACE:case Se.TAB:case Se.CR:case Se.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]-mI)}return t}}var xe;(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"})(xe||(xe={}));var Se;(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"})(Se||(Se={})),function(r){var e=function(_,I){this.hi=_|0,this.lo=I|0},t=function(_){var I,k=new Float64Array(16);if(_)for(I=0;I<_.length;I++)k[I]=_[I];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]),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(_,I){return _<<I|_>>>32-I}function A(_,I){var k=_[I+3]&255;return k=k<<8|_[I+2]&255,k=k<<8|_[I+1]&255,k<<8|_[I+0]&255}function x(_,I){var k=_[I]<<24|_[I+1]<<16|_[I+2]<<8|_[I+3],C=_[I+4]<<24|_[I+5]<<16|_[I+6]<<8|_[I+7];return new e(k,C)}function w(_,I,k){var C;for(C=0;C<4;C++)_[I+C]=k&255,k>>>=8}function O(_,I,k){_[I]=k.hi>>24&255,_[I+1]=k.hi>>16&255,_[I+2]=k.hi>>8&255,_[I+3]=k.hi&255,_[I+4]=k.lo>>24&255,_[I+5]=k.lo>>16&255,_[I+6]=k.lo>>8&255,_[I+7]=k.lo&255}function P(_,I,k,C,M){var U,ne=0;for(U=0;U<M;U++)ne|=_[I+U]^k[C+U];return(1&ne-1>>>8)-1}function R(_,I,k,C){return P(_,I,k,C,16)}function F(_,I,k,C){return P(_,I,k,C,32)}function $(_,I,k,C,M){var U=new Uint32Array(16),ne=new Uint32Array(16),he=new Uint32Array(16),G=new Uint32Array(4),re,Fe,gt;for(re=0;re<4;re++)ne[5*re]=A(C,4*re),ne[1+re]=A(k,4*re),ne[6+re]=A(I,4*re),ne[11+re]=A(k,16+4*re);for(re=0;re<16;re++)he[re]=ne[re];for(re=0;re<20;re++){for(Fe=0;Fe<4;Fe++){for(gt=0;gt<4;gt++)G[gt]=ne[(5*Fe+4*gt)%16];for(G[1]^=b(G[0]+G[3]|0,7),G[2]^=b(G[1]+G[0]|0,9),G[3]^=b(G[2]+G[1]|0,13),G[0]^=b(G[3]+G[2]|0,18),gt=0;gt<4;gt++)U[4*Fe+(Fe+gt)%4]=G[gt]}for(gt=0;gt<16;gt++)ne[gt]=U[gt]}if(M){for(re=0;re<16;re++)ne[re]=ne[re]+he[re]|0;for(re=0;re<4;re++)ne[5*re]=ne[5*re]-A(C,4*re)|0,ne[6+re]=ne[6+re]-A(I,4*re)|0;for(re=0;re<4;re++)w(_,4*re,ne[5*re]),w(_,16+4*re,ne[6+re])}else for(re=0;re<16;re++)w(_,4*re,ne[re]+he[re]|0)}function te(_,I,k,C){return $(_,I,k,C,!1),0}function J(_,I,k,C){return $(_,I,k,C,!0),0}var ue=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function fe(_,I,k,C,M,U,ne){var he=new Uint8Array(16),G=new Uint8Array(64),re,Fe;if(!M)return 0;for(Fe=0;Fe<16;Fe++)he[Fe]=0;for(Fe=0;Fe<8;Fe++)he[Fe]=U[Fe];for(;M>=64;){for(te(G,he,ne,ue),Fe=0;Fe<64;Fe++)_[I+Fe]=(k?k[C+Fe]:0)^G[Fe];for(re=1,Fe=8;Fe<16;Fe++)re=re+(he[Fe]&255)|0,he[Fe]=re&255,re>>>=8;M-=64,I+=64,k&&(C+=64)}if(M>0)for(te(G,he,ne,ue),Fe=0;Fe<M;Fe++)_[I+Fe]=(k?k[C+Fe]:0)^G[Fe];return 0}function qe(_,I,k,C,M){return fe(_,I,null,0,k,C,M)}function ve(_,I,k,C,M){var U=new Uint8Array(32);return J(U,C,M,ue),qe(_,I,k,C.subarray(16),U)}function De(_,I,k,C,M,U,ne){var he=new Uint8Array(32);return J(he,U,ne,ue),fe(_,I,k,C,M,U.subarray(16),he)}function je(_,I){var k,C=0;for(k=0;k<17;k++)C=C+(_[k]+I[k]|0)|0,_[k]=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 Je(_,I,k,C,M,U){var ne,he,G,re,Fe=new Uint32Array(17),gt=new Uint32Array(17),tr=new Uint32Array(17),En=new Uint32Array(17),Ai=new Uint32Array(17);for(G=0;G<17;G++)gt[G]=tr[G]=0;for(G=0;G<16;G++)gt[G]=U[G];for(gt[3]&=15,gt[4]&=252,gt[7]&=15,gt[8]&=252,gt[11]&=15,gt[12]&=252,gt[15]&=15;M>0;){for(G=0;G<17;G++)En[G]=0;for(G=0;G<16&&G<M;++G)En[G]=k[C+G];for(En[G]=1,C+=G,M-=G,je(tr,En),he=0;he<17;he++)for(Fe[he]=0,G=0;G<17;G++)Fe[he]=Fe[he]+tr[G]*(G<=he?gt[he-G]:320*gt[he+17-G]|0)|0|0;for(he=0;he<17;he++)tr[he]=Fe[he];for(re=0,G=0;G<16;G++)re=re+tr[G]|0,tr[G]=re&255,re>>>=8;for(re=re+tr[16]|0,tr[16]=re&3,re=5*(re>>>2)|0,G=0;G<16;G++)re=re+tr[G]|0,tr[G]=re&255,re>>>=8;re=re+tr[16]|0,tr[16]=re}for(G=0;G<17;G++)Ai[G]=tr[G];for(je(tr,ge),ne=-(tr[16]>>>7)|0,G=0;G<17;G++)tr[G]^=ne&(Ai[G]^tr[G]);for(G=0;G<16;G++)En[G]=U[G+16];for(En[16]=0,je(tr,En),G=0;G<16;G++)_[I+G]=tr[G];return 0}function be(_,I,k,C,M,U){var ne=new Uint8Array(16);return Je(ne,0,k,C,M,U),R(_,I,ne,0)}function ce(_,I,k,C,M){var U;if(k<32)return-1;for(De(_,0,I,0,k,C,M),Je(_,16,_,32,k-32,_),U=0;U<16;U++)_[U]=0;return 0}function Te(_,I,k,C,M){var U,ne=new Uint8Array(32);if(k<32||(ve(ne,0,32,C,M),be(I,16,I,32,k-32,ne)!==0))return-1;for(De(_,0,I,0,k,C,M),U=0;U<32;U++)_[U]=0;return 0}function Ne(_,I){var k;for(k=0;k<16;k++)_[k]=I[k]|0}function Ee(_){var I,k;for(k=0;k<16;k++)_[k]+=65536,I=Math.floor(_[k]/65536),_[(k+1)*(k<15?1:0)]+=I-1+37*(I-1)*(k===15?1:0),_[k]-=I*65536}function nt(_,I,k){for(var C,M=~(k-1),U=0;U<16;U++)C=M&(_[U]^I[U]),_[U]^=C,I[U]^=C}function Ot(_,I){var k,C,M,U=t(),ne=t();for(k=0;k<16;k++)ne[k]=I[k];for(Ee(ne),Ee(ne),Ee(ne),C=0;C<2;C++){for(U[0]=ne[0]-65517,k=1;k<15;k++)U[k]=ne[k]-65535-(U[k-1]>>16&1),U[k-1]&=65535;U[15]=ne[15]-32767-(U[14]>>16&1),M=U[15]>>16&1,U[14]&=65535,nt(ne,U,1-M)}for(k=0;k<16;k++)_[2*k]=ne[k]&255,_[2*k+1]=ne[k]>>8}function ht(_,I){var k=new Uint8Array(32),C=new Uint8Array(32);return Ot(k,_),Ot(C,I),F(k,0,C,0)}function Pt(_){var I=new Uint8Array(32);return Ot(I,_),I[0]&1}function Xe(_,I){var k;for(k=0;k<16;k++)_[k]=I[2*k]+(I[2*k+1]<<8);_[15]&=32767}function Ye(_,I,k){var C;for(C=0;C<16;C++)_[C]=I[C]+k[C]|0}function dt(_,I,k){var C;for(C=0;C<16;C++)_[C]=I[C]-k[C]|0}function Re(_,I,k){var C,M,U=new Float64Array(31);for(C=0;C<31;C++)U[C]=0;for(C=0;C<16;C++)for(M=0;M<16;M++)U[C+M]+=I[C]*k[M];for(C=0;C<15;C++)U[C]+=38*U[C+16];for(C=0;C<16;C++)_[C]=U[C];Ee(_),Ee(_)}function _t(_,I){Re(_,I,I)}function H(_,I){var k=t(),C;for(C=0;C<16;C++)k[C]=I[C];for(C=253;C>=0;C--)_t(k,k),C!==2&&C!==4&&Re(k,k,I);for(C=0;C<16;C++)_[C]=k[C]}function Y(_,I){var k=t(),C;for(C=0;C<16;C++)k[C]=I[C];for(C=250;C>=0;C--)_t(k,k),C!==1&&Re(k,k,I);for(C=0;C<16;C++)_[C]=k[C]}function B(_,I,k){var C=new Uint8Array(32),M=new Float64Array(80),U,ne,he=t(),G=t(),re=t(),Fe=t(),gt=t(),tr=t();for(ne=0;ne<31;ne++)C[ne]=I[ne];for(C[31]=I[31]&127|64,C[0]&=248,Xe(M,k),ne=0;ne<16;ne++)G[ne]=M[ne],Fe[ne]=he[ne]=re[ne]=0;for(he[0]=Fe[0]=1,ne=254;ne>=0;--ne)U=C[ne>>>3]>>>(ne&7)&1,nt(he,G,U),nt(re,Fe,U),Ye(gt,he,re),dt(he,he,re),Ye(re,G,Fe),dt(G,G,Fe),_t(Fe,gt),_t(tr,he),Re(he,re,he),Re(re,G,gt),Ye(gt,he,re),dt(he,he,re),_t(G,he),dt(re,Fe,tr),Re(he,re,f),Ye(he,he,Fe),Re(re,re,he),Re(he,Fe,tr),Re(Fe,G,M),_t(G,gt),nt(he,G,U),nt(re,Fe,U);for(ne=0;ne<16;ne++)M[ne+16]=he[ne],M[ne+32]=re[ne],M[ne+48]=G[ne],M[ne+64]=Fe[ne];var En=M.subarray(32),Ai=M.subarray(16);return H(En,En),Re(Ai,Ai,En),Ot(_,Ai),0}function Z(_,I){return B(_,I,a)}function X(_,I){return n(I,32),Z(_,I)}function Q(_,I,k){var C=new Uint8Array(32);return B(C,k,I),J(_,i,C,ue)}var we=ce,ze=Te;function Be(_,I,k,C,M,U){var ne=new Uint8Array(32);return Q(ne,M,U),we(_,I,k,C,ne)}function le(_,I,k,C,M,U){var ne=new Uint8Array(32);return Q(ne,M,U),ze(_,I,k,C,ne)}function _e(){var _=0,I=0,k=0,C=0,M=65535,U,ne,he;for(he=0;he<arguments.length;he++)U=arguments[he].lo,ne=arguments[he].hi,_+=U&M,I+=U>>>16,k+=ne&M,C+=ne>>>16;return I+=_>>>16,k+=I>>>16,C+=k>>>16,new e(k&M|C<<16,_&M|I<<16)}function et(_,I){return new e(_.hi>>>I,_.lo>>>I|_.hi<<32-I)}function Tt(){var _=0,I=0,k;for(k=0;k<arguments.length;k++)_^=arguments[k].lo,I^=arguments[k].hi;return new e(I,_)}function At(_,I){var k,C,M=32-I;return I<32?(k=_.hi>>>I|_.lo<<M,C=_.lo>>>I|_.hi<<M):I<64&&(k=_.lo>>>I|_.hi<<M,C=_.hi>>>I|_.lo<<M),new e(k,C)}function Yt(_,I,k){var C=_.hi&I.hi^~_.hi&k.hi,M=_.lo&I.lo^~_.lo&k.lo;return new e(C,M)}function xt(_,I,k){var C=_.hi&I.hi^_.hi&k.hi^I.hi&k.hi,M=_.lo&I.lo^_.lo&k.lo^I.lo&k.lo;return new e(C,M)}function Wt(_){return Tt(At(_,28),At(_,34),At(_,39))}function Qt(_){return Tt(At(_,14),At(_,18),At(_,41))}function Er(_){return Tt(At(_,1),At(_,8),et(_,7))}function zt(_){return Tt(At(_,19),At(_,61),et(_,6))}var ir=[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(_,I,k){var C=[],M=[],U=[],ne=[],he,G,re;for(G=0;G<8;G++)C[G]=U[G]=x(_,8*G);for(var Fe=0;k>=128;){for(G=0;G<16;G++)ne[G]=x(I,8*G+Fe);for(G=0;G<80;G++){for(re=0;re<8;re++)M[re]=U[re];for(he=_e(U[7],Qt(U[4]),Yt(U[4],U[5],U[6]),ir[G],ne[G%16]),M[7]=_e(he,Wt(U[0]),xt(U[0],U[1],U[2])),M[3]=_e(M[3],he),re=0;re<8;re++)U[(re+1)%8]=M[re];if(G%16===15)for(re=0;re<16;re++)ne[re]=_e(ne[re],ne[(re+9)%16],Er(ne[(re+1)%16]),zt(ne[(re+14)%16]))}for(G=0;G<8;G++)U[G]=_e(U[G],C[G]),C[G]=U[G];Fe+=128,k-=128}for(G=0;G<8;G++)O(_,8*G,C[G]);return k}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(_,I,k){var C=new Uint8Array(64),M=new Uint8Array(256),U,ne=k;for(U=0;U<64;U++)C[U]=Ar[U];for(dr(C,I,k),k%=128,U=0;U<256;U++)M[U]=0;for(U=0;U<k;U++)M[U]=I[ne-k+U];for(M[k]=128,k=256-128*(k<112?1:0),M[k-9]=0,O(M,k-8,new e(ne/536870912|0,ne<<3)),dr(C,M,k),U=0;U<64;U++)_[U]=C[U];return 0}function W(_,I){var k=t(),C=t(),M=t(),U=t(),ne=t(),he=t(),G=t(),re=t(),Fe=t();dt(k,_[1],_[0]),dt(Fe,I[1],I[0]),Re(k,k,Fe),Ye(C,_[0],_[1]),Ye(Fe,I[0],I[1]),Re(C,C,Fe),Re(M,_[3],I[3]),Re(M,M,d),Re(U,_[2],I[2]),Ye(U,U,U),dt(ne,C,k),dt(he,U,M),Ye(G,U,M),Ye(re,C,k),Re(_[0],ne,he),Re(_[1],re,G),Re(_[2],G,he),Re(_[3],ne,re)}function z(_,I,k){var C;for(C=0;C<4;C++)nt(_[C],I[C],k)}function it(_,I){var k=t(),C=t(),M=t();H(M,I[2]),Re(k,I[0],M),Re(C,I[1],M),Ot(_,C),_[31]^=Pt(k)<<7}function yt(_,I,k){var C,M;for(Ne(_[0],u),Ne(_[1],c),Ne(_[2],c),Ne(_[3],u),M=255;M>=0;--M)C=k[M/8|0]>>(M&7)&1,z(_,I,C),W(I,_),W(_,_),z(_,I,C)}function ct(_,I){var k=[t(),t(),t(),t()];Ne(k[0],y),Ne(k[1],g),Ne(k[2],c),Re(k[3],y,g),yt(_,k,I)}function Ve(_,I,k){var C=new Uint8Array(64),M=[t(),t(),t(),t()],U;for(k||n(I,32),Ht(C,I,32),C[0]&=248,C[31]&=127,C[31]|=64,ct(M,C),it(_,M),U=0;U<32;U++)I[U+32]=_[U];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(_,I){var k,C,M,U;for(C=63;C>=32;--C){for(k=0,M=C-32,U=C-12;M<U;++M)I[M]+=k-16*I[C]*Kt[M-(C-32)],k=Math.floor((I[M]+128)/256),I[M]-=k*256;I[M]+=k,I[C]=0}for(k=0,M=0;M<32;M++)I[M]+=k-(I[31]>>4)*Kt[M],k=I[M]>>8,I[M]&=255;for(M=0;M<32;M++)I[M]-=k*Kt[M];for(C=0;C<32;C++)I[C+1]+=I[C]>>8,_[C]=I[C]&255}function Gt(_){var I=new Float64Array(64),k;for(k=0;k<64;k++)I[k]=_[k];for(k=0;k<64;k++)_[k]=0;Zt(_,I)}function kr(_,I,k,C){var M=new Uint8Array(64),U=new Uint8Array(64),ne=new Uint8Array(64),he,G,re=new Float64Array(64),Fe=[t(),t(),t(),t()];Ht(M,C,32),M[0]&=248,M[31]&=127,M[31]|=64;var gt=k+64;for(he=0;he<k;he++)_[64+he]=I[he];for(he=0;he<32;he++)_[32+he]=M[32+he];for(Ht(ne,_.subarray(32),k+32),Gt(ne),ct(Fe,ne),it(_,Fe),he=32;he<64;he++)_[he]=C[he];for(Ht(U,_,k+64),Gt(U),he=0;he<64;he++)re[he]=0;for(he=0;he<32;he++)re[he]=ne[he];for(he=0;he<32;he++)for(G=0;G<32;G++)re[he+G]+=U[he]*M[G];return Zt(_.subarray(32),re),gt}function Hr(_,I){var k=t(),C=t(),M=t(),U=t(),ne=t(),he=t(),G=t();return Ne(_[2],c),Xe(_[1],I),_t(M,_[1]),Re(U,M,h),dt(M,M,_[2]),Ye(U,_[2],U),_t(ne,U),_t(he,ne),Re(G,he,ne),Re(k,G,M),Re(k,k,U),Y(k,k),Re(k,k,M),Re(k,k,U),Re(k,k,U),Re(_[0],k,U),_t(C,_[0]),Re(C,C,U),ht(C,M)&&Re(_[0],_[0],m),_t(C,_[0]),Re(C,C,U),ht(C,M)?-1:(Pt(_[0])===I[31]>>7&&dt(_[0],u,_[0]),Re(_[3],_[0],_[1]),0)}function Mr(_,I,k,C){var M,U=new Uint8Array(32),ne=new Uint8Array(64),he=[t(),t(),t(),t()],G=[t(),t(),t(),t()];if(k<64||Hr(G,C))return-1;for(M=0;M<k;M++)_[M]=I[M];for(M=0;M<32;M++)_[M+32]=C[M];if(Ht(ne,_,k),Gt(ne),yt(he,G,ne),ct(G,I.subarray(32)),W(he,G),it(U,he),k-=64,F(I,0,U,0)){for(M=0;M<k;M++)_[M]=0;return-1}for(M=0;M<k;M++)_[M]=I[M+64];return k}var Ut=32,Or=24,$r=32,Lr=16,sr=32,Qr=32,Tr=32,gr=32,Ir=32,Sn=Or,Un=$r,D=Lr,se=64,me=32,ke=64,$e=32,ot=64;r.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:De,crypto_stream:ve,crypto_stream_salsa20_xor:fe,crypto_stream_salsa20:qe,crypto_onetimeauth:Je,crypto_onetimeauth_verify:be,crypto_verify_16:R,crypto_verify_32:F,crypto_secretbox:ce,crypto_secretbox_open:Te,crypto_scalarmult:B,crypto_scalarmult_base:Z,crypto_box_beforenm:Q,crypto_box_afternm:we,crypto_box:Be,crypto_box_open:le,crypto_box_keypair:X,crypto_hash:Ht,crypto_sign:kr,crypto_sign_keypair:Ve,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ut,crypto_secretbox_NONCEBYTES:Or,crypto_secretbox_ZEROBYTES:$r,crypto_secretbox_BOXZEROBYTES:Lr,crypto_scalarmult_BYTES:sr,crypto_scalarmult_SCALARBYTES:Qr,crypto_box_PUBLICKEYBYTES:Tr,crypto_box_SECRETKEYBYTES:gr,crypto_box_BEFORENMBYTES:Ir,crypto_box_NONCEBYTES:Sn,crypto_box_ZEROBYTES:Un,crypto_box_BOXZEROBYTES:D,crypto_sign_BYTES:se,crypto_sign_PUBLICKEYBYTES:me,crypto_sign_SECRETKEYBYTES:ke,crypto_sign_SEEDBYTES:$e,crypto_hash_BYTES:ot,gf:t,D:h,L:Kt,pack25519:Ot,unpack25519:Xe,M:Re,A:Ye,S:_t,Z:dt,pow2523:Y,add:W,set25519:Ne,modL:Zt,scalarmult:yt,scalarbase:ct};function He(_,I){if(_.length!==Ut)throw new Error("bad key size");if(I.length!==Or)throw new Error("bad nonce size")}function Ke(_,I){if(_.length!==Tr)throw new Error("bad public key size");if(I.length!==gr)throw new Error("bad secret key size")}function Ze(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function mt(_){for(var I=0;I<_.length;I++)_[I]=0}r.randomBytes=function(_){var I=new Uint8Array(_);return n(I,_),I},r.secretbox=function(_,I,k){Ze(_,I,k),He(k,I);for(var C=new Uint8Array($r+_.length),M=new Uint8Array(C.length),U=0;U<_.length;U++)C[U+$r]=_[U];return ce(M,C,C.length,I,k),M.subarray(Lr)},r.secretbox.open=function(_,I,k){Ze(_,I,k),He(k,I);for(var C=new Uint8Array(Lr+_.length),M=new Uint8Array(C.length),U=0;U<_.length;U++)C[U+Lr]=_[U];return C.length<32||Te(M,C,C.length,I,k)!==0?null:M.subarray($r)},r.secretbox.keyLength=Ut,r.secretbox.nonceLength=Or,r.secretbox.overheadLength=Lr,r.scalarMult=function(_,I){if(Ze(_,I),_.length!==Qr)throw new Error("bad n size");if(I.length!==sr)throw new Error("bad p size");var k=new Uint8Array(sr);return B(k,_,I),k},r.scalarMult.base=function(_){if(Ze(_),_.length!==Qr)throw new Error("bad n size");var I=new Uint8Array(sr);return Z(I,_),I},r.scalarMult.scalarLength=Qr,r.scalarMult.groupElementLength=sr,r.box=function(_,I,k,C){var M=r.box.before(k,C);return r.secretbox(_,I,M)},r.box.before=function(_,I){Ze(_,I),Ke(_,I);var k=new Uint8Array(Ir);return Q(k,_,I),k},r.box.after=r.secretbox,r.box.open=function(_,I,k,C){var M=r.box.before(k,C);return r.secretbox.open(_,I,M)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var _=new Uint8Array(Tr),I=new Uint8Array(gr);return X(_,I),{publicKey:_,secretKey:I}},r.box.keyPair.fromSecretKey=function(_){if(Ze(_),_.length!==gr)throw new Error("bad secret key size");var I=new Uint8Array(Tr);return Z(I,_),{publicKey:I,secretKey:new Uint8Array(_)}},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(_,I){if(Ze(_,I),I.length!==ke)throw new Error("bad secret key size");var k=new Uint8Array(se+_.length);return kr(k,_,_.length,I),k},r.sign.open=function(_,I){if(Ze(_,I),I.length!==me)throw new Error("bad public key size");var k=new Uint8Array(_.length),C=Mr(k,_,_.length,I);if(C<0)return null;for(var M=new Uint8Array(C),U=0;U<M.length;U++)M[U]=k[U];return M},r.sign.detached=function(_,I){for(var k=r.sign(_,I),C=new Uint8Array(se),M=0;M<C.length;M++)C[M]=k[M];return C},r.sign.detached.verify=function(_,I,k){if(Ze(_,I,k),I.length!==se)throw new Error("bad signature size");if(k.length!==me)throw new Error("bad public key size");var C=new Uint8Array(se+_.length),M=new Uint8Array(se+_.length),U;for(U=0;U<se;U++)C[U]=I[U];for(U=0;U<_.length;U++)C[U+se]=_[U];return Mr(M,C,C.length,k)>=0},r.sign.keyPair=function(){var _=new Uint8Array(me),I=new Uint8Array(ke);return Ve(_,I),{publicKey:_,secretKey:I}},r.sign.keyPair.fromSecretKey=function(_){if(Ze(_),_.length!==ke)throw new Error("bad secret key size");for(var I=new Uint8Array(me),k=0;k<I.length;k++)I[k]=_[32+k];return{publicKey:I,secretKey:new Uint8Array(_)}},r.sign.keyPair.fromSeed=function(_){if(Ze(_),_.length!==$e)throw new Error("bad seed size");for(var I=new Uint8Array(me),k=new Uint8Array(ke),C=0;C<32;C++)k[C]=_[C];return Ve(I,k,!0),{publicKey:I,secretKey:k}},r.sign.publicKeyLength=me,r.sign.secretKeyLength=ke,r.sign.seedLength=$e,r.sign.signatureLength=se,r.hash=function(_){Ze(_);var I=new Uint8Array(ot);return Ht(I,_,_.length),I},r.hash.hashLength=ot,r.verify=function(_,I){return Ze(_,I),_.length===0||I.length===0||_.length!==I.length?!1:P(_,0,I,0,_.length)===0},r.setPRNG=function(_){n=_},function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var I=65536;r.setPRNG(function(k,C){var M,U=new Uint8Array(C);for(M=0;M<C;M+=I)_.getRandomValues(U.subarray(M,M+Math.min(C-M,I)));for(M=0;M<C;M++)k[M]=U[M];mt(U)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&r.setPRNG(function(k,C){var M,U=_.randomBytes(C);for(M=0;M<C;M++)k[M]=U[M];mt(U)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const lc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,yI={fromSeed:lc.sign.keyPair.fromSeed,sign:lc.sign.detached,verify:lc.sign.detached.verify,randomBytes:lc.randomBytes};let bb;function gI(r){bb=r}function is(){return bb}const vI=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 fc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^vI[(t>>8^i)&255]}return t}static validate(e,t){return fc.checksum(e)==t}}const fd="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class wb{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++]=fd.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=fd.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=fd.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 bI(){return hc(Vt.Operator)}function wI(){return hc(Vt.Account)}function _I(){return hc(Vt.User)}var jt;(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"})(jt||(jt={}));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 xa{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(jt.SerializationError);if(!xa.isValidPrefix(e))throw new Bt(jt.InvalidPrefixByte);return rn._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new Bt(jt.ApiError);if(!xa.isValidPublicPrefix(e))throw new Bt(jt.InvalidPrefixByte);if(t.byteLength!==32)throw new Bt(jt.InvalidSeedLen);return rn._encode(!0,e,t)}static decode(e,t){if(!xa.isValidPrefix(e))throw new Bt(jt.InvalidPrefixByte);const n=rn._decode(t);if(n[0]!==e)throw new Bt(jt.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(jt.InvalidSeed);if(!xa.isValidPublicPrefix(n[1]))throw new Bt(jt.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=fc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),wb.encode(f)}static _decode(e){if(e.byteLength<4)throw new Bt(jt.InvalidEncoding);let t;try{t=wb.decode(e)}catch(c){throw new Bt(jt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!fc.validate(u,a))throw new Bt(jt.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 _b{constructor(e){E(this,"seed");this.seed=e}getRawSeed(){if(!this.seed)throw new Bt(jt.ClearedPair);return rn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Bt(jt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Bt(jt.ClearedPair);const e=rn.decodeSeed(this.seed),t=is().fromSeed(this.getRawSeed()),n=rn.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new Bt(jt.ClearedPair);const e=is().fromSeed(this.getRawSeed());return rn.encode(Vt.Private,e.secretKey)}sign(e){if(!this.seed)throw new Bt(jt.ClearedPair);const t=is().fromSeed(this.getRawSeed());return is().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new Bt(jt.ClearedPair);const n=is().fromSeed(this.getRawSeed());return is().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function hc(r){const e=is().randomBytes(32);let t=rn.encodeSeed(r,new Uint8Array(e));return new _b(t)}class xI{constructor(e){E(this,"publicKey");this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new Bt(jt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Bt(jt.PublicKeyOnly):new Bt(jt.ClearedPair)}getSeed(){throw this.publicKey?new Bt(jt.PublicKeyOnly):new Bt(jt.ClearedPair)}sign(e){throw this.publicKey?new Bt(jt.CannotSign):new Bt(jt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new Bt(jt.ClearedPair);let n=rn._decode(this.publicKey);return is().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function SI(r){const e=new TextEncoder().encode(r),t=rn._decode(e),n=xa.parsePrefix(t[0]);if(xa.isValidPublicPrefix(n))return new xI(e);throw new Bt(jt.InvalidPublicKey)}function EI(r){return rn.decodeSeed(r),new _b(r)}function OI(r){return btoa(String.fromCharCode(...r))}function TI(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}gI(yI);const xb={createAccount:wI,createOperator:bI,createPair:hc,createUser:_I,fromPublic:SI,fromSeed:EI,NKeysError:Bt,NKeysErrorCode:jt,Prefix:Vt,decode:TI,encode:OI};function AI(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function kI(){return()=>{}}function II(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function PI(r){return()=>({auth_token:typeof r=="function"?r():r})}function CI(r){return e=>{const t=typeof r=="function"?r():r,n=t?xb.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=xi.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?xb.encode(u):"";return{nkey:i,sig:c}}}function NI(r,e){return t=>{const n=typeof r=="function"?r():r,i=CI(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function RI(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 Ie.errorForCode(ye.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Ie.errorForCode(ye.BadCreds);const h=xi.encode(c[1].trim());return{jwt:f,seed:h}};return NI(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const Sb=2*60*1e3,DI=2,Eb=2*1e3;function FI(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Eb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function MI(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(PI(r.token)),r.user&&e.push(II(r.user,r.pass)),e.length===0?kI():AI(e)}function LI(r){const e=`${Hh}:${db()}`;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 Ie("port and servers options are mutually exclusive",ye.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Hh}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=nc(FI(),r);if(t.authenticator=MI(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Ie(`${n} option should be a function`,ye.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{Ei(t.inboxPrefix)}catch(n){throw new Ie(n.message,ye.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof ad()=="function"),t.resolve&&typeof ad()!="function")throw new Ie("'resolve' is not supported on this client",ye.InvalidOption);return t}function jI(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Ie("noEcho",ye.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Ie("tls",ye.ServerOptionNotAvailable)}const qI=1024*32,UI=/^INFO\s+([^\r\n]+)\r\n/i,$I=xo(`PONG\r
|
|
150
|
-
`),Ob=
|
|
151
|
-
`);class BI{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):{})||{};nc(this,i)}}class Tb extends Dr{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");nc(this,i),this.protocol=t,this.subject=n,this.draining=!1,this.noIterator=typeof i.callback=="function",this.closed=nr();const a=!((u=t.options)!=null&&u.noAsyncTraces);i.timeout&&(this.timer=pa(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(Ie.errorForCode(ye.ConnectionClosed)):this.isClosed()?Promise.reject(Ie.errorForCode(ye.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(nr()).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 VI{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 dc{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=qI,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new VI,this.muxSubscriptions=new fI,this.outbound=new wa,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new zk({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new lI(n,{randomize:!e.noRandomize}),this.closed=nr(),this.parser=new vb(this),this.heartbeats=new hI(this,this.options.pingInterval||Sb,this.options.maxPingOut||DI)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Ie.errorForCode(ye.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new vb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Dr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=nr();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=Gk(),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:da.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:da.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Si.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var t;this.dispatchStatus({type:Si.Reconnect,data:this.servers.getCurrentServer().toString()}),((t=this.lastError)==null?void 0:t.code)===ye.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=pa(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:ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let i=null;for(const a of n)try{i=null,this.dispatchStatus({type:da.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():Eb;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Ie.errorForCode(ye.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 ma(n)}}static async connect(e,t){const n=new dc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Ie(e,ye.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 Ie(e,ye.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Ie(e,ye.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Ie(e,ye.AccountExpired):t.indexOf("authentication timeout")!==-1?new Ie(e,ye.AuthenticationTimeout):new Ie(e,ye.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 Yh(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=Q0(e),n=dc.toError(t),i={type:Si.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($I)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(Q0(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 BI({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(xo(`CONNECT ${f}${oc}`)),this.transport.send(Ob)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Si.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Si.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=xo(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=xi.encode(t);else throw Ie.errorForCode(ye.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 Ie("headers",ye.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Ie.errorForCode(ye.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(t)):this.deferred.resolve(n),this.cancel()}cancel(t){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(t||Ne.errorForCode(be.Cancelled))}}const Hk="$JS.API";function Gk(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),sc({apiPrefix:Hk,timeout:5e3},r)}class Io{constructor(e,t){E(this,"nc");E(this,"opts");E(this,"prefix");E(this,"timeout");E(this,"jc");this.nc=e,this.opts=Gk(t),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Ln()}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=wn;t&&(i=this.jc.encode(t));let{retries:a}=n;a=a||1,a=a===-1?Number.MAX_SAFE_INTEGER:a;const u=Gh();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===be.Timeout)&&c+1<a)await ya(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=nb(n.error.code,n.error.description);if(i!==null)throw i.api_error=n.error,i}return t}}class Co{constructor(e,t,n,i){E(this,"err");E(this,"offset");E(this,"pageInfo");E(this,"subject");E(this,"jsm");E(this,"filter");E(this,"payload");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){var t,n,i;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((t=e.streams)==null?void 0:t.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((n=e.consumers)==null?void 0:n.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((i=e.streams)==null?void 0:i.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 Cs(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 nd(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 Ct;(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"})(Ct||(Ct={}));class Qk{constructor(e){E(this,"server");E(this,"features");E(this,"disabled");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=Cs(e)),this.server=e,this.set(Ct.JS_KV,"2.6.2"),this.set(Ct.JS_OBJECTSTORE,"2.6.3"),this.set(Ct.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ct.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ct.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ct.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ct.JS_SIMPLIFICATION,"2.9.4"),this.set(Ct.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ct.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ct.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ct.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ct.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ct.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ct.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ct.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:nd(this.server,Cs(t))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var t;return((t=this.get(e))==null?void 0:t.ok)||!1}require(e){return typeof e=="string"&&(e=Cs(e)),nd(this.server,e)>=0}}class id extends Io{constructor(e,t){super(e,t)}async add(e,t,n=uc.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&&ga(i.config.durable_name);const a=this.nc;let{min:u,ok:c}=a.features.get(Ct.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{oc("name",f)}catch(g){const m=g.message,b=m.indexOf("cannot contain");throw b!==-1?new Error(`consumer 'name' ${m.substring(b)}`):g}let h,d="";if(Array.isArray(t.filter_subjects)){const{min:g,ok:m}=a.features.get(Ct.JS_MULTIPLE_CONSUMER_FILTER);if(!m)throw new Error(`consumer 'filter_subjects' requires server ${g}`);c=!1}if(t.metadata){const{min:g,ok:m}=a.features.get(Ct.JS_STREAM_CONSUMER_METADATA);if(!m)throw new Error(`consumer 'metadata' requires server ${g}`)}if(c&&(d=t.name??t.durable_name??""),d!==""){let g=t.filter_subject??void 0;g===">"&&(g=void 0),h=g!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${d}.${g}`:`${this.prefix}.CONSUMER.CREATE.${e}.${d}`}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),uc.Update)}async info(e,t){return Zr(e),ga(t),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`)}async delete(e,t){return Zr(e),ga(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 Co(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 xa(r,e,t=!1){if(t===!0&&!r)throw Ne.errorForCode(be.ApiError,new Error(`${e} is not a function`));if(r&&typeof r!="function")throw Ne.errorForCode(be.ApiError,new Error(`${e} is not a function`))}class Jk extends Rr{constructor(t,n,i){super();E(this,"sub");E(this,"adapter");E(this,"subIterDone");xa(i.adapter,"adapter",!0),this.adapter=i.adapter,i.callback&&xa(i.callback,"callback"),this.noIterator=typeof i.callback=="function",i.ingestionFilterFn&&(xa(i.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=i.ingestionFilterFn),i.protocolFilterFn&&(xa(i.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=i.protocolFilterFn),i.dispatchedFn&&(xa(i.dispatchedFn,"dispatchedFn"),this.dispatchedFn=i.dispatchedFn),i.cleanupFn&&xa(i.cleanupFn,"cleanupFn");let a=(d,y)=>{this.callback(d,y)};if(i.callback){const d=i.callback;a=(y,g)=>{const[m,b]=this.adapter(y,g);if(m){d(m,null);return}const{ingest:A}=this.ingestionFilterFn?this.ingestionFilterFn(b,this):{ingest:!0};A&&(!this.protocolFilterFn||this.protocolFilterFn(b))&&(d(m,b),this.dispatchedFn&&b&&this.dispatchedFn(b))}}const{max:u,queue:c,timeout:f}=i,h={queue:c,timeout:f,callback:a};u&&u>0&&(h.max=u),this.sub=t.subscribe(n,h),i.cleanupFn&&(this.sub.cleanupFn=i.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=tr(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(t){this.sub.unsubscribe(t)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(t,n){this.sub.cancelTimeout();const[i,a]=this.adapter(t,n);i&&this.stop(i),a&&this.push(a)}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 Sn;function Yk(r){Sn=r}function db(){return Sn!==void 0&&Sn.defaultPort!==void 0?Sn.defaultPort:4222}function sd(){return Sn!==void 0&&Sn.urlParseFn?Sn.urlParseFn:void 0}function Kk(){if(!Sn||typeof Sn.factory!="function")throw new Error("transport fn is not set");return Sn.factory()}function ad(){return Sn!==void 0&&Sn.dnsResolveFn?Sn.dnsResolveFn:void 0}const cc=`\r
|
|
149
|
+
`,lc=_a.fromAscii(cc),Zk=new Uint8Array(lc)[0],Xk=new Uint8Array(lc)[1];function eI(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===Zk&&r[t]===Xk)return t+1}return 0}function tI(r){const e=eI(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return un.decode(n)}return""}const rI=4,pb=48,nI=65,iI=97;function sI(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 aI(r)!==void 0}function aI(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return mb(r);case":":return oI(r)}}function mb(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}=uI(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return sI(e[0],e[1],e[2],e[3])}function oI(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}=cI(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=mb(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+=rI;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 uI(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)-pb),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 cI(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)-pb;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-iI+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-nI+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 lI(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function ud(r){return!lI(r)}function fI(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 hI(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=fI(r),ud(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=ud(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 Po{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=hI(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}://${ud(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Po(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&X0(t),this.resolves=t,t}}class dI{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 Po(i))}),this.randomize&&(this.servers=X0(this.servers))),this.servers.length===0&&this.addServer(`${Hh}:${db()}`,!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 Po(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 Po(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 pI{constructor(){E(this,"baseInbox");E(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Ei(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=rb(t)),i.resolver(e,t))}}}close(){const e=Ne.errorForCode(be.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class mI{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=tr();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 yI extends Error{constructor(e){super(e),this.name="AssertionError"}}function gI(r,e="Assertion failed."){if(!r)throw new yI(e)}const yb=32*1024,cd=2**32-2;function fc(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{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){gI(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=fc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(xi.encode(e))}write(e){const t=this._grow(e.byteLength);return fc(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)fc(this._buf.subarray(this._off),this._buf);else{if(i+e>cd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,cd));fc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,cd)),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(yb);for(;;){const i=this.capacity-this.length<yb,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 gb(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const vI=48;class vb{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=Se.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 Se.OP_START:switch(n){case Ee.M:case Ee.m:this.state=Se.OP_M,this.hdr=-1,this.ma=gb();break;case Ee.H:case Ee.h:this.state=Se.OP_H,this.hdr=0,this.ma=gb();break;case Ee.P:case Ee.p:this.state=Se.OP_P;break;case Ee.PLUS:this.state=Se.OP_PLUS;break;case Ee.MINUS:this.state=Se.OP_MINUS;break;case Ee.I:case Ee.i:this.state=Se.OP_I;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_H:switch(n){case Ee.M:case Ee.m:this.state=Se.OP_M;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_M:switch(n){case Ee.S:case Ee.s:this.state=Se.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MS:switch(n){case Ee.G:case Ee.g:this.state=Se.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MSG:switch(n){case Ee.SPACE:case Ee.TAB:this.state=Se.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MSG_SPC:switch(n){case Ee.SPACE:case Ee.TAB:continue;default:this.state=Se.MSG_ARG,this.as=t}break;case Se.MSG_ARG:switch(n){case Ee.CR:this.drop=1;break;case Ee.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=Se.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case Se.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=Se.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=Se.MSG_END);break;case Se.MSG_END:switch(n){case Ee.NL:this.drop=0,this.as=t+1,this.state=Se.OP_START;break;default:continue}break;case Se.OP_PLUS:switch(n){case Ee.O:case Ee.o:this.state=Se.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PLUS_O:switch(n){case Ee.K:case Ee.k:this.state=Se.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PLUS_OK:switch(n){case Ee.NL:this.dispatcher.push({kind:en.OK}),this.drop=0,this.state=Se.OP_START;break}break;case Se.OP_MINUS:switch(n){case Ee.E:case Ee.e:this.state=Se.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MINUS_E:switch(n){case Ee.R:case Ee.r:this.state=Se.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MINUS_ER:switch(n){case Ee.R:case Ee.r:this.state=Se.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MINUS_ERR:switch(n){case Ee.SPACE:case Ee.TAB:this.state=Se.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_MINUS_ERR_SPC:switch(n){case Ee.SPACE:case Ee.TAB:continue;default:this.state=Se.MINUS_ERR_ARG,this.as=t}break;case Se.MINUS_ERR_ARG:switch(n){case Ee.CR:this.drop=1;break;case Ee.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=Se.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case Se.OP_P:switch(n){case Ee.I:case Ee.i:this.state=Se.OP_PI;break;case Ee.O:case Ee.o:this.state=Se.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PO:switch(n){case Ee.N:case Ee.n:this.state=Se.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PON:switch(n){case Ee.G:case Ee.g:this.state=Se.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PONG:switch(n){case Ee.NL:this.dispatcher.push({kind:en.PONG}),this.drop=0,this.state=Se.OP_START;break}break;case Se.OP_PI:switch(n){case Ee.N:case Ee.n:this.state=Se.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PIN:switch(n){case Ee.G:case Ee.g:this.state=Se.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_PING:switch(n){case Ee.NL:this.dispatcher.push({kind:en.PING}),this.drop=0,this.state=Se.OP_START;break}break;case Se.OP_I:switch(n){case Ee.N:case Ee.n:this.state=Se.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_IN:switch(n){case Ee.F:case Ee.f:this.state=Se.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_INF:switch(n){case Ee.O:case Ee.o:this.state=Se.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_INFO:switch(n){case Ee.SPACE:case Ee.TAB:this.state=Se.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case Se.OP_INFO_SPC:switch(n){case Ee.SPACE:case Ee.TAB:continue;default:this.state=Se.INFO_ARG,this.as=t}break;case Se.INFO_ARG:switch(n){case Ee.CR:this.drop=1;break;case Ee.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=Se.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===Se.MSG_ARG||this.state===Se.MINUS_ERR_ARG||this.state===Se.INFO_ARG)&&!this.argBuf&&(this.argBuf=new ld(e.subarray(this.as,t-this.drop))),this.state===Se.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 Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.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}: ${un.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.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]-vI)}return t}}var Se;(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"})(Se||(Se={}));var Ee;(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"})(Ee||(Ee={})),function(r){var e=function(_,I){this.hi=_|0,this.lo=I|0},t=function(_){var I,k=new Float64Array(16);if(_)for(I=0;I<_.length;I++)k[I]=_[I];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]),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(_,I){return _<<I|_>>>32-I}function A(_,I){var k=_[I+3]&255;return k=k<<8|_[I+2]&255,k=k<<8|_[I+1]&255,k<<8|_[I+0]&255}function x(_,I){var k=_[I]<<24|_[I+1]<<16|_[I+2]<<8|_[I+3],P=_[I+4]<<24|_[I+5]<<16|_[I+6]<<8|_[I+7];return new e(k,P)}function w(_,I,k){var P;for(P=0;P<4;P++)_[I+P]=k&255,k>>>=8}function O(_,I,k){_[I]=k.hi>>24&255,_[I+1]=k.hi>>16&255,_[I+2]=k.hi>>8&255,_[I+3]=k.hi&255,_[I+4]=k.lo>>24&255,_[I+5]=k.lo>>16&255,_[I+6]=k.lo>>8&255,_[I+7]=k.lo&255}function C(_,I,k,P,M){var U,ie=0;for(U=0;U<M;U++)ie|=_[I+U]^k[P+U];return(1&ie-1>>>8)-1}function D(_,I,k,P){return C(_,I,k,P,16)}function F(_,I,k,P){return C(_,I,k,P,32)}function B(_,I,k,P,M){var U=new Uint32Array(16),ie=new Uint32Array(16),de=new Uint32Array(16),Y=new Uint32Array(4),ne,Le,yt;for(ne=0;ne<4;ne++)ie[5*ne]=A(P,4*ne),ie[1+ne]=A(k,4*ne),ie[6+ne]=A(I,4*ne),ie[11+ne]=A(k,16+4*ne);for(ne=0;ne<16;ne++)de[ne]=ie[ne];for(ne=0;ne<20;ne++){for(Le=0;Le<4;Le++){for(yt=0;yt<4;yt++)Y[yt]=ie[(5*Le+4*yt)%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),yt=0;yt<4;yt++)U[4*Le+(Le+yt)%4]=Y[yt]}for(yt=0;yt<16;yt++)ie[yt]=U[yt]}if(M){for(ne=0;ne<16;ne++)ie[ne]=ie[ne]+de[ne]|0;for(ne=0;ne<4;ne++)ie[5*ne]=ie[5*ne]-A(P,4*ne)|0,ie[6+ne]=ie[6+ne]-A(I,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]+de[ne]|0)}function ee(_,I,k,P){return B(_,I,k,P,!1),0}function Q(_,I,k,P){return B(_,I,k,P,!0),0}var re=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function fe(_,I,k,P,M,U,ie){var de=new Uint8Array(16),Y=new Uint8Array(64),ne,Le;if(!M)return 0;for(Le=0;Le<16;Le++)de[Le]=0;for(Le=0;Le<8;Le++)de[Le]=U[Le];for(;M>=64;){for(ee(Y,de,ie,re),Le=0;Le<64;Le++)_[I+Le]=(k?k[P+Le]:0)^Y[Le];for(ne=1,Le=8;Le<16;Le++)ne=ne+(de[Le]&255)|0,de[Le]=ne&255,ne>>>=8;M-=64,I+=64,k&&(P+=64)}if(M>0)for(ee(Y,de,ie,re),Le=0;Le<M;Le++)_[I+Le]=(k?k[P+Le]:0)^Y[Le];return 0}function ge(_,I,k,P,M){return fe(_,I,null,0,k,P,M)}function he(_,I,k,P,M){var U=new Uint8Array(32);return Q(U,P,M,re),ge(_,I,k,P.subarray(16),U)}function ve(_,I,k,P,M,U,ie){var de=new Uint8Array(32);return Q(de,U,ie,re),fe(_,I,k,P,M,U.subarray(16),de)}function Ie(_,I){var k,P=0;for(k=0;k<17;k++)P=P+(_[k]+I[k]|0)|0,_[k]=P&255,P>>>=8}var ye=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Be(_,I,k,P,M,U){var ie,de,Y,ne,Le=new Uint32Array(17),yt=new Uint32Array(17),Xt=new Uint32Array(17),En=new Uint32Array(17),Ai=new Uint32Array(17);for(Y=0;Y<17;Y++)yt[Y]=Xt[Y]=0;for(Y=0;Y<16;Y++)yt[Y]=U[Y];for(yt[3]&=15,yt[4]&=252,yt[7]&=15,yt[8]&=252,yt[11]&=15,yt[12]&=252,yt[15]&=15;M>0;){for(Y=0;Y<17;Y++)En[Y]=0;for(Y=0;Y<16&&Y<M;++Y)En[Y]=k[P+Y];for(En[Y]=1,P+=Y,M-=Y,Ie(Xt,En),de=0;de<17;de++)for(Le[de]=0,Y=0;Y<17;Y++)Le[de]=Le[de]+Xt[Y]*(Y<=de?yt[de-Y]:320*yt[de+17-Y]|0)|0|0;for(de=0;de<17;de++)Xt[de]=Le[de];for(ne=0,Y=0;Y<16;Y++)ne=ne+Xt[Y]|0,Xt[Y]=ne&255,ne>>>=8;for(ne=ne+Xt[16]|0,Xt[16]=ne&3,ne=5*(ne>>>2)|0,Y=0;Y<16;Y++)ne=ne+Xt[Y]|0,Xt[Y]=ne&255,ne>>>=8;ne=ne+Xt[16]|0,Xt[16]=ne}for(Y=0;Y<17;Y++)Ai[Y]=Xt[Y];for(Ie(Xt,ye),ie=-(Xt[16]>>>7)|0,Y=0;Y<17;Y++)Xt[Y]^=ie&(Ai[Y]^Xt[Y]);for(Y=0;Y<16;Y++)En[Y]=U[Y+16];for(En[16]=0,Ie(Xt,En),Y=0;Y<16;Y++)_[I+Y]=Xt[Y];return 0}function _e(_,I,k,P,M,U){var ie=new Uint8Array(16);return Be(ie,0,k,P,M,U),D(_,I,ie,0)}function ce(_,I,k,P,M){var U;if(k<32)return-1;for(ve(_,0,I,0,k,P,M),Be(_,16,_,32,k-32,_),U=0;U<16;U++)_[U]=0;return 0}function Ae(_,I,k,P,M){var U,ie=new Uint8Array(32);if(k<32||(he(ie,0,32,P,M),_e(I,16,I,32,k-32,ie)!==0))return-1;for(ve(_,0,I,0,k,P,M),U=0;U<32;U++)_[U]=0;return 0}function Me(_,I){var k;for(k=0;k<16;k++)_[k]=I[k]|0}function Oe(_){var I,k;for(k=0;k<16;k++)_[k]+=65536,I=Math.floor(_[k]/65536),_[(k+1)*(k<15?1:0)]+=I-1+37*(I-1)*(k===15?1:0),_[k]-=I*65536}function tt(_,I,k){for(var P,M=~(k-1),U=0;U<16;U++)P=M&(_[U]^I[U]),_[U]^=P,I[U]^=P}function Tt(_,I){var k,P,M,U=t(),ie=t();for(k=0;k<16;k++)ie[k]=I[k];for(Oe(ie),Oe(ie),Oe(ie),P=0;P<2;P++){for(U[0]=ie[0]-65517,k=1;k<15;k++)U[k]=ie[k]-65535-(U[k-1]>>16&1),U[k-1]&=65535;U[15]=ie[15]-32767-(U[14]>>16&1),M=U[15]>>16&1,U[14]&=65535,tt(ie,U,1-M)}for(k=0;k<16;k++)_[2*k]=ie[k]&255,_[2*k+1]=ie[k]>>8}function ft(_,I){var k=new Uint8Array(32),P=new Uint8Array(32);return Tt(k,_),Tt(P,I),F(k,0,P,0)}function Pt(_){var I=new Uint8Array(32);return Tt(I,_),I[0]&1}function rt(_,I){var k;for(k=0;k<16;k++)_[k]=I[2*k]+(I[2*k+1]<<8);_[15]&=32767}function Ye(_,I,k){var P;for(P=0;P<16;P++)_[P]=I[P]+k[P]|0}function pt(_,I,k){var P;for(P=0;P<16;P++)_[P]=I[P]-k[P]|0}function Fe(_,I,k){var P,M,U=new Float64Array(31);for(P=0;P<31;P++)U[P]=0;for(P=0;P<16;P++)for(M=0;M<16;M++)U[P+M]+=I[P]*k[M];for(P=0;P<15;P++)U[P]+=38*U[P+16];for(P=0;P<16;P++)_[P]=U[P];Oe(_),Oe(_)}function wt(_,I){Fe(_,I,I)}function z(_,I){var k=t(),P;for(P=0;P<16;P++)k[P]=I[P];for(P=253;P>=0;P--)wt(k,k),P!==2&&P!==4&&Fe(k,k,I);for(P=0;P<16;P++)_[P]=k[P]}function K(_,I){var k=t(),P;for(P=0;P<16;P++)k[P]=I[P];for(P=250;P>=0;P--)wt(k,k),P!==1&&Fe(k,k,I);for(P=0;P<16;P++)_[P]=k[P]}function V(_,I,k){var P=new Uint8Array(32),M=new Float64Array(80),U,ie,de=t(),Y=t(),ne=t(),Le=t(),yt=t(),Xt=t();for(ie=0;ie<31;ie++)P[ie]=I[ie];for(P[31]=I[31]&127|64,P[0]&=248,rt(M,k),ie=0;ie<16;ie++)Y[ie]=M[ie],Le[ie]=de[ie]=ne[ie]=0;for(de[0]=Le[0]=1,ie=254;ie>=0;--ie)U=P[ie>>>3]>>>(ie&7)&1,tt(de,Y,U),tt(ne,Le,U),Ye(yt,de,ne),pt(de,de,ne),Ye(ne,Y,Le),pt(Y,Y,Le),wt(Le,yt),wt(Xt,de),Fe(de,ne,de),Fe(ne,Y,yt),Ye(yt,de,ne),pt(de,de,ne),wt(Y,de),pt(ne,Le,Xt),Fe(de,ne,f),Ye(de,de,Le),Fe(ne,ne,de),Fe(de,Le,Xt),Fe(Le,Y,M),wt(Y,yt),tt(de,Y,U),tt(ne,Le,U);for(ie=0;ie<16;ie++)M[ie+16]=de[ie],M[ie+32]=ne[ie],M[ie+48]=Y[ie],M[ie+64]=Le[ie];var En=M.subarray(32),Ai=M.subarray(16);return z(En,En),Fe(Ai,Ai,En),Tt(_,Ai),0}function J(_,I){return V(_,I,a)}function X(_,I){return n(I,32),J(_,I)}function G(_,I,k){var P=new Uint8Array(32);return V(P,k,I),Q(_,i,P,re)}var Ce=ce,Ge=Ae;function Ve(_,I,k,P,M,U){var ie=new Uint8Array(32);return G(ie,M,U),Ce(_,I,k,P,ie)}function le(_,I,k,P,M,U){var ie=new Uint8Array(32);return G(ie,M,U),Ge(_,I,k,P,ie)}function xe(){var _=0,I=0,k=0,P=0,M=65535,U,ie,de;for(de=0;de<arguments.length;de++)U=arguments[de].lo,ie=arguments[de].hi,_+=U&M,I+=U>>>16,k+=ie&M,P+=ie>>>16;return I+=_>>>16,k+=I>>>16,P+=k>>>16,new e(k&M|P<<16,_&M|I<<16)}function Ze(_,I){return new e(_.hi>>>I,_.lo>>>I|_.hi<<32-I)}function At(){var _=0,I=0,k;for(k=0;k<arguments.length;k++)_^=arguments[k].lo,I^=arguments[k].hi;return new e(I,_)}function _t(_,I){var k,P,M=32-I;return I<32?(k=_.hi>>>I|_.lo<<M,P=_.lo>>>I|_.hi<<M):I<64&&(k=_.lo>>>I|_.hi<<M,P=_.hi>>>I|_.lo<<M),new e(k,P)}function Qt(_,I,k){var P=_.hi&I.hi^~_.hi&k.hi,M=_.lo&I.lo^~_.lo&k.lo;return new e(P,M)}function mt(_,I,k){var P=_.hi&I.hi^_.hi&k.hi^I.hi&k.hi,M=_.lo&I.lo^_.lo&k.lo^I.lo&k.lo;return new e(P,M)}function Ut(_){return At(_t(_,28),_t(_,34),_t(_,39))}function rr(_){return At(_t(_,14),_t(_,18),_t(_,41))}function Mr(_){return At(_t(_,1),_t(_,8),Ze(_,7))}function zt(_){return At(_t(_,19),_t(_,61),Ze(_,6))}var Jt=[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 Zt(_,I,k){var P=[],M=[],U=[],ie=[],de,Y,ne;for(Y=0;Y<8;Y++)P[Y]=U[Y]=x(_,8*Y);for(var Le=0;k>=128;){for(Y=0;Y<16;Y++)ie[Y]=x(I,8*Y+Le);for(Y=0;Y<80;Y++){for(ne=0;ne<8;ne++)M[ne]=U[ne];for(de=xe(U[7],rr(U[4]),Qt(U[4],U[5],U[6]),Jt[Y],ie[Y%16]),M[7]=xe(de,Ut(U[0]),mt(U[0],U[1],U[2])),M[3]=xe(M[3],de),ne=0;ne<8;ne++)U[(ne+1)%8]=M[ne];if(Y%16===15)for(ne=0;ne<16;ne++)ie[ne]=xe(ie[ne],ie[(ne+9)%16],Mr(ie[(ne+1)%16]),zt(ie[(ne+14)%16]))}for(Y=0;Y<8;Y++)U[Y]=xe(U[Y],P[Y]),P[Y]=U[Y];Le+=128,k-=128}for(Y=0;Y<8;Y++)O(_,8*Y,P[Y]);return k}var W=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 H(_,I,k){var P=new Uint8Array(64),M=new Uint8Array(256),U,ie=k;for(U=0;U<64;U++)P[U]=W[U];for(Zt(P,I,k),k%=128,U=0;U<256;U++)M[U]=0;for(U=0;U<k;U++)M[U]=I[ie-k+U];for(M[k]=128,k=256-128*(k<112?1:0),M[k-9]=0,O(M,k-8,new e(ie/536870912|0,ie<<3)),Zt(P,M,k),U=0;U<64;U++)_[U]=P[U];return 0}function ze(_,I){var k=t(),P=t(),M=t(),U=t(),ie=t(),de=t(),Y=t(),ne=t(),Le=t();pt(k,_[1],_[0]),pt(Le,I[1],I[0]),Fe(k,k,Le),Ye(P,_[0],_[1]),Ye(Le,I[0],I[1]),Fe(P,P,Le),Fe(M,_[3],I[3]),Fe(M,M,d),Fe(U,_[2],I[2]),Ye(U,U,U),pt(ie,P,k),pt(de,U,M),Ye(Y,U,M),Ye(ne,P,k),Fe(_[0],ie,de),Fe(_[1],ne,Y),Fe(_[2],Y,de),Fe(_[3],ie,ne)}function We(_,I,k){var P;for(P=0;P<4;P++)tt(_[P],I[P],k)}function kt(_,I){var k=t(),P=t(),M=t();z(M,I[2]),Fe(k,I[0],M),Fe(P,I[1],M),Tt(_,P),_[31]^=Pt(k)<<7}function Ke(_,I,k){var P,M;for(Me(_[0],u),Me(_[1],c),Me(_[2],c),Me(_[3],u),M=255;M>=0;--M)P=k[M/8|0]>>(M&7)&1,We(_,I,P),ze(I,_),ze(_,_),We(_,I,P)}function nr(_,I){var k=[t(),t(),t(),t()];Me(k[0],y),Me(k[1],g),Me(k[2],c),Fe(k[3],y,g),Ke(_,k,I)}function dr(_,I,k){var P=new Uint8Array(64),M=[t(),t(),t(),t()],U;for(k||n(I,32),H(P,I,32),P[0]&=248,P[31]&=127,P[31]|=64,nr(M,P),kt(_,M),U=0;U<32;U++)I[U+32]=_[U];return 0}var Mt=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 Ht(_,I){var k,P,M,U;for(P=63;P>=32;--P){for(k=0,M=P-32,U=P-12;M<U;++M)I[M]+=k-16*I[P]*Mt[M-(P-32)],k=Math.floor((I[M]+128)/256),I[M]-=k*256;I[M]+=k,I[P]=0}for(k=0,M=0;M<32;M++)I[M]+=k-(I[31]>>4)*Mt[M],k=I[M]>>8,I[M]&=255;for(M=0;M<32;M++)I[M]-=k*Mt[M];for(P=0;P<32;P++)I[P+1]+=I[P]>>8,_[P]=I[P]&255}function Ur(_){var I=new Float64Array(64),k;for(k=0;k<64;k++)I[k]=_[k];for(k=0;k<64;k++)_[k]=0;Ht(_,I)}function $r(_,I,k,P){var M=new Uint8Array(64),U=new Uint8Array(64),ie=new Uint8Array(64),de,Y,ne=new Float64Array(64),Le=[t(),t(),t(),t()];H(M,P,32),M[0]&=248,M[31]&=127,M[31]|=64;var yt=k+64;for(de=0;de<k;de++)_[64+de]=I[de];for(de=0;de<32;de++)_[32+de]=M[32+de];for(H(ie,_.subarray(32),k+32),Ur(ie),nr(Le,ie),kt(_,Le),de=32;de<64;de++)_[de]=P[de];for(H(U,_,k+64),Ur(U),de=0;de<64;de++)ne[de]=0;for(de=0;de<32;de++)ne[de]=ie[de];for(de=0;de<32;de++)for(Y=0;Y<32;Y++)ne[de+Y]+=U[de]*M[Y];return Ht(_.subarray(32),ne),yt}function ir(_,I){var k=t(),P=t(),M=t(),U=t(),ie=t(),de=t(),Y=t();return Me(_[2],c),rt(_[1],I),wt(M,_[1]),Fe(U,M,h),pt(M,M,_[2]),Ye(U,_[2],U),wt(ie,U),wt(de,ie),Fe(Y,de,ie),Fe(k,Y,M),Fe(k,k,U),K(k,k),Fe(k,k,M),Fe(k,k,U),Fe(k,k,U),Fe(_[0],k,U),wt(P,_[0]),Fe(P,P,U),ft(P,M)&&Fe(_[0],_[0],m),wt(P,_[0]),Fe(P,P,U),ft(P,M)?-1:(Pt(_[0])===I[31]>>7&&pt(_[0],u,_[0]),Fe(_[3],_[0],_[1]),0)}function cn(_,I,k,P){var M,U=new Uint8Array(32),ie=new Uint8Array(64),de=[t(),t(),t(),t()],Y=[t(),t(),t(),t()];if(k<64||ir(Y,P))return-1;for(M=0;M<k;M++)_[M]=I[M];for(M=0;M<32;M++)_[M+32]=P[M];if(H(ie,_,k),Ur(ie),Ke(de,Y,ie),nr(Y,I.subarray(32)),ze(de,Y),kt(U,de),k-=64,F(I,0,U,0)){for(M=0;M<k;M++)_[M]=0;return-1}for(M=0;M<k;M++)_[M]=I[M+64];return k}var Sr=32,Er=24,Or=32,Ar=16,cr=32,Hr=32,kr=32,Tr=32,Fr=32,ln=Er,Un=Or,R=Ar,ae=64,we=32,Pe=64,Ue=32,ot=64;r.lowlevel={crypto_core_hsalsa20:Q,crypto_stream_xor:ve,crypto_stream:he,crypto_stream_salsa20_xor:fe,crypto_stream_salsa20:ge,crypto_onetimeauth:Be,crypto_onetimeauth_verify:_e,crypto_verify_16:D,crypto_verify_32:F,crypto_secretbox:ce,crypto_secretbox_open:Ae,crypto_scalarmult:V,crypto_scalarmult_base:J,crypto_box_beforenm:G,crypto_box_afternm:Ce,crypto_box:Ve,crypto_box_open:le,crypto_box_keypair:X,crypto_hash:H,crypto_sign:$r,crypto_sign_keypair:dr,crypto_sign_open:cn,crypto_secretbox_KEYBYTES:Sr,crypto_secretbox_NONCEBYTES:Er,crypto_secretbox_ZEROBYTES:Or,crypto_secretbox_BOXZEROBYTES:Ar,crypto_scalarmult_BYTES:cr,crypto_scalarmult_SCALARBYTES:Hr,crypto_box_PUBLICKEYBYTES:kr,crypto_box_SECRETKEYBYTES:Tr,crypto_box_BEFORENMBYTES:Fr,crypto_box_NONCEBYTES:ln,crypto_box_ZEROBYTES:Un,crypto_box_BOXZEROBYTES:R,crypto_sign_BYTES:ae,crypto_sign_PUBLICKEYBYTES:we,crypto_sign_SECRETKEYBYTES:Pe,crypto_sign_SEEDBYTES:Ue,crypto_hash_BYTES:ot,gf:t,D:h,L:Mt,pack25519:Tt,unpack25519:rt,M:Fe,A:Ye,S:wt,Z:pt,pow2523:K,add:ze,set25519:Me,modL:Ht,scalarmult:Ke,scalarbase:nr};function st(_,I){if(_.length!==Sr)throw new Error("bad key size");if(I.length!==Er)throw new Error("bad nonce size")}function nt(_,I){if(_.length!==kr)throw new Error("bad public key size");if(I.length!==Tr)throw new Error("bad secret key size")}function it(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function xt(_){for(var I=0;I<_.length;I++)_[I]=0}r.randomBytes=function(_){var I=new Uint8Array(_);return n(I,_),I},r.secretbox=function(_,I,k){it(_,I,k),st(k,I);for(var P=new Uint8Array(Or+_.length),M=new Uint8Array(P.length),U=0;U<_.length;U++)P[U+Or]=_[U];return ce(M,P,P.length,I,k),M.subarray(Ar)},r.secretbox.open=function(_,I,k){it(_,I,k),st(k,I);for(var P=new Uint8Array(Ar+_.length),M=new Uint8Array(P.length),U=0;U<_.length;U++)P[U+Ar]=_[U];return P.length<32||Ae(M,P,P.length,I,k)!==0?null:M.subarray(Or)},r.secretbox.keyLength=Sr,r.secretbox.nonceLength=Er,r.secretbox.overheadLength=Ar,r.scalarMult=function(_,I){if(it(_,I),_.length!==Hr)throw new Error("bad n size");if(I.length!==cr)throw new Error("bad p size");var k=new Uint8Array(cr);return V(k,_,I),k},r.scalarMult.base=function(_){if(it(_),_.length!==Hr)throw new Error("bad n size");var I=new Uint8Array(cr);return J(I,_),I},r.scalarMult.scalarLength=Hr,r.scalarMult.groupElementLength=cr,r.box=function(_,I,k,P){var M=r.box.before(k,P);return r.secretbox(_,I,M)},r.box.before=function(_,I){it(_,I),nt(_,I);var k=new Uint8Array(Fr);return G(k,_,I),k},r.box.after=r.secretbox,r.box.open=function(_,I,k,P){var M=r.box.before(k,P);return r.secretbox.open(_,I,M)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var _=new Uint8Array(kr),I=new Uint8Array(Tr);return X(_,I),{publicKey:_,secretKey:I}},r.box.keyPair.fromSecretKey=function(_){if(it(_),_.length!==Tr)throw new Error("bad secret key size");var I=new Uint8Array(kr);return J(I,_),{publicKey:I,secretKey:new Uint8Array(_)}},r.box.publicKeyLength=kr,r.box.secretKeyLength=Tr,r.box.sharedKeyLength=Fr,r.box.nonceLength=ln,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(_,I){if(it(_,I),I.length!==Pe)throw new Error("bad secret key size");var k=new Uint8Array(ae+_.length);return $r(k,_,_.length,I),k},r.sign.open=function(_,I){if(it(_,I),I.length!==we)throw new Error("bad public key size");var k=new Uint8Array(_.length),P=cn(k,_,_.length,I);if(P<0)return null;for(var M=new Uint8Array(P),U=0;U<M.length;U++)M[U]=k[U];return M},r.sign.detached=function(_,I){for(var k=r.sign(_,I),P=new Uint8Array(ae),M=0;M<P.length;M++)P[M]=k[M];return P},r.sign.detached.verify=function(_,I,k){if(it(_,I,k),I.length!==ae)throw new Error("bad signature size");if(k.length!==we)throw new Error("bad public key size");var P=new Uint8Array(ae+_.length),M=new Uint8Array(ae+_.length),U;for(U=0;U<ae;U++)P[U]=I[U];for(U=0;U<_.length;U++)P[U+ae]=_[U];return cn(M,P,P.length,k)>=0},r.sign.keyPair=function(){var _=new Uint8Array(we),I=new Uint8Array(Pe);return dr(_,I),{publicKey:_,secretKey:I}},r.sign.keyPair.fromSecretKey=function(_){if(it(_),_.length!==Pe)throw new Error("bad secret key size");for(var I=new Uint8Array(we),k=0;k<I.length;k++)I[k]=_[32+k];return{publicKey:I,secretKey:new Uint8Array(_)}},r.sign.keyPair.fromSeed=function(_){if(it(_),_.length!==Ue)throw new Error("bad seed size");for(var I=new Uint8Array(we),k=new Uint8Array(Pe),P=0;P<32;P++)k[P]=_[P];return dr(I,k,!0),{publicKey:I,secretKey:k}},r.sign.publicKeyLength=we,r.sign.secretKeyLength=Pe,r.sign.seedLength=Ue,r.sign.signatureLength=ae,r.hash=function(_){it(_);var I=new Uint8Array(ot);return H(I,_,_.length),I},r.hash.hashLength=ot,r.verify=function(_,I){return it(_,I),_.length===0||I.length===0||_.length!==I.length?!1:C(_,0,I,0,_.length)===0},r.setPRNG=function(_){n=_},function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var I=65536;r.setPRNG(function(k,P){var M,U=new Uint8Array(P);for(M=0;M<P;M+=I)_.getRandomValues(U.subarray(M,M+Math.min(P-M,I)));for(M=0;M<P;M++)k[M]=U[M];xt(U)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&r.setPRNG(function(k,P){var M,U=_.randomBytes(P);for(M=0;M<P;M++)k[M]=U[M];xt(U)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,bI={fromSeed:hc.sign.keyPair.fromSeed,sign:hc.sign.detached,verify:hc.sign.detached.verify,randomBytes:hc.randomBytes};let bb;function wI(r){bb=r}function is(){return bb}const _I=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 dc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^_I[(t>>8^i)&255]}return t}static validate(e,t){return dc.checksum(e)==t}}const fd="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class wb{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++]=fd.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=fd.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=fd.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 Vt 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 xI(){return pc(Wt.Operator)}function SI(){return pc(Wt.Account)}function EI(){return pc(Wt.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 Wt;(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"})(Wt||(Wt={}));class Sa{static isValidPublicPrefix(e){return e==Wt.Server||e==Wt.Operator||e==Wt.Cluster||e==Wt.Account||e==Wt.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 Wt.Seed:return Wt.Seed;case Wt.Private:return Wt.Private;case Wt.Operator:return Wt.Operator;case Wt.Server:return Wt.Server;case Wt.Cluster:return Wt.Cluster;case Wt.Account:return Wt.Account;case Wt.User:return Wt.User;default:return-1}}}class tn{static encode(e,t){if(!t||!(t instanceof Uint8Array))throw new Vt(qt.SerializationError);if(!Sa.isValidPrefix(e))throw new Vt(qt.InvalidPrefixByte);return tn._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new Vt(qt.ApiError);if(!Sa.isValidPublicPrefix(e))throw new Vt(qt.InvalidPrefixByte);if(t.byteLength!==32)throw new Vt(qt.InvalidSeedLen);return tn._encode(!0,e,t)}static decode(e,t){if(!Sa.isValidPrefix(e))throw new Vt(qt.InvalidPrefixByte);const n=tn._decode(t);if(n[0]!==e)throw new Vt(qt.InvalidPrefixByte);return n.slice(1)}static decodeSeed(e){const t=tn._decode(e),n=tn._decodePrefix(t);if(n[0]!=Wt.Seed)throw new Vt(qt.InvalidSeed);if(!Sa.isValidPublicPrefix(n[1]))throw new Vt(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=tn._encodePrefix(Wt.Seed,t);f.set(y)}else f[0]=t;f.set(n,i);const h=dc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),wb.encode(f)}static _decode(e){if(e.byteLength<4)throw new Vt(qt.InvalidEncoding);let t;try{t=wb.decode(e)}catch(c){throw new Vt(qt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!dc.validate(u,a))throw new Vt(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 _b{constructor(e){E(this,"seed");this.seed=e}getRawSeed(){if(!this.seed)throw new Vt(qt.ClearedPair);return tn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Vt(qt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Vt(qt.ClearedPair);const e=tn.decodeSeed(this.seed),t=is().fromSeed(this.getRawSeed()),n=tn.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new Vt(qt.ClearedPair);const e=is().fromSeed(this.getRawSeed());return tn.encode(Wt.Private,e.secretKey)}sign(e){if(!this.seed)throw new Vt(qt.ClearedPair);const t=is().fromSeed(this.getRawSeed());return is().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new Vt(qt.ClearedPair);const n=is().fromSeed(this.getRawSeed());return is().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function pc(r){const e=is().randomBytes(32);let t=tn.encodeSeed(r,new Uint8Array(e));return new _b(t)}class OI{constructor(e){E(this,"publicKey");this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new Vt(qt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Vt(qt.PublicKeyOnly):new Vt(qt.ClearedPair)}getSeed(){throw this.publicKey?new Vt(qt.PublicKeyOnly):new Vt(qt.ClearedPair)}sign(e){throw this.publicKey?new Vt(qt.CannotSign):new Vt(qt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new Vt(qt.ClearedPair);let n=tn._decode(this.publicKey);return is().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function TI(r){const e=new TextEncoder().encode(r),t=tn._decode(e),n=Sa.parsePrefix(t[0]);if(Sa.isValidPublicPrefix(n))return new OI(e);throw new Vt(qt.InvalidPublicKey)}function AI(r){return tn.decodeSeed(r),new _b(r)}function kI(r){return btoa(String.fromCharCode(...r))}function II(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}wI(bI);const xb={createAccount:SI,createOperator:xI,createPair:pc,createUser:EI,fromPublic:TI,fromSeed:AI,NKeysError:Vt,NKeysErrorCode:qt,Prefix:Wt,decode:II,encode:kI};function CI(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function PI(){return()=>{}}function NI(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function RI(r){return()=>({auth_token:typeof r=="function"?r():r})}function DI(r){return e=>{const t=typeof r=="function"?r():r,n=t?xb.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=xi.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?xb.encode(u):"";return{nkey:i,sig:c}}}function MI(r,e){return t=>{const n=typeof r=="function"?r():r,i=DI(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function FI(r){const e=typeof r!="function"?()=>r:r,t=()=>{const a=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,u=un.decode(e());let c=a.exec(u);if(!c)throw Ne.errorForCode(be.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Ne.errorForCode(be.BadCreds);const h=xi.encode(c[1].trim());return{jwt:f,seed:h}};return MI(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const Sb=2*60*1e3,LI=2,Eb=2*1e3;function jI(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Eb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function qI(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(RI(r.token)),r.user&&e.push(NI(r.user,r.pass)),e.length===0?PI():CI(e)}function UI(r){const e=`${Hh}:${db()}`;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 Ne("port and servers options are mutually exclusive",be.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Hh}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=sc(jI(),r);if(t.authenticator=qI(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Ne(`${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{Ei(t.inboxPrefix)}catch(n){throw new Ne(n.message,be.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof ad()=="function"),t.resolve&&typeof ad()!="function")throw new Ne("'resolve' is not supported on this client",be.InvalidOption);return t}function $I(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Ne("noEcho",be.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Ne("tls",be.ServerOptionNotAvailable)}const BI=1024*32,VI=/^INFO\s+([^\r\n]+)\r\n/i,WI=Eo(`PONG\r
|
|
150
|
+
`),Ob=Eo(`PING\r
|
|
151
|
+
`);class zI{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):{})||{};sc(this,i)}}class Tb extends Rr{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");sc(this,i),this.protocol=t,this.subject=n,this.draining=!1,this.noIterator=typeof i.callback=="function",this.closed=tr();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(Ne.errorForCode(be.ConnectionClosed)):this.isClosed()?Promise.reject(Ne.errorForCode(be.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(tr()).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 HI{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 mc{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=BI,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new HI,this.muxSubscriptions=new pI,this.outbound=new _a,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new Qk({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new dI(n,{randomize:!e.noRandomize}),this.closed=tr(),this.parser=new vb(this),this.heartbeats=new mI(this,this.options.pingInterval||Sb,this.options.maxPingOut||LI)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Ne.errorForCode(be.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new vb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Rr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=tr();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=Kk(),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:Si.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var t;this.dispatchStatus({type:Si.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:ad(),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():Eb;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Ne.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 mc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Ne(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 Ne(e,be.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Ne(e,be.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Ne(e,be.AccountExpired):t.indexOf("authentication timeout")!==-1?new Ne(e,be.AuthenticationTimeout):new Ne(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 Yh(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=G0(e),n=mc.toError(t),i={type:Si.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(WI)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(G0(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(Cs(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:a,lang:u}=this.transport;try{const c=new zI({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(Eo(`CONNECT ${f}${cc}`)),this.transport.send(Ob)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Si.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Si.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=Eo(e):i=e,this.outbound.fill(i,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=wn,n){let i;if(t instanceof Uint8Array)i=t;else if(typeof t=="string")i=xi.encode(t);else throw Ne.errorForCode(be.BadPayload);let a=i.length;n=n||{},n.reply=n.reply||"";let u=wn,c=0;if(n.headers){if(this.info&&!this.info.headers)throw new Ne("headers",be.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Ne.errorForCode(be.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,lc)):(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,lc))}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=nr()),this.pongs.push(e),this.outbound.fill(Ob),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}${oc}`):e.push(`SUB ${n.subject} ${n.sid}${oc}`)}),e.length&&this.transport.send(xo(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 Tb(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 WI="$SRV";class Ab{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||Oi(),(a=i.headers)==null||a.set(tc,`${e}`),(u=i.headers)==null||u.set(ec,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!==""&&HI("service group",t);let i="";if(e instanceof Co)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;Eo("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,zI("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 zI(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 HI(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 Co{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"),Eo("name",this.config.name),Eo("queue",this.config.queue),Ps(this.config.version),this._id=Is.next(),this.internal=[],this._done=nr(),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??WI;return t===""&&n===""?`${a}.${e}`:(Eo("control subject name",t),n!==""?(Eo("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=Oi();if(e instanceof rc){const n=e;t.set(ec,n.message),t.set(tc,`${n.code}`)}else t.set(ec,e.message),t.set(tc,"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 QI(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 Ab(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:So.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:So.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=Co.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(es.PING,a),this.addInternalHandler(es.STATS,t),this.addInternalHandler(es.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:So.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 Dr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new Ab(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class QI{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 GI{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(es.PING,e,t)}stats(e="",t=""){return this.q(es.STATS,e,t)}info(e="",t=""){return this.q(es.INFO,e,t)}async q(e,t="",n=""){const i=new Dr,a=Ln(),u=Co.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 kb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function JI(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:kb(),storage:td.File}}const pc="KV-Operation",Ib="$KV",YI=/^[-/=.\w]+$/,KI=/^[-/=.>*\w]+$/,ZI=/^[-\w]+$/;function XI(r){if(r.startsWith(".")||r.endsWith(".")||!YI.test(r))throw new Error(`invalid key: ${r}`)}function eP(r){if(r.startsWith(".")||r.endsWith(".")||!KI.test(r))throw new Error(`invalid key: ${r}`)}function tP(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 mc(r){if(!ZI.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 No{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",XI);E(this,"validateSearchKey",eP);E(this,"hasWildcards",tP);mc(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=Ib,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){mc(t);const i=await e.jetstreamManager(),a=new No(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}};mc(t);const u=new No(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||kb(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(JI(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=ed.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?rs.S2:rs.None);const a=this.js.nc,u=a.getServerVersion(),c=u?nd(u,Ps("2.7.2"))>=0:!1;n.discard=c?Oo.New:Oo.Old;const{ok:f,min:h}=a.features.get(It.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}`:`${Ib}.${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 yP(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new gP(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=Oi();a.headers=f,f.set(ci.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===ye.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=nr(),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=Oi();a.set(pc,t),t==="PURGE"&&a.set(en.RollupHdr,en.RollupValueSubject),n!=null&&n.previousSeq&&a.set(ci.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:Fr.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 Dr,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=ns(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(It.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Dr,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=ns(h);this.canSetWatcherName()&&y.consumerName(Is.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 A=this.jmToEntry(b);if(u&&A.operation==="DEL")return;n.push(A),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(A){n.stop(A)}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 Dr,n=this._buildCC(e,ni.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=ns(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(pc);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 Pb(i,t)}}class Pb{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 Gh(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!==rs.None:!1}}const hd="OBJ_",Cb="SHA-256=";function rP(r){return mc(r),`${hd}${r}`}function nP(r){return r.startsWith(hd)?r.substring(4):r}class dd{constructor(e){E(this,"si");E(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return nP(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!==rs.None:!1}}function yc(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 Ti;(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"})(Ti||(Ti={}));var Sa;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Sa||(Sa={}));const Nb=Uint8Array.of(43,65,67,75),iP=Uint8Array.of(45,78,65,75),Ro=Uint8Array.of(43,87,80,73),sP=Uint8Array.of(43,78,88,84),aP=Uint8Array.of(43,84,69,82,77),oP=Uint8Array.of(32);function Do(r,e=5e3){return new EP(r,e)}class pd extends Dr{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=Ei(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(Zh(h))return;const A=(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:w,bytesLeft:O}=this.parseDiscard(h.headers);if(w>0||O>0)this.pending.msgs-=w,this.pending.bytes-=O,this.pending.requests--,this.notify(Sa.Discard,{msgsLeft:w,bytesLeft:O});else if(A===400){this.stop(new Ie(x,`${A}`));return}else if(A===409&&x==="consumer deleted"){if(this.notify(Ti.ConsumerDeleted,`${A} ${x}`),!this.refilling||this.abortOnMissingResource){const P=new Ie(x,`${A}`);this.stop(P);return}}else this.notify(Sa.DebugEvent,`${A} ${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 A=this.pullOptions();this.pull(A)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),i&&(this.monitor=new Xh(i,f=>(this.notify(Ti.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 Si.Disconnect:(h=this.monitor)==null||h.cancel();break;case Si.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=Qh();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(Ti.StreamNotFound,n),!this.refilling||this.abortOnMissingResource)return this.stop(u),!1}else if(u.message==="consumer not found"){if(t++,this.notify(Ti.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=ma(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(Sa.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 Dr;return this.listeners.push(t),Promise.resolve(t)}}class uP extends Dr{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 Dr;return this.listeners.push(t),Promise.resolve(t)}}class Rb{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 pd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new pd(this,e,!1),n=Math.round(t.opts.expires*1.05),i=pa(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=nr(),n=e;n.max_messages=1;const i=new pd(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===Ti.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=pa(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 cP{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=Is.next(),typeof n.name_prefix=="string"&&(sc("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.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:Fr.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=Qh();let i;for(let h=0;;h++)try{i=await this.api.add(this.stream,t),(u=this.iter)==null||u.notify(Ti.OrderedConsumerRecreated,i.name);break}catch(d){if(d.message==="stream not found"&&((c=this.iter)==null||c.notify(Ti.StreamNotFound,h),this.type===qn.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 ma(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===qn.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 uP),this.consumer=new Rb(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(){var e;(e=this.iter)==null||e.notify(Sa.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}){var i;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(((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=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=nr();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 Db{constructor(e){E(this,"api");E(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(It.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 Rb(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new md(n.nc,n.opts).info(e).then(a=>Promise.resolve(new cP(this.api,e,t))).catch(a=>Promise.reject(a))}}class gc{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 gc(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 Db(new id(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 md extends Ao{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(It.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(It.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(It.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(It.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(It.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(It.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=yc(e.mirror),e.sources=(i=e.sources)==null?void 0:i.map(yc);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=yc(i.mirror),i.sources=(c=i.sources)==null?void 0:c.map(yc);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 ko(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 Fb(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 Pb(h,u))},t=`${this.prefix}.STREAM.LIST`;return new ko(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(hd));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new dd(c))},t=`${this.prefix}.STREAM.LIST`;return new ko(t,e,this)}names(e=""){const t=e!=null&&e.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new ko(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new gc(this,t))}}class lP extends Ao{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=ga(f);if(h)return Promise.reject(h);const d=new yd(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 Dr,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 A=((y=b.headers)==null?void 0:y.code)||0;if(A!==0&&A<200||A>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 yd(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 yd{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(ba.Subject)}get seq(){const e=this.header.last(ba.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ba.TimeStamp)}get stream(){return this.header.last(ba.Stream)}json(e){return Ln(e).decode(this.data)}string(){return cn.decode(this.data)}}E(yd,"jc");class fP extends Ao{constructor(t,n){super(t,n);E(this,"streams");E(this,"consumers");E(this,"direct");this.streams=new md(t,n),this.consumers=new id(t,n),this.direct=new lP(t,n)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const t=new Dr;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 Fb{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=ts.decode(e)}else this._header=Oi();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(Fb,"jc");class hP{constructor(e){E(this,"api");this.api=e}get(e){return this.api.info(e).then(t=>new gc(this.api,t))}}class gd{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=ts.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 Mb(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 dP(){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 gd(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 dd(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new dd(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){var R;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=((R=e.options)==null?void 0:R.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=Is.next(),b=this._chunkSubject(m),A=this._metaSubject(y),x=Object.assign({bucket:this.name,nuid:m,size:0,chunks:0},Mb(e)),w=nr(),O=[],P=new wa;try{const F=t?t.getReader():null,$=new lb;for(;;){const{done:te,value:J}=F?await F.read():{done:!0,value:void 0};if(te){if(P.size()>0){const je=P.drain();$.update(je),x.chunks++,x.size+=je.length,O.push(this.js.publish(b,je,{timeout:a}))}await Promise.all(O),O.length=0,x.mtime=new Date().toISOString();const ue=$.digest("base64"),fe=ue.length%3,qe=fe>0?"=".repeat(fe):"";x.digest=`${Cb}${ue}${qe}`,x.deleted=!1;const ve=Oi();typeof u=="number"&&ve.set(ci.ExpectedLastSubjectSequenceHdr,`${u}`),ve.set(en.RollupHdr,en.RollupValueSubject);const De=await this.js.publish(A,Ln().encode(x),{headers:ve,timeout:a});if(x.revision=De.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}w.resolve(new gd(x));break}if(J)for(P.fill(J);P.size()>h;){x.chunks++,x.size+=h;const ue=P.drain(e.options.max_chunk_size);$.update(ue),O.push(this.js.publish(b,ue,{timeout:a}))}}}catch(F){await this.jsm.streams.purge(this.stream,{filter:b}),w.reject(F)}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){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 wa,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=nr(),i={info:new gd(t),error:n};if(t.size===0)return i.data=dP(),n.resolve(null),Promise.resolve(i);let a;const u=ns();u.orderedConsumer();const c=new lb,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=`${Cb}${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=Oi();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,Mb(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 Dr,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=ns();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.${To.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==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=Oo.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?rs.S2:rs.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 pP{constructor(e){E(this,"js");this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(It.JS_KV);return i?t.bindOnly?No.bind(this.js,e,t):No.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(It.JS_OBJECTSTORE);return i?Fo.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class vd extends Ao{constructor(t,n){super(t,n);E(this,"consumers");E(this,"streams");E(this,"consumerAPI");E(this,"streamAPI");this.consumerAPI=new id(t,n),this.streamAPI=new md(t,n),this.consumers=new Db(this.consumerAPI),this.streams=new hP(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 pP(this)}async publish(t,n=bn,i){i=i||{},i.expect=i.expect||{};const a=(i==null?void 0:i.headers)||Oi();i&&(i.msgID&&a.set(ci.MsgIdHdr,i.msgID),i.expect.lastMsgID&&a.set(ci.ExpectedLastMsgIdHdr,i.expect.lastMsgID),i.expect.streamName&&a.set(ci.ExpectedStreamHdr,i.expect.streamName),typeof i.expect.lastSequence=="number"&&a.set(ci.ExpectedLastSeqHdr,`${i.expect.lastSequence}`),typeof i.expect.lastSubjectSequence=="number"&&a.set(ci.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 ma(h);else throw m}const y=this.parseJsResponse(d);if(y.stream==="")throw Ie.errorForCode(ye.JetStreamInvalidAck);return y.duplicate=y.duplicate?y.duplicate:!1,y}async pull(t,n,i=0){Xr(t),ya(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=ga(c);if(f)throw f;return Do(c,this.timeout)}fetch(t,n,i={}){Xr(t),ya(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 O=this.nc.features.get(It.JS_PULL_MAX_BYTES);if(!O.ok)throw new Error(`max_bytes is only supported on servers ${O.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 Dr,b=d.batch;let A=0;m.protocolFilterFn=(O,P=!1)=>Zh(O.msg)?(h==null||h.work(),!1):!0,m.dispatchedFn=O=>{if(O){if(u&&(c+=O.data.length),A++,a&&O.info.pending===0)return;(m.getPending()===1&&O.info.pending===0||b===A||f>0&&c>=f)&&m.stop()}};const x=Ei(this.nc.options.inboxPrefix),w=this.nc.subscribe(x,{max:i.batch,callback:(O,P)=>{O===null&&(O=ga(P)),O!==null?(a&&(a.cancel(),a=null),Ek(O)?m.stop(jb(O)===null?void 0:O):m.stop(O)):(h==null||h.work(),m.received++,m.push(Do(P,this.timeout)))}});return y&&(a=pa(y),a.catch(()=>{w.isClosed()||(w.drain().catch(()=>{}),a=null),h&&h.cancel()})),(async()=>{try{g&&(h=new Xh(g,O=>(m.push(()=>{m.err=new Ie(`${jn.IdleHeartbeatMissed}: ${O}`,ye.JetStreamIdleHeartBeat)}),!0)))}catch{}await w.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=ns()){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===Fr.None||a===Fr.All)throw new Error("ack policy for pull consumers must be explicit");const u=this._buildTypedSubscriptionOpts(i),c=new vP(this,i.deliver,u);c.info=i;try{await this._maybeCreateConsumer(i)}catch(f){throw c.unsubscribe(),f}return c}async subscribe(t,n=ns()){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 Lb(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=ns()){const i=ab(n)?n.getOpts():n;if(i.isBind=ab(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!==Fr.NotSet&&i.config.ack_policy!==Fr.None)throw new Ie("ordered consumer: ack_policy can only be set to 'none'",ye.ApiError);if(i.config.durable_name&&i.config.durable_name.length>0)throw new Ie("ordered consumer: durable_name cannot be set",ye.ApiError);if(i.config.deliver_subject&&i.config.deliver_subject.length>0)throw new Ie("ordered consumer: deliver_subject cannot be set",ye.ApiError);if(i.config.max_deliver!==void 0&&i.config.max_deliver>1)throw new Ie("ordered consumer: max_deliver cannot be set",ye.ApiError);if(i.config.deliver_group&&i.config.deliver_group.length>0)throw new Ie("ordered consumer: deliver_group cannot be set",ye.ApiError);i.config.deliver_subject=Ei(this.nc.options.inboxPrefix),i.config.ack_policy=Fr.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===Fr.NotSet&&(i.config.ack_policy=Fr.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||Ei(this.nc.options.inboxPrefix),i}_buildTypedSubscriptionOpts(t){const n={};return n.adapter=bP(t.callbackFn===void 0,this.timeout),n.ingestionFilterFn=vd.ingestionFn(t.ordered),n.protocolFilterFn=(i,a=!1)=>{const u=i;return Kh(u.msg)?(a||u.msg.respond(),!1):!0},!t.mack&&t.config.ack_policy!==Fr.None&&(n.dispatchedFn=xP),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:Fr.Explicit,ack_wait:cr(30*1e3),replay_policy:va.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(ga(u.msg)||(f=a.monitor)==null||f.work(),Zh(u.msg)){const h=t?a._checkHbOrderConsumer(u.msg):!0;return t||a.info.flow_control.heartbeat_count++,{ingest:h,protocol:!0}}else if(Kh(u.msg))return a.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:t?a._checkOrderedConsumer(n):!0,protocol:!1}}}}class bd{constructor(e){E(this,"options");E(this,"protocol");E(this,"draining");E(this,"listeners");E(this,"_services");this.draining=!1,this.options=LI(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new bd(e);dc.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 Ie.errorForCode(ye.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Ie.errorForCode(ye.ConnectionDraining);if(e=e||"",e.length===0)throw Ie.errorForCode(ye.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 Tb(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 Ie("timeout",ye.InvalidOption));const a=new Dr;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(Ei(this.options.inboxPrefix),{callback:(b,A)=>{var x,w;if(((x=A==null?void 0:A.data)==null?void 0:x.length)===0&&((w=A==null?void 0:A.headers)==null?void 0:w.status)===ye.NoResponders&&(b=Ie.errorForCode(ye.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=tr()),this.pongs.push(e),this.outbound.fill(Ob),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}${cc}`):e.push(`SUB ${n.subject} ${n.sid}${cc}`)}),e.length&&this.transport.send(Eo(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 Tb(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 GI="$SRV";class Ab{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||Oi(),(a=i.headers)==null||a.set(nc,`${e}`),(u=i.headers)==null||u.set(rc,t),this.msg.respond(n,i)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class No{constructor(e,t="",n=""){E(this,"subject");E(this,"queue");E(this,"srv");t!==""&&JI("service group",t);let i="";if(e instanceof Ro)this.srv=e,i="";else if(e instanceof No){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;To("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,QI("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 No(this,e,t)}}function QI(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 JI(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 Ro{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"),To("name",this.config.name),To("queue",this.config.queue),Cs(this.config.version),this._id=Is.next(),this.internal=[],this._done=tr(),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??GI;return t===""&&n===""?`${a}.${e}`:(To("control subject name",t),n!==""?(To("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=Oi();if(e instanceof ic){const n=e;t.set(rc,n.message),t.set(nc,`${n.code}`)}else t.set(rc,e.message),t.set(nc,"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 YI(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 Ab(d))}catch(g){c.stats.countError(g),d==null||d.respond(wn,{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:Oo.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:Oo.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=Ro.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(es.PING,a),this.addInternalHandler(es.STATS,t),this.addInternalHandler(es.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:Oo.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 No(this,e,t)}addEndpoint(e,t){return new No(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Rr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new Ab(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class YI{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+=ur(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 KI{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(es.PING,e,t)}stats(e="",t=""){return this.q(es.STATS,e,t)}info(e="",t=""){return this.q(es.INFO,e,t)}async q(e,t="",n=""){const i=new Rr,a=Ln(),u=Ro.controlSubject(e,t,n,this.prefix),c=await this.nc.requestMany(u,wn,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 kb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function ZI(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:kb(),storage:td.File}}const yc="KV-Operation",Ib="$KV",XI=/^[-/=.\w]+$/,eC=/^[-/=.>*\w]+$/,tC=/^[-\w]+$/;function rC(r){if(r.startsWith(".")||r.endsWith(".")||!XI.test(r))throw new Error(`invalid key: ${r}`)}function nC(r){if(r.startsWith(".")||r.endsWith(".")||!eC.test(r))throw new Error(`invalid key: ${r}`)}function iC(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 gc(r){if(!tC.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 Do{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",rC);E(this,"validateSearchKey",nC);E(this,"hasWildcards",iC);gc(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=Ib,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){gc(t);const i=await e.jetstreamManager(),a=new Do(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}};gc(t);const u=new Do(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||kb(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(ZI(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=ed.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(xn)||(y.name=`${xn}${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(xn)?m.name.substring(xn.length):m.name;return m.name.startsWith(xn)||(m.name=`${xn}${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?rs.S2:rs.None);const a=this.js.nc,u=a.getServerVersion(),c=u?nd(u,Cs("2.7.2"))>=0:!1;n.discard=c?Ao.New:Ao.Old;const{ok:f,min:h}=a.features.get(Ct.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=ur(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(xn)&&(n=n.substring(xn.length)),t.external&&t.external.api!==""){const i=t.name.substring(xn.length);this.useJsPrefix=!1,this.prefix=`$KV.${i}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${xn}${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}`:`${Ib}.${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(Xr.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new bC(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new wC(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=Oi();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=tr(),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=Oi();a.set(yc,t),t==="PURGE"&&a.set(Xr.RollupHdr,Xr.RollupValueSubject),n!=null&&n.previousSeq&&a.set(li.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(i,!0),wn,{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:ur(5*1e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Rr,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=ns(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(Ct.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Rr,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=ns(h);this.canSetWatcherName()&&y.consumerName(Is.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 A=this.jmToEntry(b);if(u&&A.operation==="DEL")return;n.push(A),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(A){n.stop(A)}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 Rr,n=this._buildCC(e,ni.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=ns(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(yc);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 Cb(i,t)}}class Cb{constructor(e,t=""){E(this,"si");E(this,"cluster");this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(xn)?this.si.config.name.substring(xn.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 Qh(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!==rs.None:!1}}const hd="OBJ_",Pb="SHA-256=";function sC(r){return gc(r),`${hd}${r}`}function aC(r){return r.startsWith(hd)?r.substring(4):r}class dd{constructor(e){E(this,"si");E(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return aC(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!==rs.None:!1}}function vc(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 Ti;(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"})(Ti||(Ti={}));var Ea;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Ea||(Ea={}));const Nb=Uint8Array.of(43,65,67,75),oC=Uint8Array.of(45,78,65,75),Mo=Uint8Array.of(43,87,80,73),uC=Uint8Array.of(43,78,88,84),cC=Uint8Array.of(43,84,69,82,77),lC=Uint8Array.of(32);function Fo(r,e=5e3){return new AC(r,e)}class pd extends Rr{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=Ei(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(Zh(h))return;const A=(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:w,bytesLeft:O}=this.parseDiscard(h.headers);if(w>0||O>0)this.pending.msgs-=w,this.pending.bytes-=O,this.pending.requests--,this.notify(Ea.Discard,{msgsLeft:w,bytesLeft:O});else if(A===400){this.stop(new Ne(x,`${A}`));return}else if(A===409&&x==="consumer deleted"){if(this.notify(Ti.ConsumerDeleted,`${A} ${x}`),!this.refilling||this.abortOnMissingResource){const C=new Ne(x,`${A}`);this.stop(C);return}}else this.notify(Ea.DebugEvent,`${A} ${x}`)}else this._push(Fo(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 A=this.pullOptions();this.pull(A)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),i&&(this.monitor=new Xh(i,f=>(this.notify(Ti.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 Si.Disconnect:(h=this.monitor)==null||h.cancel();break;case Si.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=Gh();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(Ti.StreamNotFound,n),!this.refilling||this.abortOnMissingResource)return this.stop(u),!1}else if(u.message==="consumer not found"){if(t++,this.notify(Ti.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=ur(this.opts.idle_heartbeat),a=ur(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(Xr.PendingMessagesHdr);i&&(n.msgsLeft=parseInt(i));const a=t==null?void 0:t.get(Xr.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 Rr;return this.listeners.push(t),Promise.resolve(t)}}class fC extends Rr{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 Rr;return this.listeners.push(t),Promise.resolve(t)}}class Rb{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 pd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new pd(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=tr(),n=e;n.max_messages=1;const i=new pd(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===Ti.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 hC{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=Is.next(),typeof n.name_prefix=="string"&&(oc("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.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:ur(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=ur(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=Gh();let i;for(let h=0;;h++)try{i=await this.api.add(this.stream,t),(u=this.iter)==null||u.notify(Ti.OrderedConsumerRecreated,i.name);break}catch(d){if(d.message==="stream not found"&&((c=this.iter)==null||c.notify(Ti.StreamNotFound,h),this.type===qn.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===qn.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 fC),this.consumer=new Rb(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(){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===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}){var i;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(((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=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=tr();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 Db{constructor(e){E(this,"api");E(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Ct.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 Rb(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new md(n.nc,n.opts).info(e).then(a=>Promise.resolve(new hC(this.api,e,t))).catch(a=>Promise.reject(a))}}class bc{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 bc(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 Db(new id(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 md extends Io{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(Ct.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(Ct.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(Ct.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(Ct.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(Ct.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(Ct.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),Zr(e.name),e.mirror=vc(e.mirror),e.sources=(i=e.sources)==null?void 0:i.map(vc);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={}){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),Zr(e);const n=await this.info(e),i=Object.assign(n.config,t);i.mirror=vc(i.mirror),i.sources=(c=i.sources)==null?void 0:c.map(vc);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],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 Co(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 Mb(i)}find(e){return this.findStream(e)}listKvs(){const e=n=>{var f;const a=n.streams.filter(h=>h.config.name.startsWith(xn));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 Cb(h,u))},t=`${this.prefix}.STREAM.LIST`;return new Co(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(hd));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new dd(c))},t=`${this.prefix}.STREAM.LIST`;return new Co(t,e,this)}names(e=""){const t=e!=null&&e.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new Co(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new bc(this,t))}}class dC extends Io{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):wn,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 yd(f);return Promise.resolve(d)}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 Rr,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 A=((y=b.headers)==null?void 0:y.code)||0;if(A!==0&&A<200||A>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 yd(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 yd{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 un.decode(this.data)}}E(yd,"jc");class pC extends Io{constructor(t,n){super(t,n);E(this,"streams");E(this,"consumers");E(this,"direct");this.streams=new md(t,n),this.consumers=new id(t,n),this.direct=new dC(t,n)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const t=new Rr;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 Mb{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):wn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=ts.decode(e)}else this._header=Oi();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 un.decode(this.data)}}E(Mb,"jc");class mC{constructor(e){E(this,"api");this.api=e}get(e){return this.api.info(e).then(t=>new bc(this.api,t))}}class gd{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=ts.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 Fb(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 yC(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Lo{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 gd(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 dd(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new dd(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){var D;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=((D=e.options)==null?void 0:D.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=Is.next(),b=this._chunkSubject(m),A=this._metaSubject(y),x=Object.assign({bucket:this.name,nuid:m,size:0,chunks:0},Fb(e)),w=tr(),O=[],C=new _a;try{const F=t?t.getReader():null,B=new lb;for(;;){const{done:ee,value:Q}=F?await F.read():{done:!0,value:void 0};if(ee){if(C.size()>0){const Ie=C.drain();B.update(Ie),x.chunks++,x.size+=Ie.length,O.push(this.js.publish(b,Ie,{timeout:a}))}await Promise.all(O),O.length=0,x.mtime=new Date().toISOString();const re=B.digest("base64"),fe=re.length%3,ge=fe>0?"=".repeat(fe):"";x.digest=`${Pb}${re}${ge}`,x.deleted=!1;const he=Oi();typeof u=="number"&&he.set(li.ExpectedLastSubjectSequenceHdr,`${u}`),he.set(Xr.RollupHdr,Xr.RollupValueSubject);const ve=await this.js.publish(A,Ln().encode(x),{headers:he,timeout:a});if(x.revision=ve.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}w.resolve(new gd(x));break}if(Q)for(C.fill(Q);C.size()>h;){x.chunks++,x.size+=h;const re=C.drain(e.options.max_chunk_size);B.update(re),O.push(this.js.publish(b,re,{timeout:a}))}}}catch(F){await this.jsm.streams.purge(this.stream,{filter:b}),w.reject(F)}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){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 Lo.create(this.js,t.options.link.bucket):this).get(d)}const n=tr(),i={info:new gd(t),error:n};if(t.size===0)return i.data=yC(),n.resolve(null),Promise.resolve(i);let a;const u=ns();u.orderedConsumer();const c=new lb,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=`${Pb}${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 Lo))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=Oi();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,Fb(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 Rr,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=ns();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.${ko.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=sC(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=Ao.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?rs.S2:rs.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 Lo(t,i,e);return await a.init(n),Promise.resolve(a)}}class gC{constructor(e){E(this,"js");this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(Ct.JS_KV);return i?t.bindOnly?Do.bind(this.js,e,t):Do.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(Ct.JS_OBJECTSTORE);return i?Lo.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class vd extends Io{constructor(t,n){super(t,n);E(this,"consumers");E(this,"streams");E(this,"consumerAPI");E(this,"streamAPI");this.consumerAPI=new id(t,n),this.streamAPI=new md(t,n),this.consumers=new Db(this.consumerAPI),this.streams=new mC(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 gC(this)}async publish(t,n=wn,i){i=i||{},i.expect=i.expect||{};const a=(i==null?void 0:i.headers)||Oi();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 Ne.errorForCode(be.JetStreamInvalidAck);return y.duplicate=y.duplicate?y.duplicate:!1,y}async pull(t,n,i=0){Zr(t),ga(n);let a=this.timeout;i>a&&(a=i),i=i<0?0:ur(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 Fo(c,this.timeout)}fetch(t,n,i={}){Zr(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 O=this.nc.features.get(Ct.JS_PULL_MAX_BYTES);if(!O.ok)throw new Error(`max_bytes is only supported on servers ${O.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=ur(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=ur(g),i.delay_heartbeat===!0&&(d.idle_heartbeat=ur(g*4)));const m=new Rr,b=d.batch;let A=0;m.protocolFilterFn=(O,C=!1)=>Zh(O.msg)?(h==null||h.work(),!1):!0,m.dispatchedFn=O=>{if(O){if(u&&(c+=O.data.length),A++,a&&O.info.pending===0)return;(m.getPending()===1&&O.info.pending===0||b===A||f>0&&c>=f)&&m.stop()}};const x=Ei(this.nc.options.inboxPrefix),w=this.nc.subscribe(x,{max:i.batch,callback:(O,C)=>{O===null&&(O=va(C)),O!==null?(a&&(a.cancel(),a=null),Ak(O)?m.stop(jb(O)===null?void 0:O):m.stop(O)):(h==null||h.work(),m.received++,m.push(Fo(C,this.timeout)))}});return y&&(a=ma(y),a.catch(()=>{w.isClosed()||(w.drain().catch(()=>{}),a=null),h&&h.cancel()})),(async()=>{try{g&&(h=new Xh(g,O=>(m.push(()=>{m.err=new Ne(`${jn.IdleHeartbeatMissed}: ${O}`,be.JetStreamIdleHeartBeat)}),!0)))}catch{}await w.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=ns()){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 _C(this,i.deliver,u);c.info=i;try{await this._maybeCreateConsumer(i)}catch(f){throw c.unsubscribe(),f}return c}async subscribe(t,n=ns()){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 Lb(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=ns()){const i=ab(n)?n.getOpts():n;if(i.isBind=ab(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 Ne("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 Ne("ordered consumer: durable_name cannot be set",be.ApiError);if(i.config.deliver_subject&&i.config.deliver_subject.length>0)throw new Ne("ordered consumer: deliver_subject cannot be set",be.ApiError);if(i.config.max_deliver!==void 0&&i.config.max_deliver>1)throw new Ne("ordered consumer: max_deliver cannot be set",be.ApiError);if(i.config.deliver_group&&i.config.deliver_group.length>0)throw new Ne("ordered consumer: deliver_group cannot be set",be.ApiError);i.config.deliver_subject=Ei(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||ur(5e3),i.config.ack_wait=ur(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||Ei(this.nc.options.inboxPrefix),i}_buildTypedSubscriptionOpts(t){const n={};return n.adapter=xC(t.callbackFn===void 0,this.timeout),n.ingestionFilterFn=vd.ingestionFn(t.ordered),n.protocolFilterFn=(i,a=!1)=>{const u=i;return Kh(u.msg)?(a||u.msg.respond(),!1):!0},!t.mack&&t.config.ack_policy!==Dr.None&&(n.dispatchedFn=OC),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:ur(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(),Zh(u.msg)){const h=t?a._checkHbOrderConsumer(u.msg):!0;return t||a.info.flow_control.heartbeat_count++,{ingest:h,protocol:!0}}else if(Kh(u.msg))return a.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:t?a._checkOrderedConsumer(n):!0,protocol:!1}}}}class bd{constructor(e){E(this,"options");E(this,"protocol");E(this,"draining");E(this,"listeners");E(this,"_services");this.draining=!1,this.options=UI(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new bd(e);mc.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 Ne.errorForCode(be.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Ne.errorForCode(be.ConnectionDraining);if(e=e||"",e.length===0)throw Ne.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 Tb(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=wn,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 Ne("timeout",be.InvalidOption));const a=new Rr;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(Ei(this.options.inboxPrefix),{callback:(b,A)=>{var x,w;if(((x=A==null?void 0:A.data)==null?void 0:x.length)===0&&((w=A==null?void 0:A.headers)==null?void 0:w.status)===be.NoResponders&&(b=Ne.errorForCode(be.NoResponders)),b){f&&(b.stack+=`
|
|
160
160
|
|
|
161
|
-
${f}`),y(b);return}c(null,A),n.strategy===ri.Count&&(h--,h===0&&y()),n.strategy===ri.JitterTimer&&(m(),g=setTimeout(()=>{y()},300)),n.strategy===ri.SentinelMsg&&A&&A.data.length===0&&y()}});d.requestSubject=e,d.closed.then(()=>{u()}).catch(b=>{a.stop(b)});const y=b=>{b&&a.push(()=>{throw b}),m(),d.drain().then(()=>{u()}).catch(A=>{u()})};a.iterClosed.then(()=>{m(),d==null||d.unsubscribe()}).catch(b=>{m(),d==null||d.unsubscribe()});try{this.publish(e,t,{reply:d.getSubject()})}catch(b){y(b)}let g=setTimeout(()=>{y()},n.maxWait);const m=()=>{g&&clearTimeout(g)}}else{const f=n;f.callback=c,a.iterClosed.then(()=>{h.cancel()}).catch(d=>{h.cancel(d)});const h=new
|
|
161
|
+
${f}`),y(b);return}c(null,A),n.strategy===ri.Count&&(h--,h===0&&y()),n.strategy===ri.JitterTimer&&(m(),g=setTimeout(()=>{y()},300)),n.strategy===ri.SentinelMsg&&A&&A.data.length===0&&y()}});d.requestSubject=e,d.closed.then(()=>{u()}).catch(b=>{a.stop(b)});const y=b=>{b&&a.push(()=>{throw b}),m(),d.drain().then(()=>{u()}).catch(A=>{u()})};a.iterClosed.then(()=>{m(),d==null||d.unsubscribe()}).catch(b=>{m(),d==null||d.unsubscribe()});try{this.publish(e,t,{reply:d.getSubject()})}catch(b){y(b)}let g=setTimeout(()=>{y()},n.maxWait);const m=()=>{g&&clearTimeout(g)}}else{const f=n;f.callback=c,a.iterClosed.then(()=>{h.cancel()}).catch(d=>{h.cancel(d)});const h=new zk(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(d){h.cancel(d)}}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 Ne("timeout",be.InvalidOption));if(!n.noMux&&n.reply)return Promise.reject(new Ne("reply can only be used with noMux",be.InvalidOption));if(n.noMux){const a=n.reply?n.reply:Ei(this.options.inboxPrefix),u=tr(),c=i?new Error:null,f=this.subscribe(a,{max:1,timeout:n.timeout,callback:(h,d)=>{h?(c&&h.code!==be.Timeout&&(h.stack+=`
|
|
162
162
|
|
|
163
163
|
${c.stack}`),f.unsubscribe(),u.reject(h)):(h=rb(d),h?(c&&(h.stack+=`
|
|
164
164
|
|
|
165
|
-
${c.stack}`),u.reject(h)):u.resolve(d))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new hb(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(Ie.errorForCode(ye.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ie.errorForCode(ye.ConnectionClosed)):this.isDraining()?Promise.reject(Ie.errorForCode(ye.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 Dr;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 fP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===ye.NoResponders&&(i.code=ye.JetStreamNotEnabled),i}return t}jetstream(e={}){return new vd(this,e)}getServerVersion(){const e=this.info;return e?Ps(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ie.errorForCode(ye.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 mP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ie.errorForCode(ye.ConnectionClosed)):this.isDraining()?Promise.reject(Ie.errorForCode(ye.ConnectionDraining)):this.protocol.reconnect()}}class mP{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new Co(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new GI(this.nc,e,t)}}class yP{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(pc)||"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 gP{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(Gh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(pc))||"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 Lb extends Hk{constructor(t,n,i){super(t.nc,n,i);E(this,"js");E(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Is.next(),a.ordered_consumer_sequence.delivery_seq=0,a.flow_control.heartbeat_count=0,a.flow_control.fc_count=0,a.flow_control.consumer_restarts++,a.deliver=n,a.config.deliver_subject=n,a.config.deliver_policy=yr.StartSequence,a.config.opt_start_seq=t;const u={};u.stream_name=this.info.stream,u.config=a.config;const c=`${a.api.prefix}.CONSUMER.CREATE.${a.stream}`;this.js._request(c,u,{retries:-1}).then(f=>{const h=f,d=this.sub.info;d.last=h,this.info.config=h.config,this.info.name=h.name}).catch(f=>{const h=new Ie(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,ye.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(Gh(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=kk(409,`${jn.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 Xh(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 vP extends Lb{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(It.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 bP(r,e){return r?_P(e):wP(e)}function wP(r){return(e,t)=>e?[e,null]:(e=ga(t),e?[e,null]:[null,Do(t,r)])}function _P(r){return(e,t)=>{if(e)return[e,null];const n=ga(t);return n!==null?[jb(n),null]:[null,Do(t,r)]}}function jb(r){if(r!==null)switch(r.code){case ye.JetStream404NoMessages:case ye.JetStream408RequestTimeout:return null;case ye.JetStream409:return Ik(r)?r:null;default:return r}return null}function xP(r){r&&r.ack()}function SP(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 EP{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=SP(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]===Ro[0]&&e[1]===Ro[1]&&e[2]===Ro[2]&&e[3]===Ro[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=nr();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 hb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,Nb,{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(Nb)}nak(e){let t=iP;e&&(t=tb().encode(`-NAK ${JSON.stringify({delay:cr(e)})}`)),this.doAck(t)}working(){this.doAck(Ro)}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=wa.concat(sP,oP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=aP;(e==null?void 0:e.length)>0&&(t=tb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const OP="1.29.2",TP="nats.ws";class AP{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=OP,this.lang=TP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=nr(),this.closedNotification=nr()}async connect(e,t){const n=nr();if(t.tls)return n.reject(new Ie("tls",ye.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=wa.concat(...this.yields),c=Zk(u);if(c!==""){const f=UI.exec(c);if(!f){t.debug&&console.error("!!!",ic(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);jI(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 Ie(u.message,ye.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 ma(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(`> ${ic(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=nr())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${ic(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${ic(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 kP(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 IP(r={}){return Qk({defaultPort:443,urlParseFn:kP,factory:()=>new AP}),bd.connect(r)}const qb=["new","last","last_per_subject"],PP=async(r,e)=>(console.info(`Connecting to server ${r}`),await IP({servers:[r],authenticator:RI(new TextEncoder().encode(e))}));async function*CP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Ub=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},$b={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]"},NP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},RP=(r,e,t)=>{if(!$b[r])throw new Error("Unknown stream name");const n=$b[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+="."+(NP[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},DP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!qb.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${qb.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=pe.useRef(),h=pe.useRef();return pe.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await PP(u.natsUrl,c.current);f.current=y;const g=RP(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}),A=CP(b);if(h.current=A,typeof a=="function")for await(const x of A)a(x)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Ub(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Ub(h,f)]},FP=pe.forwardRef(({href:r,children:e,...t},n)=>{const{isEmbedded:i,navigateParent:a}=pe.useContext(nh);return or.jsx("a",{...t,ref:n,href:r,onClick:u=>{!i||u.metaKey||u.ctrlKey||u.shiftKey||(u.preventDefault(),u.stopPropagation(),a(r))},children:e})});Rt.Link=FP,Rt.MMProvider=gk,Rt.PrivateLayout=fA,Rt._useMMApolloLinkContext=lA,Rt.useApiRequest=Qv,Rt.useAsyncEffect=vo,Rt.useAsyncInterval=bo,Rt.useDowntimeQuery=aA,Rt.useEventStream=DP,Rt.useMMAuth=ti,Rt.useMMEmbeddedApp=cA,Rt.useMMHash=uA,Rt.useMMTemplates=oA,Rt.useProductionQuery=iA,Rt.useQuantityStream=sA,Rt.useSearchParamsState=rA,Rt.useThrottleEffect=nA,Object.defineProperty(Rt,Symbol.toStringTag,{value:"Module"})});
|
|
165
|
+
${c.stack}`),u.reject(h)):u.resolve(d))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new hb(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(Ne.errorForCode(be.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ne.errorForCode(be.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.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 Rr;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 pC(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 vd(this,e)}getServerVersion(){const e=this.info;return e?Cs(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ne.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 vC(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ne.errorForCode(be.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(be.ConnectionDraining)):this.protocol.reconnect()}}class vC{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new Ro(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new KI(this.nc,e,t)}}class bC{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(yc)||"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 wC{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(Qh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(yc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(Xr.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Lb extends Jk{constructor(t,n,i){super(t.nc,n,i);E(this,"js");E(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Is.next(),a.ordered_consumer_sequence.delivery_seq=0,a.flow_control.heartbeat_count=0,a.flow_control.fc_count=0,a.flow_control.consumer_restarts++,a.deliver=n,a.config.deliver_subject=n,a.config.deliver_policy=yr.StartSequence,a.config.opt_start_seq=t;const u={};u.stream_name=this.info.stream,u.config=a.config;const c=`${a.api.prefix}.CONSUMER.CREATE.${a.stream}`;this.js._request(c,u,{retries:-1}).then(f=>{const h=f,d=this.sub.info;d.last=h,this.info.config=h.config,this.info.name=h.name}).catch(f=>{const h=new Ne(`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(Qh(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=Pk(409,`${jn.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 Xh(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(Xr.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(Xr.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 _C extends Lb{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(Ct.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=ur(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=ur(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 xC(r,e){return r?EC(e):SC(e)}function SC(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Fo(t,r)])}function EC(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[jb(n),null]:[null,Fo(t,r)]}}function jb(r){if(r!==null)switch(r.code){case be.JetStream404NoMessages:case be.JetStream408RequestTimeout:return null;case be.JetStream409:return Nk(r)?r:null;default:return r}return null}function OC(r){r&&r.ack()}function TC(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 AC{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=TC(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=tr();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 hb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,Nb,{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(Nb)}nak(e){let t=oC;e&&(t=tb().encode(`-NAK ${JSON.stringify({delay:ur(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=ur(t.expires));const i=Ln().encode(n),a=_a.concat(uC,lC,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=cC;(e==null?void 0:e.length)>0&&(t=tb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const kC="1.29.2",IC="nats.ws";class CC{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=kC,this.lang=IC,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=tr(),this.closedNotification=tr()}async connect(e,t){const n=tr();if(t.tls)return n.reject(new Ne("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=tI(u);if(c!==""){const f=VI.exec(c);if(!f){t.debug&&console.error("!!!",ac(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);$I(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 Ne(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(`> ${ac(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=tr())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${ac(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${ac(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 PC(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 NC(r={}){return Yk({defaultPort:443,urlParseFn:PC,factory:()=>new CC}),bd.connect(r)}const qb=["new","last","last_per_subject"],RC=async(r,e)=>(console.info(`Connecting to server ${r}`),await NC({servers:[r],authenticator:FI(new TextEncoder().encode(e))}));async function*DC(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Ub=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},$b={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]"},MC={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},FC=(r,e,t)=>{if(!$b[r])throw new Error("Unknown stream name");const n=$b[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+="."+(MC[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},LC=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!qb.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${qb.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=ti(),f=me.useRef(),h=me.useRef();return me.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await RC(u.natsUrl,c.current);f.current=y;const g=FC(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}),A=DC(b);if(h.current=A,typeof a=="function")for await(const x of A)a(x)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Ub(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Ub(h,f)]},jC=me.forwardRef(({href:r,children:e,...t},n)=>{const{isEmbedded:i,navigateParent:a}=me.useContext(fa);return ar.jsx("a",{...t,ref:n,href:r,onClick:u=>{!i||u.metaKey||u.ctrlKey||u.shiftKey||(u.preventDefault(),u.stopPropagation(),a(r))},children:e})});Et.Link=jC,Et.MMProvider=wk,Et.PrivateLayout=pA,Et._useMMApolloLinkContext=dA,Et.useApiRequest=Gv,Et.useAsyncEffect=bo,Et.useAsyncInterval=wo,Et.useDowntimeQuery=aA,Et.useEventStream=LC,Et.useMMAppContext=fA,Et.useMMAppSetting=hA,Et.useMMAppTools=lA,Et.useMMAuth=ti,Et.useMMEmbeddedApp=cA,Et.useMMHash=uA,Et.useMMTemplates=oA,Et.useProductionQuery=iA,Et.useQuantityStream=sA,Et.useSearchParamsState=rA,Et.useThrottleEffect=nA,Object.defineProperty(Et,Symbol.toStringTag,{value:"Module"})});
|