@hiver/connector-agent 4.13.1 → 4.13.2

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/index.umd.js CHANGED
@@ -14,20 +14,20 @@
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 Hl;function eh(){return Hl||(Hl=1,process.env.NODE_ENV!=="production"&&function(){var e=I,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),b=Symbol.iterator,h="@@iterator";function p(O){if(O===null||typeof O!="object")return null;var W=b&&O[b]||O[h];return typeof W=="function"?W:null}var m=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(O){{for(var W=arguments.length,$=new Array(W>1?W-1:0),oe=1;oe<W;oe++)$[oe-1]=arguments[oe];C("error",O,$)}}function C(O,W,$){{var oe=m.ReactDebugCurrentFrame,we=oe.getStackAddendum();we!==""&&(W+="%s",$=$.concat([we]));var Ie=$.map(function(Ce){return String(Ce)});Ie.unshift("Warning: "+W),Function.prototype.apply.call(console[O],console,Ie)}}var w=!1,v=!1,_=!1,T=!1,S=!1,L;L=Symbol.for("react.module.reference");function R(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===s||S||O===o||O===d||O===f||T||O===E||w||v||_||typeof O=="object"&&O!==null&&(O.$$typeof===y||O.$$typeof===g||O.$$typeof===a||O.$$typeof===i||O.$$typeof===c||O.$$typeof===L||O.getModuleId!==void 0))}function D(O,W,$){var oe=O.displayName;if(oe)return oe;var we=W.displayName||W.name||"";return we!==""?$+"("+we+")":$}function F(O){return O.displayName||"Context"}function M(O){if(O==null)return null;if(typeof O.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case i:var W=O;return F(W)+".Consumer";case a:var $=O;return F($._context)+".Provider";case c:return D(O,O.render,"ForwardRef");case g:var oe=O.displayName||null;return oe!==null?oe:M(O.type)||"Memo";case y:{var we=O,Ie=we._payload,Ce=we._init;try{return M(Ce(Ie))}catch{return null}}}return null}var B=Object.assign,G=0,J,Z,H,Y,U,ee,V;function q(){}q.__reactDisabledLog=!0;function N(){{if(G===0){J=console.log,Z=console.info,H=console.warn,Y=console.error,U=console.group,ee=console.groupCollapsed,V=console.groupEnd;var O={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}G++}}function X(){{if(G--,G===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},O,{value:J}),info:B({},O,{value:Z}),warn:B({},O,{value:H}),error:B({},O,{value:Y}),group:B({},O,{value:U}),groupCollapsed:B({},O,{value:ee}),groupEnd:B({},O,{value:V})})}G<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=m.ReactCurrentDispatcher,ne;function ce(O,W,$){{if(ne===void 0)try{throw Error()}catch(we){var oe=we.stack.trim().match(/\n( *(at )?)/);ne=oe&&oe[1]||""}return`
18
- `+ne+O}}var P=!1,re;{var xe=typeof WeakMap=="function"?WeakMap:Map;re=new xe}function z(O,W){if(!O||P)return"";{var $=re.get(O);if($!==void 0)return $}var oe;P=!0;var we=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ie;Ie=Q.current,Q.current=null,N();try{if(W){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(me){oe=me}Reflect.construct(O,[],Ce)}else{try{Ce.call()}catch(me){oe=me}O.call(Ce.prototype)}}else{try{throw Error()}catch(me){oe=me}O()}}catch(me){if(me&&oe&&typeof me.stack=="string"){for(var Ee=me.stack.split(`
19
- `),lt=oe.stack.split(`
17
+ */var Hl;function eh(){return Hl||(Hl=1,process.env.NODE_ENV!=="production"&&function(){var e=I,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),b=Symbol.iterator,h="@@iterator";function p(O){if(O===null||typeof O!="object")return null;var W=b&&O[b]||O[h];return typeof W=="function"?W:null}var m=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(O){{for(var W=arguments.length,$=new Array(W>1?W-1:0),se=1;se<W;se++)$[se-1]=arguments[se];C("error",O,$)}}function C(O,W,$){{var se=m.ReactDebugCurrentFrame,we=se.getStackAddendum();we!==""&&(W+="%s",$=$.concat([we]));var Ie=$.map(function(Ce){return String(Ce)});Ie.unshift("Warning: "+W),Function.prototype.apply.call(console[O],console,Ie)}}var w=!1,v=!1,_=!1,T=!1,S=!1,L;L=Symbol.for("react.module.reference");function R(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===s||S||O===o||O===d||O===f||T||O===E||w||v||_||typeof O=="object"&&O!==null&&(O.$$typeof===y||O.$$typeof===g||O.$$typeof===a||O.$$typeof===i||O.$$typeof===c||O.$$typeof===L||O.getModuleId!==void 0))}function D(O,W,$){var se=O.displayName;if(se)return se;var we=W.displayName||W.name||"";return we!==""?$+"("+we+")":$}function F(O){return O.displayName||"Context"}function M(O){if(O==null)return null;if(typeof O.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case i:var W=O;return F(W)+".Consumer";case a:var $=O;return F($._context)+".Provider";case c:return D(O,O.render,"ForwardRef");case g:var se=O.displayName||null;return se!==null?se:M(O.type)||"Memo";case y:{var we=O,Ie=we._payload,Ce=we._init;try{return M(Ce(Ie))}catch{return null}}}return null}var B=Object.assign,G=0,J,Z,H,Y,U,ee,V;function q(){}q.__reactDisabledLog=!0;function N(){{if(G===0){J=console.log,Z=console.info,H=console.warn,Y=console.error,U=console.group,ee=console.groupCollapsed,V=console.groupEnd;var O={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}G++}}function X(){{if(G--,G===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},O,{value:J}),info:B({},O,{value:Z}),warn:B({},O,{value:H}),error:B({},O,{value:Y}),group:B({},O,{value:U}),groupCollapsed:B({},O,{value:ee}),groupEnd:B({},O,{value:V})})}G<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=m.ReactCurrentDispatcher,ne;function ce(O,W,$){{if(ne===void 0)try{throw Error()}catch(we){var se=we.stack.trim().match(/\n( *(at )?)/);ne=se&&se[1]||""}return`
18
+ `+ne+O}}var P=!1,re;{var xe=typeof WeakMap=="function"?WeakMap:Map;re=new xe}function z(O,W){if(!O||P)return"";{var $=re.get(O);if($!==void 0)return $}var se;P=!0;var we=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ie;Ie=Q.current,Q.current=null,N();try{if(W){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(me){se=me}Reflect.construct(O,[],Ce)}else{try{Ce.call()}catch(me){se=me}O.call(Ce.prototype)}}else{try{throw Error()}catch(me){se=me}O()}}catch(me){if(me&&se&&typeof me.stack=="string"){for(var Ee=me.stack.split(`
19
+ `),lt=se.stack.split(`
20
20
  `),We=Ee.length-1,Ye=lt.length-1;We>=1&&Ye>=0&&Ee[We]!==lt[Ye];)Ye--;for(;We>=1&&Ye>=0;We--,Ye--)if(Ee[We]!==lt[Ye]){if(We!==1||Ye!==1)do if(We--,Ye--,Ye<0||Ee[We]!==lt[Ye]){var mt=`
21
- `+Ee[We].replace(" at new "," at ");return O.displayName&&mt.includes("<anonymous>")&&(mt=mt.replace("<anonymous>",O.displayName)),typeof O=="function"&&re.set(O,mt),mt}while(We>=1&&Ye>=0);break}}}finally{P=!1,Q.current=Ie,X(),Error.prepareStackTrace=we}var Fn=O?O.displayName||O.name:"",se=Fn?ce(Fn):"";return typeof O=="function"&&re.set(O,se),se}function Ae(O,W,$){return z(O,!1)}function Ve(O){var W=O.prototype;return!!(W&&W.isReactComponent)}function He(O,W,$){if(O==null)return"";if(typeof O=="function")return z(O,Ve(O));if(typeof O=="string")return ce(O);switch(O){case d:return ce("Suspense");case f:return ce("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case c:return Ae(O.render);case g:return He(O.type,W,$);case y:{var oe=O,we=oe._payload,Ie=oe._init;try{return He(Ie(we),W,$)}catch{}}}return""}var rn=Object.prototype.hasOwnProperty,xn={},Ke=m.ReactDebugCurrentFrame;function it(O){if(O){var W=O._owner,$=He(O.type,O._source,W?W.type:null);Ke.setExtraStackFrame($)}else Ke.setExtraStackFrame(null)}function qe(O,W,$,oe,we){{var Ie=Function.call.bind(rn);for(var Ce in O)if(Ie(O,Ce)){var Ee=void 0;try{if(typeof O[Ce]!="function"){var lt=Error((oe||"React class")+": "+$+" type `"+Ce+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ce]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw lt.name="Invariant Violation",lt}Ee=O[Ce](W,Ce,oe,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(We){Ee=We}Ee&&!(Ee instanceof Error)&&(it(we),x("%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).",oe||"React class",$,Ce,typeof Ee),it(null)),Ee instanceof Error&&!(Ee.message in xn)&&(xn[Ee.message]=!0,it(we),x("Failed %s type: %s",$,Ee.message),it(null))}}}var Mr=Array.isArray;function Bt(O){return Mr(O)}function Kn(O){{var W=typeof Symbol=="function"&&Symbol.toStringTag,$=W&&O[Symbol.toStringTag]||O.constructor.name||"Object";return $}}function er(O){try{return tr(O),!1}catch{return!0}}function tr(O){return""+O}function nr(O){if(er(O))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Kn(O)),tr(O)}var gt=m.ReactCurrentOwner,Ln={key:!0,ref:!0,__self:!0,__source:!0},Pr,On,Vt;Vt={};function hs(O){if(rn.call(O,"ref")){var W=Object.getOwnPropertyDescriptor(O,"ref").get;if(W&&W.isReactWarning)return!1}return O.ref!==void 0}function Gt(O){if(rn.call(O,"key")){var W=Object.getOwnPropertyDescriptor(O,"key").get;if(W&&W.isReactWarning)return!1}return O.key!==void 0}function rr(O,W){if(typeof O.ref=="string"&&gt.current&&W&&gt.current.stateNode!==W){var $=M(gt.current.type);Vt[$]||(x('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',M(gt.current.type),O.ref),Vt[$]=!0)}}function kn(O,W){{var $=function(){Pr||(Pr=!0,x("%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)",W))};$.isReactWarning=!0,Object.defineProperty(O,"key",{get:$,configurable:!0})}}function _o(O,W){{var $=function(){On||(On=!0,x("%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)",W))};$.isReactWarning=!0,Object.defineProperty(O,"ref",{get:$,configurable:!0})}}var Ht=function(O,W,$,oe,we,Ie,Ce){var Ee={$$typeof:t,type:O,key:W,ref:$,props:Ce,_owner:Ie};return Ee._store={},Object.defineProperty(Ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function So(O,W,$,oe,we){{var Ie,Ce={},Ee=null,lt=null;$!==void 0&&(nr($),Ee=""+$),Gt(W)&&(nr(W.key),Ee=""+W.key),hs(W)&&(lt=W.ref,rr(W,we));for(Ie in W)rn.call(W,Ie)&&!Ln.hasOwnProperty(Ie)&&(Ce[Ie]=W[Ie]);if(O&&O.defaultProps){var We=O.defaultProps;for(Ie in We)Ce[Ie]===void 0&&(Ce[Ie]=We[Ie])}if(Ee||lt){var Ye=typeof O=="function"?O.displayName||O.name||"Unknown":O;Ee&&kn(Ce,Ye),lt&&_o(Ce,Ye)}return Ht(O,Ee,lt,we,oe,gt.current,Ce)}}var or=m.ReactCurrentOwner,sr=m.ReactDebugCurrentFrame;function on(O){if(O){var W=O._owner,$=He(O.type,O._source,W?W.type:null);sr.setExtraStackFrame($)}else sr.setExtraStackFrame(null)}var ar;ar=!1;function jr(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function To(){{if(or.current){var O=M(or.current.type);if(O)return`
21
+ `+Ee[We].replace(" at new "," at ");return O.displayName&&mt.includes("<anonymous>")&&(mt=mt.replace("<anonymous>",O.displayName)),typeof O=="function"&&re.set(O,mt),mt}while(We>=1&&Ye>=0);break}}}finally{P=!1,Q.current=Ie,X(),Error.prepareStackTrace=we}var Fn=O?O.displayName||O.name:"",oe=Fn?ce(Fn):"";return typeof O=="function"&&re.set(O,oe),oe}function Ae(O,W,$){return z(O,!1)}function Ve(O){var W=O.prototype;return!!(W&&W.isReactComponent)}function He(O,W,$){if(O==null)return"";if(typeof O=="function")return z(O,Ve(O));if(typeof O=="string")return ce(O);switch(O){case d:return ce("Suspense");case f:return ce("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case c:return Ae(O.render);case g:return He(O.type,W,$);case y:{var se=O,we=se._payload,Ie=se._init;try{return He(Ie(we),W,$)}catch{}}}return""}var rn=Object.prototype.hasOwnProperty,xn={},Ke=m.ReactDebugCurrentFrame;function it(O){if(O){var W=O._owner,$=He(O.type,O._source,W?W.type:null);Ke.setExtraStackFrame($)}else Ke.setExtraStackFrame(null)}function qe(O,W,$,se,we){{var Ie=Function.call.bind(rn);for(var Ce in O)if(Ie(O,Ce)){var Ee=void 0;try{if(typeof O[Ce]!="function"){var lt=Error((se||"React class")+": "+$+" type `"+Ce+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ce]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw lt.name="Invariant Violation",lt}Ee=O[Ce](W,Ce,se,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(We){Ee=We}Ee&&!(Ee instanceof Error)&&(it(we),x("%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).",se||"React class",$,Ce,typeof Ee),it(null)),Ee instanceof Error&&!(Ee.message in xn)&&(xn[Ee.message]=!0,it(we),x("Failed %s type: %s",$,Ee.message),it(null))}}}var Mr=Array.isArray;function Bt(O){return Mr(O)}function Kn(O){{var W=typeof Symbol=="function"&&Symbol.toStringTag,$=W&&O[Symbol.toStringTag]||O.constructor.name||"Object";return $}}function er(O){try{return tr(O),!1}catch{return!0}}function tr(O){return""+O}function nr(O){if(er(O))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Kn(O)),tr(O)}var gt=m.ReactCurrentOwner,Ln={key:!0,ref:!0,__self:!0,__source:!0},Pr,On,Vt;Vt={};function hs(O){if(rn.call(O,"ref")){var W=Object.getOwnPropertyDescriptor(O,"ref").get;if(W&&W.isReactWarning)return!1}return O.ref!==void 0}function Gt(O){if(rn.call(O,"key")){var W=Object.getOwnPropertyDescriptor(O,"key").get;if(W&&W.isReactWarning)return!1}return O.key!==void 0}function rr(O,W){if(typeof O.ref=="string"&&gt.current&&W&&gt.current.stateNode!==W){var $=M(gt.current.type);Vt[$]||(x('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',M(gt.current.type),O.ref),Vt[$]=!0)}}function kn(O,W){{var $=function(){Pr||(Pr=!0,x("%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)",W))};$.isReactWarning=!0,Object.defineProperty(O,"key",{get:$,configurable:!0})}}function _o(O,W){{var $=function(){On||(On=!0,x("%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)",W))};$.isReactWarning=!0,Object.defineProperty(O,"ref",{get:$,configurable:!0})}}var Ht=function(O,W,$,se,we,Ie,Ce){var Ee={$$typeof:t,type:O,key:W,ref:$,props:Ce,_owner:Ie};return Ee._store={},Object.defineProperty(Ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:se}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function So(O,W,$,se,we){{var Ie,Ce={},Ee=null,lt=null;$!==void 0&&(nr($),Ee=""+$),Gt(W)&&(nr(W.key),Ee=""+W.key),hs(W)&&(lt=W.ref,rr(W,we));for(Ie in W)rn.call(W,Ie)&&!Ln.hasOwnProperty(Ie)&&(Ce[Ie]=W[Ie]);if(O&&O.defaultProps){var We=O.defaultProps;for(Ie in We)Ce[Ie]===void 0&&(Ce[Ie]=We[Ie])}if(Ee||lt){var Ye=typeof O=="function"?O.displayName||O.name||"Unknown":O;Ee&&kn(Ce,Ye),lt&&_o(Ce,Ye)}return Ht(O,Ee,lt,we,se,gt.current,Ce)}}var or=m.ReactCurrentOwner,sr=m.ReactDebugCurrentFrame;function on(O){if(O){var W=O._owner,$=He(O.type,O._source,W?W.type:null);sr.setExtraStackFrame($)}else sr.setExtraStackFrame(null)}var ar;ar=!1;function jr(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function To(){{if(or.current){var O=M(or.current.type);if(O)return`
22
22
 
23
23
  Check the render method of \``+O+"`."}return""}}function gs(O){return""}var Br={};function ms(O){{var W=To();if(!W){var $=typeof O=="string"?O:O.displayName||O.name;$&&(W=`
24
24
 
25
- Check the top-level render call using <`+$+">.")}return W}}function Vr(O,W){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var $=ms(W);if(Br[$])return;Br[$]=!0;var oe="";O&&O._owner&&O._owner!==or.current&&(oe=" It was passed a child from "+M(O._owner.type)+"."),on(O),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,oe),on(null)}}function Gr(O,W){{if(typeof O!="object")return;if(Bt(O))for(var $=0;$<O.length;$++){var oe=O[$];jr(oe)&&Vr(oe,W)}else if(jr(O))O._store&&(O._store.validated=!0);else if(O){var we=p(O);if(typeof we=="function"&&we!==O.entries)for(var Ie=we.call(O),Ce;!(Ce=Ie.next()).done;)jr(Ce.value)&&Vr(Ce.value,W)}}}function Hr(O){{var W=O.type;if(W==null||typeof W=="string")return;var $;if(typeof W=="function")$=W.propTypes;else if(typeof W=="object"&&(W.$$typeof===c||W.$$typeof===g))$=W.propTypes;else return;if($){var oe=M(W);qe($,O.props,"prop",oe,O)}else if(W.PropTypes!==void 0&&!ar){ar=!0;var we=M(W);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",we||"Unknown")}typeof W.getDefaultProps=="function"&&!W.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pe(O){{for(var W=Object.keys(O.props),$=0;$<W.length;$++){var oe=W[$];if(oe!=="children"&&oe!=="key"){on(O),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),on(null);break}}O.ref!==null&&(on(O),x("Invalid attribute `ref` supplied to `React.Fragment`."),on(null))}}var ge={};function Qe(O,W,$,oe,we,Ie){{var Ce=R(O);if(!Ce){var Ee="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Ee+=" 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 lt=gs();lt?Ee+=lt:Ee+=To();var We;O===null?We="null":Bt(O)?We="array":O!==void 0&&O.$$typeof===t?(We="<"+(M(O.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):We=typeof O,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",We,Ee)}var Ye=So(O,W,$,we,Ie);if(Ye==null)return Ye;if(Ce){var mt=W.children;if(mt!==void 0)if(oe)if(Bt(mt)){for(var Fn=0;Fn<mt.length;Fn++)Gr(mt[Fn],O);Object.freeze&&Object.freeze(mt)}else x("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 Gr(mt,O)}if(rn.call(W,"key")){var se=M(O),me=Object.keys(W).filter(function(Ua){return Ua!=="key"}),ot=me.length>0?"{key: someKey, "+me.join(": ..., ")+": ...}":"{key: someKey}";if(!ge[se+ot]){var an=me.length>0?"{"+me.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+$+">.")}return W}}function Vr(O,W){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var $=ms(W);if(Br[$])return;Br[$]=!0;var se="";O&&O._owner&&O._owner!==or.current&&(se=" It was passed a child from "+M(O._owner.type)+"."),on(O),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,se),on(null)}}function Gr(O,W){{if(typeof O!="object")return;if(Bt(O))for(var $=0;$<O.length;$++){var se=O[$];jr(se)&&Vr(se,W)}else if(jr(O))O._store&&(O._store.validated=!0);else if(O){var we=p(O);if(typeof we=="function"&&we!==O.entries)for(var Ie=we.call(O),Ce;!(Ce=Ie.next()).done;)jr(Ce.value)&&Vr(Ce.value,W)}}}function Hr(O){{var W=O.type;if(W==null||typeof W=="string")return;var $;if(typeof W=="function")$=W.propTypes;else if(typeof W=="object"&&(W.$$typeof===c||W.$$typeof===g))$=W.propTypes;else return;if($){var se=M(W);qe($,O.props,"prop",se,O)}else if(W.PropTypes!==void 0&&!ar){ar=!0;var we=M(W);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",we||"Unknown")}typeof W.getDefaultProps=="function"&&!W.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pe(O){{for(var W=Object.keys(O.props),$=0;$<W.length;$++){var se=W[$];if(se!=="children"&&se!=="key"){on(O),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",se),on(null);break}}O.ref!==null&&(on(O),x("Invalid attribute `ref` supplied to `React.Fragment`."),on(null))}}var ge={};function Qe(O,W,$,se,we,Ie){{var Ce=R(O);if(!Ce){var Ee="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Ee+=" 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 lt=gs();lt?Ee+=lt:Ee+=To();var We;O===null?We="null":Bt(O)?We="array":O!==void 0&&O.$$typeof===t?(We="<"+(M(O.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):We=typeof O,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",We,Ee)}var Ye=So(O,W,$,we,Ie);if(Ye==null)return Ye;if(Ce){var mt=W.children;if(mt!==void 0)if(se)if(Bt(mt)){for(var Fn=0;Fn<mt.length;Fn++)Gr(mt[Fn],O);Object.freeze&&Object.freeze(mt)}else x("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 Gr(mt,O)}if(rn.call(W,"key")){var oe=M(O),me=Object.keys(W).filter(function(Ua){return Ua!=="key"}),ot=me.length>0?"{key: someKey, "+me.join(": ..., ")+": ...}":"{key: someKey}";if(!ge[oe+ot]){var an=me.length>0?"{"+me.join(": ..., ")+": ...}":"{}";x(`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} />`,ot,se,an,se),ge[se+ot]=!0}}return O===r?pe(Ye):Hr(Ye),Ye}}function ct(O,W,$){return Qe(O,W,$,!0)}function Nt(O,W,$){return Qe(O,W,$,!1)}var sn=Nt,St=ct;Lo.Fragment=r,Lo.jsx=sn,Lo.jsxs=St}()),Lo}process.env.NODE_ENV==="production"?ni.exports=K2():ni.exports=eh();var u=ni.exports,Wr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cr=typeof window>"u"||"Deno"in globalThis;function Rt(){}function th(e,t){return typeof e=="function"?e(t):e}function ri(e){return typeof e=="number"&&e>=0&&e!==1/0}function Wl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zr(e,t){return typeof e=="function"?e(t):e}function Zt(e,t){return typeof e=="function"?e(t):e}function Zl(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:a,stale:i}=e;if(a){if(r){if(t.queryHash!==oi(a,t.options))return!1}else if(!Oo(t.queryKey,a))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||s&&!s(t))}function zl(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(lr(t.options.mutationKey)!==lr(s))return!1}else if(!Oo(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function oi(e,t){return((t==null?void 0:t.queryKeyHashFn)||lr)(e)}function lr(e){return JSON.stringify(e,(t,n)=>ai(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Oo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Oo(e[n],t[n])):!1}function si(e,t){if(e===t)return e;const n=Xl(e)&&Xl(t);if(n||ai(e)&&ai(t)){const r=n?e:Object.keys(e),o=r.length,s=n?t:Object.keys(t),a=s.length,i=n?[]:{};let c=0;for(let d=0;d<a;d++){const f=n?d:s[d];(!n&&r.includes(f)||n)&&e[f]===void 0&&t[f]===void 0?(i[f]=void 0,c++):(i[f]=si(e[f],t[f]),i[f]===e[f]&&e[f]!==void 0&&c++)}return o===a&&c===o?e:i}return t}function xs(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Xl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ai(e){if(!Yl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Yl(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Yl(e){return Object.prototype.toString.call(e)==="[object Object]"}function nh(e){return new Promise(t=>{setTimeout(t,e)})}function ii(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return si(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return si(e,t)}return t}function rh(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function oh(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Cs=Symbol();function Jl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Cs&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Cs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var sh=(G2=class extends Wr{constructor(){super();ue(this,Ar);ue(this,Zn);ue(this,fo);K(this,fo,t=>{if(!cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){k(this,Zn)||this.setEventListener(k(this,fo))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,Zn))==null||t.call(this),K(this,Zn,void 0))}setEventListener(t){var n;K(this,fo,t),(n=k(this,Zn))==null||n.call(this),K(this,Zn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){k(this,Ar)!==t&&(K(this,Ar,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof k(this,Ar)=="boolean"?k(this,Ar):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ar=new WeakMap,Zn=new WeakMap,fo=new WeakMap,G2),ci=new sh,ah=(H2=class extends Wr{constructor(){super();ue(this,po,!0);ue(this,zn);ue(this,ho);K(this,ho,t=>{if(!cr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){k(this,zn)||this.setEventListener(k(this,ho))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,zn))==null||t.call(this),K(this,zn,void 0))}setEventListener(t){var n;K(this,ho,t),(n=k(this,zn))==null||n.call(this),K(this,zn,t(this.setOnline.bind(this)))}setOnline(t){k(this,po)!==t&&(K(this,po,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return k(this,po)}},po=new WeakMap,zn=new WeakMap,ho=new WeakMap,H2),Es=new ah;function li(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function ih(e){return Math.min(1e3*2**e,3e4)}function ql(e){return(e??"online")==="online"?Es.isOnline():!0}var Ql=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ui(e){return e instanceof Ql}function $l(e){let t=!1,n=0,r=!1,o;const s=li(),a=h=>{var p;r||(y(new Ql(h)),(p=e.abort)==null||p.call(e))},i=()=>{t=!0},c=()=>{t=!1},d=()=>ci.isFocused()&&(e.networkMode==="always"||Es.isOnline())&&e.canRun(),f=()=>ql(e.networkMode)&&e.canRun(),g=h=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,h),o==null||o(),s.resolve(h))},y=h=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,h),o==null||o(),s.reject(h))},E=()=>new Promise(h=>{var p;o=m=>{(r||d())&&h(m)},(p=e.onPause)==null||p.call(e)}).then(()=>{var h;o=void 0,r||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(r)return;let h;const p=n===0?e.initialPromise:void 0;try{h=p??e.fn()}catch(m){h=Promise.reject(m)}Promise.resolve(h).then(g).catch(m=>{var _;if(r)return;const x=e.retry??(cr?0:3),C=e.retryDelay??ih,w=typeof C=="function"?C(n,m):C,v=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,m);if(t||!v){y(m);return}n++,(_=e.onFail)==null||_.call(e,n,m),nh(w).then(()=>d()?void 0:E()).then(()=>{t?y(m):b()})})};return{promise:s,cancel:a,continue:()=>(o==null||o(),s),cancelRetry:i,continueRetry:c,canStart:f,start:()=>(f()?b():E().then(b),s)}}function ch(){let e=[],t=0,n=i=>{i()},r=i=>{i()},o=i=>setTimeout(i,0);const s=i=>{t?e.push(i):o(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&o(()=>{r(()=>{i.forEach(c=>{n(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||a()}return c},batchCalls:i=>(...c)=>{s(()=>{i(...c)})},schedule:s,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{o=i}}}var et=ch(),Ul=(W2=class{constructor(){ue(this,Lr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ri(this.gcTime)&&K(this,Lr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cr?1/0:5*60*1e3))}clearGcTimeout(){k(this,Lr)&&(clearTimeout(k(this,Lr)),K(this,Lr,void 0))}},Lr=new WeakMap,W2),lh=(Z2=class extends Ul{constructor(t){super();ue(this,tn);ue(this,go);ue(this,mo);ue(this,jt);ue(this,Or);ue(this,dt);ue(this,us);ue(this,kr);K(this,kr,!1),K(this,us,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,Or,t.client),K(this,jt,k(this,Or).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,go,uh(this.options)),this.state=t.state??k(this,go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=k(this,dt))==null?void 0:t.promise}setOptions(t){this.options={...k(this,us),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&k(this,jt).remove(this)}setData(t,n){const r=ii(this.state.data,t,this.options);return ye(this,tn,Dn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ye(this,tn,Dn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=k(this,dt))==null?void 0:r.promise;return(o=k(this,dt))==null||o.cancel(t),n?n.then(Rt).catch(Rt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(k(this,go))}isActive(){return this.observers.some(t=>Zt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cs||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Wl(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,dt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,dt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),k(this,jt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(k(this,dt)&&(k(this,kr)?k(this,dt).cancel({revert:!0}):k(this,dt).cancelRetry()),this.scheduleGc()),k(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ye(this,tn,Dn).call(this,{type:"invalidate"})}fetch(t,n){var c,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(k(this,dt))return k(this,dt).continueRetry(),k(this,dt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const g=this.observers.find(y=>y.options.queryFn);g&&this.setOptions(g.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(K(this,kr,!0),r.signal)})},s=()=>{const g=Jl(this.options,n),y={client:k(this,Or),queryKey:this.queryKey,meta:this.meta};return o(y),K(this,kr,!1),this.options.persister?this.options.persister(g,y,this):g(y)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:k(this,Or),state:this.state,fetchFn:s};o(a),(c=this.options.behavior)==null||c.onFetch(a,this),K(this,mo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&ye(this,tn,Dn).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const i=g=>{var y,E,b,h;ui(g)&&g.silent||ye(this,tn,Dn).call(this,{type:"error",error:g}),ui(g)||((E=(y=k(this,jt).config).onError)==null||E.call(y,g,this),(h=(b=k(this,jt).config).onSettled)==null||h.call(b,this.state.data,g,this)),this.scheduleGc()};return K(this,dt,$l({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var y,E,b,h;if(g===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),i(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(g)}catch(p){i(p);return}(E=(y=k(this,jt).config).onSuccess)==null||E.call(y,g,this),(h=(b=k(this,jt).config).onSettled)==null||h.call(b,g,this.state.error,this),this.scheduleGc()},onError:i,onFail:(g,y)=>{ye(this,tn,Dn).call(this,{type:"failed",failureCount:g,error:y})},onPause:()=>{ye(this,tn,Dn).call(this,{type:"pause"})},onContinue:()=>{ye(this,tn,Dn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),k(this,dt).start()}},go=new WeakMap,mo=new WeakMap,jt=new WeakMap,Or=new WeakMap,dt=new WeakMap,us=new WeakMap,kr=new WeakMap,tn=new WeakSet,Dn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Kl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return ui(o)&&o.revert&&k(this,mo)?{...k(this,mo),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),et.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),k(this,jt).notify({query:this,type:"updated",action:t})})},Z2);function Kl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ql(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function uh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var dh=(z2=class extends Wr{constructor(t={}){super();ue(this,gn);this.config=t,K(this,gn,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??oi(o,n);let a=this.get(s);return a||(a=new lh({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){k(this,gn).has(t.queryHash)||(k(this,gn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=k(this,gn).get(t.queryHash);n&&(t.destroy(),n===t&&k(this,gn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return k(this,gn).get(t)}getAll(){return[...k(this,gn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Zl(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Zl(t,r)):n}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},gn=new WeakMap,z2),fh=(X2=class extends Ul{constructor(t){super();ue(this,bn);ue(this,mn);ue(this,pt);ue(this,Fr);this.mutationId=t.mutationId,K(this,pt,t.mutationCache),K(this,mn,[]),this.state=t.state||eu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){k(this,mn).includes(t)||(k(this,mn).push(t),this.clearGcTimeout(),k(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,mn,k(this,mn).filter(n=>n!==t)),this.scheduleGc(),k(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){k(this,mn).length||(this.state.status==="pending"?this.scheduleGc():k(this,pt).remove(this))}continue(){var t;return((t=k(this,Fr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,s,a,i,c,d,f,g,y,E,b,h,p,m,x,C,w,v,_,T;K(this,Fr,$l({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(S,L)=>{ye(this,bn,ir).call(this,{type:"failed",failureCount:S,error:L})},onPause:()=>{ye(this,bn,ir).call(this,{type:"pause"})},onContinue:()=>{ye(this,bn,ir).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>k(this,pt).canRun(this)}));const n=this.state.status==="pending",r=!k(this,Fr).canStart();try{if(!n){ye(this,bn,ir).call(this,{type:"pending",variables:t,isPaused:r}),await((s=(o=k(this,pt).config).onMutate)==null?void 0:s.call(o,t,this));const L=await((i=(a=this.options).onMutate)==null?void 0:i.call(a,t));L!==this.state.context&&ye(this,bn,ir).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const S=await k(this,Fr).start();return await((d=(c=k(this,pt).config).onSuccess)==null?void 0:d.call(c,S,t,this.state.context,this)),await((g=(f=this.options).onSuccess)==null?void 0:g.call(f,S,t,this.state.context)),await((E=(y=k(this,pt).config).onSettled)==null?void 0:E.call(y,S,null,this.state.variables,this.state.context,this)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,S,null,t,this.state.context)),ye(this,bn,ir).call(this,{type:"success",data:S}),S}catch(S){try{throw await((m=(p=k(this,pt).config).onError)==null?void 0:m.call(p,S,t,this.state.context,this)),await((C=(x=this.options).onError)==null?void 0:C.call(x,S,t,this.state.context)),await((v=(w=k(this,pt).config).onSettled)==null?void 0:v.call(w,void 0,S,this.state.variables,this.state.context,this)),await((T=(_=this.options).onSettled)==null?void 0:T.call(_,void 0,S,t,this.state.context)),S}finally{ye(this,bn,ir).call(this,{type:"error",error:S})}}finally{k(this,pt).runNext(this)}}},mn=new WeakMap,pt=new WeakMap,Fr=new WeakMap,bn=new WeakSet,ir=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),et.batch(()=>{k(this,mn).forEach(r=>{r.onMutationUpdate(t)}),k(this,pt).notify({mutation:this,type:"updated",action:t})})},X2);function eu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ph=(Y2=class extends Wr{constructor(t={}){super();ue(this,Sn);ue(this,nn);ue(this,ds);this.config=t,K(this,Sn,new Set),K(this,nn,new Map),K(this,ds,0)}build(t,n,r){const o=new fh({mutationCache:this,mutationId:++Ka(this,ds)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){k(this,Sn).add(t);const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n);r?r.push(t):k(this,nn).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(k(this,Sn).delete(t)){const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&k(this,nn).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=vs(t);if(typeof n=="string"){const o=(r=k(this,nn).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{k(this,Sn).forEach(t=>{this.notify({type:"removed",mutation:t})}),k(this,Sn).clear(),k(this,nn).clear()})}getAll(){return Array.from(k(this,Sn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>zl(n,r))}findAll(t={}){return this.getAll().filter(n=>zl(t,n))}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return et.batch(()=>Promise.all(t.map(n=>n.continue().catch(Rt))))}},Sn=new WeakMap,nn=new WeakMap,ds=new WeakMap,Y2);function vs(e){var t;return(t=e.options.scope)==null?void 0:t.id}function ws(e){return{onFetch:(t,n)=>{var f,g,y,E,b;const r=t.options,o=(y=(g=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:g.fetchMore)==null?void 0:y.direction,s=((E=t.state.data)==null?void 0:E.pages)||[],a=((b=t.state.data)==null?void 0:b.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const p=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?h=!0:t.signal.addEventListener("abort",()=>{h=!0}),t.signal)})},m=Jl(t.options,t.fetchOptions),x=async(C,w,v)=>{if(h)return Promise.reject();if(w==null&&C.pages.length)return Promise.resolve(C);const _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:v?"backward":"forward",meta:t.options.meta};p(_);const T=await m(_),{maxPages:S}=t.options,L=v?oh:rh;return{pages:L(C.pages,T,S),pageParams:L(C.pageParams,w,S)}};if(o&&s.length){const C=o==="backward",w=C?tu:di,v={pages:s,pageParams:a},_=w(r,v);i=await x(v,_,C)}else{const C=e??s.length;do{const w=c===0?a[0]??r.initialPageParam:di(r,i);if(c>0&&w==null)break;i=await x(i,w),c++}while(c<C)}return i};t.options.persister?t.fetchFn=()=>{var h,p;return(p=(h=t.options).persister)==null?void 0:p.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function di(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function tu(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function hh(e,t){return t?di(e,t)!=null:!1}function gh(e,t){return!t||!e.getPreviousPageParam?!1:tu(e,t)!=null}var mh=(J2=class{constructor(e={}){ue(this,Xe);ue(this,Xn);ue(this,Yn);ue(this,bo);ue(this,yo);ue(this,Jn);ue(this,xo);ue(this,Co);K(this,Xe,e.queryCache||new dh),K(this,Xn,e.mutationCache||new ph),K(this,Yn,e.defaultOptions||{}),K(this,bo,new Map),K(this,yo,new Map),K(this,Jn,0)}mount(){Ka(this,Jn)._++,k(this,Jn)===1&&(K(this,xo,ci.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,Xe).onFocus())})),K(this,Co,Es.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,Xe).onOnline())})))}unmount(){var e,t;Ka(this,Jn)._--,k(this,Jn)===0&&((e=k(this,xo))==null||e.call(this),K(this,xo,void 0),(t=k(this,Co))==null||t.call(this),K(this,Co,void 0))}isFetching(e){return k(this,Xe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return k(this,Xn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,Xe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=k(this,Xe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Zr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return k(this,Xe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=k(this,Xe).get(r.queryHash),s=o==null?void 0:o.state.data,a=th(t,s);if(a!==void 0)return k(this,Xe).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return et.batch(()=>k(this,Xe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,Xe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=k(this,Xe);et.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=k(this,Xe);return et.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=et.batch(()=>k(this,Xe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Rt).catch(Rt)}invalidateQueries(e,t={}){return et.batch(()=>(k(this,Xe).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=et.batch(()=>k(this,Xe).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Rt)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Rt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=k(this,Xe).build(this,t);return n.isStaleByTime(Zr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rt).catch(Rt)}fetchInfiniteQuery(e){return e.behavior=ws(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rt).catch(Rt)}ensureInfiniteQueryData(e){return e.behavior=ws(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Es.isOnline()?k(this,Xn).resumePausedMutations():Promise.resolve()}getQueryCache(){return k(this,Xe)}getMutationCache(){return k(this,Xn)}getDefaultOptions(){return k(this,Yn)}setDefaultOptions(e){K(this,Yn,e)}setQueryDefaults(e,t){k(this,bo).set(lr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...k(this,bo).values()],n={};return t.forEach(r=>{Oo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){k(this,yo).set(lr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...k(this,yo).values()],n={};return t.forEach(r=>{Oo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...k(this,Yn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=oi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Cs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...k(this,Yn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){k(this,Xe).clear(),k(this,Xn).clear()}},Xe=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,bo=new WeakMap,yo=new WeakMap,Jn=new WeakMap,xo=new WeakMap,Co=new WeakMap,J2),nu=(q2=class extends Wr{constructor(t,n){super();ue(this,Me);ue(this,It);ue(this,Se);ue(this,fs);ue(this,ht);ue(this,Dr);ue(this,Eo);ue(this,qn);ue(this,yn);ue(this,ps);ue(this,vo);ue(this,wo);ue(this,Nr);ue(this,Rr);ue(this,Qn);ue(this,Io,new Set);this.options=n,K(this,It,t),K(this,yn,null),K(this,qn,li()),this.options.experimental_prefetchInRender||k(this,qn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(k(this,Se).addObserver(this),ru(k(this,Se),this.options)?ye(this,Me,bs).call(this):this.updateResult(),ye(this,Me,Ml).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fi(k(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fi(k(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ye(this,Me,Pl).call(this),ye(this,Me,jl).call(this),k(this,Se).removeObserver(this)}setOptions(t,n){const r=this.options,o=k(this,Se);if(this.options=k(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zt(this.options.enabled,k(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ye(this,Me,Bl).call(this),k(this,Se).setOptions(this.options),r._defaulted&&!xs(this.options,r)&&k(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:k(this,Se),observer:this});const s=this.hasListeners();s&&ou(k(this,Se),o,this.options,r)&&ye(this,Me,bs).call(this),this.updateResult(n),s&&(k(this,Se)!==o||Zt(this.options.enabled,k(this,Se))!==Zt(r.enabled,k(this,Se))||Zr(this.options.staleTime,k(this,Se))!==Zr(r.staleTime,k(this,Se)))&&ye(this,Me,Dl).call(this);const a=ye(this,Me,Nl).call(this);s&&(k(this,Se)!==o||Zt(this.options.enabled,k(this,Se))!==Zt(r.enabled,k(this,Se))||a!==k(this,Qn))&&ye(this,Me,Rl).call(this,a)}getOptimisticResult(t){const n=k(this,It).getQueryCache().build(k(this,It),t),r=this.createResult(n,t);return yh(this,r)&&(K(this,ht,r),K(this,Eo,this.options),K(this,Dr,k(this,Se).state)),r}getCurrentResult(){return k(this,ht)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){k(this,Io).add(t)}getCurrentQuery(){return k(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=k(this,It).defaultQueryOptions(t),r=k(this,It).getQueryCache().build(k(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ye(this,Me,bs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),k(this,ht)))}createResult(t,n){var S;const r=k(this,Se),o=this.options,s=k(this,ht),a=k(this,Dr),i=k(this,Eo),d=t!==r?t.state:k(this,fs),{state:f}=t;let g={...f},y=!1,E;if(n._optimisticResults){const L=this.hasListeners(),R=!L&&ru(t,n),D=L&&ou(t,r,n,o);(R||D)&&(g={...g,...Kl(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:p}=g;if(n.select&&g.data!==void 0)if(s&&g.data===(a==null?void 0:a.data)&&n.select===k(this,ps))E=k(this,vo);else try{K(this,ps,n.select),E=n.select(g.data),E=ii(s==null?void 0:s.data,E,n),K(this,vo,E),K(this,yn,null)}catch(L){K(this,yn,L)}else E=g.data;if(n.placeholderData!==void 0&&E===void 0&&p==="pending"){let L;if(s!=null&&s.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData))L=s.data;else if(L=typeof n.placeholderData=="function"?n.placeholderData((S=k(this,wo))==null?void 0:S.state.data,k(this,wo)):n.placeholderData,n.select&&L!==void 0)try{L=n.select(L),K(this,yn,null)}catch(R){K(this,yn,R)}L!==void 0&&(p="success",E=ii(s==null?void 0:s.data,L,n),y=!0)}k(this,yn)&&(b=k(this,yn),E=k(this,vo),h=Date.now(),p="error");const m=g.fetchStatus==="fetching",x=p==="pending",C=p==="error",w=x&&m,v=E!==void 0,T={status:p,fetchStatus:g.fetchStatus,isPending:x,isSuccess:p==="success",isError:C,isInitialLoading:w,isLoading:w,data:E,dataUpdatedAt:g.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:m,isRefetching:m&&!x,isLoadingError:C&&!v,isPaused:g.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:C&&v,isStale:pi(t,n),refetch:this.refetch,promise:k(this,qn)};if(this.options.experimental_prefetchInRender){const L=F=>{T.status==="error"?F.reject(T.error):T.data!==void 0&&F.resolve(T.data)},R=()=>{const F=K(this,qn,T.promise=li());L(F)},D=k(this,qn);switch(D.status){case"pending":t.queryHash===r.queryHash&&L(D);break;case"fulfilled":(T.status==="error"||T.data!==D.value)&&R();break;case"rejected":(T.status!=="error"||T.error!==D.reason)&&R();break}}return T}updateResult(t){const n=k(this,ht),r=this.createResult(k(this,Se),this.options);if(K(this,Dr,k(this,Se).state),K(this,Eo,this.options),k(this,Dr).data!==void 0&&K(this,wo,k(this,Se)),xs(r,n))return;K(this,ht,r);const o={},s=()=>{if(!n)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!k(this,Io).size)return!0;const c=new Set(i??k(this,Io));return this.options.throwOnError&&c.add("error"),Object.keys(k(this,ht)).some(d=>{const f=d;return k(this,ht)[f]!==n[f]&&c.has(f)})};(t==null?void 0:t.listeners)!==!1&&s()&&(o.listeners=!0),ye(this,Me,U2).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ye(this,Me,Ml).call(this)}},It=new WeakMap,Se=new WeakMap,fs=new WeakMap,ht=new WeakMap,Dr=new WeakMap,Eo=new WeakMap,qn=new WeakMap,yn=new WeakMap,ps=new WeakMap,vo=new WeakMap,wo=new WeakMap,Nr=new WeakMap,Rr=new WeakMap,Qn=new WeakMap,Io=new WeakMap,Me=new WeakSet,bs=function(t){ye(this,Me,Bl).call(this);let n=k(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Rt)),n},Dl=function(){ye(this,Me,Pl).call(this);const t=Zr(this.options.staleTime,k(this,Se));if(cr||k(this,ht).isStale||!ri(t))return;const r=Wl(k(this,ht).dataUpdatedAt,t)+1;K(this,Nr,setTimeout(()=>{k(this,ht).isStale||this.updateResult()},r))},Nl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(k(this,Se)):this.options.refetchInterval)??!1},Rl=function(t){ye(this,Me,jl).call(this),K(this,Qn,t),!(cr||Zt(this.options.enabled,k(this,Se))===!1||!ri(k(this,Qn))||k(this,Qn)===0)&&K(this,Rr,setInterval(()=>{(this.options.refetchIntervalInBackground||ci.isFocused())&&ye(this,Me,bs).call(this)},k(this,Qn)))},Ml=function(){ye(this,Me,Dl).call(this),ye(this,Me,Rl).call(this,ye(this,Me,Nl).call(this))},Pl=function(){k(this,Nr)&&(clearTimeout(k(this,Nr)),K(this,Nr,void 0))},jl=function(){k(this,Rr)&&(clearInterval(k(this,Rr)),K(this,Rr,void 0))},Bl=function(){const t=k(this,It).getQueryCache().build(k(this,It),this.options);if(t===k(this,Se))return;const n=k(this,Se);K(this,Se,t),K(this,fs,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},U2=function(t){et.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(k(this,ht))}),k(this,It).getQueryCache().notify({query:k(this,Se),type:"observerResultsUpdated"})})},q2);function bh(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ru(e,t){return bh(e,t)||e.state.data!==void 0&&fi(e,t,t.refetchOnMount)}function fi(e,t,n){if(Zt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&pi(e,t)}return!1}function ou(e,t,n,r){return(e!==t||Zt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&pi(e,n)}function pi(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(Zr(t.staleTime,e))}function yh(e,t){return!xs(e.getCurrentResult(),t)}var xh=class extends nu{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:ws()},t)}getOptimisticResult(e){return e.behavior=ws(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,h;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:a,isRefetchError:i}=r,c=(h=(b=n.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:h.direction,d=a&&c==="forward",f=o&&c==="forward",g=a&&c==="backward",y=o&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hh(t,n.data),hasPreviousPage:gh(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:g,isFetchingPreviousPage:y,isRefetchError:i&&!d&&!g,isRefetching:s&&!f&&!y}}},Ch=(Q2=class extends Wr{constructor(n,r){super();ue(this,An);ue(this,$n);ue(this,Un);ue(this,_t);ue(this,Tn);K(this,$n,n),this.setOptions(r),this.bindMethods(),ye(this,An,ei).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=k(this,$n).defaultMutationOptions(n),xs(this.options,r)||k(this,$n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:k(this,_t),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&lr(r.mutationKey)!==lr(this.options.mutationKey)?this.reset():((o=k(this,_t))==null?void 0:o.state.status)==="pending"&&k(this,_t).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=k(this,_t))==null||n.removeObserver(this)}onMutationUpdate(n){ye(this,An,ei).call(this),ye(this,An,Vl).call(this,n)}getCurrentResult(){return k(this,Un)}reset(){var n;(n=k(this,_t))==null||n.removeObserver(this),K(this,_t,void 0),ye(this,An,ei).call(this),ye(this,An,Vl).call(this)}mutate(n,r){var o;return K(this,Tn,r),(o=k(this,_t))==null||o.removeObserver(this),K(this,_t,k(this,$n).getMutationCache().build(k(this,$n),this.options)),k(this,_t).addObserver(this),k(this,_t).execute(n)}},$n=new WeakMap,Un=new WeakMap,_t=new WeakMap,Tn=new WeakMap,An=new WeakSet,ei=function(){var r;const n=((r=k(this,_t))==null?void 0:r.state)??eu();K(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(n){et.batch(()=>{var r,o,s,a,i,c,d,f;if(k(this,Tn)&&this.hasListeners()){const g=k(this,Un).variables,y=k(this,Un).context;(n==null?void 0:n.type)==="success"?((o=(r=k(this,Tn)).onSuccess)==null||o.call(r,n.data,g,y),(a=(s=k(this,Tn)).onSettled)==null||a.call(s,n.data,null,g,y)):(n==null?void 0:n.type)==="error"&&((c=(i=k(this,Tn)).onError)==null||c.call(i,n.error,g,y),(f=(d=k(this,Tn)).onSettled)==null||f.call(d,void 0,n.error,g,y))}this.listeners.forEach(g=>{g(k(this,Un))})})},Q2),su=A.createContext(void 0),ur=e=>{const t=A.useContext(su);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Eh=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(su.Provider,{value:e,children:t})),au=A.createContext(!1),vh=()=>A.useContext(au);au.Provider;function wh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ih=A.createContext(wh()),_h=()=>A.useContext(Ih);function iu(e,t){return typeof e=="function"?e(...t):!!e}function hi(){}var Sh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Th=e=>{A.useEffect(()=>{e.clearReset()},[e])},Ah=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||iu(n,[e.error,r])),Lh=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Oh=(e,t)=>e.isLoading&&e.isFetching&&!t,kh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,cu=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lu(e,t,n){var g,y,E,b,h;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=ur(),o=vh(),s=_h(),a=r.defaultQueryOptions(e);(y=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||y.call(g,a),process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=o?"isRestoring":"optimistic",Lh(a),Sh(a,s),Th(s);const i=!r.getQueryCache().get(a.queryHash),[c]=A.useState(()=>new t(r,a)),d=c.getOptimisticResult(a),f=!o&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(p=>{const m=f?c.subscribe(et.batchCalls(p)):hi;return c.updateResult(),m},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),A.useEffect(()=>{c.setOptions(a,{listeners:!1})},[a,c]),kh(a,d))throw cu(a,c,s);if(Ah({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;if((b=(E=r.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||b.call(E,a,d),a.experimental_prefetchInRender&&!cr&&Oh(d,o)){const p=i?cu(a,c,s):(h=r.getQueryCache().get(a.queryHash))==null?void 0:h.promise;p==null||p.catch(hi).finally(()=>{c.updateResult()})}return a.notifyOnChangeProps?d:c.trackResult(d)}function zt(e,t){return lu(e,nu)}function Xt(e,t){const n=ur(),[r]=A.useState(()=>new Ch(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);const o=A.useSyncExternalStore(A.useCallback(a=>r.subscribe(et.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=A.useCallback((a,i)=>{r.mutate(a,i).catch(hi)},[r]);if(o.error&&iu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}function Fh(e,t){return lu(e,xh)}const gi=(e,t)=>t.some(n=>e instanceof n);let uu,du;function Dh(){return uu||(uu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Nh(){return du||(du=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const mi=new WeakMap,bi=new WeakMap,Is=new WeakMap;function Rh(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",s),e.removeEventListener("error",a)},s=()=>{n(dr(e.result)),o()},a=()=>{r(e.error),o()};e.addEventListener("success",s),e.addEventListener("error",a)});return Is.set(t,e),t}function Mh(e){if(mi.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",a),e.removeEventListener("abort",a)},s=()=>{n(),o()},a=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",s),e.addEventListener("error",a),e.addEventListener("abort",a)});mi.set(e,t)}let yi={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return mi.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return dr(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function fu(e){yi=e(yi)}function Ph(e){return Nh().includes(e)?function(...t){return e.apply(xi(this),t),dr(this.request)}:function(...t){return dr(e.apply(xi(this),t))}}function jh(e){return typeof e=="function"?Ph(e):(e instanceof IDBTransaction&&Mh(e),gi(e,Dh())?new Proxy(e,yi):e)}function dr(e){if(e instanceof IDBRequest)return Rh(e);if(bi.has(e))return bi.get(e);const t=jh(e);return t!==e&&(bi.set(e,t),Is.set(t,e)),t}const xi=e=>Is.get(e);function Bh(e,t,{blocked:n,upgrade:r,blocking:o,terminated:s}={}){const a=indexedDB.open(e,t),i=dr(a);return r&&a.addEventListener("upgradeneeded",c=>{r(dr(a.result),c.oldVersion,c.newVersion,dr(a.transaction),c)}),n&&a.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),i.then(c=>{s&&c.addEventListener("close",()=>s()),o&&c.addEventListener("versionchange",d=>o(d.oldVersion,d.newVersion,d))}).catch(()=>{}),i}const Vh=["get","getKey","getAll","getAllKeys","count"],Gh=["put","add","delete","clear"],Ci=new Map;function pu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ci.get(t))return Ci.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=Gh.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||Vh.includes(n)))return;const s=async function(a,...i){const c=this.transaction(a,o?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(i.shift())),(await Promise.all([d[n](...i),o&&c.done]))[0]};return Ci.set(t,s),s}fu(e=>({...e,get:(t,n,r)=>pu(t,n)||e.get(t,n,r),has:(t,n)=>!!pu(t,n)||e.has(t,n)}));const Hh=["continue","continuePrimaryKey","advance"],hu={},Ei=new WeakMap,gu=new WeakMap,Wh={get(e,t){if(!Hh.includes(t))return e[t];let n=hu[t];return n||(n=hu[t]=function(...r){Ei.set(this,gu.get(this)[t](...r))}),n}};async function*Zh(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,Wh);for(gu.set(n,t),Is.set(n,xi(t));t;)yield n,t=await(Ei.get(n)||t.continue()),Ei.delete(n)}function mu(e,t){return t===Symbol.asyncIterator&&gi(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&gi(e,[IDBIndex,IDBObjectStore])}fu(e=>({...e,get(t,n,r){return mu(t,n)?Zh:e.get(t,n,r)},has(t,n){return mu(t,n)||e.has(t,n)}}));const zh="connector-db",Xh=1,_s={FEEDBACK:"feedback"},ko=`${_s.FEEDBACK}:data`,Ss=`${_s.FEEDBACK}:last_submitted`,Fo=`${_s.FEEDBACK}:capture_on_demand`,Do=`${_s.FEEDBACK}:show_notification`,Yh=12*60*60*1e3,vi=(e,t=new Date)=>e?Math.abs(t.getTime()-e.getTime())>=Yh:!0,bu=(e,t=!1)=>e.captureFeedback&&(vi(e.firstViewed)&&(!e.lastSubmittedFeedback||vi(e.lastSubmittedFeedback))||!!t);let fr=null;const Nn=async()=>{try{fr||(fr=await Bh(zh,Xh,{upgrade(e){e.objectStoreNames.contains(ko)||e.createObjectStore(ko),e.objectStoreNames.contains(Ss)||e.createObjectStore(Ss),e.objectStoreNames.contains(Fo)||e.createObjectStore(Fo),e.objectStoreNames.contains(Do)||e.createObjectStore(Do)},blocked(){console.warn("Upgrade blocked! Close other tabs using this DB.")},blocking(){console.warn("Another tab is trying to upgrade. Closing connection to allow upgrade."),fr&&(fr.close(),fr=null)},terminated(){console.error("DB connection unexpectedly closed. Resetting connection."),fr=null}}))}catch(e){console.error("Error opening IndexedDB connection:",e)}return fr},wi=async e=>{if(!e)return[];const t=await Nn();if(!t)return[];try{return await t.get(ko,e)||[]}catch(n){return console.error("Error fetching user feedback data:",n),[]}},Jh=async e=>{if(!e)return null;const t=await Nn();if(!t)return null;try{return await t.get(Ss,e)||null}catch(n){return console.error("Error fetching last submitted feedback:",n),null}},Ts=async e=>{if(!e)return;const t=await Nn();if(t)try{return await t.get(Fo,e)}catch(n){console.error("Error fetching capture on demand status:",n);return}},qh=async e=>{if(!e)return!1;const t=await Nn();if(!t)return!1;try{return await t.get(Do,e)??!1}catch(n){return console.error("Error fetching show notification status:",n),!1}},Qh=async(e,t)=>{if(!e||!t||!t.length)return;const n=await Nn();if(n)try{const r=await wi(e),o=new Set(r.map(a=>a.connectorId)),s=t.filter(a=>!o.has(a.connector_id)).map(a=>({connectorId:a.connector_id,captureFeedback:!0,firstViewed:new Date}));if(s.length>0){const a=[...r,...s];await n.put(ko,a,e),await n.put(Do,!0,e)}}catch(r){console.error("Error updating connectors feedback data:",r)}},$h=async e=>{if(!e)return;const t=await Nn();if(t)try{const n=await wi(e),r=await Ts(e),o=new Date,s=n.map(a=>{const i=bu(a,r);return{...a,lastSubmittedFeedback:i?o:a.lastSubmittedFeedback,captureFeedback:a.captureFeedback!==i}});await t.put(ko,s,e),await t.put(Ss,o,e),r&&await t.put(Fo,!1,e)}catch(n){console.error("Error updating feedback submission date:",n)}},yu=async(e,t)=>{if(!e)return;const n=await Nn();if(n)try{await n.put(Fo,t,e)}catch(r){console.error("Error updating capture on demand:",r)}},Uh=async e=>{if(!e)return;const t=await Nn();if(t)try{await t.put(Do,!1,e)}catch(n){console.error("Error resetting show notification status:",n)}},Kh=async e=>{const t=await wi(e),n=await Ts(e);return t.filter(o=>bu(o,n))},Ii=async e=>{const t=await Jh(e);return t&&!vi(t)?!1:await Ts(e)&&!t?!0:!!(await Kh(e)).length},eg=async(e,t)=>{await Qh(e,t)},As=async e=>{e&&await $h(e)},tg=async(e,t)=>{const n=await Ts(e);t?n!==!1&&await yu(e,t):await yu(e,void 0)},xu=async e=>await qh(e)&&await Ii(e),Cu=async e=>{await Uh(e)};var _i={},pr={};function Eu(e,t){return function(){return e.apply(t,arguments)}}const{toString:ng}=Object.prototype,{getPrototypeOf:Si}=Object,Ls=(e=>t=>{const n=ng.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Yt=e=>(e=e.toLowerCase(),t=>Ls(t)===e),Os=e=>t=>typeof t===e,{isArray:zr}=Array,No=Os("undefined");function rg(e){return e!==null&&!No(e)&&e.constructor!==null&&!No(e.constructor)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vu=Yt("ArrayBuffer");function og(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&vu(e.buffer),t}const sg=Os("string"),Tt=Os("function"),wu=Os("number"),ks=e=>e!==null&&typeof e=="object",ag=e=>e===!0||e===!1,Fs=e=>{if(Ls(e)!=="object")return!1;const t=Si(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ig=Yt("Date"),cg=Yt("File"),lg=Yt("Blob"),ug=Yt("FileList"),dg=e=>ks(e)&&Tt(e.pipe),fg=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Tt(e.append)&&((t=Ls(e))==="formdata"||t==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"))},pg=Yt("URLSearchParams"),[hg,gg,mg,bg]=["ReadableStream","Request","Response","Headers"].map(Yt),yg=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ro(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),zr(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),a=s.length;let i;for(r=0;r<a;r++)i=s[r],t.call(null,e[i],i,e)}}function Iu(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,o;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const hr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:he,_u=e=>!No(e)&&e!==hr;function Ti(){const{caseless:e}=_u(this)&&this||{},t={},n=(r,o)=>{const s=e&&Iu(t,o)||o;Fs(t[s])&&Fs(r)?t[s]=Ti(t[s],r):Fs(r)?t[s]=Ti({},r):zr(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Ro(arguments[r],n);return t}const xg=(e,t,n,{allOwnKeys:r}={})=>(Ro(t,(o,s)=>{n&&Tt(o)?e[s]=Eu(o,n):e[s]=o},{allOwnKeys:r}),e),Cg=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Eg=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},vg=(e,t,n,r)=>{let o,s,a;const i={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],(!r||r(a,e,t))&&!i[a]&&(t[a]=e[a],i[a]=!0);e=n!==!1&&Si(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},wg=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Ig=e=>{if(!e)return null;if(zr(e))return e;let t=e.length;if(!wu(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},_g=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Si(Uint8Array)),Sg=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},Tg=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ag=Yt("HTMLFormElement"),Lg=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Su=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Og=Yt("RegExp"),Tu=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ro(n,(o,s)=>{let a;(a=t(o,s,e))!==!1&&(r[s]=a||o)}),Object.defineProperties(e,r)},kg=e=>{Tu(e,(t,n)=>{if(Tt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Tt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Fg=(e,t)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return zr(e)?r(e):r(String(e).split(t)),n},Dg=()=>{},Ng=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Ai="abcdefghijklmnopqrstuvwxyz",Au="0123456789",Lu={DIGIT:Au,ALPHA:Ai,ALPHA_DIGIT:Ai+Ai.toUpperCase()+Au},Rg=(e=16,t=Lu.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Mg(e){return!!(e&&Tt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Pg=e=>{const t=new Array(10),n=(r,o)=>{if(ks(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const s=zr(r)?[]:{};return Ro(r,(a,i)=>{const c=n(a,o+1);!No(c)&&(s[i]=c)}),t[o]=void 0,s}}return r};return n(e,0)},jg=Yt("AsyncFunction"),Bg=e=>e&&(ks(e)||Tt(e))&&Tt(e.then)&&Tt(e.catch),Ou=((e,t)=>e?setImmediate:t?((n,r)=>(hr.addEventListener("message",({source:o,data:s})=>{o===hr&&s===n&&r.length&&r.shift()()},!1),o=>{r.push(o),hr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Tt(hr.postMessage)),Vg=typeof queueMicrotask<"u"?queueMicrotask.bind(hr):typeof process<"u"&&process.nextTick||Ou;var j={isArray:zr,isArrayBuffer:vu,isBuffer:rg,isFormData:fg,isArrayBufferView:og,isString:sg,isNumber:wu,isBoolean:ag,isObject:ks,isPlainObject:Fs,isReadableStream:hg,isRequest:gg,isResponse:mg,isHeaders:bg,isUndefined:No,isDate:ig,isFile:cg,isBlob:lg,isRegExp:Og,isFunction:Tt,isStream:dg,isURLSearchParams:pg,isTypedArray:_g,isFileList:ug,forEach:Ro,merge:Ti,extend:xg,trim:yg,stripBOM:Cg,inherits:Eg,toFlatObject:vg,kindOf:Ls,kindOfTest:Yt,endsWith:wg,toArray:Ig,forEachEntry:Sg,matchAll:Tg,isHTMLForm:Ag,hasOwnProperty:Su,hasOwnProp:Su,reduceDescriptors:Tu,freezeMethods:kg,toObjectSet:Fg,toCamelCase:Lg,noop:Dg,toFiniteNumber:Ng,findKey:Iu,global:hr,isContextDefined:_u,ALPHABET:Lu,generateString:Rg,isSpecCompliantForm:Mg,toJSONObject:Pg,isAsyncFn:jg,isThenable:Bg,setImmediate:Ou,asap:Vg};function be(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}j.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:j.toJSONObject(this.config),code:this.code,status:this.status}}});const ku=be.prototype,Fu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Fu[e]={value:e}}),Object.defineProperties(be,Fu),Object.defineProperty(ku,"isAxiosError",{value:!0}),be.from=(e,t,n,r,o,s)=>{const a=Object.create(ku);return j.toFlatObject(e,a,function(c){return c!==Error.prototype},i=>i!=="isAxiosError"),be.call(a,e.message,t,n,r,o),a.cause=e,a.name=e.name,s&&Object.assign(a,s),a};var Gg=null;function Li(e){return j.isPlainObject(e)||j.isArray(e)}function Du(e){return j.endsWith(e,"[]")?e.slice(0,-2):e}function Nu(e,t,n){return e?e.concat(t).map(function(o,s){return o=Du(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function Hg(e){return j.isArray(e)&&!e.some(Li)}const Wg=j.toFlatObject(j,{},null,function(t){return/^is[A-Z]/.test(t)});function Ds(e,t,n){if(!j.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=j.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,p){return!j.isUndefined(p[h])});const r=n.metaTokens,o=n.visitor||f,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&j.isSpecCompliantForm(t);if(!j.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(j.isDate(b))return b.toISOString();if(!c&&j.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return j.isArrayBuffer(b)||j.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,h,p){let m=b;if(b&&!p&&typeof b=="object"){if(j.endsWith(h,"{}"))h=r?h:h.slice(0,-2),b=JSON.stringify(b);else if(j.isArray(b)&&Hg(b)||(j.isFileList(b)||j.endsWith(h,"[]"))&&(m=j.toArray(b)))return h=Du(h),m.forEach(function(C,w){!(j.isUndefined(C)||C===null)&&t.append(a===!0?Nu([h],w,s):a===null?h:h+"[]",d(C))}),!1}return Li(b)?!0:(t.append(Nu(p,h,s),d(b)),!1)}const g=[],y=Object.assign(Wg,{defaultVisitor:f,convertValue:d,isVisitable:Li});function E(b,h){if(!j.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+h.join("."));g.push(b),j.forEach(b,function(m,x){(!(j.isUndefined(m)||m===null)&&o.call(t,m,j.isString(x)?x.trim():x,h,y))===!0&&E(m,h?h.concat(x):[x])}),g.pop()}}if(!j.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Ru(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Oi(e,t){this._pairs=[],e&&Ds(e,this,t)}const Mu=Oi.prototype;Mu.append=function(t,n){this._pairs.push([t,n])},Mu.toString=function(t){const n=t?function(r){return t.call(this,r,Ru)}:Ru;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function Zg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Pu(e,t,n){if(!t)return e;const r=n&&n.encode||Zg,o=n&&n.serialize;let s;if(o?s=o(t,n):s=j.isURLSearchParams(t)?t.toString():new Oi(t,n).toString(r),s){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class zg{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){j.forEach(this.handlers,function(r){r!==null&&t(r)})}}var ju=zg,Bu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xg=typeof URLSearchParams<"u"?URLSearchParams:Oi,Yg=typeof FormData<"u"?FormData:null,Jg=typeof Blob<"u"?Blob:null,qg={isBrowser:!0,classes:{URLSearchParams:Xg,FormData:Yg,Blob:Jg},protocols:["http","https","file","blob","url","data"]};const ki=typeof window<"u"&&typeof document<"u",Fi=typeof navigator=="object"&&navigator||void 0,Qg=ki&&(!Fi||["ReactNative","NativeScript","NS"].indexOf(Fi.product)<0),$g=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ug=ki&&window.location.href||"http://localhost";var Kg=Object.freeze({__proto__:null,hasBrowserEnv:ki,hasStandardBrowserWebWorkerEnv:$g,hasStandardBrowserEnv:Qg,navigator:Fi,origin:Ug}),bt={...Kg,...qg};function em(e,t){return Ds(e,new bt.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return bt.isNode&&j.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function tm(e){return j.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function nm(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}function Vu(e){function t(n,r,o,s){let a=n[s++];if(a==="__proto__")return!0;const i=Number.isFinite(+a),c=s>=n.length;return a=!a&&j.isArray(o)?o.length:a,c?(j.hasOwnProp(o,a)?o[a]=[o[a],r]:o[a]=r,!i):((!o[a]||!j.isObject(o[a]))&&(o[a]=[]),t(n,r,o[a],s)&&j.isArray(o[a])&&(o[a]=nm(o[a])),!i)}if(j.isFormData(e)&&j.isFunction(e.entries)){const n={};return j.forEachEntry(e,(r,o)=>{t(tm(r),o,n,0)}),n}return null}function rm(e,t,n){if(j.isString(e))try{return(t||JSON.parse)(e),j.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const Di={transitional:Bu,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=j.isObject(t);if(s&&j.isHTMLForm(t)&&(t=new FormData(t)),j.isFormData(t))return o?JSON.stringify(Vu(t)):t;if(j.isArrayBuffer(t)||j.isBuffer(t)||j.isStream(t)||j.isFile(t)||j.isBlob(t)||j.isReadableStream(t))return t;if(j.isArrayBufferView(t))return t.buffer;if(j.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return em(t,this.formSerializer).toString();if((i=j.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Ds(i?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),rm(t)):t}],transformResponse:[function(t){const n=this.transitional||Di.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(j.isResponse(t)||j.isReadableStream(t))return t;if(t&&j.isString(t)&&(r&&!this.responseType||o)){const a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(i){if(a)throw i.name==="SyntaxError"?be.from(i,be.ERR_BAD_RESPONSE,this,null,this.response):i}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bt.classes.FormData,Blob:bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};j.forEach(["delete","get","head","post","put","patch"],e=>{Di.headers[e]={}});var Ni=Di;const om=j.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var sm=e=>{const t={};let n,r,o;return e&&e.split(`
30
+ <%s key={someKey} {...props} />`,ot,oe,an,oe),ge[oe+ot]=!0}}return O===r?pe(Ye):Hr(Ye),Ye}}function ct(O,W,$){return Qe(O,W,$,!0)}function Nt(O,W,$){return Qe(O,W,$,!1)}var sn=Nt,St=ct;Lo.Fragment=r,Lo.jsx=sn,Lo.jsxs=St}()),Lo}process.env.NODE_ENV==="production"?ni.exports=K2():ni.exports=eh();var u=ni.exports,Wr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cr=typeof window>"u"||"Deno"in globalThis;function Rt(){}function th(e,t){return typeof e=="function"?e(t):e}function ri(e){return typeof e=="number"&&e>=0&&e!==1/0}function Wl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zr(e,t){return typeof e=="function"?e(t):e}function Zt(e,t){return typeof e=="function"?e(t):e}function Zl(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:a,stale:i}=e;if(a){if(r){if(t.queryHash!==oi(a,t.options))return!1}else if(!Oo(t.queryKey,a))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||s&&!s(t))}function zl(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(lr(t.options.mutationKey)!==lr(s))return!1}else if(!Oo(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function oi(e,t){return((t==null?void 0:t.queryKeyHashFn)||lr)(e)}function lr(e){return JSON.stringify(e,(t,n)=>ai(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Oo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Oo(e[n],t[n])):!1}function si(e,t){if(e===t)return e;const n=Xl(e)&&Xl(t);if(n||ai(e)&&ai(t)){const r=n?e:Object.keys(e),o=r.length,s=n?t:Object.keys(t),a=s.length,i=n?[]:{};let c=0;for(let d=0;d<a;d++){const f=n?d:s[d];(!n&&r.includes(f)||n)&&e[f]===void 0&&t[f]===void 0?(i[f]=void 0,c++):(i[f]=si(e[f],t[f]),i[f]===e[f]&&e[f]!==void 0&&c++)}return o===a&&c===o?e:i}return t}function xs(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Xl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ai(e){if(!Yl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Yl(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Yl(e){return Object.prototype.toString.call(e)==="[object Object]"}function nh(e){return new Promise(t=>{setTimeout(t,e)})}function ii(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return si(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return si(e,t)}return t}function rh(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function oh(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Cs=Symbol();function Jl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Cs&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Cs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var sh=(G2=class extends Wr{constructor(){super();ue(this,Ar);ue(this,Zn);ue(this,fo);K(this,fo,t=>{if(!cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){k(this,Zn)||this.setEventListener(k(this,fo))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,Zn))==null||t.call(this),K(this,Zn,void 0))}setEventListener(t){var n;K(this,fo,t),(n=k(this,Zn))==null||n.call(this),K(this,Zn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){k(this,Ar)!==t&&(K(this,Ar,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof k(this,Ar)=="boolean"?k(this,Ar):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ar=new WeakMap,Zn=new WeakMap,fo=new WeakMap,G2),ci=new sh,ah=(H2=class extends Wr{constructor(){super();ue(this,po,!0);ue(this,zn);ue(this,ho);K(this,ho,t=>{if(!cr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){k(this,zn)||this.setEventListener(k(this,ho))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,zn))==null||t.call(this),K(this,zn,void 0))}setEventListener(t){var n;K(this,ho,t),(n=k(this,zn))==null||n.call(this),K(this,zn,t(this.setOnline.bind(this)))}setOnline(t){k(this,po)!==t&&(K(this,po,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return k(this,po)}},po=new WeakMap,zn=new WeakMap,ho=new WeakMap,H2),Es=new ah;function li(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function ih(e){return Math.min(1e3*2**e,3e4)}function ql(e){return(e??"online")==="online"?Es.isOnline():!0}var Ql=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ui(e){return e instanceof Ql}function $l(e){let t=!1,n=0,r=!1,o;const s=li(),a=h=>{var p;r||(y(new Ql(h)),(p=e.abort)==null||p.call(e))},i=()=>{t=!0},c=()=>{t=!1},d=()=>ci.isFocused()&&(e.networkMode==="always"||Es.isOnline())&&e.canRun(),f=()=>ql(e.networkMode)&&e.canRun(),g=h=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,h),o==null||o(),s.resolve(h))},y=h=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,h),o==null||o(),s.reject(h))},E=()=>new Promise(h=>{var p;o=m=>{(r||d())&&h(m)},(p=e.onPause)==null||p.call(e)}).then(()=>{var h;o=void 0,r||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(r)return;let h;const p=n===0?e.initialPromise:void 0;try{h=p??e.fn()}catch(m){h=Promise.reject(m)}Promise.resolve(h).then(g).catch(m=>{var _;if(r)return;const x=e.retry??(cr?0:3),C=e.retryDelay??ih,w=typeof C=="function"?C(n,m):C,v=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,m);if(t||!v){y(m);return}n++,(_=e.onFail)==null||_.call(e,n,m),nh(w).then(()=>d()?void 0:E()).then(()=>{t?y(m):b()})})};return{promise:s,cancel:a,continue:()=>(o==null||o(),s),cancelRetry:i,continueRetry:c,canStart:f,start:()=>(f()?b():E().then(b),s)}}function ch(){let e=[],t=0,n=i=>{i()},r=i=>{i()},o=i=>setTimeout(i,0);const s=i=>{t?e.push(i):o(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&o(()=>{r(()=>{i.forEach(c=>{n(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||a()}return c},batchCalls:i=>(...c)=>{s(()=>{i(...c)})},schedule:s,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{o=i}}}var et=ch(),Ul=(W2=class{constructor(){ue(this,Lr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ri(this.gcTime)&&K(this,Lr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cr?1/0:5*60*1e3))}clearGcTimeout(){k(this,Lr)&&(clearTimeout(k(this,Lr)),K(this,Lr,void 0))}},Lr=new WeakMap,W2),lh=(Z2=class extends Ul{constructor(t){super();ue(this,tn);ue(this,go);ue(this,mo);ue(this,jt);ue(this,Or);ue(this,dt);ue(this,us);ue(this,kr);K(this,kr,!1),K(this,us,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,Or,t.client),K(this,jt,k(this,Or).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,go,uh(this.options)),this.state=t.state??k(this,go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=k(this,dt))==null?void 0:t.promise}setOptions(t){this.options={...k(this,us),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&k(this,jt).remove(this)}setData(t,n){const r=ii(this.state.data,t,this.options);return ye(this,tn,Dn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ye(this,tn,Dn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=k(this,dt))==null?void 0:r.promise;return(o=k(this,dt))==null||o.cancel(t),n?n.then(Rt).catch(Rt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(k(this,go))}isActive(){return this.observers.some(t=>Zt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cs||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Wl(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,dt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,dt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),k(this,jt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(k(this,dt)&&(k(this,kr)?k(this,dt).cancel({revert:!0}):k(this,dt).cancelRetry()),this.scheduleGc()),k(this,jt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ye(this,tn,Dn).call(this,{type:"invalidate"})}fetch(t,n){var c,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(k(this,dt))return k(this,dt).continueRetry(),k(this,dt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const g=this.observers.find(y=>y.options.queryFn);g&&this.setOptions(g.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(K(this,kr,!0),r.signal)})},s=()=>{const g=Jl(this.options,n),y={client:k(this,Or),queryKey:this.queryKey,meta:this.meta};return o(y),K(this,kr,!1),this.options.persister?this.options.persister(g,y,this):g(y)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:k(this,Or),state:this.state,fetchFn:s};o(a),(c=this.options.behavior)==null||c.onFetch(a,this),K(this,mo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&ye(this,tn,Dn).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const i=g=>{var y,E,b,h;ui(g)&&g.silent||ye(this,tn,Dn).call(this,{type:"error",error:g}),ui(g)||((E=(y=k(this,jt).config).onError)==null||E.call(y,g,this),(h=(b=k(this,jt).config).onSettled)==null||h.call(b,this.state.data,g,this)),this.scheduleGc()};return K(this,dt,$l({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var y,E,b,h;if(g===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),i(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(g)}catch(p){i(p);return}(E=(y=k(this,jt).config).onSuccess)==null||E.call(y,g,this),(h=(b=k(this,jt).config).onSettled)==null||h.call(b,g,this.state.error,this),this.scheduleGc()},onError:i,onFail:(g,y)=>{ye(this,tn,Dn).call(this,{type:"failed",failureCount:g,error:y})},onPause:()=>{ye(this,tn,Dn).call(this,{type:"pause"})},onContinue:()=>{ye(this,tn,Dn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),k(this,dt).start()}},go=new WeakMap,mo=new WeakMap,jt=new WeakMap,Or=new WeakMap,dt=new WeakMap,us=new WeakMap,kr=new WeakMap,tn=new WeakSet,Dn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Kl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return ui(o)&&o.revert&&k(this,mo)?{...k(this,mo),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),et.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),k(this,jt).notify({query:this,type:"updated",action:t})})},Z2);function Kl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ql(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function uh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var dh=(z2=class extends Wr{constructor(t={}){super();ue(this,gn);this.config=t,K(this,gn,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??oi(o,n);let a=this.get(s);return a||(a=new lh({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){k(this,gn).has(t.queryHash)||(k(this,gn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=k(this,gn).get(t.queryHash);n&&(t.destroy(),n===t&&k(this,gn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return k(this,gn).get(t)}getAll(){return[...k(this,gn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Zl(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Zl(t,r)):n}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},gn=new WeakMap,z2),fh=(X2=class extends Ul{constructor(t){super();ue(this,bn);ue(this,mn);ue(this,pt);ue(this,Fr);this.mutationId=t.mutationId,K(this,pt,t.mutationCache),K(this,mn,[]),this.state=t.state||eu(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){k(this,mn).includes(t)||(k(this,mn).push(t),this.clearGcTimeout(),k(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,mn,k(this,mn).filter(n=>n!==t)),this.scheduleGc(),k(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){k(this,mn).length||(this.state.status==="pending"?this.scheduleGc():k(this,pt).remove(this))}continue(){var t;return((t=k(this,Fr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,s,a,i,c,d,f,g,y,E,b,h,p,m,x,C,w,v,_,T;K(this,Fr,$l({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(S,L)=>{ye(this,bn,ir).call(this,{type:"failed",failureCount:S,error:L})},onPause:()=>{ye(this,bn,ir).call(this,{type:"pause"})},onContinue:()=>{ye(this,bn,ir).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>k(this,pt).canRun(this)}));const n=this.state.status==="pending",r=!k(this,Fr).canStart();try{if(!n){ye(this,bn,ir).call(this,{type:"pending",variables:t,isPaused:r}),await((s=(o=k(this,pt).config).onMutate)==null?void 0:s.call(o,t,this));const L=await((i=(a=this.options).onMutate)==null?void 0:i.call(a,t));L!==this.state.context&&ye(this,bn,ir).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const S=await k(this,Fr).start();return await((d=(c=k(this,pt).config).onSuccess)==null?void 0:d.call(c,S,t,this.state.context,this)),await((g=(f=this.options).onSuccess)==null?void 0:g.call(f,S,t,this.state.context)),await((E=(y=k(this,pt).config).onSettled)==null?void 0:E.call(y,S,null,this.state.variables,this.state.context,this)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,S,null,t,this.state.context)),ye(this,bn,ir).call(this,{type:"success",data:S}),S}catch(S){try{throw await((m=(p=k(this,pt).config).onError)==null?void 0:m.call(p,S,t,this.state.context,this)),await((C=(x=this.options).onError)==null?void 0:C.call(x,S,t,this.state.context)),await((v=(w=k(this,pt).config).onSettled)==null?void 0:v.call(w,void 0,S,this.state.variables,this.state.context,this)),await((T=(_=this.options).onSettled)==null?void 0:T.call(_,void 0,S,t,this.state.context)),S}finally{ye(this,bn,ir).call(this,{type:"error",error:S})}}finally{k(this,pt).runNext(this)}}},mn=new WeakMap,pt=new WeakMap,Fr=new WeakMap,bn=new WeakSet,ir=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),et.batch(()=>{k(this,mn).forEach(r=>{r.onMutationUpdate(t)}),k(this,pt).notify({mutation:this,type:"updated",action:t})})},X2);function eu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ph=(Y2=class extends Wr{constructor(t={}){super();ue(this,Sn);ue(this,nn);ue(this,ds);this.config=t,K(this,Sn,new Set),K(this,nn,new Map),K(this,ds,0)}build(t,n,r){const o=new fh({mutationCache:this,mutationId:++Ka(this,ds)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){k(this,Sn).add(t);const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n);r?r.push(t):k(this,nn).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(k(this,Sn).delete(t)){const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&k(this,nn).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vs(t);if(typeof n=="string"){const r=k(this,nn).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=vs(t);if(typeof n=="string"){const o=(r=k(this,nn).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{k(this,Sn).forEach(t=>{this.notify({type:"removed",mutation:t})}),k(this,Sn).clear(),k(this,nn).clear()})}getAll(){return Array.from(k(this,Sn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>zl(n,r))}findAll(t={}){return this.getAll().filter(n=>zl(t,n))}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return et.batch(()=>Promise.all(t.map(n=>n.continue().catch(Rt))))}},Sn=new WeakMap,nn=new WeakMap,ds=new WeakMap,Y2);function vs(e){var t;return(t=e.options.scope)==null?void 0:t.id}function ws(e){return{onFetch:(t,n)=>{var f,g,y,E,b;const r=t.options,o=(y=(g=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:g.fetchMore)==null?void 0:y.direction,s=((E=t.state.data)==null?void 0:E.pages)||[],a=((b=t.state.data)==null?void 0:b.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const p=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?h=!0:t.signal.addEventListener("abort",()=>{h=!0}),t.signal)})},m=Jl(t.options,t.fetchOptions),x=async(C,w,v)=>{if(h)return Promise.reject();if(w==null&&C.pages.length)return Promise.resolve(C);const _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:v?"backward":"forward",meta:t.options.meta};p(_);const T=await m(_),{maxPages:S}=t.options,L=v?oh:rh;return{pages:L(C.pages,T,S),pageParams:L(C.pageParams,w,S)}};if(o&&s.length){const C=o==="backward",w=C?tu:di,v={pages:s,pageParams:a},_=w(r,v);i=await x(v,_,C)}else{const C=e??s.length;do{const w=c===0?a[0]??r.initialPageParam:di(r,i);if(c>0&&w==null)break;i=await x(i,w),c++}while(c<C)}return i};t.options.persister?t.fetchFn=()=>{var h,p;return(p=(h=t.options).persister)==null?void 0:p.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function di(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function tu(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function hh(e,t){return t?di(e,t)!=null:!1}function gh(e,t){return!t||!e.getPreviousPageParam?!1:tu(e,t)!=null}var mh=(J2=class{constructor(e={}){ue(this,Xe);ue(this,Xn);ue(this,Yn);ue(this,bo);ue(this,yo);ue(this,Jn);ue(this,xo);ue(this,Co);K(this,Xe,e.queryCache||new dh),K(this,Xn,e.mutationCache||new ph),K(this,Yn,e.defaultOptions||{}),K(this,bo,new Map),K(this,yo,new Map),K(this,Jn,0)}mount(){Ka(this,Jn)._++,k(this,Jn)===1&&(K(this,xo,ci.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,Xe).onFocus())})),K(this,Co,Es.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,Xe).onOnline())})))}unmount(){var e,t;Ka(this,Jn)._--,k(this,Jn)===0&&((e=k(this,xo))==null||e.call(this),K(this,xo,void 0),(t=k(this,Co))==null||t.call(this),K(this,Co,void 0))}isFetching(e){return k(this,Xe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return k(this,Xn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,Xe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=k(this,Xe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Zr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return k(this,Xe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=k(this,Xe).get(r.queryHash),s=o==null?void 0:o.state.data,a=th(t,s);if(a!==void 0)return k(this,Xe).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return et.batch(()=>k(this,Xe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,Xe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=k(this,Xe);et.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=k(this,Xe);return et.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=et.batch(()=>k(this,Xe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Rt).catch(Rt)}invalidateQueries(e,t={}){return et.batch(()=>(k(this,Xe).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=et.batch(()=>k(this,Xe).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Rt)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Rt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=k(this,Xe).build(this,t);return n.isStaleByTime(Zr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rt).catch(Rt)}fetchInfiniteQuery(e){return e.behavior=ws(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rt).catch(Rt)}ensureInfiniteQueryData(e){return e.behavior=ws(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Es.isOnline()?k(this,Xn).resumePausedMutations():Promise.resolve()}getQueryCache(){return k(this,Xe)}getMutationCache(){return k(this,Xn)}getDefaultOptions(){return k(this,Yn)}setDefaultOptions(e){K(this,Yn,e)}setQueryDefaults(e,t){k(this,bo).set(lr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...k(this,bo).values()],n={};return t.forEach(r=>{Oo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){k(this,yo).set(lr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...k(this,yo).values()],n={};return t.forEach(r=>{Oo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...k(this,Yn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=oi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Cs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...k(this,Yn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){k(this,Xe).clear(),k(this,Xn).clear()}},Xe=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,bo=new WeakMap,yo=new WeakMap,Jn=new WeakMap,xo=new WeakMap,Co=new WeakMap,J2),nu=(q2=class extends Wr{constructor(t,n){super();ue(this,Me);ue(this,It);ue(this,Se);ue(this,fs);ue(this,ht);ue(this,Dr);ue(this,Eo);ue(this,qn);ue(this,yn);ue(this,ps);ue(this,vo);ue(this,wo);ue(this,Nr);ue(this,Rr);ue(this,Qn);ue(this,Io,new Set);this.options=n,K(this,It,t),K(this,yn,null),K(this,qn,li()),this.options.experimental_prefetchInRender||k(this,qn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(k(this,Se).addObserver(this),ru(k(this,Se),this.options)?ye(this,Me,bs).call(this):this.updateResult(),ye(this,Me,Ml).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fi(k(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fi(k(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ye(this,Me,Pl).call(this),ye(this,Me,jl).call(this),k(this,Se).removeObserver(this)}setOptions(t,n){const r=this.options,o=k(this,Se);if(this.options=k(this,It).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zt(this.options.enabled,k(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ye(this,Me,Bl).call(this),k(this,Se).setOptions(this.options),r._defaulted&&!xs(this.options,r)&&k(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:k(this,Se),observer:this});const s=this.hasListeners();s&&ou(k(this,Se),o,this.options,r)&&ye(this,Me,bs).call(this),this.updateResult(n),s&&(k(this,Se)!==o||Zt(this.options.enabled,k(this,Se))!==Zt(r.enabled,k(this,Se))||Zr(this.options.staleTime,k(this,Se))!==Zr(r.staleTime,k(this,Se)))&&ye(this,Me,Dl).call(this);const a=ye(this,Me,Nl).call(this);s&&(k(this,Se)!==o||Zt(this.options.enabled,k(this,Se))!==Zt(r.enabled,k(this,Se))||a!==k(this,Qn))&&ye(this,Me,Rl).call(this,a)}getOptimisticResult(t){const n=k(this,It).getQueryCache().build(k(this,It),t),r=this.createResult(n,t);return yh(this,r)&&(K(this,ht,r),K(this,Eo,this.options),K(this,Dr,k(this,Se).state)),r}getCurrentResult(){return k(this,ht)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){k(this,Io).add(t)}getCurrentQuery(){return k(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=k(this,It).defaultQueryOptions(t),r=k(this,It).getQueryCache().build(k(this,It),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ye(this,Me,bs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),k(this,ht)))}createResult(t,n){var S;const r=k(this,Se),o=this.options,s=k(this,ht),a=k(this,Dr),i=k(this,Eo),d=t!==r?t.state:k(this,fs),{state:f}=t;let g={...f},y=!1,E;if(n._optimisticResults){const L=this.hasListeners(),R=!L&&ru(t,n),D=L&&ou(t,r,n,o);(R||D)&&(g={...g,...Kl(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:p}=g;if(n.select&&g.data!==void 0)if(s&&g.data===(a==null?void 0:a.data)&&n.select===k(this,ps))E=k(this,vo);else try{K(this,ps,n.select),E=n.select(g.data),E=ii(s==null?void 0:s.data,E,n),K(this,vo,E),K(this,yn,null)}catch(L){K(this,yn,L)}else E=g.data;if(n.placeholderData!==void 0&&E===void 0&&p==="pending"){let L;if(s!=null&&s.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData))L=s.data;else if(L=typeof n.placeholderData=="function"?n.placeholderData((S=k(this,wo))==null?void 0:S.state.data,k(this,wo)):n.placeholderData,n.select&&L!==void 0)try{L=n.select(L),K(this,yn,null)}catch(R){K(this,yn,R)}L!==void 0&&(p="success",E=ii(s==null?void 0:s.data,L,n),y=!0)}k(this,yn)&&(b=k(this,yn),E=k(this,vo),h=Date.now(),p="error");const m=g.fetchStatus==="fetching",x=p==="pending",C=p==="error",w=x&&m,v=E!==void 0,T={status:p,fetchStatus:g.fetchStatus,isPending:x,isSuccess:p==="success",isError:C,isInitialLoading:w,isLoading:w,data:E,dataUpdatedAt:g.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:m,isRefetching:m&&!x,isLoadingError:C&&!v,isPaused:g.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:C&&v,isStale:pi(t,n),refetch:this.refetch,promise:k(this,qn)};if(this.options.experimental_prefetchInRender){const L=F=>{T.status==="error"?F.reject(T.error):T.data!==void 0&&F.resolve(T.data)},R=()=>{const F=K(this,qn,T.promise=li());L(F)},D=k(this,qn);switch(D.status){case"pending":t.queryHash===r.queryHash&&L(D);break;case"fulfilled":(T.status==="error"||T.data!==D.value)&&R();break;case"rejected":(T.status!=="error"||T.error!==D.reason)&&R();break}}return T}updateResult(t){const n=k(this,ht),r=this.createResult(k(this,Se),this.options);if(K(this,Dr,k(this,Se).state),K(this,Eo,this.options),k(this,Dr).data!==void 0&&K(this,wo,k(this,Se)),xs(r,n))return;K(this,ht,r);const o={},s=()=>{if(!n)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!k(this,Io).size)return!0;const c=new Set(i??k(this,Io));return this.options.throwOnError&&c.add("error"),Object.keys(k(this,ht)).some(d=>{const f=d;return k(this,ht)[f]!==n[f]&&c.has(f)})};(t==null?void 0:t.listeners)!==!1&&s()&&(o.listeners=!0),ye(this,Me,U2).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ye(this,Me,Ml).call(this)}},It=new WeakMap,Se=new WeakMap,fs=new WeakMap,ht=new WeakMap,Dr=new WeakMap,Eo=new WeakMap,qn=new WeakMap,yn=new WeakMap,ps=new WeakMap,vo=new WeakMap,wo=new WeakMap,Nr=new WeakMap,Rr=new WeakMap,Qn=new WeakMap,Io=new WeakMap,Me=new WeakSet,bs=function(t){ye(this,Me,Bl).call(this);let n=k(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Rt)),n},Dl=function(){ye(this,Me,Pl).call(this);const t=Zr(this.options.staleTime,k(this,Se));if(cr||k(this,ht).isStale||!ri(t))return;const r=Wl(k(this,ht).dataUpdatedAt,t)+1;K(this,Nr,setTimeout(()=>{k(this,ht).isStale||this.updateResult()},r))},Nl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(k(this,Se)):this.options.refetchInterval)??!1},Rl=function(t){ye(this,Me,jl).call(this),K(this,Qn,t),!(cr||Zt(this.options.enabled,k(this,Se))===!1||!ri(k(this,Qn))||k(this,Qn)===0)&&K(this,Rr,setInterval(()=>{(this.options.refetchIntervalInBackground||ci.isFocused())&&ye(this,Me,bs).call(this)},k(this,Qn)))},Ml=function(){ye(this,Me,Dl).call(this),ye(this,Me,Rl).call(this,ye(this,Me,Nl).call(this))},Pl=function(){k(this,Nr)&&(clearTimeout(k(this,Nr)),K(this,Nr,void 0))},jl=function(){k(this,Rr)&&(clearInterval(k(this,Rr)),K(this,Rr,void 0))},Bl=function(){const t=k(this,It).getQueryCache().build(k(this,It),this.options);if(t===k(this,Se))return;const n=k(this,Se);K(this,Se,t),K(this,fs,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},U2=function(t){et.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(k(this,ht))}),k(this,It).getQueryCache().notify({query:k(this,Se),type:"observerResultsUpdated"})})},q2);function bh(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ru(e,t){return bh(e,t)||e.state.data!==void 0&&fi(e,t,t.refetchOnMount)}function fi(e,t,n){if(Zt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&pi(e,t)}return!1}function ou(e,t,n,r){return(e!==t||Zt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&pi(e,n)}function pi(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(Zr(t.staleTime,e))}function yh(e,t){return!xs(e.getCurrentResult(),t)}var xh=class extends nu{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:ws()},t)}getOptimisticResult(e){return e.behavior=ws(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,h;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:a,isRefetchError:i}=r,c=(h=(b=n.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:h.direction,d=a&&c==="forward",f=o&&c==="forward",g=a&&c==="backward",y=o&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hh(t,n.data),hasPreviousPage:gh(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:g,isFetchingPreviousPage:y,isRefetchError:i&&!d&&!g,isRefetching:s&&!f&&!y}}},Ch=(Q2=class extends Wr{constructor(n,r){super();ue(this,An);ue(this,$n);ue(this,Un);ue(this,_t);ue(this,Tn);K(this,$n,n),this.setOptions(r),this.bindMethods(),ye(this,An,ei).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=k(this,$n).defaultMutationOptions(n),xs(this.options,r)||k(this,$n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:k(this,_t),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&lr(r.mutationKey)!==lr(this.options.mutationKey)?this.reset():((o=k(this,_t))==null?void 0:o.state.status)==="pending"&&k(this,_t).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=k(this,_t))==null||n.removeObserver(this)}onMutationUpdate(n){ye(this,An,ei).call(this),ye(this,An,Vl).call(this,n)}getCurrentResult(){return k(this,Un)}reset(){var n;(n=k(this,_t))==null||n.removeObserver(this),K(this,_t,void 0),ye(this,An,ei).call(this),ye(this,An,Vl).call(this)}mutate(n,r){var o;return K(this,Tn,r),(o=k(this,_t))==null||o.removeObserver(this),K(this,_t,k(this,$n).getMutationCache().build(k(this,$n),this.options)),k(this,_t).addObserver(this),k(this,_t).execute(n)}},$n=new WeakMap,Un=new WeakMap,_t=new WeakMap,Tn=new WeakMap,An=new WeakSet,ei=function(){var r;const n=((r=k(this,_t))==null?void 0:r.state)??eu();K(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(n){et.batch(()=>{var r,o,s,a,i,c,d,f;if(k(this,Tn)&&this.hasListeners()){const g=k(this,Un).variables,y=k(this,Un).context;(n==null?void 0:n.type)==="success"?((o=(r=k(this,Tn)).onSuccess)==null||o.call(r,n.data,g,y),(a=(s=k(this,Tn)).onSettled)==null||a.call(s,n.data,null,g,y)):(n==null?void 0:n.type)==="error"&&((c=(i=k(this,Tn)).onError)==null||c.call(i,n.error,g,y),(f=(d=k(this,Tn)).onSettled)==null||f.call(d,void 0,n.error,g,y))}this.listeners.forEach(g=>{g(k(this,Un))})})},Q2),su=A.createContext(void 0),ur=e=>{const t=A.useContext(su);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Eh=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(su.Provider,{value:e,children:t})),au=A.createContext(!1),vh=()=>A.useContext(au);au.Provider;function wh(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ih=A.createContext(wh()),_h=()=>A.useContext(Ih);function iu(e,t){return typeof e=="function"?e(...t):!!e}function hi(){}var Sh=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Th=e=>{A.useEffect(()=>{e.clearReset()},[e])},Ah=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||iu(n,[e.error,r])),Lh=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Oh=(e,t)=>e.isLoading&&e.isFetching&&!t,kh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,cu=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lu(e,t,n){var g,y,E,b,h;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=ur(),o=vh(),s=_h(),a=r.defaultQueryOptions(e);(y=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||y.call(g,a),process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=o?"isRestoring":"optimistic",Lh(a),Sh(a,s),Th(s);const i=!r.getQueryCache().get(a.queryHash),[c]=A.useState(()=>new t(r,a)),d=c.getOptimisticResult(a),f=!o&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(p=>{const m=f?c.subscribe(et.batchCalls(p)):hi;return c.updateResult(),m},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),A.useEffect(()=>{c.setOptions(a,{listeners:!1})},[a,c]),kh(a,d))throw cu(a,c,s);if(Ah({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;if((b=(E=r.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||b.call(E,a,d),a.experimental_prefetchInRender&&!cr&&Oh(d,o)){const p=i?cu(a,c,s):(h=r.getQueryCache().get(a.queryHash))==null?void 0:h.promise;p==null||p.catch(hi).finally(()=>{c.updateResult()})}return a.notifyOnChangeProps?d:c.trackResult(d)}function zt(e,t){return lu(e,nu)}function Xt(e,t){const n=ur(),[r]=A.useState(()=>new Ch(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);const o=A.useSyncExternalStore(A.useCallback(a=>r.subscribe(et.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=A.useCallback((a,i)=>{r.mutate(a,i).catch(hi)},[r]);if(o.error&&iu(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}function Fh(e,t){return lu(e,xh)}const gi=(e,t)=>t.some(n=>e instanceof n);let uu,du;function Dh(){return uu||(uu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Nh(){return du||(du=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const mi=new WeakMap,bi=new WeakMap,Is=new WeakMap;function Rh(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",s),e.removeEventListener("error",a)},s=()=>{n(dr(e.result)),o()},a=()=>{r(e.error),o()};e.addEventListener("success",s),e.addEventListener("error",a)});return Is.set(t,e),t}function Mh(e){if(mi.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",a),e.removeEventListener("abort",a)},s=()=>{n(),o()},a=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",s),e.addEventListener("error",a),e.addEventListener("abort",a)});mi.set(e,t)}let yi={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return mi.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return dr(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function fu(e){yi=e(yi)}function Ph(e){return Nh().includes(e)?function(...t){return e.apply(xi(this),t),dr(this.request)}:function(...t){return dr(e.apply(xi(this),t))}}function jh(e){return typeof e=="function"?Ph(e):(e instanceof IDBTransaction&&Mh(e),gi(e,Dh())?new Proxy(e,yi):e)}function dr(e){if(e instanceof IDBRequest)return Rh(e);if(bi.has(e))return bi.get(e);const t=jh(e);return t!==e&&(bi.set(e,t),Is.set(t,e)),t}const xi=e=>Is.get(e);function Bh(e,t,{blocked:n,upgrade:r,blocking:o,terminated:s}={}){const a=indexedDB.open(e,t),i=dr(a);return r&&a.addEventListener("upgradeneeded",c=>{r(dr(a.result),c.oldVersion,c.newVersion,dr(a.transaction),c)}),n&&a.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),i.then(c=>{s&&c.addEventListener("close",()=>s()),o&&c.addEventListener("versionchange",d=>o(d.oldVersion,d.newVersion,d))}).catch(()=>{}),i}const Vh=["get","getKey","getAll","getAllKeys","count"],Gh=["put","add","delete","clear"],Ci=new Map;function pu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ci.get(t))return Ci.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=Gh.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||Vh.includes(n)))return;const s=async function(a,...i){const c=this.transaction(a,o?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(i.shift())),(await Promise.all([d[n](...i),o&&c.done]))[0]};return Ci.set(t,s),s}fu(e=>({...e,get:(t,n,r)=>pu(t,n)||e.get(t,n,r),has:(t,n)=>!!pu(t,n)||e.has(t,n)}));const Hh=["continue","continuePrimaryKey","advance"],hu={},Ei=new WeakMap,gu=new WeakMap,Wh={get(e,t){if(!Hh.includes(t))return e[t];let n=hu[t];return n||(n=hu[t]=function(...r){Ei.set(this,gu.get(this)[t](...r))}),n}};async function*Zh(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,Wh);for(gu.set(n,t),Is.set(n,xi(t));t;)yield n,t=await(Ei.get(n)||t.continue()),Ei.delete(n)}function mu(e,t){return t===Symbol.asyncIterator&&gi(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&gi(e,[IDBIndex,IDBObjectStore])}fu(e=>({...e,get(t,n,r){return mu(t,n)?Zh:e.get(t,n,r)},has(t,n){return mu(t,n)||e.has(t,n)}}));const zh="connector-db",Xh=1,_s={FEEDBACK:"feedback"},ko=`${_s.FEEDBACK}:data`,Ss=`${_s.FEEDBACK}:last_submitted`,Fo=`${_s.FEEDBACK}:capture_on_demand`,Do=`${_s.FEEDBACK}:show_notification`,Yh=12*60*60*1e3,vi=(e,t=new Date)=>e?Math.abs(t.getTime()-e.getTime())>=Yh:!0,bu=(e,t=!1)=>e.captureFeedback&&(vi(e.firstViewed)&&(!e.lastSubmittedFeedback||vi(e.lastSubmittedFeedback))||!!t);let fr=null;const Nn=async()=>{try{fr||(fr=await Bh(zh,Xh,{upgrade(e){e.objectStoreNames.contains(ko)||e.createObjectStore(ko),e.objectStoreNames.contains(Ss)||e.createObjectStore(Ss),e.objectStoreNames.contains(Fo)||e.createObjectStore(Fo),e.objectStoreNames.contains(Do)||e.createObjectStore(Do)},blocked(){console.warn("Upgrade blocked! Close other tabs using this DB.")},blocking(){console.warn("Another tab is trying to upgrade. Closing connection to allow upgrade."),fr&&(fr.close(),fr=null)},terminated(){console.error("DB connection unexpectedly closed. Resetting connection."),fr=null}}))}catch(e){console.error("Error opening IndexedDB connection:",e)}return fr},wi=async e=>{if(!e)return[];const t=await Nn();if(!t)return[];try{return await t.get(ko,e)||[]}catch(n){return console.error("Error fetching user feedback data:",n),[]}},Jh=async e=>{if(!e)return null;const t=await Nn();if(!t)return null;try{return await t.get(Ss,e)||null}catch(n){return console.error("Error fetching last submitted feedback:",n),null}},Ts=async e=>{if(!e)return;const t=await Nn();if(t)try{return await t.get(Fo,e)}catch(n){console.error("Error fetching capture on demand status:",n);return}},qh=async e=>{if(!e)return!1;const t=await Nn();if(!t)return!1;try{return await t.get(Do,e)??!1}catch(n){return console.error("Error fetching show notification status:",n),!1}},Qh=async(e,t)=>{if(!e||!t||!t.length)return;const n=await Nn();if(n)try{const r=await wi(e),o=new Set(r.map(a=>a.connectorId)),s=t.filter(a=>!o.has(a.connector_id)).map(a=>({connectorId:a.connector_id,captureFeedback:!0,firstViewed:new Date}));if(s.length>0){const a=[...r,...s];await n.put(ko,a,e),await n.put(Do,!0,e)}}catch(r){console.error("Error updating connectors feedback data:",r)}},$h=async e=>{if(!e)return;const t=await Nn();if(t)try{const n=await wi(e),r=await Ts(e),o=new Date,s=n.map(a=>{const i=bu(a,r);return{...a,lastSubmittedFeedback:i?o:a.lastSubmittedFeedback,captureFeedback:a.captureFeedback!==i}});await t.put(ko,s,e),await t.put(Ss,o,e),r&&await t.put(Fo,!1,e)}catch(n){console.error("Error updating feedback submission date:",n)}},yu=async(e,t)=>{if(!e)return;const n=await Nn();if(n)try{await n.put(Fo,t,e)}catch(r){console.error("Error updating capture on demand:",r)}},Uh=async e=>{if(!e)return;const t=await Nn();if(t)try{await t.put(Do,!1,e)}catch(n){console.error("Error resetting show notification status:",n)}},Kh=async e=>{const t=await wi(e),n=await Ts(e);return t.filter(o=>bu(o,n))},Ii=async e=>{const t=await Jh(e);return t&&!vi(t)?!1:await Ts(e)&&!t?!0:!!(await Kh(e)).length},eg=async(e,t)=>{await Qh(e,t)},As=async e=>{e&&await $h(e)},tg=async(e,t)=>{const n=await Ts(e);t?n!==!1&&await yu(e,t):await yu(e,void 0)},xu=async e=>await qh(e)&&await Ii(e),Cu=async e=>{await Uh(e)};var _i={},pr={};function Eu(e,t){return function(){return e.apply(t,arguments)}}const{toString:ng}=Object.prototype,{getPrototypeOf:Si}=Object,Ls=(e=>t=>{const n=ng.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Yt=e=>(e=e.toLowerCase(),t=>Ls(t)===e),Os=e=>t=>typeof t===e,{isArray:zr}=Array,No=Os("undefined");function rg(e){return e!==null&&!No(e)&&e.constructor!==null&&!No(e.constructor)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vu=Yt("ArrayBuffer");function og(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&vu(e.buffer),t}const sg=Os("string"),Tt=Os("function"),wu=Os("number"),ks=e=>e!==null&&typeof e=="object",ag=e=>e===!0||e===!1,Fs=e=>{if(Ls(e)!=="object")return!1;const t=Si(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ig=Yt("Date"),cg=Yt("File"),lg=Yt("Blob"),ug=Yt("FileList"),dg=e=>ks(e)&&Tt(e.pipe),fg=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Tt(e.append)&&((t=Ls(e))==="formdata"||t==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"))},pg=Yt("URLSearchParams"),[hg,gg,mg,bg]=["ReadableStream","Request","Response","Headers"].map(Yt),yg=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ro(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),zr(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),a=s.length;let i;for(r=0;r<a;r++)i=s[r],t.call(null,e[i],i,e)}}function Iu(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,o;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const hr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:he,_u=e=>!No(e)&&e!==hr;function Ti(){const{caseless:e}=_u(this)&&this||{},t={},n=(r,o)=>{const s=e&&Iu(t,o)||o;Fs(t[s])&&Fs(r)?t[s]=Ti(t[s],r):Fs(r)?t[s]=Ti({},r):zr(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Ro(arguments[r],n);return t}const xg=(e,t,n,{allOwnKeys:r}={})=>(Ro(t,(o,s)=>{n&&Tt(o)?e[s]=Eu(o,n):e[s]=o},{allOwnKeys:r}),e),Cg=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Eg=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},vg=(e,t,n,r)=>{let o,s,a;const i={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],(!r||r(a,e,t))&&!i[a]&&(t[a]=e[a],i[a]=!0);e=n!==!1&&Si(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},wg=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Ig=e=>{if(!e)return null;if(zr(e))return e;let t=e.length;if(!wu(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},_g=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Si(Uint8Array)),Sg=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},Tg=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ag=Yt("HTMLFormElement"),Lg=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Su=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Og=Yt("RegExp"),Tu=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ro(n,(o,s)=>{let a;(a=t(o,s,e))!==!1&&(r[s]=a||o)}),Object.defineProperties(e,r)},kg=e=>{Tu(e,(t,n)=>{if(Tt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Tt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Fg=(e,t)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return zr(e)?r(e):r(String(e).split(t)),n},Dg=()=>{},Ng=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Ai="abcdefghijklmnopqrstuvwxyz",Au="0123456789",Lu={DIGIT:Au,ALPHA:Ai,ALPHA_DIGIT:Ai+Ai.toUpperCase()+Au},Rg=(e=16,t=Lu.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Mg(e){return!!(e&&Tt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Pg=e=>{const t=new Array(10),n=(r,o)=>{if(ks(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const s=zr(r)?[]:{};return Ro(r,(a,i)=>{const c=n(a,o+1);!No(c)&&(s[i]=c)}),t[o]=void 0,s}}return r};return n(e,0)},jg=Yt("AsyncFunction"),Bg=e=>e&&(ks(e)||Tt(e))&&Tt(e.then)&&Tt(e.catch),Ou=((e,t)=>e?setImmediate:t?((n,r)=>(hr.addEventListener("message",({source:o,data:s})=>{o===hr&&s===n&&r.length&&r.shift()()},!1),o=>{r.push(o),hr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Tt(hr.postMessage)),Vg=typeof queueMicrotask<"u"?queueMicrotask.bind(hr):typeof process<"u"&&process.nextTick||Ou;var j={isArray:zr,isArrayBuffer:vu,isBuffer:rg,isFormData:fg,isArrayBufferView:og,isString:sg,isNumber:wu,isBoolean:ag,isObject:ks,isPlainObject:Fs,isReadableStream:hg,isRequest:gg,isResponse:mg,isHeaders:bg,isUndefined:No,isDate:ig,isFile:cg,isBlob:lg,isRegExp:Og,isFunction:Tt,isStream:dg,isURLSearchParams:pg,isTypedArray:_g,isFileList:ug,forEach:Ro,merge:Ti,extend:xg,trim:yg,stripBOM:Cg,inherits:Eg,toFlatObject:vg,kindOf:Ls,kindOfTest:Yt,endsWith:wg,toArray:Ig,forEachEntry:Sg,matchAll:Tg,isHTMLForm:Ag,hasOwnProperty:Su,hasOwnProp:Su,reduceDescriptors:Tu,freezeMethods:kg,toObjectSet:Fg,toCamelCase:Lg,noop:Dg,toFiniteNumber:Ng,findKey:Iu,global:hr,isContextDefined:_u,ALPHABET:Lu,generateString:Rg,isSpecCompliantForm:Mg,toJSONObject:Pg,isAsyncFn:jg,isThenable:Bg,setImmediate:Ou,asap:Vg};function be(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}j.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:j.toJSONObject(this.config),code:this.code,status:this.status}}});const ku=be.prototype,Fu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Fu[e]={value:e}}),Object.defineProperties(be,Fu),Object.defineProperty(ku,"isAxiosError",{value:!0}),be.from=(e,t,n,r,o,s)=>{const a=Object.create(ku);return j.toFlatObject(e,a,function(c){return c!==Error.prototype},i=>i!=="isAxiosError"),be.call(a,e.message,t,n,r,o),a.cause=e,a.name=e.name,s&&Object.assign(a,s),a};var Gg=null;function Li(e){return j.isPlainObject(e)||j.isArray(e)}function Du(e){return j.endsWith(e,"[]")?e.slice(0,-2):e}function Nu(e,t,n){return e?e.concat(t).map(function(o,s){return o=Du(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function Hg(e){return j.isArray(e)&&!e.some(Li)}const Wg=j.toFlatObject(j,{},null,function(t){return/^is[A-Z]/.test(t)});function Ds(e,t,n){if(!j.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=j.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,p){return!j.isUndefined(p[h])});const r=n.metaTokens,o=n.visitor||f,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&j.isSpecCompliantForm(t);if(!j.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(j.isDate(b))return b.toISOString();if(!c&&j.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return j.isArrayBuffer(b)||j.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,h,p){let m=b;if(b&&!p&&typeof b=="object"){if(j.endsWith(h,"{}"))h=r?h:h.slice(0,-2),b=JSON.stringify(b);else if(j.isArray(b)&&Hg(b)||(j.isFileList(b)||j.endsWith(h,"[]"))&&(m=j.toArray(b)))return h=Du(h),m.forEach(function(C,w){!(j.isUndefined(C)||C===null)&&t.append(a===!0?Nu([h],w,s):a===null?h:h+"[]",d(C))}),!1}return Li(b)?!0:(t.append(Nu(p,h,s),d(b)),!1)}const g=[],y=Object.assign(Wg,{defaultVisitor:f,convertValue:d,isVisitable:Li});function E(b,h){if(!j.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+h.join("."));g.push(b),j.forEach(b,function(m,x){(!(j.isUndefined(m)||m===null)&&o.call(t,m,j.isString(x)?x.trim():x,h,y))===!0&&E(m,h?h.concat(x):[x])}),g.pop()}}if(!j.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Ru(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Oi(e,t){this._pairs=[],e&&Ds(e,this,t)}const Mu=Oi.prototype;Mu.append=function(t,n){this._pairs.push([t,n])},Mu.toString=function(t){const n=t?function(r){return t.call(this,r,Ru)}:Ru;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function Zg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Pu(e,t,n){if(!t)return e;const r=n&&n.encode||Zg,o=n&&n.serialize;let s;if(o?s=o(t,n):s=j.isURLSearchParams(t)?t.toString():new Oi(t,n).toString(r),s){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class zg{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){j.forEach(this.handlers,function(r){r!==null&&t(r)})}}var ju=zg,Bu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xg=typeof URLSearchParams<"u"?URLSearchParams:Oi,Yg=typeof FormData<"u"?FormData:null,Jg=typeof Blob<"u"?Blob:null,qg={isBrowser:!0,classes:{URLSearchParams:Xg,FormData:Yg,Blob:Jg},protocols:["http","https","file","blob","url","data"]};const ki=typeof window<"u"&&typeof document<"u",Fi=typeof navigator=="object"&&navigator||void 0,Qg=ki&&(!Fi||["ReactNative","NativeScript","NS"].indexOf(Fi.product)<0),$g=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ug=ki&&window.location.href||"http://localhost";var Kg=Object.freeze({__proto__:null,hasBrowserEnv:ki,hasStandardBrowserWebWorkerEnv:$g,hasStandardBrowserEnv:Qg,navigator:Fi,origin:Ug}),bt={...Kg,...qg};function em(e,t){return Ds(e,new bt.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return bt.isNode&&j.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function tm(e){return j.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function nm(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}function Vu(e){function t(n,r,o,s){let a=n[s++];if(a==="__proto__")return!0;const i=Number.isFinite(+a),c=s>=n.length;return a=!a&&j.isArray(o)?o.length:a,c?(j.hasOwnProp(o,a)?o[a]=[o[a],r]:o[a]=r,!i):((!o[a]||!j.isObject(o[a]))&&(o[a]=[]),t(n,r,o[a],s)&&j.isArray(o[a])&&(o[a]=nm(o[a])),!i)}if(j.isFormData(e)&&j.isFunction(e.entries)){const n={};return j.forEachEntry(e,(r,o)=>{t(tm(r),o,n,0)}),n}return null}function rm(e,t,n){if(j.isString(e))try{return(t||JSON.parse)(e),j.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const Di={transitional:Bu,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=j.isObject(t);if(s&&j.isHTMLForm(t)&&(t=new FormData(t)),j.isFormData(t))return o?JSON.stringify(Vu(t)):t;if(j.isArrayBuffer(t)||j.isBuffer(t)||j.isStream(t)||j.isFile(t)||j.isBlob(t)||j.isReadableStream(t))return t;if(j.isArrayBufferView(t))return t.buffer;if(j.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return em(t,this.formSerializer).toString();if((i=j.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Ds(i?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),rm(t)):t}],transformResponse:[function(t){const n=this.transitional||Di.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(j.isResponse(t)||j.isReadableStream(t))return t;if(t&&j.isString(t)&&(r&&!this.responseType||o)){const a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(i){if(a)throw i.name==="SyntaxError"?be.from(i,be.ERR_BAD_RESPONSE,this,null,this.response):i}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bt.classes.FormData,Blob:bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};j.forEach(["delete","get","head","post","put","patch"],e=>{Di.headers[e]={}});var Ni=Di;const om=j.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var sm=e=>{const t={};let n,r,o;return e&&e.split(`
31
31
  `).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),r=a.substring(o+1).trim(),!(!n||t[n]&&om[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};const Gu=Symbol("internals");function Mo(e){return e&&String(e).trim().toLowerCase()}function Ns(e){return e===!1||e==null?e:j.isArray(e)?e.map(Ns):String(e)}function am(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const im=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ri(e,t,n,r,o){if(j.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!j.isString(t)){if(j.isString(r))return t.indexOf(r)!==-1;if(j.isRegExp(r))return r.test(t)}}function cm(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function lm(e,t){const n=j.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,s,a){return this[r].call(this,t,o,s,a)},configurable:!0})})}class Rs{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function s(i,c,d){const f=Mo(c);if(!f)throw new Error("header name must be a non-empty string");const g=j.findKey(o,f);(!g||o[g]===void 0||d===!0||d===void 0&&o[g]!==!1)&&(o[g||c]=Ns(i))}const a=(i,c)=>j.forEach(i,(d,f)=>s(d,f,c));if(j.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(j.isString(t)&&(t=t.trim())&&!im(t))a(sm(t),n);else if(j.isHeaders(t))for(const[i,c]of t.entries())s(c,i,r);else t!=null&&s(n,t,r);return this}get(t,n){if(t=Mo(t),t){const r=j.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return am(o);if(j.isFunction(n))return n.call(this,o,r);if(j.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Mo(t),t){const r=j.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Ri(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function s(a){if(a=Mo(a),a){const i=j.findKey(r,a);i&&(!n||Ri(r,r[i],i,n))&&(delete r[i],o=!0)}}return j.isArray(t)?t.forEach(s):s(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!t||Ri(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){const n=this,r={};return j.forEach(this,(o,s)=>{const a=j.findKey(r,s);if(a){n[a]=Ns(o),delete n[s];return}const i=t?cm(s):String(s).trim();i!==s&&delete n[s],n[i]=Ns(o),r[i]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return j.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&j.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
32
32
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[Gu]=this[Gu]={accessors:{}}).accessors,o=this.prototype;function s(a){const i=Mo(a);r[i]||(lm(o,a),r[i]=!0)}return j.isArray(t)?t.forEach(s):s(t),this}}Rs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),j.reduceDescriptors(Rs.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),j.freezeMethods(Rs);var Jt=Rs;function Mi(e,t){const n=this||Ni,r=t||n,o=Jt.from(r.headers);let s=r.data;return j.forEach(e,function(i){s=i.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Hu(e){return!!(e&&e.__CANCEL__)}function Xr(e,t,n){be.call(this,e??"canceled",be.ERR_CANCELED,t,n),this.name="CanceledError"}j.inherits(Xr,be,{__CANCEL__:!0});function Wu(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new be("Request failed with status code "+n.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function um(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dm(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),f=r[s];a||(a=d),n[o]=c,r[o]=d;let g=s,y=0;for(;g!==o;)y+=n[g++],g=g%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),d-a<t)return;const E=f&&d-f;return E?Math.round(y*1e3/E):void 0}}function fm(e,t){let n=0,r=1e3/t,o,s;const a=(d,f=Date.now())=>{n=f,o=null,s&&(clearTimeout(s),s=null),e.apply(null,d)};return[(...d)=>{const f=Date.now(),g=f-n;g>=r?a(d,f):(o=d,s||(s=setTimeout(()=>{s=null,a(o)},r-g)))},()=>o&&a(o)]}const Ms=(e,t,n=3)=>{let r=0;const o=dm(50,250);return fm(s=>{const a=s.loaded,i=s.lengthComputable?s.total:void 0,c=a-r,d=o(c),f=a<=i;r=a;const g={loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:d||void 0,estimated:d&&i&&f?(i-a)/d:void 0,event:s,lengthComputable:i!=null,[t?"download":"upload"]:!0};e(g)},n)},Zu=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zu=e=>(...t)=>j.asap(()=>e(...t));var pm=bt.hasStandardBrowserEnv?function(){const t=bt.navigator&&/(msie|trident)/i.test(bt.navigator.userAgent),n=document.createElement("a");let r;function o(s){let a=s;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){const i=j.isString(a)?o(a):a;return i.protocol===r.protocol&&i.host===r.host}}():function(){return function(){return!0}}(),hm=bt.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const a=[e+"="+encodeURIComponent(t)];j.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),j.isString(r)&&a.push("path="+r),j.isString(o)&&a.push("domain="+o),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function gm(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function mm(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Xu(e,t){return e&&!gm(t)?mm(e,t):t}const Yu=e=>e instanceof Jt?{...e}:e;function gr(e,t){t=t||{};const n={};function r(d,f,g){return j.isPlainObject(d)&&j.isPlainObject(f)?j.merge.call({caseless:g},d,f):j.isPlainObject(f)?j.merge({},f):j.isArray(f)?f.slice():f}function o(d,f,g){if(j.isUndefined(f)){if(!j.isUndefined(d))return r(void 0,d,g)}else return r(d,f,g)}function s(d,f){if(!j.isUndefined(f))return r(void 0,f)}function a(d,f){if(j.isUndefined(f)){if(!j.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function i(d,f,g){if(g in t)return r(d,f);if(g in e)return r(void 0,d)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:i,headers:(d,f)=>o(Yu(d),Yu(f),!0)};return j.forEach(Object.keys(Object.assign({},e,t)),function(f){const g=c[f]||o,y=g(e[f],t[f],f);j.isUndefined(y)&&g!==i||(n[f]=y)}),n}var Ju=e=>{const t=gr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:i}=t;t.headers=a=Jt.from(a),t.url=Pu(Xu(t.baseURL,t.url),e.params,e.paramsSerializer),i&&a.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):"")));let c;if(j.isFormData(n)){if(bt.hasStandardBrowserEnv||bt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[d,...f]=c?c.split(";").map(g=>g.trim()).filter(Boolean):[];a.setContentType([d||"multipart/form-data",...f].join("; "))}}if(bt.hasStandardBrowserEnv&&(r&&j.isFunction(r)&&(r=r(t)),r||r!==!1&&pm(t.url))){const d=o&&s&&hm.read(s);d&&a.set(o,d)}return t},bm=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=Ju(e);let s=o.data;const a=Jt.from(o.headers).normalize();let{responseType:i,onUploadProgress:c,onDownloadProgress:d}=o,f,g,y,E,b;function h(){E&&E(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let p=new XMLHttpRequest;p.open(o.method.toUpperCase(),o.url,!0),p.timeout=o.timeout;function m(){if(!p)return;const C=Jt.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:C,config:e,request:p};Wu(function(T){n(T),h()},function(T){r(T),h()},v),p=null}"onloadend"in p?p.onloadend=m:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(m)},p.onabort=function(){p&&(r(new be("Request aborted",be.ECONNABORTED,e,p)),p=null)},p.onerror=function(){r(new be("Network Error",be.ERR_NETWORK,e,p)),p=null},p.ontimeout=function(){let w=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||Bu;o.timeoutErrorMessage&&(w=o.timeoutErrorMessage),r(new be(w,v.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,p)),p=null},s===void 0&&a.setContentType(null),"setRequestHeader"in p&&j.forEach(a.toJSON(),function(w,v){p.setRequestHeader(v,w)}),j.isUndefined(o.withCredentials)||(p.withCredentials=!!o.withCredentials),i&&i!=="json"&&(p.responseType=o.responseType),d&&([y,b]=Ms(d,!0),p.addEventListener("progress",y)),c&&p.upload&&([g,E]=Ms(c),p.upload.addEventListener("progress",g),p.upload.addEventListener("loadend",E)),(o.cancelToken||o.signal)&&(f=C=>{p&&(r(!C||C.type?new Xr(null,e,p):C),p.abort(),p=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const x=um(o.url);if(x&&bt.protocols.indexOf(x)===-1){r(new be("Unsupported protocol "+x+":",be.ERR_BAD_REQUEST,e));return}p.send(s||null)})},ym=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const s=function(d){if(!o){o=!0,i();const f=d instanceof Error?d:this.reason;r.abort(f instanceof be?f:new Xr(f instanceof Error?f.message:f))}};let a=t&&setTimeout(()=>{a=null,s(new be(`timeout ${t} of ms exceeded`,be.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(s):d.removeEventListener("abort",s)}),e=null)};e.forEach(d=>d.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>j.asap(i),c}};const xm=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Cm=async function*(e,t){for await(const n of Em(e))yield*xm(n,t)},Em=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},qu=(e,t,n,r)=>{const o=Cm(e,t);let s=0,a,i=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:f}=await o.next();if(d){i(),c.close();return}let g=f.byteLength;if(n){let y=s+=g;n(y)}c.enqueue(new Uint8Array(f))}catch(d){throw i(d),d}},cancel(c){return i(c),o.return()}},{highWaterMark:2})},Ps=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Qu=Ps&&typeof ReadableStream=="function",vm=Ps&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),$u=(e,...t)=>{try{return!!e(...t)}catch{return!1}},wm=Qu&&$u(()=>{let e=!1;const t=new Request(bt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Uu=64*1024,Pi=Qu&&$u(()=>j.isReadableStream(new Response("").body)),js={stream:Pi&&(e=>e.body)};Ps&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!js[t]&&(js[t]=j.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new be(`Response type '${t}' is not supported`,be.ERR_NOT_SUPPORT,r)})})})(new Response);const Im=async e=>{if(e==null)return 0;if(j.isBlob(e))return e.size;if(j.isSpecCompliantForm(e))return(await new Request(bt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(j.isArrayBufferView(e)||j.isArrayBuffer(e))return e.byteLength;if(j.isURLSearchParams(e)&&(e=e+""),j.isString(e))return(await vm(e)).byteLength},_m=async(e,t)=>{const n=j.toFiniteNumber(e.getContentLength());return n??Im(t)};var Sm=Ps&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:a,onDownloadProgress:i,onUploadProgress:c,responseType:d,headers:f,withCredentials:g="same-origin",fetchOptions:y}=Ju(e);d=d?(d+"").toLowerCase():"text";let E=ym([o,s&&s.toAbortSignal()],a),b;const h=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let p;try{if(c&&wm&&n!=="get"&&n!=="head"&&(p=await _m(f,r))!==0){let v=new Request(t,{method:"POST",body:r,duplex:"half"}),_;if(j.isFormData(r)&&(_=v.headers.get("content-type"))&&f.setContentType(_),v.body){const[T,S]=Zu(p,Ms(zu(c)));r=qu(v.body,Uu,T,S)}}j.isString(g)||(g=g?"include":"omit");const m="credentials"in Request.prototype;b=new Request(t,{...y,signal:E,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:m?g:void 0});let x=await fetch(b);const C=Pi&&(d==="stream"||d==="response");if(Pi&&(i||C&&h)){const v={};["status","statusText","headers"].forEach(L=>{v[L]=x[L]});const _=j.toFiniteNumber(x.headers.get("content-length")),[T,S]=i&&Zu(_,Ms(zu(i),!0))||[];x=new Response(qu(x.body,Uu,T,()=>{S&&S(),h&&h()}),v)}d=d||"text";let w=await js[j.findKey(js,d)||"text"](x,e);return!C&&h&&h(),await new Promise((v,_)=>{Wu(v,_,{data:w,headers:Jt.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:b})})}catch(m){throw h&&h(),m&&m.name==="TypeError"&&/fetch/i.test(m.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,e,b),{cause:m.cause||m}):be.from(m,m&&m.code,e,b)}});const ji={http:Gg,xhr:bm,fetch:Sm};j.forEach(ji,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ku=e=>`- ${e}`,Tm=e=>j.isFunction(e)||e===null||e===!1;var ed={getAdapter:e=>{e=j.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){n=e[s];let a;if(r=n,!Tm(n)&&(r=ji[(a=String(n)).toLowerCase()],r===void 0))throw new be(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+s]=r}if(!r){const s=Object.entries(o).map(([i,c])=>`adapter ${i} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since :
33
33
  `+s.map(Ku).join(`
@@ -2319,7 +2319,7 @@ Do you want to continue?`,$v="Select an object to create",Uv="Select an object t
2319
2319
  gap: 12px;
2320
2320
  align-items: center;
2321
2321
  `,$I=({appName:e,onPrimaryClick:t})=>{const[n,r]=I.useState(()=>qo().getItem($1)==="true");if(n)return null;const o=()=>{qo().setItem($1,"true"),r(!0)};return u.jsx(YI,{children:u.jsxs(JI,{children:[u.jsxs(qI,{children:[u.jsxs(l.Typography,{variant:"body2",sx:{fontWeight:600,color:l.theme.palette.gray.black,lineHeight:"18px"},children:["Create ",e," tasks faster"]}),u.jsxs(l.Typography,{variant:"caption",color:l.theme.palette.gray.gray3,sx:{letterSpacing:"0.2px",lineHeight:"16px"},children:["Spend less time filling ",e," fields. Pre-fill them for your team."]})]}),u.jsxs(QI,{children:[u.jsx(l.Button,{size:"small",onClick:t,children:"Set up now"}),u.jsx(l.Button,{variant:"text",size:"small",sx:{color:l.theme.palette.gray.gray2},onClick:o,children:"Dismiss"})]})]})})},U1=({setShown:e,shown:t,title:n,description:r,buttons:o})=>u.jsx(Sr,{shown:t,setShown:e,showCloseButton:!0,children:u.jsxs(l.Stack,{width:"400px",padding:"20px",children:[u.jsx(l.Typography,{variant:"h2",marginBottom:"8px",children:n}),u.jsx(l.Stack,{gap:"4px",marginBottom:"20px",children:r.split(`
2322
- `).map((s,a)=>u.jsx(l.Typography,{variant:"body2",children:s},a))}),u.jsx(l.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:o.map(s=>u.jsx(l.Button,{variant:s.variant,size:"medium",onClick:s.action,children:s.label},s.label.split(" ").join("_").toLowerCase()))})]})}),K1="connector-agent-expanded-write-form",e2=({metaData:e,isEdit:t=!1,defaultOption:n,mapFormOpen:r,onClose:o,onCreateSuccess:s,setMetaData:a,setMapFormOpen:i,setCreateFormId:c,syncCurrentObject:d})=>{var Gr,Hr;const{userGroupId:f}=Mt()||{},[g,y]=I.useState(null),[E,b]=I.useState(!1),[h,p]=I.useState(!1),m=I.useRef(null),{conversationId:x,availableFeatures:C,sendTrackingEvent:w,currentSmIds:v,connectorFunctions:{redirectToAdmin:_,getFormElement:T,toggleFormElement:S},stackingContext:L,isAdmin:R,variables:D}=I.useContext(Ge),[F,M]=H1(),B=_e(k1),G=_e(t?Ow:L1),J=_e(Fw),Z=_e(kw),H=_e(Rw),Y=_e(Mw),U=_e(Pw),ee=_e(jw),V=_e(Bw),q=_e(F1),N=Z==null?void 0:Z[(g==null?void 0:g.value)??""];d==null||d(N);const X=tt(C,P4),Q=(N==null?void 0:N.hasCustomFields)??!1,{customFieldsArgsPresent:ne,customFieldsArgs:ce}=I.useMemo(()=>{if(!Q)return{customFieldsArgsPresent:!1,customFieldsArgs:{}};const pe=Object.values((N==null?void 0:N.customFieldsArgs)??{}).every(ct=>!!F.values[ct]);if(!pe)return{customFieldsArgsPresent:!1,customFieldsArgs:{}};const ge=(N==null?void 0:N.customFieldsArgs)??{},Qe=as(F,ge);return{customFieldsArgsPresent:pe,customFieldsArgs:Qe}},[Q,F,N==null?void 0:N.customFieldsArgs]),P=Q&&ne&&X,{data:re}=XI({formId:String(g==null?void 0:g.value),args:ce,enabled:P}),xe=I.useMemo(()=>P?re??[]:[],[P,re]),z=N==null?void 0:N.expandedView,{formConfigs:Ae,formViewConfigs:Ve}=I.useMemo(()=>{if(g&&"value"in g&&J&&J[g.value]&&Array.isArray(J[g.value])){const ge=[...J[g.value],...xe],Qe=[{id:g.value,formFields:ge}];return{formConfigs:Qe,formViewConfigs:z?hv(ge,m1):Qe}}const pe=[{id:"emptyFormId",formFields:[]}];return{formConfigs:pe,formViewConfigs:pe}},[J,xe,g,z]),He=(Gr=Ae[0])==null?void 0:Gr.formFields,rn=I.useMemo(()=>(He??[]).filter(ge=>!ge.isFieldCustom),[He]),xn=I.useMemo(()=>{var ge;const pe=((ge=Ae==null?void 0:Ae[0])==null?void 0:ge.formFields)||[];return fl({formFields:pe})},[Ae]),{setValue:Ke,setFormDefaults:it,inputChangeHandler:qe,checkboxChangeHandler:Mr,dateChangeHandler:Bt,clearDependentFields:Kn,handleValidationError:er,isErrorInValidations:tr}=W1({state:F,dispatch:M,validations:xn,dynamicFields:xe}),nr=Ae[0].id!=="emptyFormId"?Ae[0].id:g==null?void 0:g.value,{data:gt,isNudgeRequired:Ln,enabledRef:Pr}=Q1({formId:nr,conversationId:x,inboxIds:v,enabled:!t&&!!R});I.useEffect(()=>{gt&&it(gt)},[gt,it]),I.useEffect(()=>{g&&(c==null||c(g.value))},[g,c]);const{userGroupId:On}=Mt()||{},{fetchConfig:Vt,createConfig:hs}=X1({formFields:Ae[0].formFields,formId:Ae[0].id,formState:F,conversationId:x}),Gt=(Hr=B==null?void 0:B.forms.find(pe=>pe.type==="edit"))==null?void 0:Hr.id,{externalResourceId:rr}=B??{},kn=[Y,U,V].includes(te.LOADING),_o=I.useMemo(()=>!z||!T?null:T(),[z,T]),Ht=$t();I.useEffect(()=>(z&&S&&S(!0),()=>{z&&S&&S(!1)}),[z,S]),I.useEffect(()=>{Ht(y1(t?!(ee&&"values"in ee&&"values"in F&&N1(F.values,ee.values)):(e==null?void 0:e.fields_filled)!==void 0&&e.fields_filled>0))},[t,e,ee,F,Ht]),I.useEffect(()=>(t&&ee&&M({type:vt.SET_FIELDS,payload:ee}),()=>{M({type:vt.SET_FIELDS,payload:{values:{}}})}),[t,M,ee]),I.useEffect(()=>{g!==null&&a(pe=>({...pe,object_type:g.label}))},[g,a]),I.useEffect(()=>{if(F.values){const pe=c1(Ae[0].formFields,F.values);a(ge=>({...ge,fields_filled:pe}))}},[F,Ae,a]),I.useEffect(()=>{if(n&&!t)return y(n);G&&G.length&&y(t&&Gt?G.find(pe=>pe.value===Gt)??null:pe=>pe||!Z?pe:G.length===1?G[0]:G.find(Qe=>!Z[Qe.value].expandedView)??null)},[G,Z,t,Gt,n]);const So=()=>{y(m.current),b(!1),M({type:vt.RESET_STATE})},or=(pe,ge)=>{Ke(pe,ge)},sr=(pe,ge,Qe)=>{if(ge.action==="clear"&&ge.name&&(Ke(ge.name,""),g!=null&&g.value&&Kn(ge.name,H==null?void 0:H[g.value]),xn[ge.name].isRequired&&er(ge.name,!0)),pe&&typeof pe=="object"&&"label"in pe&&typeof pe.label=="string"&&"value"in pe&&(typeof pe.value=="string"||typeof pe.value=="number")&&typeof ge.name<"u")if(ge.name==="form-object"){if(m.current={value:pe.value,label:pe.label},F.values&&pe.value!==(g==null?void 0:g.value)){const ct=Object.values(F.values).filter(St=>St!=="").length;(Object.values(gt??{}).filter(St=>!!St).length>0?!N1(F.values,gt):ct>0)?b(!0):So()}}else{let ct=!1;Qe&&(ct=Qe.isMultiSelect||!1);const Nt=!ct&&"prefillValues"in pe&&pe.prefillValues,sn=ct?[{value:pe.value,label:pe.label}]:{value:pe.value,label:pe.label};if(Ke(ge.name,sn),Nt)for(const St in Nt)Ke(St,Nt[St]);g!=null&&g.value&&Kn(ge.name,H==null?void 0:H[g.value])}},on=()=>{if(!tr()&&Gt&&(Z!=null&&Z[Gt])&&x&&rr){const{connectorName:pe,title:ge}=B;w(n4,{connector_name:pe,card_title:ge,sm_ids:v,ug_id:On});const Qe=Z[Gt].interfaceDetails;if(!Qe||!ee)return;const{id:ct,args:Nt={},previousArgs:sn={}}=Qe,St=as(ee,sn),O=as(F,Nt);Ht(Wa({formId:String(Gt),conversationId:x,args:O,previousArgs:St,externalResourceId:rr,interfaceId:ct,successCallback:()=>{s()}})).unwrap().then(()=>{var we;w(o4,{connector_name:pe,card_title:ge,sm_ids:v,ug_id:On});const W=((we=Ae[0].formFields)==null?void 0:we.filter(Ie=>Ie.isFieldCustom))??[],$=W.length>0,oe=W.some(Ie=>F.values[Ie.name]);w(C4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name,object_type:g==null?void 0:g.label,has_custom_fields:$,custom_fields_used:oe})}).finally(()=>{Ht(lo(null))})}},ar=()=>{if(!tr()&&g&&(Z!=null&&Z[g.value])&&x){const pe=Z==null?void 0:Z[g.value].interfaceDetails;if(!pe)return;const{id:ge,args:Qe={}}=pe,ct=as(F,Qe);Ht(Ha({formId:String(g.value),conversationId:x,args:ct,interfaceId:ge,successCallback:()=>{s()}})).unwrap().then(()=>{var $;w(Y3,{object_type:g});const Nt=(($=Ae[0].formFields)==null?void 0:$.filter(oe=>oe.isFieldCustom))??[],sn=Nt.length>0,St=Nt.some(oe=>F.values[oe.name]),W=Object.entries(gt??{}).filter(([oe,we])=>{if(F.values[oe]===we)return!0}).map(([oe])=>oe);w(x4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name,object_type:g==null?void 0:g.label,has_custom_fields:sn,custom_fields_used:St,...W.length?{fields_with_defaults_used:W.join(",")}:{}})})}},jr=[{label:"Cancel",action:()=>b(!1),variant:"text"},{label:"Continue",action:So}],To=()=>{_(N==null?void 0:N.connectorId,{isEdit:!0,tabIndex:2,editCard:(N==null?void 0:N.cardId)??""}),w(y4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name})},gs=({data:pe})=>{Pr.current=!0,i==null||i(!1);const{fields_configured_count:ge,has_system_variable:Qe}=r6(pe);w(I4,{app_name:N==null?void 0:N.connectorName,object_type:N==null?void 0:N.name,fields_configured_count:ge,has_system_variable:Qe})},Br=R&&X&&(N==null?void 0:N.cardAccessMode)==="read_write",ms=!h&&(v==null?void 0:v.length)>1&&Object.keys(gt??{}).length>0,Vr=u.jsxs(o2,{className:z?K1:"",children:[i&&u.jsx(ZI,{open:r??!1,isEdit:t,fields:rn,variables:D??[],title:(N==null?void 0:N.name)||"Pre-fill fields",connectorLogo:(N==null?void 0:N.logoUrl)??"",formId:nr,customFormArgsEnabled:(N==null?void 0:N.hasCustomFields)??!1,customFormArgsMap:(N==null?void 0:N.customFieldsArgs)??void 0,onSuccess:gs,onClose:()=>i==null?void 0:i(!1)}),Ln?u.jsx($I,{appName:(N==null?void 0:N.connectorName)??"App",onPrimaryClick:()=>{i==null||i(!0)}}):null,u.jsx(U1,{shown:E,setShown:b,title:Yv,description:Jv,buttons:jr}),z?u.jsxs(KI,{children:[u.jsxs(l.Typography,{variant:"body_sm_medium",children:[t?"Edit":"Add"," to ",N.connectorName]}),u.jsx(l.Tooltip,{title:"Close Popup",placement:"bottom",children:u.jsx(l.IconButton,{onClick:o,children:u.jsx(e_,{src:w1})})})]}):null,u.jsxs(r2,{spacing:3,children:[!t&&!z?u.jsx(Ir,{type:"select",placeholder:g1,options:G,value:g,name:"form-object",selectChangeHandler:sr,label:$v,labelSpacing:.5,validation:{isRequired:!0}}):null,u.jsx(Jp,{showGlobalLoader:V===te.LOADING,formConfig:Ve,selectChangeHandler:sr,inputChangeHandler:qe,checkboxChangeHandler:Mr,dateChangeHandler:Bt,tableChangeHandler:or,onValidationError:er,fieldsSpacing:3,labelSpacing:.5,fetchConfig:Vt,createConfig:hs,values:F.values,validations:xn,...z?{cols:m1,stackIndex:L.expandedForm}:null}),Br?u.jsx(l.Stack,{marginTop:"28px",width:"100%",justifyContent:"center",children:u.jsx(l.Button,{variant:"text",startIcon:u.jsx(t_,{}),onClick:To,size:"small",children:Q4})}):null]}),ms?u.jsxs(UI,{children:[u.jsx(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray1,children:ow}),u.jsx(l.IconButton,{onClick:()=>p(!0),children:u.jsx(l.icons.Close,{sx:{height:"16px",width:"16px",opacity:"0.8"}})})]}):null,u.jsxs(n2,{children:[u.jsx(l.Button,{disabled:tr()||kn||!q,onClick:t?on:ar,size:"small",...z?{style:{order:2}}:null,children:t?H4:G4}),u.jsx(s2,{variant:"outlined",color:"tertiary",size:"small",onClick:o,disabled:kn,children:Ki})]})]});return z&&_o?Wt.createPortal(Vr,_o):Vr},t2=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 10 10",fill:"none",...e},A.createElement("path",{d:"M9.70785 5.66671H5.70785V9.66671H4.37451V5.66671H0.374512V4.33337H4.37451V0.333374H5.70785V4.33337H9.70785V5.66671Z",fill:"#4D596C"})),UI=l.styled(l.Stack)`
2322
+ `).map((s,a)=>u.jsx(l.Typography,{variant:"body2",children:s},a))}),u.jsx(l.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:o.map(s=>u.jsx(l.Button,{variant:s.variant,size:"medium",onClick:s.action,children:s.label},s.label.split(" ").join("_").toLowerCase()))})]})}),K1="connector-agent-expanded-write-form",e2=({metaData:e,isEdit:t=!1,defaultOption:n,mapFormOpen:r,onClose:o,onCreateSuccess:s,setMetaData:a,setMapFormOpen:i,setCreateFormId:c,syncCurrentObject:d})=>{var Gr,Hr;const{userGroupId:f}=Mt()||{},[g,y]=I.useState(null),[E,b]=I.useState(!1),[h,p]=I.useState(!1),m=I.useRef(null),{conversationId:x,availableFeatures:C,sendTrackingEvent:w,currentSmIds:v,connectorFunctions:{redirectToAdmin:_,getFormElement:T,toggleFormElement:S},stackingContext:L,isAdmin:R,variables:D}=I.useContext(Ge),[F,M]=H1(),B=_e(k1),G=_e(t?Ow:L1),J=_e(Fw),Z=_e(kw),H=_e(Rw),Y=_e(Mw),U=_e(Pw),ee=_e(jw),V=_e(Bw),q=_e(F1),N=Z==null?void 0:Z[(g==null?void 0:g.value)??""];d==null||d(N);const X=tt(C,P4),Q=(N==null?void 0:N.hasCustomFields)??!1,{customFieldsArgsPresent:ne,customFieldsArgs:ce}=I.useMemo(()=>{if(!Q)return{customFieldsArgsPresent:!1,customFieldsArgs:{}};const pe=Object.values((N==null?void 0:N.customFieldsArgs)??{}).every(ct=>!!F.values[ct]);if(!pe)return{customFieldsArgsPresent:!1,customFieldsArgs:{}};const ge=(N==null?void 0:N.customFieldsArgs)??{},Qe=as(F,ge);return{customFieldsArgsPresent:pe,customFieldsArgs:Qe}},[Q,F,N==null?void 0:N.customFieldsArgs]),P=Q&&ne&&X,{data:re}=XI({formId:String(g==null?void 0:g.value),args:ce,enabled:P}),xe=I.useMemo(()=>P?re??[]:[],[P,re]),z=N==null?void 0:N.expandedView,{formConfigs:Ae,formViewConfigs:Ve}=I.useMemo(()=>{if(g&&"value"in g&&J&&J[g.value]&&Array.isArray(J[g.value])){const ge=[...J[g.value],...xe],Qe=[{id:g.value,formFields:ge}];return{formConfigs:Qe,formViewConfigs:z?hv(ge,m1):Qe}}const pe=[{id:"emptyFormId",formFields:[]}];return{formConfigs:pe,formViewConfigs:pe}},[J,xe,g,z]),He=(Gr=Ae[0])==null?void 0:Gr.formFields,rn=I.useMemo(()=>(He??[]).filter(ge=>!ge.isFieldCustom),[He]),xn=I.useMemo(()=>{var ge;const pe=((ge=Ae==null?void 0:Ae[0])==null?void 0:ge.formFields)||[];return fl({formFields:pe})},[Ae]),{setValue:Ke,setFormDefaults:it,inputChangeHandler:qe,checkboxChangeHandler:Mr,dateChangeHandler:Bt,clearDependentFields:Kn,handleValidationError:er,isErrorInValidations:tr}=W1({state:F,dispatch:M,validations:xn,dynamicFields:xe}),nr=Ae[0].id!=="emptyFormId"?Ae[0].id:g==null?void 0:g.value,{data:gt,isNudgeRequired:Ln,enabledRef:Pr}=Q1({formId:nr,conversationId:x,inboxIds:v,enabled:!t&&!!R});I.useEffect(()=>{gt&&it(gt)},[gt,it]),I.useEffect(()=>{g&&(c==null||c(g.value))},[g,c]);const{userGroupId:On}=Mt()||{},{fetchConfig:Vt,createConfig:hs}=X1({formFields:Ae[0].formFields,formId:Ae[0].id,formState:F,conversationId:x}),Gt=(Hr=B==null?void 0:B.forms.find(pe=>pe.type==="edit"))==null?void 0:Hr.id,{externalResourceId:rr}=B??{},kn=[Y,U,V].includes(te.LOADING),_o=I.useMemo(()=>!z||!T?null:T(),[z,T]),Ht=$t();I.useEffect(()=>(z&&S&&S(!0),()=>{z&&S&&S(!1)}),[z,S]),I.useEffect(()=>{Ht(y1(t?!(ee&&"values"in ee&&"values"in F&&N1(F.values,ee.values)):(e==null?void 0:e.fields_filled)!==void 0&&e.fields_filled>0))},[t,e,ee,F,Ht]),I.useEffect(()=>(t&&ee&&M({type:vt.SET_FIELDS,payload:ee}),()=>{M({type:vt.SET_FIELDS,payload:{values:{}}})}),[t,M,ee]),I.useEffect(()=>{g!==null&&a(pe=>({...pe,object_type:g.label}))},[g,a]),I.useEffect(()=>{if(F.values){const pe=c1(Ae[0].formFields,F.values);a(ge=>({...ge,fields_filled:pe}))}},[F,Ae,a]),I.useEffect(()=>{if(n&&!t)return y(n);G&&G.length&&y(t&&Gt?G.find(pe=>pe.value===Gt)??null:pe=>pe||!Z?pe:G.length===1?G[0]:G.find(Qe=>!Z[Qe.value].expandedView)??null)},[G,Z,t,Gt,n]);const So=()=>{y(m.current),b(!1),M({type:vt.RESET_STATE})},or=(pe,ge)=>{Ke(pe,ge)},sr=(pe,ge,Qe)=>{if(ge.action==="clear"&&ge.name&&(Ke(ge.name,""),g!=null&&g.value&&Kn(ge.name,H==null?void 0:H[g.value]),xn[ge.name].isRequired&&er(ge.name,!0)),pe&&typeof pe=="object"&&"label"in pe&&typeof pe.label=="string"&&"value"in pe&&(typeof pe.value=="string"||typeof pe.value=="number")&&typeof ge.name<"u")if(ge.name==="form-object"){if(m.current={value:pe.value,label:pe.label},F.values&&pe.value!==(g==null?void 0:g.value)){const ct=Object.values(F.values).filter(St=>St!=="").length;(Object.values(gt??{}).filter(St=>!!St).length>0?!N1(F.values,gt):ct>0)?b(!0):So()}}else{let ct=!1;Qe&&(ct=Qe.isMultiSelect||!1);const Nt=!ct&&"prefillValues"in pe&&pe.prefillValues,sn=ct?[{value:pe.value,label:pe.label}]:{value:pe.value,label:pe.label};if(Ke(ge.name,sn),Nt)for(const St in Nt)Ke(St,Nt[St]);g!=null&&g.value&&Kn(ge.name,H==null?void 0:H[g.value])}},on=()=>{if(!tr()&&Gt&&(Z!=null&&Z[Gt])&&x&&rr){const{connectorName:pe,title:ge}=B;w(n4,{connector_name:pe,card_title:ge,sm_ids:v,ug_id:On});const Qe=Z[Gt].interfaceDetails;if(!Qe||!ee)return;const{id:ct,args:Nt={},previousArgs:sn={}}=Qe,St=as(ee,sn),O=as(F,Nt);Ht(Wa({formId:String(Gt),conversationId:x,args:O,previousArgs:St,externalResourceId:rr,interfaceId:ct,successCallback:()=>{s()}})).unwrap().then(()=>{var we;w(o4,{connector_name:pe,card_title:ge,sm_ids:v,ug_id:On});const W=((we=Ae[0].formFields)==null?void 0:we.filter(Ie=>Ie.isFieldCustom))??[],$=W.length>0,se=W.some(Ie=>F.values[Ie.name]);w(C4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name,object_type:g==null?void 0:g.label,has_custom_fields:$,custom_fields_used:se})}).finally(()=>{Ht(lo(null))})}},ar=()=>{if(!tr()&&g&&(Z!=null&&Z[g.value])&&x){const pe=Z==null?void 0:Z[g.value].interfaceDetails;if(!pe)return;const{id:ge,args:Qe={}}=pe,ct=as(F,Qe);Ht(Ha({formId:String(g.value),conversationId:x,args:ct,interfaceId:ge,successCallback:()=>{s()}})).unwrap().then(()=>{var $;w(Y3,{object_type:g});const Nt=(($=Ae[0].formFields)==null?void 0:$.filter(se=>se.isFieldCustom))??[],sn=Nt.length>0,St=Nt.some(se=>F.values[se.name]),W=Object.entries(gt??{}).filter(([se,we])=>{if(F.values[se]===we)return!0}).map(([se])=>se);w(x4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name,object_type:g==null?void 0:g.label,has_custom_fields:sn,custom_fields_used:St,...W.length?{fields_with_defaults_used:W.join(",")}:{}})})}},jr=[{label:"Cancel",action:()=>b(!1),variant:"text"},{label:"Continue",action:So}],To=()=>{_(N==null?void 0:N.connectorId,{isEdit:!0,tabIndex:2,editCard:(N==null?void 0:N.cardId)??""}),w(y4,{sm_ids:v,ug_id:f,connector_name:N==null?void 0:N.connectorName,form_object:N==null?void 0:N.name})},gs=({data:pe})=>{Pr.current=!0,i==null||i(!1);const{fields_configured_count:ge,has_system_variable:Qe}=r6(pe);w(I4,{app_name:N==null?void 0:N.connectorName,object_type:N==null?void 0:N.name,fields_configured_count:ge,has_system_variable:Qe})},Br=R&&X&&(N==null?void 0:N.cardAccessMode)==="read_write",ms=!h&&(v==null?void 0:v.length)>1&&Object.keys(gt??{}).length>0,Vr=u.jsxs(o2,{className:z?K1:"",children:[i&&u.jsx(ZI,{open:r??!1,isEdit:t,fields:rn,variables:D??[],title:(N==null?void 0:N.name)||"Pre-fill fields",connectorLogo:(N==null?void 0:N.logoUrl)??"",formId:nr,customFormArgsEnabled:(N==null?void 0:N.hasCustomFields)??!1,customFormArgsMap:(N==null?void 0:N.customFieldsArgs)??void 0,onSuccess:gs,onClose:()=>i==null?void 0:i(!1)}),Ln?u.jsx($I,{appName:(N==null?void 0:N.connectorName)??"App",onPrimaryClick:()=>{i==null||i(!0)}}):null,u.jsx(U1,{shown:E,setShown:b,title:Yv,description:Jv,buttons:jr}),z?u.jsxs(KI,{children:[u.jsxs(l.Typography,{variant:"body_sm_medium",children:[t?"Edit":"Add"," to ",N.connectorName]}),u.jsx(l.Tooltip,{title:"Close Popup",placement:"bottom",children:u.jsx(l.IconButton,{onClick:o,children:u.jsx(e_,{src:w1})})})]}):null,u.jsxs(r2,{spacing:3,children:[!t&&!z?u.jsx(Ir,{type:"select",placeholder:g1,options:G,value:g,name:"form-object",selectChangeHandler:sr,label:$v,labelSpacing:.5,validation:{isRequired:!0}}):null,u.jsx(Jp,{showGlobalLoader:V===te.LOADING,formConfig:Ve,selectChangeHandler:sr,inputChangeHandler:qe,checkboxChangeHandler:Mr,dateChangeHandler:Bt,tableChangeHandler:or,onValidationError:er,fieldsSpacing:3,labelSpacing:.5,fetchConfig:Vt,createConfig:hs,values:F.values,validations:xn,...z?{cols:m1,stackIndex:L.expandedForm}:null}),Br?u.jsx(l.Stack,{marginTop:"28px",width:"100%",justifyContent:"center",children:u.jsx(l.Button,{variant:"text",startIcon:u.jsx(t_,{}),onClick:To,size:"small",children:Q4})}):null]}),ms?u.jsxs(UI,{children:[u.jsx(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray1,children:ow}),u.jsx(l.IconButton,{onClick:()=>p(!0),children:u.jsx(l.icons.Close,{sx:{height:"16px",width:"16px",opacity:"0.8"}})})]}):null,u.jsxs(n2,{children:[u.jsx(l.Button,{disabled:tr()||kn||!q,onClick:t?on:ar,size:"small",...z?{style:{order:2}}:null,children:t?H4:G4}),u.jsx(s2,{variant:"outlined",color:"tertiary",size:"small",onClick:o,disabled:kn,children:Ki})]})]});return z&&_o?Wt.createPortal(Vr,_o):Vr},t2=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 10 10",fill:"none",...e},A.createElement("path",{d:"M9.70785 5.66671H5.70785V9.66671H4.37451V5.66671H0.374512V4.33337H4.37451V0.333374H5.70785V4.33337H9.70785V5.66671Z",fill:"#4D596C"})),UI=l.styled(l.Stack)`
2323
2323
  box-sizing: border-box;
2324
2324
  width: 100%;
2325
2325
  flex-flow: row nowrap;
@@ -2487,7 +2487,7 @@ Do you want to continue?`,$v="Select an object to create",Uv="Select an object t
2487
2487
  `,J_="data:image/svg+xml,%3csvg%20width='124'%20height='107'%20viewBox='0%200%20124%20107'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M28.6168%2054.7446C28.6931%2052.5589%2031.0146%2051.1102%2033.0842%2051.8174C35.9985%2052.8133%2040.0375%2053.9024%2044.0621%2054.043C48.0034%2054.1806%2051.968%2053.4097%2054.8762%2052.6339C57.0264%2052.0602%2059.2927%2053.6932%2059.215%2055.9172C59.1742%2057.0856%2058.4742%2058.1269%2057.3723%2058.5178C54.8051%2059.4284%2049.7633%2060.8927%2044.3075%2060.7022C38.7694%2060.5088%2033.1999%2058.6241%2030.4004%2057.5311C29.2637%2057.0873%2028.5742%2055.9641%2028.6168%2054.7446Z'%20fill='url(%23paint0_linear_8481_102191)'/%3e%3cpath%20d='M47.223%2043.6373C44.4928%2030.7926%2052.6922%2018.1666%2065.5368%2015.4364C78.3815%2012.7062%2091.0075%2020.9055%2093.7377%2033.7502L105.079%2087.1053L84.1844%2091.5466C70.0346%2094.5542%2056.1258%2085.5217%2053.1182%2071.3719L47.223%2043.6373Z'%20fill='url(%23paint1_linear_8481_102191)'/%3e%3cmask%20id='mask0_8481_102191'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='46'%20y='14'%20width='60'%20height='79'%3e%3cpath%20d='M47.223%2043.6373C44.4928%2030.7926%2052.6922%2018.1666%2065.5368%2015.4364C78.3815%2012.7062%2091.0075%2020.9055%2093.7377%2033.7502L105.079%2087.1053L84.1844%2091.5466C70.0346%2094.5542%2056.1258%2085.5217%2053.1182%2071.3719L47.223%2043.6373Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_8481_102191)'%3e%3cellipse%20cx='63.7775'%20cy='46.8684'%20rx='1.48152'%20ry='1.39438'%20transform='rotate(-12%2063.7775%2046.8684)'%20fill='%23435C71'/%3e%3crect%20x='47.4368'%20y='59.3203'%20width='53.657'%20height='13.2235'%20transform='rotate(-12%2047.4368%2059.3203)'%20fill='url(%23paint2_linear_8481_102191)'/%3e%3crect%20x='51.1907'%20y='76.9824'%20width='53.657'%20height='10.4263'%20transform='rotate(-12%2051.1907%2076.9824)'%20fill='url(%23paint3_linear_8481_102191)'/%3e%3c/g%3e%3cpath%20opacity='0.883952'%20d='M113.939%2051.0679C114.775%2055%20112.265%2058.865%20108.333%2059.7008L107.842%2059.8052C103.639%2060.6986%2099.5073%2058.0155%2098.6139%2053.8123L97.205%2047.1837L105.307%2045.4616C109.239%2044.6259%20113.104%2047.1359%20113.939%2051.0679Z'%20fill='url(%23paint4_linear_8481_102191)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M68.7215%2066.4138C67.1801%2064.8725%2067.6745%2062.2062%2069.587%2061.1603C72.4457%2059.5969%2076.2861%2057.1773%2079.3785%2054.0849C82.4099%2051.0535%2084.752%2047.3461%2086.2775%2044.5465C87.3388%2042.5989%2090.0598%2042.0819%2091.6282%2043.6503C92.4782%2044.5003%2092.758%2045.7623%2092.2604%2046.8566C91.0829%2049.4466%2088.5191%2054.344%2084.4346%2058.4285C80.2853%2062.5778%2074.8639%2065.591%2072.0553%2066.9952C70.9363%2067.5548%2069.6062%2067.2985%2068.7215%2066.4138Z'%20fill='url(%23paint5_linear_8481_102191)'/%3e%3crect%20x='48.7264'%20y='33.7744'%20width='11.2108'%20height='11.2108'%20rx='5.59457'%20transform='rotate(-12%2048.7264%2033.7744)'%20fill='url(%23paint6_linear_8481_102191)'/%3e%3crect%20x='50.0175'%20y='35.8193'%20width='4.0158'%20height='3.84848'%20rx='1.92424'%20transform='rotate(-12%2050.0175%2035.8193)'%20fill='%23435C71'/%3e%3crect%20x='59.2875'%20y='31.5723'%20width='11.2108'%20height='11.2108'%20rx='5.59457'%20transform='rotate(-12%2059.2875%2031.5723)'%20fill='%23FFFEFE'/%3e%3cpath%20opacity='0.883952'%20d='M111.25%2038.5376C110.415%2034.6055%20106.55%2032.0955%20102.618%2032.9313L102.127%2033.0356C97.9234%2033.9291%2095.2403%2038.0607%2096.1337%2042.2639L97.5426%2048.8925L105.644%2047.1705C109.576%2046.3347%20112.086%2042.4696%20111.25%2038.5376Z'%20fill='url(%23paint7_linear_8481_102191)'/%3e%3crect%20x='60.0181'%20y='33.8037'%20width='3.84848'%20height='3.84848'%20rx='1.90724'%20transform='rotate(-12%2060.0181%2033.8037)'%20fill='%23435C71'/%3e%3cpath%20d='M36.9246%2059.1604C36.4487%2060.717%2034.7371%2061.6271%2033.1805%2061.1512C32.3613%2060.9007%2031.7241%2060.3475%2031.3259%2059.5987L25.2059%2046.7983C24.9784%2046.3703%2025.1286%2045.8788%2025.5566%2045.6513L28.338%2044.1724C28.7659%2043.9449%2029.2574%2044.0951%2029.4849%2044.5231L36.6496%2056.8367C37.0728%2057.5036%2037.15%2058.423%2036.9246%2059.1604Z'%20fill='%23FFDF9F'/%3e%3crect%20x='27.9973'%20y='44.333'%20width='2.39869'%20height='3.59807'%20transform='rotate(152%2027.9973%2044.333)'%20fill='%23FF9090'/%3e%3cpath%20d='M26.6628%2044.3769L26.9472%2044.9118L28.0169%2044.343L26.3106%2041.1338L24.171%2042.2714L25.0243%2043.876C25.6661%2043.5347%2026.3215%2043.7351%2026.6628%2044.3769Z'%20fill='%23FFB19F'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.26386%2027.248C9.3428%2020.4481%2016.5101%2016.6372%2023.31%2018.7161C30.11%2020.7951%2033.9209%2027.9624%2031.8419%2034.7623C29.763%2041.5622%2022.5956%2045.3731%2015.7958%2043.2942C8.99587%2041.2152%205.18493%2034.0479%207.26386%2027.248ZM9.72157%2027.9983C8.06843%2033.4055%2011.1399%2039.1821%2016.5471%2040.8352C21.9543%2042.4884%2027.7309%2039.4168%2029.384%2034.0096C31.0372%2028.6024%2027.9657%2022.8258%2022.5585%2021.1727C17.1513%2019.5196%2011.3747%2022.5911%209.72157%2027.9983Z'%20fill='%23FFE69F'/%3e%3ccircle%20opacity='0.414016'%20cx='19.5529'%20cy='31.0039'%20r='10.2804'%20transform='rotate(17%2019.5529%2031.0039)'%20fill='%23BBDEFC'/%3e%3cpath%20d='M14.3685%2030.6746C15.7299%2027.6867%2018.9391%2025.9803%2022.1776%2026.5225L22.2595%2026.5475C23.7024%2026.8095%2024.3854%2024.8682%2023.1497%2024.2218C22.3806%2023.8074%2021.5613%2023.557%2020.717%2023.3884C17.3715%2022.9031%2014.0553%2024.6664%2012.6939%2027.6543C12.2796%2028.4235%2012.0859%2029.3497%2012.0244%2030.1372C11.8444%2031.6051%2013.8607%2032.0424%2014.4503%2030.6997C14.3434%2030.7566%2014.3685%2030.6746%2014.3685%2030.6746Z'%20fill='%23F6FBFF'/%3e%3cpath%20d='M10.2904%2029.0679C11.9436%2023.6607%2017.7202%2020.5893%2023.1274%2022.2424C25.6671%2023.0189%2027.5785%2024.6783%2028.9301%2026.704C27.7539%2024.1048%2025.508%2022.0744%2022.5586%2021.1727C17.1514%2019.5196%2011.3748%2022.591%209.72165%2027.9982C8.81993%2030.9476%209.32924%2033.97%2010.7444%2036.3735C9.82081%2034.1203%209.51395%2031.6077%2010.2904%2029.0679Z'%20fill='%23ADCBE7'/%3e%3cpath%20opacity='0.406087'%20d='M36.4864%2056.8021L36.1373%2056.2691C36.3845%2056.8563%2036.428%2057.5516%2036.2372%2058.1754C35.9273%2059.189%2034.5593%2059.1971%2034.0713%2058.2806L28.3787%2047.5877C28.0534%2046.9767%2027.3508%2046.7619%2026.7395%2047.0866L25.7206%2047.6277L31.4395%2059.3516C31.7648%2059.9627%2032.27%2060.5434%2032.8706%2060.8123C33.7054%2061.1528%2034.6593%2061.1034%2035.3726%2060.7247C36.0858%2060.3459%2036.6602%2059.5837%2036.8444%2058.7021C37.0351%2058.0783%2036.8117%2057.4132%2036.4864%2056.8021Z'%20fill='white'/%3e%3cpath%20d='M29.8826%2048.4977C29.8006%2048.4726%2029.6368%2048.4225%2029.5799%2048.3155L28.1579%2045.6411C28.0442%2045.4272%2028.1193%2045.1814%2028.3332%2045.0677C28.5472%2044.9539%2028.7929%2045.0291%2028.9067%2045.243L30.3287%2047.9174C30.4424%2048.1313%2030.3673%2048.3771%2030.1534%2048.4908C30.1284%2048.5728%2029.9645%2048.5227%2029.8826%2048.4977Z'%20fill='%23FFF5EB'/%3e%3cellipse%20cx='29.2637'%20cy='54.631'%20rx='1.50593'%20ry='3.17918'%20transform='rotate(-23%2029.2637%2054.631)'%20fill='%23FFC478'/%3e%3cellipse%20cx='34.0592'%20cy='52.4078'%20rx='0.920288'%20ry='1.67325'%20transform='rotate(106%2034.0592%2052.4078)'%20fill='%23FFC478'/%3e%3cpath%20d='M89.1282%2019.2055L68.2257%2026.8725L45.9197%2028.3898L44.4929%2016.4082C44.3371%2013.798%2047.5283%2011.4502%2050.9859%2011.6309L65.1429%2012.369L67.3969%2012.4869C68.5309%2012.5463%2069.7066%2012.3289%2070.7522%2011.8627L78.6899%208.34726C81.725%206.99992%2085.3012%207.87475%2086.2125%2010.1876L89.1282%2019.2055Z'%20fill='url(%23paint8_linear_8481_102191)'/%3e%3cpath%20opacity='0.479771'%20d='M88.6262%2019.0953L68.3101%2026.5288L65.3314%2012.5149L67.5211%2012.6263C68.6228%2012.6824%2069.7652%2012.471%2070.7816%2012.0192L78.4972%208.61266C81.4474%207.30707%2084.9208%208.14856%2085.8036%2010.3829L88.6262%2019.0953Z'%20fill='%23ADCBE7'/%3e%3cpath%20d='M91.6332%2026.6212L46.9517%2036.1186L46.0387%2028.4438L89.2535%2019.2582L91.6332%2026.6212Z'%20fill='%23717DAD'/%3e%3cpath%20d='M102.961%2024.2033C103.125%2024.9722%20102.371%2025.7829%20101.278%2026.015L37.9675%2039.4722C36.8754%2039.7043%2035.8568%2039.2704%2035.6933%2038.5015C35.5301%2037.7336%2036.284%2036.922%2037.3761%2036.6898L100.687%2023.2327C101.779%2023.0005%20102.798%2023.4354%20102.961%2024.2033Z'%20fill='%239ED1FF'/%3e%3cpath%20d='M102.703%2024.1718C102.838%2024.805%20102.067%2025.5045%20100.983%2025.7349L69.5583%2032.4144L69.0712%2030.123L100.496%2023.4436C101.58%2023.2131%20102.569%2023.5394%20102.703%2024.1718Z'%20fill='%2378AFE1'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_8481_102191'%20x1='32.2665'%20y1='59.6553'%20x2='59.0518'%20y2='60.5906'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFDE0'/%3e%3cstop%20offset='1'%20stop-color='%23FFB362'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_8481_102191'%20x1='67.3434'%20y1='85.966'%20x2='103.216'%20y2='78.3411'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFABC'/%3e%3cstop%20offset='1'%20stop-color='%23FFA650'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_8481_102191'%20x1='51.4347'%20y1='74.8197'%20x2='91.1539'%20y2='74.8197'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A3C1FF'/%3e%3cstop%20offset='1'%20stop-color='%234243FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_8481_102191'%20x1='55.1887'%20y1='89.2031'%20x2='94.9078'%20y2='89.2031'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A3C1FF'/%3e%3cstop%20offset='1'%20stop-color='%234243FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_8481_102191'%20x1='94.5023'%20y1='53.1799'%20x2='106.762'%20y2='58.7056'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9498'/%3e%3cstop%20offset='1'%20stop-color='%23FFD671'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_8481_102191'%20x1='74.9906'%20y1='66.9871'%20x2='94.9778'%20y2='46.9999'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFDE0'/%3e%3cstop%20offset='1'%20stop-color='%23FFB362'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_8481_102191'%20x1='50.5805'%20y1='44.0581'%20x2='59.9372'%20y2='44.0581'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='%23E3EEF3'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear_8481_102191'%20x1='88.4187'%20y1='43.3906'%20x2='99.3981'%20y2='25.1833'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9498'/%3e%3cstop%20offset='1'%20stop-color='%23FFD671'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear_8481_102191'%20x1='56.4985'%20y1='29.5482'%20x2='100.532'%20y2='20.1885'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23ECF7FF'/%3e%3cstop%20offset='1'%20stop-color='%23C2E0FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",q_=()=>u.jsxs(l.Box,{justifyItems:"center",marginTop:"40px",children:[u.jsx("img",{src:J_,width:124,height:107}),u.jsx(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray3,children:y_})]}),Q_=({searchResults:e,selectedObject:t,onReset:n,fetchCards:r})=>{const o=$t(),{sendTrackingEvent:s,currentSmIds:a}=I.useContext(Ge),[i,c]=I.useState(null),d=nt(m_,{count:e.length.toString(),countSuffix:e.length>1?"s":"",searchObject:t.objectName,connectorName:t.connectorName}),f=(E,b)=>{s(p4,{search_keyword:t.label,search_result_label:b,sm_ids:a,connector_name:t.connectorName}),c({externalResourceId:E,formId:t.value.toString(),searchKeyword:t.label,searchResultLabel:b})},g=()=>{c(null),o(Sv())},y=()=>{n(),r(),g()};return e.length?i?u.jsx(Y_,{meta:i,onBack:g,onLink:y}):u.jsxs(l.Stack,{gap:"14px",marginTop:"12px",children:[u.jsx(l.Typography,{variant:"body2",children:d}),u.jsx(l.Stack,{gap:"17px",children:e==null?void 0:e.map(({externalResourceId:E,name:b,description:h})=>u.jsxs(d2,{onClick:()=>f(E,b),direction:"row",children:[u.jsxs(l.Stack,{flexGrow:1,children:[u.jsx(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray1,children:b}),u.jsx(l.Typography,{variant:"caption",color:l.theme.palette.gray.gray3,children:h})]}),u.jsx(l.Box,{alignSelf:"center",className:"search-item__chevron",width:"20px",height:"20px",children:u.jsx("img",{src:H_})})]},E))})]}):u.jsx(q_,{})},yl=l.styled(l.Skeleton)`
2488
2488
  display: block;
2489
2489
  margin: ${e=>e.margin?e.margin:0};
2490
- `,$_=()=>u.jsxs(l.Stack,{marginTop:"12px",children:[u.jsx(yl,{variant:"rounded",width:"50%",height:"16px",animation:"wave",margin:"0 0 18px 0"}),u.jsx(l.Stack,{gap:"17px",children:u.jsxs(d2,{gap:"8px",disableHover:!0,children:[u.jsx(yl,{variant:"rounded",width:"30%",height:"16px",animation:"wave"}),u.jsx(yl,{variant:"rounded",width:"70%",height:"16px",animation:"wave"})]})})]});let xl={};const Cl=new Set,U_=(e,t)=>{xl={...xl,[e]:t},Cl.forEach(n=>n())},K_=e=>(Cl.add(e),()=>Cl.delete(e)),eS=e=>I.useSyncExternalStore(K_,()=>xl)[e],tS=async({id:e,searchString:t,args:n})=>{try{if(e===void 0||t===void 0)return[];const r=await ve({url:M_.replace(":formId",e.toString()),method:Oe.POST,data:{search_string:t,args:n}});let o=null;return r!=null&&r.data&&"data"in r.data&&(o=r.data.data),o}catch(r){Te({message:wn,type:Je}),console.error(r)}},nS=(e,t)=>Xt({mutationFn:tS,onMutate:({searchString:n,connectorName:r})=>{e(n,r)},onSuccess:(n,{searchString:r,connectorName:o})=>{t(r,n,o)}}),El={OPEN_FORM_VIEW:"connector-agent-open-form-view"},rS=(e,t={})=>{const{delayAfterLoad:n=1e3}=t,r=I.useRef(!1),o=I.useRef(void 0),s=I.useCallback((c="auto")=>{const d=e.current;d&&d.scrollIntoView({behavior:c})},[e]),a=I.useCallback((c,d="smooth")=>{r.current||(o.current!==void 0&&clearTimeout(o.current),c&&(o.current=setTimeout(()=>{s(d),r.current=!0},n)))},[s,n]),i=I.useCallback(()=>{r.current=!1,o.current!==void 0&&clearTimeout(o.current)},[]);return I.useEffect(()=>()=>{o.current!==void 0&&clearTimeout(o.current)},[]),{scrollOnceAfterLoad:a,resetScrollState:i,hasScrolledOnce:r.current}},oS=e=>A.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.86993 0.652446C7.56922 0.248711 8.43078 0.248711 9.13007 0.652446L13.7981 3.34755C14.4974 3.75129 14.9282 4.49742 14.9282 5.30489V10.6951C14.9282 11.5026 14.4974 12.2487 13.7981 12.6524L9.13007 15.3476C8.43078 15.7513 7.56922 15.7513 6.86993 15.3476L2.20187 12.6524C1.50258 12.2487 1.0718 11.5026 1.0718 10.6951V5.30489C1.0718 4.49742 1.50258 3.75129 2.20187 3.34755L6.86993 0.652446Z",fill:"#FFD122"}),A.createElement("g",{filter:"url(#filter0_d_360_39563)"},A.createElement("path",{d:"M5.83154 4.43359V4.43359C6.84296 4.43359 7.66287 5.25351 7.66287 6.26492V11.5179V11.5179C6.65146 11.5179 5.83154 10.698 5.83154 9.68661V4.43359Z",fill:"white"})),A.createElement("g",{filter:"url(#filter1_d_360_39563)"},A.createElement("path",{d:"M8.57812 7.66211V7.66211C9.58954 7.66211 10.4095 8.48202 10.4095 9.49343V11.7103V11.7103C9.39804 11.7103 8.57812 10.8904 8.57812 9.87898V7.66211Z",fill:"white"})),A.createElement("defs",null,A.createElement("filter",{id:"filter0_d_360_39563",x:4.76488,y:3.36693,width:3.96488,height:9.21732,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},A.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),A.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),A.createElement("feOffset",null),A.createElement("feGaussianBlur",{stdDeviation:.533333}),A.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),A.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),A.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})),A.createElement("filter",{id:"filter1_d_360_39563",x:7.51146,y:6.59544,width:3.96488,height:6.18216,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},A.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),A.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),A.createElement("feOffset",null),A.createElement("feGaussianBlur",{stdDeviation:.533333}),A.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),A.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),A.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})))),sS="/v1/api/connectors/lookup/bulk",aS="/v1/api/connectors/lookup/bulk",iS=async e=>{const t=new URLSearchParams;e.forEach(o=>t.append("connector_ids",o));const n=`${sS}?${t.toString()}`,r=await ve({url:n,method:Oe.GET});return r==null?void 0:r.data},cS=async e=>{const t=await ve({url:aS,method:Oe.PUT,data:{entries:e}});return t==null?void 0:t.data},lS={fontSize:"14px",width:"209px",height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"}},uS={border:`1px solid ${l.theme.palette.gray.gray5}`,borderRadius:"8px",padding:"12px"},f2={flex:1,height:"1px",backgroundColor:l.theme.palette.gray.gray6},dS={flexShrink:0,border:`1px solid ${l.theme.palette.gray.gray6}`,borderRadius:"15px"},fS={border:`1px solid ${l.theme.palette.gray.gray6}`,backgroundColor:l.theme.palette.gray.gray6a,borderRadius:"8px",padding:"8px 10px"},pS=I.memo(function({connector:t,selectedHiverParam:n,onChange:r,sendTrackingEvent:o}){var i;const s=((i=(t.presets??[]).find(c=>c.hiverParam===n))==null?void 0:i.objectParamLabel)??"",a=I.useCallback(c=>{o(E4,{hiver_param:c.target.value,connector_name:t.connectorName,page:"agent_connector_panel"}),r(t.connectorId,c.target.value)},[t.connectorId,t.connectorName,r,o]);return u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"0px",justifyContent:"space-between",children:[u.jsx(l.Select,{value:n,onChange:a,size:"small",variant:"outlined",sx:lS,MenuProps:{sx:{zIndex:1500}},renderValue:c=>{var f;const d=((f=(t.presets??[]).find(g=>g.hiverParam===c))==null?void 0:f.label)??"";return u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(oS,{width:18,height:18}),u.jsx("span",{children:d})]})},children:(t.presets??[]).map(c=>u.jsx(l.MenuItem,{value:c.hiverParam,sx:{fontSize:"14px"},children:c.label},c.hiverParam))}),u.jsx(l.Box,{sx:f2}),u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"4px",padding:"4px 12px",sx:dS,children:[t.logo&&u.jsx("img",{src:t.logo,width:16,height:16,alt:t.connectorName}),u.jsxs(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray3,children:["Matches with ",t.connectorName,"'s"]})]}),u.jsx(l.Box,{sx:f2}),u.jsx(l.Box,{sx:fS,children:u.jsx(l.Typography,{variant:"body2",fontSize:14,children:s})})]})}),hS=I.memo(function({open:t,onClose:n,connectors:r,onSaveSuccess:o}){const{sendTrackingEvent:s}=I.useContext(Ge),[a,i]=I.useState({});I.useEffect(()=>{if(t&&r.length>0){const b={};r.filter(h=>{var p;return((p=h.presets)==null?void 0:p.length)>1}).forEach(h=>{b[h.connectorId]=h.hiverParam}),i(b)}},[t,r]);const c=ur(),{mutate:d,isPending:f}=Xt({mutationFn:cS,onSuccess:b=>{const h={};b.results.forEach(({connectorId:p,hiverParam:m})=>{h[p]=m}),c.setQueriesData({queryKey:["lookup","bulk"]},p=>p&&{...p,connectors:p.connectors.map(m=>h[m.connectorId]!==void 0?{...m,hiverParam:h[m.connectorId]}:m)}),s(v4,{page:"agent_connector_panel"}),Te({message:"Identity mapping saved successfully",type:"success"}),o==null||o(),n()},onError:()=>{Te({message:"Failed to save identity mapping",type:"error"})}}),g=I.useCallback(()=>{const b=Object.entries(a).map(([h,p])=>({connector_id:h,hiver_param:p}));d(b)},[a,d]),y=I.useCallback((b,h)=>{i(p=>({...p,[b]:h}))},[]),E=I.useCallback(b=>{b||n()},[n]);return u.jsx(Sr,{shown:t,setShown:E,showCloseButton:!1,children:u.jsxs(l.Stack,{padding:"24px 20px",gap:"16px",sx:{minWidth:"800px"},children:[u.jsx(l.Typography,{variant:"h2",children:"Customer identity mapping"}),u.jsx(l.Typography,{variant:"body2",children:"Choose how Hiver should identify customers when fetching data from connected apps."}),r.some(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1})&&u.jsx(l.Stack,{gap:"8px",sx:uS,children:r.filter(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1}).map(b=>u.jsx(pS,{connector:b,selectedHiverParam:a[b.connectorId]??b.hiverParam,onChange:y,sendTrackingEvent:s},b.connectorId))}),u.jsxs(l.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:[u.jsx(l.Button,{variant:"text",onClick:n,children:"Cancel"}),u.jsx(l.Button,{variant:"contained",onClick:g,disabled:f,children:"Save"})]})]})})}),gS=({enabled:e,...t})=>{const{actionQueue:n}=I.useContext(Ge);n&&e&&n.register(t),I.useEffect(()=>{if(n)return()=>{n.destroy()}},[n,e])},mS=({isAdmin:e=!1})=>{var mt,Fn;const{email:t,currentSmIds:n,sendTrackingEvent:r,availableFeatures:o,conversationId:s,connectorId:a}=I.useContext(Ge),i=$t(),{userGroupId:c,userId:d}=Mt()||{},f=I.useRef(!1),g=I.useRef(null),y=I.useRef(null),E=I.useRef(null),[b,h]=I.useState({}),[p,m]=I.useState(!1),[x,C]=I.useState(!1),[w,v]=I.useState(!1),[_,T]=I.useState(!1),[S,L]=I.useState(),[R,D]=I.useState(!1),[F,M]=I.useState(null),[B,G]=I.useState(),[J,Z]=I.useState(null),[H,Y]=I.useState(!1),[U,ee]=I.useState(!1),[V,q]=I.useState(!1),[N,X]=I.useState(!1),[Q,ne]=I.useState(void 0),ce=I.useRef(),P=_e(uw),re=_e(dw),xe=_e(pw),z=_e(hw),Ae=_e(mw),Ve=_e(fw),He=_e(L1),rn=_e(Lw),xn=_e(O1),Ke=_e(k1),it=_e(F1),qe=_e(DI),Mr=tt(o,S4),Bt=tt(o,Sd),Kn=tt(o,F4),er=tt(o,N4),tr=tt(o,R4),nr=tt(o,M4),gt=(mt=Mt())==null?void 0:mt.tenantPlatform,Ln=tt(o,gt==="HIVERWEB"?`hot-${Td}`:Td),{data:Pr}=zt({queryKey:["connectors","enabledAuthenticated"],queryFn:()=>nf(),enabled:Ln&&e}),On=I.useMemo(()=>(Pr??[]).map(se=>se.id),[Pr]),{data:Vt,isSuccess:hs}=zt({queryKey:["lookup","bulk",On.join(",")],queryFn:()=>iS(On),enabled:On.length>0&&Ln&&e,refetchOnMount:!1}),Gt=hs&&((Vt==null?void 0:Vt.connectors)??[]).some(se=>{var me;return(((me=se.presets)==null?void 0:me.length)??0)>1});gS({conversationId:s,openCreateForm:()=>v(!0),enabled:re});const rr=I.useMemo(()=>!P||!P.length?null:Cw(P,xe,z),[P,xe,z]),kn=K4(xe),{data:_o,isLoading:Ht}=l2({senderEmail:t,conversationId:String(s),enabled:er&&!!t}),{emailHeaders:So,selectedEmail:or}=_o??{},{scrollOnceAfterLoad:sr,resetScrollState:on}=rS(y),ar=Ve!==te.LOADING&&(!z||!Object.values(z).some(se=>se===te.LOADING))&&P&&P.length>0;I.useLayoutEffect(()=>{var se;H&&!p&&U&&((se=E==null?void 0:E.current)!=null&&se.scrollHeight)&&sr(!!ar,"smooth")},[H,p,U,ar,sr,(Fn=E==null?void 0:E.current)==null?void 0:Fn.scrollHeight,d]);const jr=(se,me)=>{r(u4,{search_keyword:se,sm_ids:n,connector_name:me,suggestion_type:qe})},To=(se,me,ot)=>{!Array.isArray(me)||!me.length?r(d4,{search_keyword:se,sm_ids:n,connector_name:ot,suggestion_type:qe}):me.length&&r(f4,{num_of_results:me.length,search_keyword:se,sm_ids:n,connector_name:ot,suggestion_type:qe})},{mutate:gs,reset:Br,data:ms,isPending:Vr,isIdle:Gr}=nS(jr,To),Hr=I.useCallback(()=>{Br(),M(null)},[Br,M]),pe=ur(),ge=I.useCallback(()=>{if(t&&n.length&&s){const se=i(Ya({inboxIds:n,conversationId:s,connectorId:a}));return()=>se.abort()}},[i,t,n,s,a]),Qe=I.useCallback(()=>{pe.invalidateQueries({queryKey:["lookup","bulk"]}),ge()},[pe,ge]),ct=I.useCallback((se,me)=>{se&&s&&me&&i(Xa({id:se,channelType:"email",conversationId:s,externalResourceId:me,contactEmail:t})).unwrap().catch(()=>{i(lo(null))})},[i,s,t]);if(I.useEffect(()=>{(async()=>{d&&(Y(await Ii(d)),ee(await xu(d)))})()},[d]),I.useEffect(()=>{Ht||G(or||t)},[t,or,Ht]),I.useEffect(()=>{B&&s&&U_(String(s),B)},[B,s]),I.useEffect(()=>{U&&d&&Cu(d)},[U,d]),I.useEffect(()=>{var se;if(Ke){C(!0);const{externalResourceId:me}=Ke,ot=(se=Ke.forms.find(an=>an.type==="edit"))==null?void 0:se.id;ct(ot,me)}else C(!1),i(sw())},[Ke,ct,i]),I.useEffect(()=>(ge(),on(),()=>{i(T1.clearConnectorList())}),[i,ge,on]),I.useEffect(()=>{var se;if(Ae&&P&&P.length&&rr&&!f.current){const{cards_per_app:me,total_empty_cards:ot,total_cards_with_errors:an}=rr,Ua=a?(se=me[0])==null?void 0:se.app_name:null;r(V3,{numOfCards:P.length,total_cards_loaded:P.length,total_empty_cards:ot,total_cards_with_errors:an,cards_per_app:me,sm_ids:n,...Ua?{app_name:Ua}:null}),f.current=!0}return()=>{f.current=!1}},[Ae,P,rr,r,n,a]),I.useEffect(()=>{if(s&&n&&n.length){const se=i(Ga({inboxIds:n,conversationId:s,channelType:"email",isExpandedFormEnabled:nr,connectorId:a}));return()=>se.abort()}},[i,n,s,nr,a]),I.useEffect(()=>{const se=me=>{var an;if(!(me instanceof CustomEvent))return;const ot=(an=me.detail)==null?void 0:an.connectorKey;h({connectorKey:ot})};return window.addEventListener(El.OPEN_FORM_VIEW,se),()=>{window.removeEventListener(El.OPEN_FORM_VIEW,se)}},[]),I.useEffect(()=>{if(!(He!=null&&He.length)||!b.connectorKey)return;const se=b.connectorKey;h({});const me=He.find(ot=>{var an;return((an=ot.connectorKey)==null?void 0:an.toLowerCase())===(se==null?void 0:se.toLowerCase())});me&&(Z(me),v(!0))},[He,b]),!t.length||Ve===te.LOADING)return u.jsx(yI,{});const Nt=se=>{r(z3,{connector_name:rn,source:se,sm_ids:n})},sn=se=>{v(!0),Nt(se)},St=()=>{T(!0),O(vd),W(Id),r(X3)},O=se=>{r(se,S),it?D(!0):(v(!1),Z(null))},W=se=>{if(Ke){const{connectorName:me,title:ot}=Ke;r(se,{connector_name:me,card_title:ot,sm_ids:n,ug_id:c})}it?D(!0):i(lo(null))},$=()=>{v(!1),i(lo(null)),L(void 0),D(!1)},oe=()=>{ge(),v(!1),C(!1),i(T1.clearConnectorList())},we=[{label:"Go back",variant:"text",action:$},{label:"Stay",variant:"contained",action:()=>D(!1)}],Ie=He.length>0,Ce=xn.length>0,Ee=w||x||_,lt=()=>Ie||Ce?u.jsx(c_,{haveCreateObjects:Ie,haveLinkObjects:Ce,onCreateClick:()=>sn(jd.MAIN_BUTTON),onLinkClick:()=>T(!0)}):u.jsx(M1,{isAdmin:e,hideHeading:!0}),We=()=>{q(!0);const se=ce.current,me=se==null?void 0:se.connectorName,ot=se==null?void 0:se.name;r(w4,{entry_point:"agent",app_name:me,object_type:ot})},Ye=se=>{ce.current=se};return u.jsxs(Jd,{ref:g,"data-testid":Array.isArray(P)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:w||_,children:[u.jsx(U1,{shown:R,setShown:D,title:qv,description:Qv,buttons:we}),u.jsx(Fb,{onWheel:()=>m(!0),ref:E,children:re?u.jsxs(u.Fragment,{children:[u.jsx(u5,{connectors:kn,isWriteFlowEnabled:Bt,haveCreateObjects:Ie,haveLinkObjects:Ce,cards:P,handleCreateNewObject:()=>sn(jd.ICON),handleLinkNewObject:St}),Kn&&!Ee?u.jsx(G_,{selectedObject:F,setSelectedObject:M,fetchSearchResults:gs,onReset:Hr,root:g.current}):null,u.jsxs(uo,{children:[u.jsx(_n,{condition:Kn&&Vr,children:u.jsx($_,{})},"search"),u.jsx(_n,{condition:Kn&&!!F&&!Gr,children:u.jsx(Q_,{searchResults:ms??[],selectedObject:F,onReset:Hr,fetchCards:ge})},"results"),u.jsx(_n,{condition:w,children:u.jsx(hl,{onClose:()=>O(vd),title:ec,rightNode:u.jsx(r_,{formId:Q,conversationId:s,inboxIds:n,enabled:w&&!!Q&&!!e,setMapFormOpen:We}),children:u.jsx(e2,{onClose:()=>O($3),onCreateSuccess:oe,metaData:S,setMetaData:L,defaultOption:J,connectors:kn,mapFormOpen:V,setMapFormOpen:q,setCreateFormId:ne,syncCurrentObject:Ye})})},"create-form"),u.jsx(_n,{condition:x,children:u.jsx(hl,{onClose:()=>W(Id),title:z4,backButtonTooltip:"Back",children:u.jsx(e2,{isEdit:!0,onClose:()=>W(r4),onCreateSuccess:oe,metaData:S,setMetaData:L,connectors:kn})})},"edit-form"),u.jsx(_n,{condition:_,children:u.jsx(hl,{onClose:()=>T(!1),children:u.jsx(n_,{setOpenTaskLinking:T,onLinkingSuccess:ge})})},"link-form"),u.jsxs(_n,{fallback:!0,children:[er&&(P!=null&&P.length)?u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(l.Stack,{sx:{flex:1,minWidth:0},children:u.jsx(AI,{emailHeaders:So,selectedEmail:B,root:g.current,isLoading:Ht,setSelectedEmail:G})}),Ln&&Gt&&e&&u.jsx(l.Tooltip,{title:"Update customer identity mapping",placement:"top",children:u.jsx(l.IconButton,{"aria-label":"Open customer identity mapping settings",sx:{height:"32px",width:"32px",marginTop:"12px",flexShrink:0},onClick:()=>{r(_d,{page:"agent_connector_panel"}),X(!0)},children:u.jsx(l.icons.SettingsOutlined,{sx:{height:"20px",width:"20px"}})})})]}):null,!er&&Ln&&Gt&&e&&(P!=null&&P.length)?u.jsx(l.Button,{fullWidth:!0,variant:"contained",startIcon:u.jsx(l.icons.SettingsOutlined,{sx:{height:"14px",width:"14px"}}),sx:{backgroundColor:"#edf1f6",color:"#4d596c",borderRadius:"6px",padding:"9px 12px",marginTop:"12px",textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"20px",boxShadow:"none","&:hover":{backgroundColor:"#e2e8f0",boxShadow:"none"}},onClick:()=>{r(_d,{page:"agent_connector_panel"}),X(!0)},children:"Customer identity mapping"}):null,Mr?u.jsx(xI,{}):null,u.jsxs(uo,{children:[u.jsxs(_n,{condition:!!P&&P.length>0,children:[u.jsx(Xw,{cards:P,specificCardData:xe,email:B??"",specificConnectorApiStatus:z,onCardUnlinking:ge}),u.jsx("div",{ref:y,children:tr?u.jsx(db,{connectors:kn,expanded:H}):null})]},"cards-list"),u.jsx(_n,{condition:!(P!=null&&P.length)&&Bt,children:lt()},"create-banner")]})]},"cards")]})]}):u.jsx(M1,{isAdmin:e})}),!re&&u.jsx(wb,{}),Ln&&u.jsx(hS,{open:N,onClose:()=>X(!1),connectors:(Vt==null?void 0:Vt.connectors)??[],onSaveSuccess:Qe})]})},bS=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:r={},currentSmIds:o=[],userEmail:s,metaData:a,availableFeatures:i,conversationId:c,connectorFunctions:d,stackingContext:f,isAdmin:g=!1,actionQueue:y,store:E,connectorId:b,variables:h})=>{const p=I.useMemo(()=>({userEmail:s,email:n,baseUrls:r,currentSmIds:o,metaData:a,conversationId:c,sendTrackingEvent:t||(()=>{}),availableFeatures:i,isAdmin:g,connectorFunctions:d,stackingContext:f,actionQueue:y,store:E,connectorId:b,variables:h}),[s,n,r,t,o,a,i,c,g,d,f,y,E,b,h]);return u.jsx(Ge.Provider,{value:p,children:e})},vl=({children:e})=>{const[t]=I.useState(()=>new mh);return u.jsx(Eh,{client:t,children:e})},yS=u0({cardList:Sw,write:aw,common:Av}),wl=Oy({reducer:yS,devTools:!0}),xS=({children:e,userEmail:t,extraParams:n,contactEmail:r,baseUrls:o,availableFeatures:s,connectorFunctions:a,stackingContext:i,actionQueue:c,store:d,connectorId:f})=>u.jsx(dc,{store:wl,children:u.jsx(l.HiverProvider,{inter:!0,children:u.jsx(vl,{children:u.jsx(bS,{...n,userEmail:t,availableFeatures:s,sendTrackingEvent:n==null?void 0:n.sendTrackingEvent,contactEmail:r,currentSmIds:n==null?void 0:n.currentSmIds,metaData:n==null?void 0:n.metaData,conversationId:n==null?void 0:n.conversationId,baseUrls:o,connectorFunctions:a,stackingContext:i,actionQueue:c,isAdmin:n==null?void 0:n.isAdmin,store:d,connectorId:f,children:u.jsx(I.Suspense,{fallback:u.jsx(u.Fragment,{}),children:e})})})})}),CS=({userEmail:e="",contactEmail:t="",baseUrls:n={},extraParams:r={},availableFeatures:o={},connectorFunctions:s,stackingContext:a={},actionQueue:i,store:c})=>{const[d,f]=I.useState(void 0);return I.useEffect(()=>{if(!c)return;const g=c.subscribe(y=>{f(y)},"connectorId");return()=>g()},[c]),u.jsx(ua,{children:u.jsxs(xS,{userEmail:e,availableFeatures:o,extraParams:r,contactEmail:t,connectorFunctions:s,stackingContext:a,actionQueue:i,baseUrls:n,store:c,connectorId:d,children:[u.jsx(mS,{isAdmin:r==null?void 0:r.isAdmin},d||"root"),u.jsx(da,{zIndex:a.toastMessage}),u.jsx("div",{"data-connectorid":"connector-layover-portal"})]})})},p2="/v1/api",ES=`${p2}/connector/conversation/:conversationId/data`,vS=`${p2}/connector/feedback/conversation/:conversationId`,wS=async(e,t)=>{try{let n=ES.replace(":conversationId",e)+"?channel_type=email";if(t!=null&&t.length){const o=t.map(s=>`inbox_ids=${encodeURIComponent(s)}`).join("&");n+=`&${o}`}const r=await ve({url:n,method:Oe.GET});return r!=null&&r.data&&Array.isArray(r.data)?r.data.reduce((s,a)=>{var i,c;return s[(i=a==null?void 0:a.cardData)==null?void 0:i.textToHighlight]||(s[(c=a==null?void 0:a.cardData)==null?void 0:c.textToHighlight]={...a}),s},{}):null}catch(n){return Promise.reject(n)}};function IS(e,t,n){return zt({queryKey:["connector-analytics",e,t,n],queryFn:async()=>!t||!e?null:await wS(e,n),enabled:!!t&&!!e})}class _S{constructor(t=[],n=null){Pe(this,"highlightTerms");Pe(this,"observer");Pe(this,"isHighlighting");Pe(this,"debounceTimer");Pe(this,"debounceDelay");Pe(this,"onHighlightsUpdated");this.highlightTerms=t,this.observer=null,this.isHighlighting=!1,this.debounceTimer=null,this.debounceDelay=500,this.onHighlightsUpdated=n,this.init()}init(){this.highlightAllEmails(),this.startObserver()}startObserver(){const t=this.findGmailContainer();if(!t){console.warn("Gmail container not found");return}this.observer=new MutationObserver(n=>{if(this.isHighlighting)return;let r=!1;n.forEach(o=>{o.type==="childList"&&Array.from(o.addedNodes).some(i=>{var c,d,f,g;return i.nodeType===1&&i instanceof Element&&(((c=i.classList)==null?void 0:c.contains("a3s"))||((d=i.classList)==null?void 0:d.contains("ii"))||((f=i.querySelector)==null?void 0:f.call(i,".a3s"))||((g=i.querySelector)==null?void 0:g.call(i,"h2.hP")))})&&(r=!0)}),r&&this.debounceHighlight()}),this.observer.observe(t,{childList:!0,subtree:!0})}findGmailContainer(){return document.querySelector('[role="main"]')||document.querySelector(".nH.if")||document.querySelector(".AO")||document.body}debounceHighlight(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.highlightAllEmails()},this.debounceDelay)}highlightAllEmails(){var t;if(this.highlightTerms.length!==0){this.isHighlighting=!0;try{if(this.clearHighlights(),["h2.hP",".ii.gt .a3s.aiL",".ii.gt .a3s",'[data-expanded="true"]'].forEach(r=>{document.querySelectorAll(r).forEach(s=>{this.isElementVisible(s)&&this.highlightInElement(s)})}),this.onHighlightsUpdated){const r=Array.from(document.querySelectorAll(".gmail-highlight"));(t=this.onHighlightsUpdated)==null||t.call(this,r)}}finally{setTimeout(()=>{this.isHighlighting=!1},250)}}}isElementVisible(t){const n=t;return n.offsetParent!==null&&n.offsetWidth>0&&n.offsetHeight>0}highlightInElement(t){if(!t||this.highlightTerms.length===0||t.dataset.highlightProcessed==="true")return;const r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:a=>a.parentElement&&a.parentElement.classList.contains("gmail-highlight")||a.parentElement&&["SCRIPT","STYLE"].includes(a.parentElement.tagName)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),o=[];let s;for(;s=r.nextNode();)o.push(s);o.forEach(a=>{this.highlightInTextNode(a)}),t.dataset.highlightProcessed="true"}highlightInTextNode(t){let n=t.textContent,r=!1;if(!n)return;if([...this.highlightTerms].sort((s,a)=>a.length-s.length).forEach(s=>{if(!s||s.trim().length===0)return;const a=this.escapeRegex(s.trim()),i=new RegExp(`\\b${a}\\b`,"gi");i.test(n)&&(n=n.replace(i,`<span class="gmail-highlight" data-highlight-term="${s.trim()}"><span class="gmail-highlight-inner">${s}</span></span>`),r=!0)}),r&&t.parentNode){const s=document.createElement("span");s.innerHTML=n,t.parentNode.replaceChild(s,t)}}clearHighlights(){document.querySelectorAll(".gmail-highlight").forEach(r=>{const o=r.parentNode;o&&r.textContent&&(o.replaceChild(document.createTextNode(r.textContent),r),o.normalize())}),document.querySelectorAll('[data-highlight-processed="true"]').forEach(r=>{delete r.dataset.highlightProcessed})}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}refreshHighlights(){this.highlightAllEmails()}updateHighlightTerms(t){this.highlightTerms=t||[],this.highlightAllEmails()}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.clearHighlights(),this.highlightTerms=[]}}if(!document.getElementById("gmail-highlighter-styles")){const e=document.createElement("style");e.id="gmail-highlighter-styles",e.textContent=`
2490
+ `,$_=()=>u.jsxs(l.Stack,{marginTop:"12px",children:[u.jsx(yl,{variant:"rounded",width:"50%",height:"16px",animation:"wave",margin:"0 0 18px 0"}),u.jsx(l.Stack,{gap:"17px",children:u.jsxs(d2,{gap:"8px",disableHover:!0,children:[u.jsx(yl,{variant:"rounded",width:"30%",height:"16px",animation:"wave"}),u.jsx(yl,{variant:"rounded",width:"70%",height:"16px",animation:"wave"})]})})]});let xl={};const Cl=new Set,U_=(e,t)=>{xl={...xl,[e]:t},Cl.forEach(n=>n())},K_=e=>(Cl.add(e),()=>Cl.delete(e)),eS=e=>I.useSyncExternalStore(K_,()=>xl)[e],tS=async({id:e,searchString:t,args:n})=>{try{if(e===void 0||t===void 0)return[];const r=await ve({url:M_.replace(":formId",e.toString()),method:Oe.POST,data:{search_string:t,args:n}});let o=null;return r!=null&&r.data&&"data"in r.data&&(o=r.data.data),o}catch(r){Te({message:wn,type:Je}),console.error(r)}},nS=(e,t)=>Xt({mutationFn:tS,onMutate:({searchString:n,connectorName:r})=>{e(n,r)},onSuccess:(n,{searchString:r,connectorName:o})=>{t(r,n,o)}}),El={OPEN_FORM_VIEW:"connector-agent-open-form-view"},rS=(e,t={})=>{const{delayAfterLoad:n=1e3}=t,r=I.useRef(!1),o=I.useRef(void 0),s=I.useCallback((c="auto")=>{const d=e.current;d&&d.scrollIntoView({behavior:c})},[e]),a=I.useCallback((c,d="smooth")=>{r.current||(o.current!==void 0&&clearTimeout(o.current),c&&(o.current=setTimeout(()=>{s(d),r.current=!0},n)))},[s,n]),i=I.useCallback(()=>{r.current=!1,o.current!==void 0&&clearTimeout(o.current)},[]);return I.useEffect(()=>()=>{o.current!==void 0&&clearTimeout(o.current)},[]),{scrollOnceAfterLoad:a,resetScrollState:i,hasScrolledOnce:r.current}},oS=e=>A.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.86993 0.652446C7.56922 0.248711 8.43078 0.248711 9.13007 0.652446L13.7981 3.34755C14.4974 3.75129 14.9282 4.49742 14.9282 5.30489V10.6951C14.9282 11.5026 14.4974 12.2487 13.7981 12.6524L9.13007 15.3476C8.43078 15.7513 7.56922 15.7513 6.86993 15.3476L2.20187 12.6524C1.50258 12.2487 1.0718 11.5026 1.0718 10.6951V5.30489C1.0718 4.49742 1.50258 3.75129 2.20187 3.34755L6.86993 0.652446Z",fill:"#FFD122"}),A.createElement("g",{filter:"url(#filter0_d_360_39563)"},A.createElement("path",{d:"M5.83154 4.43359V4.43359C6.84296 4.43359 7.66287 5.25351 7.66287 6.26492V11.5179V11.5179C6.65146 11.5179 5.83154 10.698 5.83154 9.68661V4.43359Z",fill:"white"})),A.createElement("g",{filter:"url(#filter1_d_360_39563)"},A.createElement("path",{d:"M8.57812 7.66211V7.66211C9.58954 7.66211 10.4095 8.48202 10.4095 9.49343V11.7103V11.7103C9.39804 11.7103 8.57812 10.8904 8.57812 9.87898V7.66211Z",fill:"white"})),A.createElement("defs",null,A.createElement("filter",{id:"filter0_d_360_39563",x:4.76488,y:3.36693,width:3.96488,height:9.21732,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},A.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),A.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),A.createElement("feOffset",null),A.createElement("feGaussianBlur",{stdDeviation:.533333}),A.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),A.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),A.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})),A.createElement("filter",{id:"filter1_d_360_39563",x:7.51146,y:6.59544,width:3.96488,height:6.18216,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},A.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),A.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),A.createElement("feOffset",null),A.createElement("feGaussianBlur",{stdDeviation:.533333}),A.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),A.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),A.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})))),sS="/v1/api/connectors/lookup/bulk",aS="/v1/api/connectors/lookup/bulk",iS=async e=>{const t=new URLSearchParams;e.forEach(o=>t.append("connector_ids",o));const n=`${sS}?${t.toString()}`,r=await ve({url:n,method:Oe.GET});return r==null?void 0:r.data},cS=async e=>{const t=await ve({url:aS,method:Oe.PUT,data:{entries:e}});return t==null?void 0:t.data},lS={fontSize:"14px",width:"209px",height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"}},uS={border:`1px solid ${l.theme.palette.gray.gray5}`,borderRadius:"8px",padding:"12px"},f2={flex:1,height:"1px",backgroundColor:l.theme.palette.gray.gray6},dS={flexShrink:0,border:`1px solid ${l.theme.palette.gray.gray6}`,borderRadius:"15px"},fS={border:`1px solid ${l.theme.palette.gray.gray6}`,backgroundColor:l.theme.palette.gray.gray6a,borderRadius:"8px",padding:"8px 10px"},pS=I.memo(function({connector:t,selectedHiverParam:n,onChange:r,sendTrackingEvent:o}){var i;const s=((i=(t.presets??[]).find(c=>c.hiverParam===n))==null?void 0:i.objectParamLabel)??"",a=I.useCallback(c=>{o(E4,{hiver_param:c.target.value,connector_name:t.connectorName,page:"agent_connector_panel"}),r(t.connectorId,c.target.value)},[t.connectorId,t.connectorName,r,o]);return u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"0px",justifyContent:"space-between",children:[u.jsx(l.Select,{value:n,onChange:a,size:"small",variant:"outlined",sx:lS,MenuProps:{sx:{zIndex:1500}},renderValue:c=>{var f;const d=((f=(t.presets??[]).find(g=>g.hiverParam===c))==null?void 0:f.label)??"";return u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(oS,{width:18,height:18}),u.jsx("span",{children:d})]})},children:(t.presets??[]).map(c=>u.jsx(l.MenuItem,{value:c.hiverParam,sx:{fontSize:"14px"},children:c.label},c.hiverParam))}),u.jsx(l.Box,{sx:f2}),u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"4px",padding:"4px 12px",sx:dS,children:[t.logo&&u.jsx("img",{src:t.logo,width:16,height:16,alt:t.connectorName}),u.jsxs(l.Typography,{variant:"body2",color:l.theme.palette.gray.gray3,children:["Matches with ",t.connectorName,"'s"]})]}),u.jsx(l.Box,{sx:f2}),u.jsx(l.Box,{sx:fS,children:u.jsx(l.Typography,{variant:"body2",fontSize:14,children:s})})]})}),hS=I.memo(function({open:t,onClose:n,connectors:r,onSaveSuccess:o}){const{sendTrackingEvent:s}=I.useContext(Ge),[a,i]=I.useState({});I.useEffect(()=>{if(t&&r.length>0){const b={};r.filter(h=>{var p;return((p=h.presets)==null?void 0:p.length)>1}).forEach(h=>{b[h.connectorId]=h.hiverParam}),i(b)}},[t,r]);const c=ur(),{mutate:d,isPending:f}=Xt({mutationFn:cS,onSuccess:b=>{const h={};b.results.forEach(({connectorId:p,hiverParam:m})=>{h[p]=m}),c.setQueriesData({queryKey:["lookup","bulk"]},p=>p&&{...p,connectors:p.connectors.map(m=>h[m.connectorId]!==void 0?{...m,hiverParam:h[m.connectorId]}:m)}),s(v4,{page:"agent_connector_panel"}),Te({message:"Identity mapping saved successfully",type:"success"}),o==null||o(),n()},onError:()=>{Te({message:"Failed to save identity mapping",type:"error"})}}),g=I.useCallback(()=>{const b=Object.entries(a).map(([h,p])=>({connector_id:h,hiver_param:p}));d(b)},[a,d]),y=I.useCallback((b,h)=>{i(p=>({...p,[b]:h}))},[]),E=I.useCallback(b=>{b||n()},[n]);return u.jsx(Sr,{shown:t,setShown:E,showCloseButton:!1,children:u.jsxs(l.Stack,{padding:"24px 20px",gap:"16px",sx:{minWidth:"800px"},children:[u.jsx(l.Typography,{variant:"h2",children:"Customer identity mapping"}),u.jsx(l.Typography,{variant:"body2",children:"Choose how Hiver should identify customers when fetching data from connected apps."}),r.some(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1})&&u.jsx(l.Stack,{gap:"8px",sx:uS,children:r.filter(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1}).map(b=>u.jsx(pS,{connector:b,selectedHiverParam:a[b.connectorId]??b.hiverParam,onChange:y,sendTrackingEvent:s},b.connectorId))}),u.jsxs(l.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:[u.jsx(l.Button,{variant:"text",onClick:n,children:"Cancel"}),u.jsx(l.Button,{variant:"contained",onClick:g,disabled:f,children:"Save"})]})]})})}),gS=({enabled:e,...t})=>{const{actionQueue:n}=I.useContext(Ge);n&&e&&n.register(t),I.useEffect(()=>{if(n)return()=>{n.destroy()}},[n,e])},mS=({isAdmin:e=!1})=>{var mt,Fn;const{email:t,currentSmIds:n,sendTrackingEvent:r,availableFeatures:o,conversationId:s,connectorId:a}=I.useContext(Ge),i=$t(),{userGroupId:c,userId:d}=Mt()||{},f=I.useRef(!1),g=I.useRef(null),y=I.useRef(null),E=I.useRef(null),[b,h]=I.useState({}),[p,m]=I.useState(!1),[x,C]=I.useState(!1),[w,v]=I.useState(!1),[_,T]=I.useState(!1),[S,L]=I.useState(),[R,D]=I.useState(!1),[F,M]=I.useState(null),[B,G]=I.useState(),[J,Z]=I.useState(null),[H,Y]=I.useState(!1),[U,ee]=I.useState(!1),[V,q]=I.useState(!1),[N,X]=I.useState(!1),[Q,ne]=I.useState(void 0),ce=I.useRef(),P=_e(uw),re=_e(dw),xe=_e(pw),z=_e(hw),Ae=_e(mw),Ve=_e(fw),He=_e(L1),rn=_e(Lw),xn=_e(O1),Ke=_e(k1),it=_e(F1),qe=_e(DI),Mr=tt(o,S4),Bt=tt(o,Sd),Kn=tt(o,F4),er=tt(o,N4),tr=tt(o,R4),nr=tt(o,M4),gt=(mt=Mt())==null?void 0:mt.tenantPlatform,Ln=tt(o,gt==="HIVERWEB"?`hot-${Td}`:Td),{data:Pr}=zt({queryKey:["connectors","enabledAuthenticated"],queryFn:()=>nf(),enabled:Ln&&e}),On=I.useMemo(()=>(Pr??[]).map(oe=>oe.id),[Pr]),{data:Vt,isSuccess:hs}=zt({queryKey:["lookup","bulk",On.join(",")],queryFn:()=>iS(On),enabled:On.length>0&&Ln&&e,refetchOnMount:!1}),Gt=hs&&((Vt==null?void 0:Vt.connectors)??[]).some(oe=>{var me;return(((me=oe.presets)==null?void 0:me.length)??0)>1});gS({conversationId:s,openCreateForm:()=>v(!0),enabled:re});const rr=I.useMemo(()=>!P||!P.length?null:Cw(P,xe,z),[P,xe,z]),kn=K4(xe),{data:_o,isLoading:Ht}=l2({senderEmail:t,conversationId:String(s),enabled:er&&!!t}),{emailHeaders:So,selectedEmail:or}=_o??{},{scrollOnceAfterLoad:sr,resetScrollState:on}=rS(y),ar=Ve!==te.LOADING&&(!z||!Object.values(z).some(oe=>oe===te.LOADING))&&P&&P.length>0;I.useLayoutEffect(()=>{var oe;H&&!p&&U&&((oe=E==null?void 0:E.current)!=null&&oe.scrollHeight)&&sr(!!ar,"smooth")},[H,p,U,ar,sr,(Fn=E==null?void 0:E.current)==null?void 0:Fn.scrollHeight,d]);const jr=(oe,me)=>{r(u4,{search_keyword:oe,sm_ids:n,connector_name:me,suggestion_type:qe})},To=(oe,me,ot)=>{!Array.isArray(me)||!me.length?r(d4,{search_keyword:oe,sm_ids:n,connector_name:ot,suggestion_type:qe}):me.length&&r(f4,{num_of_results:me.length,search_keyword:oe,sm_ids:n,connector_name:ot,suggestion_type:qe})},{mutate:gs,reset:Br,data:ms,isPending:Vr,isIdle:Gr}=nS(jr,To),Hr=I.useCallback(()=>{Br(),M(null)},[Br,M]),pe=ur(),ge=I.useCallback(()=>{if(t&&n.length&&s){const oe=i(Ya({inboxIds:n,conversationId:s,connectorId:a}));return()=>oe.abort()}},[i,t,n,s,a]),Qe=I.useCallback(()=>{pe.invalidateQueries({queryKey:["lookup","bulk"]}),ge()},[pe,ge]),ct=I.useCallback((oe,me)=>{oe&&s&&me&&i(Xa({id:oe,channelType:"email",conversationId:s,externalResourceId:me,contactEmail:t})).unwrap().catch(()=>{i(lo(null))})},[i,s,t]);if(I.useEffect(()=>{(async()=>{d&&(Y(await Ii(d)),ee(await xu(d)))})()},[d]),I.useEffect(()=>{Ht||G(or||t)},[t,or,Ht]),I.useEffect(()=>{B&&s&&U_(String(s),B)},[B,s]),I.useEffect(()=>{U&&d&&Cu(d)},[U,d]),I.useEffect(()=>{var oe;if(Ke){C(!0);const{externalResourceId:me}=Ke,ot=(oe=Ke.forms.find(an=>an.type==="edit"))==null?void 0:oe.id;ct(ot,me)}else C(!1),i(sw())},[Ke,ct,i]),I.useEffect(()=>{const oe=ge();return on(),()=>{oe==null||oe(),i(T1.clearConnectorList())}},[i,ge,on]),I.useEffect(()=>{var oe;if(Ae&&P&&P.length&&rr&&!f.current){const{cards_per_app:me,total_empty_cards:ot,total_cards_with_errors:an}=rr,Ua=a?(oe=me[0])==null?void 0:oe.app_name:null;r(V3,{numOfCards:P.length,total_cards_loaded:P.length,total_empty_cards:ot,total_cards_with_errors:an,cards_per_app:me,sm_ids:n,...Ua?{app_name:Ua}:null}),f.current=!0}return()=>{f.current=!1}},[Ae,P,rr,r,n,a]),I.useEffect(()=>{if(s&&n&&n.length){const oe=i(Ga({inboxIds:n,conversationId:s,channelType:"email",isExpandedFormEnabled:nr,connectorId:a}));return()=>oe.abort()}},[i,n,s,nr,a]),I.useEffect(()=>{const oe=me=>{var an;if(!(me instanceof CustomEvent))return;const ot=(an=me.detail)==null?void 0:an.connectorKey;h({connectorKey:ot})};return window.addEventListener(El.OPEN_FORM_VIEW,oe),()=>{window.removeEventListener(El.OPEN_FORM_VIEW,oe)}},[]),I.useEffect(()=>{if(!(He!=null&&He.length)||!b.connectorKey)return;const oe=b.connectorKey;h({});const me=He.find(ot=>{var an;return((an=ot.connectorKey)==null?void 0:an.toLowerCase())===(oe==null?void 0:oe.toLowerCase())});me&&(Z(me),v(!0))},[He,b]),!t.length||Ve===te.LOADING)return u.jsx(yI,{});const Nt=oe=>{r(z3,{connector_name:rn,source:oe,sm_ids:n})},sn=oe=>{v(!0),Nt(oe)},St=()=>{T(!0),O(vd),W(Id),r(X3)},O=oe=>{r(oe,S),it?D(!0):(v(!1),Z(null))},W=oe=>{if(Ke){const{connectorName:me,title:ot}=Ke;r(oe,{connector_name:me,card_title:ot,sm_ids:n,ug_id:c})}it?D(!0):i(lo(null))},$=()=>{v(!1),i(lo(null)),L(void 0),D(!1)},se=()=>{ge(),v(!1),C(!1),i(T1.clearConnectorList())},we=[{label:"Go back",variant:"text",action:$},{label:"Stay",variant:"contained",action:()=>D(!1)}],Ie=He.length>0,Ce=xn.length>0,Ee=w||x||_,lt=()=>Ie||Ce?u.jsx(c_,{haveCreateObjects:Ie,haveLinkObjects:Ce,onCreateClick:()=>sn(jd.MAIN_BUTTON),onLinkClick:()=>T(!0)}):u.jsx(M1,{isAdmin:e,hideHeading:!0}),We=()=>{q(!0);const oe=ce.current,me=oe==null?void 0:oe.connectorName,ot=oe==null?void 0:oe.name;r(w4,{entry_point:"agent",app_name:me,object_type:ot})},Ye=oe=>{ce.current=oe};return u.jsxs(Jd,{ref:g,"data-testid":Array.isArray(P)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:w||_,children:[u.jsx(U1,{shown:R,setShown:D,title:qv,description:Qv,buttons:we}),u.jsx(Fb,{onWheel:()=>m(!0),ref:E,children:re?u.jsxs(u.Fragment,{children:[u.jsx(u5,{connectors:kn,isWriteFlowEnabled:Bt,haveCreateObjects:Ie,haveLinkObjects:Ce,cards:P,handleCreateNewObject:()=>sn(jd.ICON),handleLinkNewObject:St}),Kn&&!Ee?u.jsx(G_,{selectedObject:F,setSelectedObject:M,fetchSearchResults:gs,onReset:Hr,root:g.current}):null,u.jsxs(uo,{children:[u.jsx(_n,{condition:Kn&&Vr,children:u.jsx($_,{})},"search"),u.jsx(_n,{condition:Kn&&!!F&&!Gr,children:u.jsx(Q_,{searchResults:ms??[],selectedObject:F,onReset:Hr,fetchCards:ge})},"results"),u.jsx(_n,{condition:w,children:u.jsx(hl,{onClose:()=>O(vd),title:ec,rightNode:u.jsx(r_,{formId:Q,conversationId:s,inboxIds:n,enabled:w&&!!Q&&!!e,setMapFormOpen:We}),children:u.jsx(e2,{onClose:()=>O($3),onCreateSuccess:se,metaData:S,setMetaData:L,defaultOption:J,connectors:kn,mapFormOpen:V,setMapFormOpen:q,setCreateFormId:ne,syncCurrentObject:Ye})})},"create-form"),u.jsx(_n,{condition:x,children:u.jsx(hl,{onClose:()=>W(Id),title:z4,backButtonTooltip:"Back",children:u.jsx(e2,{isEdit:!0,onClose:()=>W(r4),onCreateSuccess:se,metaData:S,setMetaData:L,connectors:kn})})},"edit-form"),u.jsx(_n,{condition:_,children:u.jsx(hl,{onClose:()=>T(!1),children:u.jsx(n_,{setOpenTaskLinking:T,onLinkingSuccess:ge})})},"link-form"),u.jsxs(_n,{fallback:!0,children:[er&&(P!=null&&P.length)?u.jsxs(l.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(l.Stack,{sx:{flex:1,minWidth:0},children:u.jsx(AI,{emailHeaders:So,selectedEmail:B,root:g.current,isLoading:Ht,setSelectedEmail:G})}),Ln&&Gt&&e&&u.jsx(l.Tooltip,{title:"Update customer identity mapping",placement:"top",children:u.jsx(l.IconButton,{"aria-label":"Open customer identity mapping settings",sx:{height:"32px",width:"32px",marginTop:"12px",flexShrink:0},onClick:()=>{r(_d,{page:"agent_connector_panel"}),X(!0)},children:u.jsx(l.icons.SettingsOutlined,{sx:{height:"20px",width:"20px"}})})})]}):null,!er&&Ln&&Gt&&e&&(P!=null&&P.length)?u.jsx(l.Button,{fullWidth:!0,variant:"contained",startIcon:u.jsx(l.icons.SettingsOutlined,{sx:{height:"14px",width:"14px"}}),sx:{backgroundColor:"#edf1f6",color:"#4d596c",borderRadius:"6px",padding:"9px 12px",marginTop:"12px",textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"20px",boxShadow:"none","&:hover":{backgroundColor:"#e2e8f0",boxShadow:"none"}},onClick:()=>{r(_d,{page:"agent_connector_panel"}),X(!0)},children:"Customer identity mapping"}):null,Mr?u.jsx(xI,{}):null,u.jsxs(uo,{children:[u.jsxs(_n,{condition:!!P&&P.length>0,children:[u.jsx(Xw,{cards:P,specificCardData:xe,email:B??"",specificConnectorApiStatus:z,onCardUnlinking:ge}),u.jsx("div",{ref:y,children:tr?u.jsx(db,{connectors:kn,expanded:H}):null})]},"cards-list"),u.jsx(_n,{condition:!(P!=null&&P.length)&&Bt,children:lt()},"create-banner")]})]},"cards")]})]}):u.jsx(M1,{isAdmin:e})}),!re&&u.jsx(wb,{}),Ln&&u.jsx(hS,{open:N,onClose:()=>X(!1),connectors:(Vt==null?void 0:Vt.connectors)??[],onSaveSuccess:Qe})]})},bS=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:r={},currentSmIds:o=[],userEmail:s,metaData:a,availableFeatures:i,conversationId:c,connectorFunctions:d,stackingContext:f,isAdmin:g=!1,actionQueue:y,store:E,connectorId:b,variables:h})=>{const p=I.useMemo(()=>({userEmail:s,email:n,baseUrls:r,currentSmIds:o,metaData:a,conversationId:c,sendTrackingEvent:t||(()=>{}),availableFeatures:i,isAdmin:g,connectorFunctions:d,stackingContext:f,actionQueue:y,store:E,connectorId:b,variables:h}),[s,n,r,t,o,a,i,c,g,d,f,y,E,b,h]);return u.jsx(Ge.Provider,{value:p,children:e})},vl=({children:e})=>{const[t]=I.useState(()=>new mh);return u.jsx(Eh,{client:t,children:e})},yS=u0({cardList:Sw,write:aw,common:Av}),wl=Oy({reducer:yS,devTools:!0}),xS=({children:e,userEmail:t,extraParams:n,contactEmail:r,baseUrls:o,availableFeatures:s,connectorFunctions:a,stackingContext:i,actionQueue:c,store:d,connectorId:f})=>u.jsx(dc,{store:wl,children:u.jsx(l.HiverProvider,{inter:!0,children:u.jsx(vl,{children:u.jsx(bS,{...n,userEmail:t,availableFeatures:s,sendTrackingEvent:n==null?void 0:n.sendTrackingEvent,contactEmail:r,currentSmIds:n==null?void 0:n.currentSmIds,metaData:n==null?void 0:n.metaData,conversationId:n==null?void 0:n.conversationId,baseUrls:o,connectorFunctions:a,stackingContext:i,actionQueue:c,isAdmin:n==null?void 0:n.isAdmin,store:d,connectorId:f,children:u.jsx(I.Suspense,{fallback:u.jsx(u.Fragment,{}),children:e})})})})}),CS=({userEmail:e="",contactEmail:t="",baseUrls:n={},extraParams:r={},availableFeatures:o={},connectorFunctions:s,stackingContext:a={},actionQueue:i,store:c})=>{const[d,f]=I.useState(()=>{if(c)return c.getData("connectorId")});return I.useEffect(()=>{if(!c)return;const g=c.subscribe(y=>{f(y)},"connectorId");return()=>g()},[c]),u.jsx(ua,{children:u.jsxs(xS,{userEmail:e,availableFeatures:o,extraParams:r,contactEmail:t,connectorFunctions:s,stackingContext:a,actionQueue:i,baseUrls:n,store:c,connectorId:d,children:[u.jsx(mS,{isAdmin:r==null?void 0:r.isAdmin},d||"root"),u.jsx(da,{zIndex:a.toastMessage}),u.jsx("div",{"data-connectorid":"connector-layover-portal"})]})})},p2="/v1/api",ES=`${p2}/connector/conversation/:conversationId/data`,vS=`${p2}/connector/feedback/conversation/:conversationId`,wS=async(e,t)=>{try{let n=ES.replace(":conversationId",e)+"?channel_type=email";if(t!=null&&t.length){const o=t.map(s=>`inbox_ids=${encodeURIComponent(s)}`).join("&");n+=`&${o}`}const r=await ve({url:n,method:Oe.GET});return r!=null&&r.data&&Array.isArray(r.data)?r.data.reduce((s,a)=>{var i,c;return s[(i=a==null?void 0:a.cardData)==null?void 0:i.textToHighlight]||(s[(c=a==null?void 0:a.cardData)==null?void 0:c.textToHighlight]={...a}),s},{}):null}catch(n){return Promise.reject(n)}};function IS(e,t,n){return zt({queryKey:["connector-analytics",e,t,n],queryFn:async()=>!t||!e?null:await wS(e,n),enabled:!!t&&!!e})}class _S{constructor(t=[],n=null){Pe(this,"highlightTerms");Pe(this,"observer");Pe(this,"isHighlighting");Pe(this,"debounceTimer");Pe(this,"debounceDelay");Pe(this,"onHighlightsUpdated");this.highlightTerms=t,this.observer=null,this.isHighlighting=!1,this.debounceTimer=null,this.debounceDelay=500,this.onHighlightsUpdated=n,this.init()}init(){this.highlightAllEmails(),this.startObserver()}startObserver(){const t=this.findGmailContainer();if(!t){console.warn("Gmail container not found");return}this.observer=new MutationObserver(n=>{if(this.isHighlighting)return;let r=!1;n.forEach(o=>{o.type==="childList"&&Array.from(o.addedNodes).some(i=>{var c,d,f,g;return i.nodeType===1&&i instanceof Element&&(((c=i.classList)==null?void 0:c.contains("a3s"))||((d=i.classList)==null?void 0:d.contains("ii"))||((f=i.querySelector)==null?void 0:f.call(i,".a3s"))||((g=i.querySelector)==null?void 0:g.call(i,"h2.hP")))})&&(r=!0)}),r&&this.debounceHighlight()}),this.observer.observe(t,{childList:!0,subtree:!0})}findGmailContainer(){return document.querySelector('[role="main"]')||document.querySelector(".nH.if")||document.querySelector(".AO")||document.body}debounceHighlight(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.highlightAllEmails()},this.debounceDelay)}highlightAllEmails(){var t;if(this.highlightTerms.length!==0){this.isHighlighting=!0;try{if(this.clearHighlights(),["h2.hP",".ii.gt .a3s.aiL",".ii.gt .a3s",'[data-expanded="true"]'].forEach(r=>{document.querySelectorAll(r).forEach(s=>{this.isElementVisible(s)&&this.highlightInElement(s)})}),this.onHighlightsUpdated){const r=Array.from(document.querySelectorAll(".gmail-highlight"));(t=this.onHighlightsUpdated)==null||t.call(this,r)}}finally{setTimeout(()=>{this.isHighlighting=!1},250)}}}isElementVisible(t){const n=t;return n.offsetParent!==null&&n.offsetWidth>0&&n.offsetHeight>0}highlightInElement(t){if(!t||this.highlightTerms.length===0||t.dataset.highlightProcessed==="true")return;const r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:a=>a.parentElement&&a.parentElement.classList.contains("gmail-highlight")||a.parentElement&&["SCRIPT","STYLE"].includes(a.parentElement.tagName)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),o=[];let s;for(;s=r.nextNode();)o.push(s);o.forEach(a=>{this.highlightInTextNode(a)}),t.dataset.highlightProcessed="true"}highlightInTextNode(t){let n=t.textContent,r=!1;if(!n)return;if([...this.highlightTerms].sort((s,a)=>a.length-s.length).forEach(s=>{if(!s||s.trim().length===0)return;const a=this.escapeRegex(s.trim()),i=new RegExp(`\\b${a}\\b`,"gi");i.test(n)&&(n=n.replace(i,`<span class="gmail-highlight" data-highlight-term="${s.trim()}"><span class="gmail-highlight-inner">${s}</span></span>`),r=!0)}),r&&t.parentNode){const s=document.createElement("span");s.innerHTML=n,t.parentNode.replaceChild(s,t)}}clearHighlights(){document.querySelectorAll(".gmail-highlight").forEach(r=>{const o=r.parentNode;o&&r.textContent&&(o.replaceChild(document.createTextNode(r.textContent),r),o.normalize())}),document.querySelectorAll('[data-highlight-processed="true"]').forEach(r=>{delete r.dataset.highlightProcessed})}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}refreshHighlights(){this.highlightAllEmails()}updateHighlightTerms(t){this.highlightTerms=t||[],this.highlightAllEmails()}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.clearHighlights(),this.highlightTerms=[]}}if(!document.getElementById("gmail-highlighter-styles")){const e=document.createElement("style");e.id="gmail-highlighter-styles",e.textContent=`
2491
2491
  .gmail-highlight {
2492
2492
  background-color: #ECEFF6 !important;
2493
2493
  color: #2c3e50 !important;