@coveo/quantic 3.37.1 → 3.37.3

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.
Files changed (20) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +12 -12
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/post-answer-evaluation.d.ts +4 -4
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +2 -2
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/plan/plan-request.d.ts +2 -2
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/generated-answer/headless-core-generated-answer.d.ts +0 -12
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/analytics-utils.d.ts +0 -1
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-mocks.d.ts +0 -1
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-selectors.d.ts +26 -7
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions-thunk-processor.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +1 -1
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions-thunk-processor.d.ts +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions-thunk-processor.d.ts +1 -1
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +1 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +1 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/fetch-event-source/fetch.d.ts +0 -1
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/fetch-event-source/parse.d.ts +0 -1
  17. package/force-app/main/default/staticresources/coveoheadless/headless.js +13 -13
  18. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +12 -12
  19. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +11 -11
  20. package/package.json +6 -8
@@ -16,32 +16,32 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
16
16
  * limitations under the License.
17
17
  */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessCaseAssist",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var uA=Object.create;var ki=Object.defineProperty;var lA=Object.getOwnPropertyDescriptor;var dA=Object.getOwnPropertyNames;var pA=Object.getPrototypeOf,fA=Object.prototype.hasOwnProperty;var mA=(e,t,r)=>t in e?ki(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$o=(e,t)=>{for(var r in t)ki(e,r,{get:t[r],enumerable:!0})},Ap=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dA(t))!fA.call(e,i)&&i!==r&&ki(e,i,{get:()=>t[i],enumerable:!(n=lA(t,i))||n.enumerable});return e};var _t=(e,t,r)=>(r=e!=null?uA(pA(e)):{},Ap(t||!e||!e.__esModule?ki(r,"default",{value:e,enumerable:!0}):r,e)),gA=e=>Ap(ki({},"__esModule",{value:!0}),e);var Se=(e,t,r)=>mA(e,typeof t!="symbol"?t+"":t,r);var A,d=Tn(()=>{"use strict";A=typeof globalThis<"u"?globalThis:window});function Qo(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qo=function(t){return typeof t}:Qo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qo(e)}function vA(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=SA.bind(this))}function SA(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",i="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");i.open("POST",e,!n),i.withCredentials=!0,i.setRequestHeader("Accept","*/*"),hA(t)?(i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.responseType="text"):yA(t)&&t.type&&i.setRequestHeader("Content-Type",t.type);try{i.send(t)}catch{return!1}return!0}var hA,yA,p=Tn(()=>{"use strict";hA=function(t){return typeof t=="string"},yA=function(t){return t instanceof Blob};vA.call((typeof window>"u"?"undefined":Qo(window))==="object"?window:{})});var iu=Ke(Oi=>{"use strict";m();d();f();p();Object.defineProperty(Oi,"__esModule",{value:!0});function bp(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function AA(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bA(e,t,r){return t=_n(t),CA(e,Ep()?Reflect.construct(t,r||[],_n(e).constructor):t.apply(e,r))}function tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,IA(n.key),n)}}function ru(e,t,r){return t&&wp(e.prototype,t),r&&wp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=TA(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
18
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return s=c.done,c},e:function(c){a=!0,o=c},f:function(){try{s||r.return==null||r.return()}finally{if(a)throw o}}}}function Zc(){return Zc=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=xA(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Zc.apply(null,arguments)}function _n(e){return _n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_n(e)}function wA(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&eu(e,t)}function Ep(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ep=function(){return!!e})()}function CA(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AA(e)}function eu(e,t){return eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},eu(e,t)}function xA(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_n(e))!==null;);return e}function EA(e,t,r,n){var i=Zc(_n(1&n?e.prototype:e),t,r);return 2&n&&typeof i=="function"?function(o){return i.apply(r,o)}:i}function RA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IA(e){var t=RA(e,"string");return typeof t=="symbol"?t:t+""}function TA(e,t){if(e){if(typeof e=="string")return bp(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function _A(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function kA(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var xp=function(){function e(){tu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return ru(e,[{key:"addEventListener",value:function(r,n,i){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:i})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var i=this.listeners[r],o=0,s=i.length;o<s;o++)if(i[o].callback===n){i.splice(o,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var i=this.listeners[r.type],o=i.slice(),s=function(){var h=o[a];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},a=0,c=o.length;a<c;a++)s();return!r.defaultPrevented}}}])}(),nu=function(e){function t(){var r;return tu(this,t),r=bA(this,t),r.listeners||xp.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return wA(t,e),ru(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),EA(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,i=this.reason,o=i===void 0?"Aborted":i;if(n)throw o}}],[{key:"timeout",value:function(n){var i=new Ho;return setTimeout(function(){return i.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),i.signal}},{key:"any",value:function(n){var i=new Ho;function o(){i.abort(this.reason),s()}function s(){var h=Cp(n),v;try{for(h.s();!(v=h.n()).done;){var S=v.value;S.removeEventListener("abort",o)}}catch(g){h.e(g)}finally{h.f()}}var a=Cp(n),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;if(u.aborted){i.abort(u.reason);break}else u.addEventListener("abort",o)}}catch(h){a.e(h)}finally{a.f()}return i.signal}}])}(xp),Ho=function(){function e(){tu(this,e),Object.defineProperty(this,"signal",{value:new nu,writable:!0,configurable:!0})}return ru(e,[{key:"abort",value:function(r){var n=kA(r),i=_A(n);this.signal.reason=n,this.signal.dispatchEvent(i)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ho.prototype[Symbol.toStringTag]="AbortController",nu.prototype[Symbol.toStringTag]="AbortSignal");function OA(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function PA(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,i=n===void 0?r.Request:n,o=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!OA({fetch:r,Request:i,AbortController:o,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:c};var c=i;(c&&!c.prototype.hasOwnProperty("signal")||a)&&(c=function(S,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var C=new i(S,g);return y&&Object.defineProperty(C,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),C},c.prototype=i.prototype);var u=r,h=function(S,g){var y=c&&c.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(y){var C;try{C=new DOMException("Aborted","AbortError")}catch{C=new Error("Aborted"),C.name="AbortError"}if(y.aborted)return Promise.reject(C);var x=new Promise(function(E,_){y.addEventListener("abort",function(){return _(C)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([x,u(S,g)])}return u(S,g)};return{fetch:h,Request:c}}Oi.AbortController=Ho;Oi.AbortSignal=nu;Oi.abortableFetch=PA});var Rp,l,b,f=Tn(()=>{"use strict";Rp=_t(iu(),1),l=_t(iu(),1),{fetch:b}=(0,Rp.abortableFetch)({fetch})});function ou(e){return typeof e!="string"||e in{}}function su(){return Object.create(null)}function Ip(e){return typeof e=="string"&&!!e.trim()}function au(e,t){var r=e.split(";").filter(Ip),n=r.shift(),i=NA(n),o=i.name,s=i.value;if(t=t?Object.assign({},zo,t):zo,ou(o))return null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var a=su();return a.name=o,a.value=s,r.forEach(function(c){var u=c.split("="),h=u.shift().trimLeft().toLowerCase();if(!ou(h)){var v=u.join("=");if(h==="expires")a.expires=new Date(v);else if(h==="max-age"){var S=parseInt(v,10);Number.isNaN(S)||(a.maxAge=S)}else h==="secure"?a.secure=!0:h==="httponly"?a.httpOnly=!0:h==="samesite"?a.sameSite=v:h==="partitioned"?a.partitioned=!0:h&&(a[h]=v)}}),a}function NA(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function kn(e,t){if(t=t?Object.assign({},zo,t):zo,!e)return t.map?su():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(s){return s.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,i=Array.isArray(e);if(n==="auto"&&(n=!i),i||(e=[e]),e=e.filter(Ip),n&&(e=e.map(Wo).flat()),t.map){var o=su();return e.reduce(function(s,a){var c=au(a,t);return c&&!ou(c.name)&&(s[c.name]=c),s},o)}else return e.map(function(s){return au(s,t)}).filter(Boolean)}function Wo(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,i,o,s,a;function c(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function u(){return i=e.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<e.length;){for(n=r,a=!1;c();)if(i=e.charAt(r),i===","){for(o=r,r+=1,c(),s=r;r<e.length&&u();)r+=1;r<e.length&&e.charAt(r)==="="?(a=!0,r=s,t.push(e.substring(n,o)),n=r):r=o+1}else r+=1;(!a||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var zo,Tp=Tn(()=>{"use strict";m();d();f();p();zo={decodeValues:!0,map:!1,silent:!1,split:"auto"};kn.parseSetCookie=kn;kn.parse=kn;kn.parseString=au;kn.splitCookiesString=Wo});function Pi(e){if(FA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function cu(e){return e.replace(DA,"")}function Ni(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!MA(r))return!1}return!0}function MA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function kp(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var FA,_p,DA,Op,On,uu,Pp,w,Fp=Tn(()=>{"use strict";m();d();f();p();Tp();FA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;_p=[`
19
- `,"\r","\t"," "],DA=new RegExp(`(^[${_p.join("")}]|$[${_p.join("")}])`,"g");On=Symbol("normalizedHeaders"),uu=Symbol("rawHeaderNames"),Pp=", ",w=class Np{constructor(t){this[On]={},this[uu]=new Map,this[Op]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Np||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Pp):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Pp):n)})}[(Op=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[On]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Ni(t))throw new TypeError(`Invalid header name "${t}"`);return this[On].hasOwnProperty(Pi(t))}get(t){if(!Ni(t))throw TypeError(`Invalid header name "${t}"`);return this[On][Pi(t)]??null}set(t,r){if(!Ni(t)||!kp(r))return;let n=Pi(t),i=cu(r);this[On][n]=cu(i),this[uu].set(n,t)}append(t,r){if(!Ni(t)||!kp(r))return;let n=Pi(t),i=cu(r),o=this.has(n)?`${this.get(n)}, ${i}`:i;this.set(t,o)}delete(t){if(!Ni(t)||!this.has(t))return;let r=Pi(t);delete this[On][r],this[uu].delete(r)}forEach(t,r){for(let[n,i]of this.entries())t.call(r,i,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Wo(t)}}});var m=Tn(()=>{"use strict";Fp()});var Dp=Ke(Fi=>{"use strict";m();d();f();p();var Ko=Fi&&Fi.__assign||function(){return Ko=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ko.apply(this,arguments)};Object.defineProperty(Fi,"__esModule",{value:!0});var jA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function LA(e){var t=Ko(Ko({},jA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Fi.getSanitizedOptions=LA});var Mp=Ke(lu=>{"use strict";m();d();f();p();Object.defineProperty(lu,"__esModule",{value:!0});function qA(e){var t=Math.random()*e;return Math.round(t)}lu.fullJitter=qA});var jp=Ke(du=>{"use strict";m();d();f();p();Object.defineProperty(du,"__esModule",{value:!0});function UA(e){return e}du.noJitter=UA});var Lp=Ke(pu=>{"use strict";m();d();f();p();Object.defineProperty(pu,"__esModule",{value:!0});var VA=Mp(),BA=jp();function GA(e){return e.jitter==="full"?VA.fullJitter:BA.noJitter}pu.JitterFactory=GA});var mu=Ke(fu=>{"use strict";m();d();f();p();Object.defineProperty(fu,"__esModule",{value:!0});var $A=Lp(),QA=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=$A.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=t*Math.pow(r,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();fu.Delay=QA});var qp=Ke(er=>{"use strict";m();d();f();p();var HA=er&&er.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),zA=er&&er.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},WA=er&&er.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(er,"__esModule",{value:!0});var KA=mu(),YA=function(e){HA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return zA(this,void 0,void 0,function(){return WA(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(KA.Delay);er.SkipFirstDelay=YA});var Up=Ke(Di=>{"use strict";m();d();f();p();var XA=Di&&Di.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Di,"__esModule",{value:!0});var JA=mu(),ZA=function(e){XA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(JA.Delay);Di.AlwaysDelay=ZA});var Vp=Ke(gu=>{"use strict";m();d();f();p();Object.defineProperty(gu,"__esModule",{value:!0});var eb=qp(),tb=Up();function rb(e,t){var r=nb(e);return r.setAttemptNumber(t),r}gu.DelayFactory=rb;function nb(e){return e.delayFirstAttempt?new tb.AlwaysDelay(e):new eb.SkipFirstDelay(e)}});var Bp=Ke(jr=>{"use strict";m();d();f();p();var hu=jr&&jr.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},yu=jr&&jr.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(jr,"__esModule",{value:!0});var ib=Dp(),ob=Vp();function sb(e,t){return t===void 0&&(t={}),hu(this,void 0,void 0,function(){var r,n;return yu(this,function(i){switch(i.label){case 0:return r=ib.getSanitizedOptions(t),n=new ab(e,r),[4,n.execute()];case 1:return[2,i.sent()]}})})}jr.backOff=sb;var ab=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return hu(this,void 0,void 0,function(){var t,r;return yu(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return hu(this,void 0,void 0,function(){var t;return yu(this,function(r){switch(r.label){case 0:return t=ob.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var ga=Ke(($l,Ql)=>{"use strict";m();d();f();p();(function(e,t){typeof $l=="object"&&typeof Ql<"u"?Ql.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})($l,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},E=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},_={s:E,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+E(Q,2,"0")+":"+E($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,u),Y=N-$<0,W=P.clone().add(Q+(Y?-1:1),u);return+(-(Q+(N-$)/(Y?$-W:W-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:u,y:v,w:c,d:a,D:S,h:s,m:o,s:i,ms:n,Q:h}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},I="en",k={};k[I]=x;var T="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[T])},V=function O(P,N,Q){var $;if(!P)return I;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var W=P.split("-");if(!$&&W.length>1)return O(W[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(I=$),$||!Q&&I},L=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},j=_;j.l=V,j.i=F,j.w=function(O,P){return L(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[T]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(j.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var W=$.match(y);if(W){var H=W[2]-1||0,J=(W[7]||"0").substring(0,3);return Y?new Date(Date.UTC(W[1],H,W[3]||1,W[4]||0,W[5]||0,W[6]||0,J)):new Date(W[1],H,W[3]||1,W[4]||0,W[5]||0,W[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return j},P.isValid=function(){return this.$d.toString()!==g},P.isSame=function(N,Q){var $=L(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return L(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<L(N)},P.$g=function(N,Q,$){return j.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!j.u(Q)||Q,W=j.p(N),H=function(le,ue){var fe=j.w($.$u?Date.UTC($.$y,ue,le):new Date($.$y,ue,le),$);return Y?fe:fe.endOf(a)},J=function(le,ue){return j.w($.toDate()[le].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(ue)),$)},ie=this.$W,ve=this.$M,Oe=this.$D,xe="set"+(this.$u?"UTC":"");switch(W){case v:return Y?H(1,0):H(31,11);case u:return Y?H(1,ve):H(0,ve+1);case c:var Te=this.$locale().weekStart||0,_e=(ie<Te?ie+7:ie)-Te;return H(Y?Oe-_e:Oe+(6-_e),ve);case a:case S:return J(xe+"Hours",0);case s:return J(xe+"Minutes",1);case o:return J(xe+"Seconds",2);case i:return J(xe+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=j.p(N),W="set"+(this.$u?"UTC":""),H=($={},$[a]=W+"Date",$[S]=W+"Date",$[u]=W+"Month",$[v]=W+"FullYear",$[s]=W+"Hours",$[o]=W+"Minutes",$[i]=W+"Seconds",$[n]=W+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===u||Y===v){var ie=this.clone().set(S,1);ie.$d[H](J),ie.init(),this.$d=ie.set(S,Math.min(this.$D,ie.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[j.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var W=j.p(Q),H=function(ve){var Oe=L(Y);return j.w(Oe.date(Oe.date()+Math.round(ve*N)),Y)};if(W===u)return this.set(u,this.$M+N);if(W===v)return this.set(v,this.$y+N);if(W===a)return H(1);if(W===c)return H(7);var J=($={},$[o]=t,$[s]=r,$[i]=e,$)[W]||1,ie=this.$d.getTime()+N*J;return j.w(ie,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||g;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",W=j.z(this),H=this.$H,J=this.$m,ie=this.$M,ve=$.weekdays,Oe=$.months,xe=$.meridiem,Te=function(ue,fe,de,Ue){return ue&&(ue[fe]||ue(Q,Y))||de[fe].slice(0,Ue)},_e=function(ue){return j.s(H%12||12,ue,"0")},le=xe||function(ue,fe,de){var Ue=ue<12?"AM":"PM";return de?Ue.toLowerCase():Ue};return Y.replace(C,function(ue,fe){return fe||function(de){switch(de){case"YY":return String(Q.$y).slice(-2);case"YYYY":return j.s(Q.$y,4,"0");case"M":return ie+1;case"MM":return j.s(ie+1,2,"0");case"MMM":return Te($.monthsShort,ie,Oe,3);case"MMMM":return Te(Oe,ie);case"D":return Q.$D;case"DD":return j.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return Te($.weekdaysMin,Q.$W,ve,2);case"ddd":return Te($.weekdaysShort,Q.$W,ve,3);case"dddd":return ve[Q.$W];case"H":return String(H);case"HH":return j.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return le(H,J,!0);case"A":return le(H,J,!1);case"m":return String(J);case"mm":return j.s(J,2,"0");case"s":return String(Q.$s);case"ss":return j.s(Q.$s,2,"0");case"SSS":return j.s(Q.$ms,3,"0");case"Z":return W}return null}(ue)||W.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,W=this,H=j.p(Q),J=L(N),ie=(J.utcOffset()-this.utcOffset())*t,ve=this-J,Oe=function(){return j.m(W,J)};switch(H){case v:Y=Oe()/12;break;case u:Y=Oe();break;case h:Y=Oe()/3;break;case c:Y=(ve-ie)/6048e5;break;case a:Y=(ve-ie)/864e5;break;case s:Y=ve/r;break;case o:Y=ve/t;break;case i:Y=ve/e;break;default:Y=ve}return $?Y:j.a(Y)},P.daysInMonth=function(){return this.endOf(u).$D},P.$locale=function(){return k[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return j.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=U.prototype;return L.prototype=M,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",u],["$y",v],["$D",S]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),L.extend=function(O,P){return O.$i||(O(P,U,L),O.$i=!0),L},L.locale=V,L.isDayjs=F,L.unix=function(O){return L(1e3*O)},L.en=k[I],L.Ls=k,L.p={},L})});var th=Ke((Hl,zl)=>{"use strict";m();d();f();p();(function(e,t){typeof Hl=="object"&&typeof zl<"u"?zl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(Hl,function(){"use strict";var e="month",t="quarter";return function(r,n){var i=n.prototype;i.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var o=i.add;i.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):o.bind(this)(a,c)};var s=i.startOf;i.startOf=function(a,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(a)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,c)}}})});var rh=Ke((Wl,Kl)=>{"use strict";m();d();f();p();(function(e,t){typeof Wl=="object"&&typeof Kl<"u"?Kl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Wl,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(C){this[y]=+C}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(C){if(!C||C==="Z")return 0;var x=C.match(/([+-]|\d\d)/g),E=60*x[1]+(+x[2]||0);return E===0?0:x[0]==="+"?-E:E}(y)}],h=function(y){var C=s[y];return C&&(C.indexOf?C:C.s.concat(C.f))},v=function(y,C){var x,E=s.meridiem;if(E){for(var _=1;_<=24;_+=1)if(y.indexOf(E(_,0,C))>-1){x=_>12;break}}else x=y===(C?"pm":"PM");return x},S={A:[o,function(y){this.afternoon=v(y,!1)}],a:[o,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[n,c("day")],Do:[o,function(y){var C=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],C)for(var E=1;E<=31;E+=1)C(E).replace(/\[|\]/g,"")===y&&(this.day=E)}],w:[i,c("week")],ww:[n,c("week")],M:[i,c("month")],MM:[n,c("month")],MMM:[o,function(y){var C=h("months"),x=(h("monthsShort")||C.map(function(E){return E.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[o,function(y){var C=h("months").indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var C,x;C=y,x=s&&s.formats;for(var E=(y=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(L,j,U){var M=U&&U.toUpperCase();return j||x[U]||e[U]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),_=E.length,I=0;I<_;I+=1){var k=E[I],T=S[k],F=T&&T[0],V=T&&T[1];E[I]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(L){for(var j={},U=0,M=0;U<_;U+=1){var O=E[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=L.slice(M),$=P.exec(Q)[0];N.call(j,$),L=L.replace($,"")}}return function(Y){var W=Y.afternoon;if(W!==void 0){var H=Y.hours;W?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(j),j}}return function(y,C,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var E=C.prototype,_=E.parse;E.parse=function(I){var k=I.date,T=I.utc,F=I.args;this.$u=T;var V=F[1];if(typeof V=="string"){var L=F[2]===!0,j=F[3]===!0,U=L||j,M=F[2];j&&(M=F[2]),s=this.$locale(),!L&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,W){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=g($)(Q),J=H.year,ie=H.month,ve=H.day,Oe=H.hours,xe=H.minutes,Te=H.seconds,_e=H.milliseconds,le=H.zone,ue=H.week,fe=new Date,de=ve||(J||ie?1:fe.getDate()),Ue=J||fe.getFullYear(),Qe=0;J&&!ie||(Qe=ie>0?ie-1:fe.getMonth());var It,mt=Oe||0,jt=xe||0,vt=Te||0,Tt=_e||0;return le?new Date(Date.UTC(Ue,Qe,de,mt,jt,vt,Tt+60*le.offset*1e3)):Y?new Date(Date.UTC(Ue,Qe,de,mt,jt,vt,Tt)):(It=new Date(Ue,Qe,de,mt,jt,vt,Tt),ue&&(It=W(It).week(ue).toDate()),It)}catch{return new Date("")}}(k,V,T,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else _.call(this,I)}}})});var Qh=Ke((dd,pd)=>{"use strict";m();d();f();p();(function(e,t){typeof dd=="object"&&typeof pd<"u"?pd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(dd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,i){var o,s=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(C,x){x===void 0&&(x={});var E=x.timeZoneName||"short",_=C+"|"+E,I=t[_];return I||(I=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:C,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),t[_]=I),I}(v,S);return y.formatToParts(g)},a=function(h,v){for(var S=s(h,v),g=[],y=0;y<S.length;y+=1){var C=S[y],x=C.type,E=C.value,_=e[x];_>=0&&(g[_]=parseInt(E,10))}var I=g[3],k=I===24?0:I,T=g[0]+"-"+g[1]+"-"+g[2]+" "+k+":"+g[4]+":"+g[5]+":000",F=+h;return(i.utc(T).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=o);var S,g=this.utcOffset(),y=this.toDate(),C=y.toLocaleString("en-US",{timeZone:h}),x=Math.round((y-new Date(C))/1e3/60),E=15*-Math.round(y.getTimezoneOffset()/15)-x;if(!Number(E))S=this.utcOffset(0,v);else if(S=i(C,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(E,!0),v){var _=S.utcOffset();S=S.add(g-_,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||i.tz.guess(),S=s(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},i.tz=function(h,v,S){var g=S&&v,y=S||v||o,C=a(+i(),y);if(typeof h!="string")return i(h).tz(y);var x=function(k,T,F){var V=k-60*T*1e3,L=a(V,F);if(T===L)return[V,T];var j=a(V-=60*(L-T)*1e3,F);return L===j?[V,L]:[k-60*Math.min(L,j)*1e3,Math.max(L,j)]}(i.utc(h,g).valueOf(),C,y),E=x[0],_=x[1],I=i(E).utcOffset(_);return I.$x.$timezone=y,I},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(h){o=h}}})});var Hh=Ke((fd,md)=>{"use strict";m();d();f();p();(function(e,t){typeof fd=="object"&&typeof md<"u"?md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(fd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,i,o){var s=i.prototype;o.utc=function(g){var y={date:g,utc:!0,args:arguments};return new i(y)},s.utc=function(g){var y=o(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),a.call(this,g)};var c=s.init;s.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(g,y){var C=this.$utils().u;if(C(g))return this.$u?0:C(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(I){I===void 0&&(I="");var k=I.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],F=T[0],V=60*+T[1]+ +T[2];return V===0?0:F==="+"?V:-V}(g),g===null))return this;var x=Math.abs(g)<=16?60*g:g;if(x===0)return this.utc(y);var E=this.clone();if(y)return E.$offset=x,E.$u=!1,E;var _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(E=this.local().add(x+_,e)).$offset=x,E.$x.$localOffset=_,E};var h=s.format;s.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},s.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(g){return g==="s"&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=s.diff;s.diff=function(g,y,C){if(g&&this.$u===g.$u)return S.call(this,g,y,C);var x=this.local(),E=o(g).local();return S.call(x,E,y,C)}}})});var CS=Ke((Xoe,wS)=>{"use strict";m();d();f();p();function Fk(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}wS.exports=Dk;function Dk(e,t,r){var n=r&&r.stringify||Fk,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var s=new Array(o);s[0]=n(e);for(var a=1;a<o;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",h=1-i,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var _S=Ke((rse,Qc)=>{"use strict";m();d();f();p();var xS=CS();Qc.exports=fr;var Vo=Yk().console||{},Mk={mapHttpRequest:$c,mapHttpResponse:$c,wrapRequestSerializer:cp,wrapResponseSerializer:cp,wrapErrorSerializer:cp,req:$c,res:$c,err:RS,errWithCause:RS};function Fr(e,t){return e==="silent"?1/0:t.levels.values[e]}var dp=Symbol("pino.logFuncs"),up=Symbol("pino.hierarchy"),jk={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function ES(e,t){let r={logger:t,parent:e[up]};t[up]=r}function Lk(e,t,r){let n={};t.forEach(i=>{n[i]=r[i]?r[i]:Vo[i]||Vo[jk[i]||"log"]||Ei}),e[dp]=n}function qk(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function fr(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Vo;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},i=qk(e.browser.serialize,n),o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(C){r[C]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Ei),Lk(u,a,r),ES({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:zk(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ei};u.levels=Uk(e),u.level=c,u.isLevelEnabled=function(C){return this.levels.values[C]?this.levels.values[C]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Ei,u.serializers=n,u._serialize=i,u._stdErrSerialize=o,u.child=function(...C){return y.call(this,h,...C)},t&&(u._logEvent=lp());function v(){return Fr(this.level,this)}function S(){return this._level}function g(C){if(C!=="silent"&&!this.levels.values[C])throw Error("unknown level "+C);this._level=C,Rn(this,h,u,"error"),Rn(this,h,u,"fatal"),Rn(this,h,u,"warn"),Rn(this,h,u,"info"),Rn(this,h,u,"debug"),Rn(this,h,u,"trace"),s.forEach(x=>{Rn(this,h,u,x)})}function y(C,x,E){if(!x)throw new Error("missing bindings for child Pino");E=E||{},i&&x.serializers&&(E.serializers=x.serializers);let _=E.serializers;if(i&&_){var I=Object.assign({},n,_),k=e.browser.serialize===!0?Object.keys(I):i;delete x.serializers,pp([x],k,I,this._stdErrSerialize)}function T(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,I&&(this.serializers=I,this._serialize=k),t&&(this._logEvent=lp([].concat(V._logEvent.bindings,x)))}T.prototype=this;let F=new T(this);return ES(this,F),F.child=function(...V){return y.call(this,C,...V)},F.level=E.level||this.level,C.onChild(F),F}return u}function Uk(e){let t=e.customLevels||{},r=Object.assign({},fr.levels.values,t),n=Object.assign({},fr.levels.labels,Vk(t));return{values:r,labels:n}}function Vk(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}fr.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};fr.stdSerializers=Mk;fr.stdTimeFunctions=Object.assign({},{nullTime:IS,epochTime:TS,unixTime:Wk,isoTime:Kk});function Bk(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[up];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Rn(e,t,r,n){if(Object.defineProperty(e,n,{value:Fr(e.level,r)>Fr(n,r)?Ei:r[dp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ei){if(!t.transmit)return;let o=t.transmit.level||e.level,s=Fr(o,r);if(Fr(n,r)<s)return}e[n]=$k(e,t,r,n);let i=Bk(e);i.length!==0&&(e[n]=Gk(i,e[n]))}function Gk(e,t){return function(){return t.apply(this,[...e,...arguments])}}function $k(e,t,r,n){return function(i){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Vo?Vo:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var h=!1;if(t.serialize&&(pp(a,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?i.call(c,...Qk(this,n,a,s,t)):i.apply(c,a),t.transmit){let v=t.transmit.level||e._level,S=Fr(v,r),g=Fr(n,r);if(g<S)return;Hk(this,{ts:s,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Fr(e._level,r)},a,h)}}}(e[dp][n])}function Qk(e,t,r,n,i){let{level:o,log:s=v=>v}=i.formatters||{},a=r.slice(),c=a[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),o){let v=o(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?xS(a.shift(),a):void 0}else typeof c=="string"&&(c=xS(a.shift(),a));return c!==void 0&&(u[i.messageKey]=c),[s(u)]}}function pp(e,t,r,n){for(let i in e)if(n&&e[i]instanceof Error)e[i]=fr.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i])&&t)for(let o in e[i])t.indexOf(o)>-1&&o in r&&(e[i][o]=r[o](e[i][o]))}function Hk(e,t,r,n=!1){let i=t.send,o=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||pp(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,i(s,e._logEvent,c),e._logEvent=lp(u)}function lp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function RS(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function zk(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?IS:TS}function $c(){return{}}function cp(e){return e}function Ei(){}function IS(){return!1}function TS(){return Date.now()}function Wk(){return Math.round(Date.now()/1e3)}function Kk(){return new Date(Date.now()).toISOString()}function Yk(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}Qc.exports.default=fr;Qc.exports.pino=fr});var b0={};$o(b0,{ResultTemplatesHelpers:()=>hh,buildCaseAssistEngine:()=>DS,buildCaseField:()=>YS,buildCaseInput:()=>XS,buildController:()=>Zt,buildDocumentSuggestion:()=>mp,buildDocumentSuggestionList:()=>mp,buildInteractiveResult:()=>ZS,buildQuickview:()=>nA,getAnalyticsNextApiBaseUrl:()=>Xo,getOrganizationEndpoint:()=>qe,loadCaseAssistAnalyticsActions:()=>y0,loadCaseFieldActions:()=>v0,loadCaseInputActions:()=>S0,loadDocumentSuggestionActions:()=>A0,loadGenericAnalyticsActions:()=>h0});module.exports=gA(b0);m();d();f();p();m();d();f();p();var Yp=_t(Bp(),1);m();d();f();p();var St=new Error("Failed to load reducers."),Pn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},Lr=class extends Error{constructor(r,n){super();Se(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Gp(e){return Array.isArray(e)}function $p(e,t){return[...e.reduce((r,n)=>{let i=t(n);return r.has(i)||r.set(i,n),r},new Map).values()]}var cb=new Set(["1",1,"yes",!0]);function Qp(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>cb.has(r))}function Hp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Yo(e,t,r={}){let n;return(...i)=>{let o=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,i)},t),o)return e.apply(void 0,i)}}m();d();f();p();function zp(e){let t=[];for(let r in e){let n=encodeURIComponent(r),i=encodeURIComponent(e[r]);t.push(`${n}=${i}`)}return t.join("&")}function Wp(e){return typeof e!="object"||!e?!1:Object.values(e).every(ub)}function ub(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Kp(e){return e===429}var gr=class e{static call(t){return _asyncToGenerator(function*(){let r=lb(t),{logger:n}=t,i=yield e.preprocessRequest(r,t);n.info(i,"Platform request");let{url:o,...s}=i,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield b(o,s);if(Kp(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Yp.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&Kp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Pn;case 404:throw new Lr(o,c.status);default:return n.info({response:c,requestInfo:i},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Lr(o):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:i,logger:o,requestMetadata:s}=r,{signal:a,...c}=t,u=Mi(c);try{let h=yield i(t,n,s);return{...t,...h}}catch(h){o.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function qe(e,t="prod",r="platform"){let n=t==="prod"?"":t,i=r==="platform"?"":`.${r}`;return`https://${e}${i}.org${n}.coveo.com`}function Nn(e,t="prod"){return`${qe(e,t)}/rest/search/v2`}function Xo(e,t="prod"){return`${qe(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function lb(e){let{url:t,method:r,requestParams:n,contentType:i,accessToken:o,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=db(n,i);return{url:t,method:r,headers:{"Content-Type":i,Authorization:`Bearer ${o}`,...e.headers},...(a&&{body:c}),signal:s}}function db(e,t){return t==="application/x-www-form-urlencoded"?Wp(e)?zp(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function pb(e,t){let r=`
19
+ `,"\r","\t"," "],DA=new RegExp(`(^[${_p.join("")}]|$[${_p.join("")}])`,"g");On=Symbol("normalizedHeaders"),uu=Symbol("rawHeaderNames"),Pp=", ",w=class Np{constructor(t){this[On]={},this[uu]=new Map,this[Op]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Np||typeof A.Headers<"u"&&t instanceof A.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Pp):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Pp):n)})}[(Op=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[On]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Ni(t))throw new TypeError(`Invalid header name "${t}"`);return this[On].hasOwnProperty(Pi(t))}get(t){if(!Ni(t))throw TypeError(`Invalid header name "${t}"`);return this[On][Pi(t)]??null}set(t,r){if(!Ni(t)||!kp(r))return;let n=Pi(t),i=cu(r);this[On][n]=cu(i),this[uu].set(n,t)}append(t,r){if(!Ni(t)||!kp(r))return;let n=Pi(t),i=cu(r),o=this.has(n)?`${this.get(n)}, ${i}`:i;this.set(t,o)}delete(t){if(!Ni(t)||!this.has(t))return;let r=Pi(t);delete this[On][r],this[uu].delete(r)}forEach(t,r){for(let[n,i]of this.entries())t.call(r,i,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Wo(t)}}});var m=Tn(()=>{"use strict";Fp()});var Dp=Ke(Fi=>{"use strict";m();d();f();p();var Ko=Fi&&Fi.__assign||function(){return Ko=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ko.apply(this,arguments)};Object.defineProperty(Fi,"__esModule",{value:!0});var jA={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function LA(e){var t=Ko(Ko({},jA),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Fi.getSanitizedOptions=LA});var Mp=Ke(lu=>{"use strict";m();d();f();p();Object.defineProperty(lu,"__esModule",{value:!0});function qA(e){var t=Math.random()*e;return Math.round(t)}lu.fullJitter=qA});var jp=Ke(du=>{"use strict";m();d();f();p();Object.defineProperty(du,"__esModule",{value:!0});function UA(e){return e}du.noJitter=UA});var Lp=Ke(pu=>{"use strict";m();d();f();p();Object.defineProperty(pu,"__esModule",{value:!0});var VA=Mp(),BA=jp();function GA(e){return e.jitter==="full"?VA.fullJitter:BA.noJitter}pu.JitterFactory=GA});var mu=Ke(fu=>{"use strict";m();d();f();p();Object.defineProperty(fu,"__esModule",{value:!0});var $A=Lp(),QA=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=$A.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=t*Math.pow(r,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();fu.Delay=QA});var qp=Ke(er=>{"use strict";m();d();f();p();var HA=er&&er.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),zA=er&&er.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},WA=er&&er.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(er,"__esModule",{value:!0});var KA=mu(),YA=function(e){HA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return zA(this,void 0,void 0,function(){return WA(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(KA.Delay);er.SkipFirstDelay=YA});var Up=Ke(Di=>{"use strict";m();d();f();p();var XA=Di&&Di.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Di,"__esModule",{value:!0});var JA=mu(),ZA=function(e){XA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(JA.Delay);Di.AlwaysDelay=ZA});var Vp=Ke(gu=>{"use strict";m();d();f();p();Object.defineProperty(gu,"__esModule",{value:!0});var eb=qp(),tb=Up();function rb(e,t){var r=nb(e);return r.setAttemptNumber(t),r}gu.DelayFactory=rb;function nb(e){return e.delayFirstAttempt?new tb.AlwaysDelay(e):new eb.SkipFirstDelay(e)}});var Bp=Ke(jr=>{"use strict";m();d();f();p();var hu=jr&&jr.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},yu=jr&&jr.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(jr,"__esModule",{value:!0});var ib=Dp(),ob=Vp();function sb(e,t){return t===void 0&&(t={}),hu(this,void 0,void 0,function(){var r,n;return yu(this,function(i){switch(i.label){case 0:return r=ib.getSanitizedOptions(t),n=new ab(e,r),[4,n.execute()];case 1:return[2,i.sent()]}})})}jr.backOff=sb;var ab=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return hu(this,void 0,void 0,function(){var t,r;return yu(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return hu(this,void 0,void 0,function(){var t;return yu(this,function(r){switch(r.label){case 0:return t=ob.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var ga=Ke(($l,Ql)=>{"use strict";m();d();f();p();(function(e,t){typeof $l=="object"&&typeof Ql<"u"?Ql.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})($l,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var P=["th","st","nd","rd"],N=O%100;return"["+O+(P[(N-20)%10]||P[N]||P[0])+"]"}},E=function(O,P,N){var Q=String(O);return!Q||Q.length>=P?O:""+Array(P+1-Q.length).join(N)+O},_={s:E,z:function(O){var P=-O.utcOffset(),N=Math.abs(P),Q=Math.floor(N/60),$=N%60;return(P<=0?"+":"-")+E(Q,2,"0")+":"+E($,2,"0")},m:function O(P,N){if(P.date()<N.date())return-O(N,P);var Q=12*(N.year()-P.year())+(N.month()-P.month()),$=P.clone().add(Q,u),Y=N-$<0,W=P.clone().add(Q+(Y?-1:1),u);return+(-(Q+(N-$)/(Y?$-W:W-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:u,y:v,w:c,d:a,D:S,h:s,m:o,s:i,ms:n,Q:h}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},I="en",k={};k[I]=x;var T="$isDayjsObject",F=function(O){return O instanceof U||!(!O||!O[T])},V=function O(P,N,Q){var $;if(!P)return I;if(typeof P=="string"){var Y=P.toLowerCase();k[Y]&&($=Y),N&&(k[Y]=N,$=Y);var W=P.split("-");if(!$&&W.length>1)return O(W[0])}else{var H=P.name;k[H]=P,$=H}return!Q&&$&&(I=$),$||!Q&&I},L=function(O,P){if(F(O))return O.clone();var N=typeof P=="object"?P:{};return N.date=O,N.args=arguments,new U(N)},j=_;j.l=V,j.i=F,j.w=function(O,P){return L(O,{locale:P.$L,utc:P.$u,x:P.$x,$offset:P.$offset})};var U=function(){function O(N){this.$L=V(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[T]=!0}var P=O.prototype;return P.parse=function(N){this.$d=function(Q){var $=Q.date,Y=Q.utc;if($===null)return new Date(NaN);if(j.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var W=$.match(y);if(W){var H=W[2]-1||0,J=(W[7]||"0").substring(0,3);return Y?new Date(Date.UTC(W[1],H,W[3]||1,W[4]||0,W[5]||0,W[6]||0,J)):new Date(W[1],H,W[3]||1,W[4]||0,W[5]||0,W[6]||0,J)}}return new Date($)}(N),this.init()},P.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},P.$utils=function(){return j},P.isValid=function(){return this.$d.toString()!==g},P.isSame=function(N,Q){var $=L(N);return this.startOf(Q)<=$&&$<=this.endOf(Q)},P.isAfter=function(N,Q){return L(N)<this.startOf(Q)},P.isBefore=function(N,Q){return this.endOf(Q)<L(N)},P.$g=function(N,Q,$){return j.u(N)?this[Q]:this.set($,N)},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this.$d.getTime()},P.startOf=function(N,Q){var $=this,Y=!!j.u(Q)||Q,W=j.p(N),H=function(le,ue){var fe=j.w($.$u?Date.UTC($.$y,ue,le):new Date($.$y,ue,le),$);return Y?fe:fe.endOf(a)},J=function(le,ue){return j.w($.toDate()[le].apply($.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(ue)),$)},ie=this.$W,ve=this.$M,Oe=this.$D,xe="set"+(this.$u?"UTC":"");switch(W){case v:return Y?H(1,0):H(31,11);case u:return Y?H(1,ve):H(0,ve+1);case c:var Te=this.$locale().weekStart||0,_e=(ie<Te?ie+7:ie)-Te;return H(Y?Oe-_e:Oe+(6-_e),ve);case a:case S:return J(xe+"Hours",0);case s:return J(xe+"Minutes",1);case o:return J(xe+"Seconds",2);case i:return J(xe+"Milliseconds",3);default:return this.clone()}},P.endOf=function(N){return this.startOf(N,!1)},P.$set=function(N,Q){var $,Y=j.p(N),W="set"+(this.$u?"UTC":""),H=($={},$[a]=W+"Date",$[S]=W+"Date",$[u]=W+"Month",$[v]=W+"FullYear",$[s]=W+"Hours",$[o]=W+"Minutes",$[i]=W+"Seconds",$[n]=W+"Milliseconds",$)[Y],J=Y===a?this.$D+(Q-this.$W):Q;if(Y===u||Y===v){var ie=this.clone().set(S,1);ie.$d[H](J),ie.init(),this.$d=ie.set(S,Math.min(this.$D,ie.daysInMonth())).$d}else H&&this.$d[H](J);return this.init(),this},P.set=function(N,Q){return this.clone().$set(N,Q)},P.get=function(N){return this[j.p(N)]()},P.add=function(N,Q){var $,Y=this;N=Number(N);var W=j.p(Q),H=function(ve){var Oe=L(Y);return j.w(Oe.date(Oe.date()+Math.round(ve*N)),Y)};if(W===u)return this.set(u,this.$M+N);if(W===v)return this.set(v,this.$y+N);if(W===a)return H(1);if(W===c)return H(7);var J=($={},$[o]=t,$[s]=r,$[i]=e,$)[W]||1,ie=this.$d.getTime()+N*J;return j.w(ie,this)},P.subtract=function(N,Q){return this.add(-1*N,Q)},P.format=function(N){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||g;var Y=N||"YYYY-MM-DDTHH:mm:ssZ",W=j.z(this),H=this.$H,J=this.$m,ie=this.$M,ve=$.weekdays,Oe=$.months,xe=$.meridiem,Te=function(ue,fe,de,Ue){return ue&&(ue[fe]||ue(Q,Y))||de[fe].slice(0,Ue)},_e=function(ue){return j.s(H%12||12,ue,"0")},le=xe||function(ue,fe,de){var Ue=ue<12?"AM":"PM";return de?Ue.toLowerCase():Ue};return Y.replace(C,function(ue,fe){return fe||function(de){switch(de){case"YY":return String(Q.$y).slice(-2);case"YYYY":return j.s(Q.$y,4,"0");case"M":return ie+1;case"MM":return j.s(ie+1,2,"0");case"MMM":return Te($.monthsShort,ie,Oe,3);case"MMMM":return Te(Oe,ie);case"D":return Q.$D;case"DD":return j.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return Te($.weekdaysMin,Q.$W,ve,2);case"ddd":return Te($.weekdaysShort,Q.$W,ve,3);case"dddd":return ve[Q.$W];case"H":return String(H);case"HH":return j.s(H,2,"0");case"h":return _e(1);case"hh":return _e(2);case"a":return le(H,J,!0);case"A":return le(H,J,!1);case"m":return String(J);case"mm":return j.s(J,2,"0");case"s":return String(Q.$s);case"ss":return j.s(Q.$s,2,"0");case"SSS":return j.s(Q.$ms,3,"0");case"Z":return W}return null}(ue)||W.replace(":","")})},P.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},P.diff=function(N,Q,$){var Y,W=this,H=j.p(Q),J=L(N),ie=(J.utcOffset()-this.utcOffset())*t,ve=this-J,Oe=function(){return j.m(W,J)};switch(H){case v:Y=Oe()/12;break;case u:Y=Oe();break;case h:Y=Oe()/3;break;case c:Y=(ve-ie)/6048e5;break;case a:Y=(ve-ie)/864e5;break;case s:Y=ve/r;break;case o:Y=ve/t;break;case i:Y=ve/e;break;default:Y=ve}return $?Y:j.a(Y)},P.daysInMonth=function(){return this.endOf(u).$D},P.$locale=function(){return k[this.$L]},P.locale=function(N,Q){if(!N)return this.$L;var $=this.clone(),Y=V(N,Q,!0);return Y&&($.$L=Y),$},P.clone=function(){return j.w(this.$d,this)},P.toDate=function(){return new Date(this.valueOf())},P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toISOString=function(){return this.$d.toISOString()},P.toString=function(){return this.$d.toUTCString()},O}(),M=U.prototype;return L.prototype=M,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",u],["$y",v],["$D",S]].forEach(function(O){M[O[1]]=function(P){return this.$g(P,O[0],O[1])}}),L.extend=function(O,P){return O.$i||(O(P,U,L),O.$i=!0),L},L.locale=V,L.isDayjs=F,L.unix=function(O){return L(1e3*O)},L.en=k[I],L.Ls=k,L.p={},L})});var th=Ke((Hl,zl)=>{"use strict";m();d();f();p();(function(e,t){typeof Hl=="object"&&typeof zl<"u"?zl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(Hl,function(){"use strict";var e="month",t="quarter";return function(r,n){var i=n.prototype;i.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var o=i.add;i.add=function(a,c){return a=Number(a),this.$utils().p(c)===t?this.add(3*a,e):o.bind(this)(a,c)};var s=i.startOf;i.startOf=function(a,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(a)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return s.bind(this)(a,c)}}})});var rh=Ke((Wl,Kl)=>{"use strict";m();d();f();p();(function(e,t){typeof Wl=="object"&&typeof Kl<"u"?Kl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Wl,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(C){this[y]=+C}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(C){if(!C||C==="Z")return 0;var x=C.match(/([+-]|\d\d)/g),E=60*x[1]+(+x[2]||0);return E===0?0:x[0]==="+"?-E:E}(y)}],h=function(y){var C=s[y];return C&&(C.indexOf?C:C.s.concat(C.f))},v=function(y,C){var x,E=s.meridiem;if(E){for(var _=1;_<=24;_+=1)if(y.indexOf(E(_,0,C))>-1){x=_>12;break}}else x=y===(C?"pm":"PM");return x},S={A:[o,function(y){this.afternoon=v(y,!1)}],a:[o,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[n,c("day")],Do:[o,function(y){var C=s.ordinal,x=y.match(/\d+/);if(this.day=x[0],C)for(var E=1;E<=31;E+=1)C(E).replace(/\[|\]/g,"")===y&&(this.day=E)}],w:[i,c("week")],ww:[n,c("week")],M:[i,c("month")],MM:[n,c("month")],MMM:[o,function(y){var C=h("months"),x=(h("monthsShort")||C.map(function(E){return E.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[o,function(y){var C=h("months").indexOf(y)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=a(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var C,x;C=y,x=s&&s.formats;for(var E=(y=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(L,j,U){var M=U&&U.toUpperCase();return j||x[U]||e[U]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(O,P,N){return P||N.slice(1)})})).match(t),_=E.length,I=0;I<_;I+=1){var k=E[I],T=S[k],F=T&&T[0],V=T&&T[1];E[I]=V?{regex:F,parser:V}:k.replace(/^\[|\]$/g,"")}return function(L){for(var j={},U=0,M=0;U<_;U+=1){var O=E[U];if(typeof O=="string")M+=O.length;else{var P=O.regex,N=O.parser,Q=L.slice(M),$=P.exec(Q)[0];N.call(j,$),L=L.replace($,"")}}return function(Y){var W=Y.afternoon;if(W!==void 0){var H=Y.hours;W?H<12&&(Y.hours+=12):H===12&&(Y.hours=0),delete Y.afternoon}}(j),j}}return function(y,C,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var E=C.prototype,_=E.parse;E.parse=function(I){var k=I.date,T=I.utc,F=I.args;this.$u=T;var V=F[1];if(typeof V=="string"){var L=F[2]===!0,j=F[3]===!0,U=L||j,M=F[2];j&&(M=F[2]),s=this.$locale(),!L&&M&&(s=x.Ls[M]),this.$d=function(Q,$,Y,W){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var H=g($)(Q),J=H.year,ie=H.month,ve=H.day,Oe=H.hours,xe=H.minutes,Te=H.seconds,_e=H.milliseconds,le=H.zone,ue=H.week,fe=new Date,de=ve||(J||ie?1:fe.getDate()),Ue=J||fe.getFullYear(),Qe=0;J&&!ie||(Qe=ie>0?ie-1:fe.getMonth());var It,mt=Oe||0,jt=xe||0,vt=Te||0,Tt=_e||0;return le?new Date(Date.UTC(Ue,Qe,de,mt,jt,vt,Tt+60*le.offset*1e3)):Y?new Date(Date.UTC(Ue,Qe,de,mt,jt,vt,Tt)):(It=new Date(Ue,Qe,de,mt,jt,vt,Tt),ue&&(It=W(It).week(ue).toDate()),It)}catch{return new Date("")}}(k,V,T,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&k!=this.format(V)&&(this.$d=new Date("")),s={}}else if(V instanceof Array)for(var O=V.length,P=1;P<=O;P+=1){F[1]=V[P-1];var N=x.apply(this,F);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}P===O&&(this.$d=new Date(""))}else _.call(this,I)}}})});var Qh=Ke((dd,pd)=>{"use strict";m();d();f();p();(function(e,t){typeof dd=="object"&&typeof pd<"u"?pd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(dd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,i){var o,s=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(C,x){x===void 0&&(x={});var E=x.timeZoneName||"short",_=C+"|"+E,I=t[_];return I||(I=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:C,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),t[_]=I),I}(v,S);return y.formatToParts(g)},a=function(h,v){for(var S=s(h,v),g=[],y=0;y<S.length;y+=1){var C=S[y],x=C.type,E=C.value,_=e[x];_>=0&&(g[_]=parseInt(E,10))}var I=g[3],k=I===24?0:I,T=g[0]+"-"+g[1]+"-"+g[2]+" "+k+":"+g[4]+":"+g[5]+":000",F=+h;return(i.utc(T).valueOf()-(F-=F%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=o);var S,g=this.utcOffset(),y=this.toDate(),C=y.toLocaleString("en-US",{timeZone:h}),x=Math.round((y-new Date(C))/1e3/60),E=15*-Math.round(y.getTimezoneOffset()/15)-x;if(!Number(E))S=this.utcOffset(0,v);else if(S=i(C,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(E,!0),v){var _=S.utcOffset();S=S.add(g-_,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||i.tz.guess(),S=s(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},i.tz=function(h,v,S){var g=S&&v,y=S||v||o,C=a(+i(),y);if(typeof h!="string")return i(h).tz(y);var x=function(k,T,F){var V=k-60*T*1e3,L=a(V,F);if(T===L)return[V,T];var j=a(V-=60*(L-T)*1e3,F);return L===j?[V,L]:[k-60*Math.min(L,j)*1e3,Math.max(L,j)]}(i.utc(h,g).valueOf(),C,y),E=x[0],_=x[1],I=i(E).utcOffset(_);return I.$x.$timezone=y,I},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(h){o=h}}})});var Hh=Ke((fd,md)=>{"use strict";m();d();f();p();(function(e,t){typeof fd=="object"&&typeof md<"u"?md.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(fd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,i,o){var s=i.prototype;o.utc=function(g){var y={date:g,utc:!0,args:arguments};return new i(y)},s.utc=function(g){var y=o(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},s.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),a.call(this,g)};var c=s.init;s.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=s.utcOffset;s.utcOffset=function(g,y){var C=this.$utils().u;if(C(g))return this.$u?0:C(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(I){I===void 0&&(I="");var k=I.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],F=T[0],V=60*+T[1]+ +T[2];return V===0?0:F==="+"?V:-V}(g),g===null))return this;var x=Math.abs(g)<=16?60*g:g;if(x===0)return this.utc(y);var E=this.clone();if(y)return E.$offset=x,E.$u=!1,E;var _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(E=this.local().add(x+_,e)).$offset=x,E.$x.$localOffset=_,E};var h=s.format;s.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},s.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(g){return g==="s"&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=s.diff;s.diff=function(g,y,C){if(g&&this.$u===g.$u)return S.call(this,g,y,C);var x=this.local(),E=o(g).local();return S.call(x,E,y,C)}}})});var CS=Ke((tse,wS)=>{"use strict";m();d();f();p();function Lk(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}wS.exports=qk;function qk(e,t,r){var n=r&&r.stringify||Lk,i=1;if(typeof e=="object"&&e!==null){var o=t.length+i;if(o===1)return e;var s=new Array(o);s[0]=n(e);for(var a=1;a<o;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",h=1-i,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var _S=Ke((sse,Qc)=>{"use strict";m();d();f();p();var xS=CS();Qc.exports=fr;var Vo=e0().console||{},Uk={mapHttpRequest:$c,mapHttpResponse:$c,wrapRequestSerializer:cp,wrapResponseSerializer:cp,wrapErrorSerializer:cp,req:$c,res:$c,err:RS,errWithCause:RS};function Fr(e,t){return e==="silent"?1/0:t.levels.values[e]}var dp=Symbol("pino.logFuncs"),up=Symbol("pino.hierarchy"),Vk={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function ES(e,t){let r={logger:t,parent:e[up]};t[up]=r}function Bk(e,t,r){let n={};t.forEach(i=>{n[i]=r[i]?r[i]:Vo[i]||Vo[Vk[i]||"log"]||Ei}),e[dp]=n}function Gk(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function fr(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Vo;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},i=Gk(e.browser.serialize,n),o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof r=="function"&&a.forEach(function(C){r[C]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Ei),Bk(u,a,r),ES({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:Xk(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ei};u.levels=$k(e),u.level=c,u.isLevelEnabled=function(C){return this.levels.values[C]?this.levels.values[C]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Ei,u.serializers=n,u._serialize=i,u._stdErrSerialize=o,u.child=function(...C){return y.call(this,h,...C)},t&&(u._logEvent=lp());function v(){return Fr(this.level,this)}function S(){return this._level}function g(C){if(C!=="silent"&&!this.levels.values[C])throw Error("unknown level "+C);this._level=C,Rn(this,h,u,"error"),Rn(this,h,u,"fatal"),Rn(this,h,u,"warn"),Rn(this,h,u,"info"),Rn(this,h,u,"debug"),Rn(this,h,u,"trace"),s.forEach(x=>{Rn(this,h,u,x)})}function y(C,x,E){if(!x)throw new Error("missing bindings for child Pino");E=E||{},i&&x.serializers&&(E.serializers=x.serializers);let _=E.serializers;if(i&&_){var I=Object.assign({},n,_),k=e.browser.serialize===!0?Object.keys(I):i;delete x.serializers,pp([x],k,I,this._stdErrSerialize)}function T(V){this._childLevel=(V._childLevel|0)+1,this.bindings=x,I&&(this.serializers=I,this._serialize=k),t&&(this._logEvent=lp([].concat(V._logEvent.bindings,x)))}T.prototype=this;let F=new T(this);return ES(this,F),F.child=function(...V){return y.call(this,C,...V)},F.level=E.level||this.level,C.onChild(F),F}return u}function $k(e){let t=e.customLevels||{},r=Object.assign({},fr.levels.values,t),n=Object.assign({},fr.levels.labels,Qk(t));return{values:r,labels:n}}function Qk(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}fr.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};fr.stdSerializers=Uk;fr.stdTimeFunctions=Object.assign({},{nullTime:IS,epochTime:TS,unixTime:Jk,isoTime:Zk});function Hk(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[up];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Rn(e,t,r,n){if(Object.defineProperty(e,n,{value:Fr(e.level,r)>Fr(n,r)?Ei:r[dp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ei){if(!t.transmit)return;let o=t.transmit.level||e.level,s=Fr(o,r);if(Fr(n,r)<s)return}e[n]=Wk(e,t,r,n);let i=Hk(e);i.length!==0&&(e[n]=zk(i,e[n]))}function zk(e,t){return function(){return t.apply(this,[...e,...arguments])}}function Wk(e,t,r,n){return function(i){return function(){let s=t.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Vo?Vo:this;for(var u=0;u<a.length;u++)a[u]=arguments[u];var h=!1;if(t.serialize&&(pp(a,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?i.call(c,...Kk(this,n,a,s,t)):i.apply(c,a),t.transmit){let v=t.transmit.level||e._level,S=Fr(v,r),g=Fr(n,r);if(g<S)return;Yk(this,{ts:s,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Fr(e._level,r)},a,h)}}}(e[dp][n])}function Kk(e,t,r,n,i){let{level:o,log:s=v=>v}=i.formatters||{},a=r.slice(),c=a[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),o){let v=o(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[s(u),...a]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?xS(a.shift(),a):void 0}else typeof c=="string"&&(c=xS(a.shift(),a));return c!==void 0&&(u[i.messageKey]=c),[s(u)]}}function pp(e,t,r,n){for(let i in e)if(n&&e[i]instanceof Error)e[i]=fr.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i])&&t)for(let o in e[i])t.indexOf(o)>-1&&o in r&&(e[i][o]=r[o](e[i][o]))}function Yk(e,t,r,n=!1){let i=t.send,o=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,u=e._logEvent.bindings;n||pp(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,i(s,e._logEvent,c),e._logEvent=lp(u)}function lp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function RS(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function Xk(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?IS:TS}function $c(){return{}}function cp(e){return e}function Ei(){}function IS(){return!1}function TS(){return Date.now()}function Jk(){return Math.round(Date.now()/1e3)}function Zk(){return new Date(Date.now()).toISOString()}function e0(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}Qc.exports.default=fr;Qc.exports.pino=fr});var E0={};$o(E0,{ResultTemplatesHelpers:()=>hh,buildCaseAssistEngine:()=>DS,buildCaseField:()=>YS,buildCaseInput:()=>XS,buildController:()=>Zt,buildDocumentSuggestion:()=>mp,buildDocumentSuggestionList:()=>mp,buildInteractiveResult:()=>ZS,buildQuickview:()=>nA,getAnalyticsNextApiBaseUrl:()=>Xo,getOrganizationEndpoint:()=>qe,loadCaseAssistAnalyticsActions:()=>b0,loadCaseFieldActions:()=>w0,loadCaseInputActions:()=>C0,loadDocumentSuggestionActions:()=>x0,loadGenericAnalyticsActions:()=>A0});module.exports=gA(E0);m();d();f();p();m();d();f();p();var Yp=_t(Bp(),1);m();d();f();p();var St=new Error("Failed to load reducers."),Pn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},Lr=class extends Error{constructor(r,n){super();Se(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Gp(e){return Array.isArray(e)}function $p(e,t){return[...e.reduce((r,n)=>{let i=t(n);return r.has(i)||r.set(i,n),r},new Map).values()]}var cb=new Set(["1",1,"yes",!0]);function Qp(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>cb.has(r))}function Hp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Yo(e,t,r={}){let n;return(...i)=>{let o=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,i)},t),o)return e.apply(void 0,i)}}m();d();f();p();function zp(e){let t=[];for(let r in e){let n=encodeURIComponent(r),i=encodeURIComponent(e[r]);t.push(`${n}=${i}`)}return t.join("&")}function Wp(e){return typeof e!="object"||!e?!1:Object.values(e).every(ub)}function ub(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Kp(e){return e===429}var gr=class e{static call(t){return _asyncToGenerator(function*(){let r=lb(t),{logger:n}=t,i=yield e.preprocessRequest(r,t);n.info(i,"Platform request");let{url:o,...s}=i,a=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield b(o,s);if(Kp(c.status))throw c;return c});return function a(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Yp.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&Kp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Pn;case 404:throw new Lr(o,c.status);default:return n.info({response:c,requestInfo:i},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Lr(o):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:i,logger:o,requestMetadata:s}=r,{signal:a,...c}=t,u=Mi(c);try{let h=yield i(t,n,s);return{...t,...h}}catch(h){o.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function qe(e,t="prod",r="platform"){let n=t==="prod"?"":t,i=r==="platform"?"":`.${r}`;return`https://${e}${i}.org${n}.coveo.com`}function Nn(e,t="prod"){return`${qe(e,t)}/rest/search/v2`}function Xo(e,t="prod"){return`${qe(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function lb(e){let{url:t,method:r,requestParams:n,contentType:i,accessToken:o,signal:s}=e,a=e.method==="POST"||e.method==="PUT",c=db(n,i);return{url:t,method:r,headers:{"Content-Type":i,Authorization:`Bearer ${o}`,...e.headers},...(a&&{body:c}),signal:s}}function db(e,t){return t==="application/x-www-form-urlencoded"?Wp(e)?zp(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function pb(e,t){let r=`
20
20
  The following properties are invalid:
21
21
 
22
22
  ${e.join(`
23
23
  `)}
24
24
 
25
25
  ${t}
26
- `;return new vu(r)}var vu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},kt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let i in this.definition){let o=this.definition[i].validate(r[i]);o&&n.push(`${i}: ${o}`)}if(n.length)throw pb(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},qr=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&se(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Fn(e){return e===void 0}function fb(e){return e===null}function se(e){return Fn(e)||fb(e)}var Me=class{constructor(e={}){Se(this,"value");this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(mb(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function mb(e){return Fn(e)||Xp(e)}function Xp(e){return typeof e=="boolean"}var Ve=class{constructor(e={}){Se(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(gb(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function gb(e){return Fn(e)||Jp(e)}function Jp(e){return typeof e=="number"&&!Number.isNaN(e)}var hb=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,ee=class{constructor(e={}){Se(this,"value");Se(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:i,ISODate:o}=this.config,s=this.value.validate(e);if(s)return s;if(Fn(e))return null;if(!Zp(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:i&&!i.includes(e)?`value should be one of: ${i.join(", ")}.`:o&&!(hb.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function Zp(e){return Object.prototype.toString.call(e)==="[object String]"}var Ee=class{constructor(e={}){Se(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Fn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!ef(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&se(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let i=e[r],o=n.validate(i);o!==null&&(t+=` ${o}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function ef(e){return e!==void 0&&typeof e=="object"}var Ot=class{constructor(e={}){Se(this,"value");this.config=e,this.value=new qr(this.config)}validate(e){if(!se(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(se(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&se(n)&&(r=`value is null or undefined: ${e.join(",")}`);let i=this.validatePrimitiveValue(n,this.config.each);i!==null&&(r+=` ${i}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Xp(e)||Zp(e)||Jp(e)||ef(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function tf(e){return Array.isArray(e)}var Su=class{constructor(e){Se(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Fn(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var Jo=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Dn=class{constructor(t){Se(this,"_basePath");Se(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Au(e){let{url:t,accessToken:r,organizationId:n,authentication:i,...o}=e;return o}var bu=e=>{let{response:t}=e;return t.body?yb(e):vb(t)},yb=e=>Ab(e)?bb(e):Sb(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},vb=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Sb(e){return e.body.statusCode!==void 0}function Ab(e){return e.body.exception!==void 0}var bb=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function rf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var wu=(e,t,r,n)=>{let i=new Dn(`${e.url}${n}`);return i.addParam("organizationId",e.organizationId),e.authentication&&i.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:i.href,origin:"searchApiFetch"}};var nf=(e,t)=>{let r=new Dn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Cu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield gr.call({...wu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Au(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=rf(r),i=yield r.arrayBuffer(),s=new TextDecoder(n).decode(i);return wb(s)?{success:s}:{error:bu({response:r,body:s})}});return function Cu(_x3,_x4){return _ref3.apply(this,arguments)}}();function wb(e){return typeof e=="string"}m();d();f();p();function Cb(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function xb(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Zo(e,t){if(t&&e.name==="AbortError")return{error:xb(e)};if(e instanceof Lr)return{error:Cb(e)};throw e}m();d();f();p();m();d();f();p();var es=(e,t,r,n,i={})=>{Eb(e);let o=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Rb(i),a=s?`${o}?${s}`:o;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},ts=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),rs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),Eb=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},Rb=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var of=e=>{let t=e.debug?{debug:"1"}:{};return{...es(e,"POST","application/json","/classify",t),requestParams:Ib(e)}},Ib=e=>({clientId:e.clientId,locale:e.locale,fields:ts(e.fields)});m();d();f();p();var sf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...es(e,"POST","application/json","/documents/suggest",t),requestParams:Tb(e)}},Tb=e=>({clientId:e.clientId,locale:e.locale,fields:ts(e.fields),context:e.context,analytics:e.analytics});var ns=class{constructor(t){this.options=t}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield gr.call({...of(t),..._this.options});if(r instanceof Error)return Zo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield gr.call({...sf(t),..._this2.options});if(r instanceof Error)return Zo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Cu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Ye(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var _b=typeof Symbol=="function"&&Symbol.observable||"@@observable",af=_b,xu=()=>Math.random().toString(36).substring(7).split("").join("."),kb={INIT:`@@redux/INIT${xu()}`,REPLACE:`@@redux/REPLACE${xu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xu()}`},is=kb;function Lt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Eu(e,t,r){if(typeof e!="function")throw new Error(Ye(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ye(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ye(1));return r(Eu)(e,t)}let n=e,i=t,o=new Map,s=o,a=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((x,E)=>{s.set(E,x)}))}function h(){if(c)throw new Error(Ye(3));return i}function v(x){if(typeof x!="function")throw new Error(Ye(4));if(c)throw new Error(Ye(5));let E=!0;u();let _=a++;return s.set(_,x),function(){if(E){if(c)throw new Error(Ye(6));E=!1,u(),s.delete(_),o=null}}}function S(x){if(!Lt(x))throw new Error(Ye(7));if(typeof x.type>"u")throw new Error(Ye(8));if(typeof x.type!="string")throw new Error(Ye(17));if(c)throw new Error(Ye(9));try{c=!0,i=n(i,x)}finally{c=!1}return(o=s).forEach(_=>{_()}),x}function g(x){if(typeof x!="function")throw new Error(Ye(10));n=x,S({type:is.REPLACE})}function y(){let x=v;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ye(11));function _(){let k=E;k.next&&k.next(h())}return _(),{unsubscribe:x(_)}},[af](){return this}}}return S({type:is.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[af]:y}}function Ob(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:is.INIT})>"u")throw new Error(Ye(12));if(typeof r(void 0,{type:is.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ye(13))})}function Mn(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),i,o;try{Ob(r)}catch(s){o=s}return function(a={},c){if(o)throw o;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=a[S],C=g(y,c);if(typeof C>"u"){let x=c&&c.type;throw new Error(Ye(14))}h[S]=C,u=u||C!==y}return u=u||n.length!==Object.keys(a).length,u?h:a}}function ji(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function cf(...e){return t=>(r,n)=>{let i=t(r,n),o=()=>{throw new Error(Ye(15))},s={getState:i.getState,dispatch:(c,...u)=>o(c,...u)},a=e.map(c=>c(s));return o=ji(...a)(i.dispatch),{...i,dispatch:o}}}function Li(e){return Lt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Fu=Symbol.for("immer-nothing"),qi=Symbol.for("immer-draftable"),He=Symbol.for("immer-state");function Xe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gt=Object,Vr=gt.getPrototypeOf,Vi="constructor",Hi="prototype",Tu="configurable",cs="enumerable",ss="writable",Bi="value",st=e=>!!e&&!!e[He];function at(e){return e?hf(e)||Wi(e)||!!e[qi]||!!e[Vi]?.[qi]||Ki(e)||Yi(e):!1}var Pb=gt[Hi][Vi].toString(),uf=new WeakMap;function hf(e){if(!e||!jn(e))return!1;let t=Vr(e);if(t===null||t===gt[Hi])return!0;let r=gt.hasOwnProperty.call(t,Vi)&&t[Vi];if(r===Object)return!0;if(!Ur(r))return!1;let n=uf.get(r);return n===void 0&&(n=Function.toString.call(r),uf.set(r,n)),n===Pb}function yf(e){return st(e)||Xe(15,e),e[He].base_}function zi(e,t,r=!0){Br(e)===0?(r?Reflect.ownKeys(e):gt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Br(e){let t=e[He];return t?t.type_:Wi(e)?1:Ki(e)?2:Yi(e)?3:0}var Ui=(e,t,r=Br(e))=>r===2?e.has(t):gt[Hi].hasOwnProperty.call(e,t),tr=(e,t,r=Br(e))=>r===2?e.get(t):e[t],us=(e,t,r,n=Br(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Nb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Wi=Array.isArray,Ki=e=>e instanceof Map,Yi=e=>e instanceof Set,jn=e=>typeof e=="object",Ur=e=>typeof e=="function",Ru=e=>typeof e=="boolean";function Fb(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Db=e=>jn(e)?e?.[He]:null,rr=e=>e.copy_||e.base_;var Du=e=>e.modified_?e.copy_:e.base_;function _u(e,t){if(Ki(e))return new Map(e);if(Yi(e))return new Set(e);if(Wi(e))return Array[Hi].slice.call(e);let r=hf(e);if(t===!0||t==="class_only"&&!r){let n=gt.getOwnPropertyDescriptors(e);delete n[He];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){let s=i[o],a=n[s];a[ss]===!1&&(a[ss]=!0,a[Tu]=!0),(a.get||a.set)&&(n[s]={[Tu]:!0,[ss]:!0,[cs]:a[cs],[Bi]:e[s]})}return gt.create(Vr(e),n)}else{let n=Vr(e);if(n!==null&&r)return{...e};let i=gt.create(n);return gt.assign(i,e)}}function Mu(e,t=!1){return gs(e)||st(e)||!at(e)||(Br(e)>1&&gt.defineProperties(e,{set:os,add:os,clear:os,delete:os}),gt.freeze(e),t&&zi(e,(r,n)=>{Mu(n,!0)},!1)),e}function Mb(){Xe(2)}var os={[Bi]:Mb};function gs(e){return e===null||!jn(e)?!0:gt.isFrozen(e)}var ls="MapSet",ds="Patches",lf="ArrayMethods",ps={};function Gr(e){let t=ps[e];return t||Xe(0,e),t}var df=e=>!!ps[e];function jb(e,t){ps[e]||(ps[e]=t)}var Gi,vf=()=>Gi,Lb=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:df(ls)?Gr(ls):void 0,arrayMethodsPlugin_:df(lf)?Gr(lf):void 0});function pf(e,t){t&&(e.patchPlugin_=Gr(ds),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ku(e){Ou(e),e.drafts_.forEach(qb),e.drafts_=null}function Ou(e){e===Gi&&(Gi=e.parent_)}var ff=e=>Gi=Lb(Gi,e);function qb(e){let t=e[He];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[He].modified_&&(ku(t),Xe(4)),at(e)&&(e=gf(t,e));let{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[He].base_,e,t)}else e=gf(t,r);return Ub(t,e,!0),ku(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Fu?e:void 0}function gf(e,t){if(gs(t))return t;let r=t[He];if(!r)return fs(t,e.handledSet_,e);if(!hs(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);bf(r,e)}return r.copy_}function Ub(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Mu(t,r)}function Sf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var hs=(e,t)=>e.scope_===t,Vb=[];function Af(e,t,r,n){let i=rr(e),o=e.type_;if(n!==void 0&&tr(i,n,o)===t){us(i,n,r,o);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;zi(i,(c,u)=>{if(st(u)){let h=a.get(u)||[];h.push(c),a.set(u,h)}})}let s=e.draftLocations_.get(t)??Vb;for(let a of s)us(i,a,r,o)}function Bb(e,t,r){e.callbacks_.push(function(i){let o=t;if(!o||!hs(o,i))return;i.mapSetPlugin_?.fixSetContents(o);let s=Du(o);Af(e,o.draft_??o,s,r),bf(o,i)})}function bf(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let i=n.getPath(e);i&&n.generatePatches_(e,i,t)}Sf(e)}}function Gb(e,t,r){let{scope_:n}=e;if(st(r)){let i=r[He];hs(i,n)&&i.callbacks_.push(function(){as(e);let s=Du(i);Af(e,r,s,t)})}else at(r)&&e.callbacks_.push(function(){let o=rr(e);e.type_===3?o.has(r)&&fs(r,n.handledSet_,n):tr(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fs(tr(e.copy_,t,e.type_),n.handledSet_,n)})}function fs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||st(e)||t.has(e)||!at(e)||gs(e)||(t.add(e),zi(e,(n,i)=>{if(st(i)){let o=i[He];if(hs(o,r)){let s=Du(o);us(e,n,s,e.type_),Sf(o)}}else at(i)&&fs(i,t,r)})),e}function $b(e,t){let r=Wi(e),n={type_:r?1:0,scope_:t?t.scope_:vf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=n,o=ms;r&&(i=[n],o=$i);let{revoke:s,proxy:a}=Proxy.revocable(i,o);return n.draft_=a,n.revoke_=s,[a,n]}var ms={get(e,t){if(t===He)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let i=rr(e);if(!Ui(i,t,e.type_))return Qb(e,i,t);let o=i[t];if(e.finalized_||!at(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Fb(t))return o;if(o===Iu(e.base_,t)){as(e);let s=e.type_===1?+t:t,a=Nu(e.scope_,o,e,s);return e.copy_[s]=a}return o},has(e,t){return t in rr(e)},ownKeys(e){return Reflect.ownKeys(rr(e))},set(e,t,r){let n=wf(rr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let i=Iu(rr(e),t),o=i?.[He];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Nb(r,i)&&(r!==void 0||Ui(e.base_,t,e.type_)))return!0;as(e),Pu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Gb(e,t,r)),!0},deleteProperty(e,t){return as(e),Iu(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Pu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=rr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ss]:!0,[Tu]:e.type_!==1||t!=="length",[cs]:n[cs],[Bi]:r[t]}},defineProperty(){Xe(11)},getPrototypeOf(e){return Vr(e.base_)},setPrototypeOf(){Xe(12)}},$i={};for(let e in ms){let t=ms[e];$i[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}$i.deleteProperty=function(e,t){return $i.set.call(this,e,t,void 0)};$i.set=function(e,t,r){return ms.set.call(this,e[0],t,r,e[0])};function Iu(e,t){let r=e[He];return(r?rr(r):e)[t]}function Qb(e,t,r){let n=wf(t,r);return n?Bi in n?n[Bi]:n.get?.call(e.draft_):void 0}function wf(e,t){if(!(t in e))return;let r=Vr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vr(r)}}function Pu(e){e.modified_||(e.modified_=!0,e.parent_&&Pu(e.parent_))}function as(e){e.copy_||(e.assigned_=new Map,e.copy_=_u(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Hb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Ur(t)&&!Ur(r)){let o=r;r=t;let s=this;return function(c=o,...u){return s.produce(c,h=>r.call(this,h,...u))}}Ur(r)||Xe(6),n!==void 0&&!Ur(n)&&Xe(7);let i;if(at(t)){let o=ff(this),s=Nu(o,t,void 0),a=!0;try{i=r(s),a=!1}finally{a?ku(o):Ou(o)}return pf(o,n),mf(i,o)}else if(!t||!jn(t)){if(i=r(t),i===void 0&&(i=t),i===Fu&&(i=void 0),this.autoFreeze_&&Mu(i,!0),n){let o=[],s=[];Gr(ds).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:s}),n(o,s)}return i}else Xe(1,t)},this.produceWithPatches=(t,r)=>{if(Ur(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,i;return[this.produce(t,r,(s,a)=>{n=s,i=a}),n,i]},Ru(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ru(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ru(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){at(e)||Xe(8),st(e)&&(e=ys(e));let t=ff(this),r=Nu(t,e,void 0);return r[He].isManual_=!0,Ou(t),r}finishDraft(e,t){let r=e&&e[He];(!r||!r.isManual_)&&Xe(9);let{scope_:n}=r;return pf(n,t),mf(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let n=Gr(ds).applyPatches_;return st(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Nu(e,t,r,n){let[i,o]=Ki(t)?Gr(ls).proxyMap_(t,r):Yi(t)?Gr(ls).proxySet_(t,r):$b(t,r);return(r?.scope_??vf()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?Bb(r,o,n):o.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(o);let{patchPlugin_:u}=c;o.modified_&&u&&u.generatePatches_(o,[],c)}),i}function ys(e){return st(e)||Xe(10,e),Cf(e)}function Cf(e){if(!at(e)||gs(e))return e;let t=e[He],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=_u(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=_u(e,!0);return zi(r,(i,o)=>{us(r,i,Cf(o))},n),t&&(t.finalized_=!1),r}function xf(){function t(y,C=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,E=Db(tr(x,y.key_)),_=tr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||E!=null&&E.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&x.size>k||Ui(x,k)))return null;C.push(k)}if(y.parent_)return t(y.parent_,C);C.reverse();try{r(y.copy_,C)}catch{return null}return C}function r(y,C){let x=y;for(let E=0;E<C.length-1;E++){let _=C[E];if(x=tr(x,_),!jn(x)||x===null)throw new Error(`Cannot resolve path at '${C.join("/")}'`)}return x}let n="replace",i="add",o="remove";function s(y,C,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:_}=x;switch(y.type_){case 0:case 2:return c(y,C,E,_);case 1:return a(y,C,E,_);case 3:return u(y,C,E,_)}}function a(y,C,x,E){let{base_:_,assigned_:I}=y,k=y.copy_;k.length<_.length&&([_,k]=[k,_],[x,E]=[E,x]);let T=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=k[F],L=_[F];if((T||I?.get(F.toString()))&&V!==L){let U=V?.[He];if(U&&U.modified_)continue;let M=C.concat([F]);x.push({op:n,path:M,value:g(V)}),E.push({op:n,path:M,value:g(L)})}}for(let F=_.length;F<k.length;F++){let V=C.concat([F]);x.push({op:i,path:V,value:g(k[F])})}for(let F=k.length-1;_.length<=F;--F){let V=C.concat([F]);E.push({op:o,path:V})}}function c(y,C,x,E){let{base_:_,copy_:I,type_:k}=y;zi(y.assigned_,(T,F)=>{let V=tr(_,T,k),L=tr(I,T,k),j=F?Ui(_,T)?n:i:o;if(V===L&&j===n)return;let U=C.concat(T);x.push(j===o?{op:j,path:U}:{op:j,path:U,value:g(L)}),E.push(j===i?{op:o,path:U}:j===o?{op:i,path:U,value:g(V)}:{op:n,path:U,value:g(V)})})}function u(y,C,x,E){let{base_:_,copy_:I}=y,k=0;_.forEach(T=>{if(!I.has(T)){let F=C.concat([k]);x.push({op:o,path:F,value:T}),E.unshift({op:i,path:F,value:T})}k++}),k=0,I.forEach(T=>{if(!_.has(T)){let F=C.concat([k]);x.push({op:i,path:F,value:T}),E.unshift({op:o,path:F,value:T})}k++})}function h(y,C,x){let{patches_:E,inversePatches_:_}=x;E.push({op:n,path:[],value:C===Fu?void 0:C}),_.push({op:n,path:[],value:y})}function v(y,C){return C.forEach(x=>{let{path:E,op:_}=x,I=y;for(let V=0;V<E.length-1;V++){let L=Br(I),j=E[V];typeof j!="string"&&typeof j!="number"&&(j=""+j),(L===0||L===1)&&(j==="__proto__"||j===Vi)&&Xe(19),Ur(I)&&j===Hi&&Xe(19),I=tr(I,j),jn(I)||Xe(18,E.join("/"))}let k=Br(I),T=S(x.value),F=E[E.length-1];switch(_){case n:switch(k){case 2:return I.set(F,T);case 3:Xe(16);default:return I[F]=T}case i:switch(k){case 1:return F==="-"?I.push(T):I.splice(F,0,T);case 2:return I.set(F,T);case 3:return I.add(T);default:return I[F]=T}case o:switch(k){case 1:return I.splice(F,1);case 2:return I.delete(F);case 3:return I.delete(x.value);default:return delete I[F]}default:Xe(17,_)}}),y}function S(y){if(!at(y))return y;if(Wi(y))return y.map(S);if(Ki(y))return new Map(Array.from(y.entries()).map(([x,E])=>[x,S(E)]));if(Yi(y))return new Set(Array.from(y).map(S));let C=Object.create(Vr(y));for(let x in y)C[x]=S(y[x]);return Ui(y,qi)&&(C[qi]=y[qi]),C}function g(y){return st(y)?S(y):y}jb(ds,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:h,getPath:t})}var Qi=new Hb,$r=Qi.produce,ju=Qi.produceWithPatches.bind(Qi);var Lu=Qi.applyPatches.bind(Qi);m();d();f();p();function zb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Wb(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Kb(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Ef=e=>Array.isArray(e)?e:[e];function Yb(e){let t=Array.isArray(e[0])?e[0]:e;return Kb(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Xb(e,t){let r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var HN=Object.getPrototypeOf({});var Jb=class{constructor(e){this.value=e}deref(){return this.value}},Zb=typeof WeakRef<"u"?WeakRef:Jb,ew=0,Rf=1;function vs(){return{s:ew,v:void 0,o:null,p:null}}function Xi(e,t={}){let r=vs(),{resultEqualityCheck:n}=t,i,o=0;function s(){let a=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let C=y.get(g);C===void 0?(a=vs(),y.set(g,a)):a=C}else{let y=a.p;y===null&&(a.p=y=new Map);let C=y.get(g);C===void 0?(a=vs(),y.set(g,a)):a=C}}let u=a,h;if(a.s===Rf)h=a.v;else if(h=e.apply(null,arguments),o++,n){let v=i?.deref?.()??i;v!=null&&n(v,h)&&(h=v,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new Zb(h):h}return u.s=Rf,u.v=h,h}return s.clearCache=()=>{r=vs(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function tw(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,s=0,a,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),zb(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=Xi,argsMemoizeOptions:y=[],devModeChecks:C={}}=h,x=Ef(S),E=Ef(y),_=Yb(i),I=v(function(){return o++,u.apply(null,arguments)},...x),k=!0,T=g(function(){s++;let V=Xb(_,arguments);return a=I.apply(null,V),a},...E);return Object.assign(T,{resultFunc:u,memoizedResultFunc:I,dependencies:_,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var je=tw(Xi),rw=Object.assign((e,t=je)=>{Wb(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(o=>e[o]);return t(n,(...o)=>o.reduce((s,a,c)=>(s[r[c]]=a,s),{}))},{withTypes:()=>rw});m();d();f();p();function If(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var Tf=If(),_f=If;var nw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ji:ji.apply(null,arguments)},lF=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},iw=e=>e&&typeof e.match=="function";function G(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ct(0));return{type:e,payload:i.payload,...("meta"in i&&{meta:i.meta}),...("error"in i&&{error:i.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Li(n)&&n.type===e,r}var jf=class Ji extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ji.prototype)}static get[Symbol.species](){return Ji}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ji(...t[0].concat(this)):new Ji(...t.concat(this))}};function kf(e){return at(e)?$r(e,()=>{}):e}function Ss(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ow(e){return typeof e=="boolean"}var sw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{},s=new jf;return r&&(ow(r)?s.push(Tf):s.push(_f(r.extraArgument))),s},Zi="RTK_autoBatch",Un=()=>e=>({payload:e,meta:{[Zi]:!0}}),Of=e=>t=>{setTimeout(t,e)},aw=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,o=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Of(10):e.type==="callback"?e.queueNotification:Of(e.timeout),u=()=>{s=!1,o&&(o=!1,a.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>i&&h(),S=n.subscribe(v);return a.add(h),()=>{S(),a.delete(h)}},dispatch(h){try{return i=!h?.meta?.[Zi],o=!i,o&&(s||(s=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},cw=e=>function(r){let{autoBatch:n=!0}=r??{},i=new jf(e);return n&&i.push(aw(typeof n=="object"?n:void 0)),i};function Lf(e){let t=sw(),{reducer:r=void 0,middleware:n,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Lt(r))c=Mn(r);else throw new Error(ct(1));let u;typeof n=="function"?u=n(t):u=t();let h=ji;i&&(h=nw({trace:!1,...(typeof i=="object"&&i)}));let v=cf(...u),S=cw(v),g=typeof a=="function"?a(S):S(),y=h(...g);return Eu(c,s,y)}function qf(e){let t={},r=[],n,i={addCase(o,s){let a=typeof o=="string"?o:o.type;if(!a)throw new Error(ct(28));if(a in t)throw new Error(ct(29));return t[a]=s,i},addAsyncThunk(o,s){return s.pending&&(t[o.pending.type]=s.pending),s.rejected&&(t[o.rejected.type]=s.rejected),s.fulfilled&&(t[o.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:o.settled,reducer:s.settled}),i},addMatcher(o,s){return r.push({matcher:o,reducer:s}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function uw(e){return typeof e=="function"}function Ge(e,t){let[r,n,i]=qf(t),o;if(uw(e))o=()=>kf(e());else{let a=kf(e);o=()=>a}function s(a=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,v)=>{if(v)if(st(h)){let g=v(h,c);return g===void 0?h:g}else{if(at(h))return $r(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},a)}return s.getInitialState=o,s}var Uf=(e,t)=>iw(e)?e.match(t):e(t);function qt(...e){return t=>e.some(r=>Uf(r,t))}function qn(...e){return t=>e.every(r=>Uf(r,t))}function Cs(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function eo(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function xs(...e){return e.length===0?t=>Cs(t,["pending"]):eo(e)?qt(...e.map(t=>t.pending)):xs()(e[0])}function Hr(...e){return e.length===0?t=>Cs(t,["rejected"]):eo(e)?qt(...e.map(t=>t.rejected)):Hr()(e[0])}function to(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?qn(Hr(...e),t):eo(e)?qn(Hr(...e),t):to()(e[0])}function nr(...e){return e.length===0?t=>Cs(t,["fulfilled"]):eo(e)?qt(...e.map(t=>t.fulfilled)):nr()(e[0])}function Es(...e){return e.length===0?t=>Cs(t,["pending","fulfilled","rejected"]):eo(e)?qt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Es()(e[0])}var lw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ro=(e=21)=>{let t="",r=e;for(;r--;)t+=lw[Math.random()*64|0];return t},dw=["name","message","stack","code"],qu=class{constructor(e,t){Se(this,"_type");this.payload=e,this.meta=t}},Pf=class{constructor(e,t){Se(this,"_type");this.payload=e,this.meta=t}},pw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of dw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Nf="External signal was aborted",Ae=(()=>{function e(t,r,n){let i=G(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),o=G(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=G(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||pw)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(h,v,S)=>{let g=n?.idGenerator?n.idGenerator(c):ro(),y=new l.AbortController,C,x;function E(I){x=I,y.abort()}u&&(u.aborted?E(Nf):u.addEventListener("abort",()=>E(Nf),{once:!0}));let _=_asyncToGenerator(function*(){let I;try{let T=n?.condition?.(c,{getState:v,extra:S});if(mw(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,L)=>{C=()=>{L({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",C,{once:!0})});h(o(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:v,extra:S}))),I=yield Promise.race([F,Promise.resolve(r(c,{dispatch:h,getState:v,extra:S,requestId:g,signal:y.signal,abort:E,rejectWithValue:(V,L)=>new qu(V,L),fulfillWithValue:(V,L)=>new Pf(V,L)})).then(V=>{if(V instanceof qu)throw V;return V instanceof Pf?i(V.payload,g,c,V.meta):i(V,g,c)})])}catch(T){I=T instanceof qu?s(null,g,c,T.payload,T.meta):s(T,g,c)}finally{C&&y.signal.removeEventListener("abort",C)}return n&&!n.dispatchConditionRejection&&s.match(I)&&I.meta.condition||h(I),I})();return Object.assign(_,{abort:E,requestId:g,arg:c,unwrap(){return _.then(fw)}})}}return Object.assign(a,{pending:o,rejected:s,fulfilled:i,settled:qt(s,i),typePrefix:t})}return e.withTypes=()=>e,e})();function fw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function mw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Vf=Symbol.for("rtk-slice-createasyncthunk"),pF={[Vf]:Ae};function gw(e,t){return`${e}/${t}`}function hw({creators:e}={}){let t=e?.asyncThunk?.[Vf];return function(n){let{name:i,reducerPath:o=i}=n;if(!i)throw new Error(ct(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(vw()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,k){let T=typeof I=="string"?I:I.type;if(!T)throw new Error(ct(12));if(T in c.sliceCaseReducersByType)throw new Error(ct(13));return c.sliceCaseReducersByType[T]=k,u},addMatcher(I,k){return c.sliceMatchers.push({matcher:I,reducer:k}),u},exposeAction(I,k){return c.actionCreators[I]=k,u},exposeCaseReducer(I,k){return c.sliceCaseReducersByName[I]=k,u}};a.forEach(I=>{let k=s[I],T={reducerName:I,type:gw(i,I),createNotation:typeof n.reducers=="function"};Aw(k)?ww(T,k,u,t):Sw(T,k,u)});function h(){let[I={},k=[],T=void 0]=typeof n.extraReducers=="function"?qf(n.extraReducers):[n.extraReducers],F={...I,...c.sliceCaseReducersByType};return Ge(n.initialState,V=>{for(let L in F)V.addCase(L,F[L]);for(let L of c.sliceMatchers)V.addMatcher(L.matcher,L.reducer);for(let L of k)V.addMatcher(L.matcher,L.reducer);T&&V.addDefaultCase(T)})}let v=I=>I,S=new Map,g=new WeakMap,y;function C(I,k){return y||(y=h()),y(I,k)}function x(){return y||(y=h()),y.getInitialState()}function E(I,k=!1){function T(V){let L=V[I];return typeof L>"u"&&k&&(L=Ss(g,T,x)),L}function F(V=v){let L=Ss(S,k,()=>new WeakMap);return Ss(L,V,()=>{let j={};for(let[U,M]of Object.entries(n.selectors??{}))j[U]=yw(M,V,()=>Ss(g,V,x),k);return j})}return{reducerPath:I,getSelectors:F,get selectors(){return F(T)},selectSlice:T}}let _={name:i,reducer:C,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...E(o),injectInto(I,{reducerPath:k,...T}={}){let F=k??o;return I.inject({reducerPath:F,reducer:C},T),{..._,...E(F,!0)}}};return _}}function yw(e,t,r,n){function i(o,...s){let a=t(o);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return i.unwrapped=e,i}var zr=hw();function vw(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Sw({type:e,reducerName:t,createNotation:r},n,i){let o,s;if("reducer"in n){if(r&&!bw(n))throw new Error(ct(17));o=n.reducer,s=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?G(e,s):G(e))}function Aw(e){return e._reducerDefinitionType==="asyncThunk"}function bw(e){return e._reducerDefinitionType==="reducerWithPrepare"}function ww({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ct(18));let{payloadCreator:o,fulfilled:s,pending:a,rejected:c,settled:u,options:h}=r,v=i(e,o,h);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||As,pending:a||As,rejected:c||As,settled:u||As})}function As(){}var Cw="task",Bf="listener",Gf="completed",Bu="cancelled",xw=`task-${Bu}`,Ew=`task-${Gf}`,Uu=`${Bf}-${Bu}`,Rw=`${Bf}-${Gf}`,Rs=class{constructor(e){Se(this,"name","TaskAbortError");Se(this,"message");this.code=e,this.message=`${Cw} ${Bu} (reason: ${e})`}},Gu=(e,t)=>{if(typeof e!="function")throw new TypeError(ct(32))},bs=()=>{},$f=(e,t=bs)=>(e.catch(t),e),Qf=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Qr=e=>{if(e.aborted)throw new Rs(e.reason)};function Hf(e,t){let r=bs;return new Promise((n,i)=>{let o=()=>i(new Rs(e.reason));if(e.aborted){o();return}r=Qf(e,o),t.finally(()=>r()).then(n,i)}).finally(()=>{r=bs})}var Iw=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Rs?"cancelled":"rejected",error:r}}finally{t?.()}});return function Iw(_x5,_x6){return _ref5.apply(this,arguments)}}(),ws=e=>t=>$f(Hf(e,t).then(r=>(Qr(e),r))),zf=e=>{let t=ws(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Ln}=Object,Ff={},Is="listenerMiddleware",Tw=(e,t)=>{let r=n=>Qf(e,()=>n.abort(e.reason));return(n,i)=>{Gu(n,"taskExecutor");let o=new l.AbortController;r(o);let s=Iw(/*#__PURE__*/_asyncToGenerator(function*(){Qr(e),Qr(o.signal);let a=yield n({pause:ws(o.signal),delay:zf(o.signal),signal:o.signal});return Qr(o.signal),a}),()=>o.abort(Ew));return i?.autoJoin&&t.push(s.catch(bs)),{result:ws(e)(s),cancel(){o.abort(xw)}}}},_w=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,i){Qr(t);let o=()=>{},a=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});o=()=>{h(),u()}})];i!=null&&a.push(new Promise(c=>setTimeout(c,i,null)));try{let c=yield Hf(t,Promise.race(a));return Qr(t),c}finally{o()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,i)=>$f(r(n,i))},Wf=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:o}=e;if(t)i=G(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ct(21));return Gu(o,"options.listener"),{predicate:i,type:t,effect:o}},Kf=Ln(e=>{let{type:t,predicate:r,effect:n}=Wf(e);return{id:ro(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ct(22))}}},{withTypes:()=>Kf}),Df=(e,t)=>{let{type:r,effect:n,predicate:i}=Wf(t);return Array.from(e.values()).find(o=>(typeof r=="string"?o.type===r:o.predicate===i)&&o.effect===n)},Vu=e=>{e.pending.forEach(t=>{t.abort(Uu)})},kw=(e,t)=>()=>{for(let r of t.keys())Vu(r);e.clear()},Mf=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Yf=Ln(G(`${Is}/add`),{withTypes:()=>Yf}),Ow=G(`${Is}/removeAll`),Xf=Ln(G(`${Is}/remove`),{withTypes:()=>Xf}),Pw=(...e)=>{console.error(`${Is}/error`,...e)},Jf=(e={})=>{let t=new Map,r=new Map,n=g=>{let y=r.get(g)??0;r.set(g,y+1)},i=g=>{let y=r.get(g)??1;y===1?r.delete(g):r.set(g,y-1)},{extra:o,onError:s=Pw}=e;Gu(s,"onError");let a=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&Vu(g)}),c=g=>{let y=Df(t,g)??Kf(g);return a(y)};Ln(c,{withTypes:()=>c});let u=g=>{let y=Df(t,g);return y&&(y.unsubscribe(),g.cancelActive&&Vu(y)),!!y};Ln(u,{withTypes:()=>u});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,y,C,x){let E=new l.AbortController,_=_w(c,E.signal),I=[];try{g.pending.add(E),n(g),yield Promise.resolve(g.effect(y,Ln({},C,{getOriginalState:x,condition:(k,T)=>_(k,T).then(Boolean),take:_,delay:zf(E.signal),pause:ws(E.signal),extra:o,signal:E.signal,fork:Tw(E.signal,I),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((k,T,F)=>{k!==E&&(k.abort(Uu),F.delete(k))})},cancel:()=>{E.abort(Uu),g.pending.delete(E)},throwIfCancelled:()=>{Qr(E.signal)}})))}catch(k){k instanceof Rs||Mf(s,k,{raisedBy:"effect"})}finally{yield Promise.all(I),E.abort(Rw),i(g),g.pending.delete(E)}});return function h(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=kw(t,r);return{middleware:g=>y=>C=>{if(!Li(C))return y(C);if(Yf.match(C))return c(C.payload);if(Ow.match(C)){v();return}if(Xf.match(C))return u(C.payload);let x=g.getState(),E=()=>{if(x===Ff)throw new Error(ct(23));return x},_;try{if(_=y(C),t.size>0){let I=g.getState(),k=Array.from(t.values());for(let T of k){let F=!1;try{F=T.predicate(C,I,x)}catch(V){F=!1,Mf(s,V,{raisedBy:"predicate"})}F&&h(T,C,g,E)}}}finally{x=Ff}return _},startListening:c,stopListening:u,clearListeners:v}};function ct(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var te=new ee({required:!0,emptyAllowed:!1}),$e=new ee({required:!1,emptyAllowed:!1}),Pt=new ee({required:!0,emptyAllowed:!0}),xF=new ee({required:!1,emptyAllowed:!0}),Zf=new Ot({each:te,required:!0}),em=new ee({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),tm=new ee({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),EF=new ee({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Nw=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),$u=(e,t)=>{if("required"in t)return{payload:new kt({value:t}).validate({value:e}).value};let i=new Ee({options:{required:!0},values:t}).validate(e);if(i)throw new vu(i);return{payload:e}},K=(e,t)=>{try{return $u(e,t)}catch(r){return{payload:e,error:Nw(r)}}};var Ts=(e,t,r,n)=>{let i=`Check the options of ${n}`;return Fw(e,t,r,i,"Controller initialization error")},Fw=(e,t,r,n,i)=>{try{return t.validate(r,n)}catch(o){throw e.logger.error(o,i),o}};var _s=G("caseAssistConfiguration/set",e=>K(e,{caseAssistId:te,locale:$e,proxyBaseUrl:new ee({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var rm=()=>({caseAssistId:"",locale:"en-US"});var hr=Ge(rm(),e=>{e.addCase(_s,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var nm={q:new ee,enableQuerySyntax:new Me,aq:new ee,cq:new ee,firstResult:new Ve({min:0}),numberOfResults:new Ve({min:0}),sortCriteria:new ee,f:new Ee,fExcluded:new Ee,cf:new Ee,nf:new Ee,mnf:new Ee,df:new Ee,debug:new Me,sf:new Ee,tab:new ee,af:new Ee};var ks=G("searchParameters/restore",e=>K(e,nm)),im=G("searchParameters/restoreTab",e=>K(e,te));m();d();f();p();var om=G("debug/enable"),sm=G("debug/disable");m();d();f();p();var Os=()=>!1;var am=Ge(Os(),e=>{e.addCase(om,()=>!0).addCase(sm,()=>!1).addCase(ks,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ps=G("searchHub/set",e=>K(e,new ee({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Vn="3.48.1",cm=["@coveo/atomic","@coveo/quantic"];var Qu=()=>$e,um=()=>te,Bn=G("configuration/updateBasicConfiguration",e=>K(e,{accessToken:$e,environment:new ee({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:$e})),Ns=G("configuration/updateSearchConfiguration",e=>K(e,{proxyBaseUrl:new ee({required:!1,url:!0}),pipeline:new ee({required:!1,emptyAllowed:!0}),searchHub:$e,timezone:$e,locale:$e,authenticationProviders:new Ot({required:!1,each:te})})),Dw={enabled:new Me({default:!0}),originContext:Qu(),originLevel2:Qu(),originLevel3:Qu(),proxyBaseUrl:new ee({required:!1,url:!0}),runtimeEnvironment:new qr,anonymous:new Me({default:!1}),deviceId:$e,userDisplayName:$e,documentLocation:$e,trackingId:tm,analyticsMode:new ee({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Ee({options:{required:!1},values:cm.reduce((e,t)=>(e[t]=em,e),{})})},Fs=G("configuration/updateAnalyticsConfiguration",e=>K(e,Dw)),Ds=G("configuration/analytics/disable"),Ms=G("configuration/analytics/enable"),lm=G("configuration/analytics/originlevel2",e=>K(e,{originLevel2:um()})),dm=G("configuration/analytics/originlevel3",e=>K(e,{originLevel3:um()})),pm=G("knowledge/setAgentId",e=>K(e,new ee({required:!0})));m();d();f();p();var Mw=G("history/undo"),jw=G("history/redo"),Ut=G("history/snapshot"),tM=Ae("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Mw()),yield t(js())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),rM=Ae("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(jw()),yield t(js())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),js=Ae("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Gn=()=>"default";var fm=Ge(Gn(),e=>{e.addCase(Ps,(t,r)=>r.payload).addCase(js.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ns,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function mm(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var gm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Lw(e){return typeof e=="string"&&gm.test(e)}var Hu=Lw;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function hm(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var zu,qw=new Uint8Array(16);function Wu(){if(!zu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");zu=crypto.getRandomValues.bind(crypto)}return zu(qw)}m();d();f();p();m();d();f();p();var Uw=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ku={randomUUID:Uw};function Vw(e,t,r){e=e||{};let n=e.random??e.rng?.()??Wu();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return hm(n)}function Bw(e,t,r){return Ku.randomUUID&&!t&&!e?Ku.randomUUID():Vw(e,t,r)}var Yu=Bw;function Gw(_x17){return _Gw.apply(this,arguments)}function _Gw(){_Gw=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:i,token:o,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(i,o,r)});return _Gw.apply(this,arguments)}var wm="2.1.1",Xu=128,Cm=192,ym=224,vm=240,$w=248;function Qw(e){return(e&$w)===vm?4:(e&vm)===ym?3:(e&ym)===Cm?2:1}function Hw(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Xu)!=Xu)break;if(r-=3,(n&Cm)!=Xu){t-r>=Qw(n)*3&&(r=t);break}}return e.substring(0,r)}function zw(e){let{trackingId:t}=e;return{trackingId:t}}function Ww(e){return(e.source||[]).concat([`relay@${wm}`])}function xm(e,t,r){let{getReferrer:n,getLocation:i,getUserAgent:o}=r,s=zw(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:Ww(t),clientId:a,userAgent:o(),referrer:Sm(n()),location:Sm(i())})}function Sm(e){return e!==null?Hw(e,1024):null}function Kw(e,t,r,n){return{...t,meta:xm(e,r,n)}}var Yw="*";function Xw(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function i(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function o(c){if(c===Yw)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):o(c)}return{add:n,call:i,remove:a}}function Am({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function Jw(e){let t=Am(e);return{get:()=>t,update:r=>{t=Am({...t,...r})}}}var Ju=Zw();function Zw(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,i=document.cookie.split(";");for(let o of i){let s=o.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,i){let o=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+i).toUTCString()}`,a=o?`;domain=${o}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function eC(){return{getItem(e){return Ju.getItem(e)||localStorage.getItem(e)},removeItem(e){Ju.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Ju.setItem(e,t,31556952e3)}}}var bm="visitorId";function tC(){let e=document.referrer;return e===""?null:e}function Zu(){let e=eC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let i=b(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});mm().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield i;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>tC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(bm);if(t&&Hu(t))return t;let r=Yu();return e.setItem(bm,r),r}}}function rC(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function nC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function iC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=nC();return t&&r?{...r,runtime:"custom"}:t&&oC()&&rC()?Zu():n}function oC(){try{return typeof window=="object"}catch{return!1}}function sC(e){return{get:()=>Object.freeze(iC(e))}}function Em(e){let t=Jw(e),r=Xw(),n=sC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(i,o){let s=t.get(),a=n.get(),c=Kw(i,o,s,a);return Gw({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:i=>xm(i,t.get(),n.get()),on:(i,o)=>r.add({type:i,callback:o}),off:(i,o)=>r.remove(i,o),updateConfig:i=>t.update(i),version:wm}}m();d();f();p();function Rm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var $n=je(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Vn}`));var no=je(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>$n(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:i,enabled:o},s,a)=>{let c=cC(a);return Em({mode:o?"emit":"disabled",url:i??Xo(e,t),token:r,trackingId:n??null,source:s,environment:c})}),aC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},cC=e=>{if(!e)return;let t=e();return{...(Rm()?Zu():aC),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var Im=class extends Error{constructor(t){super(t[0].message);Se(this,"issues");this.name="SchemaError",this.issues=t}};var or="uninitialized",rl="pending",oo="fulfilled",so="rejected";function Tm(e){return{status:e,isUninitialized:e===or,isLoading:e===rl,isSuccess:e===oo,isError:e===so}}var _m=Lt;function Gm(e,t){if(e===t||!(_m(e)&&_m(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),i=r.length===n.length,o=Array.isArray(t)?[]:{};for(let s of r)o[s]=Gm(e[s],t[s]),i&&(i=e[s]===o[s]);return i?e:o}function nl(e,t,r){return e.reduce((n,i,o)=>(t(i,o)&&n.push(r(i,o)),n),[]).flat()}function uC(e){return new RegExp("(^|:)//").test(e)}function lC(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function al(e){return e!=null}function km(e){return[...(e?.values()??[])].filter(al)}function dC(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var pC=e=>e.replace(/\/$/,""),fC=e=>e.replace(/^\//,"");function mC(e,t){if(!e)return t;if(!t)return e;if(uC(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=pC(e),t=fC(t),`${e}${r}${t}`}function Us(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var il=()=>new Map,gC=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},hC=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Om=(...e)=>b(...e),yC=e=>e.status>=200&&e.status<=299,vC=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Pm(e){if(!Lt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var SC=e=>typeof e=="object"&&(Lt(e)||Array.isArray(e)||typeof e.toJSON=="function");function $m({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Om,paramsSerializer:n,isJsonContentType:i=vC,jsonContentType:o="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...h}={}){return typeof b>"u"&&r===Om&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(S,g,y){let{getState:C,extra:x,endpoint:E,forced:_,type:I}=g,k,{url:T,headers:F=new w(h.headers),params:V=void 0,responseHandler:L=c??"json",validateStatus:j=u??yC,timeout:U=a,...M}=typeof S=="string"?{url:S}:S,O={...h,signal:U?hC(g.signal,gC(U)):g.signal,...M};F=new w(Pm(F)),O.headers=(yield t(F,{getState:C,arg:S,extra:x,endpoint:E,forced:_,type:I,extraOptions:y}))||F;let P=SC(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",o),P&&i(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(L==="json"?O.headers.set("accept","application/json"):L==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~T.indexOf("?")?"&":"?",ie=n?n(V):new URLSearchParams(Pm(V));T+=J+ie}T=mC(e,T);let N=new Request(T,O);k={request:new Request(T,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:k}}let Y=$.clone();k.response=Y;let W,H="";try{let J;if(yield Promise.all([v($,L).then(ie=>W=ie,ie=>J=ie),Y.text().then(ie=>H=ie,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:k}}return j($,W)?{data:W,meta:k}:{error:{status:$.status,data:W},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=i(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var Qn=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function AC(){return _AC.apply(this,arguments)}function _AC(){_AC=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),i=~~((Math.random()+.4)*(300<<n));yield new Promise((o,s)=>{let a=setTimeout(()=>o(),i);if(r){let c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _AC.apply(this,arguments)}function Qm(e,t){throw Object.assign(new Qn({error:e,meta:t}),{throwImmediately:!0})}function el(e){e.aborted&&Qm({status:"CUSTOM_ERROR",error:"Aborted"})}var Nm={},bC=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,i){let o=[5,(t||Nm).maxRetries,(i||Nm).maxRetries].filter(h=>h!==void 0),[s]=o.slice(-1),c={maxRetries:s,backoff:AC,retryCondition:(h,v,{attempt:S})=>S<=s,...t,...i},u=0;for(;;){el(n.signal);try{let h=yield e(r,n,i);if(h.error)throw new Qn(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof Qn)return h.value;throw h}if(h instanceof Qn){if(!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:i}))return h.value}else if(u>c.maxRetries)return{error:h};el(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw el(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),Hm=Object.assign(bC,{fail:Qm}),Bs="__rtkq/",wC="online",CC="offline";var zm="focused";var cl=G(`${Bs}${zm}`),Wm=G(`${Bs}un${zm}`),ul=G(`${Bs}${wC}`),Km=G(`${Bs}${CC}`);var uo="query",Ym="mutation",Xm="infinitequery";function Gs(e){return e.type===uo}function xC(e){return e.type===Ym}function $s(e){return e.type===Xm}function Vs(e){return Gs(e)||$s(e)}function ll(e,t,r,n,i,o){let s=EC(e)?e(t,r,n,i):e;return s?nl(s,al,a=>o(Jm(a))):[]}function EC(e){return typeof e=="function"}function Jm(e){return typeof e=="string"?{type:e}:e}function RC(e,t){return e.catch(t)}var Hn=(e,t)=>e.endpointDefinitions[t],ao=Symbol("forceQueryFn"),ol=e=>typeof e[ao]=="function";function IC({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o,getInternalState:s}){let a=T=>s(T)?.runningQueries,c=T=>s(T)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:h,updateSubscriptionOptions:v}=i.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:I,buildInitiateMutation:k,getRunningQueryThunk:S,getRunningMutationThunk:g,getRunningQueriesThunk:y,getRunningMutationsThunk:C};function S(T,F){return V=>{let L=Hn(o,T),j=e({queryArgs:F,endpointDefinition:L,endpointName:T});return a(V)?.get(j)}}function g(T,F){return V=>c(V)?.get(F)}function y(){return T=>km(a(T))}function C(){return T=>km(c(T))}function x(T){}function E(T,F){let V=(L,{subscribe:j=!0,forceRefetch:U,subscriptionOptions:M,[ao]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:L,endpointDefinition:F,endpointName:T}),Y,W={...P,type:uo,subscribe:j,forceRefetch:U,subscriptionOptions:M,endpointName:T,originalArgs:L,queryCacheKey:$,[ao]:O};if(Gs(F))Y=t(W);else{let{direction:ue,initialPageParam:fe,refetchCachedPages:de}=P;Y=r({...W,direction:ue,initialPageParam:fe,refetchCachedPages:de})}let H=i.endpoints[T].select(L),J=N(Y),ie=H(Q());let{requestId:ve,abort:Oe}=J,xe=ie.requestId!==ve,Te=a(N)?.get($),_e=()=>H(Q()),le=Object.assign(O?J.then(_e):xe&&!Te?Promise.resolve(ie):Promise.all([Te,J]).then(_e),{arg:L,requestId:ve,subscriptionOptions:M,queryCacheKey:$,abort:Oe,unwrap(){return _asyncToGenerator(function*(){let ue=yield le;if(ue.isError)throw ue.error;return ue.data})()},refetch:ue=>N(V(L,{subscribe:!1,forceRefetch:!0,...ue})),unsubscribe(){j&&N(u({queryCacheKey:$,requestId:ve}))},updateSubscriptionOptions(ue){le.subscriptionOptions=ue,N(v({endpointName:T,requestId:ve,queryCacheKey:$,options:ue}))}});if(!Te&&!xe&&!O){let ue=a(N);ue.set($,le),le.then(()=>{ue.delete($)})}return le};return V}function _(T,F){return E(T,F)}function I(T,F){return E(T,F)}function k(T){return(F,{track:V=!0,fixedCacheKey:L}={})=>(j,U)=>{let M=n({type:"mutation",endpointName:T,originalArgs:F,track:V,fixedCacheKey:L}),O=j(M);let{requestId:P,abort:N,unwrap:Q}=O,$=RC(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{j(h({requestId:P,fixedCacheKey:L}))},W=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(j);return H.set(P,W),W.then(()=>{H.delete(P)}),L&&(H.set(L,W),W.then(()=>{H.get(L)===W&&H.delete(L)})),W}}}var Zm=class extends Im{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}},Wr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Kr(_x31,_x32,_x33,_x34){return _Kr.apply(this,arguments)}function _Kr(){_Kr=_asyncToGenerator(function*(e,t,r,n){let i=yield e["~standard"].validate(t);if(i.issues)throw new Zm(i.issues,t,r,n);return i.value});return _Kr.apply(this,arguments)}function Fm(e){return e}var io=(e={})=>({...e,[Zi]:!0});function TC({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){let h=(M,O,P,N)=>(Q,$)=>{let Y=r[M],W=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(i.internalActions.queryResultPatched({queryCacheKey:W,patches:P})),!N)return;let H=i.endpoints[M].select(O)($()),J=ll(Y.providesTags,H.data,void 0,O,{},o);Q(i.internalActions.updateProvidedBy([{queryCacheKey:W,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function S(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let g=(M,O,P,N=!0)=>(Q,$)=>{let W=i.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(i.util.patchQueryData(M,O,H.inversePatches,N))};if(W.status===or)return H;let J;if("data"in W)if(at(W.data)){let[ie,ve,Oe]=ju(W.data,P);H.patches.push(...ve),H.inversePatches.push(...Oe),J=ie}else J=P(W.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:W.data});return H.patches.length===0||Q(i.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(i.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[ao]:()=>({data:P})})),C=(M,O)=>M.query&&M[O]?M[O]:Fm,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:W}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:ie=u}=H,ve=M.type===uo;try{let Oe=Fm,xe={signal:O,abort:P,dispatch:$,getState:Y,extra:W,endpoint:M.endpointName,type:M.type,forced:ve?E(M,Y()):void 0,queryCacheKey:ve?M.queryCacheKey:void 0},Te=ve?M[ao]:void 0,_e,le=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(fe,de,Ue,Qe){if(de==null&&fe.pages.length)return Promise.resolve({data:fe});let It={queryArg:M.originalArgs,pageParam:de},mt=yield ue(It),jt=Qe?v:S;return{data:{pages:jt(fe.pages,mt.data,Ue),pageParams:jt(fe.pageParams,de,Ue)},meta:mt.meta}});return function le(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function ue(_x41){return _ue.apply(this,arguments)}function _ue(){_ue=_asyncToGenerator(function*(fe){let de,{extraOptions:Ue,argSchema:Qe,rawResponseSchema:It,responseSchema:mt}=H;if(Qe&&!Wr(ie,"arg")&&(fe=yield Kr(Qe,fe,"argSchema",{})),Te?de=Te():H.query?(Oe=C(H,"transformResponse"),de=yield t(H.query(fe),xe,Ue)):de=yield H.queryFn(fe,xe,Ue,Tt=>t(Tt,xe,Ue)),typeof process<"u",de.error)throw new Qn(de.error,de.meta);let{data:jt}=de;It&&!Wr(ie,"rawResponse")&&(jt=yield Kr(It,de.data,"rawResponseSchema",de.meta));let vt=yield Oe(jt,de.meta,fe);return mt&&!Wr(ie,"response")&&(vt=yield Kr(mt,vt,"responseSchema",de.meta)),{...de,data:vt}});return _ue.apply(this,arguments)}if(ve&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:fe}=H,{maxPages:de=1/0}=fe,Ue=M.refetchCachedPages??fe.refetchCachedPages??!0,Qe,It={pages:[],pageParams:[]},mt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,vt=E(M,Y())&&!M.direction||!mt?It:mt;if("direction"in M&&M.direction&&vt.pages.length){let Tt=M.direction==="backward",Go=(Tt?eg:sl)(fe,vt,M.originalArgs);Qe=yield le(vt,Go,de,Tt)}else{let{initialPageParam:Tt=fe.initialPageParam}=M,_i=mt?.pageParams??[],Go=_i[0]??Tt,aA=_i.length;if(Qe=yield le(vt,Go,de),Te&&(Qe={data:Qe.data.pages[0]}),Ue)for(let Sp=1;Sp<aA;Sp++){let cA=sl(fe,Qe.data,M.originalArgs);Qe=yield le(Qe.data,cA,de)}}_e=Qe}else _e=yield ue(M.originalArgs);return J&&!Wr(ie,"meta")&&_e.meta&&(_e.meta=yield Kr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,io({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Oe){let xe=Oe;if(xe instanceof Qn){let Te=C(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:le}=H,{value:ue,meta:fe}=xe;try{_e&&!Wr(ie,"rawErrorResponse")&&(ue=yield Kr(_e,ue,"rawErrorResponseSchema",fe)),J&&!Wr(ie,"meta")&&(fe=yield Kr(J,fe,"metaSchema",fe));let de=yield Te(ue,fe,M.originalArgs);return le&&!Wr(ie,"errorResponse")&&(de=yield Kr(le,de,"errorResponseSchema",fe)),N(de,io({baseQueryMeta:fe}))}catch(de){xe=de}}try{if(xe instanceof Zm){let Te={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:ve?M.queryCacheKey:void 0};H.onSchemaFailure?.(xe,Te),a?.(xe,Te);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(xe,Te),io({baseQueryMeta:xe._bqMeta}))}}catch(Te){xe=Te}throw typeof process<"u",console.error(xe),xe}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function E(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let _=()=>Ae(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return io({startedTimeStamp:Date.now(),...($s(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,W=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return ol(O)?!0:Q?.status==="pending"?!1:E(O,N)||Gs(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:W,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),I=_(),k=_(),T=Ae(`${e}/executeMutation`,x,{getPendingMeta(){return io({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,L=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,W=(J=!0)=>{let ie={forceRefetch:J,subscribe:!1};return i.endpoints[M].initiate(O,ie)},H=i.endpoints[M].select(O)(Q());if($)N(W());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(W());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(W())}else N(W(!1))};function j(M){return O=>O?.meta?.arg?.endpointName===M}function U(M,O){return{matchPending:qn(xs(M),j(O)),matchFulfilled:qn(nr(M),j(O)),matchRejected:qn(Hr(M),j(O))}}return{queryThunk:I,mutationThunk:T,infiniteQueryThunk:k,prefetch:L,updateQueryData:g,upsertQueryData:y,patchQueryData:h,buildMatchThunkActions:U}}function sl(e,{pages:t,pageParams:r},n){let i=t.length-1;return e.getNextPageParam(t[i],t,r[i],r,n)}function eg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function tg(e,t,r,n){return ll(r[e.meta.arg.endpointName][t],nr(e)?e.payload:void 0,to(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Dm(e){return st(e)?ys(e):e}function Ls(e,t,r){let n=e[t];n&&r(n)}function co(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Mm(e,t,r){let n=e[co(t)];n&&r(n)}var qs={};function _C({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let h=G(`${e}/resetApiState`);function v(j,U,M,O){var P;j[P=U.queryCacheKey]??(j[P]={status:or,endpointName:U.endpointName}),Ls(j,U.queryCacheKey,N=>{N.status=rl,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=i[O.arg.endpointName];$s(Q)&&"direction"in U&&(N.direction=U.direction)})}function S(j,U,M,O){Ls(j,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=i[U.arg.endpointName];if(P.status=oo,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:W}=U,H=$r(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:W}));P.data=H}else P.data=M;}else P.data=i[U.arg.endpointName].structuralSharing??!0?Gm(st(P.data)?yf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let g=zr({name:`${e}/queries`,initialState:qs,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:U}}){delete j[U]},prepare:Un()},cacheEntriesUpserted:{reducer(j,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(j,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),S(j,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:j=>({payload:j.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=i[P];return{queryDescription:{type:uo,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[Zi]:!0,requestId:ro(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:U,patches:M}}){Ls(j,U,O=>{O.data=Lu(O.data,M.concat())})},prepare:Un()}},extraReducers(j){j.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=ol(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=ol(M.arg);S(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Ls(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=so,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===oo||N?.status===so)&&(U[P]=N)})}}),y=zr({name:`${e}/mutations`,initialState:qs,reducers:{removeMutationResult:{reducer(j,{payload:U}){let M=co(U);M in j&&delete j[M]},prepare:Un()}},extraReducers(j){j.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[co(M)]={requestId:O,status:rl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&Mm(U,O,P=>{P.requestId===O.requestId&&(P.status=oo,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&Mm(U,P,N=>{N.requestId===P.requestId&&(N.status=so,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===oo||N?.status===so)&&P!==N?.requestId&&(U[P]=N)})}}),C={tags:{},keys:{}},x=zr({name:`${e}/invalidation`,initialState:C,reducers:{updateProvidedBy:{reducer(j,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.payload){E(j,N);for(let{type:$,id:Y}of Q){let W=(O=(M=j.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);W.includes(N)||W.push(N)}j.keys[N]=Q}},prepare:Un()}},extraReducers(j){j.addCase(g.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{E(U,M)}).addMatcher(a,(U,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[W,H]of Object.entries(Y)){let J=(N=(P=U.tags)[$]??(P[$]={}))[Q=W||"__internal_without_id"]??(N[Q]=[]);for(let ie of H)J.includes(ie)||J.push(ie),U.keys[ie]=O.keys[ie]}}).addMatcher(qt(nr(t),to(t)),(U,M)=>{_(U,[M])}).addMatcher(g.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(U,O)})}});function E(j,U){let M=Dm(j.keys[U]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=j.tags[P]?.[N];Q&&(j.tags[P][N]=Dm(Q).filter($=>$!==U))}delete j.keys[U]}function _(j,U){let M=U.map(O=>{let P=tg(O,"providesTags",i,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(j,x.actions.updateProvidedBy(M))}let I=zr({name:`${e}/subscriptions`,initialState:qs,reducers:{updateSubscriptionOptions(j,U){},unsubscribeQueryResult(j,U){},internal_getRTKQSubscriptions(){}}}),k=zr({name:`${e}/internalSubscriptions`,initialState:qs,reducers:{subscriptionsUpdated:{reducer(j,U){return Lu(j,U.payload)},prepare:Un()}}}),T=zr({name:`${e}/config`,initialState:{online:dC(),focused:lC(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(j,{payload:U}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||o!==U?"conflict":!0}},extraReducers:j=>{j.addCase(ul,U=>{U.online=!0}).addCase(Km,U=>{U.online=!1}).addCase(cl,U=>{U.focused=!0}).addCase(Wm,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=Mn({queries:g.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:k.reducer,config:T.reducer}),V=(j,U)=>F(h.match(U)?void 0:j,U),L={...T.actions,...g.actions,...I.actions,...k.actions,...y.actions,...x.actions,resetApiState:h};return{reducer:V,actions:L}}var tl=Symbol.for("RTKQ/skipToken"),rg={status:or},jm=$r(rg,()=>{}),Lm=$r(rg,()=>{});function kC({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>jm,i=I=>Lm;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:C,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:h};function o(I){return{...I,...Tm(I.status)}}function s(I){return I[t]}function a(I){return s(I)?.queries}function c(I,k){return a(I)?.[k]}function u(I){return s(I)?.mutations}function h(I){return s(I)?.config}function v(I,k,T){return F=>{if(F===tl)return r(n,T);let V=e({queryArgs:F,endpointDefinition:k,endpointName:I});return r(j=>c(j,V)??jm,T)}}function S(I,k){return v(I,k,o)}function g(I,k){let{infiniteQueryOptions:T}=k;function F(V){let L={...V,...Tm(V.status)},{isLoading:j,isError:U,direction:M}=L,O=M==="forward",P=M==="backward";return{...L,hasNextPage:E(T,L.data,L.originalArgs),hasPreviousPage:_(T,L.data,L.originalArgs),isFetchingNextPage:j&&O,isFetchingPreviousPage:j&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(I,k,F)}function y(){return I=>{let k;return typeof I=="object"?k=co(I)??tl:k=I,r(k===tl?i:V=>s(V)?.mutations?.[k]??Lm,o)}}function C(I,k){let T=I[t],F=new Set,V=nl(k,al,Jm);for(let L of V){let j=T.provided.tags[L.type];if(!j)continue;let U=(L.id!==void 0?j[L.id]:Object.values(j).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(L=>{let j=T.queries[L];return j?{queryCacheKey:L,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function x(I,k){return nl(Object.values(a(I)),T=>T?.endpointName===k&&T.status!==or,T=>T.originalArgs)}function E(I,k,T){return k?sl(I,k,T)!=null:!1}function _(I,k,T){return!k||!I.getPreviousPageParam?!1:eg(I,k,T)!=null}}var qm=WeakMap?new WeakMap:void 0,Um=({endpointName:e,queryArgs:t})=>{let r="",n=qm?.get(t);if(typeof n=="string")r=n;else{let i=JSON.stringify(t,(o,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Lt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Lt(t)&&qm?.set(t,i),r=i}return`${e}(${r})`};function OC(...e){return function(r){let n=Xi(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=Um;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:Um({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},o={endpointDefinitions:{},batch(u){u()},apiUid:ro(),extractRehydrationInfo:n,hasRehydrationInfo:Xi(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)i.tagTypes.includes(v)||i.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(Hn(o,v)):Object.assign(Hn(o,v)||{},S);return s}},a=e.map(u=>u.init(s,i,o));function c(u){let h=u.endpoints({query:v=>({...v,type:uo}),mutation:v=>({...v,type:Ym}),infiniteQuery:v=>({...v,type:Xm})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in o.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ct(39));typeof process<"u";continue}typeof process<"u",o.endpointDefinitions[v]=S;for(let g of a)g.injectEndpoint(v,S)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function ir(e,...t){return Object.assign(e,...t)}var PC=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let i=`${e.reducerPath}/subscriptions`,o=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(C,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:I,options:k}=x.payload,T=C.get(_);return T?.has(I)&&T.set(I,k),!0}if(c.match(x)){let{queryCacheKey:_,requestId:I}=x.payload,k=C.get(_);return k&&k.delete(I),!0}if(e.internalActions.removeQueryResult.match(x))return C.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:I}}=x,k=Us(C,_.queryCacheKey,il);return _.subscribe&&k.set(I,_.subscriptionOptions??k.get(I)??{}),!0}let E=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:I,requestId:k}}=x;if(_&&I.subscribe){let T=Us(C,I.queryCacheKey,il);T.set(k,I.subscriptionOptions??T.get(k)??{}),E=!0}}return E},h=()=>r.currentSubscriptions,g={getSubscriptions:h,getSubscriptionCount:C=>h().get(C)?.size??0,isRequestSubscribed:(C,x)=>!!h()?.get(C)?.get(x)};function y(C){return JSON.parse(JSON.stringify(Object.fromEntries([...C].map(([x,E])=>[x,Object.fromEntries(E)]))))}return(C,x)=>{if(o||(o=y(r.currentSubscriptions)),e.util.resetApiState.match(C))return o={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(C))return[!1,g];let E=u(r.currentSubscriptions,C),_=!0;if(E){s||(s=setTimeout(()=>{let T=y(r.currentSubscriptions),[,F]=ju(o,()=>T);x.next(e.internalActions.subscriptionsUpdated(F)),o=T,s=null},500));let I=typeof C.type=="string"&&!!C.type.startsWith(i),k=t.rejected.match(C)&&C.meta.condition&&!!C.meta.arg.subscribe;_=!I&&!k}return[_,!1]}},NC=2147483647/1e3-1,FC=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:i,selectors:{selectQueryEntry:o,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:h,cacheEntriesUpserted:v}=t.internalActions,S=qt(h.match,r.fulfilled,r.rejected,v.match);function g(I){let k=i.currentSubscriptions.get(I);return k?k.size>0:!1}let y={};function C(I){for(let k of I.values())k?.abort?.()}let x=(I,k)=>{let T=k.getState(),F=s(T);if(S(I)){let V;if(v.match(I))V=I.payload.map(L=>L.queryDescription.queryCacheKey);else{let{queryCacheKey:L}=h.match(I)?I.payload:I.meta.arg;V=[L]}E(V,k,F)}if(t.util.resetApiState.match(I)){for(let[V,L]of Object.entries(y))L&&clearTimeout(L),delete y[V];C(i.runningQueries),C(i.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:V}=n.extractRehydrationInfo(I);E(Object.keys(V),k,F)}};function E(I,k,T){let F=k.getState();for(let V of I){let L=o(F,V);L?.endpointName&&_(V,L.endpointName,k,T)}}function _(I,k,T,F){let L=Hn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(L===1/0)return;let j=Math.max(0,Math.min(L,NC));if(!g(I)){let U=y[I];U&&clearTimeout(U),y[I]=setTimeout(()=>{if(!g(I)){let M=o(T.getState(),I);M?.endpointName&&T.dispatch(a(M.endpointName,M.originalArgs))?.abort(),T.dispatch(u({queryCacheKey:I}))}delete y[I]},j*1e3)}}return x},Vm=new Error("Promise never resolved before cacheEntryRemoved."),DC=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Es(n),u=Es(i),h=nr(n,i),v={},{removeQueryResult:S,removeMutationResult:g,cacheEntriesUpserted:y}=e.internalActions;function C(T,F,V){let L=v[T];L?.valueResolved&&(L.valueResolved({data:F,meta:V}),delete L.valueResolved)}function x(T){let F=v[T];F&&(delete v[T],F.cacheEntryRemoved())}function E(T){let{arg:F,requestId:V}=T.meta,{endpointName:L,originalArgs:j}=F;return[L,j,V]}let _=(T,F,V)=>{let L=I(T);function j(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(T)){let[U,M,O]=E(T);j(U,L,O,M)}else if(y.match(T))for(let{queryDescription:U,value:M}of T.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;j(O,N,T.meta.requestId,P),C(N,M,{})}else if(i.pending.match(T)){if(F.getState()[t].mutations[L]){let[M,O,P]=E(T);k(M,O,L,F,P)}}else if(h(T))C(L,T.payload,T.meta.baseQueryMeta);else if(S.match(T)||g.match(T))x(L);else if(e.util.resetApiState.match(T))for(let U of Object.keys(v))x(U)};function I(T){return c(T)?T.meta.arg.queryCacheKey:u(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:S.match(T)?T.payload.queryCacheKey:g.match(T)?co(T.payload):""}function k(T,F,V,L,j){let U=Hn(r,T),M=U?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw Vm})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[T].select(Vs(U)?F:V),$=L.dispatch((H,J,ie)=>ie),Y={...L,getCacheEntry:()=>Q(L.getState()),requestId:j,extra:$,updateCachedData:Vs(U)?H=>L.dispatch(e.util.updateQueryData(T,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},W=M(F,Y);Promise.resolve(W).catch(H=>{if(H!==Vm)throw H})}return _},MC=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},jC=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:i,api:o,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=o.internalActions,h=qt(nr(n),to(n)),v=qt(nr(i,n),Hr(i,n)),S=[],g=0,y=(E,_)=>{(i.pending.match(E)||n.pending.match(E))&&g++,v(E)&&(g=Math.max(0,g-1)),h(E)?x(tg(E,"invalidatesTags",r,s),_):v(E)?x([],_):o.util.invalidateTags.match(E)&&x(ll(E.payload,void 0,void 0,void 0,void 0,s),_)};function C(){return g>0}function x(E,_){let I=_.getState(),k=I[e];if(S.push(...E),k.config.invalidationBehavior==="delayed"&&C())return;let T=S;if(S=[],T.length===0)return;let F=o.util.selectInvalidatedBy(I,T);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:L}of V){let j=k.queries[L],U=Us(c.currentSubscriptions,L,il);j&&(U.size===0?_.dispatch(u({queryCacheKey:L})):j.status!==or&&_.dispatch(a(j)))}})}return y},LC=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:i})=>{let{currentPolls:o,currentSubscriptions:s}=i,a=new Set,c=null,u=(x,E)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&h(x.payload.queryCacheKey,E),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&h(x.meta.arg.queryCacheKey,E),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,E),r.util.resetApiState.match(x)&&(y(),c&&(clearTimeout(c),c=null),a.clear())};function h(x,E){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)S({queryCacheKey:_},E);a.clear(),c=null},0))}function v({queryCacheKey:x},E){let _=E.getState()[e],I=_.queries[x],k=s.get(x);if(!I||I.status===or)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:F}=C(k);if(!Number.isFinite(T))return;let V=o.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let L=Date.now()+T;o.set(x,{nextPollTimestamp:L,pollingInterval:T,timeout:setTimeout(()=>{(_.config.focused||!F)&&E.dispatch(n(I)),v({queryCacheKey:x},E)},T)})}function S({queryCacheKey:x},E){let I=E.getState()[e].queries[x],k=s.get(x);if(!I||I.status===or)return;let{lowestPollingInterval:T}=C(k);if(!Number.isFinite(T)){g(x);return}let F=o.get(x),V=Date.now()+T;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},E)}function g(x){let E=o.get(x);E?.timeout&&clearTimeout(E.timeout),o.delete(x)}function y(){for(let x of o.keys())g(x)}function C(x=new Map){let E=!1,_=Number.POSITIVE_INFINITY;for(let I of x.values())I.pollingInterval&&(_=Math.min(I.pollingInterval,_),E=I.skipPollingIfUnfocused||E);return{lowestPollingInterval:_,skipPollingIfUnfocused:E}}return u},qC=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let i=xs(r,n),o=Hr(r,n),s=nr(r,n),a={};return(u,h)=>{if(i(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=Hn(t,S),C=y?.onQueryStarted;if(C){let x={},E=new Promise((T,F)=>{x.resolve=T,x.reject=F});E.catch(()=>{}),a[v]=x;let _=e.endpoints[S].select(Vs(y)?g:v),I=h.dispatch((T,F,V)=>V),k={...h,getCacheEntry:()=>_(h.getState()),requestId:v,extra:I,updateCachedData:Vs(y)?T=>h.dispatch(e.util.updateQueryData(S,g,T)):void 0,queryFulfilled:E};C(g,k)}}else if(s(u)){let{requestId:v,baseQueryMeta:S}=u.meta;a[v]?.resolve({data:u.payload,meta:S}),delete a[v]}else if(o(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete a[v]}}},UC=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{let{removeQueryResult:o}=r.internalActions,s=(c,u)=>{cl.match(c)&&a(u,"refetchOnFocus"),ul.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let h=c.getState()[e],v=h.queries,S=i.currentSubscriptions;t.batch(()=>{for(let g of S.keys()){let y=v[g],C=S.get(g);if(!C||!y)continue;let x=[...C.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&h.config[u])&&(C.size===0?c.dispatch(o({queryCacheKey:g})):y.status!==or&&c.dispatch(n(y)))}})}return s};function VC(e){let{reducerPath:t,queryThunk:r,api:n,context:i,getInternalState:o}=e,{apiUid:s}=i,a={invalidateTags:G(`${t}/invalidateTags`)},c=S=>S.type.startsWith(`${t}/`),u=[MC,FC,jC,LC,DC,qC];return{middleware:S=>{let g=!1,y=o(S.dispatch),C={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:S},x=u.map(I=>I(C)),E=PC(C),_=UC(C);return I=>k=>{if(!Li(k))return I(k);g||(g=!0,S.dispatch(n.internalActions.middlewareRegistered(s)));let T={...S,next:I},F=S.getState(),[V,L]=E(k,T,F),j;if(V?j=I(k):j=L,S.getState()[t]&&(_(k,T,F),c(k)||i.hasRehydrationInfo(k)))for(let U of x)U(k,T,F);return j}},actions:a};function v(S){return e.api.endpoints[S.endpointName].initiate(S.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Bm=Symbol(),BC=({createSelector:e=je}={})=>({name:Bm,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h,onSchemaFailure:v,catchSchemaFailure:S,skipSchemaValidation:g},y){xf();let C=le=>(typeof process<"u",le);Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:ul,onOffline:Km,onFocus:cl,onFocusLost:Wm},util:{}});let x=kC({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:E,selectCachedArgsForQuery:_,buildQuerySelector:I,buildInfiniteQuerySelector:k,buildMutationSelector:T}=x;ir(t.util,{selectInvalidatedBy:E,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:L,patchQueryData:j,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=TC({baseQuery:r,reducerPath:i,context:y,api:t,serializeQueryArgs:o,assertTagType:C,selectors:x,onSchemaFailure:v,catchSchemaFailure:S,skipSchemaValidation:g}),{reducer:N,actions:Q}=_C({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:L,serializeQueryArgs:o,reducerPath:i,assertTagType:C,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:i,invalidationBehavior:h}});ir(t.util,{patchQueryData:j,updateQueryData:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),ir(t.internalActions,Q);let $=new WeakMap,Y=le=>Us($,le,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:W,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:ie,getRunningMutationsThunk:ve,getRunningQueriesThunk:Oe,getRunningQueryThunk:xe}=IC({queryThunk:F,mutationThunk:L,infiniteQueryThunk:V,api:t,serializeQueryArgs:o,context:y,getInternalState:Y});ir(t.util,{getRunningMutationThunk:ie,getRunningMutationsThunk:ve,getRunningQueryThunk:xe,getRunningQueriesThunk:Oe});let{middleware:Te,actions:_e}=VC({reducerPath:i,context:y,queryThunk:F,mutationThunk:L,infiniteQueryThunk:V,api:t,assertTagType:C,selectors:x,getRunningQueryThunk:xe,getInternalState:Y});return ir(t.util,_e),ir(t,{reducer:N,middleware:Te}),{name:Bm,injectEndpoint(le,ue){var Ue;let de=(Ue=t.endpoints)[le]??(Ue[le]={});Gs(ue)&&ir(de,{name:le,select:I(le,ue),initiate:W(le,ue)},P(F,le)),xC(ue)&&ir(de,{name:le,select:T(),initiate:J(le)},P(L,le)),$s(ue)&&ir(de,{name:le,select:k(le,ue),initiate:H(le,ue)},P(F,le))}}}}),ng=OC(BC());m();d();f();p();m();d();f();p();var Yr=e=>e.query,ig=e=>e.query?.enableQuerySyntax;var vL=je(e=>Yr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,i)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:i})),GC=je(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function sr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function q(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var ge;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ge||(ge={}));function fl(){return typeof window<"u"}function Rl(){return typeof navigator<"u"}function zn(){return typeof document<"u"}function ml(){try{return typeof localStorage<"u"}catch{return!1}}function $C(){try{return typeof sessionStorage<"u"}catch{return!1}}function vg(){return Rl()&&navigator.cookieEnabled}var QC=[ge.click,ge.custom,ge.search,ge.view],HC=(e,t)=>QC.indexOf(e)!==-1?Object.assign({language:zn()?document.documentElement.lang:"unknown",userAgent:Rl()?navigator.userAgent:"unknown"},t):t,po=class e{static set(t,r,n){var i,o,s,a;n&&(o=new Date,o.setTime(o.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?og(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],og(t,r,o,i))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function og(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function zC(){return ml()?localStorage:vg()?new fo:$C()?sessionStorage:new Kn}var fo=class e{getItem(t){return po.get(`${e.prefix}${t}`)}removeItem(t){po.erase(`${e.prefix}${t}`)}setItem(t,r,n){po.set(`${e.prefix}${t}`,r,n)}};fo.prefix="coveo_";var gl=class{constructor(){this.cookieStorage=new fo}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Kn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Qs="__coveo.analytics.history",WC=20,KC=1e3*60,YC=75,Ws=class{constructor(t){this.store=t||zC()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Qs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Qs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Qs,JSON.stringify(t.slice(0,WC)))}catch{}}clear(){try{this.store.removeItem(Qs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,YC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>KC:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var XC=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ge.view?(yield JC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),JC=e=>q(void 0,void 0,void 0,function*(){let t=new Ws,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Hs,ZC=new Uint8Array(16);function ex(){if(!Hs&&(Hs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hs(ZC)}var tx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ks(e){return typeof e=="string"&&tx.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Sg(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function rx(e){if(!Ks(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function nx(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var ix="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ox="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function sx(e,t,r){function n(i,o,s,a){var c;if(typeof i=="string"&&(i=nx(i)),typeof o=="string"&&(o=rx(o)),((c=o)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+i.length);if(u.set(o),u.set(i,o.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,s){a=a||0;for(let h=0;h<16;++h)s[a+h]=u[h];return s}return Sg(u)}try{n.name=e}catch{}return n.DNS=ix,n.URL=ox,n}var ax=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),sg={randomUUID:ax};function Xr(e,t,r){if(sg.randomUUID&&!t&&!e)return sg.randomUUID();e=e||{};let n=e.random||(e.rng||ex)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Sg(n)}function cx(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function dl(e,t){return e<<t|e>>>32-t}function ux(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let s=0;s<i;++s){let a=new Uint32Array(16);for(let c=0;c<16;++c)a[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];o[s]=a}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let a=new Uint32Array(80);for(let g=0;g<16;++g)a[g]=o[s][g];for(let g=16;g<80;++g)a[g]=dl(a[g-3]^a[g-8]^a[g-14]^a[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),C=dl(c,5)+cx(y,u,h,v)+S+t[y]+a[g]>>>0;S=v,v=h,h=dl(u,30)>>>0,u=c,c=C}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var lx=sx("v5",80,ux),ag=lx,Ag="2.30.54",cg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,lo={pageview:"pageview",event:"event"},Ys=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},hl=class extends Ys{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=cg(window.location),this.lastReferrer=zn()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:zn()?document.title:"",encoding:zn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},i={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},o),n),i),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:i,location:o}=this.getNextValues(t,r);this.lastReferrer=i,this.pageViewId=n,this.currentLocation=o,t===lo.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===lo.pageview?this.nextPageViewId:this.pageViewId,referrer:t===lo.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===lo.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=i=>i.replace(/^\/?(.*)$/,"/$1");return`${(i=>i.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return cg(window.location)}},yr=class e{constructor(t,r){if(!Ks(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(i=>new RegExp(i.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,i]=r;if(n.length!==32||isNaN(parseInt(i)))return null;let o=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Ks(o)?new e(o,Number.parseInt(i)*1e3):null}};yr.cvo_cid="cvo_cid";yr.expirationTime=120;var yl=class extends Ys{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(yr.cvo_cid,new yr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};yl.Id="link";var bt=Object.keys;function zs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var pl=128,bg=192,ug=224,lg=240;function dx(e){return(e&248)===lg?4:(e&lg)===ug?3:(e&ug)===bg?2:1}function px(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&pl)!=pl)break;if(r-=3,(n&bg)!=pl){t-r>=dx(n)*3&&(r=t);break}}return e.substring(0,r)}var vl={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},fx=bt(vl).map(e=>vl[e]),mx=[...fx].join("|"),gx=new RegExp(`^(${mx}$)`),hx={svcAction:"svc_action",svcActionData:"svc_action_data"},yx=e=>bt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=vl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),vx=e=>gx.test(e),Sx=[vx],dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},pg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},nt={action:"pa",list:"pal",listSource:"pls"},Xs={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Ax=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Sl={id:"quoteId",affiliation:"quoteAffiliation"},Al={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},bx={add:nt,bookmark_add:nt,bookmark_remove:nt,click:nt,checkout:nt,checkout_option:nt,detail:nt,impression:nt,remove:nt,refund:Object.assign(Object.assign({},nt),Xs),purchase:Object.assign(Object.assign({},nt),Xs),quickview:nt,quote:Object.assign(Object.assign({},nt),Sl),review:Object.assign(Object.assign({},nt),Al)},wx=bt(dg).map(e=>dg[e]),Cx=bt(pg).map(e=>pg[e]),xx=bt(nt).map(e=>nt[e]),Ex=bt(Xs).map(e=>Xs[e]),Rx=bt(Al).map(e=>Al[e]),Ix=bt(Sl).map(e=>Sl[e]),Tx=[...wx,"custom"].join("|"),_x=[...Cx,"custom"].join("|"),wg="(pr[0-9]+)",Cg="(il[0-9]+pi[0-9]+)",kx=new RegExp(`^${wg}(${Tx})$`),Ox=new RegExp(`^(${Cg}(${_x}))|(il[0-9]+nm)$`),Px=new RegExp(`^(${xx.join("|")})$`),Nx=new RegExp(`^(${Ex.join("|")})$`),Fx=new RegExp(`^${wg}custom$`),Dx=new RegExp(`^${Cg}custom$`),Mx=new RegExp(`^(${[...Ax,...Rx,...Ix].join("|")})$`),jx=e=>kx.test(e),Lx=e=>Ox.test(e),qx=e=>Px.test(e),Ux=e=>Nx.test(e),Vx=e=>Mx.test(e),Bx=[Lx,jx,qx,Ux,Vx],Gx=[Fx,Dx],$x={anonymizeIp:"aip"},Qx={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Hx={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},zx=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Wx=Object.assign(Object.assign(Object.assign(Object.assign({},$x),Qx),Hx),zx.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),bl=Object.assign(Object.assign({},Wx),hx),Kx=e=>{let t=!!e.action&&bx[e.action]||{};return bt(e).reduce((r,n)=>{let i=t[n]||bl[n]||n;return Object.assign(Object.assign({},r),{[i]:e[n]})},{})},Yx=bt(bl).map(e=>bl[e]),Xx=e=>Yx.indexOf(e)!==-1,Jx=e=>e==="custom",Zx=e=>[...Bx,...Sx,Xx,Jx].some(t=>t(e)),eE=e=>bt(e).reduce((t,r)=>{let n=tE(r);return n?Object.assign(Object.assign({},t),rE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),tE=e=>{let t;return[...Gx].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},rE=(e,t)=>bt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),wl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:i}=this.opts,o=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${o}`,r,i),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let i=t,o=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;i=a||t;try{o=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:o,url:i}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,i=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",i?`visitorId=${i}`:"","discardVisitInfo=true"].filter(o=>!!o).join("&")})}isEventTypeLegacy(t){return[ge.click,ge.custom,ge.search,ge.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let i=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(i=`access_token=${encodeURIComponent(n)}&${i}`),i}},Cl=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},fg=A.fetch,Js=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:i,preprocessRequest:o}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},a),o?yield o(a,"analyticsFetch"):{}),{url:u}=c,h=sr(c,["url"]),v;try{v=yield fg(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&i.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield fg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ge.click,ge.custom,ge.search,ge.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},xl=class{constructor(t,r){ml()&&vg()?this.storage=new gl:ml()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Kn),this.client=new Js(t),this.beaconClient=new wl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:i,payload:o}of n)this.beaconClient.sendEvent(i,o)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},El=class{constructor(t,r){this.storage=r||new Kn,this.client=new Js(t)}getClientDependingOnEventType(t){return this.client}},Zs=class{constructor(){this.storage=new Kn,this.client=new Cl}getClientDependingOnEventType(t){return this.client}},nE="xx",iE=e=>e?.startsWith(nE)||!1,oE=`
26
+ `;return new vu(r)}var vu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},kt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let i in this.definition){let o=this.definition[i].validate(r[i]);o&&n.push(`${i}: ${o}`)}if(n.length)throw pb(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},qr=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&se(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Fn(e){return e===void 0}function fb(e){return e===null}function se(e){return Fn(e)||fb(e)}var je=class{constructor(e={}){Se(this,"value");this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(mb(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function mb(e){return Fn(e)||Xp(e)}function Xp(e){return typeof e=="boolean"}var Ve=class{constructor(e={}){Se(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t||(gb(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function gb(e){return Fn(e)||Jp(e)}function Jp(e){return typeof e=="number"&&!Number.isNaN(e)}var hb=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,ee=class{constructor(e={}){Se(this,"value");Se(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qr(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:i,ISODate:o}=this.config,s=this.value.validate(e);if(s)return s;if(Fn(e))return null;if(!Zp(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:i&&!i.includes(e)?`value should be one of: ${i.join(", ")}.`:o&&!(hb.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function Zp(e){return Object.prototype.toString.call(e)==="[object String]"}var Ee=class{constructor(e={}){Se(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Fn(e))return this.config.options.required?"value is required and is currently undefined":null;if(!ef(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&se(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let i=e[r],o=n.validate(i);o!==null&&(t+=` ${o}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function ef(e){return e!==void 0&&typeof e=="object"}var Ot=class{constructor(e={}){Se(this,"value");this.config=e,this.value=new qr(this.config)}validate(e){if(!se(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(se(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&se(n)&&(r=`value is null or undefined: ${e.join(",")}`);let i=this.validatePrimitiveValue(n,this.config.each);i!==null&&(r+=` ${i}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Xp(e)||Zp(e)||Jp(e)||ef(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function tf(e){return Array.isArray(e)}var Su=class{constructor(e){Se(this,"value");this.config=e,this.value=new qr(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Fn(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var Jo=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Dn=class{constructor(t){Se(this,"_basePath");Se(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Au(e){let{url:t,accessToken:r,organizationId:n,authentication:i,...o}=e;return o}var bu=e=>{let{response:t}=e;return t.body?yb(e):vb(t)},yb=e=>Ab(e)?bb(e):Sb(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},vb=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Sb(e){return e.body.statusCode!==void 0}function Ab(e){return e.body.exception!==void 0}var bb=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function rf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var wu=(e,t,r,n)=>{let i=new Dn(`${e.url}${n}`);return i.addParam("organizationId",e.organizationId),e.authentication&&i.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:i.href,origin:"searchApiFetch"}};var nf=(e,t)=>{let r=new Dn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Cu=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield gr.call({...wu(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Au(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=rf(r),i=yield r.arrayBuffer(),s=new TextDecoder(n).decode(i);return wb(s)?{success:s}:{error:bu({response:r,body:s})}});return function Cu(_x3,_x4){return _ref3.apply(this,arguments)}}();function wb(e){return typeof e=="string"}m();d();f();p();function Cb(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function xb(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Zo(e,t){if(t&&e.name==="AbortError")return{error:xb(e)};if(e instanceof Lr)return{error:Cb(e)};throw e}m();d();f();p();m();d();f();p();var es=(e,t,r,n,i={})=>{Eb(e);let o=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${n}`,s=Rb(i),a=s?`${o}?${s}`:o;return{accessToken:e.accessToken,method:t,contentType:r,url:a,origin:"caseAssistApiFetch"}},ts=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r],t),{}),rs=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,r)=>(t[r]=e[r].value,t),{}),Eb=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},Rb=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var of=e=>{let t=e.debug?{debug:"1"}:{};return{...es(e,"POST","application/json","/classify",t),requestParams:Ib(e)}},Ib=e=>({clientId:e.clientId,locale:e.locale,fields:ts(e.fields)});m();d();f();p();var sf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...es(e,"POST","application/json","/documents/suggest",t),requestParams:Tb(e)}},Tb=e=>({clientId:e.clientId,locale:e.locale,fields:ts(e.fields),context:e.context,analytics:e.analytics});var ns=class{constructor(t){this.options=t}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let r=yield gr.call({...of(t),..._this.options});if(r instanceof Error)return Zo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield gr.call({...sf(t),..._this2.options});if(r instanceof Error)return Zo(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return Cu(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Ye(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var _b=typeof Symbol=="function"&&Symbol.observable||"@@observable",af=_b,xu=()=>Math.random().toString(36).substring(7).split("").join("."),kb={INIT:`@@redux/INIT${xu()}`,REPLACE:`@@redux/REPLACE${xu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xu()}`},is=kb;function Lt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Eu(e,t,r){if(typeof e!="function")throw new Error(Ye(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ye(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ye(1));return r(Eu)(e,t)}let n=e,i=t,o=new Map,s=o,a=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((x,E)=>{s.set(E,x)}))}function h(){if(c)throw new Error(Ye(3));return i}function v(x){if(typeof x!="function")throw new Error(Ye(4));if(c)throw new Error(Ye(5));let E=!0;u();let _=a++;return s.set(_,x),function(){if(E){if(c)throw new Error(Ye(6));E=!1,u(),s.delete(_),o=null}}}function S(x){if(!Lt(x))throw new Error(Ye(7));if(typeof x.type>"u")throw new Error(Ye(8));if(typeof x.type!="string")throw new Error(Ye(17));if(c)throw new Error(Ye(9));try{c=!0,i=n(i,x)}finally{c=!1}return(o=s).forEach(_=>{_()}),x}function g(x){if(typeof x!="function")throw new Error(Ye(10));n=x,S({type:is.REPLACE})}function y(){let x=v;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ye(11));function _(){let k=E;k.next&&k.next(h())}return _(),{unsubscribe:x(_)}},[af](){return this}}}return S({type:is.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[af]:y}}function Ob(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:is.INIT})>"u")throw new Error(Ye(12));if(typeof r(void 0,{type:is.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ye(13))})}function Mn(e){let t=Object.keys(e),r={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(r[a]=e[a])}let n=Object.keys(r),i,o;try{Ob(r)}catch(s){o=s}return function(a={},c){if(o)throw o;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=a[S],C=g(y,c);if(typeof C>"u"){let x=c&&c.type;throw new Error(Ye(14))}h[S]=C,u=u||C!==y}return u=u||n.length!==Object.keys(a).length,u?h:a}}function ji(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function cf(...e){return t=>(r,n)=>{let i=t(r,n),o=()=>{throw new Error(Ye(15))},s={getState:i.getState,dispatch:(c,...u)=>o(c,...u)},a=e.map(c=>c(s));return o=ji(...a)(i.dispatch),{...i,dispatch:o}}}function Li(e){return Lt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Fu=Symbol.for("immer-nothing"),qi=Symbol.for("immer-draftable"),He=Symbol.for("immer-state");function Xe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gt=Object,Vr=gt.getPrototypeOf,Vi="constructor",Hi="prototype",Tu="configurable",cs="enumerable",ss="writable",Bi="value",st=e=>!!e&&!!e[He];function at(e){return e?hf(e)||Wi(e)||!!e[qi]||!!e[Vi]?.[qi]||Ki(e)||Yi(e):!1}var Pb=gt[Hi][Vi].toString(),uf=new WeakMap;function hf(e){if(!e||!jn(e))return!1;let t=Vr(e);if(t===null||t===gt[Hi])return!0;let r=gt.hasOwnProperty.call(t,Vi)&&t[Vi];if(r===Object)return!0;if(!Ur(r))return!1;let n=uf.get(r);return n===void 0&&(n=Function.toString.call(r),uf.set(r,n)),n===Pb}function yf(e){return st(e)||Xe(15,e),e[He].base_}function zi(e,t,r=!0){Br(e)===0?(r?Reflect.ownKeys(e):gt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Br(e){let t=e[He];return t?t.type_:Wi(e)?1:Ki(e)?2:Yi(e)?3:0}var Ui=(e,t,r=Br(e))=>r===2?e.has(t):gt[Hi].hasOwnProperty.call(e,t),tr=(e,t,r=Br(e))=>r===2?e.get(t):e[t],us=(e,t,r,n=Br(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Nb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Wi=Array.isArray,Ki=e=>e instanceof Map,Yi=e=>e instanceof Set,jn=e=>typeof e=="object",Ur=e=>typeof e=="function",Ru=e=>typeof e=="boolean";function Fb(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Db=e=>jn(e)?e?.[He]:null,rr=e=>e.copy_||e.base_;var Du=e=>e.modified_?e.copy_:e.base_;function _u(e,t){if(Ki(e))return new Map(e);if(Yi(e))return new Set(e);if(Wi(e))return Array[Hi].slice.call(e);let r=hf(e);if(t===!0||t==="class_only"&&!r){let n=gt.getOwnPropertyDescriptors(e);delete n[He];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){let s=i[o],a=n[s];a[ss]===!1&&(a[ss]=!0,a[Tu]=!0),(a.get||a.set)&&(n[s]={[Tu]:!0,[ss]:!0,[cs]:a[cs],[Bi]:e[s]})}return gt.create(Vr(e),n)}else{let n=Vr(e);if(n!==null&&r)return{...e};let i=gt.create(n);return gt.assign(i,e)}}function Mu(e,t=!1){return gs(e)||st(e)||!at(e)||(Br(e)>1&&gt.defineProperties(e,{set:os,add:os,clear:os,delete:os}),gt.freeze(e),t&&zi(e,(r,n)=>{Mu(n,!0)},!1)),e}function Mb(){Xe(2)}var os={[Bi]:Mb};function gs(e){return e===null||!jn(e)?!0:gt.isFrozen(e)}var ls="MapSet",ds="Patches",lf="ArrayMethods",ps={};function Gr(e){let t=ps[e];return t||Xe(0,e),t}var df=e=>!!ps[e];function jb(e,t){ps[e]||(ps[e]=t)}var Gi,vf=()=>Gi,Lb=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:df(ls)?Gr(ls):void 0,arrayMethodsPlugin_:df(lf)?Gr(lf):void 0});function pf(e,t){t&&(e.patchPlugin_=Gr(ds),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ku(e){Ou(e),e.drafts_.forEach(qb),e.drafts_=null}function Ou(e){e===Gi&&(Gi=e.parent_)}var ff=e=>Gi=Lb(Gi,e);function qb(e){let t=e[He];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[He].modified_&&(ku(t),Xe(4)),at(e)&&(e=gf(t,e));let{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[He].base_,e,t)}else e=gf(t,r);return Ub(t,e,!0),ku(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Fu?e:void 0}function gf(e,t){if(gs(t))return t;let r=t[He];if(!r)return fs(t,e.handledSet_,e);if(!hs(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);bf(r,e)}return r.copy_}function Ub(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Mu(t,r)}function Sf(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var hs=(e,t)=>e.scope_===t,Vb=[];function Af(e,t,r,n){let i=rr(e),o=e.type_;if(n!==void 0&&tr(i,n,o)===t){us(i,n,r,o);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;zi(i,(c,u)=>{if(st(u)){let h=a.get(u)||[];h.push(c),a.set(u,h)}})}let s=e.draftLocations_.get(t)??Vb;for(let a of s)us(i,a,r,o)}function Bb(e,t,r){e.callbacks_.push(function(i){let o=t;if(!o||!hs(o,i))return;i.mapSetPlugin_?.fixSetContents(o);let s=Du(o);Af(e,o.draft_??o,s,r),bf(o,i)})}function bf(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let i=n.getPath(e);i&&n.generatePatches_(e,i,t)}Sf(e)}}function Gb(e,t,r){let{scope_:n}=e;if(st(r)){let i=r[He];hs(i,n)&&i.callbacks_.push(function(){as(e);let s=Du(i);Af(e,r,s,t)})}else at(r)&&e.callbacks_.push(function(){let o=rr(e);e.type_===3?o.has(r)&&fs(r,n.handledSet_,n):tr(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fs(tr(e.copy_,t,e.type_),n.handledSet_,n)})}function fs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||st(e)||t.has(e)||!at(e)||gs(e)||(t.add(e),zi(e,(n,i)=>{if(st(i)){let o=i[He];if(hs(o,r)){let s=Du(o);us(e,n,s,e.type_),Sf(o)}}else at(i)&&fs(i,t,r)})),e}function $b(e,t){let r=Wi(e),n={type_:r?1:0,scope_:t?t.scope_:vf(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=n,o=ms;r&&(i=[n],o=$i);let{revoke:s,proxy:a}=Proxy.revocable(i,o);return n.draft_=a,n.revoke_=s,[a,n]}var ms={get(e,t){if(t===He)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let i=rr(e);if(!Ui(i,t,e.type_))return Qb(e,i,t);let o=i[t];if(e.finalized_||!at(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Fb(t))return o;if(o===Iu(e.base_,t)){as(e);let s=e.type_===1?+t:t,a=Nu(e.scope_,o,e,s);return e.copy_[s]=a}return o},has(e,t){return t in rr(e)},ownKeys(e){return Reflect.ownKeys(rr(e))},set(e,t,r){let n=wf(rr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let i=Iu(rr(e),t),o=i?.[He];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Nb(r,i)&&(r!==void 0||Ui(e.base_,t,e.type_)))return!0;as(e),Pu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Gb(e,t,r)),!0},deleteProperty(e,t){return as(e),Iu(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Pu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=rr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ss]:!0,[Tu]:e.type_!==1||t!=="length",[cs]:n[cs],[Bi]:r[t]}},defineProperty(){Xe(11)},getPrototypeOf(e){return Vr(e.base_)},setPrototypeOf(){Xe(12)}},$i={};for(let e in ms){let t=ms[e];$i[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}$i.deleteProperty=function(e,t){return $i.set.call(this,e,t,void 0)};$i.set=function(e,t,r){return ms.set.call(this,e[0],t,r,e[0])};function Iu(e,t){let r=e[He];return(r?rr(r):e)[t]}function Qb(e,t,r){let n=wf(t,r);return n?Bi in n?n[Bi]:n.get?.call(e.draft_):void 0}function wf(e,t){if(!(t in e))return;let r=Vr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vr(r)}}function Pu(e){e.modified_||(e.modified_=!0,e.parent_&&Pu(e.parent_))}function as(e){e.copy_||(e.assigned_=new Map,e.copy_=_u(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Hb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Ur(t)&&!Ur(r)){let o=r;r=t;let s=this;return function(c=o,...u){return s.produce(c,h=>r.call(this,h,...u))}}Ur(r)||Xe(6),n!==void 0&&!Ur(n)&&Xe(7);let i;if(at(t)){let o=ff(this),s=Nu(o,t,void 0),a=!0;try{i=r(s),a=!1}finally{a?ku(o):Ou(o)}return pf(o,n),mf(i,o)}else if(!t||!jn(t)){if(i=r(t),i===void 0&&(i=t),i===Fu&&(i=void 0),this.autoFreeze_&&Mu(i,!0),n){let o=[],s=[];Gr(ds).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:s}),n(o,s)}return i}else Xe(1,t)},this.produceWithPatches=(t,r)=>{if(Ur(t))return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let n,i;return[this.produce(t,r,(s,a)=>{n=s,i=a}),n,i]},Ru(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ru(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ru(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){at(e)||Xe(8),st(e)&&(e=ys(e));let t=ff(this),r=Nu(t,e,void 0);return r[He].isManual_=!0,Ou(t),r}finishDraft(e,t){let r=e&&e[He];(!r||!r.isManual_)&&Xe(9);let{scope_:n}=r;return pf(n,t),mf(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let n=Gr(ds).applyPatches_;return st(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Nu(e,t,r,n){let[i,o]=Ki(t)?Gr(ls).proxyMap_(t,r):Yi(t)?Gr(ls).proxySet_(t,r):$b(t,r);return(r?.scope_??vf()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?Bb(r,o,n):o.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(o);let{patchPlugin_:u}=c;o.modified_&&u&&u.generatePatches_(o,[],c)}),i}function ys(e){return st(e)||Xe(10,e),Cf(e)}function Cf(e){if(!at(e)||gs(e))return e;let t=e[He],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=_u(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=_u(e,!0);return zi(r,(i,o)=>{us(r,i,Cf(o))},n),t&&(t.finalized_=!1),r}function xf(){function t(y,C=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,E=Db(tr(x,y.key_)),_=tr(x,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||E!=null&&E.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&x.size>k||Ui(x,k)))return null;C.push(k)}if(y.parent_)return t(y.parent_,C);C.reverse();try{r(y.copy_,C)}catch{return null}return C}function r(y,C){let x=y;for(let E=0;E<C.length-1;E++){let _=C[E];if(x=tr(x,_),!jn(x)||x===null)throw new Error(`Cannot resolve path at '${C.join("/")}'`)}return x}let n="replace",i="add",o="remove";function s(y,C,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:_}=x;switch(y.type_){case 0:case 2:return c(y,C,E,_);case 1:return a(y,C,E,_);case 3:return u(y,C,E,_)}}function a(y,C,x,E){let{base_:_,assigned_:I}=y,k=y.copy_;k.length<_.length&&([_,k]=[k,_],[x,E]=[E,x]);let T=y.allIndicesReassigned_===!0;for(let F=0;F<_.length;F++){let V=k[F],L=_[F];if((T||I?.get(F.toString()))&&V!==L){let U=V?.[He];if(U&&U.modified_)continue;let M=C.concat([F]);x.push({op:n,path:M,value:g(V)}),E.push({op:n,path:M,value:g(L)})}}for(let F=_.length;F<k.length;F++){let V=C.concat([F]);x.push({op:i,path:V,value:g(k[F])})}for(let F=k.length-1;_.length<=F;--F){let V=C.concat([F]);E.push({op:o,path:V})}}function c(y,C,x,E){let{base_:_,copy_:I,type_:k}=y;zi(y.assigned_,(T,F)=>{let V=tr(_,T,k),L=tr(I,T,k),j=F?Ui(_,T)?n:i:o;if(V===L&&j===n)return;let U=C.concat(T);x.push(j===o?{op:j,path:U}:{op:j,path:U,value:g(L)}),E.push(j===i?{op:o,path:U}:j===o?{op:i,path:U,value:g(V)}:{op:n,path:U,value:g(V)})})}function u(y,C,x,E){let{base_:_,copy_:I}=y,k=0;_.forEach(T=>{if(!I.has(T)){let F=C.concat([k]);x.push({op:o,path:F,value:T}),E.unshift({op:i,path:F,value:T})}k++}),k=0,I.forEach(T=>{if(!_.has(T)){let F=C.concat([k]);x.push({op:i,path:F,value:T}),E.unshift({op:o,path:F,value:T})}k++})}function h(y,C,x){let{patches_:E,inversePatches_:_}=x;E.push({op:n,path:[],value:C===Fu?void 0:C}),_.push({op:n,path:[],value:y})}function v(y,C){return C.forEach(x=>{let{path:E,op:_}=x,I=y;for(let V=0;V<E.length-1;V++){let L=Br(I),j=E[V];typeof j!="string"&&typeof j!="number"&&(j=""+j),(L===0||L===1)&&(j==="__proto__"||j===Vi)&&Xe(19),Ur(I)&&j===Hi&&Xe(19),I=tr(I,j),jn(I)||Xe(18,E.join("/"))}let k=Br(I),T=S(x.value),F=E[E.length-1];switch(_){case n:switch(k){case 2:return I.set(F,T);case 3:Xe(16);default:return I[F]=T}case i:switch(k){case 1:return F==="-"?I.push(T):I.splice(F,0,T);case 2:return I.set(F,T);case 3:return I.add(T);default:return I[F]=T}case o:switch(k){case 1:return I.splice(F,1);case 2:return I.delete(F);case 3:return I.delete(x.value);default:return delete I[F]}default:Xe(17,_)}}),y}function S(y){if(!at(y))return y;if(Wi(y))return y.map(S);if(Ki(y))return new Map(Array.from(y.entries()).map(([x,E])=>[x,S(E)]));if(Yi(y))return new Set(Array.from(y).map(S));let C=Object.create(Vr(y));for(let x in y)C[x]=S(y[x]);return Ui(y,qi)&&(C[qi]=y[qi]),C}function g(y){return st(y)?S(y):y}jb(ds,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:h,getPath:t})}var Qi=new Hb,$r=Qi.produce,ju=Qi.produceWithPatches.bind(Qi);var Lu=Qi.applyPatches.bind(Qi);m();d();f();p();function zb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Wb(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Kb(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Ef=e=>Array.isArray(e)?e:[e];function Yb(e){let t=Array.isArray(e[0])?e[0]:e;return Kb(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Xb(e,t){let r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var YN=Object.getPrototypeOf({});var Jb=class{constructor(e){this.value=e}deref(){return this.value}},Zb=typeof WeakRef<"u"?WeakRef:Jb,ew=0,Rf=1;function vs(){return{s:ew,v:void 0,o:null,p:null}}function Xi(e,t={}){let r=vs(),{resultEqualityCheck:n}=t,i,o=0;function s(){let a=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);let C=y.get(g);C===void 0?(a=vs(),y.set(g,a)):a=C}else{let y=a.p;y===null&&(a.p=y=new Map);let C=y.get(g);C===void 0?(a=vs(),y.set(g,a)):a=C}}let u=a,h;if(a.s===Rf)h=a.v;else if(h=e.apply(null,arguments),o++,n){let v=i?.deref?.()??i;v!=null&&n(v,h)&&(h=v,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new Zb(h):h}return u.s=Rf,u.v=h,h}return s.clearCache=()=>{r=vs(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function tw(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,s=0,a,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),zb(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=Xi,argsMemoizeOptions:y=[],devModeChecks:C={}}=h,x=Ef(S),E=Ef(y),_=Yb(i),I=v(function(){return o++,u.apply(null,arguments)},...x),k=!0,T=g(function(){s++;let V=Xb(_,arguments);return a=I.apply(null,V),a},...E);return Object.assign(T,{resultFunc:u,memoizedResultFunc:I,dependencies:_,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Fe=tw(Xi),rw=Object.assign((e,t=Fe)=>{Wb(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(o=>e[o]);return t(n,(...o)=>o.reduce((s,a,c)=>(s[r[c]]=a,s),{}))},{withTypes:()=>rw});m();d();f();p();function If(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var Tf=If(),_f=If;var nw=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ji:ji.apply(null,arguments)},mF=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},iw=e=>e&&typeof e.match=="function";function G(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ct(0));return{type:e,payload:i.payload,...("meta"in i&&{meta:i.meta}),...("error"in i&&{error:i.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Li(n)&&n.type===e,r}var jf=class Ji extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Ji.prototype)}static get[Symbol.species](){return Ji}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Ji(...t[0].concat(this)):new Ji(...t.concat(this))}};function kf(e){return at(e)?$r(e,()=>{}):e}function Ss(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ow(e){return typeof e=="boolean"}var sw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{},s=new jf;return r&&(ow(r)?s.push(Tf):s.push(_f(r.extraArgument))),s},Zi="RTK_autoBatch",Un=()=>e=>({payload:e,meta:{[Zi]:!0}}),Of=e=>t=>{setTimeout(t,e)},aw=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),i=!0,o=!1,s=!1,a=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Of(10):e.type==="callback"?e.queueNotification:Of(e.timeout),u=()=>{s=!1,o&&(o=!1,a.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>i&&h(),S=n.subscribe(v);return a.add(h),()=>{S(),a.delete(h)}},dispatch(h){try{return i=!h?.meta?.[Zi],o=!i,o&&(s||(s=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},cw=e=>function(r){let{autoBatch:n=!0}=r??{},i=new jf(e);return n&&i.push(aw(typeof n=="object"?n:void 0)),i};function Lf(e){let t=sw(),{reducer:r=void 0,middleware:n,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Lt(r))c=Mn(r);else throw new Error(ct(1));let u;typeof n=="function"?u=n(t):u=t();let h=ji;i&&(h=nw({trace:!1,...(typeof i=="object"&&i)}));let v=cf(...u),S=cw(v),g=typeof a=="function"?a(S):S(),y=h(...g);return Eu(c,s,y)}function qf(e){let t={},r=[],n,i={addCase(o,s){let a=typeof o=="string"?o:o.type;if(!a)throw new Error(ct(28));if(a in t)throw new Error(ct(29));return t[a]=s,i},addAsyncThunk(o,s){return s.pending&&(t[o.pending.type]=s.pending),s.rejected&&(t[o.rejected.type]=s.rejected),s.fulfilled&&(t[o.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:o.settled,reducer:s.settled}),i},addMatcher(o,s){return r.push({matcher:o,reducer:s}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function uw(e){return typeof e=="function"}function Ge(e,t){let[r,n,i]=qf(t),o;if(uw(e))o=()=>kf(e());else{let a=kf(e);o=()=>a}function s(a=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,v)=>{if(v)if(st(h)){let g=v(h,c);return g===void 0?h:g}else{if(at(h))return $r(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},a)}return s.getInitialState=o,s}var Uf=(e,t)=>iw(e)?e.match(t):e(t);function qt(...e){return t=>e.some(r=>Uf(r,t))}function qn(...e){return t=>e.every(r=>Uf(r,t))}function Cs(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function eo(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function xs(...e){return e.length===0?t=>Cs(t,["pending"]):eo(e)?qt(...e.map(t=>t.pending)):xs()(e[0])}function Hr(...e){return e.length===0?t=>Cs(t,["rejected"]):eo(e)?qt(...e.map(t=>t.rejected)):Hr()(e[0])}function to(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?qn(Hr(...e),t):eo(e)?qn(Hr(...e),t):to()(e[0])}function nr(...e){return e.length===0?t=>Cs(t,["fulfilled"]):eo(e)?qt(...e.map(t=>t.fulfilled)):nr()(e[0])}function Es(...e){return e.length===0?t=>Cs(t,["pending","fulfilled","rejected"]):eo(e)?qt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Es()(e[0])}var lw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ro=(e=21)=>{let t="",r=e;for(;r--;)t+=lw[Math.random()*64|0];return t},dw=["name","message","stack","code"],qu=class{constructor(e,t){Se(this,"_type");this.payload=e,this.meta=t}},Pf=class{constructor(e,t){Se(this,"_type");this.payload=e,this.meta=t}},pw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of dw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Nf="External signal was aborted",Ae=(()=>{function e(t,r,n){let i=G(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),o=G(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),s=G(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||pw)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:u}={}){return(h,v,S)=>{let g=n?.idGenerator?n.idGenerator(c):ro(),y=new l.AbortController,C,x;function E(I){x=I,y.abort()}u&&(u.aborted?E(Nf):u.addEventListener("abort",()=>E(Nf),{once:!0}));let _=_asyncToGenerator(function*(){let I;try{let T=n?.condition?.(c,{getState:v,extra:S});if(mw(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let F=new Promise((V,L)=>{C=()=>{L({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",C,{once:!0})});h(o(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:v,extra:S}))),I=yield Promise.race([F,Promise.resolve(r(c,{dispatch:h,getState:v,extra:S,requestId:g,signal:y.signal,abort:E,rejectWithValue:(V,L)=>new qu(V,L),fulfillWithValue:(V,L)=>new Pf(V,L)})).then(V=>{if(V instanceof qu)throw V;return V instanceof Pf?i(V.payload,g,c,V.meta):i(V,g,c)})])}catch(T){I=T instanceof qu?s(null,g,c,T.payload,T.meta):s(T,g,c)}finally{C&&y.signal.removeEventListener("abort",C)}return n&&!n.dispatchConditionRejection&&s.match(I)&&I.meta.condition||h(I),I})();return Object.assign(_,{abort:E,requestId:g,arg:c,unwrap(){return _.then(fw)}})}}return Object.assign(a,{pending:o,rejected:s,fulfilled:i,settled:qt(s,i),typePrefix:t})}return e.withTypes=()=>e,e})();function fw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function mw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Vf=Symbol.for("rtk-slice-createasyncthunk"),hF={[Vf]:Ae};function gw(e,t){return`${e}/${t}`}function hw({creators:e}={}){let t=e?.asyncThunk?.[Vf];return function(n){let{name:i,reducerPath:o=i}=n;if(!i)throw new Error(ct(11));typeof process<"u";let s=(typeof n.reducers=="function"?n.reducers(vw()):n.reducers)||{},a=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,k){let T=typeof I=="string"?I:I.type;if(!T)throw new Error(ct(12));if(T in c.sliceCaseReducersByType)throw new Error(ct(13));return c.sliceCaseReducersByType[T]=k,u},addMatcher(I,k){return c.sliceMatchers.push({matcher:I,reducer:k}),u},exposeAction(I,k){return c.actionCreators[I]=k,u},exposeCaseReducer(I,k){return c.sliceCaseReducersByName[I]=k,u}};a.forEach(I=>{let k=s[I],T={reducerName:I,type:gw(i,I),createNotation:typeof n.reducers=="function"};Aw(k)?ww(T,k,u,t):Sw(T,k,u)});function h(){let[I={},k=[],T=void 0]=typeof n.extraReducers=="function"?qf(n.extraReducers):[n.extraReducers],F={...I,...c.sliceCaseReducersByType};return Ge(n.initialState,V=>{for(let L in F)V.addCase(L,F[L]);for(let L of c.sliceMatchers)V.addMatcher(L.matcher,L.reducer);for(let L of k)V.addMatcher(L.matcher,L.reducer);T&&V.addDefaultCase(T)})}let v=I=>I,S=new Map,g=new WeakMap,y;function C(I,k){return y||(y=h()),y(I,k)}function x(){return y||(y=h()),y.getInitialState()}function E(I,k=!1){function T(V){let L=V[I];return typeof L>"u"&&k&&(L=Ss(g,T,x)),L}function F(V=v){let L=Ss(S,k,()=>new WeakMap);return Ss(L,V,()=>{let j={};for(let[U,M]of Object.entries(n.selectors??{}))j[U]=yw(M,V,()=>Ss(g,V,x),k);return j})}return{reducerPath:I,getSelectors:F,get selectors(){return F(T)},selectSlice:T}}let _={name:i,reducer:C,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...E(o),injectInto(I,{reducerPath:k,...T}={}){let F=k??o;return I.inject({reducerPath:F,reducer:C},T),{..._,...E(F,!0)}}};return _}}function yw(e,t,r,n){function i(o,...s){let a=t(o);return typeof a>"u"&&n&&(a=r()),e(a,...s)}return i.unwrapped=e,i}var zr=hw();function vw(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Sw({type:e,reducerName:t,createNotation:r},n,i){let o,s;if("reducer"in n){if(r&&!bw(n))throw new Error(ct(17));o=n.reducer,s=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?G(e,s):G(e))}function Aw(e){return e._reducerDefinitionType==="asyncThunk"}function bw(e){return e._reducerDefinitionType==="reducerWithPrepare"}function ww({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ct(18));let{payloadCreator:o,fulfilled:s,pending:a,rejected:c,settled:u,options:h}=r,v=i(e,o,h);n.exposeAction(t,v),s&&n.addCase(v.fulfilled,s),a&&n.addCase(v.pending,a),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:s||As,pending:a||As,rejected:c||As,settled:u||As})}function As(){}var Cw="task",Bf="listener",Gf="completed",Bu="cancelled",xw=`task-${Bu}`,Ew=`task-${Gf}`,Uu=`${Bf}-${Bu}`,Rw=`${Bf}-${Gf}`,Rs=class{constructor(e){Se(this,"name","TaskAbortError");Se(this,"message");this.code=e,this.message=`${Cw} ${Bu} (reason: ${e})`}},Gu=(e,t)=>{if(typeof e!="function")throw new TypeError(ct(32))},bs=()=>{},$f=(e,t=bs)=>(e.catch(t),e),Qf=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Qr=e=>{if(e.aborted)throw new Rs(e.reason)};function Hf(e,t){let r=bs;return new Promise((n,i)=>{let o=()=>i(new Rs(e.reason));if(e.aborted){o();return}r=Qf(e,o),t.finally(()=>r()).then(n,i)}).finally(()=>{r=bs})}var Iw=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Rs?"cancelled":"rejected",error:r}}finally{t?.()}});return function Iw(_x5,_x6){return _ref5.apply(this,arguments)}}(),ws=e=>t=>$f(Hf(e,t).then(r=>(Qr(e),r))),zf=e=>{let t=ws(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Ln}=Object,Ff={},Is="listenerMiddleware",Tw=(e,t)=>{let r=n=>Qf(e,()=>n.abort(e.reason));return(n,i)=>{Gu(n,"taskExecutor");let o=new l.AbortController;r(o);let s=Iw(/*#__PURE__*/_asyncToGenerator(function*(){Qr(e),Qr(o.signal);let a=yield n({pause:ws(o.signal),delay:zf(o.signal),signal:o.signal});return Qr(o.signal),a}),()=>o.abort(Ew));return i?.autoJoin&&t.push(s.catch(bs)),{result:ws(e)(s),cancel(){o.abort(xw)}}}},_w=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,i){Qr(t);let o=()=>{},a=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});o=()=>{h(),u()}})];i!=null&&a.push(new Promise(c=>setTimeout(c,i,null)));try{let c=yield Hf(t,Promise.race(a));return Qr(t),c}finally{o()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,i)=>$f(r(n,i))},Wf=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:o}=e;if(t)i=G(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ct(21));return Gu(o,"options.listener"),{predicate:i,type:t,effect:o}},Kf=Ln(e=>{let{type:t,predicate:r,effect:n}=Wf(e);return{id:ro(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ct(22))}}},{withTypes:()=>Kf}),Df=(e,t)=>{let{type:r,effect:n,predicate:i}=Wf(t);return Array.from(e.values()).find(o=>(typeof r=="string"?o.type===r:o.predicate===i)&&o.effect===n)},Vu=e=>{e.pending.forEach(t=>{t.abort(Uu)})},kw=(e,t)=>()=>{for(let r of t.keys())Vu(r);e.clear()},Mf=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Yf=Ln(G(`${Is}/add`),{withTypes:()=>Yf}),Ow=G(`${Is}/removeAll`),Xf=Ln(G(`${Is}/remove`),{withTypes:()=>Xf}),Pw=(...e)=>{console.error(`${Is}/error`,...e)},Jf=(e={})=>{let t=new Map,r=new Map,n=g=>{let y=r.get(g)??0;r.set(g,y+1)},i=g=>{let y=r.get(g)??1;y===1?r.delete(g):r.set(g,y-1)},{extra:o,onError:s=Pw}=e;Gu(s,"onError");let a=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&Vu(g)}),c=g=>{let y=Df(t,g)??Kf(g);return a(y)};Ln(c,{withTypes:()=>c});let u=g=>{let y=Df(t,g);return y&&(y.unsubscribe(),g.cancelActive&&Vu(y)),!!y};Ln(u,{withTypes:()=>u});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,y,C,x){let E=new l.AbortController,_=_w(c,E.signal),I=[];try{g.pending.add(E),n(g),yield Promise.resolve(g.effect(y,Ln({},C,{getOriginalState:x,condition:(k,T)=>_(k,T).then(Boolean),take:_,delay:zf(E.signal),pause:ws(E.signal),extra:o,signal:E.signal,fork:Tw(E.signal,I),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((k,T,F)=>{k!==E&&(k.abort(Uu),F.delete(k))})},cancel:()=>{E.abort(Uu),g.pending.delete(E)},throwIfCancelled:()=>{Qr(E.signal)}})))}catch(k){k instanceof Rs||Mf(s,k,{raisedBy:"effect"})}finally{yield Promise.all(I),E.abort(Rw),i(g),g.pending.delete(E)}});return function h(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),v=kw(t,r);return{middleware:g=>y=>C=>{if(!Li(C))return y(C);if(Yf.match(C))return c(C.payload);if(Ow.match(C)){v();return}if(Xf.match(C))return u(C.payload);let x=g.getState(),E=()=>{if(x===Ff)throw new Error(ct(23));return x},_;try{if(_=y(C),t.size>0){let I=g.getState(),k=Array.from(t.values());for(let T of k){let F=!1;try{F=T.predicate(C,I,x)}catch(V){F=!1,Mf(s,V,{raisedBy:"predicate"})}F&&h(T,C,g,E)}}}finally{x=Ff}return _},startListening:c,stopListening:u,clearListeners:v}};function ct(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var te=new ee({required:!0,emptyAllowed:!1}),$e=new ee({required:!1,emptyAllowed:!1}),Pt=new ee({required:!0,emptyAllowed:!0}),TF=new ee({required:!1,emptyAllowed:!0}),Zf=new Ot({each:te,required:!0}),em=new ee({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),tm=new ee({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),_F=new ee({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Nw=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),$u=(e,t)=>{if("required"in t)return{payload:new kt({value:t}).validate({value:e}).value};let i=new Ee({options:{required:!0},values:t}).validate(e);if(i)throw new vu(i);return{payload:e}},K=(e,t)=>{try{return $u(e,t)}catch(r){return{payload:e,error:Nw(r)}}};var Ts=(e,t,r,n)=>{let i=`Check the options of ${n}`;return Fw(e,t,r,i,"Controller initialization error")},Fw=(e,t,r,n,i)=>{try{return t.validate(r,n)}catch(o){throw e.logger.error(o,i),o}};var _s=G("caseAssistConfiguration/set",e=>K(e,{caseAssistId:te,locale:$e,proxyBaseUrl:new ee({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var rm=()=>({caseAssistId:"",locale:"en-US"});var hr=Ge(rm(),e=>{e.addCase(_s,(t,r)=>{t.caseAssistId=r.payload.caseAssistId,t.locale=r.payload.locale,t.apiBaseUrl=r.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var nm={q:new ee,enableQuerySyntax:new je,aq:new ee,cq:new ee,firstResult:new Ve({min:0}),numberOfResults:new Ve({min:0}),sortCriteria:new ee,f:new Ee,fExcluded:new Ee,cf:new Ee,nf:new Ee,mnf:new Ee,df:new Ee,debug:new je,sf:new Ee,tab:new ee,af:new Ee};var ks=G("searchParameters/restore",e=>K(e,nm)),im=G("searchParameters/restoreTab",e=>K(e,te));m();d();f();p();var om=G("debug/enable"),sm=G("debug/disable");m();d();f();p();var Os=()=>!1;var am=Ge(Os(),e=>{e.addCase(om,()=>!0).addCase(sm,()=>!1).addCase(ks,(t,r)=>r.payload.debug??t)});m();d();f();p();var Ps=G("searchHub/set",e=>K(e,new ee({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Vn="3.49.1",cm=["@coveo/atomic","@coveo/quantic"];var Qu=()=>$e,um=()=>te,Bn=G("configuration/updateBasicConfiguration",e=>K(e,{accessToken:$e,environment:new ee({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:$e})),Ns=G("configuration/updateSearchConfiguration",e=>K(e,{proxyBaseUrl:new ee({required:!1,url:!0}),pipeline:new ee({required:!1,emptyAllowed:!0}),searchHub:$e,timezone:$e,locale:$e,authenticationProviders:new Ot({required:!1,each:te})})),Dw={enabled:new je({default:!0}),originContext:Qu(),originLevel2:Qu(),originLevel3:Qu(),proxyBaseUrl:new ee({required:!1,url:!0}),runtimeEnvironment:new qr,anonymous:new je({default:!1}),deviceId:$e,userDisplayName:$e,documentLocation:$e,trackingId:tm,analyticsMode:new ee({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Ee({options:{required:!1},values:cm.reduce((e,t)=>(e[t]=em,e),{})})},Fs=G("configuration/updateAnalyticsConfiguration",e=>K(e,Dw)),Ds=G("configuration/analytics/disable"),Ms=G("configuration/analytics/enable"),lm=G("configuration/analytics/originlevel2",e=>K(e,{originLevel2:um()})),dm=G("configuration/analytics/originlevel3",e=>K(e,{originLevel3:um()})),pm=G("knowledge/setAgentId",e=>K(e,new ee({required:!0})));m();d();f();p();var Mw=G("history/undo"),jw=G("history/redo"),Ut=G("history/snapshot"),oM=Ae("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Mw()),yield t(js())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),sM=Ae("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(jw()),yield t(js())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),js=Ae("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Gn=()=>"default";var fm=Ge(Gn(),e=>{e.addCase(Ps,(t,r)=>r.payload).addCase(js.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ns,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function mm(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var gm=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Lw(e){return typeof e=="string"&&gm.test(e)}var Hu=Lw;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function hm(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var zu,qw=new Uint8Array(16);function Wu(){if(!zu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");zu=crypto.getRandomValues.bind(crypto)}return zu(qw)}m();d();f();p();m();d();f();p();var Uw=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ku={randomUUID:Uw};function Vw(e,t,r){e=e||{};let n=e.random??e.rng?.()??Wu();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return hm(n)}function Bw(e,t,r){return Ku.randomUUID&&!t&&!e?Ku.randomUUID():Vw(e,t,r)}var Yu=Bw;function Gw(_x17){return _Gw.apply(this,arguments)}function _Gw(){_Gw=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:i,token:o,mode:s}=e;if(s!=="disabled")return n.call(r),t.send(i,o,r)});return _Gw.apply(this,arguments)}var wm="2.1.1",Xu=128,Cm=192,ym=224,vm=240,$w=248;function Qw(e){return(e&$w)===vm?4:(e&vm)===ym?3:(e&ym)===Cm?2:1}function Hw(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Xu)!=Xu)break;if(r-=3,(n&Cm)!=Xu){t-r>=Qw(n)*3&&(r=t);break}}return e.substring(0,r)}function zw(e){let{trackingId:t}=e;return{trackingId:t}}function Ww(e){return(e.source||[]).concat([`relay@${wm}`])}function xm(e,t,r){let{getReferrer:n,getLocation:i,getUserAgent:o}=r,s=zw(t),a=r.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:Ww(t),clientId:a,userAgent:o(),referrer:Sm(n()),location:Sm(i())})}function Sm(e){return e!==null?Hw(e,1024):null}function Kw(e,t,r,n){return{...t,meta:xm(e,r,n)}}var Yw="*";function Xw(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>a(c.type,c.callback)}function i(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function o(c){if(c===Yw)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function s(c){let u=t(c);u>=0&&e.splice(u,1)}function a(c,u){u?s({type:c,callback:u}):o(c)}return{add:n,call:i,remove:a}}function Am({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function Jw(e){let t=Am(e);return{get:()=>t,update:r=>{t=Am({...t,...r})}}}var Ju=Zw();function Zw(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,i=document.cookie.split(";");for(let o of i){let s=o.replace(/^\s+/,"");if(s.lastIndexOf(n,0)===0)return s.substring(n.length,s.length)}return null},setItem(r,n,i){let o=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+i).toUTCString()}`,a=o?`;domain=${o}`:"";document.cookie=`${e}${r}=${n}${s}${a};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function eC(){return{getItem(e){return Ju.getItem(e)||localStorage.getItem(e)},removeItem(e){Ju.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Ju.setItem(e,t,31556952e3)}}}var bm="visitorId";function tC(){let e=document.referrer;return e===""?null:e}function Zu(){let e=eC();return{runtime:"browser",send:function(){var _ref10=_asyncToGenerator(function*(t,r,n){let i=b(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});mm().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let s=yield i;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let c of a.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});return function send(_x18,_x19,_x20){return _ref10.apply(this,arguments)}}(),getReferrer:()=>tC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(bm);if(t&&Hu(t))return t;let r=Yu();return e.setItem(bm,r),r}}}function rC(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function nC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function iC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=nC();return t&&r?{...r,runtime:"custom"}:t&&oC()&&rC()?Zu():n}function oC(){try{return typeof window=="object"}catch{return!1}}function sC(e){return{get:()=>Object.freeze(iC(e))}}function Em(e){let t=Jw(e),r=Xw(),n=sC(t);return{emit:function(){var _ref11=_asyncToGenerator(function*(i,o){let s=t.get(),a=n.get(),c=Kw(i,o,s,a);return Gw({config:s,environment:a,event:c,listenerManager:r})});return function emit(_x21,_x22){return _ref11.apply(this,arguments)}}(),getMeta:i=>xm(i,t.get(),n.get()),on:(i,o)=>r.add({type:i,callback:o}),off:(i,o)=>r.remove(i,o),updateConfig:i=>t.update(i),version:wm}}m();d();f();p();function Rm(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var $n=Fe(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Vn}`));var no=Fe(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>$n(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:i,enabled:o},s,a)=>{let c=cC(a);return Em({mode:o?"emit":"disabled",url:i??Xo(e,t),token:r,trackingId:n??null,source:s,environment:c})}),aC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref12=_asyncToGenerator(function*(){});return function send(){return _ref12.apply(this,arguments)}}()},cC=e=>{if(!e)return;let t=e();return{...(Rm()?Zu():aC),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var Im=class extends Error{constructor(t){super(t[0].message);Se(this,"issues");this.name="SchemaError",this.issues=t}};var or="uninitialized",rl="pending",oo="fulfilled",so="rejected";function Tm(e){return{status:e,isUninitialized:e===or,isLoading:e===rl,isSuccess:e===oo,isError:e===so}}var _m=Lt;function Gm(e,t){if(e===t||!(_m(e)&&_m(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),i=r.length===n.length,o=Array.isArray(t)?[]:{};for(let s of r)o[s]=Gm(e[s],t[s]),i&&(i=e[s]===o[s]);return i?e:o}function nl(e,t,r){return e.reduce((n,i,o)=>(t(i,o)&&n.push(r(i,o)),n),[]).flat()}function uC(e){return new RegExp("(^|:)//").test(e)}function lC(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function al(e){return e!=null}function km(e){return[...(e?.values()??[])].filter(al)}function dC(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var pC=e=>e.replace(/\/$/,""),fC=e=>e.replace(/^\//,"");function mC(e,t){if(!e)return t;if(!t)return e;if(uC(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=pC(e),t=fC(t),`${e}${r}${t}`}function Us(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var il=()=>new Map,gC=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},hC=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Om=(...e)=>b(...e),yC=e=>e.status>=200&&e.status<=299,vC=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Pm(e){if(!Lt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var SC=e=>typeof e=="object"&&(Lt(e)||Array.isArray(e)||typeof e.toJSON=="function");function $m({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Om,paramsSerializer:n,isJsonContentType:i=vC,jsonContentType:o="application/json",jsonReplacer:s,timeout:a,responseHandler:c,validateStatus:u,...h}={}){return typeof b>"u"&&r===Om&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(S,g,y){let{getState:C,extra:x,endpoint:E,forced:_,type:I}=g,k,{url:T,headers:F=new w(h.headers),params:V=void 0,responseHandler:L=c??"json",validateStatus:j=u??yC,timeout:U=a,...M}=typeof S=="string"?{url:S}:S,O={...h,signal:U?hC(g.signal,gC(U)):g.signal,...M};F=new w(Pm(F)),O.headers=(yield t(F,{getState:C,arg:S,extra:x,endpoint:E,forced:_,type:I,extraOptions:y}))||F;let P=SC(O.body);if(O.body!=null&&!P&&typeof O.body!="string"&&O.headers.delete("content-type"),!O.headers.has("content-type")&&P&&O.headers.set("content-type",o),P&&i(O.headers)&&(O.body=JSON.stringify(O.body,s)),O.headers.has("accept")||(L==="json"?O.headers.set("accept","application/json"):L==="text"&&O.headers.set("accept","text/plain, text/html, */*")),V){let J=~T.indexOf("?")?"&":"?",ie=n?n(V):new URLSearchParams(Pm(V));T+=J+ie}T=mC(e,T);let N=new Request(T,O);k={request:new Request(T,O)};let $;try{$=yield r(N)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:k}}let Y=$.clone();k.response=Y;let W,H="";try{let J;if(yield Promise.all([v($,L).then(ie=>W=ie,ie=>J=ie),Y.text().then(ie=>H=ie,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:$.status,data:H,error:String(J)},meta:k}}return j($,W)?{data:W,meta:k}:{error:{status:$.status,data:W},meta:k}});return function(_x23,_x24,_x25){return _ref13.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=i(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var Qn=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function AC(){return _AC.apply(this,arguments)}function _AC(){_AC=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),i=~~((Math.random()+.4)*(300<<n));yield new Promise((o,s)=>{let a=setTimeout(()=>o(),i);if(r){let c=()=>{clearTimeout(a),s(new Error("Aborted"))};r.aborted?(clearTimeout(a),s(new Error("Aborted"))):r.addEventListener("abort",c,{once:!0})}})});return _AC.apply(this,arguments)}function Qm(e,t){throw Object.assign(new Qn({error:e,meta:t}),{throwImmediately:!0})}function el(e){e.aborted&&Qm({status:"CUSTOM_ERROR",error:"Aborted"})}var Nm={},bC=(e,t)=>(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(r,n,i){let o=[5,(t||Nm).maxRetries,(i||Nm).maxRetries].filter(h=>h!==void 0),[s]=o.slice(-1),c={maxRetries:s,backoff:AC,retryCondition:(h,v,{attempt:S})=>S<=s,...t,...i},u=0;for(;;){el(n.signal);try{let h=yield e(r,n,i);if(h.error)throw new Qn(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof Qn)return h.value;throw h}if(h instanceof Qn){if(!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:i}))return h.value}else if(u>c.maxRetries)return{error:h};el(n.signal);try{yield c.backoff(u,c.maxRetries,n.signal)}catch(v){throw el(n.signal),v}}}});return function(_x28,_x29,_x30){return _ref14.apply(this,arguments)}}()),Hm=Object.assign(bC,{fail:Qm}),Bs="__rtkq/",wC="online",CC="offline";var zm="focused";var cl=G(`${Bs}${zm}`),Wm=G(`${Bs}un${zm}`),ul=G(`${Bs}${wC}`),Km=G(`${Bs}${CC}`);var uo="query",Ym="mutation",Xm="infinitequery";function Gs(e){return e.type===uo}function xC(e){return e.type===Ym}function $s(e){return e.type===Xm}function Vs(e){return Gs(e)||$s(e)}function ll(e,t,r,n,i,o){let s=EC(e)?e(t,r,n,i):e;return s?nl(s,al,a=>o(Jm(a))):[]}function EC(e){return typeof e=="function"}function Jm(e){return typeof e=="string"?{type:e}:e}function RC(e,t){return e.catch(t)}var Hn=(e,t)=>e.endpointDefinitions[t],ao=Symbol("forceQueryFn"),ol=e=>typeof e[ao]=="function";function IC({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o,getInternalState:s}){let a=T=>s(T)?.runningQueries,c=T=>s(T)?.runningMutations,{unsubscribeQueryResult:u,removeMutationResult:h,updateSubscriptionOptions:v}=i.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:I,buildInitiateMutation:k,getRunningQueryThunk:S,getRunningMutationThunk:g,getRunningQueriesThunk:y,getRunningMutationsThunk:C};function S(T,F){return V=>{let L=Hn(o,T),j=e({queryArgs:F,endpointDefinition:L,endpointName:T});return a(V)?.get(j)}}function g(T,F){return V=>c(V)?.get(F)}function y(){return T=>km(a(T))}function C(){return T=>km(c(T))}function x(T){}function E(T,F){let V=(L,{subscribe:j=!0,forceRefetch:U,subscriptionOptions:M,[ao]:O,...P}={})=>(N,Q)=>{let $=e({queryArgs:L,endpointDefinition:F,endpointName:T}),Y,W={...P,type:uo,subscribe:j,forceRefetch:U,subscriptionOptions:M,endpointName:T,originalArgs:L,queryCacheKey:$,[ao]:O};if(Gs(F))Y=t(W);else{let{direction:ue,initialPageParam:fe,refetchCachedPages:de}=P;Y=r({...W,direction:ue,initialPageParam:fe,refetchCachedPages:de})}let H=i.endpoints[T].select(L),J=N(Y),ie=H(Q());let{requestId:ve,abort:Oe}=J,xe=ie.requestId!==ve,Te=a(N)?.get($),_e=()=>H(Q()),le=Object.assign(O?J.then(_e):xe&&!Te?Promise.resolve(ie):Promise.all([Te,J]).then(_e),{arg:L,requestId:ve,subscriptionOptions:M,queryCacheKey:$,abort:Oe,unwrap(){return _asyncToGenerator(function*(){let ue=yield le;if(ue.isError)throw ue.error;return ue.data})()},refetch:ue=>N(V(L,{subscribe:!1,forceRefetch:!0,...ue})),unsubscribe(){j&&N(u({queryCacheKey:$,requestId:ve}))},updateSubscriptionOptions(ue){le.subscriptionOptions=ue,N(v({endpointName:T,requestId:ve,queryCacheKey:$,options:ue}))}});if(!Te&&!xe&&!O){let ue=a(N);ue.set($,le),le.then(()=>{ue.delete($)})}return le};return V}function _(T,F){return E(T,F)}function I(T,F){return E(T,F)}function k(T){return(F,{track:V=!0,fixedCacheKey:L}={})=>(j,U)=>{let M=n({type:"mutation",endpointName:T,originalArgs:F,track:V,fixedCacheKey:L}),O=j(M);let{requestId:P,abort:N,unwrap:Q}=O,$=RC(O.unwrap().then(J=>({data:J})),J=>({error:J})),Y=()=>{j(h({requestId:P,fixedCacheKey:L}))},W=Object.assign($,{arg:O.arg,requestId:P,abort:N,unwrap:Q,reset:Y}),H=c(j);return H.set(P,W),W.then(()=>{H.delete(P)}),L&&(H.set(L,W),W.then(()=>{H.get(L)===W&&H.delete(L)})),W}}}var Zm=class extends Im{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}},Wr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Kr(_x31,_x32,_x33,_x34){return _Kr.apply(this,arguments)}function _Kr(){_Kr=_asyncToGenerator(function*(e,t,r,n){let i=yield e["~standard"].validate(t);if(i.issues)throw new Zm(i.issues,t,r,n);return i.value});return _Kr.apply(this,arguments)}function Fm(e){return e}var io=(e={})=>({...e,[Zi]:!0});function TC({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:s,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:u}){let h=(M,O,P,N)=>(Q,$)=>{let Y=r[M],W=n({queryArgs:O,endpointDefinition:Y,endpointName:M});if(Q(i.internalActions.queryResultPatched({queryCacheKey:W,patches:P})),!N)return;let H=i.endpoints[M].select(O)($()),J=ll(Y.providesTags,H.data,void 0,O,{},o);Q(i.internalActions.updateProvidedBy([{queryCacheKey:W,providedTags:J}]))};function v(M,O,P=0){let N=[O,...M];return P&&N.length>P?N.slice(0,-1):N}function S(M,O,P=0){let N=[...M,O];return P&&N.length>P?N.slice(1):N}let g=(M,O,P,N=!0)=>(Q,$)=>{let W=i.endpoints[M].select(O)($()),H={patches:[],inversePatches:[],undo:()=>Q(i.util.patchQueryData(M,O,H.inversePatches,N))};if(W.status===or)return H;let J;if("data"in W)if(at(W.data)){let[ie,ve,Oe]=ju(W.data,P);H.patches.push(...ve),H.inversePatches.push(...Oe),J=ie}else J=P(W.data),H.patches.push({op:"replace",path:[],value:J}),H.inversePatches.push({op:"replace",path:[],value:W.data});return H.patches.length===0||Q(i.util.patchQueryData(M,O,H.patches,N)),H},y=(M,O,P)=>N=>N(i.endpoints[M].initiate(O,{subscribe:!1,forceRefetch:!0,[ao]:()=>({data:P})})),C=(M,O)=>M.query&&M[O]?M[O]:Fm,x=/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(M,{signal:O,abort:P,rejectWithValue:N,fulfillWithValue:Q,dispatch:$,getState:Y,extra:W}){let H=r[M.endpointName],{metaSchema:J,skipSchemaValidation:ie=u}=H,ve=M.type===uo;try{let Oe=Fm,xe={signal:O,abort:P,dispatch:$,getState:Y,extra:W,endpoint:M.endpointName,type:M.type,forced:ve?E(M,Y()):void 0,queryCacheKey:ve?M.queryCacheKey:void 0},Te=ve?M[ao]:void 0,_e,le=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(fe,de,Ue,Qe){if(de==null&&fe.pages.length)return Promise.resolve({data:fe});let It={queryArg:M.originalArgs,pageParam:de},mt=yield ue(It),jt=Qe?v:S;return{data:{pages:jt(fe.pages,mt.data,Ue),pageParams:jt(fe.pageParams,de,Ue)},meta:mt.meta}});return function le(_x37,_x38,_x39,_x40){return _ref16.apply(this,arguments)}}();function ue(_x41){return _ue.apply(this,arguments)}function _ue(){_ue=_asyncToGenerator(function*(fe){let de,{extraOptions:Ue,argSchema:Qe,rawResponseSchema:It,responseSchema:mt}=H;if(Qe&&!Wr(ie,"arg")&&(fe=yield Kr(Qe,fe,"argSchema",{})),Te?de=Te():H.query?(Oe=C(H,"transformResponse"),de=yield t(H.query(fe),xe,Ue)):de=yield H.queryFn(fe,xe,Ue,Tt=>t(Tt,xe,Ue)),typeof process<"u",de.error)throw new Qn(de.error,de.meta);let{data:jt}=de;It&&!Wr(ie,"rawResponse")&&(jt=yield Kr(It,de.data,"rawResponseSchema",de.meta));let vt=yield Oe(jt,de.meta,fe);return mt&&!Wr(ie,"response")&&(vt=yield Kr(mt,vt,"responseSchema",de.meta)),{...de,data:vt}});return _ue.apply(this,arguments)}if(ve&&"infiniteQueryOptions"in H){let{infiniteQueryOptions:fe}=H,{maxPages:de=1/0}=fe,Ue=M.refetchCachedPages??fe.refetchCachedPages??!0,Qe,It={pages:[],pageParams:[]},mt=s.selectQueryEntry(Y(),M.queryCacheKey)?.data,vt=E(M,Y())&&!M.direction||!mt?It:mt;if("direction"in M&&M.direction&&vt.pages.length){let Tt=M.direction==="backward",Go=(Tt?eg:sl)(fe,vt,M.originalArgs);Qe=yield le(vt,Go,de,Tt)}else{let{initialPageParam:Tt=fe.initialPageParam}=M,_i=mt?.pageParams??[],Go=_i[0]??Tt,aA=_i.length;if(Qe=yield le(vt,Go,de),Te&&(Qe={data:Qe.data.pages[0]}),Ue)for(let Sp=1;Sp<aA;Sp++){let cA=sl(fe,Qe.data,M.originalArgs);Qe=yield le(Qe.data,cA,de)}}_e=Qe}else _e=yield ue(M.originalArgs);return J&&!Wr(ie,"meta")&&_e.meta&&(_e.meta=yield Kr(J,_e.meta,"metaSchema",_e.meta)),Q(_e.data,io({fulfilledTimeStamp:Date.now(),baseQueryMeta:_e.meta}))}catch(Oe){let xe=Oe;if(xe instanceof Qn){let Te=C(H,"transformErrorResponse"),{rawErrorResponseSchema:_e,errorResponseSchema:le}=H,{value:ue,meta:fe}=xe;try{_e&&!Wr(ie,"rawErrorResponse")&&(ue=yield Kr(_e,ue,"rawErrorResponseSchema",fe)),J&&!Wr(ie,"meta")&&(fe=yield Kr(J,fe,"metaSchema",fe));let de=yield Te(ue,fe,M.originalArgs);return le&&!Wr(ie,"errorResponse")&&(de=yield Kr(le,de,"errorResponseSchema",fe)),N(de,io({baseQueryMeta:fe}))}catch(de){xe=de}}try{if(xe instanceof Zm){let Te={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:ve?M.queryCacheKey:void 0};H.onSchemaFailure?.(xe,Te),a?.(xe,Te);let{catchSchemaFailure:_e=c}=H;if(_e)return N(_e(xe,Te),io({baseQueryMeta:xe._bqMeta}))}}catch(Te){xe=Te}throw typeof process<"u",console.error(xe),xe}});return function x(_x35,_x36){return _ref15.apply(this,arguments)}}();function E(M,O){let P=s.selectQueryEntry(O,M.queryCacheKey),N=s.selectConfig(O).refetchOnMountOrArgChange,Q=P?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&N);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let _=()=>Ae(`${e}/executeQuery`,x,{getPendingMeta({arg:O}){let P=r[O.endpointName];return io({startedTimeStamp:Date.now(),...($s(P)?{direction:O.direction}:{})})},condition(O,{getState:P}){let N=P(),Q=s.selectQueryEntry(N,O.queryCacheKey),$=Q?.fulfilledTimeStamp,Y=O.originalArgs,W=Q?.originalArgs,H=r[O.endpointName],J=O.direction;return ol(O)?!0:Q?.status==="pending"?!1:E(O,N)||Gs(H)&&H?.forceRefetch?.({currentArg:Y,previousArg:W,endpointState:Q,state:N})?!0:!($&&!J)},dispatchConditionRejection:!0}),I=_(),k=_(),T=Ae(`${e}/executeMutation`,x,{getPendingMeta(){return io({startedTimeStamp:Date.now()})}}),F=M=>"force"in M,V=M=>"ifOlderThan"in M,L=(M,O,P={})=>(N,Q)=>{let $=F(P)&&P.force,Y=V(P)&&P.ifOlderThan,W=(J=!0)=>{let ie={forceRefetch:J,subscribe:!1};return i.endpoints[M].initiate(O,ie)},H=i.endpoints[M].select(O)(Q());if($)N(W());else if(Y){let J=H?.fulfilledTimeStamp;if(!J){N(W());return}(Number(new Date)-Number(new Date(J)))/1e3>=Y&&N(W())}else N(W(!1))};function j(M){return O=>O?.meta?.arg?.endpointName===M}function U(M,O){return{matchPending:qn(xs(M),j(O)),matchFulfilled:qn(nr(M),j(O)),matchRejected:qn(Hr(M),j(O))}}return{queryThunk:I,mutationThunk:T,infiniteQueryThunk:k,prefetch:L,updateQueryData:g,upsertQueryData:y,patchQueryData:h,buildMatchThunkActions:U}}function sl(e,{pages:t,pageParams:r},n){let i=t.length-1;return e.getNextPageParam(t[i],t,r[i],r,n)}function eg(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function tg(e,t,r,n){return ll(r[e.meta.arg.endpointName][t],nr(e)?e.payload:void 0,to(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Dm(e){return st(e)?ys(e):e}function Ls(e,t,r){let n=e[t];n&&r(n)}function co(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Mm(e,t,r){let n=e[co(t)];n&&r(n)}var qs={};function _C({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:c,config:u}){let h=G(`${e}/resetApiState`);function v(j,U,M,O){var P;j[P=U.queryCacheKey]??(j[P]={status:or,endpointName:U.endpointName}),Ls(j,U.queryCacheKey,N=>{N.status=rl,N.requestId=M&&N.requestId?N.requestId:O.requestId,U.originalArgs!==void 0&&(N.originalArgs=U.originalArgs),N.startedTimeStamp=O.startedTimeStamp;let Q=i[O.arg.endpointName];$s(Q)&&"direction"in U&&(N.direction=U.direction)})}function S(j,U,M,O){Ls(j,U.arg.queryCacheKey,P=>{if(P.requestId!==U.requestId&&!O)return;let{merge:N}=i[U.arg.endpointName];if(P.status=oo,N){if(P.data!==void 0){let{fulfilledTimeStamp:Q,arg:$,baseQueryMeta:Y,requestId:W}=U,H=$r(P.data,J=>N(J,M,{arg:$.originalArgs,baseQueryMeta:Y,fulfilledTimeStamp:Q,requestId:W}));P.data=H}else P.data=M;}else P.data=i[U.arg.endpointName].structuralSharing??!0?Gm(st(P.data)?yf(P.data):P.data,M):M;delete P.error,P.fulfilledTimeStamp=U.fulfilledTimeStamp})}let g=zr({name:`${e}/queries`,initialState:qs,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:U}}){delete j[U]},prepare:Un()},cacheEntriesUpserted:{reducer(j,U){for(let M of U.payload){let{queryDescription:O,value:P}=M;v(j,O,!0,{arg:O,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),S(j,{arg:O,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},P,!0)}},prepare:j=>({payload:j.map(O=>{let{endpointName:P,arg:N,value:Q}=O,$=i[P];return{queryDescription:{type:uo,endpointName:P,originalArgs:O.arg,queryCacheKey:n({queryArgs:N,endpointDefinition:$,endpointName:P})},value:Q}}),meta:{[Zi]:!0,requestId:ro(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:U,patches:M}}){Ls(j,U,O=>{O.data=Lu(O.data,M.concat())})},prepare:Un()}},extraReducers(j){j.addCase(t.pending,(U,{meta:M,meta:{arg:O}})=>{let P=ol(O);v(U,O,P,M)}).addCase(t.fulfilled,(U,{meta:M,payload:O})=>{let P=ol(M.arg);S(U,M,O,P)}).addCase(t.rejected,(U,{meta:{condition:M,arg:O,requestId:P},error:N,payload:Q})=>{Ls(U,O.queryCacheKey,$=>{if(!M){if($.requestId!==P)return;$.status=so,$.error=Q??N}})}).addMatcher(a,(U,M)=>{let{queries:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===oo||N?.status===so)&&(U[P]=N)})}}),y=zr({name:`${e}/mutations`,initialState:qs,reducers:{removeMutationResult:{reducer(j,{payload:U}){let M=co(U);M in j&&delete j[M]},prepare:Un()}},extraReducers(j){j.addCase(r.pending,(U,{meta:M,meta:{requestId:O,arg:P,startedTimeStamp:N}})=>{P.track&&(U[co(M)]={requestId:O,status:rl,endpointName:P.endpointName,startedTimeStamp:N})}).addCase(r.fulfilled,(U,{payload:M,meta:O})=>{O.arg.track&&Mm(U,O,P=>{P.requestId===O.requestId&&(P.status=oo,P.data=M,P.fulfilledTimeStamp=O.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:M,error:O,meta:P})=>{P.arg.track&&Mm(U,P,N=>{N.requestId===P.requestId&&(N.status=so,N.error=M??O)})}).addMatcher(a,(U,M)=>{let{mutations:O}=s(M);for(let[P,N]of Object.entries(O))(N?.status===oo||N?.status===so)&&P!==N?.requestId&&(U[P]=N)})}}),C={tags:{},keys:{}},x=zr({name:`${e}/invalidation`,initialState:C,reducers:{updateProvidedBy:{reducer(j,U){var M,O,P;for(let{queryCacheKey:N,providedTags:Q}of U.payload){E(j,N);for(let{type:$,id:Y}of Q){let W=(O=(M=j.tags)[$]??(M[$]={}))[P=Y||"__internal_without_id"]??(O[P]=[]);W.includes(N)||W.push(N)}j.keys[N]=Q}},prepare:Un()}},extraReducers(j){j.addCase(g.actions.removeQueryResult,(U,{payload:{queryCacheKey:M}})=>{E(U,M)}).addMatcher(a,(U,M)=>{var P,N,Q;let{provided:O}=s(M);for(let[$,Y]of Object.entries(O.tags??{}))for(let[W,H]of Object.entries(Y)){let J=(N=(P=U.tags)[$]??(P[$]={}))[Q=W||"__internal_without_id"]??(N[Q]=[]);for(let ie of H)J.includes(ie)||J.push(ie),U.keys[ie]=O.keys[ie]}}).addMatcher(qt(nr(t),to(t)),(U,M)=>{_(U,[M])}).addMatcher(g.actions.cacheEntriesUpserted.match,(U,M)=>{let O=M.payload.map(({queryDescription:P,value:N})=>({type:"UNKNOWN",payload:N,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:P}}));_(U,O)})}});function E(j,U){let M=Dm(j.keys[U]??[]);for(let O of M){let P=O.type,N=O.id??"__internal_without_id",Q=j.tags[P]?.[N];Q&&(j.tags[P][N]=Dm(Q).filter($=>$!==U))}delete j.keys[U]}function _(j,U){let M=U.map(O=>{let P=tg(O,"providesTags",i,c),{queryCacheKey:N}=O.meta.arg;return{queryCacheKey:N,providedTags:P}});x.caseReducers.updateProvidedBy(j,x.actions.updateProvidedBy(M))}let I=zr({name:`${e}/subscriptions`,initialState:qs,reducers:{updateSubscriptionOptions(j,U){},unsubscribeQueryResult(j,U){},internal_getRTKQSubscriptions(){}}}),k=zr({name:`${e}/internalSubscriptions`,initialState:qs,reducers:{subscriptionsUpdated:{reducer(j,U){return Lu(j,U.payload)},prepare:Un()}}}),T=zr({name:`${e}/config`,initialState:{online:dC(),focused:lC(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(j,{payload:U}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||o!==U?"conflict":!0}},extraReducers:j=>{j.addCase(ul,U=>{U.online=!0}).addCase(Km,U=>{U.online=!1}).addCase(cl,U=>{U.focused=!0}).addCase(Wm,U=>{U.focused=!1}).addMatcher(a,U=>({...U}))}}),F=Mn({queries:g.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:k.reducer,config:T.reducer}),V=(j,U)=>F(h.match(U)?void 0:j,U),L={...T.actions,...g.actions,...I.actions,...k.actions,...y.actions,...x.actions,resetApiState:h};return{reducer:V,actions:L}}var tl=Symbol.for("RTKQ/skipToken"),rg={status:or},jm=$r(rg,()=>{}),Lm=$r(rg,()=>{});function kC({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>jm,i=I=>Lm;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:C,selectCachedArgsForQuery:x,selectApiState:s,selectQueries:a,selectMutations:u,selectQueryEntry:c,selectConfig:h};function o(I){return{...I,...Tm(I.status)}}function s(I){return I[t]}function a(I){return s(I)?.queries}function c(I,k){return a(I)?.[k]}function u(I){return s(I)?.mutations}function h(I){return s(I)?.config}function v(I,k,T){return F=>{if(F===tl)return r(n,T);let V=e({queryArgs:F,endpointDefinition:k,endpointName:I});return r(j=>c(j,V)??jm,T)}}function S(I,k){return v(I,k,o)}function g(I,k){let{infiniteQueryOptions:T}=k;function F(V){let L={...V,...Tm(V.status)},{isLoading:j,isError:U,direction:M}=L,O=M==="forward",P=M==="backward";return{...L,hasNextPage:E(T,L.data,L.originalArgs),hasPreviousPage:_(T,L.data,L.originalArgs),isFetchingNextPage:j&&O,isFetchingPreviousPage:j&&P,isFetchNextPageError:U&&O,isFetchPreviousPageError:U&&P}}return v(I,k,F)}function y(){return I=>{let k;return typeof I=="object"?k=co(I)??tl:k=I,r(k===tl?i:V=>s(V)?.mutations?.[k]??Lm,o)}}function C(I,k){let T=I[t],F=new Set,V=nl(k,al,Jm);for(let L of V){let j=T.provided.tags[L.type];if(!j)continue;let U=(L.id!==void 0?j[L.id]:Object.values(j).flat())??[];for(let M of U)F.add(M)}return Array.from(F.values()).flatMap(L=>{let j=T.queries[L];return j?{queryCacheKey:L,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function x(I,k){return nl(Object.values(a(I)),T=>T?.endpointName===k&&T.status!==or,T=>T.originalArgs)}function E(I,k,T){return k?sl(I,k,T)!=null:!1}function _(I,k,T){return!k||!I.getPreviousPageParam?!1:eg(I,k,T)!=null}}var qm=WeakMap?new WeakMap:void 0,Um=({endpointName:e,queryArgs:t})=>{let r="",n=qm?.get(t);if(typeof n=="string")r=n;else{let i=JSON.stringify(t,(o,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Lt(s)?Object.keys(s).sort().reduce((a,c)=>(a[c]=s[c],a),{}):s,s));Lt(t)&&qm?.set(t,i),r=i}return`${e}(${r})`};function OC(...e){return function(r){let n=Xi(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=Um;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:Um({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},o={endpointDefinitions:{},batch(u){u()},apiUid:ro(),extractRehydrationInfo:n,hasRehydrationInfo:Xi(u=>n(u)!=null)},s={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)i.tagTypes.includes(v)||i.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(Hn(o,v)):Object.assign(Hn(o,v)||{},S);return s}},a=e.map(u=>u.init(s,i,o));function c(u){let h=u.endpoints({query:v=>({...v,type:uo}),mutation:v=>({...v,type:Ym}),infiniteQuery:v=>({...v,type:Xm})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in o.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(ct(39));typeof process<"u";continue}typeof process<"u",o.endpointDefinitions[v]=S;for(let g of a)g.injectEndpoint(v,S)}return s}return s.injectEndpoints({endpoints:r.endpoints})}}function ir(e,...t){return Object.assign(e,...t)}var PC=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let i=`${e.reducerPath}/subscriptions`,o=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=e.internalActions,u=(C,x)=>{if(a.match(x)){let{queryCacheKey:_,requestId:I,options:k}=x.payload,T=C.get(_);return T?.has(I)&&T.set(I,k),!0}if(c.match(x)){let{queryCacheKey:_,requestId:I}=x.payload,k=C.get(_);return k&&k.delete(I),!0}if(e.internalActions.removeQueryResult.match(x))return C.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:_,requestId:I}}=x,k=Us(C,_.queryCacheKey,il);return _.subscribe&&k.set(I,_.subscriptionOptions??k.get(I)??{}),!0}let E=!1;if(t.rejected.match(x)){let{meta:{condition:_,arg:I,requestId:k}}=x;if(_&&I.subscribe){let T=Us(C,I.queryCacheKey,il);T.set(k,I.subscriptionOptions??T.get(k)??{}),E=!0}}return E},h=()=>r.currentSubscriptions,g={getSubscriptions:h,getSubscriptionCount:C=>h().get(C)?.size??0,isRequestSubscribed:(C,x)=>!!h()?.get(C)?.get(x)};function y(C){return JSON.parse(JSON.stringify(Object.fromEntries([...C].map(([x,E])=>[x,Object.fromEntries(E)]))))}return(C,x)=>{if(o||(o=y(r.currentSubscriptions)),e.util.resetApiState.match(C))return o={},r.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(C))return[!1,g];let E=u(r.currentSubscriptions,C),_=!0;if(E){s||(s=setTimeout(()=>{let T=y(r.currentSubscriptions),[,F]=ju(o,()=>T);x.next(e.internalActions.subscriptionsUpdated(F)),o=T,s=null},500));let I=typeof C.type=="string"&&!!C.type.startsWith(i),k=t.rejected.match(C)&&C.meta.condition&&!!C.meta.arg.subscribe;_=!I&&!k}return[_,!1]}},NC=2147483647/1e3-1,FC=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:i,selectors:{selectQueryEntry:o,selectConfig:s},getRunningQueryThunk:a,mwApi:c})=>{let{removeQueryResult:u,unsubscribeQueryResult:h,cacheEntriesUpserted:v}=t.internalActions,S=qt(h.match,r.fulfilled,r.rejected,v.match);function g(I){let k=i.currentSubscriptions.get(I);return k?k.size>0:!1}let y={};function C(I){for(let k of I.values())k?.abort?.()}let x=(I,k)=>{let T=k.getState(),F=s(T);if(S(I)){let V;if(v.match(I))V=I.payload.map(L=>L.queryDescription.queryCacheKey);else{let{queryCacheKey:L}=h.match(I)?I.payload:I.meta.arg;V=[L]}E(V,k,F)}if(t.util.resetApiState.match(I)){for(let[V,L]of Object.entries(y))L&&clearTimeout(L),delete y[V];C(i.runningQueries),C(i.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:V}=n.extractRehydrationInfo(I);E(Object.keys(V),k,F)}};function E(I,k,T){let F=k.getState();for(let V of I){let L=o(F,V);L?.endpointName&&_(V,L.endpointName,k,T)}}function _(I,k,T,F){let L=Hn(n,k)?.keepUnusedDataFor??F.keepUnusedDataFor;if(L===1/0)return;let j=Math.max(0,Math.min(L,NC));if(!g(I)){let U=y[I];U&&clearTimeout(U),y[I]=setTimeout(()=>{if(!g(I)){let M=o(T.getState(),I);M?.endpointName&&T.dispatch(a(M.endpointName,M.originalArgs))?.abort(),T.dispatch(u({queryCacheKey:I}))}delete y[I]},j*1e3)}}return x},Vm=new Error("Promise never resolved before cacheEntryRemoved."),DC=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let c=Es(n),u=Es(i),h=nr(n,i),v={},{removeQueryResult:S,removeMutationResult:g,cacheEntriesUpserted:y}=e.internalActions;function C(T,F,V){let L=v[T];L?.valueResolved&&(L.valueResolved({data:F,meta:V}),delete L.valueResolved)}function x(T){let F=v[T];F&&(delete v[T],F.cacheEntryRemoved())}function E(T){let{arg:F,requestId:V}=T.meta,{endpointName:L,originalArgs:j}=F;return[L,j,V]}let _=(T,F,V)=>{let L=I(T);function j(U,M,O,P){let N=s(V,M),Q=s(F.getState(),M);!N&&Q&&k(U,P,M,F,O)}if(n.pending.match(T)){let[U,M,O]=E(T);j(U,L,O,M)}else if(y.match(T))for(let{queryDescription:U,value:M}of T.payload){let{endpointName:O,originalArgs:P,queryCacheKey:N}=U;j(O,N,T.meta.requestId,P),C(N,M,{})}else if(i.pending.match(T)){if(F.getState()[t].mutations[L]){let[M,O,P]=E(T);k(M,O,L,F,P)}}else if(h(T))C(L,T.payload,T.meta.baseQueryMeta);else if(S.match(T)||g.match(T))x(L);else if(e.util.resetApiState.match(T))for(let U of Object.keys(v))x(U)};function I(T){return c(T)?T.meta.arg.queryCacheKey:u(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:S.match(T)?T.payload.queryCacheKey:g.match(T)?co(T.payload):""}function k(T,F,V,L,j){let U=Hn(r,T),M=U?.onCacheEntryAdded;if(!M)return;let O={},P=new Promise(H=>{O.cacheEntryRemoved=H}),N=Promise.race([new Promise(H=>{O.valueResolved=H}),P.then(()=>{throw Vm})]);N.catch(()=>{}),v[V]=O;let Q=e.endpoints[T].select(Vs(U)?F:V),$=L.dispatch((H,J,ie)=>ie),Y={...L,getCacheEntry:()=>Q(L.getState()),requestId:j,extra:$,updateCachedData:Vs(U)?H=>L.dispatch(e.util.updateQueryData(T,F,H)):void 0,cacheDataLoaded:N,cacheEntryRemoved:P},W=M(F,Y);Promise.resolve(W).catch(H=>{if(H!==Vm)throw H})}return _},MC=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},jC=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:i,api:o,assertTagType:s,refetchQuery:a,internalState:c})=>{let{removeQueryResult:u}=o.internalActions,h=qt(nr(n),to(n)),v=qt(nr(i,n),Hr(i,n)),S=[],g=0,y=(E,_)=>{(i.pending.match(E)||n.pending.match(E))&&g++,v(E)&&(g=Math.max(0,g-1)),h(E)?x(tg(E,"invalidatesTags",r,s),_):v(E)?x([],_):o.util.invalidateTags.match(E)&&x(ll(E.payload,void 0,void 0,void 0,void 0,s),_)};function C(){return g>0}function x(E,_){let I=_.getState(),k=I[e];if(S.push(...E),k.config.invalidationBehavior==="delayed"&&C())return;let T=S;if(S=[],T.length===0)return;let F=o.util.selectInvalidatedBy(I,T);t.batch(()=>{let V=Array.from(F.values());for(let{queryCacheKey:L}of V){let j=k.queries[L],U=Us(c.currentSubscriptions,L,il);j&&(U.size===0?_.dispatch(u({queryCacheKey:L})):j.status!==or&&_.dispatch(a(j)))}})}return y},LC=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:i})=>{let{currentPolls:o,currentSubscriptions:s}=i,a=new Set,c=null,u=(x,E)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&h(x.payload.queryCacheKey,E),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&h(x.meta.arg.queryCacheKey,E),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,E),r.util.resetApiState.match(x)&&(y(),c&&(clearTimeout(c),c=null),a.clear())};function h(x,E){a.add(x),c||(c=setTimeout(()=>{for(let _ of a)S({queryCacheKey:_},E);a.clear(),c=null},0))}function v({queryCacheKey:x},E){let _=E.getState()[e],I=_.queries[x],k=s.get(x);if(!I||I.status===or)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:F}=C(k);if(!Number.isFinite(T))return;let V=o.get(x);V?.timeout&&(clearTimeout(V.timeout),V.timeout=void 0);let L=Date.now()+T;o.set(x,{nextPollTimestamp:L,pollingInterval:T,timeout:setTimeout(()=>{(_.config.focused||!F)&&E.dispatch(n(I)),v({queryCacheKey:x},E)},T)})}function S({queryCacheKey:x},E){let I=E.getState()[e].queries[x],k=s.get(x);if(!I||I.status===or)return;let{lowestPollingInterval:T}=C(k);if(!Number.isFinite(T)){g(x);return}let F=o.get(x),V=Date.now()+T;(!F||V<F.nextPollTimestamp)&&v({queryCacheKey:x},E)}function g(x){let E=o.get(x);E?.timeout&&clearTimeout(E.timeout),o.delete(x)}function y(){for(let x of o.keys())g(x)}function C(x=new Map){let E=!1,_=Number.POSITIVE_INFINITY;for(let I of x.values())I.pollingInterval&&(_=Math.min(I.pollingInterval,_),E=I.skipPollingIfUnfocused||E);return{lowestPollingInterval:_,skipPollingIfUnfocused:E}}return u},qC=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let i=xs(r,n),o=Hr(r,n),s=nr(r,n),a={};return(u,h)=>{if(i(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=Hn(t,S),C=y?.onQueryStarted;if(C){let x={},E=new Promise((T,F)=>{x.resolve=T,x.reject=F});E.catch(()=>{}),a[v]=x;let _=e.endpoints[S].select(Vs(y)?g:v),I=h.dispatch((T,F,V)=>V),k={...h,getCacheEntry:()=>_(h.getState()),requestId:v,extra:I,updateCachedData:Vs(y)?T=>h.dispatch(e.util.updateQueryData(S,g,T)):void 0,queryFulfilled:E};C(g,k)}}else if(s(u)){let{requestId:v,baseQueryMeta:S}=u.meta;a[v]?.resolve({data:u.payload,meta:S}),delete a[v]}else if(o(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;a[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete a[v]}}},UC=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{let{removeQueryResult:o}=r.internalActions,s=(c,u)=>{cl.match(c)&&a(u,"refetchOnFocus"),ul.match(c)&&a(u,"refetchOnReconnect")};function a(c,u){let h=c.getState()[e],v=h.queries,S=i.currentSubscriptions;t.batch(()=>{for(let g of S.keys()){let y=v[g],C=S.get(g);if(!C||!y)continue;let x=[...C.values()];(x.some(_=>_[u]===!0)||x.every(_=>_[u]===void 0)&&h.config[u])&&(C.size===0?c.dispatch(o({queryCacheKey:g})):y.status!==or&&c.dispatch(n(y)))}})}return s};function VC(e){let{reducerPath:t,queryThunk:r,api:n,context:i,getInternalState:o}=e,{apiUid:s}=i,a={invalidateTags:G(`${t}/invalidateTags`)},c=S=>S.type.startsWith(`${t}/`),u=[MC,FC,jC,LC,DC,qC];return{middleware:S=>{let g=!1,y=o(S.dispatch),C={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:c,mwApi:S},x=u.map(I=>I(C)),E=PC(C),_=UC(C);return I=>k=>{if(!Li(k))return I(k);g||(g=!0,S.dispatch(n.internalActions.middlewareRegistered(s)));let T={...S,next:I},F=S.getState(),[V,L]=E(k,T,F),j;if(V?j=I(k):j=L,S.getState()[t]&&(_(k,T,F),c(k)||i.hasRehydrationInfo(k)))for(let U of x)U(k,T,F);return j}},actions:a};function v(S){return e.api.endpoints[S.endpointName].initiate(S.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Bm=Symbol(),BC=({createSelector:e=Fe}={})=>({name:Bm,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h,onSchemaFailure:v,catchSchemaFailure:S,skipSchemaValidation:g},y){xf();let C=le=>(typeof process<"u",le);Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:ul,onOffline:Km,onFocus:cl,onFocusLost:Wm},util:{}});let x=kC({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:E,selectCachedArgsForQuery:_,buildQuerySelector:I,buildInfiniteQuerySelector:k,buildMutationSelector:T}=x;ir(t.util,{selectInvalidatedBy:E,selectCachedArgsForQuery:_});let{queryThunk:F,infiniteQueryThunk:V,mutationThunk:L,patchQueryData:j,updateQueryData:U,upsertQueryData:M,prefetch:O,buildMatchThunkActions:P}=TC({baseQuery:r,reducerPath:i,context:y,api:t,serializeQueryArgs:o,assertTagType:C,selectors:x,onSchemaFailure:v,catchSchemaFailure:S,skipSchemaValidation:g}),{reducer:N,actions:Q}=_C({context:y,queryThunk:F,infiniteQueryThunk:V,mutationThunk:L,serializeQueryArgs:o,reducerPath:i,assertTagType:C,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:i,invalidationBehavior:h}});ir(t.util,{patchQueryData:j,updateQueryData:U,upsertQueryData:M,prefetch:O,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),ir(t.internalActions,Q);let $=new WeakMap,Y=le=>Us($,le,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:W,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:ie,getRunningMutationsThunk:ve,getRunningQueriesThunk:Oe,getRunningQueryThunk:xe}=IC({queryThunk:F,mutationThunk:L,infiniteQueryThunk:V,api:t,serializeQueryArgs:o,context:y,getInternalState:Y});ir(t.util,{getRunningMutationThunk:ie,getRunningMutationsThunk:ve,getRunningQueryThunk:xe,getRunningQueriesThunk:Oe});let{middleware:Te,actions:_e}=VC({reducerPath:i,context:y,queryThunk:F,mutationThunk:L,infiniteQueryThunk:V,api:t,assertTagType:C,selectors:x,getRunningQueryThunk:xe,getInternalState:Y});return ir(t.util,_e),ir(t,{reducer:N,middleware:Te}),{name:Bm,injectEndpoint(le,ue){var Ue;let de=(Ue=t.endpoints)[le]??(Ue[le]={});Gs(ue)&&ir(de,{name:le,select:I(le,ue),initiate:W(le,ue)},P(F,le)),xC(ue)&&ir(de,{name:le,select:T(),initiate:J(le)},P(L,le)),$s(ue)&&ir(de,{name:le,select:k(le,ue),initiate:H(le,ue)},P(F,le))}}}}),ng=OC(BC());m();d();f();p();m();d();f();p();var Yr=e=>e.query,ig=e=>e.query?.enableQuerySyntax;var wL=Fe(e=>Yr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,i)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:i})),GC=Fe(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function sr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function q(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}var ge;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ge||(ge={}));function fl(){return typeof window<"u"}function Rl(){return typeof navigator<"u"}function zn(){return typeof document<"u"}function ml(){try{return typeof localStorage<"u"}catch{return!1}}function $C(){try{return typeof sessionStorage<"u"}catch{return!1}}function vg(){return Rl()&&navigator.cookieEnabled}var QC=[ge.click,ge.custom,ge.search,ge.view],HC=(e,t)=>QC.indexOf(e)!==-1?Object.assign({language:zn()?document.documentElement.lang:"unknown",userAgent:Rl()?navigator.userAgent:"unknown"},t):t,po=class e{static set(t,r,n){var i,o,s,a;n&&(o=new Date,o.setTime(o.getTime()+n)),a=window.location.hostname,a.indexOf(".")===-1?og(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],og(t,r,o,i))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function og(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function zC(){return ml()?localStorage:vg()?new fo:$C()?sessionStorage:new Kn}var fo=class e{getItem(t){return po.get(`${e.prefix}${t}`)}removeItem(t){po.erase(`${e.prefix}${t}`)}setItem(t,r,n){po.set(`${e.prefix}${t}`,r,n)}};fo.prefix="coveo_";var gl=class{constructor(){this.cookieStorage=new fo}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},Kn=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Qs="__coveo.analytics.history",WC=20,KC=1e3*60,YC=75,Ws=class{constructor(t){this.store=t||zC()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return q(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Qs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Qs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Qs,JSON.stringify(t.slice(0,WC)))}catch{}}clear(){try{this.store.removeItem(Qs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,YC)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>KC:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var XC=(e,t)=>q(void 0,void 0,void 0,function*(){return e===ge.view?(yield JC(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),JC=e=>q(void 0,void 0,void 0,function*(){let t=new Ws,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Hs,ZC=new Uint8Array(16);function ex(){if(!Hs&&(Hs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hs(ZC)}var tx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ks(e){return typeof e=="string"&&tx.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Sg(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function rx(e){if(!Ks(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function nx(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var ix="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ox="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function sx(e,t,r){function n(i,o,s,a){var c;if(typeof i=="string"&&(i=nx(i)),typeof o=="string"&&(o=rx(o)),((c=o)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+i.length);if(u.set(o),u.set(i,o.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,s){a=a||0;for(let h=0;h<16;++h)s[a+h]=u[h];return s}return Sg(u)}try{n.name=e}catch{}return n.DNS=ix,n.URL=ox,n}var ax=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),sg={randomUUID:ax};function Xr(e,t,r){if(sg.randomUUID&&!t&&!e)return sg.randomUUID();e=e||{};let n=e.random||(e.rng||ex)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Sg(n)}function cx(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function dl(e,t){return e<<t|e>>>32-t}function ux(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let s=0;s<i;++s){let a=new Uint32Array(16);for(let c=0;c<16;++c)a[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];o[s]=a}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let a=new Uint32Array(80);for(let g=0;g<16;++g)a[g]=o[s][g];for(let g=16;g<80;++g)a[g]=dl(a[g-3]^a[g-8]^a[g-14]^a[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),C=dl(c,5)+cx(y,u,h,v)+S+t[y]+a[g]>>>0;S=v,v=h,h=dl(u,30)>>>0,u=c,c=C}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var lx=sx("v5",80,ux),ag=lx,Ag="2.30.54",cg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,lo={pageview:"pageview",event:"event"},Ys=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},hl=class extends Ys{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=cg(window.location),this.lastReferrer=zn()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:zn()?document.title:"",encoding:zn()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},i={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},o),n),i),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:i,location:o}=this.getNextValues(t,r);this.lastReferrer=i,this.pageViewId=n,this.currentLocation=o,t===lo.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===lo.pageview?this.nextPageViewId:this.pageViewId,referrer:t===lo.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===lo.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=i=>i.replace(/^\/?(.*)$/,"/$1");return`${(i=>i.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return cg(window.location)}},yr=class e{constructor(t,r){if(!Ks(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(i=>new RegExp(i.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,i]=r;if(n.length!==32||isNaN(parseInt(i)))return null;let o=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Ks(o)?new e(o,Number.parseInt(i)*1e3):null}};yr.cvo_cid="cvo_cid";yr.expirationTime=120;var yl=class extends Ys{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return q(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(yr.cvo_cid,new yr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};yl.Id="link";var bt=Object.keys;function zs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var pl=128,bg=192,ug=224,lg=240;function dx(e){return(e&248)===lg?4:(e&lg)===ug?3:(e&ug)===bg?2:1}function px(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&pl)!=pl)break;if(r-=3,(n&bg)!=pl){t-r>=dx(n)*3&&(r=t);break}}return e.substring(0,r)}var vl={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},fx=bt(vl).map(e=>vl[e]),mx=[...fx].join("|"),gx=new RegExp(`^(${mx}$)`),hx={svcAction:"svc_action",svcActionData:"svc_action_data"},yx=e=>bt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=vl[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),vx=e=>gx.test(e),Sx=[vx],dg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},pg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},nt={action:"pa",list:"pal",listSource:"pls"},Xs={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Ax=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Sl={id:"quoteId",affiliation:"quoteAffiliation"},Al={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},bx={add:nt,bookmark_add:nt,bookmark_remove:nt,click:nt,checkout:nt,checkout_option:nt,detail:nt,impression:nt,remove:nt,refund:Object.assign(Object.assign({},nt),Xs),purchase:Object.assign(Object.assign({},nt),Xs),quickview:nt,quote:Object.assign(Object.assign({},nt),Sl),review:Object.assign(Object.assign({},nt),Al)},wx=bt(dg).map(e=>dg[e]),Cx=bt(pg).map(e=>pg[e]),xx=bt(nt).map(e=>nt[e]),Ex=bt(Xs).map(e=>Xs[e]),Rx=bt(Al).map(e=>Al[e]),Ix=bt(Sl).map(e=>Sl[e]),Tx=[...wx,"custom"].join("|"),_x=[...Cx,"custom"].join("|"),wg="(pr[0-9]+)",Cg="(il[0-9]+pi[0-9]+)",kx=new RegExp(`^${wg}(${Tx})$`),Ox=new RegExp(`^(${Cg}(${_x}))|(il[0-9]+nm)$`),Px=new RegExp(`^(${xx.join("|")})$`),Nx=new RegExp(`^(${Ex.join("|")})$`),Fx=new RegExp(`^${wg}custom$`),Dx=new RegExp(`^${Cg}custom$`),Mx=new RegExp(`^(${[...Ax,...Rx,...Ix].join("|")})$`),jx=e=>kx.test(e),Lx=e=>Ox.test(e),qx=e=>Px.test(e),Ux=e=>Nx.test(e),Vx=e=>Mx.test(e),Bx=[Lx,jx,qx,Ux,Vx],Gx=[Fx,Dx],$x={anonymizeIp:"aip"},Qx={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Hx={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},zx=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Wx=Object.assign(Object.assign(Object.assign(Object.assign({},$x),Qx),Hx),zx.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),bl=Object.assign(Object.assign({},Wx),hx),Kx=e=>{let t=!!e.action&&bx[e.action]||{};return bt(e).reduce((r,n)=>{let i=t[n]||bl[n]||n;return Object.assign(Object.assign({},r),{[i]:e[n]})},{})},Yx=bt(bl).map(e=>bl[e]),Xx=e=>Yx.indexOf(e)!==-1,Jx=e=>e==="custom",Zx=e=>[...Bx,...Sx,Xx,Jx].some(t=>t(e)),eE=e=>bt(e).reduce((t,r)=>{let n=tE(r);return n?Object.assign(Object.assign({},t),rE(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),tE=e=>{let t;return[...Gx].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},rE=(e,t)=>bt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),wl=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:i}=this.opts,o=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${o}`,r,i),c=this.encodeForEventType(t,a),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return q(this,void 0,void 0,function*(){let i=t,o=r;if(n){let s=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:a,body:c}=s;i=a||t;try{o=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:o,url:i}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return q(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,i=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",i?`visitorId=${i}`:"","discardVisitInfo=true"].filter(o=>!!o).join("&")})}isEventTypeLegacy(t){return[ge.click,ge.custom,ge.search,ge.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let i=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(i=`access_token=${encodeURIComponent(n)}&${i}`),i}},Cl=class{sendEvent(t,r){return q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){return Promise.resolve()})}},fg=A.fetch,Js=class{constructor(t){this.opts=t}sendEvent(t,r){return q(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:i,preprocessRequest:o}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${n}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},a),o?yield o(a,"analyticsFetch"):{}),{url:u}=c,h=sr(c,["url"]),v;try{v=yield fg(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&i.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield fg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ge.click,ge.custom,ge.search,ge.view].indexOf(t)!==-1}getVisitorIdParam(){return q(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},xl=class{constructor(t,r){ml()&&vg()?this.storage=new gl:ml()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Kn),this.client=new Js(t),this.beaconClient=new wl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:i,payload:o}of n)this.beaconClient.sendEvent(i,o)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},El=class{constructor(t,r){this.storage=r||new Kn,this.client=new Js(t)}getClientDependingOnEventType(t){return this.client}},Zs=class{constructor(){this.storage=new Kn,this.client=new Cl}getClientDependingOnEventType(t){return this.client}},nE="xx",iE=e=>e?.startsWith(nE)||!1,oE=`
27
27
  We've detected you're using React Native but have not provided the corresponding runtime,
28
28
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
29
29
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
30
- `;function sE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var aE=["1",1,"yes",!0];function ea(){let e=[];return fl()&&e.push(window.doNotTrack),Rl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>aE.indexOf(t)!==-1)}var xg="v15",Eg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function cE(e=Eg.default,t=xg,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var uE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Vt=class{get defaultOptions(){return{endpoint:Eg.default,isCustomEndpoint:!1,token:"",version:xg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Ag}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[XC,HC].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};ea()?this.runtime=new Zs:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ge.view,{newEventType:ge.view,addClientIdParameter:!0}),this.addEventTypeMapping(ge.click,{newEventType:ge.click,addClientIdParameter:!0}),this.addEventTypeMapping(ge.custom,{newEventType:ge.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ge.search,{newEventType:ge.search,addClientIdParameter:!0})}initRuntime(t){return fl()&&zn()?new xl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(sE()&&console.warn(oE),new El(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return fl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(Ks(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ag(t,ag(r,uE)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(ea())return null;try{let r=new URL(t).searchParams.get(yr.cvo_cid);if(r==null)return null;let n=yr.fromString(r);return!n||!zn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:o=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:i?yield this.getCurrentVisitorId():""})}),g=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>o?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,C)=>q(this,void 0,void 0,function*(){let x=yield y;return yield C(t,x)}),g)].reduce((g,y)=>q(this,void 0,void 0,function*(){let C=yield g;return yield y(C)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?Kx(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>q(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return q(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},i=yield this.resolveParameters(t,...r),o=yield this.resolvePayloadForParameters(t,i);return{eventType:n,payload:o,log:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},o),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},i),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Ws().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=sr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=sr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=sr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield b(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(this,void 0,void 0,function*(){return yield(yield b(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let i=0,o=r.length;i<o;i++){let s=r[i];if(typeof s=="string")n[t[i]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ge.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=i=>typeof i<"u"&&i!==null&&i!=="";return Object.keys(t).filter(i=>this.isKeyAllowedEmpty(r,i)||n(t[i])).reduce((i,o)=>Object.assign(Object.assign({},i),{[o]:t[o]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(Zx(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,i)=>Object.assign(Object.assign({},n),{[i]:t[i]}),{})}processCustomParameters(t){let{custom:r}=t,n=sr(t,["custom"]),i={};r&&zs(r)&&(i=this.lowercaseKeys(r));let o=eE(n);return Object.assign(Object.assign({},i),o)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=sr(t,["custom"]);if(r&&zs(r)){let i=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},i),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(i=>{n[i.toLowerCase()]=t[i]}),n}validateParams(t,r){let{anonymizeIp:n}=t,i=sr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(i.anonymizeIp=1),(r==ge.view||r==ge.click||r==ge.search||r==ge.custom)&&(i.originLevel3=this.limit(i.originLevel3,1024)),r==ge.view&&(i.location=this.limit(i.location,1024)),(r=="pageview"||r=="event")&&(i.referrer=this.limit(i.referrer,2048),i.location=this.limit(i.location,2048),i.page=this.limit(i.page,2048)),i}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=sr(t,["userId"]);return iE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=sr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&zs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&zs(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?px(t,r):t}get baseUrl(){return cE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},ar;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(ar||(ar={}));var B;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(B||(B={}));var mg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[ar.expandToFullUI]:"interface",[ar.openUserActions]:"User Actions",[ar.showPrecedingSessions]:"User Actions",[ar.showFollowingSessions]:"User Actions",[ar.clickViewedDocument]:"User Actions",[ar.clickPageView]:"User Actions",[ar.createArticle]:"createArticle"},Yn=class{constructor(){this.runtime=new Zs,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(ge.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ge.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ge.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ge.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Ag}};function lE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function dE(e){return e.map(t=>t.replace(/;/g,""))}function Rg(e){let r=e.join(";");return r.length<=256?r:Rg(e.slice(1))}var gg=e=>{let t=dE(e),r=lE(t);return Rg(r)};function hg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:gg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:gg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ta=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||ea();this.coveoAnalyticsClient=n?new Yn:new Vt(t)}disable(){this.coveoAnalyticsClient=new Yn}enable(){this.coveoAnalyticsClient=new Vt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(B.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(B.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(B.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(B.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(B.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(B.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(B.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(B.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(B.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(B.omniboxAnalytics,hg(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(B.omniboxFromLink,hg(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(B.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(B.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(B.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(B.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(B.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(B.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(B.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(B.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(B.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(B.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(B.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(B.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(B.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(B.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(B.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(B.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(B.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(B.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(B.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(B.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(B.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(B.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(B.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(B.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(B.showLessFoldedResults)}logShowLessFoldedResults(){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return q(this,arguments,void 0,function*(n,i,o=mg[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),i),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:o,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,i,o=mg[n]){return(yield this.makeCustomEvent(n,i,o)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),o=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),i=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(i,t),log:({searchUID:o})=>i.log({searchQueryUid:o})}})}makeClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){let o=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,i)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(this,void 0,void 0,function*(){var n,i;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(i=(n=this.provider).getGeneratedAnswerMetadata)===null||i===void 0?void 0:i.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Vt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(B.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(B.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(B.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(B.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(B.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(B.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(B.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(B.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(B.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(B.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(B.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ra=Object.assign({},lo),yg=Object.keys(ra).map(e=>ra[e]),Wn=class extends hl{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>yg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(yg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ra.pageview,{newEventType:ge.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ra.event,{newEventType:ge.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let i=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),o=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},o),i),r)}getTicketPayload(){return yx(this.ticket)}};Wn.Id="svc";var na;(function(e){e.click="click",e.flowStart="flowStart"})(na||(na={}));var At;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(At||(At={}));var ia;(function(e){e.quit="Quit",e.solved="Solved"})(ia||(ia={}));var oa=class{constructor(t,r){var n;this.options=t,this.provider=r;let i=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!ea();this.coveoAnalyticsClient=i?new Vt(t):new Yn,this.svc=new Wn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Yn,this.svc=new Wn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Vt(this.options),this.svc=new Wn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(At.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(At.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(At.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(At.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(At.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(At.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(At.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(At.caseCancelled,{reason:ia.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(At.caseSolved,{reason:ia.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(At.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",na.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",na.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){var r,n;let i=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:i,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Vt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,i,o;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel2(),originLevel3:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel3()}}logClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){var o,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{searchQueryUid:(s=(o=this.provider)===null||o===void 0?void 0:o.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var pE=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Jr=class{constructor(t){this.getState=t;Se(this,"state");this.state=t()}getLanguage(){return pE(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},i={};for(let[o,s]of Object.entries(n)){let a=`context_${o}`;i[a]=s}return r.analytics.analyticsMode==="legacy"&&(i.coveoHeadlessVersion=Vn),i}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Gn()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var Xn=e=>new Vt(e).getCurrentVisitorId(),mo=(e,t)=>typeof t=="function"?(...r)=>{let n=Mi(r[0]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,go=(e,t)=>(...r)=>{let n=Mi(r[1]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics hook. Returning original request."),n}};var ho=class extends Jr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Ig=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i=new ho(t)})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new oa({enableAnalytics:u,token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:mo(e,n),beforeSendHooks:[go(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function sa(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Tg(e){let{activeValue:t,ancestryMap:r}=gE(e);return t?hE(t,r):[]}function gE(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let i of n.children)r.set(i,n);t.unshift(...n.children)}return{}}function hE(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var yE=(e,t)=>e.categoryFacetSet[t]?.request;var Il=(e,t)=>{let r=yE(e,t);return Tg(r?.currentValues??[])};m();d();f();p();function aa(){return{}}m();d();f();p();function ca(){return{}}m();d();f();p();function ua(){return{}}m();d();f();p();function la(){return{}}function Tl(e){return{facetSet:e.facetSet??la(),categoryFacetSet:e.categoryFacetSet??aa(),dateFacetSet:e.dateFacetSet??ca(),numericFacetSet:e.numericFacetSet??ua(),automaticFacetSet:e.automaticFacetSet??sa()}}var _l=e=>{let t=[];return AE(e).forEach((r,n)=>{let i=TE(e,r.facetId),o=RE(r,n+1);if(SE(r)){if(!!!Il(e,r.facetId).length)return;t.push({...o,...xE(e,r.facetId),facetType:i,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=_g(s,a+1,i),u=vE(r)?kg(s):wE(s);t.push({...o,...c,...u})})}),bE(e).forEach((r,n)=>{let i=EE(r,n+1);r.values.forEach((o,s)=>{if(o.state==="idle")return;let a=_g(o,s+1,"specific"),c=kg(o);t.push({...i,...a,...c})})}),t},vE=e=>e.type==="specific",SE=e=>e.type==="hierarchical",AE=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),bE=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),_g=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),wE=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),kg=e=>({displayValue:e.value,value:e.value}),CE=(e,t)=>Il(e,t).map(n=>n.value).join(";"),xE=(e,t)=>{let n=CE(e,t);return{value:n,valuePosition:1,displayValue:n}},EE=(e,t)=>({title:Og(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),RE=(e,t)=>({title:Og(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Og=(e,t)=>`${e}_${t}`,IE=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,TE=(e,t)=>{let r=IE(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var kl=e=>e.configuration.search.locale,Pg=e=>e.configuration.search.timezone,Ng=e=>e.configuration.accessToken,Fg=e=>e.configuration.organizationId,Dg=e=>e.configuration.environment,da=e=>e.configuration?.knowledge?.agentId,Mg=e=>e.configuration.knowledge.debugAgentSession;var Zr=e=>{if(_E(e)||Ol(e))return e.generatedAnswer?.answerId;if(kE(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},_E=e=>"answer"in e&&"generatedAnswer"in e&&!se(e.generatedAnswer?.answerConfigurationId),Ol=e=>{let t=da(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},kE=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Pl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,OE=je(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));m();d();f();p();var Nt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function Nl(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Nl(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Nl(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var jg=(r=>(r.Ascending="ascending",r.Descending="descending",r))(jg||{}),Lg=(o=>(o.Relevancy="relevancy",o.QRE="qre",o.Date="date",o.Field="field",o.NoSort="nosort",o))(Lg||{}),Fl=e=>{if(tf(e))return e.map(t=>Fl(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},qg=()=>({by:"relevancy"});var GU=new Ee({values:{by:new Su({enum:Lg,required:!0}),order:new Su({enum:jg}),field:new ee}});function pa(){return Fl(qg())}m();d();f();p();m();d();f();p();m();d();f();p();var Jn=class e{static set(t,r,n){let i,o,s;n&&(o=new Date,o.setTime(o.getTime()+n));let a=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(a)||u.test(a)||a.indexOf(".")===-1?Dl(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],Dl(t,r,o,i))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let i=0;i<n.length;i++){let o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function Dl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();f();p();function PE(){return typeof navigator<"u"}function Ug(){try{return typeof localStorage<"u"}catch{return!1}}function Vg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Bg(){return!!(PE()&&navigator.cookieEnabled)}var Gg=null;function $g(){return Gg||(Ug()?localStorage:Bg()?new Ml:Vg()?sessionStorage:new jl)}var Zn=class Zn{getItem(t){return Jn.get(`${Zn.prefix}${t}`)}removeItem(t){Jn.erase(`${Zn.prefix}${t}`)}setItem(t,r,n){Jn.set(`${Zn.prefix}${t}`,r,n)}};Se(Zn,"prefix","coveo_");var Ml=Zn;var jl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var fa="__coveo.analytics.history",NE=20,FE=1e3*60,DE=75,en=class en{constructor(t){Se(this,"store");this.store=t||$g()}static getInstance(t){return en.instance||(en.instance=new en(t)),en.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!==null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(fa);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(fa);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(fa,JSON.stringify(t.slice(0,NE)))}catch{}}clear(){try{this.store.removeItem(fa)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,DE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>FE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};Se(en,"instance",null);var Ll=en,Gt=Ll;var yo=class yo extends Jr{constructor(){super(...arguments);Se(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return _l(Tl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||yo.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Bt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||yo.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),i=Zr(r);return i&&(n.generativeQuestionAnsweringId=i),n}getFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetValue:n,facetTitle:`${o}_${r}`}}getFacetClearAllMetadata(r){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetTitle:`${i}_${r}`}}getFacetUpdateSortMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,criteria:n,facetTitle:`${o}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${o}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??pa()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:o,categoryFacetPath:n,categoryFacetTitle:`${o}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let i=this.state.querySuggest?.[r],o=i.completions.map(u=>u.expression),s=i.partialQueries.length-1,a=i.partialQueries[s]||"",c=i.responseId;return{...this.getBaseMetadata(),suggestionRanking:o.indexOf(n),partialQuery:a,partialQueries:i.partialQueries.length>0?i.partialQueries:"",suggestions:o.length>0?o:"",querySuggestResponseId:c}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Nt().q}get responseTime(){return this.state.search?.duration||Bt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Bt().response.totalCountFiltered}};Se(yo,"fallbackPipelineName","default");var vr=yo,Qg=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new ta({token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:mo(e,n),beforeSendHooks:[go(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h},ql=()=>{let t=Gt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function Hg(e){let t=zg(e),r=[e,...t].filter(i=>i.parentResult).map(i=>i.parentResult);return $p([e,...t,...r],i=>i.uniqueId)}function zg(e){return e.childResults?e.childResults.flatMap(t=>[t,...zg(t)]):[]}m();d();f();p();var ma=()=>"";function Wg(e,t){return{...new vr(t).getBaseMetadata(),actionCause:e,type:e}}function ME(e){return Object.assign(e,{instantlyCallable:!0})}function jE(e,t){let r=o=>{let s=Ae(e,o);return ME(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(o,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c}){let{description:u,log:h}=yield t({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Kg=(e,t,r)=>{function n(...i){let o=i.length===1?{...i[0],__legacy__getBuilder:t(i[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:i[0],__legacy__getBuilder:t(i[1]),__legacy__provider:i[2],analyticsConfigurator:e,providerClass:r};return UE(o)}return n},LE=e=>e.configuration.analytics.analyticsMode==="legacy",qE=e=>e.configuration.analytics.analyticsMode==="next",UE=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:i,analyticsConfigurator:o,providerClass:s})=>(r??(r=a=>new s(a)),jE(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref21=_asyncToGenerator(function*({state:E}){for(let _ of v)yield _(E)});return function log(_x48){return _ref21.apply(this,arguments)}}()},g=a(),y=o({getState:a,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(a)}),C=yield t(y,a());S.description=C?.description,v.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(E){LE(E)&&(yield VE(C,r,E,h,y.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:x}=no(g);return v.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(E){if(qE(E)&&i&&n){let _=n(E);yield KE(x,i,_)}});return function(_x50){return _ref23.apply(this,arguments)}}()),S});return function(_x47){return _ref20.apply(this,arguments)}}()));function VE(_x51,_x52,_x53,_x54,_x55){return _VE.apply(this,arguments)}function _VE(){_VE=_asyncToGenerator(function*(e,t,r,n,i){t(()=>r);let o=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:i,response:o},"Analytics response")});return _VE.apply(this,arguments)}var BE=e=>r=>(n,i)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(o){r(n,i)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),it=Kg(e=>Qg({...e,provider:e.provider||new vr(e.getState)}),e=>e,vr),ht=Kg(Ig,BE("caseAssist"),ho);var Ul=(e,t)=>{let r=o=>o+(t.pagination?.firstResult??0),n=-1,i=t.search?.results;return n=Jg(e,i),n<0&&(n=WE(e,i)),n<0&&(n=0),GE(e,r(n),t)};function GE(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:HE(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:zE(e),queryPipeline:r.pipeline||ma()}}var Vl=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),Yg={urihash:new ee,sourcetype:new ee,permanentid:new ee},Xg={uniqueId:te,raw:new Ee({values:Yg}),title:te,uri:te,clickUri:te,rankingModifier:new ee({required:!1,emptyAllowed:!0})};function $E(e){return Object.assign({},...Object.keys(Yg).map(t=>({[t]:e[t]})))}function QE(e){return Object.assign({},...Object.keys(Xg).map(t=>({[t]:e[t]})),{raw:$E(e.raw)})}function HE(e){let t=e.raw.author;return se(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function zE(e){let t=e.raw.source;return se(t)?"unknown":t}var Bl=e=>new kt(Xg).validate(QE(e));function WE(e,t){for(let[r,n]of t.entries()){let i=Hg(n);if(Jg(e,i)!==-1)return r}return-1}function Jg(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function KE(_x57,_x58,_x59){return _KE.apply(this,arguments)}function _KE(){_KE=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _KE.apply(this,arguments)}m();d();f();p();var ei=(e,t,r,n)=>it({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(i,o)=>{let s=t??Zr(o),a=e?r??(!o.generatedAnswer?.answer||!o.generatedAnswer?.answer.length):void 0;return s?i.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:s,answerGenerated:e,answerTextIsEmpty:a,...(n&&{conversationId:n})}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:i=>({answerId:t??Zr(i)??"",answerGenerated:e??!1})}),ti=e=>it({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Zr(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var Zg=je(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:i}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(i&&{lq:i})}});m();d();f();p();var tn=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:$n(e)}});m();d();f();p();var eh=e=>e.context;m();d();f();p();var Gl=e=>e.pipeline;m();d();f();p();m();d();f();p();var So=_t(ga(),1),sh=_t(th(),1);m();d();f();p();var nh=_t(ga(),1),ih=_t(rh(),1);nh.default.extend(ih.default);var YE="YYYY/MM/DD@HH:mm:ss";function oh(e){return e.format(YE)}So.default.extend(sh.default);var XE=["past","now","next"],JE=["minute","hour","day","week","month","quarter","year"];function ZE(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,So.default)().subtract(r,n);case"next":return(0,So.default)().add(r,n);case"now":return(0,So.default)()}}function Yl(e){return oh(ZE(eR(e)))}function ah(e){return e.toLocaleLowerCase().split("-")}function Xl(e){let[t,r,n]=ah(e);if(t==="now")return!0;if(!XE.includes(t)||!JE.includes(n))return!1;let i=parseInt(r,10);return!(Number.isNaN(i)||i<=0)}function eR(e){let[t,r,n]=ah(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function ch(e){return e.type==="dateRange"}function uh(e){return`start${e}`}function lh(e){return`end${e}`}var Jl=()=>({dateFacetValueMap:{}});function tR(e,t,r){let n=e.start,i=e.end;return Xl(n)&&(n=Yl(n),r.dateFacetValueMap[t][uh(n)]=e.start),Xl(i)&&(i=Yl(i),r.dateFacetValueMap[t][lh(i)]=e.end),{...e,start:n,end:i}}function Zl(e,t){if(ch(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(i=>tR(i,r,t))}}return e}function Sr(e){let t=Jl();return{request:{...e,facets:e.facets?.map(n=>Zl(n,t))},mappings:t}}function rR(e,t,r){return{...e,start:r.dateFacetValueMap[t][uh(e.start)]||e.start,end:r.dateFacetValueMap[t][lh(e.end)]||e.end}}function nR(e,t){return e.facetId in t.dateFacetValueMap}function iR(e,t){return nR(e,t)?{...e,values:e.values.map(r=>rR(r,e.facetId,t))}:e}function ha(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>iR(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Ar(e){return Object.values(e).map(t=>t.request)}function ed(e,t){let r={};e.forEach(o=>{r[o.facetId]=o});let n=[];t.forEach(o=>{o in r&&(n.push(r[o]),delete r[o])});let i=Object.values(r);return[...n,...i]}function dh(e){return Ar(e).map(t=>{let n=t.currentValues.some(({state:i})=>i!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var td={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function oR(e){return Ar(e).map(t=>{let r=td[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function sR(e){return[...oR(e.facetSet??{}),...dh(e.numericFacetSet??{}),...dh(e.dateFacetSet??{}),...Ar(e.categoryFacetSet??{})]}function aR(e){return sR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ya(e){return ed(aR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var ph=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Xn(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(ql()&&{pageId:ql()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:$n(e)})}}});return function ph(_x60,_x61){return _ref25.apply(this,arguments)}}();var ri=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:Gt.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield ph(e.configuration.analytics,t))),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function ri(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var va=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,r)),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var fh=je(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i}));var br=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=nd(e),i=cR(e),o=uR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield ri(e,r):va(e,t,r);return Sr({...s,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(i.length&&{facets:i}),...(e.pagination&&{numberOfResults:rd(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function br(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function rd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function cR(e){return ed(dR(e),e.facetOrder??[])}function uR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(lR).filter(r=>r.currentValues.length>0):void 0}function lR(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function dR(e){return pR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function pR(e){return[...fR(e.facetSet??{}),...mh(e.numericFacetSet??{}),...mh(e.dateFacetSet??{}),...Ar(e.categoryFacetSet??{})]}function fR(e){return Ar(e).map(t=>{let r=td[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function mh(e){return Ar(e).map(t=>{let r=t.currentValues,n=r.some(({state:o})=>o!=="idle"),i=r.some(o=>o.previousState);return t.generateAutomaticRanges&&!n&&!i?{...t,currentValues:[]}:t})}function nd(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=fh(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}m();d();f();p();m();d();f();p();var bo=(e,t)=>{let r=e;return se(r[t])?se(e.raw[t])?null:e.raw[t]:r[t]},mR=e=>t=>e.every(r=>!se(bo(t,r))),gR=e=>t=>e.every(r=>se(bo(t,r))),hR=(e,t)=>r=>{let n=gh(e,r);return t.some(i=>n.some(o=>`${o}`.toLowerCase()===i.toLowerCase()))},yR=(e,t)=>r=>{let n=gh(e,r);return t.every(i=>n.every(o=>`${o}`.toLowerCase()!==i.toLowerCase()))},gh=(e,t)=>{let r=bo(t,e);return Gp(r)?r:[r]},hh={getResultProperty:bo,fieldsMustBeDefined:mR,fieldsMustNotBeDefined:gR,fieldMustMatch:hR,fieldMustNotMatch:yR};var id=je(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var od=e=>e.searchHub;m();d();f();p();var sd=je(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),sG=je(e=>e,e=>{let t=sd(e);return t&&e?e[t].expression:""});m();d();f();p();var yh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var vh=e=>e.excerptLength?.length;m();d();f();p();var Sh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Ah=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var bh=e=>e.sortCriteria;var wh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:qe(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function wh(_x67){return _ref28.apply(this,arguments)}}(),Ch=(e,t)=>{let r=Yr(e)?.q,{aq:n,cq:i,dq:o,lq:s}=SR(e),a=eh(e),c=tn(e.configuration.analytics,t,{actionCause:id(e)}),u=od(e),h=Gl(e),v=Pl(e)??[],S=Eh(e),g=sd(e.tabSet)||"default",y=kl(e),C=Pg(e),x=t.referrer||"",E=Sh(e),_=bh(e),I=vR(e),k=vh(e),T=Ah(e),F=yh(e);return{q:r,...(n&&{aq:n}),...(i&&{cq:i}),...(o&&{dq:o}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:ig(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:rd(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:C,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...I,...(T??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:_,...(E&&{facetOptions:E}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},xh=(e,t)=>{let r=Yr(e)?.q,n=Eh(e),i=tn(e.configuration.analytics,t,{actionCause:id(e)}),o=kl(e),s=od(e),a=Gl(e),c=Pl(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:c,...(s?.length&&{searchHub:s}),...(a?.length&&{pipeline:a}),...i,locale:o}},Eh=e=>ya(e)?.map(t=>Zl(t,Jl())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),vR=e=>({actionsHistory:e.configuration.analytics.enabled?Gt.getInstance().getHistory():[]}),SR=e=>{let t=Zg(e),r=nd(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Sa=["searching","thinking","answering"];function Aa(e){return e.toLowerCase()}m();d();f();p();var Rh=["text/plain","text/markdown"];var ni=new ee({required:!0}),Ih=new ee,ii=new Me({required:!0}),ad={id:ni,title:ni,uri:ni,permanentid:ni,clickUri:Ih},ba=new ee({required:!0,constrainTo:Rh}),Th=new ee({required:!0,constrainTo:Sa}),_h=e=>({...e,name:Aa(e.name)}),R$=G("generatedAnswer/setIsVisible",e=>K(e,ii)),wa=G("generatedAnswer/setAnswerId",e=>K(e,te)),I$=G("generatedAnswer/setAnswerGenerationMode",e=>K(e,new ee({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),T$=G("generatedAnswer/setIsEnabled",e=>K(e,ii)),Co=G("generatedAnswer/updateMessage",e=>K(e,{textDelta:ni})),xo=G("generatedAnswer/updateCitations",e=>K(e,{citations:new Ot({required:!0,each:new Ee({values:ad})})})),Eo=G("generatedAnswer/updateError",e=>K(e,{message:Ih,code:new Ve({min:0})})),Ca=G("generatedAnswer/resetAnswer"),_$=G("generatedAnswer/like"),k$=G("generatedAnswer/dislike"),O$=G("generatedAnswer/feedbackModal/open"),P$=G("generatedAnswer/expand"),N$=G("generatedAnswer/collapse"),F$=G("generatedAnswer/setId",e=>K(e,{id:new ee({required:!0})})),D$=G("generatedAnswer/feedbackModal/close"),M$=G("generatedAnswer/sendFeedback"),wr=G("generatedAnswer/setIsLoading",e=>K(e,ii)),wo=G("generatedAnswer/setIsStreaming",e=>K(e,ii)),Ro=G("generatedAnswer/setAnswerContentFormat",e=>K(e,ba)),j$=G("generatedAnswer/updateResponseFormat",e=>K(e,{contentFormat:new Ot({each:ba,default:["text/plain"]})})),L$=G("knowledge/updateAnswerConfigurationId",e=>K(e,ni)),q$=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>K(e,Zf)),cd=G("generatedAnswer/setIsAnswerGenerated",e=>K(e,ii)),Io=G("generatedAnswer/setCannotAnswer",e=>K(e,ii)),AR=G("generatedAnswer/setAnswerApiQueryParams",e=>K(e,new Ee({}))),kh=G("generatedAnswer/startStep",e=>K(_h(e),{name:Th,startedAt:new Ve({min:0,required:!0})})),Oh=G("generatedAnswer/finishStep",e=>K(_h(e),{name:Th,finishedAt:new Ve({min:0,required:!0})})),U$=Ae("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:i,getState:o}=t,{search:s}=o(),{queryExecuted:a}=s,{setAbortControllerRef:c}=e,u=yield wh(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let C=JSON.parse(y);n(Ro(C.contentFormat));break}case"genqa.messageType":n(Co(JSON.parse(y)));break;case"genqa.citationsType":n(xo(JSON.parse(y)));break;case"genqa.endOfStreamType":{let C=JSON.parse(y).answerGenerated,x=o().generatedAnswer.answerId,E=a.length!==0&&!C,_=C?!o().generatedAnswer.answer?.length:void 0;n(Io(E)),n(wo(!1)),n(cd(C)),n(ei(C,x,_)),n(ti());break}default:r.debug&&i.logger.warn(`Unknown payloadType: "${g}"`)}};n(wr(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=i.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(wr(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(Eo(g))},close:()=>{v(u)&&n(wo(!1))},resetAnswer:()=>{v(u)&&n(Ca())}});S?c(S):n(wr(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),V$=Ae("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:i}}){r(Ca());let o=t();if(o.generatedAnswer.answerConfigurationId){let s=Ch(o,n);r(AR(s)),yield r(Ph(s))}else i.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function Fh(_x72,_x73){return _Fh.apply(this,arguments)}function _Fh(){_Fh=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Fh.apply(this,arguments)}function Dh(e){let t,r,n,i=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=wR(t,s);let a=t.length,c=0;for(;r<a;){i&&(t[r]===10&&(c=++r),i=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:i=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===a?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function Mh(e,t,r){let n=Nh(),i=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=Nh();else if(a>0){let c=i.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),h=i.decode(s.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
31
- ${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":bR(h,n,t);break}}}}function bR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function wR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Nh(){return{data:"",event:"",id:"",retry:void 0}}var ud="text/event-stream",CR=1e3,jh="last-event-id";function Lh(){return typeof window<"u"}function qh(e,{signal:t,headers:r,onopen:n,onmessage:i,onclose:o,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=ud);let g;function y(){g?.abort(),document.hidden||k()}!a&&Lh()&&document.addEventListener("visibilitychange",y);let C=CR,x;function E(){Lh()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),g?.abort()}t?.addEventListener("abort",()=>{E(),h()});let _=c??b,I=n??xR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let T=yield _(e,{...u,headers:S,signal:g?.signal});yield I(T),yield Fh(T.body,Dh(Mh(F=>{F?S[jh]=F:delete S[jh]},F=>{C=F},i))),o?.(),E(),h()}catch(T){if(!g?.signal?.aborted)try{let F=s?.(T)??C;clearTimeout(x),x=setTimeout(k,F)}catch(F){E(),v(F)}}});return _k2.apply(this,arguments)}k()})}function xR(e){let t=e.headers.get("content-type");if(!t?.startsWith(ud))throw new Error(`Expected content-type to be ${ud}, Actual: ${t}`)}m();d();f();p();var ER=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:i,environment:o,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${i}`}};try{let u=qe(s,o);return{data:$m({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),b(S,g)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function ER(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),Uh=ng({reducerPath:"answer",baseQuery:Hm(ER,{maxRetries:3}),endpoints:()=>({})});var RR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},IR=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},TR=(e,t)=>{e.citations=t.citations},_R=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},kR=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},OR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&kR(t,n);let i=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":i.contentFormat&&(RR(t,i),r(Ro(i.contentFormat)));break;case"genqa.messageType":i.textDelta&&(IR(t,i),r(Co({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(TR(t,i),r(xo({citations:i.citations})));break;case"genqa.endOfStreamType":{_R(t,i);let o=t.answerId,s=i.answerGenerated??!1,a=s?!t.answer?.length:void 0;r(ei(s,o,a)),r(ti());break}}},PR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let i=`/rest/organizations/${t}`,o=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${i}/${o}/${r}/generate`},ld=Uh.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...i}=r;return`${t}(${JSON.stringify(i)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:i,dispatch:o}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=s,S=qe(u,h),g=PR(S,u,a.answerConfigurationId,c?.insightId);yield qh(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:b,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let C=y.headers.get("x-answer-id");C&&i(x=>{x.answerId=C,o(wa(C))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:y=>{i(C=>{OR(y,C,o)})},onerror:y=>{throw y},onclose:()=>{i(y=>{o(Io(!y.generated))})}})}).apply(this,arguments)}})})}),Ph=e=>ld.endpoints.getAnswer.initiate(e);m();d();f();p();var Vh=Ge(Vn,e=>e);m();d();f();p();function NR(e){let t=e.payload?.analyticsAction;return Bh(e)&&!se(t)}function Bh(e){return"type"in e}var Gh=e=>t=>r=>{let n;NR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let i=t(r);return Bh(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),i};m();d();f();p();m();d();f();p();m();d();f();p();var LQ=G("tab/register",e=>{let t=new Ee({values:{id:te,expression:Pt}});return K(e,t)}),$h=G("tab/updateActiveTab",e=>K(e,te));m();d();f();p();var xa=_t(ga(),1),zh=_t(Qh(),1),Wh=_t(Hh(),1);xa.default.extend(Wh.default);xa.default.extend(zh.default);var Kh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:xa.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var FR=/(^|; )Coveo-Pendragon=([^;]*)/,DR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Yh(){return typeof window>"u"?!1:FR.exec(document.cookie)?.pop()||null}function Xh(){return typeof window>"u"?!1:DR.test(document.cookie)}var Jh=Ge(Kh(),e=>e.addCase(Bn,(t,r)=>{MR(t,r.payload)}).addCase(Ns,(t,r)=>{jR(t,r.payload)}).addCase(Fs,(t,r)=>{LR(t,r.payload)}).addCase(Ds,t=>{t.analytics.enabled=!1}).addCase(Ms,t=>{t.analytics.enabled=!0}).addCase(lm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(dm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase($h,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(im,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ks,(t,r)=>{se(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(pm,(t,{payload:r})=>{qR(t,r)}));function MR(e,t){se(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",se(t.organizationId)||(e.organizationId=t.organizationId)}function jR(e,t){se(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),se(t.locale)||(e.search.locale=t.locale),se(t.timezone)||(e.search.timezone=t.timezone),se(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function LR(e,t){se(t.enabled)||(e.analytics.enabled=t.enabled),se(t.originContext)||(e.analytics.originContext=t.originContext),se(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),se(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),se(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),se(t.trackingId)||(e.analytics.trackingId=t.trackingId),se(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),se(t.source)||(e.analytics.source=t.source);try{let r=Yh();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}se(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),se(t.anonymous)||(e.analytics.anonymous=t.anonymous),se(t.deviceId)||(e.analytics.deviceId=t.deviceId),se(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),se(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function qR(e,t){e.knowledge.agentId=t;try{let r=Xh();se(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var yt=Jh;m();d();f();p();function UR(e){return e.instantlyCallable}var Zh=()=>e=>t=>e(UR(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function ey(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}m();d();f();p();var gd,VR=new Uint8Array(16);function hd(){if(!gd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gd=crypto.getRandomValues.bind(crypto)}return gd(VR)}m();d();f();p();m();d();f();p();var BR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yd={randomUUID:BR};function GR(e,t,r){if(yd.randomUUID&&!t&&!e)return yd.randomUUID();e=e||{};let n=e.random??e.rng?.()??hd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return ey(n)}var Cr=GR;m();d();f();p();m();d();f();p();var R={};$o(R,{BRAND:()=>gI,DIRTY:()=>rn,EMPTY_PATH:()=>zR,INVALID:()=>ae,NEVER:()=>ZI,OK:()=>ot,ParseStatus:()=>tt,Schema:()=>me,ZodAny:()=>Rr,ZodArray:()=>dr,ZodBigInt:()=>on,ZodBoolean:()=>sn,ZodBranded:()=>_o,ZodCatch:()=>yn,ZodDate:()=>an,ZodDefault:()=>hn,ZodDiscriminatedUnion:()=>Ia,ZodEffects:()=>xt,ZodEnum:()=>mn,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>ce,ZodFunction:()=>_a,ZodIntersection:()=>dn,ZodIssueCode:()=>z,ZodLazy:()=>pn,ZodLiteral:()=>fn,ZodMap:()=>li,ZodNaN:()=>pi,ZodNativeEnum:()=>gn,ZodNever:()=>Ft,ZodNull:()=>un,ZodNullable:()=>Ht,ZodNumber:()=>nn,ZodObject:()=>lt,ZodOptional:()=>wt,ZodParsedType:()=>Z,ZodPipeline:()=>ko,ZodPromise:()=>Ir,ZodReadonly:()=>vn,ZodRecord:()=>Ta,ZodSchema:()=>me,ZodSet:()=>di,ZodString:()=>Er,ZodSymbol:()=>ci,ZodTransformer:()=>xt,ZodTuple:()=>Qt,ZodType:()=>me,ZodUndefined:()=>cn,ZodUnion:()=>ln,ZodUnknown:()=>lr,ZodVoid:()=>ui,addIssueToContext:()=>X,any:()=>xI,array:()=>TI,bigint:()=>SI,boolean:()=>dy,coerce:()=>JI,custom:()=>cy,date:()=>AI,datetimeRegex:()=>sy,defaultErrorMap:()=>cr,discriminatedUnion:()=>PI,effect:()=>$I,enum:()=>VI,function:()=>LI,getErrorMap:()=>oi,getParsedType:()=>$t,instanceof:()=>yI,intersection:()=>NI,isAborted:()=>Ea,isAsync:()=>si,isDirty:()=>Ra,isValid:()=>xr,late:()=>hI,lazy:()=>qI,literal:()=>UI,makeIssue:()=>To,map:()=>MI,nan:()=>vI,nativeEnum:()=>BI,never:()=>RI,null:()=>CI,nullable:()=>HI,number:()=>ly,object:()=>_I,objectUtil:()=>vd,oboolean:()=>XI,onumber:()=>YI,optional:()=>QI,ostring:()=>KI,pipeline:()=>WI,preprocess:()=>zI,promise:()=>GI,quotelessJson:()=>$R,record:()=>DI,set:()=>jI,setErrorMap:()=>HR,strictObject:()=>kI,string:()=>uy,symbol:()=>bI,transformer:()=>$I,tuple:()=>FI,undefined:()=>wI,union:()=>OI,unknown:()=>EI,util:()=>ye,void:()=>II});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var ye;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ye||(ye={}));var vd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(vd||(vd={}));var Z=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$t=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}};var z=ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),$R=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ut=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=e=>new ut(e);var QR=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case z.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},cr=QR;var ty=cr;function HR(e){ty=e}function oi(){return ty}m();d();f();p();var To=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...(i.path||[])],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},zR=[];function X(e,t){let r=oi(),n=To({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===cr?void 0:cr].filter(i=>!!i)});e.common.issues.push(n)}var tt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let i of r){let o=yield i.key,s=yield i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ae;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ae=Object.freeze({status:"aborted"}),rn=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),Ea=e=>e.status==="aborted",Ra=e=>e.status==="dirty",xr=e=>e.status==="valid",si=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));var Ct=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ry=(e,t)=>{if(xr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(e.common.issues);return this._error=r,this._error}}};function pe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var me=class{get description(){return this._def.description}_getType(t){return $t(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tt,ctx:{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(si(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)},i=this._parseSync({data:t,path:n.path,parent:n});return ry(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return xr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>xr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:$t(t)},i=_this8._parse({data:t,path:n.path,parent:n}),o=yield si(i)?i:Promise.resolve(i);return ry(n,o)})()}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:z.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new xt({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return wt.create(this,this._def)}nullable(){return Ht.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return Ir.create(this,this._def)}or(t){return ln.create([this,t],this._def)}and(t){return dn.create(this,t,this._def)}transform(t){return new xt({...pe(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new hn({...pe(this._def),innerType:this,defaultValue:r,typeName:ce.ZodDefault})}brand(){return new _o({typeName:ce.ZodBranded,type:this,...pe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new yn({...pe(this._def),innerType:this,catchValue:r,typeName:ce.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ko.create(this,t)}readonly(){return vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},WR=/^c[^\s-]{8,}$/i,KR=/^[0-9a-z]+$/,YR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,XR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,JR=/^[a-z0-9_-]{21}$/i,ZR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,eI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sd,nI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,iI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,oI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,sI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,iy="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",uI=new RegExp(`^${iy}$`);function oy(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function lI(e){return new RegExp(`^${oy(e)}$`)}function sy(e){let t=`${iy}T${oy(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function dI(e,t){return!!((t==="v4"||!t)&&nI.test(e)||(t==="v6"||!t)&&oI.test(e))}function pI(e,t){if(!ZR.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function fI(e,t){return!!((t==="v4"||!t)&&iI.test(e)||(t==="v6"||!t)&&sI.test(e))}var Er=class e extends me{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.string,received:o.parsedType}),ae}let n=new tt,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?X(i,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&X(i,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")tI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"email",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Sd||(Sd=new RegExp(rI,"u")),Sd.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"emoji",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")XR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"uuid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")JR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"nanoid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")WR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cuid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")KR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cuid2",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")YR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"ulid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),X(i,{validation:"url",code:z.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"regex",code:z.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?sy(o).test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?uI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?lI(o).test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?eI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"duration",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?dI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"ip",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?pI(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"jwt",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?fI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cidr",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?aI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"base64",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?cI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"base64url",code:z.invalid_string,message:o.message}),n.dirty()):ye.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:z.invalid_string,...re.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Er.create=e=>new Er({checks:[],typeName:ce.ZodString,coerce:e?.coerce??!1,...pe(e)});function mI(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var nn=class e extends me{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.number,received:o.parsedType}),ae}let n,i=new tt;for(let o of this._def.checks)o.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),X(n,{code:z.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?mI(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_finite,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ye.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};nn.create=e=>new nn({checks:[],typeName:ce.ZodNumber,coerce:e?.coerce||!1,...pe(e)});var on=class e extends me{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let n,i=new tt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return X(r,{code:z.invalid_type,expected:Z.bigint,received:r.parsedType}),ae}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};on.create=e=>new on({checks:[],typeName:ce.ZodBigInt,coerce:e?.coerce??!1,...pe(e)});var sn=class extends me{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.boolean,received:n.parsedType}),ae}return ot(t.data)}};sn.create=e=>new sn({typeName:ce.ZodBoolean,coerce:e?.coerce||!1,...pe(e)});var an=class e extends me{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.date,received:o.parsedType}),ae}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_date}),ae}let n=new tt,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ye.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:ce.ZodDate,...pe(e)});var ci=class extends me{_parse(t){if(this._getType(t)!==Z.symbol){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.symbol,received:n.parsedType}),ae}return ot(t.data)}};ci.create=e=>new ci({typeName:ce.ZodSymbol,...pe(e)});var cn=class extends me{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.undefined,received:n.parsedType}),ae}return ot(t.data)}};cn.create=e=>new cn({typeName:ce.ZodUndefined,...pe(e)});var un=class extends me{_parse(t){if(this._getType(t)!==Z.null){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.null,received:n.parsedType}),ae}return ot(t.data)}};un.create=e=>new un({typeName:ce.ZodNull,...pe(e)});var Rr=class extends me{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}};Rr.create=e=>new Rr({typeName:ce.ZodAny,...pe(e)});var lr=class extends me{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}};lr.create=e=>new lr({typeName:ce.ZodUnknown,...pe(e)});var Ft=class extends me{_parse(t){let r=this._getOrReturnCtx(t);return X(r,{code:z.invalid_type,expected:Z.never,received:r.parsedType}),ae}};Ft.create=e=>new Ft({typeName:ce.ZodNever,...pe(e)});var ui=class extends me{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.void,received:n.parsedType}),ae}return ot(t.data)}};ui.create=e=>new ui({typeName:ce.ZodVoid,...pe(e)});var dr=class e extends me{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==Z.array)return X(r,{code:z.invalid_type,expected:Z.array,received:r.parsedType}),ae;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(X(r,{code:s?z.too_big:z.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(X(r,{code:z.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(X(r,{code:z.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Ct(r,s,r.path,a)))).then(s=>tt.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Ct(r,s,r.path,a)));return tt.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};dr.create=(e,t)=>new dr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...pe(t)});function ai(e){if(e instanceof lt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wt.create(ai(n))}return new lt({...e._def,shape:()=>t})}else return e instanceof dr?new dr({...e._def,type:ai(e.element)}):e instanceof wt?wt.create(ai(e.unwrap())):e instanceof Ht?Ht.create(ai(e.unwrap())):e instanceof Qt?Qt.create(e.items.map(t=>ai(t))):e}var lt=class e extends me{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ye.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return X(u,{code:z.invalid_type,expected:Z.object,received:u.parsedType}),ae}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let h=o[u],v=i.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new Ct(i,v,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ft){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of a)c.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(u==="strict")a.length>0&&(X(i,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of a){let v=i.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new Ct(i,v,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>tt.mergeObjectSync(n,u)):tt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??i}:{message:i}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ye.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ye.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ai(this)}partial(t){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ye.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof wt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return ay(ye.objectKeys(this.shape))}};lt.create=(e,t)=>new lt({shape:()=>e,unknownKeys:"strip",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});lt.strictCreate=(e,t)=>new lt({shape:()=>e,unknownKeys:"strict",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});lt.lazycreate=(e,t)=>new lt({shape:e,unknownKeys:"strip",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});var ln=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new ut(a.ctx.common.issues));return X(r,{code:z.invalid_union,unionErrors:s}),ae}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(o){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new ut(c));return X(r,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}};ln.create=(e,t)=>new ln({options:e,typeName:ce.ZodUnion,...pe(t)});var ur=e=>e instanceof pn?ur(e.schema):e instanceof xt?ur(e.innerType()):e instanceof fn?[e.value]:e instanceof mn?e.options:e instanceof gn?ye.objectValues(e.enum):e instanceof hn?ur(e._def.innerType):e instanceof cn?[void 0]:e instanceof un?[null]:e instanceof wt?[void 0,...ur(e.unwrap())]:e instanceof Ht?[null,...ur(e.unwrap())]:e instanceof _o||e instanceof vn?ur(e.unwrap()):e instanceof yn?ur(e._def.innerType):[],Ia=class e extends me{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return X(r,{code:z.invalid_type,expected:Z.object,received:r.parsedType}),ae;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(X(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=ur(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:ce.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pe(n)})}};function Ad(e,t){let r=$t(e),n=$t(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){let i=ye.objectKeys(t),o=ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=Ad(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=Ad(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var dn=class extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Ea(o)||Ea(s))return ae;let a=Ad(o.value,s.value);return a.valid?((Ra(o)||Ra(s))&&r.dirty(),{status:r.value,value:a.data}):(X(n,{code:z.invalid_intersection_types}),ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};dn.create=(e,t,r)=>new dn({left:e,right:t,typeName:ce.ZodIntersection,...pe(r)});var Qt=class e extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return X(n,{code:z.invalid_type,expected:Z.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return X(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(X(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ct(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>tt.mergeArray(r,s)):tt.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Qt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qt({items:e,typeName:ce.ZodTuple,rest:null,...pe(t)})};var Ta=class e extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.object)return X(n,{code:z.invalid_type,expected:Z.object,received:n.parsedType}),ae;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Ct(n,a,n.path,a)),value:s._parse(new Ct(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?tt.mergeObjectAsync(r,i):tt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof me?new e({keyType:t,valueType:r,typeName:ce.ZodRecord,...pe(n)}):new e({keyType:Er.create(),valueType:t,typeName:ce.ZodRecord,...pe(r)})}},li=class extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return X(n,{code:z.invalid_type,expected:Z.map,received:n.parsedType}),ae;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new Ct(n,a,n.path,[u,"key"])),value:o._parse(new Ct(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of s){let u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return ae;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return ae;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}}};li.create=(e,t,r)=>new li({valueType:t,keyType:e,typeName:ce.ZodMap,...pe(r)});var di=class e extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return X(n,{code:z.invalid_type,expected:Z.set,received:n.parsedType}),ae;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(X(n,{code:z.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(X(n,{code:z.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let h of c){if(h.status==="aborted")return ae;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new Ct(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};di.create=(e,t)=>new di({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...pe(t)});var _a=class e extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return X(r,{code:z.invalid_type,expected:Z.function,received:r.parsedType}),ae;function n(a,c){return To({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),cr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function i(a,c){return To({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),cr].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ir){let a=this;return ot(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new ut([]),h=yield a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(s,this,h);return yield a._def.returns._def.type.parseAsync(v,o).catch(g=>{throw u.addIssue(i(v,g)),u})}))}else{let a=this;return ot(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new ut([n(c,u.error)]);let h=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(h,o);if(!v.success)throw new ut([i(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Qt.create(t).rest(lr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Qt.create([]).rest(lr.create()),returns:r||lr.create(),typeName:ce.ZodFunction,...pe(n)})}},pn=class extends me{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};pn.create=(e,t)=>new pn({getter:e,typeName:ce.ZodLazy,...pe(t)});var fn=class extends me{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return X(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};fn.create=(e,t)=>new fn({value:e,typeName:ce.ZodLiteral,...pe(t)});function ay(e,t){return new mn({values:e,typeName:ce.ZodEnum,...pe(t)})}var mn=class e extends me{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return X(r,{expected:ye.joinValues(n),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return X(r,{received:r.data,code:z.invalid_enum_value,options:n}),ae}return ot(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};mn.create=ay;var gn=class extends me{_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let i=ye.objectValues(r);return X(n,{expected:ye.joinValues(i),received:n.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ye.objectValues(r);return X(n,{received:n.data,code:z.invalid_enum_value,options:i}),ae}return ot(t.data)}get enum(){return this._def.values}};gn.create=(e,t)=>new gn({values:e,typeName:ce.ZodNativeEnum,...pe(t)});var Ir=class extends me{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return X(r,{code:z.invalid_type,expected:Z.promise,received:r.parsedType}),ae;let n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return ot(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ir.create=(e,t)=>new Ir({type:e,typeName:ce.ZodPromise,...pe(t)});var xt=class extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{X(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ae;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ae:c.status==="dirty"?rn(c.value):r.value==="dirty"?rn(c.value):c});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ae;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ae:a.status==="dirty"?rn(a.value):r.value==="dirty"?rn(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xr(s))return ae;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>xr(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ae);ye.assertNever(i)}};xt.create=(e,t,r)=>new xt({schema:e,typeName:ce.ZodEffects,effect:t,...pe(r)});xt.createWithPreprocess=(e,t,r)=>new xt({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...pe(r)});var wt=class extends me{_parse(t){return this._getType(t)===Z.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};wt.create=(e,t)=>new wt({innerType:e,typeName:ce.ZodOptional,...pe(t)});var Ht=class extends me{_parse(t){return this._getType(t)===Z.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ht.create=(e,t)=>new Ht({innerType:e,typeName:ce.ZodNullable,...pe(t)});var hn=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});var yn=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return si(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});var pi=class extends me{_parse(t){if(this._getType(t)!==Z.nan){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.nan,received:n.parsedType}),ae}return{status:"valid",value:t.data}}};pi.create=e=>new pi({typeName:ce.ZodNaN,...pe(e)});var gI=Symbol("zod_brand"),_o=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ko=class e extends me{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let o=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:o.status==="dirty"?(r.dirty(),rn(o.value)):_this0._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ae:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ce.ZodPipeline})}},vn=class extends me{_parse(t){let r=this._def.innerType._parse(t),n=i=>(xr(i)&&(i.value=Object.freeze(i.value)),i);return si(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:ce.ZodReadonly,...pe(t)});function ny(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function cy(e,t={},r){return e?Rr.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=ny(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=ny(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Rr.create()}var hI={object:lt.lazycreate},ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ce||(ce={}));var yI=(e,t={message:`Input not instance of ${e.name}`})=>cy(r=>r instanceof e,t),uy=Er.create,ly=nn.create,vI=pi.create,SI=on.create,dy=sn.create,AI=an.create,bI=ci.create,wI=cn.create,CI=un.create,xI=Rr.create,EI=lr.create,RI=Ft.create,II=ui.create,TI=dr.create,_I=lt.create,kI=lt.strictCreate,OI=ln.create,PI=Ia.create,NI=dn.create,FI=Qt.create,DI=Ta.create,MI=li.create,jI=di.create,LI=_a.create,qI=pn.create,UI=fn.create,VI=mn.create,BI=gn.create,GI=Ir.create,$I=xt.create,QI=wt.create,HI=Ht.create,zI=xt.createWithPreprocess,WI=ko.create,KI=()=>uy().optional(),YI=()=>ly().optional(),XI=()=>dy().optional(),JI={string:e=>Er.create({...e,coerce:!0}),number:e=>nn.create({...e,coerce:!0}),boolean:e=>sn.create({...e,coerce:!0}),bigint:e=>on.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var ZI=ae;var eT=R.object({name:R.string(),arguments:R.string()}),tT=R.object({id:R.string(),type:R.literal("function"),function:eT,encryptedValue:R.string().optional()}),ka=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),rT=R.object({type:R.literal("text"),text:R.string()}),py=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),fy=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},gz=py.superRefine((e,t)=>{fy(e,t)}),nT=R.discriminatedUnion("type",[rT,py]),iT=nT.superRefine((e,t)=>{e.type==="binary"&&fy(e,t)}),oT=ka.extend({role:R.literal("developer"),content:R.string()}),sT=ka.extend({role:R.literal("system"),content:R.string()}),aT=ka.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(tT).optional()}),cT=ka.extend({role:R.literal("user"),content:R.union([R.string(),R.array(iT)])}),uT=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),lT=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),dT=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),my=R.discriminatedUnion("role",[oT,sT,aT,cT,uT,lT,dT]),hz=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),pT=R.object({description:R.string(),value:R.string()}),fT=R.object({name:R.string(),description:R.string(),parameters:R.any()}),mT=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(my),tools:R.array(fT),context:R.array(pT),forwardedProps:R.any()}),gT=R.any(),Fe=class extends Error{constructor(e){super(e)}},bd=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},gy=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),D=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),we=R.object({type:R.nativeEnum(D),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),hT=we.extend({type:R.literal(D.TEXT_MESSAGE_START),messageId:R.string(),role:gy.default("assistant")}),hy=we.extend({type:R.literal(D.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),yT=we.extend({type:R.literal(D.TEXT_MESSAGE_END),messageId:R.string()}),vT=we.extend({type:R.literal(D.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:gy.optional(),delta:R.string().optional()}),ST=we.extend({type:R.literal(D.THINKING_TEXT_MESSAGE_START)}),AT=hy.omit({messageId:!0,type:!0}).extend({type:R.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),bT=we.extend({type:R.literal(D.THINKING_TEXT_MESSAGE_END)}),wT=we.extend({type:R.literal(D.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),CT=we.extend({type:R.literal(D.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),xT=we.extend({type:R.literal(D.TOOL_CALL_END),toolCallId:R.string()}),ET=we.extend({messageId:R.string(),type:R.literal(D.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),RT=we.extend({type:R.literal(D.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),IT=we.extend({type:R.literal(D.THINKING_START),title:R.string().optional()}),TT=we.extend({type:R.literal(D.THINKING_END)}),_T=we.extend({type:R.literal(D.STATE_SNAPSHOT),snapshot:gT}),kT=we.extend({type:R.literal(D.STATE_DELTA),delta:R.array(R.any())}),OT=we.extend({type:R.literal(D.MESSAGES_SNAPSHOT),messages:R.array(my)}),PT=we.extend({type:R.literal(D.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),NT=we.extend({type:R.literal(D.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),FT=we.extend({type:R.literal(D.RAW),event:R.any(),source:R.string().optional()}),DT=we.extend({type:R.literal(D.CUSTOM),name:R.string(),value:R.any()}),MT=we.extend({type:R.literal(D.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:mT.optional()}),jT=we.extend({type:R.literal(D.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),LT=we.extend({type:R.literal(D.RUN_ERROR),message:R.string(),code:R.string().optional()}),qT=we.extend({type:R.literal(D.STEP_STARTED),stepName:R.string()}),UT=we.extend({type:R.literal(D.STEP_FINISHED),stepName:R.string()}),VT=R.union([R.literal("tool-call"),R.literal("message")]),BT=we.extend({type:R.literal(D.REASONING_START),messageId:R.string()}),GT=we.extend({type:R.literal(D.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),$T=we.extend({type:R.literal(D.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),QT=we.extend({type:R.literal(D.REASONING_MESSAGE_END),messageId:R.string()}),HT=we.extend({type:R.literal(D.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),zT=we.extend({type:R.literal(D.REASONING_END),messageId:R.string()}),WT=we.extend({type:R.literal(D.REASONING_ENCRYPTED_VALUE),subtype:VT,entityId:R.string(),encryptedValue:R.string()}),Oa=R.discriminatedUnion("type",[hT,hy,yT,vT,IT,TT,ST,AT,bT,wT,CT,xT,RT,ET,_T,kT,OT,PT,NT,FT,DT,MT,jT,LT,qT,UT,BT,GT,$T,QT,HT,zT,WT]);m();d();f();p();var wd={};$o(wd,{JsonPatchError:()=>Le,_areEquals:()=>No,applyOperation:()=>Sn,applyPatch:()=>Tr,applyReducer:()=>ZT,deepClone:()=>XT,getValueByPointer:()=>Ma,validate:()=>vy,validator:()=>ja});m();d();f();p();m();d();f();p();var KT=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),YT=Object.prototype.hasOwnProperty;function Na(e,t){return YT.call(e,t)}function Fa(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var i in e)Na(e,i)&&n.push(i);return n}function rt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Da(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function zt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Oo(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Pa(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Pa(e[t]))return!0}else if(typeof e=="object"){for(var n=Fa(e),i=n.length,o=0;o<i;o++)if(Pa(e[n[o]]))return!0}}return!1}function yy(e,t){var r=[e];for(var n in t){var i=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
32
- `)}var Po=function(e){KT(t,e);function t(r,n,i,o,s){var a=this.constructor,c=e.call(this,yy(r,{name:n,index:i,operation:o,tree:s}))||this;return c.name=n,c.index=i,c.operation=o,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=yy(r,{name:n,index:i,operation:o,tree:s}),c}return t}(Error);var Le=Po,XT=rt,fi={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ma(r,this.path);n&&(n=rt(n));var i=Sn(r,{op:"remove",path:this.from}).removed;return Sn(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ma(r,this.from);return Sn(r,{op:"add",path:this.path,value:rt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:No(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},JT={add:function(e,t,r){return Da(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:fi.move,copy:fi.copy,test:fi.test,_get:fi._get};function Ma(e,t){if(t=="")return e;var r={op:"_get",path:t};return Sn(e,r),r.value}function Sn(e,t,r,n,i,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):ja(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ma(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=No(e,t.value),s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new Le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return s}}else{n||(e=rt(e));var a=t.path||"",c=a.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=ja;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=Oo(g)),i&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!Da(g))throw new Le("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);Da(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Le("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var s=JT[t.op].call(t,u,g,e);if(s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}}else if(h>=v){var s=fi[t.op].call(t,u,g,e);if(s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Le("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}function Tr(e,t,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(t))throw new Le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=rt(e));for(var o=new Array(t.length),s=0,a=t.length;s<a;s++)o[s]=Sn(e,t[s],r,!0,i,s),e=o[s].newDocument;return o.newDocument=e,o}function ZT(e,t,r){var n=Sn(e,t);if(n.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function ja(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Le("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(fi[e.op]){if(typeof e.path!="string")throw new Le("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Le("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Le("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Pa(e.value))throw new Le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var i=e.path.split("/").length,o=n.split("/").length;if(i!==o+1&&i!==o)throw new Le("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Le("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=vy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Le("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function vy(e,t,r){try{if(!Array.isArray(e))throw new Le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Tr(rt(t),rt(e),r||!0);else{r=r||ja;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(i){if(i instanceof Le)return i;throw i}}function No(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),i,o,s;if(r&&n){if(o=e.length,o!=t.length)return!1;for(i=o;i--!==0;)if(!No(e[i],t[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(o=a.length,o!==Object.keys(t).length)return!1;for(i=o;i--!==0;)if(!t.hasOwnProperty(a[i]))return!1;for(i=o;i--!==0;)if(s=a[i],!No(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Rd={};$o(Rd,{compare:()=>a_,generate:()=>Cd,observe:()=>s_,unobserve:()=>o_});m();d();f();p();var xd=new WeakMap,e_=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),t_=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function r_(e){return xd.get(e)}function n_(e,t){return e.observers.get(t)}function i_(e,t){e.observers.delete(t.callback)}function o_(e,t){t.unobserve()}function s_(e,t){var r=[],n,i=r_(e);if(!i)i=new e_(e),xd.set(e,i);else{var o=n_(i,t);n=o&&o.observer}if(n)return n;if(n={},i.value=rt(e),t){n.callback=t,n.next=null;var s=function(){Cd(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){Cd(n),clearTimeout(n.next),i_(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new t_(t,n)),n}function Cd(e,t){t===void 0&&(t=!1);var r=xd.get(e.object);Ed(r.value,e.object,e.patches,"",t),e.patches.length&&Tr(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Ed(e,t,r,n,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=Fa(t),s=Fa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var h=s[u],v=e[h];if(Na(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?Ed(v,S,r,n+"/"+zt(h),i):v!==S&&(a=!0,i&&r.push({op:"test",path:n+"/"+zt(h),value:rt(v)}),r.push({op:"replace",path:n+"/"+zt(h),value:rt(S)}))}else Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+zt(h),value:rt(v)}),r.push({op:"remove",path:n+"/"+zt(h)}),c=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&o.length==s.length))for(var u=0;u<o.length;u++){var h=o[u];!Na(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+zt(h),value:rt(t[h])})}}}function a_(e,t,r){r===void 0&&(r=!1);var n=[];return Ed(e,t,n,"",r),n}var Vz=Object.assign({},wd,Rd,{JsonPatchError:Po,deepClone:rt,escapePathComponent:zt,unescapePathComponent:Oo});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Id=function(e,t){return Id=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Id(e,t)};function Wt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Id(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Sy(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function La(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function pr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-->0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function gi(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function An(e){return this instanceof An?(this.v=e,this):new An(e)}function Ay(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(y){return Promise.resolve(y).then(g,v)}}function a(g,y){n[g]&&(i[g]=function(C){return new Promise(function(x,E){o.push([g,C,x,E])>1||c(g,C)})},y&&(i[g]=y(i[g])))}function c(g,y){try{u(n[g](y))}catch(C){S(o[0][3],C)}}function u(g){g.value instanceof An?Promise.resolve(g.value.v).then(h,v):S(o[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function by(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof pr=="function"?pr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}m();d();f();p();function he(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function hi(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var qa=hi(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
30
+ `;function sE(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var aE=["1",1,"yes",!0];function ea(){let e=[];return fl()&&e.push(window.doNotTrack),Rl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>aE.indexOf(t)!==-1)}var xg="v15",Eg={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function cE(e=Eg.default,t=xg,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var uE="38824e1f-37f5-42d3-8372-a4b8fa9df946",Vt=class{get defaultOptions(){return{endpoint:Eg.default,isCustomEndpoint:!1,token:"",version:xg,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Ag}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[XC,HC].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};ea()?this.runtime=new Zs:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ge.view,{newEventType:ge.view,addClientIdParameter:!0}),this.addEventTypeMapping(ge.click,{newEventType:ge.click,addClientIdParameter:!0}),this.addEventTypeMapping(ge.custom,{newEventType:ge.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ge.search,{newEventType:ge.search,addClientIdParameter:!0})}initRuntime(t){return fl()&&zn()?new xl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(sE()&&console.warn(oE),new El(t))}get storage(){return this.runtime.storage}determineVisitorId(){return q(this,void 0,void 0,function*(){try{return fl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return q(this,void 0,void 0,function*(){if(Ks(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ag(t,ag(r,uE)))}})}getParameters(t,...r){return q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return q(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(ea())return null;try{let r=new URL(t).searchParams.get(yr.cvo_cid);if(r==null)return null;let n=yr.fromString(r);return!n||!zn()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return q(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:o=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:i?yield this.getCurrentVisitorId():""})}),g=>q(this,void 0,void 0,function*(){return s?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>o?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,C)=>q(this,void 0,void 0,function*(){let x=yield y;return yield C(t,x)}),g)].reduce((g,y)=>q(this,void 0,void 0,function*(){let C=yield g;return yield y(C)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return q(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?Kx(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>q(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return q(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},i=yield this.resolveParameters(t,...r),o=yield this.resolvePayloadForParameters(t,i);return{eventType:n,payload:o,log:s=>q(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},o),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},i),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return q(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Ws().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.search,t)})}sendSearchEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=sr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.click,t)})}sendClickEvent(t){return q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=sr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.custom,t)})}sendCustomEvent(t){return q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=sr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return q(this,void 0,void 0,function*(){return this.makeEvent(ge.view,t)})}sendViewEvent(t){return q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return q(this,void 0,void 0,function*(){let r=yield(yield b(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return q(this,void 0,void 0,function*(){return yield(yield b(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let i=0,o=r.length;i<o;i++){let s=r[i];if(typeof s=="string")n[t[i]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},n),s)}return n}isKeyAllowedEmpty(t,r){return({[ge.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=i=>typeof i<"u"&&i!==null&&i!=="";return Object.keys(t).filter(i=>this.isKeyAllowedEmpty(r,i)||n(t[i])).reduce((i,o)=>Object.assign(Object.assign({},i),{[o]:t[o]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(Zx(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,i)=>Object.assign(Object.assign({},n),{[i]:t[i]}),{})}processCustomParameters(t){let{custom:r}=t,n=sr(t,["custom"]),i={};r&&zs(r)&&(i=this.lowercaseKeys(r));let o=eE(n);return Object.assign(Object.assign({},i),o)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=sr(t,["custom"]);if(r&&zs(r)){let i=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},i),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(i=>{n[i.toLowerCase()]=t[i]}),n}validateParams(t,r){let{anonymizeIp:n}=t,i=sr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(i.anonymizeIp=1),(r==ge.view||r==ge.click||r==ge.search||r==ge.custom)&&(i.originLevel3=this.limit(i.originLevel3,1024)),r==ge.view&&(i.location=this.limit(i.location,1024)),(r=="pageview"||r=="event")&&(i.referrer=this.limit(i.referrer,2048),i.location=this.limit(i.location,2048),i.page=this.limit(i.page,2048)),i}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=sr(t,["userId"]);return iE(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=sr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&zs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&zs(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?px(t,r):t}get baseUrl(){return cE(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},ar;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(ar||(ar={}));var B;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(B||(B={}));var mg={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[ar.expandToFullUI]:"interface",[ar.openUserActions]:"User Actions",[ar.showPrecedingSessions]:"User Actions",[ar.showFollowingSessions]:"User Actions",[ar.clickViewedDocument]:"User Actions",[ar.clickPageView]:"User Actions",[ar.createArticle]:"createArticle"},Yn=class{constructor(){this.runtime=new Zs,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(ge.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ge.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ge.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ge.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Ag}};function lE(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function dE(e){return e.map(t=>t.replace(/;/g,""))}function Rg(e){let r=e.join(";");return r.length<=256?r:Rg(e.slice(1))}var gg=e=>{let t=dE(e),r=lE(t);return Rg(r)};function hg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:gg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:gg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ta=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||ea();this.coveoAnalyticsClient=n?new Yn:new Vt(t)}disable(){this.coveoAnalyticsClient=new Yn}enable(){this.coveoAnalyticsClient=new Vt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.recommendation)}logRecommendation(){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(B.recommendationOpen,t,r)}logRecommendationOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(B.staticFilterClearAll,t)}logStaticFilterClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(B.staticFilterSelect,t)}logStaticFilterSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(B.staticFilterDeselect,t)}logStaticFilterDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(B.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(B.interfaceChange,t)}logInterfaceChange(t){return q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.resultsSort,t)}logResultsSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(B.searchboxSubmit)}logSearchboxSubmit(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.breadcrumbFacet,t)}logBreadcrumbFacet(t){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(B.breadcrumbResetAll)}logBreadcrumbResetAll(){return q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(B.documentQuickview,t,r)}logDocumentQuickview(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(B.documentOpen,t,r)}logDocumentOpen(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(B.omniboxAnalytics,hg(t))}logOmniboxAnalytics(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(B.omniboxFromLink,hg(t))}logOmniboxFromLink(t){return q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(B.searchFromLink)}logSearchFromLink(){return q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.triggerNotify,t)}logTriggerNotify(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(B.triggerExecute,t)}logTriggerExecute(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(B.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(B.undoTriggerQuery,t)}logUndoTriggerQuery(t){return q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(B.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(B.pagerResize,t)}logPagerResize(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(B.pagerNumber,t)}logPagerNumber(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(B.pagerNext,t)}logPagerNext(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(B.pagerPrevious,t)}logPagerPrevious(t){return q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(B.pagerScrolling)}logPagerScrolling(){return q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.facetClearAll,t)}logFacetClearAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(B.facetSearch,t)}logFacetSearch(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(B.facetSelect,t)}logFacetSelect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(B.facetDeselect,t)}logFacetDeselect(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(B.facetExclude,t)}logFacetExclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(B.facetUnexclude,t)}logFacetUnexclude(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(B.facetSelectAll,t)}logFacetSelectAll(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(B.facetUpdateSort,t)}logFacetUpdateSort(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(B.facetShowMore,t)}logFacetShowMore(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(B.facetShowLess,t)}logFacetShowLess(t){return q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(B.queryError,t)}logQueryError(t){return q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorBack);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorBack)})}})}logQueryErrorBack(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorRetry);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorRetry)})}})}logQueryErrorRetry(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(B.queryErrorClear);return{description:t.description,log:()=>q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(B.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(B.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(B.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(B.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(B.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(B.copyToClipboard,t,r)}logCopyToClipboard(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(B.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(B.recentQueryClick)}logRecentQueryClick(){return q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.clearRecentQueries)}logClearRecentQueries(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(B.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(B.clearRecentResults)}logClearRecentResults(){return q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.noResultsBack)}logNoResultsBack(){return q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(B.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(B.showLessFoldedResults)}logShowLessFoldedResults(){return q(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return q(this,arguments,void 0,function*(n,i,o=mg[n]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),i),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:o,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return q(this,arguments,void 0,function*(n,i,o=mg[n]){return(yield this.makeCustomEvent(n,i,o)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),o=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:r,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,r,n){return q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return q(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),i=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(i,t),log:({searchUID:o})=>i.log({searchQueryUid:o})}})}makeClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){let o=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(o);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,i)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return q(this,void 0,void 0,function*(){var n,i;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(i=(n=this.provider).getGeneratedAnswerMetadata)===null||i===void 0?void 0:i.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Vt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(B.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(B.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(B.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(B.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(B.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(B.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(B.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(B.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(B.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(B.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(B.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(B.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ra=Object.assign({},lo),yg=Object.keys(ra).map(e=>ra[e]),Wn=class extends hl{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>yg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(yg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ra.pageview,{newEventType:ge.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ra.event,{newEventType:ge.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let i=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),o=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},o),i),r)}getTicketPayload(){return yx(this.ticket)}};Wn.Id="svc";var na;(function(e){e.click="click",e.flowStart="flowStart"})(na||(na={}));var At;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(At||(At={}));var ia;(function(e){e.quit="Quit",e.solved="Solved"})(ia||(ia={}));var oa=class{constructor(t,r){var n;this.options=t,this.provider=r;let i=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!ea();this.coveoAnalyticsClient=i?new Vt(t):new Yn,this.svc=new Wn({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Yn,this.svc=new Wn({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Vt(this.options),this.svc=new Wn({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(At.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(At.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(At.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(At.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(At.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(At.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(At.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(At.caseCancelled,{reason:ia.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(At.caseSolved,{reason:ia.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(At.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",na.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",na.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return q(this,void 0,void 0,function*(){var r,n;let i=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:i,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Vt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,i,o;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel2(),originLevel3:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel3()}}logClickEvent(t,r,n,i){return q(this,void 0,void 0,function*(){var o,s;let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),i))),{searchQueryUid:(s=(o=this.provider)===null||o===void 0?void 0:o.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var pE=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Jr=class{constructor(t){this.getState=t;Se(this,"state");this.state=t()}getLanguage(){return pE(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},i={};for(let[o,s]of Object.entries(n)){let a=`context_${o}`;i[a]=s}return r.analytics.analyticsMode==="legacy"&&(i.coveoHeadlessVersion=Vn),i}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Gn()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var Xn=e=>new Vt(e).getCurrentVisitorId(),mo=(e,t)=>typeof t=="function"?(...r)=>{let n=Mi(r[0]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,go=(e,t)=>(...r)=>{let n=Mi(r[1]);try{return t.apply(t,r)}catch(i){return e.error(i,"Error in analytics hook. Returning original request."),n}};var ho=class extends Jr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Ig=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i=new ho(t)})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new oa({enableAnalytics:u,token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:mo(e,n),beforeSendHooks:[go(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function sa(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Tg(e){let{activeValue:t,ancestryMap:r}=gE(e);return t?hE(t,r):[]}function gE(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let i of n.children)r.set(i,n);t.unshift(...n.children)}return{}}function hE(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var yE=(e,t)=>e.categoryFacetSet[t]?.request;var Il=(e,t)=>{let r=yE(e,t);return Tg(r?.currentValues??[])};m();d();f();p();function aa(){return{}}m();d();f();p();function ca(){return{}}m();d();f();p();function ua(){return{}}m();d();f();p();function la(){return{}}function Tl(e){return{facetSet:e.facetSet??la(),categoryFacetSet:e.categoryFacetSet??aa(),dateFacetSet:e.dateFacetSet??ca(),numericFacetSet:e.numericFacetSet??ua(),automaticFacetSet:e.automaticFacetSet??sa()}}var _l=e=>{let t=[];return AE(e).forEach((r,n)=>{let i=TE(e,r.facetId),o=RE(r,n+1);if(SE(r)){if(!!!Il(e,r.facetId).length)return;t.push({...o,...xE(e,r.facetId),facetType:i,state:"selected"});return}r.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let c=_g(s,a+1,i),u=vE(r)?kg(s):wE(s);t.push({...o,...c,...u})})}),bE(e).forEach((r,n)=>{let i=EE(r,n+1);r.values.forEach((o,s)=>{if(o.state==="idle")return;let a=_g(o,s+1,"specific"),c=kg(o);t.push({...i,...a,...c})})}),t},vE=e=>e.type==="specific",SE=e=>e.type==="hierarchical",AE=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),bE=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),_g=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),wE=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),kg=e=>({displayValue:e.value,value:e.value}),CE=(e,t)=>Il(e,t).map(n=>n.value).join(";"),xE=(e,t)=>{let n=CE(e,t);return{value:n,valuePosition:1,displayValue:n}},EE=(e,t)=>({title:Og(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),RE=(e,t)=>({title:Og(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Og=(e,t)=>`${e}_${t}`,IE=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,TE=(e,t)=>{let r=IE(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var kl=e=>e.configuration.search.locale,Pg=e=>e.configuration.search.timezone,Ng=e=>e.configuration.accessToken,Fg=e=>e.configuration.organizationId,Dg=e=>e.configuration.environment,da=e=>e.configuration?.knowledge?.agentId,Mg=e=>e.configuration.knowledge.debugAgentSession;var Zr=e=>{if(_E(e)||Ol(e))return e.generatedAnswer?.answerId;if(kE(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},_E=e=>"answer"in e&&"generatedAnswer"in e&&!se(e.generatedAnswer?.answerConfigurationId),Ol=e=>{let t=da(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},kE=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Pl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,OE=e=>e.generatedAnswer?.citations,PE=e=>e.followUpAnswers?.followUpAnswers,NE=Fe(PE,e=>e?.flatMap(t=>t.citations)),FE=(e,t)=>t,DE=Fe(OE,NE,FE,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Nt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function Nl(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Nl(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Nl(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var jg=(r=>(r.Ascending="ascending",r.Descending="descending",r))(jg||{}),Lg=(o=>(o.Relevancy="relevancy",o.QRE="qre",o.Date="date",o.Field="field",o.NoSort="nosort",o))(Lg||{}),Fl=e=>{if(tf(e))return e.map(t=>Fl(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},qg=()=>({by:"relevancy"});var zU=new Ee({values:{by:new Su({enum:Lg,required:!0}),order:new Su({enum:jg}),field:new ee}});function pa(){return Fl(qg())}m();d();f();p();m();d();f();p();m();d();f();p();var Jn=class e{static set(t,r,n){let i,o,s;n&&(o=new Date,o.setTime(o.getTime()+n));let a=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(a)||u.test(a)||a.indexOf(".")===-1?Dl(t,r,o):(s=a.split("."),i=s[s.length-2]+"."+s[s.length-1],Dl(t,r,o,i))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let i=0;i<n.length;i++){let o=n[i];if(o=o.replace(/^\s+/,""),o.lastIndexOf(r,0)===0)return o.substring(r.length,o.length)}return null}static erase(t){e.set(t,"",-1)}};function Dl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();f();p();function ME(){return typeof navigator<"u"}function Ug(){try{return typeof localStorage<"u"}catch{return!1}}function Vg(){try{return typeof sessionStorage<"u"}catch{return!1}}function Bg(){return!!(ME()&&navigator.cookieEnabled)}var Gg=null;function $g(){return Gg||(Ug()?localStorage:Bg()?new Ml:Vg()?sessionStorage:new jl)}var Zn=class Zn{getItem(t){return Jn.get(`${Zn.prefix}${t}`)}removeItem(t){Jn.erase(`${Zn.prefix}${t}`)}setItem(t,r,n){Jn.set(`${Zn.prefix}${t}`,r,n)}};Se(Zn,"prefix","coveo_");var Ml=Zn;var jl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var fa="__coveo.analytics.history",jE=20,LE=1e3*60,qE=75,en=class en{constructor(t){Se(this,"store");this.store=t||$g()}static getInstance(t){return en.instance||(en.instance=new en(t)),en.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let r=yield _this4.getHistoryWithInternalTimeAsync();r!==null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(r)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(fa);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(fa);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(fa,JSON.stringify(t.slice(0,jE)))}catch{}}clear(){try{this.store.removeItem(fa)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,i)=>(i.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,qE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>LE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:i,value:o}=r;return{name:n,time:i,value:o}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:i}=t;return r&&typeof i=="string"&&r.toLowerCase()==="query"&&i.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};Se(en,"instance",null);var Ll=en,Gt=Ll;var yo=class yo extends Jr{constructor(){super(...arguments);Se(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return _l(Tl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||yo.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Bt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||yo.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),i=Zr(r);return i&&(n.generativeQuestionAnsweringId=i),n}getFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetValue:n,facetTitle:`${o}_${r}`}}getFacetClearAllMetadata(r){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetTitle:`${i}_${r}`}}getFacetUpdateSortMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,criteria:n,facetTitle:`${o}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${o}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??pa()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:o,categoryFacetPath:n,categoryFacetTitle:`${o}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let i=this.state.querySuggest?.[r],o=i.completions.map(u=>u.expression),s=i.partialQueries.length-1,a=i.partialQueries[s]||"",c=i.responseId;return{...this.getBaseMetadata(),suggestionRanking:o.indexOf(n),partialQuery:a,partialQueries:i.partialQueries.length>0?i.partialQueries:"",suggestions:o.length>0?o:"",querySuggestResponseId:c}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Nt().q}get responseTime(){return this.state.search?.duration||Bt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Bt().response.totalCountFiltered}};Se(yo,"fallbackPipelineName","default");var vr=yo,Qg=({logger:e,getState:t,analyticsClientMiddleware:r=(o,s)=>s,preprocessRequest:n,provider:i})=>{let o=t(),s=o.configuration.accessToken,a=o.configuration.analytics.apiBaseUrl??qe(o.configuration.organizationId,o.configuration.environment,"analytics"),c=o.configuration.analytics.runtimeEnvironment,u=o.configuration.analytics.enabled,h=new ta({token:s,endpoint:a,runtimeEnvironment:c,preprocessRequest:mo(e,n),beforeSendHooks:[go(e,r),(v,S)=>(e.info({...S,type:v,endpoint:a,token:s},"Analytics request"),S)]},i);return u||h.disable(),h},ql=()=>{let t=Gt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};m();d();f();p();function Hg(e){let t=zg(e),r=[e,...t].filter(i=>i.parentResult).map(i=>i.parentResult);return $p([e,...t,...r],i=>i.uniqueId)}function zg(e){return e.childResults?e.childResults.flatMap(t=>[t,...zg(t)]):[]}m();d();f();p();var ma=()=>"";function Wg(e,t){return{...new vr(t).getBaseMetadata(),actionCause:e,type:e}}function UE(e){return Object.assign(e,{instantlyCallable:!0})}function VE(e,t){let r=o=>{let s=Ae(e,o);return UE(Object.assign(s,{type:s.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(o,{getState:s,extra:a}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=a;return yield(yield t({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref17.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref18=_asyncToGenerator(function*({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c}){let{description:u,log:h}=yield t({getState:o,analyticsClientMiddleware:s,preprocessRequest:a,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x45,_x46){return _ref19.apply(this,arguments)}}())}});return function prepare(_x44){return _ref18.apply(this,arguments)}}()}),n}var Kg=(e,t,r)=>{function n(...i){let o=i.length===1?{...i[0],__legacy__getBuilder:t(i[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:i[0],__legacy__getBuilder:t(i[1]),__legacy__provider:i[2],analyticsConfigurator:e,providerClass:r};return $E(o)}return n},BE=e=>e.configuration.analytics.analyticsMode==="legacy",GE=e=>e.configuration.analytics.analyticsMode==="next",$E=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:i,analyticsConfigurator:o,providerClass:s})=>(r??(r=a=>new s(a)),VE(e,/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref21=_asyncToGenerator(function*({state:E}){for(let _ of v)yield _(E)});return function log(_x48){return _ref21.apply(this,arguments)}}()},g=a(),y=o({getState:a,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(a)}),C=yield t(y,a());S.description=C?.description,v.push(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(E){BE(E)&&(yield QE(C,r,E,h,y.coveoAnalyticsClient))});return function(_x49){return _ref22.apply(this,arguments)}}());let{emit:x}=no(g);return v.push(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(E){if(GE(E)&&i&&n){let _=n(E);yield ZE(x,i,_)}});return function(_x50){return _ref23.apply(this,arguments)}}()),S});return function(_x47){return _ref20.apply(this,arguments)}}()));function QE(_x51,_x52,_x53,_x54,_x55){return _QE.apply(this,arguments)}function _QE(){_QE=_asyncToGenerator(function*(e,t,r,n,i){t(()=>r);let o=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:i,response:o},"Analytics response")});return _QE.apply(this,arguments)}var HE=e=>r=>(n,i)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref24=_asyncToGenerator(function*(o){r(n,i)});return function log(_x56){return _ref24.apply(this,arguments)}}()}),it=Kg(e=>Qg({...e,provider:e.provider||new vr(e.getState)}),e=>e,vr),ht=Kg(Ig,HE("caseAssist"),ho);var Ul=(e,t)=>{let r=o=>o+(t.pagination?.firstResult??0),n=-1,i=t.search?.results;return n=Jg(e,i),n<0&&(n=JE(e,i)),n<0&&(n=0),zE(e,r(n),t)};function zE(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:YE(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:XE(e),queryPipeline:r.pipeline||ma()}}var Vl=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),Yg={urihash:new ee,sourcetype:new ee,permanentid:new ee},Xg={uniqueId:te,raw:new Ee({values:Yg}),title:te,uri:te,clickUri:te,rankingModifier:new ee({required:!1,emptyAllowed:!0})};function WE(e){return Object.assign({},...Object.keys(Yg).map(t=>({[t]:e[t]})))}function KE(e){return Object.assign({},...Object.keys(Xg).map(t=>({[t]:e[t]})),{raw:WE(e.raw)})}function YE(e){let t=e.raw.author;return se(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function XE(e){let t=e.raw.source;return se(t)?"unknown":t}var Bl=e=>new kt(Xg).validate(KE(e));function JE(e,t){for(let[r,n]of t.entries()){let i=Hg(n);if(Jg(e,i)!==-1)return r}return-1}function Jg(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function ZE(_x57,_x58,_x59){return _ZE.apply(this,arguments)}function _ZE(){_ZE=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _ZE.apply(this,arguments)}m();d();f();p();var ei=(e,t,r,n)=>it({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(i,o)=>{let s=t??Zr(o),a=e?r??(!o.generatedAnswer?.answer||!o.generatedAnswer?.answer.length):void 0;return s?i.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:s,answerGenerated:e,answerTextIsEmpty:a,...(n&&{conversationId:n})}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:i=>({answerId:t??Zr(i)??"",answerGenerated:e??!1})}),ti=e=>it({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Zr(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var Zg=Fe(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:i}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(i&&{lq:i})}});m();d();f();p();var tn=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:$n(e)}});m();d();f();p();var eh=e=>e.context;m();d();f();p();var Gl=e=>e.pipeline;m();d();f();p();m();d();f();p();var So=_t(ga(),1),sh=_t(th(),1);m();d();f();p();var nh=_t(ga(),1),ih=_t(rh(),1);nh.default.extend(ih.default);var eR="YYYY/MM/DD@HH:mm:ss";function oh(e){return e.format(eR)}So.default.extend(sh.default);var tR=["past","now","next"],rR=["minute","hour","day","week","month","quarter","year"];function nR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,So.default)().subtract(r,n);case"next":return(0,So.default)().add(r,n);case"now":return(0,So.default)()}}function Yl(e){return oh(nR(iR(e)))}function ah(e){return e.toLocaleLowerCase().split("-")}function Xl(e){let[t,r,n]=ah(e);if(t==="now")return!0;if(!tR.includes(t)||!rR.includes(n))return!1;let i=parseInt(r,10);return!(Number.isNaN(i)||i<=0)}function iR(e){let[t,r,n]=ah(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function ch(e){return e.type==="dateRange"}function uh(e){return`start${e}`}function lh(e){return`end${e}`}var Jl=()=>({dateFacetValueMap:{}});function oR(e,t,r){let n=e.start,i=e.end;return Xl(n)&&(n=Yl(n),r.dateFacetValueMap[t][uh(n)]=e.start),Xl(i)&&(i=Yl(i),r.dateFacetValueMap[t][lh(i)]=e.end),{...e,start:n,end:i}}function Zl(e,t){if(ch(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(i=>oR(i,r,t))}}return e}function Sr(e){let t=Jl();return{request:{...e,facets:e.facets?.map(n=>Zl(n,t))},mappings:t}}function sR(e,t,r){return{...e,start:r.dateFacetValueMap[t][uh(e.start)]||e.start,end:r.dateFacetValueMap[t][lh(e.end)]||e.end}}function aR(e,t){return e.facetId in t.dateFacetValueMap}function cR(e,t){return aR(e,t)?{...e,values:e.values.map(r=>sR(r,e.facetId,t))}:e}function ha(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>cR(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Ar(e){return Object.values(e).map(t=>t.request)}function ed(e,t){let r={};e.forEach(o=>{r[o.facetId]=o});let n=[];t.forEach(o=>{o in r&&(n.push(r[o]),delete r[o])});let i=Object.values(r);return[...n,...i]}function dh(e){return Ar(e).map(t=>{let n=t.currentValues.some(({state:i})=>i!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var td={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function uR(e){return Ar(e).map(t=>{let r=td[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function lR(e){return[...uR(e.facetSet??{}),...dh(e.numericFacetSet??{}),...dh(e.dateFacetSet??{}),...Ar(e.categoryFacetSet??{})]}function dR(e){return lR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ya(e){return ed(dR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var ph=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Xn(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(ql()&&{pageId:ql()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:$n(e)})}}});return function ph(_x60,_x61){return _ref25.apply(this,arguments)}}();var ri=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:Gt.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield ph(e.configuration.analytics,t))),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function ri(_x62,_x63){return _ref26.apply(this,arguments)}}();m();d();f();p();var va=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,r)),...(e.excerptLength&&!se(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var fh=Fe(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i}));var br=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=nd(e),i=pR(e),o=fR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield ri(e,r):va(e,t,r);return Sr({...s,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(i.length&&{facets:i}),...(e.pagination&&{numberOfResults:rd(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function br(_x64,_x65,_x66){return _ref27.apply(this,arguments)}}();function rd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function pR(e){return ed(gR(e),e.facetOrder??[])}function fR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(mR).filter(r=>r.currentValues.length>0):void 0}function mR(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function gR(e){return hR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function hR(e){return[...yR(e.facetSet??{}),...mh(e.numericFacetSet??{}),...mh(e.dateFacetSet??{}),...Ar(e.categoryFacetSet??{})]}function yR(e){return Ar(e).map(t=>{let r=td[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function mh(e){return Ar(e).map(t=>{let r=t.currentValues,n=r.some(({state:o})=>o!=="idle"),i=r.some(o=>o.previousState);return t.generateAutomaticRanges&&!n&&!i?{...t,currentValues:[]}:t})}function nd(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=fh(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}m();d();f();p();m();d();f();p();var bo=(e,t)=>{let r=e;return se(r[t])?se(e.raw[t])?null:e.raw[t]:r[t]},vR=e=>t=>e.every(r=>!se(bo(t,r))),SR=e=>t=>e.every(r=>se(bo(t,r))),AR=(e,t)=>r=>{let n=gh(e,r);return t.some(i=>n.some(o=>`${o}`.toLowerCase()===i.toLowerCase()))},bR=(e,t)=>r=>{let n=gh(e,r);return t.every(i=>n.every(o=>`${o}`.toLowerCase()!==i.toLowerCase()))},gh=(e,t)=>{let r=bo(t,e);return Gp(r)?r:[r]},hh={getResultProperty:bo,fieldsMustBeDefined:vR,fieldsMustNotBeDefined:SR,fieldMustMatch:AR,fieldMustNotMatch:bR};var id=Fe(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var od=e=>e.searchHub;m();d();f();p();var sd=Fe(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),lG=Fe(e=>e,e=>{let t=sd(e);return t&&e?e[t].expression:""});m();d();f();p();var yh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var vh=e=>e.excerptLength?.length;m();d();f();p();var Sh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Ah=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var bh=e=>e.sortCriteria;var wh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:qe(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function wh(_x67){return _ref28.apply(this,arguments)}}(),Ch=(e,t)=>{let r=Yr(e)?.q,{aq:n,cq:i,dq:o,lq:s}=CR(e),a=eh(e),c=tn(e.configuration.analytics,t,{actionCause:id(e)}),u=od(e),h=Gl(e),v=Pl(e)??[],S=Eh(e),g=sd(e.tabSet)||"default",y=kl(e),C=Pg(e),x=t.referrer||"",E=Sh(e),_=bh(e),I=wR(e),k=vh(e),T=Ah(e),F=yh(e);return{q:r,...(n&&{aq:n}),...(i&&{cq:i}),...(o&&{dq:o}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:ig(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:rd(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:C,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...I,...(T??{}),...(k&&{excerptLength:k}),...(F&&{dictionaryFieldContext:F}),sortCriteria:_,...(E&&{facetOptions:E}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},xh=(e,t)=>{let r=Yr(e)?.q,n=Eh(e),i=tn(e.configuration.analytics,t,{actionCause:id(e)}),o=kl(e),s=od(e),a=Gl(e),c=Pl(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:c,...(s?.length&&{searchHub:s}),...(a?.length&&{pipeline:a}),...i,locale:o}},Eh=e=>ya(e)?.map(t=>Zl(t,Jl())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),wR=e=>({actionsHistory:e.configuration.analytics.enabled?Gt.getInstance().getHistory():[]}),CR=e=>{let t=Zg(e),r=nd(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var Sa=["searching","thinking","answering"];function Aa(e){return e.toLowerCase()}m();d();f();p();var Rh=["text/plain","text/markdown"];var ni=new ee({required:!0}),Ih=new ee,ii=new je({required:!0}),ad={id:ni,title:ni,uri:ni,permanentid:ni,clickUri:Ih},ba=new ee({required:!0,constrainTo:Rh}),Th=new ee({required:!0,constrainTo:Sa}),_h=e=>({...e,name:Aa(e.name)}),k$=G("generatedAnswer/setIsVisible",e=>K(e,ii)),wa=G("generatedAnswer/setAnswerId",e=>K(e,te)),O$=G("generatedAnswer/setAnswerGenerationMode",e=>K(e,new ee({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),P$=G("generatedAnswer/setIsEnabled",e=>K(e,ii)),Co=G("generatedAnswer/updateMessage",e=>K(e,{textDelta:ni})),xo=G("generatedAnswer/updateCitations",e=>K(e,{citations:new Ot({required:!0,each:new Ee({values:ad})})})),Eo=G("generatedAnswer/updateError",e=>K(e,{message:Ih,code:new Ve({min:0})})),Ca=G("generatedAnswer/resetAnswer"),N$=G("generatedAnswer/like"),F$=G("generatedAnswer/dislike"),D$=G("generatedAnswer/feedbackModal/open"),M$=G("generatedAnswer/expand"),j$=G("generatedAnswer/collapse"),L$=G("generatedAnswer/setId",e=>K(e,{id:new ee({required:!0})})),q$=G("generatedAnswer/feedbackModal/close"),U$=G("generatedAnswer/sendFeedback"),wr=G("generatedAnswer/setIsLoading",e=>K(e,ii)),wo=G("generatedAnswer/setIsStreaming",e=>K(e,ii)),Ro=G("generatedAnswer/setAnswerContentFormat",e=>K(e,ba)),V$=G("generatedAnswer/updateResponseFormat",e=>K(e,{contentFormat:new Ot({each:ba,default:["text/plain"]})})),B$=G("knowledge/updateAnswerConfigurationId",e=>K(e,ni)),G$=G("generatedAnswer/registerFieldsToIncludeInCitations",e=>K(e,Zf)),cd=G("generatedAnswer/setIsAnswerGenerated",e=>K(e,ii)),Io=G("generatedAnswer/setCannotAnswer",e=>K(e,ii)),xR=G("generatedAnswer/setAnswerApiQueryParams",e=>K(e,new Ee({}))),kh=G("generatedAnswer/startStep",e=>K(_h(e),{name:Th,startedAt:new Ve({min:0,required:!0})})),Oh=G("generatedAnswer/finishStep",e=>K(_h(e),{name:Th,finishedAt:new Ve({min:0,required:!0})})),$$=Ae("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:i,getState:o}=t,{search:s}=o(),{queryExecuted:a}=s,{setAbortControllerRef:c}=e,u=yield wh(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let C=JSON.parse(y);n(Ro(C.contentFormat));break}case"genqa.messageType":n(Co(JSON.parse(y)));break;case"genqa.citationsType":n(xo(JSON.parse(y)));break;case"genqa.endOfStreamType":{let C=JSON.parse(y).answerGenerated,x=o().generatedAnswer.answerId,E=a.length!==0&&!C,_=C?!o().generatedAnswer.answer?.length:void 0;n(Io(E)),n(wo(!1)),n(cd(C)),n(ei(C,x,_)),n(ti());break}default:r.debug&&i.logger.warn(`Unknown payloadType: "${g}"`)}};n(wr(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=i.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(wr(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(Eo(g))},close:()=>{v(u)&&n(wo(!1))},resetAnswer:()=>{v(u)&&n(Ca())}});S?c(S):n(wr(!1))});return function(_x68,_x69){return _ref29.apply(this,arguments)}}()),Q$=Ae("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:i}}){r(Ca());let o=t();if(o.generatedAnswer.answerConfigurationId){let s=Ch(o,n);r(xR(s)),yield r(Ph(s))}else i.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x70,_x71){return _ref30.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function Fh(_x72,_x73){return _Fh.apply(this,arguments)}function _Fh(){_Fh=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Fh.apply(this,arguments)}function Dh(e){let t,r,n,i=!1;return function(s){t===void 0?(t=s,r=0,n=-1):t=RR(t,s);let a=t.length,c=0;for(;r<a;){i&&(t[r]===10&&(c=++r),i=!1);let u=-1;for(;r<a&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:i=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===a?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function Mh(e,t,r){let n=Nh(),i=new TextDecoder;return function(s,a){if(s.length===0)r?.(n),n=Nh();else if(a>0){let c=i.decode(s.subarray(0,a)),u=a+(s[a+1]===32?2:1),h=i.decode(s.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
31
+ ${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":ER(h,n,t);break}}}}function ER(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function RR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Nh(){return{data:"",event:"",id:"",retry:void 0}}var ud="text/event-stream",IR=1e3,jh="last-event-id";function Lh(){return typeof window<"u"}function qh(e,{signal:t,headers:r,onopen:n,onmessage:i,onclose:o,onerror:s,openWhenHidden:a,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=ud);let g;function y(){g?.abort(),document.hidden||k()}!a&&Lh()&&document.addEventListener("visibilitychange",y);let C=IR,x;function E(){Lh()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),g?.abort()}t?.addEventListener("abort",()=>{E(),h()});let _=c??b,I=n??TR;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let T=yield _(e,{...u,headers:S,signal:g?.signal});yield I(T),yield Fh(T.body,Dh(Mh(F=>{F?S[jh]=F:delete S[jh]},F=>{C=F},i))),o?.(),E(),h()}catch(T){if(!g?.signal?.aborted)try{let F=s?.(T)??C;clearTimeout(x),x=setTimeout(k,F)}catch(F){E(),v(F)}}});return _k2.apply(this,arguments)}k()})}function TR(e){let t=e.headers.get("content-type");if(!t?.startsWith(ud))throw new Error(`Expected content-type to be ${ud}, Actual: ${t}`)}m();d();f();p();var _R=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:i,environment:o,organizationId:s}=n.configuration,a=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${i}`}};try{let u=qe(s,o);return{data:$m({baseUrl:`${u}/rest/organizations/${s}/answer/v1/configs/${a}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),b(S,g)});return function fetchFn(_x77){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function _R(_x74,_x75,_x76){return _ref31.apply(this,arguments)}}(),Uh=ng({reducerPath:"answer",baseQuery:Hm(_R,{maxRetries:3}),endpoints:()=>({})});var kR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},OR=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},PR=(e,t)=>{e.citations=t.citations},NR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},FR=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},DR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&FR(t,n);let i=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":i.contentFormat&&(kR(t,i),r(Ro(i.contentFormat)));break;case"genqa.messageType":i.textDelta&&(OR(t,i),r(Co({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(PR(t,i),r(xo({citations:i.citations})));break;case"genqa.endOfStreamType":{NR(t,i);let o=t.answerId,s=i.answerGenerated??!1,a=s?!t.answer?.length:void 0;r(ei(s,o,a)),r(ti());break}}},MR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let i=`/rest/organizations/${t}`,o=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${i}/${o}/${r}/generate`},ld=Uh.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...i}=r;return`${t}(${JSON.stringify(i)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:i,dispatch:o}){yield n;let{configuration:s,generatedAnswer:a,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=s,S=qe(u,h),g=MR(S,u,a.answerConfigurationId,c?.insightId);yield qh(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:b,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let C=y.headers.get("x-answer-id");C&&i(x=>{x.answerId=C,o(wa(C))})});return function onopen(_x80){return _ref33.apply(this,arguments)}}(),onmessage:y=>{i(C=>{DR(y,C,o)})},onerror:y=>{throw y},onclose:()=>{i(y=>{o(Io(!y.generated))})}})}).apply(this,arguments)}})})}),Ph=e=>ld.endpoints.getAnswer.initiate(e);m();d();f();p();var Vh=Ge(Vn,e=>e);m();d();f();p();function jR(e){let t=e.payload?.analyticsAction;return Bh(e)&&!se(t)}function Bh(e){return"type"in e}var Gh=e=>t=>r=>{let n;jR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let i=t(r);return Bh(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),i};m();d();f();p();m();d();f();p();m();d();f();p();var BQ=G("tab/register",e=>{let t=new Ee({values:{id:te,expression:Pt}});return K(e,t)}),$h=G("tab/updateActiveTab",e=>K(e,te));m();d();f();p();var xa=_t(ga(),1),zh=_t(Qh(),1),Wh=_t(Hh(),1);xa.default.extend(Wh.default);xa.default.extend(zh.default);var Kh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:xa.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var LR=/(^|; )Coveo-Pendragon=([^;]*)/,qR=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Yh(){return typeof window>"u"?!1:LR.exec(document.cookie)?.pop()||null}function Xh(){return typeof window>"u"?!1:qR.test(document.cookie)}var Jh=Ge(Kh(),e=>e.addCase(Bn,(t,r)=>{UR(t,r.payload)}).addCase(Ns,(t,r)=>{VR(t,r.payload)}).addCase(Fs,(t,r)=>{BR(t,r.payload)}).addCase(Ds,t=>{t.analytics.enabled=!1}).addCase(Ms,t=>{t.analytics.enabled=!0}).addCase(lm,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(dm,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase($h,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(im,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ks,(t,r)=>{se(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(pm,(t,{payload:r})=>{GR(t,r)}));function UR(e,t){se(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",se(t.organizationId)||(e.organizationId=t.organizationId)}function VR(e,t){se(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),se(t.locale)||(e.search.locale=t.locale),se(t.timezone)||(e.search.timezone=t.timezone),se(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function BR(e,t){se(t.enabled)||(e.analytics.enabled=t.enabled),se(t.originContext)||(e.analytics.originContext=t.originContext),se(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),se(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),se(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),se(t.trackingId)||(e.analytics.trackingId=t.trackingId),se(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),se(t.source)||(e.analytics.source=t.source);try{let r=Yh();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}se(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),se(t.anonymous)||(e.analytics.anonymous=t.anonymous),se(t.deviceId)||(e.analytics.deviceId=t.deviceId),se(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),se(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function GR(e,t){e.knowledge.agentId=t;try{let r=Xh();se(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var yt=Jh;m();d();f();p();function $R(e){return e.instantlyCallable}var Zh=()=>e=>t=>e($R(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function ey(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}m();d();f();p();var gd,QR=new Uint8Array(16);function hd(){if(!gd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gd=crypto.getRandomValues.bind(crypto)}return gd(QR)}m();d();f();p();m();d();f();p();var HR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yd={randomUUID:HR};function zR(e,t,r){if(yd.randomUUID&&!t&&!e)return yd.randomUUID();e=e||{};let n=e.random??e.rng?.()??hd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return ey(n)}var Cr=zR;m();d();f();p();m();d();f();p();var R={};$o(R,{BRAND:()=>SI,DIRTY:()=>rn,EMPTY_PATH:()=>XR,INVALID:()=>ae,NEVER:()=>nT,OK:()=>ot,ParseStatus:()=>tt,Schema:()=>me,ZodAny:()=>Rr,ZodArray:()=>dr,ZodBigInt:()=>on,ZodBoolean:()=>sn,ZodBranded:()=>_o,ZodCatch:()=>yn,ZodDate:()=>an,ZodDefault:()=>hn,ZodDiscriminatedUnion:()=>Ia,ZodEffects:()=>xt,ZodEnum:()=>mn,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>ce,ZodFunction:()=>_a,ZodIntersection:()=>dn,ZodIssueCode:()=>z,ZodLazy:()=>pn,ZodLiteral:()=>fn,ZodMap:()=>li,ZodNaN:()=>pi,ZodNativeEnum:()=>gn,ZodNever:()=>Ft,ZodNull:()=>un,ZodNullable:()=>Ht,ZodNumber:()=>nn,ZodObject:()=>lt,ZodOptional:()=>wt,ZodParsedType:()=>Z,ZodPipeline:()=>ko,ZodPromise:()=>Ir,ZodReadonly:()=>vn,ZodRecord:()=>Ta,ZodSchema:()=>me,ZodSet:()=>di,ZodString:()=>Er,ZodSymbol:()=>ci,ZodTransformer:()=>xt,ZodTuple:()=>Qt,ZodType:()=>me,ZodUndefined:()=>cn,ZodUnion:()=>ln,ZodUnknown:()=>lr,ZodVoid:()=>ui,addIssueToContext:()=>X,any:()=>TI,array:()=>PI,bigint:()=>CI,boolean:()=>dy,coerce:()=>rT,custom:()=>cy,date:()=>xI,datetimeRegex:()=>sy,defaultErrorMap:()=>cr,discriminatedUnion:()=>MI,effect:()=>WI,enum:()=>QI,function:()=>BI,getErrorMap:()=>oi,getParsedType:()=>$t,instanceof:()=>bI,intersection:()=>jI,isAborted:()=>Ea,isAsync:()=>si,isDirty:()=>Ra,isValid:()=>xr,late:()=>AI,lazy:()=>GI,literal:()=>$I,makeIssue:()=>To,map:()=>UI,nan:()=>wI,nativeEnum:()=>HI,never:()=>kI,null:()=>II,nullable:()=>YI,number:()=>ly,object:()=>NI,objectUtil:()=>vd,oboolean:()=>tT,onumber:()=>eT,optional:()=>KI,ostring:()=>ZI,pipeline:()=>JI,preprocess:()=>XI,promise:()=>zI,quotelessJson:()=>WR,record:()=>qI,set:()=>VI,setErrorMap:()=>YR,strictObject:()=>FI,string:()=>uy,symbol:()=>EI,transformer:()=>WI,tuple:()=>LI,undefined:()=>RI,union:()=>DI,unknown:()=>_I,util:()=>ye,void:()=>OI});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var ye;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ye||(ye={}));var vd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(vd||(vd={}));var Z=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$t=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}};var z=ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),WR=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ut=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=e=>new ut(e);var KR=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ye.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case z.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,ye.assertNever(e)}return{message:r}},cr=KR;var ty=cr;function YR(e){ty=e}function oi(){return ty}m();d();f();p();var To=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...(i.path||[])],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},XR=[];function X(e,t){let r=oi(),n=To({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===cr?void 0:cr].filter(i=>!!i)});e.common.issues.push(n)}var tt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let i of r){let o=yield i.key,s=yield i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ae;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ae=Object.freeze({status:"aborted"}),rn=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),Ea=e=>e.status==="aborted",Ra=e=>e.status==="dirty",xr=e=>e.status==="valid",si=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));var Ct=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ry=(e,t)=>{if(xr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(e.common.issues);return this._error=r,this._error}}};function pe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var me=class{get description(){return this._def.description}_getType(t){return $t(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tt,ctx:{common:t.parent.common,data:t.data,parsedType:$t(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(si(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)},i=this._parseSync({data:t,path:n.path,parent:n});return ry(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$t(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return xr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>xr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this7=this;return _asyncToGenerator(function*(){let n=yield _this7.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this8=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:$t(t)},i=_this8._parse({data:t,path:n.path,parent:n}),o=yield si(i)?i:Promise.resolve(i);return ry(n,o)})()}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:z.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new xt({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return wt.create(this,this._def)}nullable(){return Ht.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return Ir.create(this,this._def)}or(t){return ln.create([this,t],this._def)}and(t){return dn.create(this,t,this._def)}transform(t){return new xt({...pe(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new hn({...pe(this._def),innerType:this,defaultValue:r,typeName:ce.ZodDefault})}brand(){return new _o({typeName:ce.ZodBranded,type:this,...pe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new yn({...pe(this._def),innerType:this,catchValue:r,typeName:ce.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ko.create(this,t)}readonly(){return vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},JR=/^c[^\s-]{8,}$/i,ZR=/^[0-9a-z]+$/,eI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rI=/^[a-z0-9_-]{21}$/i,nI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sd,aI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,uI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,iy="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fI=new RegExp(`^${iy}$`);function oy(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function mI(e){return new RegExp(`^${oy(e)}$`)}function sy(e){let t=`${iy}T${oy(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function gI(e,t){return!!((t==="v4"||!t)&&aI.test(e)||(t==="v6"||!t)&&uI.test(e))}function hI(e,t){if(!nI.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function yI(e,t){return!!((t==="v4"||!t)&&cI.test(e)||(t==="v6"||!t)&&lI.test(e))}var Er=class e extends me{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.string,received:o.parsedType}),ae}let n=new tt,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?X(i,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&X(i,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")oI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"email",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Sd||(Sd=new RegExp(sI,"u")),Sd.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"emoji",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")tI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"uuid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")rI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"nanoid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")JR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cuid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")ZR.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cuid2",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")eI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"ulid",code:z.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),X(i,{validation:"url",code:z.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"regex",code:z.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?sy(o).test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?fI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?mI(o).test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:z.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?iI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"duration",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?gI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"ip",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?hI(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"jwt",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?yI(t.data,o.version)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"cidr",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?dI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"base64",code:z.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?pI.test(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{validation:"base64url",code:z.invalid_string,message:o.message}),n.dirty()):ye.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:z.invalid_string,...re.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Er.create=e=>new Er({checks:[],typeName:ce.ZodString,coerce:e?.coerce??!1,...pe(e)});function vI(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var nn=class e extends me{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.number,received:o.parsedType}),ae}let n,i=new tt;for(let o of this._def.checks)o.kind==="int"?ye.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),X(n,{code:z.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?vI(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_finite,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ye.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};nn.create=e=>new nn({checks:[],typeName:ce.ZodNumber,coerce:e?.coerce||!1,...pe(e)});var on=class e extends me{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let n,i=new tt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),X(n,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ye.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return X(r,{code:z.invalid_type,expected:Z.bigint,received:r.parsedType}),ae}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};on.create=e=>new on({checks:[],typeName:ce.ZodBigInt,coerce:e?.coerce??!1,...pe(e)});var sn=class extends me{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.boolean,received:n.parsedType}),ae}return ot(t.data)}};sn.create=e=>new sn({typeName:ce.ZodBoolean,coerce:e?.coerce||!1,...pe(e)});var an=class e extends me{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_type,expected:Z.date,received:o.parsedType}),ae}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return X(o,{code:z.invalid_date}),ae}let n=new tt,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),X(i,{code:z.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ye.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:ce.ZodDate,...pe(e)});var ci=class extends me{_parse(t){if(this._getType(t)!==Z.symbol){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.symbol,received:n.parsedType}),ae}return ot(t.data)}};ci.create=e=>new ci({typeName:ce.ZodSymbol,...pe(e)});var cn=class extends me{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.undefined,received:n.parsedType}),ae}return ot(t.data)}};cn.create=e=>new cn({typeName:ce.ZodUndefined,...pe(e)});var un=class extends me{_parse(t){if(this._getType(t)!==Z.null){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.null,received:n.parsedType}),ae}return ot(t.data)}};un.create=e=>new un({typeName:ce.ZodNull,...pe(e)});var Rr=class extends me{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}};Rr.create=e=>new Rr({typeName:ce.ZodAny,...pe(e)});var lr=class extends me{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}};lr.create=e=>new lr({typeName:ce.ZodUnknown,...pe(e)});var Ft=class extends me{_parse(t){let r=this._getOrReturnCtx(t);return X(r,{code:z.invalid_type,expected:Z.never,received:r.parsedType}),ae}};Ft.create=e=>new Ft({typeName:ce.ZodNever,...pe(e)});var ui=class extends me{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.void,received:n.parsedType}),ae}return ot(t.data)}};ui.create=e=>new ui({typeName:ce.ZodVoid,...pe(e)});var dr=class e extends me{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==Z.array)return X(r,{code:z.invalid_type,expected:Z.array,received:r.parsedType}),ae;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(X(r,{code:s?z.too_big:z.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(X(r,{code:z.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(X(r,{code:z.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Ct(r,s,r.path,a)))).then(s=>tt.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Ct(r,s,r.path,a)));return tt.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};dr.create=(e,t)=>new dr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...pe(t)});function ai(e){if(e instanceof lt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wt.create(ai(n))}return new lt({...e._def,shape:()=>t})}else return e instanceof dr?new dr({...e._def,type:ai(e.element)}):e instanceof wt?wt.create(ai(e.unwrap())):e instanceof Ht?Ht.create(ai(e.unwrap())):e instanceof Qt?Qt.create(e.items.map(t=>ai(t))):e}var lt=class e extends me{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ye.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return X(u,{code:z.invalid_type,expected:Z.object,received:u.parsedType}),ae}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let h=o[u],v=i.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new Ct(i,v,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ft){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of a)c.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(u==="strict")a.length>0&&(X(i,{code:z.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of a){let v=i.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new Ct(i,v,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>tt.mergeObjectSync(n,u)):tt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??i}:{message:i}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ye.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ye.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ai(this)}partial(t){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ye.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof wt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return ay(ye.objectKeys(this.shape))}};lt.create=(e,t)=>new lt({shape:()=>e,unknownKeys:"strip",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});lt.strictCreate=(e,t)=>new lt({shape:()=>e,unknownKeys:"strict",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});lt.lazycreate=(e,t)=>new lt({shape:e,unknownKeys:"strip",catchall:Ft.create(),typeName:ce.ZodObject,...pe(t)});var ln=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new ut(a.ctx.common.issues));return X(r,{code:z.invalid_union,unionErrors:s}),ae}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(o){let s={...r,common:{...r.common,issues:[]},parent:null};return{result:yield o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}});return function(_x81){return _ref35.apply(this,arguments)}}())).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new ut(c));return X(r,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}};ln.create=(e,t)=>new ln({options:e,typeName:ce.ZodUnion,...pe(t)});var ur=e=>e instanceof pn?ur(e.schema):e instanceof xt?ur(e.innerType()):e instanceof fn?[e.value]:e instanceof mn?e.options:e instanceof gn?ye.objectValues(e.enum):e instanceof hn?ur(e._def.innerType):e instanceof cn?[void 0]:e instanceof un?[null]:e instanceof wt?[void 0,...ur(e.unwrap())]:e instanceof Ht?[null,...ur(e.unwrap())]:e instanceof _o||e instanceof vn?ur(e.unwrap()):e instanceof yn?ur(e._def.innerType):[],Ia=class e extends me{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return X(r,{code:z.invalid_type,expected:Z.object,received:r.parsedType}),ae;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(X(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=ur(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:ce.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...pe(n)})}};function Ad(e,t){let r=$t(e),n=$t(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){let i=ye.objectKeys(t),o=ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=Ad(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=Ad(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var dn=class extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Ea(o)||Ea(s))return ae;let a=Ad(o.value,s.value);return a.valid?((Ra(o)||Ra(s))&&r.dirty(),{status:r.value,value:a.data}):(X(n,{code:z.invalid_intersection_types}),ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};dn.create=(e,t,r)=>new dn({left:e,right:t,typeName:ce.ZodIntersection,...pe(r)});var Qt=class e extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return X(n,{code:z.invalid_type,expected:Z.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return X(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(X(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ct(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>tt.mergeArray(r,s)):tt.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Qt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qt({items:e,typeName:ce.ZodTuple,rest:null,...pe(t)})};var Ta=class e extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.object)return X(n,{code:z.invalid_type,expected:Z.object,received:n.parsedType}),ae;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Ct(n,a,n.path,a)),value:s._parse(new Ct(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?tt.mergeObjectAsync(r,i):tt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof me?new e({keyType:t,valueType:r,typeName:ce.ZodRecord,...pe(n)}):new e({keyType:Er.create(),valueType:t,typeName:ce.ZodRecord,...pe(r)})}},li=class extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return X(n,{code:z.invalid_type,expected:Z.map,received:n.parsedType}),ae;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new Ct(n,a,n.path,[u,"key"])),value:o._parse(new Ct(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of s){let u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return ae;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}))}else{let a=new Map;for(let c of s){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return ae;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(u.value,h.value)}return{status:r.value,value:a}}}};li.create=(e,t,r)=>new li({valueType:t,keyType:e,typeName:ce.ZodMap,...pe(r)});var di=class e extends me{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return X(n,{code:z.invalid_type,expected:Z.set,received:n.parsedType}),ae;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(X(n,{code:z.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(X(n,{code:z.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let h of c){if(h.status==="aborted")return ae;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new Ct(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};di.create=(e,t)=>new di({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...pe(t)});var _a=class e extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return X(r,{code:z.invalid_type,expected:Z.function,received:r.parsedType}),ae;function n(a,c){return To({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),cr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function i(a,c){return To({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),cr].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ir){let a=this;return ot(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new ut([]),h=yield a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(s,this,h);return yield a._def.returns._def.type.parseAsync(v,o).catch(g=>{throw u.addIssue(i(v,g)),u})}))}else{let a=this;return ot(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new ut([n(c,u.error)]);let h=Reflect.apply(s,this,u.data),v=a._def.returns.safeParse(h,o);if(!v.success)throw new ut([i(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Qt.create(t).rest(lr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Qt.create([]).rest(lr.create()),returns:r||lr.create(),typeName:ce.ZodFunction,...pe(n)})}},pn=class extends me{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};pn.create=(e,t)=>new pn({getter:e,typeName:ce.ZodLazy,...pe(t)});var fn=class extends me{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return X(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};fn.create=(e,t)=>new fn({value:e,typeName:ce.ZodLiteral,...pe(t)});function ay(e,t){return new mn({values:e,typeName:ce.ZodEnum,...pe(t)})}var mn=class e extends me{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return X(r,{expected:ye.joinValues(n),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return X(r,{received:r.data,code:z.invalid_enum_value,options:n}),ae}return ot(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};mn.create=ay;var gn=class extends me{_parse(t){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let i=ye.objectValues(r);return X(n,{expected:ye.joinValues(i),received:n.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ye.objectValues(r);return X(n,{received:n.data,code:z.invalid_enum_value,options:i}),ae}return ot(t.data)}get enum(){return this._def.values}};gn.create=(e,t)=>new gn({values:e,typeName:ce.ZodNativeEnum,...pe(t)});var Ir=class extends me{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return X(r,{code:z.invalid_type,expected:Z.promise,received:r.parsedType}),ae;let n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return ot(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ir.create=(e,t)=>new Ir({type:e,typeName:ce.ZodPromise,...pe(t)});var xt=class extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{X(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(a){if(r.value==="aborted")return ae;let c=yield _this9._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ae:c.status==="dirty"?rn(c.value):r.value==="dirty"?rn(c.value):c});return function(_x82){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return ae;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ae:a.status==="dirty"?rn(a.value):r.value==="dirty"?rn(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xr(s))return ae;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>xr(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ae);ye.assertNever(i)}};xt.create=(e,t,r)=>new xt({schema:e,typeName:ce.ZodEffects,effect:t,...pe(r)});xt.createWithPreprocess=(e,t,r)=>new xt({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...pe(r)});var wt=class extends me{_parse(t){return this._getType(t)===Z.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};wt.create=(e,t)=>new wt({innerType:e,typeName:ce.ZodOptional,...pe(t)});var Ht=class extends me{_parse(t){return this._getType(t)===Z.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ht.create=(e,t)=>new Ht({innerType:e,typeName:ce.ZodNullable,...pe(t)});var hn=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...pe(t)});var yn=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return si(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...pe(t)});var pi=class extends me{_parse(t){if(this._getType(t)!==Z.nan){let n=this._getOrReturnCtx(t);return X(n,{code:z.invalid_type,expected:Z.nan,received:n.parsedType}),ae}return{status:"valid",value:t.data}}};pi.create=e=>new pi({typeName:ce.ZodNaN,...pe(e)});var SI=Symbol("zod_brand"),_o=class extends me{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ko=class e extends me{_parse(t){var _this0=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let o=yield _this0._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:o.status==="dirty"?(r.dirty(),rn(o.value)):_this0._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ae:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ce.ZodPipeline})}},vn=class extends me{_parse(t){let r=this._def.innerType._parse(t),n=i=>(xr(i)&&(i.value=Object.freeze(i.value)),i);return si(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};vn.create=(e,t)=>new vn({innerType:e,typeName:ce.ZodReadonly,...pe(t)});function ny(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function cy(e,t={},r){return e?Rr.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=ny(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=ny(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Rr.create()}var AI={object:lt.lazycreate},ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ce||(ce={}));var bI=(e,t={message:`Input not instance of ${e.name}`})=>cy(r=>r instanceof e,t),uy=Er.create,ly=nn.create,wI=pi.create,CI=on.create,dy=sn.create,xI=an.create,EI=ci.create,RI=cn.create,II=un.create,TI=Rr.create,_I=lr.create,kI=Ft.create,OI=ui.create,PI=dr.create,NI=lt.create,FI=lt.strictCreate,DI=ln.create,MI=Ia.create,jI=dn.create,LI=Qt.create,qI=Ta.create,UI=li.create,VI=di.create,BI=_a.create,GI=pn.create,$I=fn.create,QI=mn.create,HI=gn.create,zI=Ir.create,WI=xt.create,KI=wt.create,YI=Ht.create,XI=xt.createWithPreprocess,JI=ko.create,ZI=()=>uy().optional(),eT=()=>ly().optional(),tT=()=>dy().optional(),rT={string:e=>Er.create({...e,coerce:!0}),number:e=>nn.create({...e,coerce:!0}),boolean:e=>sn.create({...e,coerce:!0}),bigint:e=>on.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var nT=ae;var iT=R.object({name:R.string(),arguments:R.string()}),oT=R.object({id:R.string(),type:R.literal("function"),function:iT,encryptedValue:R.string().optional()}),ka=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),sT=R.object({type:R.literal("text"),text:R.string()}),py=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),fy=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},Sz=py.superRefine((e,t)=>{fy(e,t)}),aT=R.discriminatedUnion("type",[sT,py]),cT=aT.superRefine((e,t)=>{e.type==="binary"&&fy(e,t)}),uT=ka.extend({role:R.literal("developer"),content:R.string()}),lT=ka.extend({role:R.literal("system"),content:R.string()}),dT=ka.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(oT).optional()}),pT=ka.extend({role:R.literal("user"),content:R.union([R.string(),R.array(cT)])}),fT=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),mT=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),gT=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),my=R.discriminatedUnion("role",[uT,lT,dT,pT,fT,mT,gT]),Az=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),hT=R.object({description:R.string(),value:R.string()}),yT=R.object({name:R.string(),description:R.string(),parameters:R.any()}),vT=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(my),tools:R.array(yT),context:R.array(hT),forwardedProps:R.any()}),ST=R.any(),De=class extends Error{constructor(e){super(e)}},bd=class extends De{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},gy=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),D=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),we=R.object({type:R.nativeEnum(D),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),AT=we.extend({type:R.literal(D.TEXT_MESSAGE_START),messageId:R.string(),role:gy.default("assistant")}),hy=we.extend({type:R.literal(D.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),bT=we.extend({type:R.literal(D.TEXT_MESSAGE_END),messageId:R.string()}),wT=we.extend({type:R.literal(D.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:gy.optional(),delta:R.string().optional()}),CT=we.extend({type:R.literal(D.THINKING_TEXT_MESSAGE_START)}),xT=hy.omit({messageId:!0,type:!0}).extend({type:R.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),ET=we.extend({type:R.literal(D.THINKING_TEXT_MESSAGE_END)}),RT=we.extend({type:R.literal(D.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),IT=we.extend({type:R.literal(D.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),TT=we.extend({type:R.literal(D.TOOL_CALL_END),toolCallId:R.string()}),_T=we.extend({messageId:R.string(),type:R.literal(D.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),kT=we.extend({type:R.literal(D.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),OT=we.extend({type:R.literal(D.THINKING_START),title:R.string().optional()}),PT=we.extend({type:R.literal(D.THINKING_END)}),NT=we.extend({type:R.literal(D.STATE_SNAPSHOT),snapshot:ST}),FT=we.extend({type:R.literal(D.STATE_DELTA),delta:R.array(R.any())}),DT=we.extend({type:R.literal(D.MESSAGES_SNAPSHOT),messages:R.array(my)}),MT=we.extend({type:R.literal(D.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),jT=we.extend({type:R.literal(D.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),LT=we.extend({type:R.literal(D.RAW),event:R.any(),source:R.string().optional()}),qT=we.extend({type:R.literal(D.CUSTOM),name:R.string(),value:R.any()}),UT=we.extend({type:R.literal(D.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:vT.optional()}),VT=we.extend({type:R.literal(D.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),BT=we.extend({type:R.literal(D.RUN_ERROR),message:R.string(),code:R.string().optional()}),GT=we.extend({type:R.literal(D.STEP_STARTED),stepName:R.string()}),$T=we.extend({type:R.literal(D.STEP_FINISHED),stepName:R.string()}),QT=R.union([R.literal("tool-call"),R.literal("message")]),HT=we.extend({type:R.literal(D.REASONING_START),messageId:R.string()}),zT=we.extend({type:R.literal(D.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),WT=we.extend({type:R.literal(D.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),KT=we.extend({type:R.literal(D.REASONING_MESSAGE_END),messageId:R.string()}),YT=we.extend({type:R.literal(D.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),XT=we.extend({type:R.literal(D.REASONING_END),messageId:R.string()}),JT=we.extend({type:R.literal(D.REASONING_ENCRYPTED_VALUE),subtype:QT,entityId:R.string(),encryptedValue:R.string()}),Oa=R.discriminatedUnion("type",[AT,hy,bT,wT,OT,PT,CT,xT,ET,RT,IT,TT,kT,_T,NT,FT,DT,MT,jT,LT,qT,UT,VT,BT,GT,$T,HT,zT,WT,KT,YT,XT,JT]);m();d();f();p();var wd={};$o(wd,{JsonPatchError:()=>Le,_areEquals:()=>No,applyOperation:()=>Sn,applyPatch:()=>Tr,applyReducer:()=>n_,deepClone:()=>t_,getValueByPointer:()=>Ma,validate:()=>vy,validator:()=>ja});m();d();f();p();m();d();f();p();var ZT=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),e_=Object.prototype.hasOwnProperty;function Na(e,t){return e_.call(e,t)}function Fa(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var i in e)Na(e,i)&&n.push(i);return n}function rt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Da(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function zt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Oo(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Pa(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Pa(e[t]))return!0}else if(typeof e=="object"){for(var n=Fa(e),i=n.length,o=0;o<i;o++)if(Pa(e[n[o]]))return!0}}return!1}function yy(e,t){var r=[e];for(var n in t){var i=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
32
+ `)}var Po=function(e){ZT(t,e);function t(r,n,i,o,s){var a=this.constructor,c=e.call(this,yy(r,{name:n,index:i,operation:o,tree:s}))||this;return c.name=n,c.index=i,c.operation=o,c.tree=s,Object.setPrototypeOf(c,a.prototype),c.message=yy(r,{name:n,index:i,operation:o,tree:s}),c}return t}(Error);var Le=Po,t_=rt,fi={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ma(r,this.path);n&&(n=rt(n));var i=Sn(r,{op:"remove",path:this.from}).removed;return Sn(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ma(r,this.from);return Sn(r,{op:"add",path:this.path,value:rt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:No(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},r_={add:function(e,t,r){return Da(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:fi.move,copy:fi.copy,test:fi.test,_get:fi._get};function Ma(e,t){if(t=="")return e;var r={op:"_get",path:t};return Sn(e,r),r.value}function Sn(e,t,r,n,i,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):ja(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ma(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=No(e,t.value),s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new Le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return s}}else{n||(e=rt(e));var a=t.path||"",c=a.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=ja;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=Oo(g)),i&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!Da(g))throw new Le("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);Da(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Le("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var s=r_[t.op].call(t,u,g,e);if(s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}}else if(h>=v){var s=fi[t.op].call(t,u,g,e);if(s.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Le("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}function Tr(e,t,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(t))throw new Le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=rt(e));for(var o=new Array(t.length),s=0,a=t.length;s<a;s++)o[s]=Sn(e,t[s],r,!0,i,s),e=o[s].newDocument;return o.newDocument=e,o}function n_(e,t,r){var n=Sn(e,t);if(n.test===!1)throw new Le("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function ja(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Le("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(fi[e.op]){if(typeof e.path!="string")throw new Le("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Le("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Le("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Pa(e.value))throw new Le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var i=e.path.split("/").length,o=n.split("/").length;if(i!==o+1&&i!==o)throw new Le("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Le("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=vy([s],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Le("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function vy(e,t,r){try{if(!Array.isArray(e))throw new Le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Tr(rt(t),rt(e),r||!0);else{r=r||ja;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(i){if(i instanceof Le)return i;throw i}}function No(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),i,o,s;if(r&&n){if(o=e.length,o!=t.length)return!1;for(i=o;i--!==0;)if(!No(e[i],t[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(e);if(o=a.length,o!==Object.keys(t).length)return!1;for(i=o;i--!==0;)if(!t.hasOwnProperty(a[i]))return!1;for(i=o;i--!==0;)if(s=a[i],!No(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Rd={};$o(Rd,{compare:()=>d_,generate:()=>Cd,observe:()=>l_,unobserve:()=>u_});m();d();f();p();var xd=new WeakMap,i_=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),o_=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function s_(e){return xd.get(e)}function a_(e,t){return e.observers.get(t)}function c_(e,t){e.observers.delete(t.callback)}function u_(e,t){t.unobserve()}function l_(e,t){var r=[],n,i=s_(e);if(!i)i=new i_(e),xd.set(e,i);else{var o=a_(i,t);n=o&&o.observer}if(n)return n;if(n={},i.value=rt(e),t){n.callback=t,n.next=null;var s=function(){Cd(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=e,n.unobserve=function(){Cd(n),clearTimeout(n.next),c_(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new o_(t,n)),n}function Cd(e,t){t===void 0&&(t=!1);var r=xd.get(e.object);Ed(r.value,e.object,e.patches,"",t),e.patches.length&&Tr(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Ed(e,t,r,n,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=Fa(t),s=Fa(e),a=!1,c=!1,u=s.length-1;u>=0;u--){var h=s[u],v=e[h];if(Na(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?Ed(v,S,r,n+"/"+zt(h),i):v!==S&&(a=!0,i&&r.push({op:"test",path:n+"/"+zt(h),value:rt(v)}),r.push({op:"replace",path:n+"/"+zt(h),value:rt(S)}))}else Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+zt(h),value:rt(v)}),r.push({op:"remove",path:n+"/"+zt(h)}),c=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),a=!0)}if(!(!c&&o.length==s.length))for(var u=0;u<o.length;u++){var h=o[u];!Na(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+zt(h),value:rt(t[h])})}}}function d_(e,t,r){r===void 0&&(r=!1);var n=[];return Ed(e,t,n,"",r),n}var Qz=Object.assign({},wd,Rd,{JsonPatchError:Po,deepClone:rt,escapePathComponent:zt,unescapePathComponent:Oo});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Id=function(e,t){return Id=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Id(e,t)};function Wt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Id(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Sy(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{u(n.next(h))}catch(v){s(v)}}function c(h){try{u(n.throw(h))}catch(v){s(v)}}function u(h){h.done?o(h.value):i(h.value).then(a,c)}u((n=n.apply(e,t||[])).next())})}function La(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function pr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-->0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function gi(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function An(e){return this instanceof An?(this.v=e,this):new An(e)}function Ay(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(y){return Promise.resolve(y).then(g,v)}}function a(g,y){n[g]&&(i[g]=function(C){return new Promise(function(x,E){o.push([g,C,x,E])>1||c(g,C)})},y&&(i[g]=y(i[g])))}function c(g,y){try{u(n[g](y))}catch(C){S(o[0][3],C)}}function u(g){g.value instanceof An?Promise.resolve(g.value.v).then(h,v):S(o[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function by(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof pr=="function"?pr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}m();d();f();p();function he(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function hi(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var qa=hi(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
33
33
  `+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
34
- `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Fo(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var yi=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=pr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(C){t={error:C}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(he(h))try{h()}catch(C){o=C instanceof qa?C.errors:[C]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=pr(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{wy(y)}catch(C){o=o??[],C instanceof qa?o=gi(gi([],mi(o)),mi(C.errors)):o.push(C)}}}catch(C){n={error:C}}finally{try{g&&!g.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}}if(o)throw new qa(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)wy(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Fo(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Fo(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Td=yi.EMPTY;function Ua(e){return e instanceof yi||e&&"closed"in e&&he(e.remove)&&he(e.add)&&he(e.unsubscribe)}function wy(e){he(e)?e():e.unsubscribe()}m();d();f();p();var Dt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var vi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=vi.delegate;return i?.setTimeout?i.setTimeout.apply(i,gi([e,t],mi(r))):setTimeout.apply(void 0,gi([e,t],mi(r)))},clearTimeout:function(e){var t=vi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Va(e){vi.setTimeout(function(){var t=Dt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Do(){}m();d();f();p();var Cy=function(){return _d("C",void 0,void 0)}();function xy(e){return _d("E",void 0,e)}function Ey(e){return _d("N",e,void 0)}function _d(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var bn=null;function Si(e){if(Dt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,i=r.error;if(bn=null,n)throw i}}else e()}function Ry(e){Dt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Mo=function(e){Wt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ua(r)&&r.add(n)):n.destination=p_,n}return t.create=function(r,n,i){return new Ga(r,n,i)},t.prototype.next=function(r){this.isStopped?Od(Ey(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Od(xy(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Od(Cy,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(yi);var u_=Function.prototype.bind;function kd(e,t){return u_.call(e,t)}var l_=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Ba(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ba(n)}else Ba(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ba(r)}},e}(),Ga=function(e){Wt(t,e);function t(r,n,i){var o=e.call(this)||this,s;if(he(r)||!r)s={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;o&&Dt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return o.unsubscribe()},s={next:r.next&&kd(r.next,a),error:r.error&&kd(r.error,a),complete:r.complete&&kd(r.complete,a)}):s=r}return o.destination=new l_(s),o}return t}(Mo);function Ba(e){Dt.useDeprecatedSynchronousErrorHandling?Ry(e):Va(e)}function d_(e){throw e}function Od(e,t){var r=Dt.onStoppedNotification;r&&vi.setTimeout(function(){return r(e,t)})}var p_={closed:!0,next:Do,error:d_,complete:Do};m();d();f();p();var Ai=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function bi(e){return e}function $a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pd(e)}function Pd(e){return e.length===0?bi:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var Pe=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=m_(t)?t:new Ga(t,r,n);return Si(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Iy(r),new r(function(i,o){var s=new Ga({next:function(a){try{t(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Ai]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Pd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Iy(t),new t(function(n,i){var o;r.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function Iy(e){var t;return(t=e??Dt.Promise)!==null&&t!==void 0?t:Promise}function f_(e){return e&&he(e.next)&&he(e.error)&&he(e.complete)}function m_(e){return e&&e instanceof Mo||f_(e)&&Ua(e)}m();d();f();p();function g_(e){return he(e?.lift)}function Be(e){return function(t){if(g_(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function ze(e,t,r,n,i){return new h_(e,t,r,n,i)}var h_=function(e){Wt(t,e);function t(r,n,i,o,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(h){r.error(h)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Mo);m();d();f();p();m();d();f();p();var Ty=hi(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Kt=function(e){Wt(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new _y(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ty},t.prototype.next=function(r){var n=this;Si(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=pr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Si(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Si(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?Td:(this.currentObservers=null,a.push(r),new yi(function(){n.currentObservers=null,Fo(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?r.error(o):s&&r.complete()},t.prototype.asObservable=function(){var r=new Pe;return r.source=this,r},t.create=function(r,n){return new _y(r,n)},t}(Pe);var _y=function(e){Wt(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Td},t}(Kt);m();d();f();p();m();d();f();p();var Nd={now:function(){return(Nd.delegate||Date).now()},delegate:void 0};var Qa=function(e){Wt(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=Nd);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;i||(o.push(r),!s&&o.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=o?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<o.length&&o.splice(0,o.length-a),!s){for(var c=i.now(),u=0,h=1;h<o.length&&o[h]<=c;h+=2)u=h;u&&o.splice(0,u+1)}},t}(Kt);m();d();f();p();var Ha=new Pe(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function ky(e){return e&&he(e.schedule)}function y_(e){return e[e.length-1]}function Oy(e){return ky(y_(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var za=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Wa(e){return he(e?.then)}m();d();f();p();function Ka(e){return he(e[Ai])}m();d();f();p();function Ya(e){return Symbol.asyncIterator&&he(e?.[Symbol.asyncIterator])}m();d();f();p();function Xa(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function v_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ja=v_();function Za(e){return he(e?.[Ja])}m();d();f();p();function ec(e){return Ay(this,arguments,function(){var r,n,i,o;return La(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,An(r.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,An(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,An(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function tc(e){return he(e?.getReader)}function We(e){if(e instanceof Pe)return e;if(e!=null){if(Ka(e))return S_(e);if(za(e))return A_(e);if(Wa(e))return b_(e);if(Ya(e))return Py(e);if(Za(e))return w_(e);if(tc(e))return C_(e)}throw Xa(e)}function S_(e){return new Pe(function(t){var r=e[Ai]();if(he(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function A_(e){return new Pe(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function b_(e){return new Pe(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Va)})}function w_(e){return new Pe(function(t){var r,n;try{for(var i=pr(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function Py(e){return new Pe(function(t){x_(e,t).catch(function(r){return t.error(r)})})}function C_(e){return Py(ec(e))}function x_(e,t){var r,n,i,o;return Sy(this,void 0,void 0,function(){var s,a;return La(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=by(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Et(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function rc(e,t){return t===void 0&&(t=0),Be(function(r,n){r.subscribe(ze(n,function(i){return Et(n,e,function(){return n.next(i)},t)},function(){return Et(n,e,function(){return n.complete()},t)},function(i){return Et(n,e,function(){return n.error(i)},t)}))})}m();d();f();p();function nc(e,t){return t===void 0&&(t=0),Be(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Ny(e,t){return We(e).pipe(nc(t),rc(t))}m();d();f();p();function Fy(e,t){return We(e).pipe(nc(t),rc(t))}m();d();f();p();function Dy(e,t){return new Pe(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function My(e,t){return new Pe(function(r){var n;return Et(r,t,function(){n=e[Ja](),Et(r,t,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(o)},0,!0)}),function(){return he(n?.return)&&n.return()}})}m();d();f();p();function ic(e,t){if(!e)throw new Error("Iterable cannot be null");return new Pe(function(r){Et(r,t,function(){var n=e[Symbol.asyncIterator]();Et(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}m();d();f();p();function jy(e,t){return ic(ec(e),t)}function Ly(e,t){if(e!=null){if(Ka(e))return Ny(e,t);if(za(e))return Dy(e,t);if(Wa(e))return Fy(e,t);if(Ya(e))return ic(e,t);if(Za(e))return My(e,t);if(tc(e))return jy(e,t)}throw Xa(e)}function wn(e,t){return t?Ly(e,t):We(e)}function De(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Oy(e);return wn(e,r)}m();d();f();p();function Ne(e,t){var r=he(e)?e:function(){return e},n=function(i){return i.error(r())};return new Pe(t?function(i){return t.schedule(n,0,i)}:n)}m();d();f();p();m();d();f();p();var qy=hi(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function oc(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=!1,s;e.subscribe({next:function(a){s=a,o=!0},error:i,complete:function(){o?n(s):r?n(t.defaultValue):i(new qy)}})})}m();d();f();p();function Cn(e,t){return Be(function(r,n){var i=0;r.subscribe(ze(n,function(o){n.next(e.call(t,o,i++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Uy(e,t,r,n,i,o,s,a){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(C){return u<n?y(C):c.push(C)},y=function(C){o&&t.next(C),u++;var x=!1;We(r(C,h++)).subscribe(ze(t,function(E){i?.(E),o?g(E):t.next(E)},function(){x=!0},void 0,function(){if(x)try{u--;for(var E=function(){var _=c.shift();s?Et(t,s,function(){return y(_)}):y(_)};c.length&&u<n;)E();S()}catch(_){t.error(_)}}))};return e.subscribe(ze(t,g,function(){v=!0,S()})),function(){a?.()}}function dt(e,t,r){return r===void 0&&(r=1/0),he(t)?dt(function(n,i){return Cn(function(o,s){return t(n,o,i,s)})(We(e(n,i)))},r):(typeof t=="number"&&(r=t),Be(function(n,i){return Uy(n,i,e,r)}))}function Fd(e){return e===void 0&&(e=1/0),dt(bi,e)}m();d();f();p();function Dd(e){return new Pe(function(t){We(e()).subscribe(t)})}m();d();f();p();function jo(e){return Be(function(t,r){var n=null,i=!1,o;n=t.subscribe(ze(r,void 0,void 0,function(s){o=We(e(s,jo(e)(t))),n?(n.unsubscribe(),n=null,o.subscribe(r)):i=!0})),i&&(n.unsubscribe(),n=null,o.subscribe(r))})}m();d();f();p();function sc(e,t){return he(t)?dt(e,t,1):dt(e,1)}m();d();f();p();function Md(e){return Be(function(t,r){var n=!1;t.subscribe(ze(r,function(i){n=!0,r.next(i)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function xn(e){return Be(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function jd(e,t){return Be(function(r,n){var i=null,o=0,s=!1,a=function(){return s&&!i&&n.complete()};r.subscribe(ze(n,function(c){i?.unsubscribe();var u=0,h=o++;We(e(c,h)).subscribe(i=ze(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){i=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function ac(e){return Be(function(t,r){We(e).subscribe(ze(r,function(){return r.complete()},Do)),!r.closed&&t.subscribe(r)})}m();d();f();p();function Ld(e,t,r){var n=he(e)||t||r?{next:e,error:t,complete:r}:e;return n?Be(function(i,o){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;i.subscribe(ze(o,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),o.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),o.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),o.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):bi}m();d();f();p();m();d();f();p();function Vy(e){return` \r
35
- `.indexOf(e)>=0}function cc(e){for(var t=["topLevel"],r=0,n,i,o,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,i=t.length,o=_)},u=function(_){_===o&&(n=void 0,i=void 0,o=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():Vy(y)||(u("collectionItem"),a("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Vy(y)||(u("collectionItem"),a("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}i!=null&&(t.length=i);for(var C=[n!=null?e.slice(0,n):e],x=function(_){return C.push(_.slice(e.length-e.lastIndexOf(_[0])))},E=t.length-1;E>=0;E--)switch(t[E]){case"string":C.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":C.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":C.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":C.push("}");break}return C.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function Gy(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function lc(e,t,r){for(let o=0;o<28;o=o+7){let s=e>>>o,a=!(!(s>>>7)&&t==0),c=(a?s|128:s)&255;if(r.push(c),!a)return}let n=e>>>28&15|(t&7)<<4,i=t>>3!=0;if(r.push((i?n|128:n)&255),!!i){for(let o=3;o<31;o=o+7){let s=t>>>o,a=!!(s>>>7),c=(a?s|128:s)&255;if(r.push(c),!a)return}r.push(t>>>31&1)}}var uc=4294967296;function qd(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,i=0;function o(s,a){let c=Number(e.slice(s,a));i*=r,n=n*r+c,n>=uc&&(i=i+(n/uc|0),n=n%uc)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?Qy(n,i):Vd(n,i)}function $y(e,t){let r=Vd(e,t),n=r.hi&2147483648;n&&(r=Qy(r.lo,r.hi));let i=Ud(r.lo,r.hi);return n?"-"+i:i}function Ud(e,t){if({lo:e,hi:t}=E_(e,t),t<=2097151)return String(uc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,i=t>>16&65535,o=r+n*6777216+i*6710656,s=n+i*8147497,a=i*2,c=1e7;return o>=c&&(s+=Math.floor(o/c),o%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+By(s)+By(o)}function E_(e,t){return{lo:e>>>0,hi:t>>>0}}function Vd(e,t){return{lo:e|0,hi:t|0}}function Qy(e,t){return t=~t,e?e=~e+1:t+=1,Vd(e,t)}var By=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Bd(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function Hy(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Mt=R_();function R_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>o||a<i)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),zy(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Wy(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),zy(r),qd(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Wy(r),qd(r)},dec(r,n){return $y(r,n)},uDec(r,n){return Ud(r,n)}}}function zy(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Wy(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Gd=Symbol.for("@bufbuild/protobuf/text-encoding");function $d(){if(A[Gd]==null){let e=new A.TextEncoder,t=new A.TextDecoder;A[Gd]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return A[Gd]}var _r;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(_r||(_r={}));var I_=34028234663852886e22,T_=-34028234663852886e22,__=4294967295,k_=2147483647,O_=-2147483648,Ce=class{constructor(t=$d().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let i=0;i<this.chunks.length;i++)t+=this.chunks[i].length;let r=new Uint8Array(t),n=0;for(let i=0;i<this.chunks.length;i++)r.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(Ky(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Qd(t),Bd(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){P_(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){Ky(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Qd(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Qd(t),t=(t<<1^t>>31)>>>0,Bd(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Mt.enc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Mt.uEnc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(t){let r=Mt.enc(t);return lc(r.lo,r.hi,this.buf),this}sint64(t){let r=Mt.enc(t),n=r.hi>>31,i=r.lo<<1^n,o=(r.hi<<1|r.lo>>>31)^n;return lc(i,o,this.buf),this}uint64(t){let r=Mt.uEnc(t);return lc(r.lo,r.hi,this.buf),this}},ne=class{constructor(t,r=$d().decodeUtf8){this.decodeUtf8=r,this.varint64=Gy,this.uint32=Hy,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case _r.Varint:for(;this.buf[this.pos++]&128;);break;case _r.Bit64:this.pos+=4;case _r.Bit32:this.pos+=4;break;case _r.LengthDelimited:let i=this.uint32();this.pos+=i;break;case _r.StartGroup:for(;;){let[o,s]=this.tag();if(s===_r.EndGroup){if(r!==void 0&&o!==r)throw new Error("invalid end group tag");break}this.skip(s,o)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Mt.dec(...this.varint64())}uint64(){return Mt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Mt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Mt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Mt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function Qd(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>k_||e<O_)throw new Error("invalid int32: "+e)}function Ky(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>__||e<0)throw new Error("invalid uint32: "+e)}function P_(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>I_||e<T_))throw new Error("invalid float32: "+e)}var N_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Hd(){return{fields:{}}}var Lo={encode(e,t=new Ce){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Kd.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Hd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:{if(o!==10)break;let s=Kd.decode(r,r.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Lo.fromPartial(e??{})},fromPartial(e){let t=Hd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,i])=>(i!==void 0&&(r[n]=i),r),{}),t},wrap(e){let t=Hd();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function Yy(){return{key:"",value:void 0}}var Kd={encode(e,t=new Ce){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Yy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.key=r.string();continue;case 2:if(o!==18)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Kd.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.key=e.key??"",t.value=e.value??void 0,t}};function zd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var be={encode(e,t=new Ce){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Lo.encode(Lo.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&qo.encode(qo.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=zd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.nullValue=r.int32();continue;case 2:if(o!==17)break;i.numberValue=r.double();continue;case 3:if(o!==26)break;i.stringValue=r.string();continue;case 4:if(o!==32)break;i.boolValue=r.bool();continue;case 5:if(o!==42)break;i.structValue=Lo.unwrap(Lo.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.listValue=qo.unwrap(qo.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return be.fromPartial(e??{})},fromPartial(e){let t=zd();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=zd();if(e===null)t.nullValue=N_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Wd(){return{values:[]}}var qo={encode(e,t=new Ce){for(let r of e.values)be.encode(be.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Wd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.values.push(be.unwrap(be.decode(r,r.uint32())));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return qo.fromPartial(e??{})},fromPartial(e){let t=Wd();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Wd();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},F_=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Xy(){return{op:0,path:"",from:void 0,value:void 0}}var dc={encode(e,t=new Ce){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Xy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.op=r.int32();continue;case 2:if(o!==18)break;i.path=r.string();continue;case 3:if(o!==26)break;i.from=r.string();continue;case 4:if(o!==34)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=Xy();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Jy(){return{id:"",type:"",function:void 0}}var pc={encode(e,t=new Ce){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&fc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Jy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.type=r.string();continue;case 3:if(o!==26)break;i.function=fc.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=Jy();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?fc.fromPartial(e.function):void 0,t}};function Zy(){return{name:"",arguments:""}}var fc={encode(e,t=new Ce){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Zy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.name=r.string();continue;case 2:if(o!==18)break;i.arguments=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function ev(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var mc={encode(e,t=new Ce){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)pc.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=ev();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.role=r.string();continue;case 3:if(o!==26)break;i.content=r.string();continue;case 4:if(o!==34)break;i.name=r.string();continue;case 5:if(o!==42)break;i.toolCalls.push(pc.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.toolCallId=r.string();continue;case 7:if(o!==58)break;i.error=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=ev();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>pc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},D_=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function tv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var oe={encode(e,t=new Ce){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&be.encode(be.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=tv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.type=r.int32();continue;case 2:if(o!==16)break;i.timestamp=M_(r.int64());continue;case 3:if(o!==26)break;i.rawEvent=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=tv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function rv(){return{baseEvent:void 0,messageId:"",role:void 0}}var gc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=rv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=rv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function nv(){return{baseEvent:void 0,messageId:"",delta:""}}var hc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=nv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=nv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function iv(){return{baseEvent:void 0,messageId:""}}var yc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=iv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return yc.fromPartial(e??{})},fromPartial(e){let t=iv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function ov(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var vc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=ov();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return vc.fromPartial(e??{})},fromPartial(e){let t=ov();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function sv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Sc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=sv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Sc.fromPartial(e??{})},fromPartial(e){let t=sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function av(){return{baseEvent:void 0,toolCallId:""}}var Ac={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=av();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ac.fromPartial(e??{})},fromPartial(e){let t=av();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function cv(){return{baseEvent:void 0,snapshot:void 0}}var bc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&be.encode(be.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=cv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.snapshot=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return bc.fromPartial(e??{})},fromPartial(e){let t=cv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function uv(){return{baseEvent:void 0,delta:[]}}var wc={encode(e,t=new Ce){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)dc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=uv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.delta.push(dc.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=uv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>dc.fromPartial(r))||[],t}};function lv(){return{baseEvent:void 0,messages:[]}}var Cc={encode(e,t=new Ce){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)mc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=lv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messages.push(mc.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=lv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>mc.fromPartial(r))||[],t}};function dv(){return{baseEvent:void 0,event:void 0,source:void 0}}var xc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&be.encode(be.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=dv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.event=be.unwrap(be.decode(r,r.uint32()));continue;case 3:if(o!==26)break;i.source=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=dv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function pv(){return{baseEvent:void 0,name:"",value:void 0}}var Ec={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=pv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.name=r.string();continue;case 3:if(o!==26)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=pv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function fv(){return{baseEvent:void 0,threadId:"",runId:""}}var Rc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=fv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=fv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function mv(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Ic={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&be.encode(be.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=mv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue;case 4:if(o!==34)break;i.result=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=mv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function gv(){return{baseEvent:void 0,code:void 0,message:""}}var Tc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=gv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.code=r.string();continue;case 3:if(o!==26)break;i.message=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=gv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function hv(){return{baseEvent:void 0,stepName:""}}var _c={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=hv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=hv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function yv(){return{baseEvent:void 0,stepName:""}}var kc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=yv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function vv(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var Oc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=vv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue;case 4:if(o!==34)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=vv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function Sv(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Pc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Sv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue;case 5:if(o!==42)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=Sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function Av(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var bv={encode(e,t=new Ce){return e.textMessageStart!==void 0&&gc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&hc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&yc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&vc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Sc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ac.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&bc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Cc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&xc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ec.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Rc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ic.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Tc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&_c.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&kc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Oc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Pc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Av();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.textMessageStart=gc.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.textMessageContent=hc.decode(r,r.uint32());continue;case 3:if(o!==26)break;i.textMessageEnd=yc.decode(r,r.uint32());continue;case 4:if(o!==34)break;i.toolCallStart=vc.decode(r,r.uint32());continue;case 5:if(o!==42)break;i.toolCallArgs=Sc.decode(r,r.uint32());continue;case 6:if(o!==50)break;i.toolCallEnd=Ac.decode(r,r.uint32());continue;case 7:if(o!==58)break;i.stateSnapshot=bc.decode(r,r.uint32());continue;case 8:if(o!==66)break;i.stateDelta=wc.decode(r,r.uint32());continue;case 9:if(o!==74)break;i.messagesSnapshot=Cc.decode(r,r.uint32());continue;case 10:if(o!==82)break;i.raw=xc.decode(r,r.uint32());continue;case 11:if(o!==90)break;i.custom=Ec.decode(r,r.uint32());continue;case 12:if(o!==98)break;i.runStarted=Rc.decode(r,r.uint32());continue;case 13:if(o!==106)break;i.runFinished=Ic.decode(r,r.uint32());continue;case 14:if(o!==114)break;i.runError=Tc.decode(r,r.uint32());continue;case 15:if(o!==122)break;i.stepStarted=_c.decode(r,r.uint32());continue;case 16:if(o!==130)break;i.stepFinished=kc.decode(r,r.uint32());continue;case 17:if(o!==138)break;i.textMessageChunk=Oc.decode(r,r.uint32());continue;case 18:if(o!==146)break;i.toolCallChunk=Pc.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return bv.fromPartial(e??{})},fromPartial(e){let t=Av();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?gc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?hc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?yc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?vc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Sc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ac.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?bc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Cc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?xc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ec.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Rc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ic.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Tc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?_c.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?kc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Oc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Pc.fromPartial(e.toolCallChunk):void 0,t}};function M_(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function wv(e){let t=bv.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=D_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let i=n;i.toolCalls?.length===0&&(i.toolCalls=void 0)}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=F_[n.op].toLowerCase(),Object.keys(n).forEach(i=>{n[i]===void 0&&delete n[i]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Oa.parse(r)}var Cv="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var L_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Yd=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(L_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},xv=e=>e==="*"||e==="x"||e==="X",Ev=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},q_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],U_=(e,t)=>{if(xv(e)||xv(t))return 0;let[r,n]=q_(Ev(e),Ev(t));return r>n?1:r<n?-1:0},Xd=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=U_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Nc=(e,t)=>{let r=Yd(e),n=Yd(t),i=r.pop(),o=n.pop(),s=Xd(r,n);return s!==0?s:i&&o?Xd(i.split("."),o.split(".")):i||o?i?-1:1:0};var Ie=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Uo(){return Cr()}function Re(_x83,_x84,_x85,_x86){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(e,t,r,n){let i=t,o=r,s;for(let a of e)try{let c=yield n(a,Ie(i),Ie(o));if(c===void 0)continue;if(c.messages!==void 0&&(i=c.messages),c.state!==void 0&&(o=c.state),s=c.stopPropagation,s===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(i)===JSON.stringify(t)?{}:{messages:i}),...(JSON.stringify(o)===JSON.stringify(r)?{}:{state:o}),...(s===void 0?{}:{stopPropagation:s})}});return _Re.apply(this,arguments)}var Ov=(e,t,r,n)=>{let i=Ie(r.messages),o=Ie(e.state),s={},a=u=>{u.messages!==void 0&&(i=u.messages,s.messages=u.messages),u.state!==void 0&&(o=u.state,s.state=u.state)},c=()=>{let u=Ie(s);return s={},u.messages!==void 0||u.state!==void 0?De(u):Ha};return t.pipe(sc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(u){let h=yield Re(n,i,o,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(a(h),h.stopPropagation===!0)return c();switch(u.type){case D.TEXT_MESSAGE_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!i.find(y=>y.id===S)){let y={id:S,role:g,content:""};i.push(y),a({messages:i})}}return c()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Re(n,i,o,(C,x,E)=>C.onTextMessageContentEvent?.({event:u,messages:x,state:E,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case D.TEXT_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Re(n,i,o,(g,y,C)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case D.TOOL_CALL_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,C;y&&i.length>0&&i[i.length-1].id===y?C=i[i.length-1]:(C={id:y||S,role:"assistant",toolCalls:[]},i.push(C)),C.toolCalls??(C.toolCalls=[]),C.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),a({messages:i})}return c()}case D.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=i.find(x=>x.toolCalls?.some(E=>E.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(x=>x.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let C=yield Re(n,i,o,(x,E,_)=>{let I=y.function.arguments,k=y.function.name,T={};try{T=cc(I)}catch{}return x.onToolCallArgsEvent?.({event:u,messages:E,state:_,agent:r,input:e,toolCallBuffer:I,toolCallName:k,partialToolCallArgs:T})});return a(C),C.stopPropagation!==!0&&(y.function.arguments+=S,a({messages:i})),c()}case D.TOOL_CALL_END:{let{toolCallId:v}=u,S=i.find(y=>y.toolCalls?.some(C=>C.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(a(yield Re(n,i,o,(y,C,x)=>{let E=g.function.arguments,_=g.function.name,I={};try{I=JSON.parse(E)}catch{}return y.onToolCallEndEvent?.({event:u,messages:C,state:x,agent:r,input:e,toolCallName:_,toolCallArgs:I})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case D.TOOL_CALL_RESULT:{let v=yield Re(n,i,o,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:C}=u,x={id:S,toolCallId:g,role:C||"tool",content:y};i.push(x),yield Promise.all(n.map(E=>{E.onNewMessage?.({message:x,messages:i,state:o,agent:r,input:e})})),a({messages:i})}return c()}case D.STATE_SNAPSHOT:{let v=yield Re(n,i,o,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{snapshot:S}=u;o=S,a({state:o})}return c()}case D.STATE_DELTA:{let v=yield Re(n,i,o,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{delta:S}=u;try{o=Tr(o,S,!0,!1).newDocument,a({state:o})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
34
+ `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Fo(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var yi=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=pr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(C){t={error:C}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(he(h))try{h()}catch(C){o=C instanceof qa?C.errors:[C]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=pr(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{wy(y)}catch(C){o=o??[],C instanceof qa?o=gi(gi([],mi(o)),mi(C.errors)):o.push(C)}}}catch(C){n={error:C}}finally{try{g&&!g.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}}if(o)throw new qa(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)wy(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Fo(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Fo(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Td=yi.EMPTY;function Ua(e){return e instanceof yi||e&&"closed"in e&&he(e.remove)&&he(e.add)&&he(e.unsubscribe)}function wy(e){he(e)?e():e.unsubscribe()}m();d();f();p();var Dt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var vi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=vi.delegate;return i?.setTimeout?i.setTimeout.apply(i,gi([e,t],mi(r))):setTimeout.apply(void 0,gi([e,t],mi(r)))},clearTimeout:function(e){var t=vi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Va(e){vi.setTimeout(function(){var t=Dt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Do(){}m();d();f();p();var Cy=function(){return _d("C",void 0,void 0)}();function xy(e){return _d("E",void 0,e)}function Ey(e){return _d("N",e,void 0)}function _d(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var bn=null;function Si(e){if(Dt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,i=r.error;if(bn=null,n)throw i}}else e()}function Ry(e){Dt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Mo=function(e){Wt(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ua(r)&&r.add(n)):n.destination=h_,n}return t.create=function(r,n,i){return new Ga(r,n,i)},t.prototype.next=function(r){this.isStopped?Od(Ey(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Od(xy(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Od(Cy,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(yi);var f_=Function.prototype.bind;function kd(e,t){return f_.call(e,t)}var m_=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Ba(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ba(n)}else Ba(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ba(r)}},e}(),Ga=function(e){Wt(t,e);function t(r,n,i){var o=e.call(this)||this,s;if(he(r)||!r)s={next:r??void 0,error:n??void 0,complete:i??void 0};else{var a;o&&Dt.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return o.unsubscribe()},s={next:r.next&&kd(r.next,a),error:r.error&&kd(r.error,a),complete:r.complete&&kd(r.complete,a)}):s=r}return o.destination=new m_(s),o}return t}(Mo);function Ba(e){Dt.useDeprecatedSynchronousErrorHandling?Ry(e):Va(e)}function g_(e){throw e}function Od(e,t){var r=Dt.onStoppedNotification;r&&vi.setTimeout(function(){return r(e,t)})}var h_={closed:!0,next:Do,error:g_,complete:Do};m();d();f();p();var Ai=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function bi(e){return e}function $a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pd(e)}function Pd(e){return e.length===0?bi:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var Pe=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=v_(t)?t:new Ga(t,r,n);return Si(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Iy(r),new r(function(i,o){var s=new Ga({next:function(a){try{t(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Ai]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Pd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Iy(t),new t(function(n,i){var o;r.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function Iy(e){var t;return(t=e??Dt.Promise)!==null&&t!==void 0?t:Promise}function y_(e){return e&&he(e.next)&&he(e.error)&&he(e.complete)}function v_(e){return e&&e instanceof Mo||y_(e)&&Ua(e)}m();d();f();p();function S_(e){return he(e?.lift)}function Be(e){return function(t){if(S_(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function ze(e,t,r,n,i){return new A_(e,t,r,n,i)}var A_=function(e){Wt(t,e);function t(r,n,i,o,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=n?function(u){try{n(u)}catch(h){r.error(h)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Mo);m();d();f();p();m();d();f();p();var Ty=hi(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Kt=function(e){Wt(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new _y(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ty},t.prototype.next=function(r){var n=this;Si(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=pr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Si(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Si(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?Td:(this.currentObservers=null,a.push(r),new yi(function(){n.currentObservers=null,Fo(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?r.error(o):s&&r.complete()},t.prototype.asObservable=function(){var r=new Pe;return r.source=this,r},t.create=function(r,n){return new _y(r,n)},t}(Pe);var _y=function(e){Wt(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Td},t}(Kt);m();d();f();p();m();d();f();p();var Nd={now:function(){return(Nd.delegate||Date).now()},delegate:void 0};var Qa=function(e){Wt(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=Nd);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;i||(o.push(r),!s&&o.push(a.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),c=0;c<a.length&&!r.closed;c+=o?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,s=r._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<o.length&&o.splice(0,o.length-a),!s){for(var c=i.now(),u=0,h=1;h<o.length&&o[h]<=c;h+=2)u=h;u&&o.splice(0,u+1)}},t}(Kt);m();d();f();p();var Ha=new Pe(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function ky(e){return e&&he(e.schedule)}function b_(e){return e[e.length-1]}function Oy(e){return ky(b_(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var za=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Wa(e){return he(e?.then)}m();d();f();p();function Ka(e){return he(e[Ai])}m();d();f();p();function Ya(e){return Symbol.asyncIterator&&he(e?.[Symbol.asyncIterator])}m();d();f();p();function Xa(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function w_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ja=w_();function Za(e){return he(e?.[Ja])}m();d();f();p();function ec(e){return Ay(this,arguments,function(){var r,n,i,o;return La(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,An(r.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,An(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,An(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function tc(e){return he(e?.getReader)}function We(e){if(e instanceof Pe)return e;if(e!=null){if(Ka(e))return C_(e);if(za(e))return x_(e);if(Wa(e))return E_(e);if(Ya(e))return Py(e);if(Za(e))return R_(e);if(tc(e))return I_(e)}throw Xa(e)}function C_(e){return new Pe(function(t){var r=e[Ai]();if(he(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function x_(e){return new Pe(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function E_(e){return new Pe(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Va)})}function R_(e){return new Pe(function(t){var r,n;try{for(var i=pr(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function Py(e){return new Pe(function(t){T_(e,t).catch(function(r){return t.error(r)})})}function I_(e){return Py(ec(e))}function T_(e,t){var r,n,i,o;return Sy(this,void 0,void 0,function(){var s,a;return La(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=by(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Et(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function rc(e,t){return t===void 0&&(t=0),Be(function(r,n){r.subscribe(ze(n,function(i){return Et(n,e,function(){return n.next(i)},t)},function(){return Et(n,e,function(){return n.complete()},t)},function(i){return Et(n,e,function(){return n.error(i)},t)}))})}m();d();f();p();function nc(e,t){return t===void 0&&(t=0),Be(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Ny(e,t){return We(e).pipe(nc(t),rc(t))}m();d();f();p();function Fy(e,t){return We(e).pipe(nc(t),rc(t))}m();d();f();p();function Dy(e,t){return new Pe(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function My(e,t){return new Pe(function(r){var n;return Et(r,t,function(){n=e[Ja](),Et(r,t,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(o)},0,!0)}),function(){return he(n?.return)&&n.return()}})}m();d();f();p();function ic(e,t){if(!e)throw new Error("Iterable cannot be null");return new Pe(function(r){Et(r,t,function(){var n=e[Symbol.asyncIterator]();Et(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}m();d();f();p();function jy(e,t){return ic(ec(e),t)}function Ly(e,t){if(e!=null){if(Ka(e))return Ny(e,t);if(za(e))return Dy(e,t);if(Wa(e))return Fy(e,t);if(Ya(e))return ic(e,t);if(Za(e))return My(e,t);if(tc(e))return jy(e,t)}throw Xa(e)}function wn(e,t){return t?Ly(e,t):We(e)}function Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Oy(e);return wn(e,r)}m();d();f();p();function Ne(e,t){var r=he(e)?e:function(){return e},n=function(i){return i.error(r())};return new Pe(t?function(i){return t.schedule(n,0,i)}:n)}m();d();f();p();m();d();f();p();var qy=hi(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function oc(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=!1,s;e.subscribe({next:function(a){s=a,o=!0},error:i,complete:function(){o?n(s):r?n(t.defaultValue):i(new qy)}})})}m();d();f();p();function Cn(e,t){return Be(function(r,n){var i=0;r.subscribe(ze(n,function(o){n.next(e.call(t,o,i++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Uy(e,t,r,n,i,o,s,a){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(C){return u<n?y(C):c.push(C)},y=function(C){o&&t.next(C),u++;var x=!1;We(r(C,h++)).subscribe(ze(t,function(E){i?.(E),o?g(E):t.next(E)},function(){x=!0},void 0,function(){if(x)try{u--;for(var E=function(){var _=c.shift();s?Et(t,s,function(){return y(_)}):y(_)};c.length&&u<n;)E();S()}catch(_){t.error(_)}}))};return e.subscribe(ze(t,g,function(){v=!0,S()})),function(){a?.()}}function dt(e,t,r){return r===void 0&&(r=1/0),he(t)?dt(function(n,i){return Cn(function(o,s){return t(n,o,i,s)})(We(e(n,i)))},r):(typeof t=="number"&&(r=t),Be(function(n,i){return Uy(n,i,e,r)}))}function Fd(e){return e===void 0&&(e=1/0),dt(bi,e)}m();d();f();p();function Dd(e){return new Pe(function(t){We(e()).subscribe(t)})}m();d();f();p();function jo(e){return Be(function(t,r){var n=null,i=!1,o;n=t.subscribe(ze(r,void 0,void 0,function(s){o=We(e(s,jo(e)(t))),n?(n.unsubscribe(),n=null,o.subscribe(r)):i=!0})),i&&(n.unsubscribe(),n=null,o.subscribe(r))})}m();d();f();p();function sc(e,t){return he(t)?dt(e,t,1):dt(e,1)}m();d();f();p();function Md(e){return Be(function(t,r){var n=!1;t.subscribe(ze(r,function(i){n=!0,r.next(i)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function xn(e){return Be(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function jd(e,t){return Be(function(r,n){var i=null,o=0,s=!1,a=function(){return s&&!i&&n.complete()};r.subscribe(ze(n,function(c){i?.unsubscribe();var u=0,h=o++;We(e(c,h)).subscribe(i=ze(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){i=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function ac(e){return Be(function(t,r){We(e).subscribe(ze(r,function(){return r.complete()},Do)),!r.closed&&t.subscribe(r)})}m();d();f();p();function Ld(e,t,r){var n=he(e)||t||r?{next:e,error:t,complete:r}:e;return n?Be(function(i,o){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;i.subscribe(ze(o,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),o.next(c)},function(){var c;a=!1,(c=n.complete)===null||c===void 0||c.call(n),o.complete()},function(c){var u;a=!1,(u=n.error)===null||u===void 0||u.call(n,c),o.error(c)},function(){var c,u;a&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):bi}m();d();f();p();m();d();f();p();function Vy(e){return` \r
35
+ `.indexOf(e)>=0}function cc(e){for(var t=["topLevel"],r=0,n,i,o,s=function(_){return t.push(_)},a=function(_){return t[t.length-1]=_},c=function(_){n==null&&(n=r,i=t.length,o=_)},u=function(_){_===o&&(n=void 0,i=void 0,o=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(_){if("0"<=_&&_<="9"){s("number");return}switch(_){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():Vy(y)||(u("collectionItem"),a("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Vy(y)||(u("collectionItem"),a("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),a("objectNeedsKey"));break}}i!=null&&(t.length=i);for(var C=[n!=null?e.slice(0,n):e],x=function(_){return C.push(_.slice(e.length-e.lastIndexOf(_[0])))},E=t.length-1;E>=0;E--)switch(t[E]){case"string":C.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":C.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":C.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":C.push("}");break}return C.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function Gy(){let e=0,t=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function lc(e,t,r){for(let o=0;o<28;o=o+7){let s=e>>>o,a=!(!(s>>>7)&&t==0),c=(a?s|128:s)&255;if(r.push(c),!a)return}let n=e>>>28&15|(t&7)<<4,i=t>>3!=0;if(r.push((i?n|128:n)&255),!!i){for(let o=3;o<31;o=o+7){let s=t>>>o,a=!!(s>>>7),c=(a?s|128:s)&255;if(r.push(c),!a)return}r.push(t>>>31&1)}}var uc=4294967296;function qd(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,i=0;function o(s,a){let c=Number(e.slice(s,a));i*=r,n=n*r+c,n>=uc&&(i=i+(n/uc|0),n=n%uc)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?Qy(n,i):Vd(n,i)}function $y(e,t){let r=Vd(e,t),n=r.hi&2147483648;n&&(r=Qy(r.lo,r.hi));let i=Ud(r.lo,r.hi);return n?"-"+i:i}function Ud(e,t){if({lo:e,hi:t}=__(e,t),t<=2097151)return String(uc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,i=t>>16&65535,o=r+n*6777216+i*6710656,s=n+i*8147497,a=i*2,c=1e7;return o>=c&&(s+=Math.floor(o/c),o%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+By(s)+By(o)}function __(e,t){return{lo:e>>>0,hi:t>>>0}}function Vd(e,t){return{lo:e|0,hi:t|0}}function Qy(e,t){return t=~t,e?e=~e+1:t+=1,Vd(e,t)}var By=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Bd(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function Hy(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Mt=k_();function k_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>o||a<i)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),zy(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Wy(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),zy(r),qd(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Wy(r),qd(r)},dec(r,n){return $y(r,n)},uDec(r,n){return Ud(r,n)}}}function zy(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Wy(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Gd=Symbol.for("@bufbuild/protobuf/text-encoding");function $d(){if(A[Gd]==null){let e=new A.TextEncoder,t=new A.TextDecoder;A[Gd]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return A[Gd]}var _r;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(_r||(_r={}));var O_=34028234663852886e22,P_=-34028234663852886e22,N_=4294967295,F_=2147483647,D_=-2147483648,Ce=class{constructor(t=$d().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let i=0;i<this.chunks.length;i++)t+=this.chunks[i].length;let r=new Uint8Array(t),n=0;for(let i=0;i<this.chunks.length;i++)r.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(Ky(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Qd(t),Bd(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){M_(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){Ky(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Qd(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Qd(t),t=(t<<1^t>>31)>>>0,Bd(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Mt.enc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),i=Mt.uEnc(t);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(t){let r=Mt.enc(t);return lc(r.lo,r.hi,this.buf),this}sint64(t){let r=Mt.enc(t),n=r.hi>>31,i=r.lo<<1^n,o=(r.hi<<1|r.lo>>>31)^n;return lc(i,o,this.buf),this}uint64(t){let r=Mt.uEnc(t);return lc(r.lo,r.hi,this.buf),this}},ne=class{constructor(t,r=$d().decodeUtf8){this.decodeUtf8=r,this.varint64=Gy,this.uint32=Hy,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case _r.Varint:for(;this.buf[this.pos++]&128;);break;case _r.Bit64:this.pos+=4;case _r.Bit32:this.pos+=4;break;case _r.LengthDelimited:let i=this.uint32();this.pos+=i;break;case _r.StartGroup:for(;;){let[o,s]=this.tag();if(s===_r.EndGroup){if(r!==void 0&&o!==r)throw new Error("invalid end group tag");break}this.skip(s,o)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Mt.dec(...this.varint64())}uint64(){return Mt.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Mt.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Mt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Mt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function Qd(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>F_||e<D_)throw new Error("invalid int32: "+e)}function Ky(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>N_||e<0)throw new Error("invalid uint32: "+e)}function M_(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>O_||e<P_))throw new Error("invalid float32: "+e)}var j_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Hd(){return{fields:{}}}var Lo={encode(e,t=new Ce){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Kd.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Hd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:{if(o!==10)break;let s=Kd.decode(r,r.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Lo.fromPartial(e??{})},fromPartial(e){let t=Hd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,i])=>(i!==void 0&&(r[n]=i),r),{}),t},wrap(e){let t=Hd();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function Yy(){return{key:"",value:void 0}}var Kd={encode(e,t=new Ce){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Yy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.key=r.string();continue;case 2:if(o!==18)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Kd.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.key=e.key??"",t.value=e.value??void 0,t}};function zd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var be={encode(e,t=new Ce){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Lo.encode(Lo.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&qo.encode(qo.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=zd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.nullValue=r.int32();continue;case 2:if(o!==17)break;i.numberValue=r.double();continue;case 3:if(o!==26)break;i.stringValue=r.string();continue;case 4:if(o!==32)break;i.boolValue=r.bool();continue;case 5:if(o!==42)break;i.structValue=Lo.unwrap(Lo.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.listValue=qo.unwrap(qo.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return be.fromPartial(e??{})},fromPartial(e){let t=zd();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=zd();if(e===null)t.nullValue=j_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Wd(){return{values:[]}}var qo={encode(e,t=new Ce){for(let r of e.values)be.encode(be.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Wd();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.values.push(be.unwrap(be.decode(r,r.uint32())));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return qo.fromPartial(e??{})},fromPartial(e){let t=Wd();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Wd();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},L_=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Xy(){return{op:0,path:"",from:void 0,value:void 0}}var dc={encode(e,t=new Ce){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Xy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.op=r.int32();continue;case 2:if(o!==18)break;i.path=r.string();continue;case 3:if(o!==26)break;i.from=r.string();continue;case 4:if(o!==34)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=Xy();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Jy(){return{id:"",type:"",function:void 0}}var pc={encode(e,t=new Ce){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&fc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Jy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.type=r.string();continue;case 3:if(o!==26)break;i.function=fc.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=Jy();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?fc.fromPartial(e.function):void 0,t}};function Zy(){return{name:"",arguments:""}}var fc={encode(e,t=new Ce){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Zy();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.name=r.string();continue;case 2:if(o!==18)break;i.arguments=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function ev(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var mc={encode(e,t=new Ce){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)pc.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=ev();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.id=r.string();continue;case 2:if(o!==18)break;i.role=r.string();continue;case 3:if(o!==26)break;i.content=r.string();continue;case 4:if(o!==34)break;i.name=r.string();continue;case 5:if(o!==42)break;i.toolCalls.push(pc.decode(r,r.uint32()));continue;case 6:if(o!==50)break;i.toolCallId=r.string();continue;case 7:if(o!==58)break;i.error=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=ev();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>pc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},q_=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function tv(){return{type:0,timestamp:void 0,rawEvent:void 0}}var oe={encode(e,t=new Ce){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&be.encode(be.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=tv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==8)break;i.type=r.int32();continue;case 2:if(o!==16)break;i.timestamp=U_(r.int64());continue;case 3:if(o!==26)break;i.rawEvent=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=tv();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function rv(){return{baseEvent:void 0,messageId:"",role:void 0}}var gc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=rv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=rv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function nv(){return{baseEvent:void 0,messageId:"",delta:""}}var hc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=nv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=nv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function iv(){return{baseEvent:void 0,messageId:""}}var yc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=iv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return yc.fromPartial(e??{})},fromPartial(e){let t=iv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function ov(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var vc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=ov();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return vc.fromPartial(e??{})},fromPartial(e){let t=ov();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function sv(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Sc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=sv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Sc.fromPartial(e??{})},fromPartial(e){let t=sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function av(){return{baseEvent:void 0,toolCallId:""}}var Ac={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=av();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ac.fromPartial(e??{})},fromPartial(e){let t=av();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function cv(){return{baseEvent:void 0,snapshot:void 0}}var bc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&be.encode(be.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=cv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.snapshot=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return bc.fromPartial(e??{})},fromPartial(e){let t=cv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function uv(){return{baseEvent:void 0,delta:[]}}var wc={encode(e,t=new Ce){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)dc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=uv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.delta.push(dc.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=uv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>dc.fromPartial(r))||[],t}};function lv(){return{baseEvent:void 0,messages:[]}}var Cc={encode(e,t=new Ce){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)mc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=lv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messages.push(mc.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=lv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>mc.fromPartial(r))||[],t}};function dv(){return{baseEvent:void 0,event:void 0,source:void 0}}var xc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&be.encode(be.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=dv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.event=be.unwrap(be.decode(r,r.uint32()));continue;case 3:if(o!==26)break;i.source=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=dv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function pv(){return{baseEvent:void 0,name:"",value:void 0}}var Ec={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&be.encode(be.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=pv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.name=r.string();continue;case 3:if(o!==26)break;i.value=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=pv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function fv(){return{baseEvent:void 0,threadId:"",runId:""}}var Rc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=fv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=fv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function mv(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Ic={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&be.encode(be.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=mv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.threadId=r.string();continue;case 3:if(o!==26)break;i.runId=r.string();continue;case 4:if(o!==34)break;i.result=be.unwrap(be.decode(r,r.uint32()));continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=mv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function gv(){return{baseEvent:void 0,code:void 0,message:""}}var Tc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=gv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.code=r.string();continue;case 3:if(o!==26)break;i.message=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=gv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function hv(){return{baseEvent:void 0,stepName:""}}var _c={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=hv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=hv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function yv(){return{baseEvent:void 0,stepName:""}}var kc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=yv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.stepName=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=yv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function vv(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var Oc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=vv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.messageId=r.string();continue;case 3:if(o!==26)break;i.role=r.string();continue;case 4:if(o!==34)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=vv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function Sv(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Pc={encode(e,t=new Ce){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Sv();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.toolCallId=r.string();continue;case 3:if(o!==26)break;i.toolCallName=r.string();continue;case 4:if(o!==34)break;i.parentMessageId=r.string();continue;case 5:if(o!==42)break;i.delta=r.string();continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=Sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function Av(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var bv={encode(e,t=new Ce){return e.textMessageStart!==void 0&&gc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&hc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&yc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&vc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Sc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ac.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&bc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Cc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&xc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ec.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Rc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ic.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Tc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&_c.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&kc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Oc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Pc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,i=Av();for(;r.pos<n;){let o=r.uint32();switch(o>>>3){case 1:if(o!==10)break;i.textMessageStart=gc.decode(r,r.uint32());continue;case 2:if(o!==18)break;i.textMessageContent=hc.decode(r,r.uint32());continue;case 3:if(o!==26)break;i.textMessageEnd=yc.decode(r,r.uint32());continue;case 4:if(o!==34)break;i.toolCallStart=vc.decode(r,r.uint32());continue;case 5:if(o!==42)break;i.toolCallArgs=Sc.decode(r,r.uint32());continue;case 6:if(o!==50)break;i.toolCallEnd=Ac.decode(r,r.uint32());continue;case 7:if(o!==58)break;i.stateSnapshot=bc.decode(r,r.uint32());continue;case 8:if(o!==66)break;i.stateDelta=wc.decode(r,r.uint32());continue;case 9:if(o!==74)break;i.messagesSnapshot=Cc.decode(r,r.uint32());continue;case 10:if(o!==82)break;i.raw=xc.decode(r,r.uint32());continue;case 11:if(o!==90)break;i.custom=Ec.decode(r,r.uint32());continue;case 12:if(o!==98)break;i.runStarted=Rc.decode(r,r.uint32());continue;case 13:if(o!==106)break;i.runFinished=Ic.decode(r,r.uint32());continue;case 14:if(o!==114)break;i.runError=Tc.decode(r,r.uint32());continue;case 15:if(o!==122)break;i.stepStarted=_c.decode(r,r.uint32());continue;case 16:if(o!==130)break;i.stepFinished=kc.decode(r,r.uint32());continue;case 17:if(o!==138)break;i.textMessageChunk=Oc.decode(r,r.uint32());continue;case 18:if(o!==146)break;i.toolCallChunk=Pc.decode(r,r.uint32());continue}if((o&7)===4||o===0)break;r.skip(o&7)}return i},create(e){return bv.fromPartial(e??{})},fromPartial(e){let t=Av();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?gc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?hc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?yc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?vc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Sc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ac.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?bc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Cc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?xc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ec.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Rc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ic.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Tc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?_c.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?kc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Oc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Pc.fromPartial(e.toolCallChunk):void 0,t}};function U_(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function wv(e){let t=bv.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=q_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let i=n;i.toolCalls?.length===0&&(i.toolCalls=void 0)}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=L_[n.op].toLowerCase(),Object.keys(n).forEach(i=>{n[i]===void 0&&delete n[i]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Oa.parse(r)}var Cv="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var B_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Yd=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(B_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},xv=e=>e==="*"||e==="x"||e==="X",Ev=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},G_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],$_=(e,t)=>{if(xv(e)||xv(t))return 0;let[r,n]=G_(Ev(e),Ev(t));return r>n?1:r<n?-1:0},Xd=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=$_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Nc=(e,t)=>{let r=Yd(e),n=Yd(t),i=r.pop(),o=n.pop(),s=Xd(r,n);return s!==0?s:i&&o?Xd(i.split("."),o.split(".")):i||o?i?-1:1:0};var Ie=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Uo(){return Cr()}function Re(_x83,_x84,_x85,_x86){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(e,t,r,n){let i=t,o=r,s;for(let a of e)try{let c=yield n(a,Ie(i),Ie(o));if(c===void 0)continue;if(c.messages!==void 0&&(i=c.messages),c.state!==void 0&&(o=c.state),s=c.stopPropagation,s===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(i)===JSON.stringify(t)?{}:{messages:i}),...(JSON.stringify(o)===JSON.stringify(r)?{}:{state:o}),...(s===void 0?{}:{stopPropagation:s})}});return _Re.apply(this,arguments)}var Ov=(e,t,r,n)=>{let i=Ie(r.messages),o=Ie(e.state),s={},a=u=>{u.messages!==void 0&&(i=u.messages,s.messages=u.messages),u.state!==void 0&&(o=u.state,s.state=u.state)},c=()=>{let u=Ie(s);return s={},u.messages!==void 0||u.state!==void 0?Me(u):Ha};return t.pipe(sc(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(u){let h=yield Re(n,i,o,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(a(h),h.stopPropagation===!0)return c();switch(u.type){case D.TEXT_MESSAGE_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!i.find(y=>y.id===S)){let y={id:S,role:g,content:""};i.push(y),a({messages:i})}}return c()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Re(n,i,o,(C,x,E)=>C.onTextMessageContentEvent?.({event:u,messages:x,state:E,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case D.TEXT_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Re(n,i,o,(g,y,C)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case D.TOOL_CALL_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,C;y&&i.length>0&&i[i.length-1].id===y?C=i[i.length-1]:(C={id:y||S,role:"assistant",toolCalls:[]},i.push(C)),C.toolCalls??(C.toolCalls=[]),C.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),a({messages:i})}return c()}case D.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=i.find(x=>x.toolCalls?.some(E=>E.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(x=>x.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let C=yield Re(n,i,o,(x,E,_)=>{let I=y.function.arguments,k=y.function.name,T={};try{T=cc(I)}catch{}return x.onToolCallArgsEvent?.({event:u,messages:E,state:_,agent:r,input:e,toolCallBuffer:I,toolCallName:k,partialToolCallArgs:T})});return a(C),C.stopPropagation!==!0&&(y.function.arguments+=S,a({messages:i})),c()}case D.TOOL_CALL_END:{let{toolCallId:v}=u,S=i.find(y=>y.toolCalls?.some(C=>C.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(a(yield Re(n,i,o,(y,C,x)=>{let E=g.function.arguments,_=g.function.name,I={};try{I=JSON.parse(E)}catch{}return y.onToolCallEndEvent?.({event:u,messages:C,state:x,agent:r,input:e,toolCallName:_,toolCallArgs:I})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case D.TOOL_CALL_RESULT:{let v=yield Re(n,i,o,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:C}=u,x={id:S,toolCallId:g,role:C||"tool",content:y};i.push(x),yield Promise.all(n.map(E=>{E.onNewMessage?.({message:x,messages:i,state:o,agent:r,input:e})})),a({messages:i})}return c()}case D.STATE_SNAPSHOT:{let v=yield Re(n,i,o,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{snapshot:S}=u;o=S,a({state:o})}return c()}case D.STATE_DELTA:{let v=yield Re(n,i,o,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{delta:S}=u;try{o=Tr(o,S,!0,!1).newDocument,a({state:o})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
36
36
  Current state: ${JSON.stringify(o,null,2)}
37
37
  Patch operations: ${JSON.stringify(S,null,2)}
38
- Error: ${y}`)}}return c()}case D.MESSAGES_SNAPSHOT:{let v=yield Re(n,i,o,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messages:S}=u;i=S,a({messages:i})}return c()}case D.ACTIVITY_SNAPSHOT:{let v=u,S=i.findIndex(E=>E.id===v.messageId),g=S>=0?i[S]:void 0,y=g?.role==="activity"?g:void 0,C=v.replace??!0,x=yield Re(n,i,o,(E,_,I)=>E.onActivitySnapshotEvent?.({event:v,messages:_,state:I,agent:r,input:e,activityMessage:y,existingMessage:g}));if(a(x),x.stopPropagation!==!0){let E={id:v.messageId,role:"activity",activityType:v.activityType,content:Ie(v.content)},_;S===-1?(i.push(E),_=E):y?C&&(i[S]={...y,activityType:v.activityType,content:Ie(v.content)}):C&&(i[S]=E,_=E),a({messages:i}),_&&(yield Promise.all(n.map(I=>I.onNewMessage?.({message:_,messages:i,state:o,agent:r,input:e}))))}return c()}case D.ACTIVITY_DELTA:{let v=u,S=i.findIndex(x=>x.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=i[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,C=yield Re(n,i,o,(x,E,_)=>x.onActivityDeltaEvent?.({event:v,messages:E,state:_,agent:r,input:e,activityMessage:y}));if(a(C),C.stopPropagation!==!0)try{let x=Ie(y.content??{}),E=Tr(x,v.patch??[],!0,!1).newDocument;i[S]={...y,content:Ie(E),activityType:v.activityType},a({messages:i})}catch(x){let E=x instanceof Error?x.message:String(x);console.warn(`Failed to apply activity patch for '${v.messageId}': ${E}`)}return c()}case D.RAW:return a(yield Re(n,i,o,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.CUSTOM:return a(yield Re(n,i,o,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.RUN_STARTED:{let v=yield Re(n,i,o,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)i.find(y=>y.id===g.id)||i.push(g);a({messages:i})}}return c()}case D.RUN_FINISHED:return a(yield Re(n,i,o,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case D.RUN_ERROR:return a(yield Re(n,i,o,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.STEP_STARTED:return a(yield Re(n,i,o,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.STEP_FINISHED:return a(yield Re(n,i,o,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return c();case D.THINKING_END:return c();case D.THINKING_TEXT_MESSAGE_START:return c();case D.THINKING_TEXT_MESSAGE_CONTENT:return c();case D.THINKING_TEXT_MESSAGE_END:return c();case D.REASONING_START:return a(yield Re(n,i,o,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.REASONING_MESSAGE_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!i.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};i.push(g),a({messages:i})}}return c()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Re(n,i,o,(C,x,E)=>C.onReasoningMessageContentEvent?.({event:u,messages:x,state:E,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case D.REASONING_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Re(n,i,o,(g,y,C)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return a(yield Re(n,i,o,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield Re(n,i,o,(C,x,E)=>C.onReasoningEncryptedValueEvent?.({event:u,messages:x,state:E,agent:r,input:e}));if(a(y),y.stopPropagation!==!0){let C=!1;if(v==="tool-call"){for(let x of i)if(x.role==="assistant"&&x.toolCalls){let E=x.toolCalls.find(_=>_.id===S);if(E){E.encryptedValue=g,C=!0;break}}}else{let x=i.find(E=>E.id===S);x?.role!=="activity"&&x&&(x.encryptedValue=g,C=!0)}C&&(s.messages=i)}return c()}}return u.type,c()});return function(_x87){return _ref40.apply(this,arguments)}}()),Fd(),n.length>0?Md({}):u=>u)},Jd=e=>t=>{let r=new Map,n=new Map,i=!1,o=!1,s=!1,a=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),a.clear(),c=!1,u=!1,i=!1,o=!1,h=!0};return t.pipe(dt(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),o)return Ne(()=>new Fe(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&g!==D.RUN_ERROR&&g!==D.RUN_STARTED)return Ne(()=>new Fe(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(s){if(g===D.RUN_STARTED){if(h&&!i)return Ne(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&v()}}else if(s=!0,g!==D.RUN_STARTED&&g!==D.RUN_ERROR)return Ne(()=>new Fe("First event must be 'RUN_STARTED'"));switch(g){case D.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?Ne(()=>new Fe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),De(S))}case D.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?De(S):Ne(()=>new Fe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),De(S)):Ne(()=>new Fe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?Ne(()=>new Fe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),De(S))}case D.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?De(S):Ne(()=>new Fe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),De(S)):Ne(()=>new Fe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let y=S.stepName;return a.has(y)?Ne(()=>new Fe(`Step "${y}" is already active for 'STEP_STARTED'`)):(a.set(y,!0),De(S))}case D.STEP_FINISHED:{let y=S.stepName;return a.has(y)?(a.delete(y),De(S)):Ne(()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case D.RUN_STARTED:return h=!0,De(S);case D.RUN_FINISHED:if(a.size>0){let y=Array.from(a.keys()).join(", ");return Ne(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return Ne(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return Ne(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return i=!0,De(S);case D.RUN_ERROR:return o=!0,De(S);case D.CUSTOM:return De(S);case D.THINKING_TEXT_MESSAGE_START:return c?u?Ne(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,De(S)):Ne(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return u?De(S):Ne(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return u?(u=!1,De(S)):Ne(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return c?Ne(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,De(S));case D.THINKING_END:return c?(c=!1,De(S)):Ne(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return De(S)}}))},En=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),V_=(e,t)=>Dd(()=>wn(b(e,t))).pipe(jd(r=>{if(!r.ok){let o=r.headers.get("content-type")||"";return wn(r.text()).pipe(dt(s=>{let a=s;if(o.includes("application/json"))try{a=JSON.parse(s)}catch{}let c=Error(`HTTP ${r.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return c.status=r.status,c.payload=a,Ne(()=>c)}))}let n={type:En.HEADERS,status:r.status,headers:r.headers},i=r.body?.getReader();return i?new Pe(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:s,value:a}=yield i.read();if(s)break;let c={type:En.DATA,data:a};o.next(c)}o.complete()}catch(s){o.error(s)}})(),()=>{i.cancel().catch(s=>{if(s?.name!=="AbortError")throw s})})):Ne(()=>Error("Failed to getReader() from response"))})),B_=e=>{let t=new Kt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:o=>{if(o.type!==En.HEADERS&&o.type===En.DATA&&o.data){let s=r.decode(o.data,{stream:!0});n+=s;let a=n.split(/\n\n/);n=a.pop()||"";for(let c of a)i(c)}},error:o=>t.error(o),complete:()=>{n&&(n+=r.decode(),i(n)),t.complete()}});function i(o){let s=o.split(`
38
+ Error: ${y}`)}}return c()}case D.MESSAGES_SNAPSHOT:{let v=yield Re(n,i,o,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messages:S}=u;i=S,a({messages:i})}return c()}case D.ACTIVITY_SNAPSHOT:{let v=u,S=i.findIndex(E=>E.id===v.messageId),g=S>=0?i[S]:void 0,y=g?.role==="activity"?g:void 0,C=v.replace??!0,x=yield Re(n,i,o,(E,_,I)=>E.onActivitySnapshotEvent?.({event:v,messages:_,state:I,agent:r,input:e,activityMessage:y,existingMessage:g}));if(a(x),x.stopPropagation!==!0){let E={id:v.messageId,role:"activity",activityType:v.activityType,content:Ie(v.content)},_;S===-1?(i.push(E),_=E):y?C&&(i[S]={...y,activityType:v.activityType,content:Ie(v.content)}):C&&(i[S]=E,_=E),a({messages:i}),_&&(yield Promise.all(n.map(I=>I.onNewMessage?.({message:_,messages:i,state:o,agent:r,input:e}))))}return c()}case D.ACTIVITY_DELTA:{let v=u,S=i.findIndex(x=>x.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=i[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,C=yield Re(n,i,o,(x,E,_)=>x.onActivityDeltaEvent?.({event:v,messages:E,state:_,agent:r,input:e,activityMessage:y}));if(a(C),C.stopPropagation!==!0)try{let x=Ie(y.content??{}),E=Tr(x,v.patch??[],!0,!1).newDocument;i[S]={...y,content:Ie(E),activityType:v.activityType},a({messages:i})}catch(x){let E=x instanceof Error?x.message:String(x);console.warn(`Failed to apply activity patch for '${v.messageId}': ${E}`)}return c()}case D.RAW:return a(yield Re(n,i,o,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.CUSTOM:return a(yield Re(n,i,o,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.RUN_STARTED:{let v=yield Re(n,i,o,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)i.find(y=>y.id===g.id)||i.push(g);a({messages:i})}}return c()}case D.RUN_FINISHED:return a(yield Re(n,i,o,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case D.RUN_ERROR:return a(yield Re(n,i,o,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.STEP_STARTED:return a(yield Re(n,i,o,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.STEP_FINISHED:return a(yield Re(n,i,o,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return c();case D.THINKING_END:return c();case D.THINKING_TEXT_MESSAGE_START:return c();case D.THINKING_TEXT_MESSAGE_CONTENT:return c();case D.THINKING_TEXT_MESSAGE_END:return c();case D.REASONING_START:return a(yield Re(n,i,o,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.REASONING_MESSAGE_START:{let v=yield Re(n,i,o,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(a(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!i.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};i.push(g),a({messages:i})}}return c()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=i.find(C=>C.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield Re(n,i,o,(C,x,E)=>C.onReasoningMessageContentEvent?.({event:u,messages:x,state:E,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return a(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,a({messages:i})),c()}case D.REASONING_MESSAGE_END:{let{messageId:v}=u,S=i.find(g=>g.id===v);return S?(a(yield Re(n,i,o,(g,y,C)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:C,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:i,state:o,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return a(yield Re(n,i,o,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield Re(n,i,o,(C,x,E)=>C.onReasoningEncryptedValueEvent?.({event:u,messages:x,state:E,agent:r,input:e}));if(a(y),y.stopPropagation!==!0){let C=!1;if(v==="tool-call"){for(let x of i)if(x.role==="assistant"&&x.toolCalls){let E=x.toolCalls.find(_=>_.id===S);if(E){E.encryptedValue=g,C=!0;break}}}else{let x=i.find(E=>E.id===S);x?.role!=="activity"&&x&&(x.encryptedValue=g,C=!0)}C&&(s.messages=i)}return c()}}return u.type,c()});return function(_x87){return _ref40.apply(this,arguments)}}()),Fd(),n.length>0?Md({}):u=>u)},Jd=e=>t=>{let r=new Map,n=new Map,i=!1,o=!1,s=!1,a=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),a.clear(),c=!1,u=!1,i=!1,o=!1,h=!0};return t.pipe(dt(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),o)return Ne(()=>new De(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&g!==D.RUN_ERROR&&g!==D.RUN_STARTED)return Ne(()=>new De(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(s){if(g===D.RUN_STARTED){if(h&&!i)return Ne(()=>new De("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));i&&v()}}else if(s=!0,g!==D.RUN_STARTED&&g!==D.RUN_ERROR)return Ne(()=>new De("First event must be 'RUN_STARTED'"));switch(g){case D.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),Me(S))}case D.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?Me(S):Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),Me(S)):Ne(()=>new De(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?Ne(()=>new De(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),Me(S))}case D.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?Me(S):Ne(()=>new De(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),Me(S)):Ne(()=>new De(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let y=S.stepName;return a.has(y)?Ne(()=>new De(`Step "${y}" is already active for 'STEP_STARTED'`)):(a.set(y,!0),Me(S))}case D.STEP_FINISHED:{let y=S.stepName;return a.has(y)?(a.delete(y),Me(S)):Ne(()=>new De(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case D.RUN_STARTED:return h=!0,Me(S);case D.RUN_FINISHED:if(a.size>0){let y=Array.from(a.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return Ne(()=>new De(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return i=!0,Me(S);case D.RUN_ERROR:return o=!0,Me(S);case D.CUSTOM:return Me(S);case D.THINKING_TEXT_MESSAGE_START:return c?u?Ne(()=>new De("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,Me(S)):Ne(()=>new De("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return u?Me(S):Ne(()=>new De("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return u?(u=!1,Me(S)):Ne(()=>new De("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return c?Ne(()=>new De("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Me(S));case D.THINKING_END:return c?(c=!1,Me(S)):Ne(()=>new De("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Me(S)}}))},En=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),Q_=(e,t)=>Dd(()=>wn(b(e,t))).pipe(jd(r=>{if(!r.ok){let o=r.headers.get("content-type")||"";return wn(r.text()).pipe(dt(s=>{let a=s;if(o.includes("application/json"))try{a=JSON.parse(s)}catch{}let c=Error(`HTTP ${r.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return c.status=r.status,c.payload=a,Ne(()=>c)}))}let n={type:En.HEADERS,status:r.status,headers:r.headers},i=r.body?.getReader();return i?new Pe(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:s,value:a}=yield i.read();if(s)break;let c={type:En.DATA,data:a};o.next(c)}o.complete()}catch(s){o.error(s)}})(),()=>{i.cancel().catch(s=>{if(s?.name!=="AbortError")throw s})})):Ne(()=>Error("Failed to getReader() from response"))})),H_=e=>{let t=new Kt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:o=>{if(o.type!==En.HEADERS&&o.type===En.DATA&&o.data){let s=r.decode(o.data,{stream:!0});n+=s;let a=n.split(/\n\n/);n=a.pop()||"";for(let c of a)i(c)}},error:o=>t.error(o),complete:()=>{n&&(n+=r.decode(),i(n)),t.complete()}});function i(o){let s=o.split(`
39
39
  `),a=[];for(let c of s)c.startsWith("data:")&&a.push(c.slice(5).replace(/^ /,""));if(a.length>0)try{let c=a.join(`
40
- `),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},G_=e=>{let t=new Kt,r=new Uint8Array;e.subscribe({next:i=>{if(i.type!==En.HEADERS&&i.type===En.DATA&&i.data){let o=new Uint8Array(r.length+i.data.length);o.set(r,0),o.set(i.data,r.length),r=o,n()}},error:i=>t.error(i),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let i=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<i)break;try{let o=r.slice(4,i),s=wv(o);t.next(s),r=r.slice(i)}catch(o){let s=o instanceof Error?o.message:String(o);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},$_=e=>{let t=new Kt,r=new Qa,n=!1;return e.subscribe({next:i=>{r.next(i),i.type===En.HEADERS&&!n?(n=!0,i.headers.get("content-type")===Cv?G_(r).subscribe({next:o=>t.next(o),error:o=>t.error(o),complete:()=>t.complete()}):B_(r).subscribe({next:o=>{try{let s=Oa.parse(o);t.next(s)}catch(s){t.error(s)}},error:o=>{if(o?.name==="AbortError"){t.next({type:D.RUN_ERROR,message:o.message||"Request aborted",code:"abort",rawEvent:o}),t.complete();return}return t.error(o)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:i=>{r.error(i),t.error(i)},complete:()=>{r.complete()}}),t.asObservable()},ke=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Q_=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),H_=R.object({type:R.literal(ke.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),z_=R.object({type:R.literal(ke.enum.TextMessageContent),messageId:R.string(),content:R.string()}),W_=R.object({type:R.literal(ke.enum.TextMessageEnd),messageId:R.string()}),K_=R.object({type:R.literal(ke.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),Y_=R.object({type:R.literal(ke.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),X_=R.object({type:R.literal(ke.enum.ActionExecutionEnd),actionExecutionId:R.string()}),J_=R.object({type:R.literal(ke.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),Z_=R.object({type:R.literal(ke.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),ek=R.object({type:R.literal(ke.enum.MetaEvent),name:Q_,value:R.any()}),tk=R.object({type:R.literal(ke.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[H_,z_,W_,K_,Y_,X_,J_,Z_,ek,tk]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var rk=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
- `)},nk=(e,t,r)=>n=>{let i={},o=!0,s=!0,a="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,i=g)};return n.pipe(dt(g=>{switch(g.type){case D.TEXT_MESSAGE_START:{let y=g;return[{type:ke.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:ke.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=g;return[{type:ke.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:ke.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=g,C=h.find(E=>E.id===y.toolCallId);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];C.function.arguments+=y.delta;let x=!1;if(u){let E=u.find(_=>_.tool==C.function.name);if(E)try{let _=JSON.parse(cc(C.function.arguments));E.tool_argument&&E.tool_argument in _?(S({...i,[E.state_key]:_[E.tool_argument]}),x=!0):E.tool_argument||(S({...i,[E.state_key]:_}),x=!0)}catch{}}return[{type:ke.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]:[])]}case D.TOOL_CALL_END:{let y=g;return[{type:ke.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=g;return[{type:ke.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=g;switch(y.name){case"Exit":o=!1;break;case"PredictState":u=y.value;break}return[{type:ke.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return S(g.snapshot),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}];case D.STATE_DELTA:{let y=g,C=Tr(i,y.delta,!0,!1);return C?(S(C.newDocument),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return c=g.messages,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:c}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:ik(c)}:{})}),active:!1}];case D.RUN_ERROR:{let y=g;return[{type:ke.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=g.stepName,h=[],u=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!0}];case D.STEP_FINISHED:return h=[],u=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))};function ik(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=rk(r.content);if(n){let i={id:r.id,role:r.role,content:n};t.push(i)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let i of r.toolCalls){let o={id:i.id,name:i.function.name,arguments:JSON.parse(i.function.arguments),parentMessageId:r.id};t.push(o)}}else if(r.role==="tool"){let n="unknown";for(let o of e)if(o.role==="assistant"&&o.toolCalls?.length){for(let s of o.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let i={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(i)}return t}var Fc=e=>t=>{let r,n,i,o,s=()=>{if(!r||o!=="text")throw Error("No text message to close");let h={type:D.TEXT_MESSAGE_END,messageId:r.messageId};return o=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},a=()=>{if(!n||o!=="tool")throw Error("No tool call to close");let h={type:D.TOOL_CALL_END,toolCallId:n.toolCallId};return o=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!i||o!=="reasoning")throw Error("No reasoning message to close");let h={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return o=void 0,i=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>o==="text"?[s()]:o==="tool"?[a()]:o==="reasoning"?[c()]:[];return t.pipe(dt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...u(),h];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[h];case D.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((o!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),o!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},o="text";let E={type:D.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(E))}if(v.delta!==void 0){let E={type:D.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(E))}return S;case D.TOOL_CALL_CHUNK:let g=h,y=[];if((o!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),o!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},o="tool";let E={type:D.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(E))}if(g.delta!==void 0){let E={type:D.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(E))}return y;case D.REASONING_MESSAGE_CHUNK:let C=h,x=[];if((o!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&x.push(...u()),o!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},o="reasoning";let E={type:D.REASONING_MESSAGE_START,messageId:C.messageId};x.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(E))}if(C.delta!==void 0){let E={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};x.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(E))}return x}return h.type,[]}),xn(()=>{u()}))},Zd=class{runNext(e,t){return t.run(e).pipe(Fc(!1))}runNextWithState(e,t){let r=Ie(e.messages||[]),n=Ie(e.state||{}),i=new Qa;return Ov(e,i,t,[]).subscribe(o=>{o.messages!==void 0&&(r=o.messages),o.state!==void 0&&(n=o.state)}),this.runNext(e,t).pipe(sc(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(o){return i.next(o),yield new Promise(s=>setTimeout(s,0)),{event:o,messages:Ie(r),state:Ie(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},ok=class extends Zd{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function sk(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var ak=class extends Zd{run(e,t){let{parentRunId:r,...n}=e,i={...n,messages:n.messages.map(sk)};return this.runNext(i,t)}},Rv="THINKING_START",Iv="THINKING_END",Tv="THINKING_TEXT_MESSAGE_START",_v="THINKING_TEXT_MESSAGE_CONTENT",kv="THINKING_TEXT_MESSAGE_END",ck=class extends Zd{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Cn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Rv:{this.currentReasoningId=Uo();let{title:t,...r}=e;return this.warnAboutTransformation(Rv,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case Tv:return this.currentMessageId=Uo(),this.warnAboutTransformation(Tv,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case _v:{let{delta:t,...r}=e;return this.warnAboutTransformation(_v,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Uo(),delta:t}}case kv:{let t=this.currentMessageId??Uo();return this.warnAboutTransformation(kv,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case Iv:{let t=this.currentReasoningId??Uo();return this.warnAboutTransformation(Iv,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}},uk="0.0.45",lk=class{get maxVersion(){return uk}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:i,debug:o}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Cr(),this.messages=Ie(n??[]),this.state=Ie(i??{}),this.debug=o??!1,Nc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new ak),Nc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new ck)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new ok(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??Cr();let r=_this1.prepareRunAgentInput(e),n,i=new Set(_this1.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,o),_this1.activeRunDetach$=new Kt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield oc($a(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this1).run(r),Fc(_this1.debug),Jd(_this1.debug),c=>c.pipe(ac(_this1.activeRunDetach$)),c=>_this1.apply(r,c,o),c=>_this1.processApplyEvents(r,c,o),jo(c=>(_this1.isRunning=!1,_this1.onError(r,c,o))),xn(()=>{_this1.isRunning=!1,_this1.onFinalize(r,o),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(De(null)));let a=Ie(_this1.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new bd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??Cr();let r=_this10.prepareRunAgentInput(e),n,i=new Set(_this10.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,o),_this10.activeRunDetach$=new Kt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield oc($a(()=>_this10.connect(r),Fc(_this10.debug),Jd(_this10.debug),c=>c.pipe(ac(_this10.activeRunDetach$)),c=>_this10.apply(r,c,o),c=>_this10.processApplyEvents(r,c,o),jo(c=>(_this10.isRunning=!1,c instanceof bd?Ha:_this10.onError(r,c,o))),xn(()=>{_this10.isRunning=!1,_this10.onFinalize(r,o),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(De(null)));let a=Ie(_this10.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Ov(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(Ld(n=>{n.messages&&(this.messages=n.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ie(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Cr(),tools:Ie(e?.tools??[]),context:Ie(e?.context??[]),forwardedProps:Ie(e?.forwardedProps??{}),state:Ie(this.state),messages:t}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this12.messages,_this12.state,(n,i,o)=>n.onRunInitialized?.({messages:i,state:o,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return wn(Re(r,this.messages,this.state,(n,i,o)=>n.onRunFailed?.({error:t,messages:i,state:o,agent:this,input:e}))).pipe(Cn(n=>{let i=n;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this13.messages,_this13.state,(n,i,o)=>n.onRunFinalized?.({messages:i,state:o,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Ie(this.messages),e.state=Ie(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=Ie(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=Ie(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Cr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:i=>n.run(i,r)}),this).run(t)).pipe(Fc(this.debug),Jd(this.debug),nk(this.threadId,t.runId,this.agentId),r=>r.pipe(Cn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Pv=class extends lk{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Ie(e.headers??{})}run(e){return $_(V_(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Ie(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Nv=(e,t,r)=>{let n=qe(t,r),i=e?.trim();if(!n||!t||!i)throw new Error("Missing required parameters for answer endpoint");let o=`/api/preview/organizations/${t}/agents`;return`${n}${o}/${i}`};var ep=class extends Pv{requestInit(t){let{params:r,accessToken:n,recordDebugSession:i}=t.forwardedProps||{},o={...r,...(i&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(o),signal:this.abortController.signal}}},Fv=(e,t,r)=>new ep({url:`${Nv(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var dk=new ee({required:!0}),Dv=new ee({required:!0,constrainTo:Sa}),Mv=e=>({...e,name:Aa(e.name)}),jv=G("followUpAnswers/setIsEnabled",e=>K(e,new Me({required:!0}))),Lv=G("followUpAnswers/setFollowUpAnswersConversationId",e=>K(e,te)),qv=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>K(e,te)),Uv=G("followUpAnswers/clearFollowUpAnswersConversationToken"),CJ=G("followUpAnswers/createFollowUpAnswer",e=>K(e,{question:te})),xJ=G("followUpAnswers/setActiveFollowUpAnswerId",e=>K(e,te)),EJ=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>K(e,{contentFormat:ba,answerId:te})),RJ=G("followUpAnswers/setFollowUpIsLoading",e=>K(e,{isLoading:new Me({required:!0}),answerId:te})),IJ=G("followUpAnswers/setFollowUpIsStreaming",e=>K(e,{isStreaming:new Me({required:!0}),answerId:te})),TJ=G("followUpAnswers/followUpMessageChunkReceived",e=>K(e,{textDelta:dk,answerId:te})),_J=G("followUpAnswers/followUpCitationsReceived",e=>K(e,{citations:new Ot({required:!0,each:new Ee({values:ad})}),answerId:te})),kJ=G("followUpAnswers/followUpCompleted",e=>K(e,{answerId:te,cannotAnswer:new Me({required:!1})})),OJ=G("followUpAnswers/followUpFailed",e=>K(e,{message:new ee,code:new Ve({min:0}),answerId:te})),PJ=G("followUpAnswers/activeFollowUpStartFailed",e=>K(e,{message:new ee})),NJ=G("followUpAnswers/likeFollowUp",e=>K(e,{answerId:te})),FJ=G("followUpAnswers/dislikeFollowUp",e=>K(e,{answerId:te})),DJ=G("followUpAnswers/submitFollowUpFeedback",e=>K(e,{answerId:te})),Vv=G("followUpAnswers/resetFollowUpAnswers"),MJ=G("followUpAnswers/stepStarted",e=>K(Mv(e),{answerId:te,name:Dv,startedAt:new Ve({min:0,required:!0})})),jJ=G("followUpAnswers/stepFinished",e=>K(Mv(e),{answerId:te,name:Dv,finishedAt:new Ve({min:0,required:!0})}));m();d();f();p();var pk={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:TURN_LIMIT_REACHED":1005};function Bv(e){return e?pk[e]??1004:1004}var Gv=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(wa(n.runId)),e(wr(!1)),e(wo(!0)),e(Lv(n.threadId)),e(Uv())},onStepStartedEvent:({event:n})=>{e(kh({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Oh({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Co({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:i,value:o}=n;switch(i){case"header":{o?.contentFormat&&e(Ro(o.contentFormat)),typeof o?.followUpEnabled=="boolean"&&e(jv(o.followUpEnabled)),o?.conversationToken&&e(qv(o.conversationToken));return}case"citations":{e(xo({citations:o.citations}));return}}},onRunErrorEvent:({event:n})=>{let i=Bv(n.code);e(Eo({message:n.message,code:i}))},onRunFinishedEvent:({event:n})=>{let i=n.result?.completionReason==="ANSWERED",o=i?!r:void 0;e(cd(i)),e(Io(!i)),e(wo(!1)),e(ei(i,t,o,n.threadId)),e(ti())}}};var $v=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,i,o){t();let s=da(n),a=Fg(n),c=Dg(n),u=Ng(n),h=Mg(n),v=Fv(s,a,c);e=v;let S=Gv(i),g=xh(n,o());try{i(wr(!0)),yield v.runAgent({forwardedProps:{params:g,accessToken:u,recordDebugSession:h}},S)}catch(y){i(wr(!1)),i(Eo({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var Qv=G("breadcrumb/deselectAll"),Hv=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var zv=G("facet/updateFacetAutoSelection",e=>K(e,{allow:new Me({required:!0})}));m();d();f();p();m();d();f();p();var Dc=class extends vr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].cache[i];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Nt().q}get responseTime(){return this.activeInstantResultCache?.duration??Bt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Bt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Wv=()=>it("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Dc(e)),Kv=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var tp={id:te},fk={...tp,q:Pt},QZ=G("instantResults/register",e=>K(e,tp)),Mc=G("instantResults/updateQuery",e=>K(e,fk)),HZ=G("instantResults/clearExpired",e=>K(e,tp));m();d();f();p();var jc=new Ve({required:!0,min:0}),tee=G("pagination/registerNumberOfResults",e=>K(e,jc)),ree=G("pagination/updateNumberOfResults",e=>K(e,jc)),nee=G("pagination/registerPage",e=>K(e,jc)),Yv=G("pagination/updatePage",e=>K(e,jc)),iee=G("pagination/nextPage"),oee=G("pagination/previousPage");m();d();f();p();var wi=G("query/updateQuery",e=>K(e,{q:new ee,enableQuerySyntax:new Me}));m();d();f();p();m();d();f();p();m();d();f();p();var Ci=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var rp=()=>it("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),kr=e=>it("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Nt().q,aq:r.advancedSearchQueries?.aq||Ci().aq,cq:r.advancedSearchQueries?.cq||Ci().cq,dq:r.advancedSearchQueries?.dq||Ci().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var Lc=e=>e.success!==void 0,pt=e=>e.error!==void 0;m();d();f();p();var rte=G("didYouMean/enable"),nte=G("didYouMean/disable"),ite=G("didYouMean/automaticCorrections/disable"),ote=G("didYouMean/automaticCorrections/enable"),qc=G("didYouMean/correction",e=>K(e,te)),ste=G("didYouMean/automaticCorrections/mode",e=>K(e,new ee({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var np=()=>it("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Xv=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Jv(){return{contextValues:{}}}m();d();f();p();function Zv(){return{contextValues:{}}}m();d();f();p();function eS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function tS(){return[]}m();d();f();p();function rS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function nS(){return{}}m();d();f();p();function iS(){return{}}m();d();f();p();function oS(){return{}}function Yt(e){return{context:e.context||Jv(),dictionaryFieldContext:e.dictionaryFieldContext||Zv(),facetSet:e.facetSet||la(),numericFacetSet:e.numericFacetSet||ua(),dateFacetSet:e.dateFacetSet||ca(),categoryFacetSet:e.categoryFacetSet||aa(),automaticFacetSet:e.automaticFacetSet??sa(),pagination:e.pagination||rS(),query:e.query||Nt(),tabSet:e.tabSet||oS(),advancedSearchQueries:e.advancedSearchQueries||Ci(),staticFilterSet:e.staticFilterSet||iS(),querySet:e.querySet||nS(),sortCriteria:e.sortCriteria||pa(),pipeline:e.pipeline||ma(),searchHub:e.searchHub||Gn(),facetOptions:e.facetOptions||eS(),facetOrder:e.facetOrder??tS(),debug:e.debug??Os()}}m();d();f();p();var Pre=new Ee({values:{undoneQuery:Pt},options:{required:!0}}),sS=()=>it("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Uc=G("trigger/query/ignore",e=>K(e,new ee({emptyAllowed:!0,required:!0}))),Vc=G("trigger/query/modification",e=>K(e,new Ee({values:{originalQuery:$e,modification:$e}})));m();d();f();p();var Or=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=hk(e),n=ya(e),i=mk(e),o=yield ri(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Sr({...o,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:s(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Or(_x92,_x93){return _ref48.apply(this,arguments)}}();function mk(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(gk).filter(r=>r.currentValues.length>0):void 0}function gk(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function hk(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=yk(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}function yk(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i})}var Pr=class{constructor(t,r=n=>{this.dispatch(wi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=ha(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this18.getState().query?.q||"";return{response:o,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Ut(Yt(_this20.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this21.automaticallyRetryQueryWithCorrection(i);return pt(o.response)?(_this21.dispatch(kr(o.response.error)),_this21.rejectWithValue(o.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Ut(Yt(_this21.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:np()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i,analyticsAction:np()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(Uc("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let o=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this22.dispatch(kr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Ut(Yt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o,analyticsAction:sS()})})()}getStateAfterResponse(t,r,n,i){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Nt().enableQuerySyntax},search:{...Bt(),duration:r,response:i,results:i.results}}}processSuccessResponse(t){return this.dispatch(Ut(Yt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Lc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Or(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(qc(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(Vc({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Or(_this24.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var One=Ae("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Bc(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),Pne=Ae("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield op(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),Nne=Ae("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sp(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Fne=Ae("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield bk(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),Dne=Ae("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return ip(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),vk=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function vk(_x106,_x107){return _ref54.apply(this,arguments)}}(),Sk=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield ri(e);return Sr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Sk(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),Ak=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request.numberOfResults=0,r});return function Ak(_x111,_x112){return _ref56.apply(this,arguments)}}(),aS=e=>{e.configuration.analytics.enabled&&Gt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function ip(_x113,_x114){return _ip.apply(this,arguments)}function _ip(){_ip=_asyncToGenerator(function*(e,t){K(e,{id:te,q:te,maxResultsPerQuery:new Ve({required:!0,min:1}),cacheTimeout:new Ve});let{q:r,maxResultsPerQuery:n}=e,i=t.getState(),o=new Pr({...t,analyticsAction:Wv()},u=>{t.dispatch(Mc({q:u,id:e.id}))}),s=yield Sk(i,r,n),a=yield o.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield o.process(a);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _ip.apply(this,arguments)}function op(_x115,_x116,_x117){return _op.apply(this,arguments)}function _op(){_op=_asyncToGenerator(function*(e,t,r){aS(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Pr({...t,analyticsAction:r}),c=yield Or(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _op.apply(this,arguments)}function sp(_x118,_x119){return _sp.apply(this,arguments)}function _sp(){_sp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:i}=e.extra,{description:o}=yield rp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:i}),s=new Pr({...e,analyticsAction:rp()}),a=yield vk(t,o),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _sp.apply(this,arguments)}function bk(_x120,_x121,_x122){return _bk.apply(this,arguments)}function _bk(){_bk=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Pr({...e,analyticsAction:t}),c=yield Ak(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _bk.apply(this,arguments)}function Bc(_x123,_x124,_x125){return _Bc.apply(this,arguments)}function _Bc(){_Bc=_asyncToGenerator(function*(e,t,r){aS(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=yield Or(e,s),c=new Pr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _Bc.apply(this,arguments)}m();d();f();p();var Nr=class{constructor(t,r=n=>{this.dispatch(wi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=ha(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this25.getState().query?.q||"";return{response:o,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Ut(Yt(_this27.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this28.automaticallyRetryQueryWithCorrection(i);return pt(o.response)?(_this28.dispatch(kr(o.response.error)),_this28.rejectWithValue(o.response.error)):(_this28.dispatch(Ut(Yt(_this28.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(Uc("")),null;let o=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this29.dispatch(kr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Ut(Yt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o})})()}processSuccessResponse(t){return this.dispatch(Ut(Yt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Lc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=Xv(),i=yield _this30.fetchFromAPI(yield br(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(qc(t)),i})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(Vc({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield br(_this31.getState(),_this31.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Aie=Ae("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;K(e,{q:new ee,enableQuerySyntax:new Me,clearFilters:new Me}),e.clearFilters&&(r(Qv()),r(Hv())),r(zv({allow:!0})),r(wi({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Yv(1))}),bie=G("search/updateSearchAction"),Gc=Ae("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bc(r,t,e.legacy);lS(r);let n=e.next?dS(e.next):void 0,i=yield br(r,t.extra.navigatorContext,n),o=new Nr({...t,analyticsAction:n??{}}),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),cS=Ae("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(lS(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return op(r,t,e.legacy);let n=new Nr({...t,analyticsAction:e.next}),i=yield br(r,t.extra.navigatorContext,e.next),o=yield n.fetchFromAPI(i,{origin:"mainSearch"});return yield n.process(o)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),uS=Ae("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sp(t,r);let n=Wg("browseResults",t.getState),i=new Nr({...t,analyticsAction:n}),o=yield wk(r,t.extra.navigatorContext,n),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),wie=Ae("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bc(r,t,e.legacy);let n=new Nr({...t,analyticsAction:{}}),i=yield xk(r,t.extra.navigatorContext),o=yield n.fetchFromAPI(i,{origin:"facetValues"});return yield n.process(o)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),Cie=Ae("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ip(e,t);K(e,{id:te,q:te,maxResultsPerQuery:new Ve({required:!0,min:1}),cacheTimeout:new Ve});let{q:n,maxResultsPerQuery:i}=e,o=dS(Kv()),s=yield Ck(r,t.extra.navigatorContext,n,i,o),a=new Nr({...t,analyticsAction:o},h=>{t.dispatch(Mc({q:h,id:e.id}))}),c=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield a.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),wk=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function wk(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),Ck=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,i){let o=va(e,t,i);return Sr({...o,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function Ck(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),xk=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request.numberOfResults=0,n});return function xk(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),lS=e=>{e.configuration.analytics.enabled&&Gt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},dS=e=>({actionCause:e.actionCause,type:e.actionCause});var pS=e=>{let t=Jf({extra:e}),r=$v();return t.startListening({actionCreator:Gc.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,i){let o=i.getState();if(!Ol(o))return;r.abortRun(),i.dispatch(Ca()),i.dispatch(Vv());let s=Yr(o)?.q;!s||s.trim()===""||r.run(o,i.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var fS=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let i=n.error;if(n.payload?.ignored||e.error({error:i,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},mS=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var ap=(e,t)=>{let{referrer:r,userAgent:n,location:i,clientId:o}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:i,clientId:o}};m();d();f();p();function gS(e,t){let r={...e},n,i=o=>(s,a)=>{let c=o(s,a);return n?n(c,a):c};return{get combinedReducer(){let o=Hp(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return i(Mn({...o,...r}))},containsAll(o){return Object.keys(o).every(a=>a in r)},add(o){Object.keys(o).filter(s=>!(s in r)).forEach(s=>{r[s]=o[s]})},addCrossReducer(o){n=o}}}m();d();f();p();m();d();f();p();var xi=G("app/setError");m();d();f();p();function Ek(e){if(!e||!Rk(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),i=decodeURIComponent(n.split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(i)}catch{return null}}function hS(e,t=60){if(!e)return!1;let r=Ek(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function Rk(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function vS(e,t){let r=0,n=null,i=Yo(()=>{r=0},500),o=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(Bn({accessToken:v})),v});return function o(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),h=Tk(u);if(!(!h||!hS(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield o(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),yS(c,u.error),u;!n&&(r++,i());try{yield o(c,!0)}catch(S){e.debug(S,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(h)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield s(c));let g=yield u(h);return Ik(g)?S?yield a(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),yS(c,g.error),g):g});return function(_x156){return _ref70.apply(this,arguments)}}())}function Ik(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Pn().name}function yS(e,t){e.dispatch(xi({status:401,statusCode:401,message:t.message,type:t.name}))}function Tk(e){return e.configuration.accessToken}m();d();f();p();function SS({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:i}){return Lf({reducer:e,preloadedState:t,devTools:{stateSanitizer:o=>o.history?{...o,history:"<<OMIT>>"}:o,name:i,shouldHotReload:!1},middleware:o=>o({thunk:{extraArgument:n}}).prepend(...r).concat(mS(n.logger))})}function _k(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...i}=r??{},o={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return o.analyticsMode!=="next"&&Qp()?(t.info("Analytics disabled since doNotTrack is active."),{...o,enabled:!1}):o}function AS(e,t){let r={...e.reducers,configuration:yt,version:Vh},n=kk({...e,reducers:r},t,yt),{accessToken:i,environment:o,organizationId:s}=e.configuration;n.dispatch(Bn({accessToken:i,environment:o,organizationId:s}));let a=_k(e.configuration,n.logger);return a&&n.dispatch(Fs(a)),n}function kk(e,t,r){let{reducers:n,navigatorContextProvider:i}=e,o=gS({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&o.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return no(u.state,i)},get navigatorContext(){return ap(this.relay,i)}},c=Ok(e,a,o),u={addReducers(h){o.containsAll(h)||(o.add(h),c.replaceReducer(o.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(Ms())},disableAnalytics(){c.dispatch(Ds())},get state(){return c.getState()},get relay(){return no(this.state,i)},get navigatorContext(){return ap(this.relay,i)},logger:s,store:c};return u}function Ok(e,t,r){let{preloadedState:n,configuration:i}=e,o=i.name||"coveo-headless",s=Pk(e,t.logger,()=>t.navigatorContext);return SS({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:o})}function Pk(e,t,r){let{renewAccessToken:n}=e.configuration,i=vS(t,n),o=pS({getNavigatorContext:r});return[Zh,i,fS(t),Gh].concat(ld.middleware,o.middleware,e.middlewares||[])}var Nk=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
40
+ `),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},z_=e=>{let t=new Kt,r=new Uint8Array;e.subscribe({next:i=>{if(i.type!==En.HEADERS&&i.type===En.DATA&&i.data){let o=new Uint8Array(r.length+i.data.length);o.set(r,0),o.set(i.data,r.length),r=o,n()}},error:i=>t.error(i),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let i=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<i)break;try{let o=r.slice(4,i),s=wv(o);t.next(s),r=r.slice(i)}catch(o){let s=o instanceof Error?o.message:String(o);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},W_=e=>{let t=new Kt,r=new Qa,n=!1;return e.subscribe({next:i=>{r.next(i),i.type===En.HEADERS&&!n?(n=!0,i.headers.get("content-type")===Cv?z_(r).subscribe({next:o=>t.next(o),error:o=>t.error(o),complete:()=>t.complete()}):H_(r).subscribe({next:o=>{try{let s=Oa.parse(o);t.next(s)}catch(s){t.error(s)}},error:o=>{if(o?.name==="AbortError"){t.next({type:D.RUN_ERROR,message:o.message||"Request aborted",code:"abort",rawEvent:o}),t.complete();return}return t.error(o)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:i=>{r.error(i),t.error(i)},complete:()=>{r.complete()}}),t.asObservable()},ke=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),K_=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Y_=R.object({type:R.literal(ke.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),X_=R.object({type:R.literal(ke.enum.TextMessageContent),messageId:R.string(),content:R.string()}),J_=R.object({type:R.literal(ke.enum.TextMessageEnd),messageId:R.string()}),Z_=R.object({type:R.literal(ke.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),ek=R.object({type:R.literal(ke.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),tk=R.object({type:R.literal(ke.enum.ActionExecutionEnd),actionExecutionId:R.string()}),rk=R.object({type:R.literal(ke.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),nk=R.object({type:R.literal(ke.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),ik=R.object({type:R.literal(ke.enum.MetaEvent),name:K_,value:R.any()}),ok=R.object({type:R.literal(ke.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[Y_,X_,J_,Z_,ek,tk,rk,nk,ik,ok]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var sk=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
+ `)},ak=(e,t,r)=>n=>{let i={},o=!0,s=!0,a="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,i=g)};return n.pipe(dt(g=>{switch(g.type){case D.TEXT_MESSAGE_START:{let y=g;return[{type:ke.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case D.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:ke.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case D.TEXT_MESSAGE_END:{let y=g;return[{type:ke.enum.TextMessageEnd,messageId:y.messageId}]}case D.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:ke.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case D.TOOL_CALL_ARGS:{let y=g,C=h.find(E=>E.id===y.toolCallId);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];C.function.arguments+=y.delta;let x=!1;if(u){let E=u.find(_=>_.tool==C.function.name);if(E)try{let _=JSON.parse(cc(C.function.arguments));E.tool_argument&&E.tool_argument in _?(S({...i,[E.state_key]:_[E.tool_argument]}),x=!0):E.tool_argument||(S({...i,[E.state_key]:_}),x=!0)}catch{}}return[{type:ke.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]:[])]}case D.TOOL_CALL_END:{let y=g;return[{type:ke.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case D.TOOL_CALL_RESULT:{let y=g;return[{type:ke.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let y=g;switch(y.name){case"Exit":o=!1;break;case"PredictState":u=y.value;break}return[{type:ke.enum.MetaEvent,name:y.name,value:y.value}]}case D.STATE_SNAPSHOT:return S(g.snapshot),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}];case D.STATE_DELTA:{let y=g,C=Tr(i,y.delta,!0,!1);return C?(S(C.newDocument),[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return c=g.messages,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:c}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify({...i,...(c?{messages:ck(c)}:{})}),active:!1}];case D.RUN_ERROR:{let y=g;return[{type:ke.enum.RunError,message:y.message,code:y.code}]}case D.STEP_STARTED:return a=g.stepName,h=[],u=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!0}];case D.STEP_FINISHED:return h=[],u=null,[{type:ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:a,runId:t,running:o,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))};function ck(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=sk(r.content);if(n){let i={id:r.id,role:r.role,content:n};t.push(i)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let i of r.toolCalls){let o={id:i.id,name:i.function.name,arguments:JSON.parse(i.function.arguments),parentMessageId:r.id};t.push(o)}}else if(r.role==="tool"){let n="unknown";for(let o of e)if(o.role==="assistant"&&o.toolCalls?.length){for(let s of o.toolCalls)if(s.id===r.toolCallId){n=s.function.name;break}}let i={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(i)}return t}var Fc=e=>t=>{let r,n,i,o,s=()=>{if(!r||o!=="text")throw Error("No text message to close");let h={type:D.TEXT_MESSAGE_END,messageId:r.messageId};return o=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},a=()=>{if(!n||o!=="tool")throw Error("No tool call to close");let h={type:D.TOOL_CALL_END,toolCallId:n.toolCallId};return o=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!i||o!=="reasoning")throw Error("No reasoning message to close");let h={type:D.REASONING_MESSAGE_END,messageId:i.messageId};return o=void 0,i=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>o==="text"?[s()]:o==="tool"?[a()]:o==="reasoning"?[c()]:[];return t.pipe(dt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...u(),h];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[h];case D.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((o!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),o!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},o="text";let E={type:D.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(E))}if(v.delta!==void 0){let E={type:D.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(E))}return S;case D.TOOL_CALL_CHUNK:let g=h,y=[];if((o!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),o!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},o="tool";let E={type:D.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(E))}if(g.delta!==void 0){let E={type:D.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(E))}return y;case D.REASONING_MESSAGE_CHUNK:let C=h,x=[];if((o!=="reasoning"||C.messageId&&C.messageId!==i?.messageId)&&x.push(...u()),o!=="reasoning"){if(C.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:C.messageId},o="reasoning";let E={type:D.REASONING_MESSAGE_START,messageId:C.messageId};x.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(E))}if(C.delta!==void 0){let E={type:D.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:C.delta};x.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(E))}return x}return h.type,[]}),xn(()=>{u()}))},Zd=class{runNext(e,t){return t.run(e).pipe(Fc(!1))}runNextWithState(e,t){let r=Ie(e.messages||[]),n=Ie(e.state||{}),i=new Qa;return Ov(e,i,t,[]).subscribe(o=>{o.messages!==void 0&&(r=o.messages),o.state!==void 0&&(n=o.state)}),this.runNext(e,t).pipe(sc(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(o){return i.next(o),yield new Promise(s=>setTimeout(s,0)),{event:o,messages:Ie(r),state:Ie(n)}});return function(_x88){return _ref42.apply(this,arguments)}}()))}},uk=class extends Zd{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function lk(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var dk=class extends Zd{run(e,t){let{parentRunId:r,...n}=e,i={...n,messages:n.messages.map(lk)};return this.runNext(i,t)}},Rv="THINKING_START",Iv="THINKING_END",Tv="THINKING_TEXT_MESSAGE_START",_v="THINKING_TEXT_MESSAGE_CONTENT",kv="THINKING_TEXT_MESSAGE_END",pk=class extends Zd{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Cn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Rv:{this.currentReasoningId=Uo();let{title:t,...r}=e;return this.warnAboutTransformation(Rv,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case Tv:return this.currentMessageId=Uo(),this.warnAboutTransformation(Tv,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case _v:{let{delta:t,...r}=e;return this.warnAboutTransformation(_v,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Uo(),delta:t}}case kv:{let t=this.currentMessageId??Uo();return this.warnAboutTransformation(kv,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case Iv:{let t=this.currentReasoningId??Uo();return this.warnAboutTransformation(Iv,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}},fk="0.0.45",mk=class{get maxVersion(){return fk}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:i,debug:o}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Cr(),this.messages=Ie(n??[]),this.state=Ie(i??{}),this.debug=o??!1,Nc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new dk),Nc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new pk)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new uk(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??Cr();let r=_this1.prepareRunAgentInput(e),n,i=new Set(_this1.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this1.subscribers,t??{}];yield _this1.onInitialize(r,o),_this1.activeRunDetach$=new Kt;let s;_this1.activeRunCompletionPromise=new Promise(c=>{s=c}),yield oc($a(()=>_this1.middlewares.length===0?_this1.run(r):_this1.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this1).run(r),Fc(_this1.debug),Jd(_this1.debug),c=>c.pipe(ac(_this1.activeRunDetach$)),c=>_this1.apply(r,c,o),c=>_this1.processApplyEvents(r,c,o),jo(c=>(_this1.isRunning=!1,_this1.onError(r,c,o))),xn(()=>{_this1.isRunning=!1,_this1.onFinalize(r,o),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Me(null)));let a=Ie(_this1.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new bd}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??Cr();let r=_this10.prepareRunAgentInput(e),n,i=new Set(_this10.messages.map(c=>c.id)),o=[{onRunFinishedEvent:c=>{n=c.result}},..._this10.subscribers,t??{}];yield _this10.onInitialize(r,o),_this10.activeRunDetach$=new Kt;let s;_this10.activeRunCompletionPromise=new Promise(c=>{s=c}),yield oc($a(()=>_this10.connect(r),Fc(_this10.debug),Jd(_this10.debug),c=>c.pipe(ac(_this10.activeRunDetach$)),c=>_this10.apply(r,c,o),c=>_this10.processApplyEvents(r,c,o),jo(c=>(_this10.isRunning=!1,c instanceof bd?Ha:_this10.onError(r,c,o))),xn(()=>{_this10.isRunning=!1,_this10.onFinalize(r,o),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Me(null)));let a=Ie(_this10.messages).filter(c=>!i.has(c.id));return{result:n,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Ov(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(Ld(n=>{n.messages&&(this.messages=n.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ie(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Cr(),tools:Ie(e?.tools??[]),context:Ie(e?.context??[]),forwardedProps:Ie(e?.forwardedProps??{}),state:Ie(this.state),messages:t}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this12.messages,_this12.state,(n,i,o)=>n.onRunInitialized?.({messages:i,state:o,agent:_this12,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this12.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})),r.state&&(_this12.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})})))})()}onError(e,t,r){return wn(Re(r,this.messages,this.state,(n,i,o)=>n.onRunFailed?.({error:t,messages:i,state:o,agent:this,input:e}))).pipe(Cn(n=>{let i=n;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this13=this;return _asyncToGenerator(function*(){let r=yield Re(t,_this13.messages,_this13.state,(n,i,o)=>n.onRunFinalized?.({messages:i,state:o,agent:_this13,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this13.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),r.state!==void 0&&(_this13.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Ie(this.messages),e.state=Ie(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this14.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this15.subscribers)yield r.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this15.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=Ie(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=Ie(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Cr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:i=>n.run(i,r)}),this).run(t)).pipe(Fc(this.debug),Jd(this.debug),ak(this.threadId,t.runId,this.agentId),r=>r.pipe(Cn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Pv=class extends mk{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Ie(e.headers??{})}run(e){return W_(Q_(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Ie(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Nv=(e,t,r)=>{let n=qe(t,r),i=e?.trim();if(!n||!t||!i)throw new Error("Missing required parameters for answer endpoint");let o=`/api/preview/organizations/${t}/agents`;return`${n}${o}/${i}`};var ep=class extends Pv{requestInit(t){let{params:r,accessToken:n,recordDebugSession:i}=t.forwardedProps||{},o={...r,...(i&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(o),signal:this.abortController.signal}}},Fv=(e,t,r)=>new ep({url:`${Nv(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var gk=new ee({required:!0}),Dv=new ee({required:!0,constrainTo:Sa}),Mv=e=>({...e,name:Aa(e.name)}),jv=G("followUpAnswers/setIsEnabled",e=>K(e,new je({required:!0}))),Lv=G("followUpAnswers/setFollowUpAnswersConversationId",e=>K(e,te)),qv=G("followUpAnswers/setFollowUpAnswersConversationToken",e=>K(e,te)),Uv=G("followUpAnswers/clearFollowUpAnswersConversationToken"),IJ=G("followUpAnswers/createFollowUpAnswer",e=>K(e,{question:te})),TJ=G("followUpAnswers/setActiveFollowUpAnswerId",e=>K(e,te)),_J=G("followUpAnswers/setFollowUpAnswerContentFormat",e=>K(e,{contentFormat:ba,answerId:te})),kJ=G("followUpAnswers/setFollowUpIsLoading",e=>K(e,{isLoading:new je({required:!0}),answerId:te})),OJ=G("followUpAnswers/setFollowUpIsStreaming",e=>K(e,{isStreaming:new je({required:!0}),answerId:te})),PJ=G("followUpAnswers/followUpMessageChunkReceived",e=>K(e,{textDelta:gk,answerId:te})),NJ=G("followUpAnswers/followUpCitationsReceived",e=>K(e,{citations:new Ot({required:!0,each:new Ee({values:ad})}),answerId:te})),FJ=G("followUpAnswers/followUpCompleted",e=>K(e,{answerId:te,cannotAnswer:new je({required:!1})})),DJ=G("followUpAnswers/followUpFailed",e=>K(e,{message:new ee,code:new Ve({min:0}),answerId:te})),MJ=G("followUpAnswers/activeFollowUpStartFailed",e=>K(e,{message:new ee})),jJ=G("followUpAnswers/likeFollowUp",e=>K(e,{answerId:te})),LJ=G("followUpAnswers/dislikeFollowUp",e=>K(e,{answerId:te})),qJ=G("followUpAnswers/submitFollowUpFeedback",e=>K(e,{answerId:te})),Vv=G("followUpAnswers/resetFollowUpAnswers"),UJ=G("followUpAnswers/stepStarted",e=>K(Mv(e),{answerId:te,name:Dv,startedAt:new Ve({min:0,required:!0})})),VJ=G("followUpAnswers/stepFinished",e=>K(Mv(e),{answerId:te,name:Dv,finishedAt:new Ve({min:0,required:!0})}));m();d();f();p();var hk={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:TURN_LIMIT_REACHED":1005};function Bv(e){return e?hk[e]??1004:1004}var Gv=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(wa(n.runId)),e(wr(!1)),e(wo(!0)),e(Lv(n.threadId)),e(Uv())},onStepStartedEvent:({event:n})=>{e(kh({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Oh({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Co({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:i,value:o}=n;switch(i){case"header":{o?.contentFormat&&e(Ro(o.contentFormat)),typeof o?.followUpEnabled=="boolean"&&e(jv(o.followUpEnabled)),o?.conversationToken&&e(qv(o.conversationToken));return}case"citations":{e(xo({citations:o.citations}));return}}},onRunErrorEvent:({event:n})=>{let i=Bv(n.code);e(Eo({message:n.message,code:i}))},onRunFinishedEvent:({event:n})=>{let i=n.result?.completionReason==="ANSWERED",o=i?!r:void 0;e(cd(i)),e(Io(!i)),e(wo(!1)),e(ei(i,t,o,n.threadId)),e(ti())}}};var $v=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,i,o){t();let s=da(n),a=Fg(n),c=Dg(n),u=Ng(n),h=Mg(n),v=Fv(s,a,c);e=v;let S=Gv(i),g=xh(n,o());try{i(wr(!0)),yield v.runAgent({forwardedProps:{params:g,accessToken:u,recordDebugSession:h}},S)}catch(y){i(wr(!1)),i(Eo({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x89,_x90,_x91){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var Qv=G("breadcrumb/deselectAll"),Hv=G("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var zv=G("facet/updateFacetAutoSelection",e=>K(e,{allow:new je({required:!0})}));m();d();f();p();m();d();f();p();var Dc=class extends vr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let i in r[n].cache)if(r[n].cache[i].isActive)return r[n].cache[i];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Nt().q}get responseTime(){return this.activeInstantResultCache?.duration??Bt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Bt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Wv=()=>it("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Dc(e)),Kv=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var tp={id:te},yk={...tp,q:Pt},KZ=G("instantResults/register",e=>K(e,tp)),Mc=G("instantResults/updateQuery",e=>K(e,yk)),YZ=G("instantResults/clearExpired",e=>K(e,tp));m();d();f();p();var jc=new Ve({required:!0,min:0}),oee=G("pagination/registerNumberOfResults",e=>K(e,jc)),see=G("pagination/updateNumberOfResults",e=>K(e,jc)),aee=G("pagination/registerPage",e=>K(e,jc)),Yv=G("pagination/updatePage",e=>K(e,jc)),cee=G("pagination/nextPage"),uee=G("pagination/previousPage");m();d();f();p();var wi=G("query/updateQuery",e=>K(e,{q:new ee,enableQuerySyntax:new je}));m();d();f();p();m();d();f();p();m();d();f();p();var Ci=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var rp=()=>it("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),kr=e=>it("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Nt().q,aq:r.advancedSearchQueries?.aq||Ci().aq,cq:r.advancedSearchQueries?.cq||Ci().cq,dq:r.advancedSearchQueries?.dq||Ci().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var Lc=e=>e.success!==void 0,pt=e=>e.error!==void 0;m();d();f();p();var ste=G("didYouMean/enable"),ate=G("didYouMean/disable"),cte=G("didYouMean/automaticCorrections/disable"),ute=G("didYouMean/automaticCorrections/enable"),qc=G("didYouMean/correction",e=>K(e,te)),lte=G("didYouMean/automaticCorrections/mode",e=>K(e,new ee({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var np=()=>it("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Xv=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Jv(){return{contextValues:{}}}m();d();f();p();function Zv(){return{contextValues:{}}}m();d();f();p();function eS(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function tS(){return[]}m();d();f();p();function rS(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function nS(){return{}}m();d();f();p();function iS(){return{}}m();d();f();p();function oS(){return{}}function Yt(e){return{context:e.context||Jv(),dictionaryFieldContext:e.dictionaryFieldContext||Zv(),facetSet:e.facetSet||la(),numericFacetSet:e.numericFacetSet||ua(),dateFacetSet:e.dateFacetSet||ca(),categoryFacetSet:e.categoryFacetSet||aa(),automaticFacetSet:e.automaticFacetSet??sa(),pagination:e.pagination||rS(),query:e.query||Nt(),tabSet:e.tabSet||oS(),advancedSearchQueries:e.advancedSearchQueries||Ci(),staticFilterSet:e.staticFilterSet||iS(),querySet:e.querySet||nS(),sortCriteria:e.sortCriteria||pa(),pipeline:e.pipeline||ma(),searchHub:e.searchHub||Gn(),facetOptions:e.facetOptions||eS(),facetOrder:e.facetOrder??tS(),debug:e.debug??Os()}}m();d();f();p();var Mre=new Ee({values:{undoneQuery:Pt},options:{required:!0}}),sS=()=>it("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var Uc=G("trigger/query/ignore",e=>K(e,new ee({emptyAllowed:!0,required:!0}))),Vc=G("trigger/query/modification",e=>K(e,new Ee({values:{originalQuery:$e,modification:$e}})));m();d();f();p();var Or=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=Ak(e),n=ya(e),i=vk(e),o=yield ri(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Sr({...o,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:s(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Or(_x92,_x93){return _ref48.apply(this,arguments)}}();function vk(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(Sk).filter(r=>r.currentValues.length>0):void 0}function Sk(e){let{field:t,label:r,values:n}=e,i=n.filter(o=>o.state==="selected");return{field:t,label:r,currentValues:i}}function Ak(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(o=>o.isActive)?.expression.trim()||"",i=bk(e);return[t,n,...i].filter(o=>!!o).join(" AND ")}function bk(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(o=>o.state==="selected"&&!!o.expression.trim()),i=n.map(o=>o.expression).join(" OR ");return n.length>1?`(${i})`:i})}var Pr=class{constructor(t,r=n=>{this.dispatch(wi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=ha(yield _this18.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this18.getState().query?.q||"";return{response:o,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getState(),n=_this20.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Ut(Yt(_this20.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let r=_this21.getCurrentQuery(),n=_this21.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this21.automaticallyRetryQueryWithCorrection(i);return pt(o.response)?(_this21.dispatch(kr(o.response.error)),_this21.rejectWithValue(o.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Ut(Yt(_this21.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:np()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i,analyticsAction:np()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let r=_this22.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===n)return _this22.dispatch(Uc("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let o=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this22.dispatch(kr(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Ut(Yt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o,analyticsAction:sS()})})()}getStateAfterResponse(t,r,n,i){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Nt().enableQuerySyntax},search:{...Bt(),duration:r,response:i,results:i.results}}}processSuccessResponse(t){return this.dispatch(Ut(Yt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Lc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let r=yield _this23.fetchFromAPI(yield Or(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(qc(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(Vc({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Or(_this24.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var Dne=Ae("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Bc(r,t,e)});return function(_x96,_x97){return _ref49.apply(this,arguments)}}()),Mne=Ae("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield op(r,t,e)});return function(_x98,_x99){return _ref50.apply(this,arguments)}}()),jne=Ae("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sp(t,r)});return function(_x100,_x101){return _ref51.apply(this,arguments)}}()),Lne=Ae("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ek(t,e,r)});return function(_x102,_x103){return _ref52.apply(this,arguments)}}()),qne=Ae("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return ip(e,t)});return function(_x104,_x105){return _ref53.apply(this,arguments)}}()),wk=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function wk(_x106,_x107){return _ref54.apply(this,arguments)}}(),Ck=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield ri(e);return Sr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Ck(_x108,_x109,_x110){return _ref55.apply(this,arguments)}}(),xk=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Or(e,t);return r.request.numberOfResults=0,r});return function xk(_x111,_x112){return _ref56.apply(this,arguments)}}(),aS=e=>{e.configuration.analytics.enabled&&Gt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function ip(_x113,_x114){return _ip.apply(this,arguments)}function _ip(){_ip=_asyncToGenerator(function*(e,t){K(e,{id:te,q:te,maxResultsPerQuery:new Ve({required:!0,min:1}),cacheTimeout:new Ve});let{q:r,maxResultsPerQuery:n}=e,i=t.getState(),o=new Pr({...t,analyticsAction:Wv()},u=>{t.dispatch(Mc({q:u,id:e.id}))}),s=yield Ck(i,r,n),a=yield o.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield o.process(a);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _ip.apply(this,arguments)}function op(_x115,_x116,_x117){return _op.apply(this,arguments)}function _op(){_op=_asyncToGenerator(function*(e,t,r){aS(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Pr({...t,analyticsAction:r}),c=yield Or(e,s),u=yield a.fetchFromAPI(c,{origin:"mainSearch"});return yield a.process(u)});return _op.apply(this,arguments)}function sp(_x118,_x119){return _sp.apply(this,arguments)}function _sp(){_sp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:i}=e.extra,{description:o}=yield rp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:i}),s=new Pr({...e,analyticsAction:rp()}),a=yield wk(t,o),c=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(c)});return _sp.apply(this,arguments)}function Ek(_x120,_x121,_x122){return _Ek.apply(this,arguments)}function _Ek(){_Ek=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=new Pr({...e,analyticsAction:t}),c=yield xk(r,s),u=yield a.fetchFromAPI(c,{origin:"facetValues"});return yield a.process(u)});return _Ek.apply(this,arguments)}function Bc(_x123,_x124,_x125){return _Bc.apply(this,arguments)}function _Bc(){_Bc=_asyncToGenerator(function*(e,t,r){aS(e);let{analyticsClientMiddleware:n,preprocessRequest:i,logger:o}=t.extra,{description:s}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:i,logger:o}),a=yield Or(e,s),c=new Pr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(a,{origin:"mainSearch"});return yield c.process(u)});return _Bc.apply(this,arguments)}m();d();f();p();var Nr=class{constructor(t,r=n=>{this.dispatch(wi({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let i=Date.now(),o=ha(yield _this25.extra.apiClient.search(r,n),t),s=Date.now()-i,a=_this25.getState().query?.q||"";return{response:o,duration:s,queryExecuted:a,requestExecuted:r}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return pt(t.response)?(this.dispatch(kr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getState(),n=_this27.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:o}=r.didYouMean,{results:s,queryCorrections:a,queryCorrection:c}=n;if(!i||!o)return null;let u=s.length===0&&a&&a.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Ut(Yt(_this27.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getCurrentQuery(),n=_this28.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:i}=n.queryCorrections[0],o=yield _this28.automaticallyRetryQueryWithCorrection(i);return pt(o.response)?(_this28.dispatch(kr(o.response.error)),_this28.rejectWithValue(o.response.error)):(_this28.dispatch(Ut(Yt(_this28.getState()))),{...o,response:{...o.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:i}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:i}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let r=_this29.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(a=>a.type==="query")?.content||"";if(!n)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===n)return _this29.dispatch(Uc("")),null;let o=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(n);return pt(s.response)?(_this29.dispatch(kr(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Ut(Yt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:o})})()}processSuccessResponse(t){return this.dispatch(Ut(Yt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Lc(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let r=_this30.getState(),{actionCause:n}=Xv(),i=yield _this30.fetchFromAPI(yield br(r,_this30.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this30.dispatch(qc(t)),i})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(Vc({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield br(_this31.getState(),_this31.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var xie=Ae("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;K(e,{q:new ee,enableQuerySyntax:new je,clearFilters:new je}),e.clearFilters&&(r(Qv()),r(Hv())),r(zv({allow:!0})),r(wi({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Yv(1))}),Eie=G("search/updateSearchAction"),Gc=Ae("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bc(r,t,e.legacy);lS(r);let n=e.next?dS(e.next):void 0,i=yield br(r,t.extra.navigatorContext,n),o=new Nr({...t,analyticsAction:n??{}}),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x128,_x129){return _ref57.apply(this,arguments)}}()),cS=Ae("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if(lS(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return op(r,t,e.legacy);let n=new Nr({...t,analyticsAction:e.next}),i=yield br(r,t.extra.navigatorContext,e.next),o=yield n.fetchFromAPI(i,{origin:"mainSearch"});return yield n.process(o)});return function(_x130,_x131){return _ref58.apply(this,arguments)}}()),uS=Ae("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sp(t,r);let n=Wg("browseResults",t.getState),i=new Nr({...t,analyticsAction:n}),o=yield Rk(r,t.extra.navigatorContext,n),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x132,_x133){return _ref59.apply(this,arguments)}}()),Rie=Ae("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bc(r,t,e.legacy);let n=new Nr({...t,analyticsAction:{}}),i=yield Tk(r,t.extra.navigatorContext),o=yield n.fetchFromAPI(i,{origin:"facetValues"});return yield n.process(o)});return function(_x134,_x135){return _ref60.apply(this,arguments)}}()),Iie=Ae("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ip(e,t);K(e,{id:te,q:te,maxResultsPerQuery:new Ve({required:!0,min:1}),cacheTimeout:new Ve});let{q:n,maxResultsPerQuery:i}=e,o=dS(Kv()),s=yield Ik(r,t.extra.navigatorContext,n,i,o),a=new Nr({...t,analyticsAction:o},h=>{t.dispatch(Mc({q:h,id:e.id}))}),c=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield a.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x136,_x137){return _ref61.apply(this,arguments)}}()),Rk=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function Rk(_x138,_x139,_x140){return _ref62.apply(this,arguments)}}(),Ik=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,i){let o=va(e,t,i);return Sr({...o,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function Ik(_x141,_x142,_x143,_x144,_x145){return _ref63.apply(this,arguments)}}(),Tk=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request.numberOfResults=0,n});return function Tk(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),lS=e=>{e.configuration.analytics.enabled&&Gt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},dS=e=>({actionCause:e.actionCause,type:e.actionCause});var pS=e=>{let t=Jf({extra:e}),r=$v();return t.startListening({actionCreator:Gc.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,i){let o=i.getState();if(!Ol(o))return;r.abortRun(),i.dispatch(Ca()),i.dispatch(Vv());let s=Yr(o)?.q;!s||s.trim()===""||r.run(o,i.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};m();d();f();p();var fS=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let i=n.error;if(n.payload?.ignored||e.error({error:i,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},mS=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var ap=(e,t)=>{let{referrer:r,userAgent:n,location:i,clientId:o}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:i,clientId:o}};m();d();f();p();function gS(e,t){let r={...e},n,i=o=>(s,a)=>{let c=o(s,a);return n?n(c,a):c};return{get combinedReducer(){let o=Hp(Object.entries(t).filter(([s])=>!(s in r)).map(([s,a])=>[s,()=>a]));return i(Mn({...o,...r}))},containsAll(o){return Object.keys(o).every(a=>a in r)},add(o){Object.keys(o).filter(s=>!(s in r)).forEach(s=>{r[s]=o[s]})},addCrossReducer(o){n=o}}}m();d();f();p();m();d();f();p();var xi=G("app/setError");m();d();f();p();function _k(e){if(!e||!kk(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),i=decodeURIComponent(n.split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(i)}catch{return null}}function hS(e,t=60){if(!e)return!1;let r=_k(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function kk(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function vS(e,t){let r=0,n=null,i=Yo(()=>{r=0},500),o=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(Bn({accessToken:v})),v});return function o(_x151){return _ref66.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),h=Pk(u);if(!(!h||!hS(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield o(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function s(_x152){return _ref68.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),yS(c,u.error),u;!n&&(r++,i());try{yield o(c,!0)}catch(S){e.debug(S,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(h)});return function a(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield s(c));let g=yield u(h);return Ok(g)?S?yield a(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),yS(c,g.error),g):g});return function(_x156){return _ref70.apply(this,arguments)}}())}function Ok(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Pn().name}function yS(e,t){e.dispatch(xi({status:401,statusCode:401,message:t.message,type:t.name}))}function Pk(e){return e.configuration.accessToken}m();d();f();p();function SS({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:i}){return Lf({reducer:e,preloadedState:t,devTools:{stateSanitizer:o=>o.history?{...o,history:"<<OMIT>>"}:o,name:i,shouldHotReload:!1},middleware:o=>o({thunk:{extraArgument:n}}).prepend(...r).concat(mS(n.logger))})}function Nk(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...i}=r??{},o={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return o.analyticsMode!=="next"&&Qp()?(t.info("Analytics disabled since doNotTrack is active."),{...o,enabled:!1}):o}function AS(e,t){let r={...e.reducers,configuration:yt,version:Vh},n=Fk({...e,reducers:r},t,yt),{accessToken:i,environment:o,organizationId:s}=e.configuration;n.dispatch(Bn({accessToken:i,environment:o,organizationId:s}));let a=Nk(e.configuration,n.logger);return a&&n.dispatch(Fs(a)),n}function Fk(e,t,r){let{reducers:n,navigatorContextProvider:i}=e,o=gS({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&o.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return no(u.state,i)},get navigatorContext(){return ap(this.relay,i)}},c=Dk(e,a,o),u={addReducers(h){o.containsAll(h)||(o.add(h),c.replaceReducer(o.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(Ms())},disableAnalytics(){c.dispatch(Ds())},get state(){return c.getState()},get relay(){return no(this.state,i)},get navigatorContext(){return ap(this.relay,i)},logger:s,store:c};return u}function Dk(e,t,r){let{preloadedState:n,configuration:i}=e,o=i.name||"coveo-headless",s=Mk(e,t.logger,()=>t.navigatorContext);return SS({preloadedState:n,reducer:r.combinedReducer,middlewares:s,thunkExtraArguments:t,name:o})}function Mk(e,t,r){let{renewAccessToken:n}=e.configuration,i=vS(t,n),o=pS({getNavigatorContext:r});return[Zh,i,fS(t),Gh].concat(ld.middleware,o.middleware,e.middlewares||[])}var jk=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
42
42
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
43
43
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
44
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function bS(e){e==="next"&&console.warn(Nk)}m();d();f();p();var kS=_t(_S(),1);function OS(e){return(0,kS.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function PS(e,t){let r=Xk(e),n=$u,i=Jk(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:i,logger:t}}function Xk(e){let{analytics:t}=e,r=(n,i)=>i;return t?.analyticsClientMiddleware||r}function Jk(e){return e.preprocessRequest||Jo}m();d();f();p();m();d();f();p();var NS={organizationId:te,accessToken:te,name:new ee({required:!1,emptyAllowed:!1}),analytics:new Ee({options:{required:!1},values:{enabled:new Me({required:!1}),originContext:new ee({required:!1}),originLevel2:new ee({required:!1}),originLevel3:new ee({required:!1}),analyticsMode:new ee({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new ee({required:!1,url:!0}),trackingId:new ee({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new ee({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var FS=new kt({...NS,caseAssistId:te,locale:$e});var Zk={debug:am,caseAssistConfiguration:hr,searchHub:fm};function DS(e){let t=OS(e.loggerOptions);e0(e.configuration,t);let r=t0(e.configuration,t),n={...PS(e.configuration,t),apiClient:r},i={...e,reducers:Zk},o=AS(i,n);bS(o.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return o.dispatch(_s({caseAssistId:s,locale:a,proxyBaseUrl:u})),se(c)||o.dispatch(Ps(c)),{...o,get state(){return o.state}}}function e0(e,t){try{FS.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function t0(e,t){return new ns({logger:t,preprocessRequest:e.preprocessRequest||Jo})}m();d();f();p();m();d();f();p();m();d();f();p();var MS=(o=>(o.id="id",o.subject="subject",o.description="description",o.category="category",o.productId="productId",o))(MS||{}),jS=e=>!Object.values(MS).includes(e),ft=e=>{let t=r=>r0(e,r)??i0(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...n0(e),...o0(e)}}},r0=(e,t)=>e?.caseInput?.[t]?.value,n0=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(jS(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),i0=(e,t)=>e?.caseField?.fields[t]?.value,o0=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(jS(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),fp=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(c=>c.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let o=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:o?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:o?.value??"",confidence:o?.confidence??0}};return r?{...s,autoSelection:r}:s},mr=(e,t,r=!1,n=!1)=>{let i,o=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(i=c+1),u});if(!o)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:o.uniqueId,permanentId:o.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:o.fields.uri,documentUriHash:o.fields.urihash,documentTitle:o.title,documentUrl:o.clickUri,documentPosition:i??0,sourceName:o.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var LS=()=>ht({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:ft(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),qS=e=>ht("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:ft(r),stage:e?.stageName})),US=()=>ht({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:ft(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:i,productId:o}=ft(e);return{ticket:{id:t,category:r,subject:n,description:i,system:o}}}}),VS=()=>ht({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),BS=()=>ht({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Ri=e=>ht({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:ft(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),GS=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:fp(r,e,!0),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),Hc=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:fp(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),$S=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:mr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),zc=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:mr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),QS=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:mr(r,e,!1,!0),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),HS=(e,t)=>ht({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:mr(n,e),ticket:ft(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,i=mr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:i.suggestionId,url:i.suggestion.documentUri,title:i.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var Ii=G("caseAssist/caseField/register",e=>K(e,{fieldName:te,fieldValue:Pt})),Ti=G("caseAssist/caseField/update",e=>K(e,{fieldName:te,fieldValue:Pt})),Xt=Ae("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let i=t(),o=yield n.getCaseClassifications(yield s0(i));return pt(o)?r(o.error):{response:o.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),s0=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Xn(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?rs(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function s0(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var zS=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Dr=Ge(zS(),e=>{e.addCase(Ii,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n]={value:i,suggestions:[]}}).addCase(Ti,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n].value=i}).addCase(Xt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Xt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([i,o])=>{t.fields[i]||(t.fields[i]={...n}),t.fields[i].suggestions=o.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Xt.pending,t=>{t.status.loading=!0}).addCase(xi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var In=G("caseAssist/caseInput/update",e=>K(e,{fieldName:te,fieldValue:Pt}));m();d();f();p();var WS=()=>({});var Mr=Ge(WS(),e=>{e.addCase(In,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var Rt=Ae("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:i}}){let o=t(),s=yield n.getDocumentSuggestions(yield a0(o,i));return pt(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),a0=/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Xn(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?rs(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function a0(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var KS=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Jt=Ge(KS(),e=>{e.addCase(Rt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Rt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Rt.pending,t=>{t.status.loading=!0}).addCase(xi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function Zt(e){let t,r=new Map,n=()=>r.size===0,i=o=>{try{let s=JSON.stringify(o),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(o){o();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{i(this.state)&&r.forEach(c=>c())})),r.set(s,o),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var c0=new kt({field:te});function YS(e,t={}){if(!u0(e))throw St;let r=Zt(e),{dispatch:n}=e,i=Ts(e,c0,t.options,"buildCaseField"),o=()=>e.state;return o().caseField?.fields?.[i.field]||n(Ii({fieldName:i.field,fieldValue:""})),{...r,get state(){let a=o().caseField?.status?.loading??!1,c=o().caseField?.status?.error??null,u=o().caseField?.fields?.[i.field],h=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:h,suggestions:v}},update(a,c,u){let h=o().caseField?.fields?.[i.field]?.suggestions?.find(v=>v.value===a)?.id;h&&n(u?GS(h):Hc(h)),n(Ti({fieldName:i.field,fieldValue:a})),!u&&n(Ri(i.field)),c?.caseClassifications&&n(Xt()),c?.documentSuggestions&&n(Rt())}}}function u0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();function l0(e,t){let r=new kt({field:te});Ts(e,r,t,"buildCaseInput")}function XS(e,t){if(!d0(e))throw St;let r=Zt(e),{dispatch:n}=e,i=()=>e.state;l0(e,t.options);let o=t.options.field;return i().caseInput?.[o]||n(In({fieldName:o,fieldValue:""})),{...r,update(a,c){n(In({fieldName:o,fieldValue:a})),n(Ri(o)),c?.caseClassifications&&n(Xt()),c?.documentSuggestions&&n(Rt())},get state(){return i().caseInput[o]}}}function d0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();function JS(e,t,r){if(!p0(e))throw St;let n=1e3,i={selectionDelay:n,debounceWait:n,...t.options},o;return{select:Yo(r,i.debounceWait,{isImmediate:!0}),beginDelayedSelect(){o=setTimeout(r,i.selectionDelay)},cancelPendingSelect(){o&&clearTimeout(o)}}}function p0(e){return e.addReducers({configuration:yt}),!0}function ZS(e,t){let r=!1;return JS(e,t,()=>{r||(r=!0,e.dispatch(QS(t.options.result.uniqueId)))})}m();d();f();p();function mp(e){if(!f0(e))throw St;let t=Zt(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(Rt())},get state(){let i=n().documentSuggestion;return{loading:i.status.loading,error:i.status.error,documents:i.documents}}}}function f0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function Wc(_x164,_x165){return _Wc.apply(this,arguments)}function _Wc(){_Wc=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:i}=e.configuration,o=e.query?.q||"";return{url:r.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:i,enableNavigation:!1,q:o,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Wc.apply(this,arguments)}var Bo=Ae("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let i=r(),o=yield Wc(i,e),s=yield t.apiClient.html(o);return pt(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),Kc=G("resultPreview/next"),Yc=G("resultPreview/previous"),Xc=G("resultPreview/prepare",e=>K(e,{results:new Ot({required:!0})})),eA=2048,Jc=Ae("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),i=nf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return i?.length>eA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${eA} characters.`),{contentURL:i}});return function(_x168,_x169){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function gp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var hp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:i}=gp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=i},yp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),tA=Ge(gp(),e=>{e.addCase(Bo.pending,t=>{t.isLoading=!0}).addCase(Bo.fulfilled,(t,r)=>{let{content:n,uniqueId:i}=r.payload;t.position=t.resultsWithPreview.indexOf(i),t.content=n,t.uniqueId=i,t.isLoading=!1}).addCase(Gc.fulfilled,(t,r)=>{hp(t),t.resultsWithPreview=yp(r.payload.response.results)}).addCase(uS.fulfilled,(t,r)=>{hp(t),t.resultsWithPreview=t.resultsWithPreview.concat(yp(r.payload.response.results))}).addCase(cS.fulfilled,hp).addCase(Xc,(t,r)=>{t.resultsWithPreview=yp(r.payload.results)}).addCase(Kc,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Yc,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Jc.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function rA(e,t,r,n,i){if(!m0(e))throw St;let{dispatch:o}=e,s=()=>e.state,a=Zt(e),{result:c,maximumPreviewSize:u}=t.options,h=()=>{let{resultsWithPreview:S,position:g}=s().resultPreview;return S[g]},v=S=>{o(Jc({uniqueId:S,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||o(Bo({uniqueId:S,requestedOutputSize:u})),i&&i()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){o(Kc()),v(h())},previous(){o(Yc()),v(h())},get state(){let S=s(),g=c.hasHtmlVersion,y=S.resultPreview,C=c.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,E=y.contentURL,_=h();return{content:C,resultHasPreview:g,isLoading:x,contentURL:E,currentResultUniqueId:_}}}}function m0(e){return e.addReducers({configuration:yt,resultPreview:tA}),!0}function nA(e,t){if(!g0(e))throw St;let{dispatch:r}=e,n=()=>e.state,i=()=>n().documentSuggestion.documents,a=rA(e,t,Wc,"/html",()=>{e.dispatch(zc(t.options.result.uniqueId))});return r(Xc({results:i()})),{...a,get state(){return{...a.state,currentDocument:i().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:i().length}}}}function g0(e){return e.addReducers({documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();var vp=e=>K(e,{evt:te,type:$e}),iA=e=>it("analytics/generic/search",t=>{vp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),oA=e=>it("analytics/generic/click",(t,r)=>(Bl(e.result),vp(e),t.makeClickEvent(e.evt,Ul(e.result,r),Vl(e.result),e.meta))),sA=e=>it("analytics/generic/custom",t=>(vp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function h0(e){return e.addReducers({}),{logSearchEvent:iA,logClickEvent:oA,logCustomEvent:sA}}m();d();f();p();function y0(e){return e.addReducers({}),{logCaseStart:LS,logCaseNextStage:qS,logCreateCase:US,logSolveCase:VS,logAbandonCase:BS,logUpdateCaseField:Ri,logClassificationClick:Hc,logDocumentSuggestionClick:$S,logDocumentSuggestionRating:HS,logQuickviewDocumentSuggestionClick:zc}}m();d();f();p();function v0(e){return e.addReducers({caseField:Dr}),{registerCaseField:Ii,updateCaseField:Ti,fetchCaseClassifications:Xt}}m();d();f();p();function S0(e){return e.addReducers({caseInput:Mr}),{updateCaseInput:In}}m();d();f();p();function A0(e){return e.addReducers({documentSuggestion:Jt}),{fetchDocumentSuggestions:Rt}}/**
44
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function bS(e){e==="next"&&console.warn(jk)}m();d();f();p();var kS=_t(_S(),1);function OS(e){return(0,kS.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function PS(e,t){let r=t0(e),n=$u,i=r0(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:i,logger:t}}function t0(e){let{analytics:t}=e,r=(n,i)=>i;return t?.analyticsClientMiddleware||r}function r0(e){return e.preprocessRequest||Jo}m();d();f();p();m();d();f();p();var NS={organizationId:te,accessToken:te,name:new ee({required:!1,emptyAllowed:!1}),analytics:new Ee({options:{required:!1},values:{enabled:new je({required:!1}),originContext:new ee({required:!1}),originLevel2:new ee({required:!1}),originLevel3:new ee({required:!1}),analyticsMode:new ee({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new ee({required:!1,url:!0}),trackingId:new ee({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new ee({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var FS=new kt({...NS,caseAssistId:te,locale:$e});var n0={debug:am,caseAssistConfiguration:hr,searchHub:fm};function DS(e){let t=OS(e.loggerOptions);i0(e.configuration,t);let r=o0(e.configuration,t),n={...PS(e.configuration,t),apiClient:r},i={...e,reducers:n0},o=AS(i,n);bS(o.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:c,proxyBaseUrl:u}=e.configuration;return o.dispatch(_s({caseAssistId:s,locale:a,proxyBaseUrl:u})),se(c)||o.dispatch(Ps(c)),{...o,get state(){return o.state}}}function i0(e,t){try{FS.validate(e)}catch(r){throw t.error(r,"Case Assist engine configuration error"),r}}function o0(e,t){return new ns({logger:t,preprocessRequest:e.preprocessRequest||Jo})}m();d();f();p();m();d();f();p();m();d();f();p();var MS=(o=>(o.id="id",o.subject="subject",o.description="description",o.category="category",o.productId="productId",o))(MS||{}),jS=e=>!Object.values(MS).includes(e),ft=e=>{let t=r=>s0(e,r)??c0(e,r);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...a0(e),...u0(e)}}},s0=(e,t)=>e?.caseInput?.[t]?.value,a0=e=>Object.keys(e?.caseInput??[]).reduce((t,r)=>{if(jS(r)){let n=e?.caseInput?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),c0=(e,t)=>e?.caseField?.fields[t]?.value,u0=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,r)=>{if(jS(r)){let n=e?.caseField?.fields?.[r]?.value;if(n)return{...t,[r]:n}}return t},{}),fp=(e,t,r=!1)=>{let n=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(c=>c.id===t));if(!n)throw new Error(`Classification with ID '${t}' could not be found.`);let o=e?.caseField?.fields[n]?.suggestions.find(a=>a.id===t),s={classificationId:o?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:n,classification:{value:o?.value??"",confidence:o?.confidence??0}};return r?{...s,autoSelection:r}:s},mr=(e,t,r=!1,n=!1)=>{let i,o=e.documentSuggestion?.documents.find((a,c)=>{let u=a.uniqueId===t;return u&&(i=c+1),u});if(!o)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:o.uniqueId,permanentId:o.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:o.fields.uri,documentUriHash:o.fields.urihash,documentTitle:o.title,documentUrl:o.clickUri,documentPosition:i??0,sourceName:o.fields.source}};return r?{...s,fromQuickview:r}:n?{...s,openDocument:n}:s};var LS=()=>ht({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:ft(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),qS=e=>ht("analytics/caseAssist/case/nextStage",(t,r)=>t.logMoveToNextCaseStep({ticket:ft(r),stage:e?.stageName})),US=()=>ht({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:ft(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:r,subject:n,description:i,productId:o}=ft(e);return{ticket:{id:t,category:r,subject:n,description:i,system:o}}}}),VS=()=>ht({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),BS=()=>ht({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:ft(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Ri=e=>ht({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,r)=>t.logUpdateCaseField({fieldName:e,ticket:ft(r)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let r=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:r}}}),GS=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:fp(r,e,!0),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!0,classificationId:e,responseId:r}}}),Hc=e=>ht({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,r)=>t.logSelectFieldSuggestion({suggestion:fp(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let r=t.caseField?.status?.lastResponseId;if(r)return{autoselected:!1,classificationId:e,responseId:r}}}),$S=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:mr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),zc=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logQuickviewDocumentSuggestion({suggestion:mr(r,e),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),QS=e=>ht({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,r)=>t.logSelectDocumentSuggestion({suggestion:mr(r,e,!1,!0),ticket:ft(r)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let r=t.documentSuggestion?.status?.lastResponseId,n=mr(t,e);if(r)return{responseId:r,position:n.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:n.suggestionId,url:n.suggestion.documentUri,title:n.suggestion.documentTitle}}}}),HS=(e,t)=>ht({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(r,n)=>r.logRateDocumentSuggestion({rating:t,suggestion:mr(n,e),ticket:ft(n)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:r=>{let n=r.documentSuggestion?.status?.lastResponseId,i=mr(r,e);if(n)return{responseId:n,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:i.suggestionId,url:i.suggestion.documentUri,title:i.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var Ii=G("caseAssist/caseField/register",e=>K(e,{fieldName:te,fieldValue:Pt})),Ti=G("caseAssist/caseField/update",e=>K(e,{fieldName:te,fieldValue:Pt})),Xt=Ae("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let i=t(),o=yield n.getCaseClassifications(yield l0(i));return pt(o)?r(o.error):{response:o.success}});return function(_x157,_x158){return _ref71.apply(this,arguments)}}()),l0=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Xn(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?rs(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function l0(_x159){return _ref72.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var zS=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Dr=Ge(zS(),e=>{e.addCase(Ii,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n]={value:i,suggestions:[]}}).addCase(Ti,(t,r)=>{let{fieldName:n,fieldValue:i}=r.payload;t.fields[n].value=i}).addCase(Xt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Xt.fulfilled,(t,r)=>{let n={value:"",suggestions:[]};Object.entries(r.payload.response.fields).forEach(([i,o])=>{t.fields[i]||(t.fields[i]={...n}),t.fields[i].suggestions=o.predictions}),t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Xt.pending,t=>{t.status.loading=!0}).addCase(xi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var In=G("caseAssist/caseInput/update",e=>K(e,{fieldName:te,fieldValue:Pt}));m();d();f();p();var WS=()=>({});var Mr=Ge(WS(),e=>{e.addCase(In,(t,r)=>{t[r.payload.fieldName]={value:r.payload.fieldValue}})});m();d();f();p();var Rt=Ae("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:i}}){let o=t(),s=yield n.getDocumentSuggestions(yield d0(o,i));return pt(s)?r(s.error):{response:s.success}});return function(_x160,_x161){return _ref73.apply(this,arguments)}}()),d0=/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??qe(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield Xn(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&tn(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?rs(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});return function d0(_x162,_x163){return _ref74.apply(this,arguments)}}();m();d();f();p();m();d();f();p();var KS=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var Jt=Ge(KS(),e=>{e.addCase(Rt.rejected,(t,r)=>{t.status.error=r.payload??null,t.status.loading=!1}).addCase(Rt.fulfilled,(t,r)=>{t.documents=r.payload.response.documents,t.status.lastResponseId=r.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Rt.pending,t=>{t.status.loading=!0}).addCase(xi,(t,r)=>{t.status.error=r.payload,t.status.loading=!1})});m();d();f();p();function Zt(e){let t,r=new Map,n=()=>r.size===0,i=o=>{try{let s=JSON.stringify(o),a=t!==s;return t=s,a}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(o){o();let s=Symbol(),a;return n()&&(t=JSON.stringify(this.state),a=e.subscribe(()=>{i(this.state)&&r.forEach(c=>c())})),r.set(s,o),()=>{r.delete(s),n()&&a?.()}},get state(){return{}}}}var p0=new kt({field:te});function YS(e,t={}){if(!f0(e))throw St;let r=Zt(e),{dispatch:n}=e,i=Ts(e,p0,t.options,"buildCaseField"),o=()=>e.state;return o().caseField?.fields?.[i.field]||n(Ii({fieldName:i.field,fieldValue:""})),{...r,get state(){let a=o().caseField?.status?.loading??!1,c=o().caseField?.status?.error??null,u=o().caseField?.fields?.[i.field],h=u?.value??"",v=u?.suggestions??[];return{loading:a,error:c,value:h,suggestions:v}},update(a,c,u){let h=o().caseField?.fields?.[i.field]?.suggestions?.find(v=>v.value===a)?.id;h&&n(u?GS(h):Hc(h)),n(Ti({fieldName:i.field,fieldValue:a})),!u&&n(Ri(i.field)),c?.caseClassifications&&n(Xt()),c?.documentSuggestions&&n(Rt())}}}function f0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();function m0(e,t){let r=new kt({field:te});Ts(e,r,t,"buildCaseInput")}function XS(e,t){if(!g0(e))throw St;let r=Zt(e),{dispatch:n}=e,i=()=>e.state;m0(e,t.options);let o=t.options.field;return i().caseInput?.[o]||n(In({fieldName:o,fieldValue:""})),{...r,update(a,c){n(In({fieldName:o,fieldValue:a})),n(Ri(o)),c?.caseClassifications&&n(Xt()),c?.documentSuggestions&&n(Rt())},get state(){return i().caseInput[o]}}}function g0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();function JS(e,t,r){if(!h0(e))throw St;let n=1e3,i={selectionDelay:n,debounceWait:n,...t.options},o;return{select:Yo(r,i.debounceWait,{isImmediate:!0}),beginDelayedSelect(){o=setTimeout(r,i.selectionDelay)},cancelPendingSelect(){o&&clearTimeout(o)}}}function h0(e){return e.addReducers({configuration:yt}),!0}function ZS(e,t){let r=!1;return JS(e,t,()=>{r||(r=!0,e.dispatch(QS(t.options.result.uniqueId)))})}m();d();f();p();function mp(e){if(!y0(e))throw St;let t=Zt(e),{dispatch:r}=e,n=()=>e.state;return{...t,fetch(){r(Rt())},get state(){let i=n().documentSuggestion;return{loading:i.status.loading,error:i.status.error,documents:i.documents}}}}function y0(e){return e.addReducers({configuration:yt,caseAssistConfiguration:hr,caseInput:Mr,caseField:Dr,documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function Wc(_x164,_x165){return _Wc.apply(this,arguments)}function _Wc(){_Wc=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:i}=e.configuration,o=e.query?.q||"";return{url:r.apiBaseUrl??Nn(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:i,enableNavigation:!1,q:o,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Wc.apply(this,arguments)}var Bo=Ae("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let i=r(),o=yield Wc(i,e),s=yield t.apiClient.html(o);return pt(s)?n(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x166,_x167){return _ref75.apply(this,arguments)}}()),Kc=G("resultPreview/next"),Yc=G("resultPreview/previous"),Xc=G("resultPreview/prepare",e=>K(e,{results:new Ot({required:!0})})),eA=2048,Jc=Ae("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),i=nf(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return i?.length>eA&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${eA} characters.`),{contentURL:i}});return function(_x168,_x169){return _ref76.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function gp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var hp=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:i}=gp();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=i},yp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),tA=Ge(gp(),e=>{e.addCase(Bo.pending,t=>{t.isLoading=!0}).addCase(Bo.fulfilled,(t,r)=>{let{content:n,uniqueId:i}=r.payload;t.position=t.resultsWithPreview.indexOf(i),t.content=n,t.uniqueId=i,t.isLoading=!1}).addCase(Gc.fulfilled,(t,r)=>{hp(t),t.resultsWithPreview=yp(r.payload.response.results)}).addCase(uS.fulfilled,(t,r)=>{hp(t),t.resultsWithPreview=t.resultsWithPreview.concat(yp(r.payload.response.results))}).addCase(cS.fulfilled,hp).addCase(Xc,(t,r)=>{t.resultsWithPreview=yp(r.payload.results)}).addCase(Kc,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Yc,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Jc.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function rA(e,t,r,n,i){if(!v0(e))throw St;let{dispatch:o}=e,s=()=>e.state,a=Zt(e),{result:c,maximumPreviewSize:u}=t.options,h=()=>{let{resultsWithPreview:S,position:g}=s().resultPreview;return S[g]},v=S=>{o(Jc({uniqueId:S,requestedOutputSize:u,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||o(Bo({uniqueId:S,requestedOutputSize:u})),i&&i()};return{...a,fetchResultContent(){v(c.uniqueId)},next(){o(Kc()),v(h())},previous(){o(Yc()),v(h())},get state(){let S=s(),g=c.hasHtmlVersion,y=S.resultPreview,C=c.uniqueId===y.uniqueId?y.content:"",x=y.isLoading,E=y.contentURL,_=h();return{content:C,resultHasPreview:g,isLoading:x,contentURL:E,currentResultUniqueId:_}}}}function v0(e){return e.addReducers({configuration:yt,resultPreview:tA}),!0}function nA(e,t){if(!S0(e))throw St;let{dispatch:r}=e,n=()=>e.state,i=()=>n().documentSuggestion.documents,a=rA(e,t,Wc,"/html",()=>{e.dispatch(zc(t.options.result.uniqueId))});return r(Xc({results:i()})),{...a,get state(){return{...a.state,currentDocument:i().findIndex(c=>c.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:i().length}}}}function S0(e){return e.addReducers({documentSuggestion:Jt}),!0}m();d();f();p();m();d();f();p();var vp=e=>K(e,{evt:te,type:$e}),iA=e=>it("analytics/generic/search",t=>{vp(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),oA=e=>it("analytics/generic/click",(t,r)=>(Bl(e.result),vp(e),t.makeClickEvent(e.evt,Ul(e.result,r),Vl(e.result),e.meta))),sA=e=>it("analytics/generic/custom",t=>(vp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function A0(e){return e.addReducers({}),{logSearchEvent:iA,logClickEvent:oA,logCustomEvent:sA}}m();d();f();p();function b0(e){return e.addReducers({}),{logCaseStart:LS,logCaseNextStage:qS,logCreateCase:US,logSolveCase:VS,logAbandonCase:BS,logUpdateCaseField:Ri,logClassificationClick:Hc,logDocumentSuggestionClick:$S,logDocumentSuggestionRating:HS,logQuickviewDocumentSuggestionClick:zc}}m();d();f();p();function w0(e){return e.addReducers({caseField:Dr}),{registerCaseField:Ii,updateCaseField:Ti,fetchCaseClassifications:Xt}}m();d();f();p();function C0(e){return e.addReducers({caseInput:Mr}),{updateCaseInput:In}}m();d();f();p();function x0(e){return e.addReducers({documentSuggestion:Jt}),{fetchDocumentSuggestions:Rt}}/**
45
45
  * @license
46
46
  *
47
47
  * Copyright 2026 Coveo Solutions Inc.
@@ -74,4 +74,4 @@ fast-json-patch/module/duplex.mjs:
74
74
  *)
75
75
  */if(__exports!=exports)module.exports=exports;return module.exports});
76
76
 
77
- window.coveoQuanticVersion = '3.37.1';
77
+ window.coveoQuanticVersion = '3.37.3';