@coveo/quantic 3.43.6 → 3.44.1

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 (18) hide show
  1. package/docs/out/quantic-docs.json +20 -2
  2. package/force-app/main/default/lwc/quanticNumberButton/quanticNumberButton.js +5 -1
  3. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +1 -1
  4. package/force-app/main/default/lwc/quanticPager/quanticPager.html +8 -5
  5. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +22 -0
  6. package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js +10 -2
  7. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +15 -15
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/history-store.d.ts +9 -33
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-request.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -1
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-search-request.d.ts +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  13. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  14. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +14 -14
  15. package/package.json +6 -5
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/cookie.d.ts +0 -5
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/detector.d.ts +0 -5
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/storage.d.ts +0 -24
@@ -14,36 +14,36 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessInsight",["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["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Tk=Object.create;var Ys=Object.defineProperty;var Pk=Object.getOwnPropertyDescriptor;var kk=Object.getOwnPropertyNames;var Ok=Object.getPrototypeOf,_k=Object.prototype.hasOwnProperty;var Nk=(e,t,r)=>t in e?Ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var La=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var It=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ks=(e,t)=>{for(var r in t)Ys(e,r,{get:t[r],enumerable:!0})},Gv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kk(t))!_k.call(e,o)&&o!==r&&Ys(e,o,{get:()=>t[o],enumerable:!(n=Pk(t,o))||n.enumerable});return e};var Fr=(e,t,r)=>(r=e!=null?Tk(Ok(e)):{},Gv(t||!e||!e.__esModule?Ys(r,"default",{value:e,enumerable:!0}):r,e)),Dk=e=>Gv(Ys({},"__esModule",{value:!0}),e);var le=(e,t,r)=>Nk(e,typeof t!="symbol"?t+"":t,r);var S,c=La(()=>{"use strict";S=typeof globalThis<"u"?globalThis:window});function Ou(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ou=function(t){return typeof t}:Ou=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(e)}function jk(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Vk.bind(this))}function Vk(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),qk(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Mk(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var qk,Mk,u=La(()=>{"use strict";qk=function(t){return typeof t=="string"},Mk=function(t){return t instanceof Blob};jk.call((typeof window>"u"?"undefined":Ou(window))==="object"?window:{})});var Vg=It(Xs=>{"use strict";d();c();l();u();Object.defineProperty(Xs,"__esModule",{value:!0});function $v(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 Lk(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uk(e,t,r){return t=Ua(t),Bk(e,Yv()?Reflect.construct(t,r||[],Ua(e).constructor):t.apply(e,r))}function qg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hv(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,zk(n.key),n)}}function Mg(e,t,r){return t&&Hv(e.prototype,t),r&&Hv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Wk(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,i=!0,p=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return i=f.done,f},e:function(f){p=!0,a=f},f:function(){try{i||r.return==null||r.return()}finally{if(p)throw a}}}}function Ng(){return Ng=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Gk(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Ng.apply(null,arguments)}function Ua(e){return Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ua(e)}function Qk(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&&Dg(e,t)}function Yv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Yv=function(){return!!e})()}function Bk(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 Lk(e)}function Dg(e,t){return Dg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Dg(e,t)}function Gk(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ua(e))!==null;);return e}function $k(e,t,r,n){var o=Ng(Ua(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function Hk(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 zk(e){var t=Hk(e,"string");return typeof t=="symbol"?t:t+""}function Wk(e,t){if(e){if(typeof e=="string")return $v(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)?$v(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Yk(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 Kk(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 Wv=function(){function e(){qg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Mg(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],a=0,i=o.length;a<i;a++)if(o[a].callback===n){o.splice(a,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],a=o.slice(),i=function(){var g=a[p];try{g.callback.call(n,r)}catch(A){Promise.resolve().then(function(){throw A})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),jg=function(e){function t(){var r;return qg(this,t),r=Uk(this,t),r.listeners||Wv.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 Qk(t,e),Mg(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)),$k(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,a=o===void 0?"Aborted":o;if(n)throw a}}],[{key:"timeout",value:function(n){var o=new _u;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new _u;function a(){o.abort(this.reason),i()}function i(){var g=zv(n),A;try{for(g.s();!(A=g.n()).done;){var x=A.value;x.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=zv(n),f;try{for(p.s();!(f=p.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",a)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(Wv),_u=function(){function e(){qg(this,e),Object.defineProperty(this,"signal",{value:new jg,writable:!0,configurable:!0})}return Mg(e,[{key:"abort",value:function(r){var n=Kk(r),o=Yk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(_u.prototype[Symbol.toStringTag]="AbortController",jg.prototype[Symbol.toStringTag]="AbortSignal");function Xk(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 Zk(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,a=t.AbortController,i=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=i===void 0?!1:i;if(!Xk({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||p)&&(f=function(x,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(x,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var y=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var w=new Promise(function(I,F){y.addEventListener("abort",function(){return F(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,m(x,h)])}return m(x,h)};return{fetch:g,Request:f}}Xs.AbortController=_u;Xs.AbortSignal=jg;Xs.abortableFetch=Zk});var Kv,s,v,l=La(()=>{"use strict";Kv=Fr(Vg(),1),s=Fr(Vg(),1),{fetch:v}=(0,Kv.abortableFetch)({fetch})});function Lg(e){return typeof e!="string"||e in{}}function Ug(){return Object.create(null)}function Xv(e){return typeof e=="string"&&!!e.trim()}function Qg(e,t){var r=e.split(";").filter(Xv),n=r.shift();if(!n)return null;var o=Jk(n),a=o.name,i=o.value;if(t=t?Object.assign({},Nu,t):Nu,Lg(a))return null;try{i=t.decodeValues?decodeURIComponent(i):i}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var p=Ug();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Lg(g)){var A=m.join("=").trim();if(g==="expires")p.expires=new Date(A);else if(g==="max-age"){var x=parseInt(A,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=A:g==="partitioned"?p.partitioned=!0:g&&(p[g]=A)}}),p}function Jk(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Qa(e,t){if(t=t?Object.assign({},Nu,t):Nu,!e)return t.map?Ug():[];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(i){return i.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,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(Xv),n&&(e=e.map(Du).flat()),t.map){var a=Ug();return e.reduce(function(i,p){var f=Qg(p,t);return f&&!Lg(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return Qg(i,t)}).filter(Boolean)}function Du(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,p;function f(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function m(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;f();)if(o=e.charAt(r),o===","){for(a=r,r+=1,f(),i=r;r<e.length&&m();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Nu,Zv=La(()=>{"use strict";d();c();l();u();Nu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Qa.parseSetCookie=Qa;Qa.parse=Qa;Qa.parseString=Qg;Qa.splitCookiesString=Du});function Zs(e){if(eO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Bg(e){return e.replace(tO,"")}function Js(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||!rO(r))return!1}return!0}function rO(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function eA(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 eO,Jv,tO,tA,Ba,Gg,rA,C,oA=La(()=>{"use strict";d();c();l();u();Zv();eO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Jv=[`
19
- `,"\r","\t"," "],tO=new RegExp(`(^[${Jv.join("")}]|$[${Jv.join("")}])`,"g");Ba=Symbol("normalizedHeaders"),Gg=Symbol("rawHeaderNames"),rA=", ",C=class nA{constructor(t){this[Ba]={},this[Gg]=new Map,this[tA]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof nA||typeof S.Headers<"u"&&t instanceof S.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(rA):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(rA):n)})}[(tA=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[Ba]).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(!Js(t))throw new TypeError(`Invalid header name "${t}"`);return this[Ba].hasOwnProperty(Zs(t))}get(t){if(!Js(t))throw TypeError(`Invalid header name "${t}"`);return this[Ba][Zs(t)]??null}set(t,r){if(!Js(t)||!eA(r))return;let n=Zs(t),o=Bg(r);this[Ba][n]=Bg(o),this[Gg].set(n,t)}append(t,r){if(!Js(t)||!eA(r))return;let n=Zs(t),o=Bg(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Js(t)||!this.has(t))return;let r=Zs(t);delete this[Ba][r],this[Gg].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Du(t)}}});var d=La(()=>{"use strict";oA()});var lA=It(rc=>{"use strict";d();c();l();u();var Qu=rc&&rc.__assign||function(){return Qu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Qu.apply(this,arguments)};Object.defineProperty(rc,"__esModule",{value:!0});var dO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function pO(e){var t=Qu(Qu({},dO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}rc.getSanitizedOptions=pO});var dA=It(Yg=>{"use strict";d();c();l();u();Object.defineProperty(Yg,"__esModule",{value:!0});function fO(e){var t=Math.random()*e;return Math.round(t)}Yg.fullJitter=fO});var pA=It(Kg=>{"use strict";d();c();l();u();Object.defineProperty(Kg,"__esModule",{value:!0});function mO(e){return e}Kg.noJitter=mO});var fA=It(Xg=>{"use strict";d();c();l();u();Object.defineProperty(Xg,"__esModule",{value:!0});var gO=dA(),hO=pA();function yO(e){return e.jitter==="full"?gO.fullJitter:hO.noJitter}Xg.JitterFactory=yO});var Jg=It(Zg=>{"use strict";d();c();l();u();Object.defineProperty(Zg,"__esModule",{value:!0});var SO=fA(),vO=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=SO.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,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Zg.Delay=vO});var mA=It(Rn=>{"use strict";d();c();l();u();var AO=Rn&&Rn.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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)}}(),CO=Rn&&Rn.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(A){i(A)}}function f(g){try{m(n.throw(g))}catch(A){i(A)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},bO=Rn&&Rn.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Rn,"__esModule",{value:!0});var xO=Jg(),wO=function(e){AO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return CO(this,void 0,void 0,function(){return bO(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}(xO.Delay);Rn.SkipFirstDelay=wO});var gA=It(nc=>{"use strict";d();c();l();u();var RO=nc&&nc.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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(nc,"__esModule",{value:!0});var IO=Jg(),EO=function(e){RO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(IO.Delay);nc.AlwaysDelay=EO});var hA=It(eh=>{"use strict";d();c();l();u();Object.defineProperty(eh,"__esModule",{value:!0});var FO=mA(),TO=gA();function PO(e,t){var r=kO(e);return r.setAttemptNumber(t),r}eh.DelayFactory=PO;function kO(e){return e.delayFirstAttempt?new TO.AlwaysDelay(e):new FO.SkipFirstDelay(e)}});var yA=It(qo=>{"use strict";d();c();l();u();var th=qo&&qo.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(A){i(A)}}function f(g){try{m(n.throw(g))}catch(A){i(A)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},rh=qo&&qo.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(qo,"__esModule",{value:!0});var OO=lA(),_O=hA();function NO(e,t){return t===void 0&&(t={}),th(this,void 0,void 0,function(){var r,n;return rh(this,function(o){switch(o.label){case 0:return r=OO.getSanitizedOptions(t),n=new DO(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qo.backOff=NO;var DO=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return th(this,void 0,void 0,function(){var t,r;return rh(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 th(this,void 0,void 0,function(){var t;return rh(this,function(r){switch(r.label){case 0:return t=_O.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Gu=It((nh,oh)=>{"use strict";d();c();l();u();(function(e,t){typeof nh=="object"&&typeof oh<"u"?oh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs=t()})(nh,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",p="day",f="week",m="month",g="quarter",A="year",x="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|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,w={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(N){var D=["th","st","nd","rd"],M=N%100;return"["+N+(D[(M-20)%10]||D[M]||D[0])+"]"}},I=function(N,D,M){var W=String(N);return!W||W.length>=D?N:""+Array(D+1-W.length).join(M)+N},F={s:I,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),z=M%60;return(D<=0?"+":"-")+I(W,2,"0")+":"+I(z,2,"0")},m:function N(D,M){if(D.date()<M.date())return-N(M,D);var W=12*(M.year()-D.year())+(M.month()-D.month()),z=D.clone().add(W,m),re=M-z<0,Z=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-z)/(re?z-Z:Z-z))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:A,w:f,d:p,D:x,h:i,m:a,s:o,ms:n,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",k={};k[E]=w;var T="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[T])},G=function N(D,M,W){var z;if(!D)return E;if(typeof D=="string"){var re=D.toLowerCase();k[re]&&(z=re),M&&(k[re]=M,z=re);var Z=D.split("-");if(!z&&Z.length>1)return N(Z[0])}else{var K=D.name;k[K]=D,z=K}return!W&&z&&(E=z),z||!W&&E},Q=function(N,D){if(q(N))return N.clone();var M=typeof D=="object"?D:{};return M.date=N,M.args=arguments,new B(M)},V=F;V.l=G,V.i=q,V.w=function(N,D){return Q(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var B=function(){function N(M){this.$L=G(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[T]=!0}var D=N.prototype;return D.parse=function(M){this.$d=function(W){var z=W.date,re=W.utc;if(z===null)return new Date(NaN);if(V.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var Z=z.match(y);if(Z){var K=Z[2]-1||0,ce=(Z[7]||"0").substring(0,3);return re?new Date(Date.UTC(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)):new Date(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)}}return new Date(z)}(M),this.init()},D.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},D.$utils=function(){return V},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(M,W){var z=Q(M);return this.startOf(W)<=z&&z<=this.endOf(W)},D.isAfter=function(M,W){return Q(M)<this.startOf(W)},D.isBefore=function(M,W){return this.endOf(W)<Q(M)},D.$g=function(M,W,z){return V.u(M)?this[W]:this.set(z,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var z=this,re=!!V.u(W)||W,Z=V.p(M),K=function(Te,Ie){var De=V.w(z.$u?Date.UTC(z.$y,Ie,Te):new Date(z.$y,Ie,Te),z);return re?De:De.endOf(p)},ce=function(Te,Ie){return V.w(z.toDate()[Te].apply(z.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(Ie)),z)},ve=this.$W,Le=this.$M,nt=this.$D,$e="set"+(this.$u?"UTC":"");switch(Z){case A:return re?K(1,0):K(31,11);case m:return re?K(1,Le):K(0,Le+1);case f:var Je=this.$locale().weekStart||0,et=(ve<Je?ve+7:ve)-Je;return K(re?nt-et:nt+(6-et),Le);case p:case x:return ce($e+"Hours",0);case i:return ce($e+"Minutes",1);case a:return ce($e+"Seconds",2);case o:return ce($e+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var z,re=V.p(M),Z="set"+(this.$u?"UTC":""),K=(z={},z[p]=Z+"Date",z[x]=Z+"Date",z[m]=Z+"Month",z[A]=Z+"FullYear",z[i]=Z+"Hours",z[a]=Z+"Minutes",z[o]=Z+"Seconds",z[n]=Z+"Milliseconds",z)[re],ce=re===p?this.$D+(W-this.$W):W;if(re===m||re===A){var ve=this.clone().set(x,1);ve.$d[K](ce),ve.init(),this.$d=ve.set(x,Math.min(this.$D,ve.daysInMonth())).$d}else K&&this.$d[K](ce);return this.init(),this},D.set=function(M,W){return this.clone().$set(M,W)},D.get=function(M){return this[V.p(M)]()},D.add=function(M,W){var z,re=this;M=Number(M);var Z=V.p(W),K=function(Le){var nt=Q(re);return V.w(nt.date(nt.date()+Math.round(Le*M)),re)};if(Z===m)return this.set(m,this.$M+M);if(Z===A)return this.set(A,this.$y+M);if(Z===p)return K(1);if(Z===f)return K(7);var ce=(z={},z[a]=t,z[i]=r,z[o]=e,z)[Z]||1,ve=this.$d.getTime()+M*ce;return V.w(ve,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,z=this.$locale();if(!this.isValid())return z.invalidDate||h;var re=M||"YYYY-MM-DDTHH:mm:ssZ",Z=V.z(this),K=this.$H,ce=this.$m,ve=this.$M,Le=z.weekdays,nt=z.months,$e=z.meridiem,Je=function(Ie,De,Pe,gt){return Ie&&(Ie[De]||Ie(W,re))||Pe[De].slice(0,gt)},et=function(Ie){return V.s(K%12||12,Ie,"0")},Te=$e||function(Ie,De,Pe){var gt=Ie<12?"AM":"PM";return Pe?gt.toLowerCase():gt};return re.replace(b,function(Ie,De){return De||function(Pe){switch(Pe){case"YY":return String(W.$y).slice(-2);case"YYYY":return V.s(W.$y,4,"0");case"M":return ve+1;case"MM":return V.s(ve+1,2,"0");case"MMM":return Je(z.monthsShort,ve,nt,3);case"MMMM":return Je(nt,ve);case"D":return W.$D;case"DD":return V.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Je(z.weekdaysMin,W.$W,Le,2);case"ddd":return Je(z.weekdaysShort,W.$W,Le,3);case"dddd":return Le[W.$W];case"H":return String(K);case"HH":return V.s(K,2,"0");case"h":return et(1);case"hh":return et(2);case"a":return Te(K,ce,!0);case"A":return Te(K,ce,!1);case"m":return String(ce);case"mm":return V.s(ce,2,"0");case"s":return String(W.$s);case"ss":return V.s(W.$s,2,"0");case"SSS":return V.s(W.$ms,3,"0");case"Z":return Z}return null}(Ie)||Z.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,z){var re,Z=this,K=V.p(W),ce=Q(M),ve=(ce.utcOffset()-this.utcOffset())*t,Le=this-ce,nt=function(){return V.m(Z,ce)};switch(K){case A:re=nt()/12;break;case m:re=nt();break;case g:re=nt()/3;break;case f:re=(Le-ve)/6048e5;break;case p:re=(Le-ve)/864e5;break;case i:re=Le/r;break;case a:re=Le/t;break;case o:re=Le/e;break;default:re=Le}return z?re:V.a(re)},D.daysInMonth=function(){return this.endOf(m).$D},D.$locale=function(){return k[this.$L]},D.locale=function(M,W){if(!M)return this.$L;var z=this.clone(),re=G(M,W,!0);return re&&(z.$L=re),z},D.clone=function(){return V.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N}(),L=B.prototype;return Q.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",m],["$y",A],["$D",x]].forEach(function(N){L[N[1]]=function(D){return this.$g(D,N[0],N[1])}}),Q.extend=function(N,D){return N.$i||(N(D,B,Q),N.$i=!0),Q},Q.locale=G,Q.isDayjs=q,Q.unix=function(N){return Q(1e3*N)},Q.en=k[E],Q.Ls=k,Q.p={},Q})});var bA=It((ah,ih)=>{"use strict";d();c();l();u();(function(e,t){typeof ah=="object"&&typeof ih<"u"?ih.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_quarterOfYear=t()})(ah,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var a=o.add;o.add=function(p,f){return p=Number(p),this.$utils().p(f)===t?this.add(3*p,e):a.bind(this)(p,f)};var i=o.startOf;o.startOf=function(p,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(p)===t){var A=this.quarter()-1;return g?this.month(3*A).startOf(e).startOf("day"):this.month(3*A+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var xA=It((sh,ch)=>{"use strict";d();c();l();u();(function(e,t){typeof sh=="object"&&typeof ch<"u"?ch.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_customParseFormat=t()})(sh,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/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,i={},p=function(y){return(y=+y)+(y>68?1900:2e3)},f=function(y){return function(b){this[y]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var w=b.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(y)}],g=function(y){var b=i[y];return b&&(b.indexOf?b:b.s.concat(b.f))},A=function(y,b){var w,I=i.meridiem;if(I){for(var F=1;F<=24;F+=1)if(y.indexOf(I(F,0,b))>-1){w=F>12;break}}else w=y===(b?"pm":"PM");return w},x={A:[a,function(y){this.afternoon=A(y,!1)}],a:[a,function(y){this.afternoon=A(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:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[a,function(y){var b=i.ordinal,w=y.match(/\d+/);if(this.day=w[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(y){var b=g("months"),w=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(y){this.year=p(y)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(y){var b,w;b=y,w=i&&i.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,V,B){var L=B&&B.toUpperCase();return V||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),F=I.length,E=0;E<F;E+=1){var k=I[E],T=x[k],q=T&&T[0],G=T&&T[1];I[E]=G?{regex:q,parser:G}:k.replace(/^\[|\]$/g,"")}return function(Q){for(var V={},B=0,L=0;B<F;B+=1){var N=I[B];if(typeof N=="string")L+=N.length;else{var D=N.regex,M=N.parser,W=Q.slice(L),z=D.exec(W)[0];M.call(V,z),Q=Q.replace(z,"")}}return function(re){var Z=re.afternoon;if(Z!==void 0){var K=re.hours;Z?K<12&&(re.hours+=12):K===12&&(re.hours=0),delete re.afternoon}}(V),V}}return function(y,b,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(p=y.parseTwoDigitYear);var I=b.prototype,F=I.parse;I.parse=function(E){var k=E.date,T=E.utc,q=E.args;this.$u=T;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,V=q[3]===!0,B=Q||V,L=q[2];V&&(L=q[2]),i=this.$locale(),!Q&&L&&(i=w.Ls[L]),this.$d=function(W,z,re,Z){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*W);var K=h(z)(W),ce=K.year,ve=K.month,Le=K.day,nt=K.hours,$e=K.minutes,Je=K.seconds,et=K.milliseconds,Te=K.zone,Ie=K.week,De=new Date,Pe=Le||(ce||ve?1:De.getDate()),gt=ce||De.getFullYear(),At=0;ce&&!ve||(At=ve>0?ve-1:De.getMonth());var Ir,ir=nt||0,Vr=$e||0,fr=Je||0,Er=et||0;return Te?new Date(Date.UTC(gt,At,Pe,ir,Vr,fr,Er+60*Te.offset*1e3)):re?new Date(Date.UTC(gt,At,Pe,ir,Vr,fr,Er)):(Ir=new Date(gt,At,Pe,ir,Vr,fr,Er),Ie&&(Ir=Z(Ir).week(Ie).toDate()),Ir)}catch{return new Date("")}}(k,G,T,w),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(G)&&(this.$d=new Date("")),i={}}else if(G instanceof Array)for(var N=G.length,D=1;D<=N;D+=1){q[1]=G[D-1];var M=w.apply(this,q);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}D===N&&(this.$d=new Date(""))}else F.call(this,E)}}})});var nR=It((yS,SS)=>{"use strict";d();c();l();u();(function(e,t){typeof yS=="object"&&typeof SS<"u"?SS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(yS,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var a,i=function(g,A,x){x===void 0&&(x={});var h=new Date(g),y=function(b,w){w===void 0&&(w={});var I=w.timeZoneName||"short",F=b+"|"+I,E=t[F];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[F]=E),E}(A,x);return y.formatToParts(h)},p=function(g,A){for(var x=i(g,A),h=[],y=0;y<x.length;y+=1){var b=x[y],w=b.type,I=b.value,F=e[w];F>=0&&(h[F]=parseInt(I,10))}var E=h[3],k=E===24?0:E,T=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",q=+g;return(o.utc(T).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(g,A){g===void 0&&(g=a);var x,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),w=Math.round((y-new Date(b))/1e3/60),I=15*-Math.round(y.getTimezoneOffset()/15)-w;if(!Number(I))x=this.utcOffset(0,A);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),A){var F=x.utcOffset();x=x.add(h-F,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var A=this.$x.$timezone||o.tz.guess(),x=i(this.valueOf(),A,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,A){if(!this.$x||!this.$x.$timezone)return m.call(this,g,A);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,A).tz(this.$x.$timezone,!0)},o.tz=function(g,A,x){var h=x&&A,y=x||A||a,b=p(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=function(k,T,q){var G=k-60*T*1e3,Q=p(G,q);if(T===Q)return[G,T];var V=p(G-=60*(Q-T)*1e3,q);return Q===V?[G,Q]:[k-60*Math.min(Q,V)*1e3,Math.max(Q,V)]}(o.utc(g,h).valueOf(),b,y),I=w[0],F=w[1],E=o(I).utcOffset(F);return E.$x.$timezone=y,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var oR=It((vS,AS)=>{"use strict";d();c();l();u();(function(e,t){typeof vS=="object"&&typeof AS<"u"?AS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_utc=t()})(vS,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},i.utc=function(h){var y=a(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var p=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var f=i.init;i.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=i.utcOffset;i.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(E){E===void 0&&(E="");var k=E.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],q=T[0],G=60*+T[1]+ +T[2];return G===0?0:q==="+"?G:-G}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=w,I.$u=!1,I;var F=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+F,e)).$offset=w,I.$x.$localOffset=F,I};var g=i.format;i.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var A=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():A.call(this)};var x=i.diff;i.diff=function(h,y,b){if(h&&this.$u===h.$u)return x.call(this,h,y,b);var w=this.local(),I=a(h).local();return x.call(w,I,y,b)}}})});var xE=It((Lwe,bE)=>{"use strict";d();c();l();u();function eQ(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}bE.exports=tQ;function tQ(e,t,r){var n=r&&r.stringify||eQ,o=1;if(typeof e=="object"&&e!==null){var a=t.length+o;if(a===1)return e;var i=new Array(a);i[0]=n(e);for(var p=1;p<a;p++)i[p]=n(t[p]);return i.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var m="",g=1-o,A=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(A=A>-1?A:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;A<h&&(m+=e.slice(A,h)),m+=Number(t[g]),A=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;A<h&&(m+=e.slice(A,h)),m+=Math.floor(Number(t[g])),A=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;A<h&&(m+=e.slice(A,h));var y=typeof t[g];if(y==="string"){m+="'"+t[g]+"'",A=h+2,h++;break}if(y==="function"){m+=t[g].name||"<anonymous>",A=h+2,h++;break}m+=n(t[g]),A=h+2,h++;break;case 115:if(g>=f)break;A<h&&(m+=e.slice(A,h)),m+=String(t[g]),A=h+2,h++;break;case 37:A<h&&(m+=e.slice(A,h)),m+="%",A=h+2,h++,g--;break}++g}++h}return A===-1?e:(A<x&&(m+=e.slice(A)),m)}});var PE=It(($we,jf)=>{"use strict";d();c();l();u();var wE=xE();jf.exports=Vn;var du=hQ().console||{},rQ={mapHttpRequest:Mf,mapHttpResponse:Mf,wrapRequestSerializer:lv,wrapResponseSerializer:lv,wrapErrorSerializer:lv,req:Mf,res:Mf,err:IE,errWithCause:IE};function So(e,t){return e==="silent"?1/0:t.levels.values[e]}var fv=Symbol("pino.logFuncs"),dv=Symbol("pino.hierarchy"),nQ={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function RE(e,t){let r={logger:t,parent:e[dv]};t[dv]=r}function oQ(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:du[o]||du[nQ[o]||"log"]||cs}),e[fv]=n}function aQ(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Vn(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||du;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=aQ(e.browser.serialize,n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);let i=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&p.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=cs),oQ(m,p,r),RE({},m),Object.defineProperty(m,"levelVal",{get:A}),Object.defineProperty(m,"level",{get:x,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:p,timestamp:fQ(e),messageKey:e.messageKey||"msg",onChild:e.onChild||cs};m.levels=iQ(e),m.level=f,m.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=cs,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...b){return y.call(this,g,...b)},t&&(m._logEvent=pv());function A(){return So(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Oa(this,g,m,"error"),Oa(this,g,m,"fatal"),Oa(this,g,m,"warn"),Oa(this,g,m,"info"),Oa(this,g,m,"debug"),Oa(this,g,m,"trace"),i.forEach(w=>{Oa(this,g,m,w)})}function y(b,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let F=I.serializers;if(o&&F){var E=Object.assign({},n,F),k=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,mv([w],k,E,this._stdErrSerialize)}function T(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=k),t&&(this._logEvent=pv([].concat(G._logEvent.bindings,w)))}T.prototype=this;let q=new T(this);return RE(this,q),q.child=function(...G){return y.call(this,b,...G)},q.level=I.level||this.level,b.onChild(q),q}return m}function iQ(e){let t=e.customLevels||{},r=Object.assign({},Vn.levels.values,t),n=Object.assign({},Vn.levels.labels,sQ(t));return{values:r,labels:n}}function sQ(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Vn.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"}};Vn.stdSerializers=rQ;Vn.stdTimeFunctions=Object.assign({},{nullTime:FE,epochTime:TE,unixTime:mQ,isoTime:gQ});function cQ(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[dv];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Oa(e,t,r,n){if(Object.defineProperty(e,n,{value:So(e.level,r)>So(n,r)?cs:r[fv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===cs){if(!t.transmit)return;let a=t.transmit.level||e.level,i=So(a,r);if(So(n,r)<i)return}e[n]=lQ(e,t,r,n);let o=cQ(e);o.length!==0&&(e[n]=uQ(o,e[n]))}function uQ(e,t){return function(){return t.apply(this,[...e,...arguments])}}function lQ(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===du?du:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(mv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let A=dQ(this,n,p,i,t);if(t.reportCaller&&A&&A.length>0&&A[0]&&typeof A[0]=="object")try{let x=EE();x&&(A[0].caller=x)}catch{}o.call(f,...A)}else{if(t.reportCaller)try{let A=EE();A&&p.push(A)}catch{}o.apply(f,p)}if(t.transmit){let A=t.transmit.level||e._level,x=So(A,r),h=So(n,r);if(h<x)return;pQ(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:A,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:So(e._level,r)},p,g)}}}(e[fv][n])}function dQ(e,t,r,n,o){let{level:a,log:i=A=>A}=o.formatters||{},p=r.slice(),f=p[0],m={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(m.time=n),a){let A=a(t,e.levels.values[t]);Object.assign(m,A)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());return[i(m),...p]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());f=p.length?wE(p.shift(),p):void 0}else typeof f=="string"&&(f=wE(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function mv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Vn.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let a in e[o])t.indexOf(a)>-1&&a in r&&(e[o][a]=r[a](e[o][a]))}function pQ(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,p=t.methodValue,f=t.val,m=e._logEvent.bindings;n||mv(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=r.filter(function(g){return m.indexOf(g)===-1}),e._logEvent.level.label=i,e._logEvent.level.value=p,o(i,e._logEvent,f),e._logEvent=pv(m)}function pv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function IE(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 fQ(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?FE:TE}function Mf(){return{}}function lv(e){return e}function cs(){}function FE(){return!1}function TE(){return Date.now()}function mQ(){return Math.round(Date.now()/1e3)}function gQ(){return new Date(Date.now()).toISOString()}function hQ(){function e(t){return typeof t<"u"&&t}try{return typeof S<"u"?S:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),S)}catch{return e(self)||e(window)||e(this)||{}}}jf.exports.default=Vn;jf.exports.pino=Vn;function EE(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
- `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let a=o[1],i=o[2],p=o[3];return a+":"+i+":"+p}}return null}});var y2={};Ks(y2,{HighlightUtils:()=>Wg,ResultTemplatesHelpers:()=>rw,SortOrder:()=>Ul,VERSION:()=>Wn,buildAttachToCase:()=>UE,buildAttachedResults:()=>QE,buildBreadcrumbManager:()=>yF,buildCategoryFacet:()=>QF,buildController:()=>he,buildCriterionExpression:()=>Hr,buildDateFacet:()=>cT,buildDateFilter:()=>lT,buildDateRange:()=>xs,buildDateSortCriterion:()=>Wb,buildDidYouMean:()=>RF,buildFacet:()=>rT,buildFacetConditionsManager:()=>TF,buildFacetManager:()=>kF,buildFoldedResultList:()=>IT,buildGeneratedAnswer:()=>PT,buildInsightEngine:()=>ME,buildInsightInterface:()=>hk,buildInteractiveCitation:()=>OT,buildInteractiveResult:()=>JT,buildNotifyTrigger:()=>sk,buildNumericFacet:()=>mT,buildNumericFilter:()=>hT,buildNumericRange:()=>$m,buildPager:()=>MT,buildQueryError:()=>VT,buildQuerySummary:()=>UT,buildQuickview:()=>$T,buildRecentQueriesList:()=>XT,buildRelevanceSortCriterion:()=>Bl,buildResultList:()=>eP,buildResultTemplatesManager:()=>Ik,buildResultsPerPage:()=>rP,buildSearchBox:()=>gP,buildSearchParameterManager:()=>DP,buildSearchStatus:()=>KP,buildSmartSnippet:()=>UP,buildSmartSnippetQuestionsList:()=>GP,buildSort:()=>YP,buildTab:()=>ZP,buildUserActions:()=>gk,deserializeRelativeDate:()=>NA,getAnalyticsNextApiBaseUrl:()=>Bu,getOrganizationEndpoint:()=>mt,getSampleInsightEngineConfiguration:()=>gv,loadAttachedResultsActions:()=>XG,loadAttachedResultsAnalyticsActions:()=>ZG,loadCaseContextActions:()=>JG,loadContextActions:()=>t2,loadDateFacetSetActions:()=>r2,loadFieldActions:()=>o2,loadFoldingActions:()=>a2,loadGeneratedAnswerActions:()=>i2,loadGenericAnalyticsActions:()=>YG,loadInsightAnalyticsActions:()=>KG,loadInsightInterfaceActions:()=>s2,loadInsightSearchActions:()=>u2,loadInsightSearchAnalyticsActions:()=>l2,loadInsightUserActionsActions:()=>d2,loadNumericFacetSetActions:()=>n2,loadQuerySetActions:()=>c2,loadQuerySuggestActions:()=>p2,loadQuestionAnsweringActions:()=>f2,loadRecentResultsActions:()=>m2});module.exports=Dk(y2);d();c();l();u();var Wg={};Ks(Wg,{escapeHtml:()=>Wa,getHighlightedSuggestion:()=>zg,highlightString:()=>lO});d();c();l();u();d();c();l();u();function nO(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessInsight",["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["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Pk=Object.create;var Ws=Object.defineProperty;var kk=Object.getOwnPropertyDescriptor;var Ok=Object.getOwnPropertyNames;var _k=Object.getPrototypeOf,Nk=Object.prototype.hasOwnProperty;var Dk=(e,t,r)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Li=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Et=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ys=(e,t)=>{for(var r in t)Ws(e,r,{get:t[r],enumerable:!0})},Bv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ok(t))!Nk.call(e,o)&&o!==r&&Ws(e,o,{get:()=>t[o],enumerable:!(n=kk(t,o))||n.enumerable});return e};var Fr=(e,t,r)=>(r=e!=null?Pk(_k(e)):{},Bv(t||!e||!e.__esModule?Ws(r,"default",{value:e,enumerable:!0}):r,e)),qk=e=>Bv(Ws({},"__esModule",{value:!0}),e);var de=(e,t,r)=>Dk(e,typeof t!="symbol"?t+"":t,r);var S,c=Li(()=>{"use strict";S=typeof globalThis<"u"?globalThis:window});function Ou(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ou=function(t){return typeof t}:Ou=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(e)}function Vk(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Lk.bind(this))}function Lk(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),Mk(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):jk(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Mk,jk,u=Li(()=>{"use strict";Mk=function(t){return typeof t=="string"},jk=function(t){return t instanceof Blob};Vk.call((typeof window>"u"?"undefined":Ou(window))==="object"?window:{})});var Lg=Et(Ks=>{"use strict";d();c();l();u();Object.defineProperty(Ks,"__esModule",{value:!0});function Gv(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 Uk(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qk(e,t,r){return t=Ui(t),Gk(e,Wv()?Reflect.construct(t,r||[],Ui(e).constructor):t.apply(e,r))}function Mg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $v(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,Wk(n.key),n)}}function jg(e,t,r){return t&&$v(e.prototype,t),r&&$v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Yk(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,p=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return a=f.done,f},e:function(f){p=!0,i=f},f:function(){try{a||r.return==null||r.return()}finally{if(p)throw i}}}}function Dg(){return Dg=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=$k(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Dg.apply(null,arguments)}function Ui(e){return Ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ui(e)}function Bk(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&&qg(e,t)}function Wv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wv=function(){return!!e})()}function Gk(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 Uk(e)}function qg(e,t){return qg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},qg(e,t)}function $k(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ui(e))!==null;);return e}function Hk(e,t,r,n){var o=Dg(Ui(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function zk(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 Wk(e){var t=zk(e,"string");return typeof t=="symbol"?t:t+""}function Yk(e,t){if(e){if(typeof e=="string")return Gv(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)?Gv(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Kk(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 Xk(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 zv=function(){function e(){Mg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return jg(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[p];try{g.callback.call(n,r)}catch(A){Promise.resolve().then(function(){throw A})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=i.length;p<f;p++)a();return!r.defaultPrevented}}}])}(),Vg=function(e){function t(){var r;return Mg(this,t),r=Qk(this,t),r.listeners||zv.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 Bk(t,e),jg(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)),Hk(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new _u;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new _u;function i(){o.abort(this.reason),a()}function a(){var g=Hv(n),A;try{for(g.s();!(A=g.n()).done;){var x=A.value;x.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var p=Hv(n),f;try{for(p.s();!(f=p.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",i)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(zv),_u=function(){function e(){Mg(this,e),Object.defineProperty(this,"signal",{value:new Vg,writable:!0,configurable:!0})}return jg(e,[{key:"abort",value:function(r){var n=Xk(r),o=Kk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(_u.prototype[Symbol.toStringTag]="AbortController",Vg.prototype[Symbol.toStringTag]="AbortSignal");function Zk(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 Jk(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=a===void 0?!1:a;if(!Zk({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||p)&&(f=function(x,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(x,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var y=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var w=new Promise(function(I,F){y.addEventListener("abort",function(){return F(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,m(x,h)])}return m(x,h)};return{fetch:g,Request:f}}Ks.AbortController=_u;Ks.AbortSignal=Vg;Ks.abortableFetch=Jk});var Yv,s,v,l=Li(()=>{"use strict";Yv=Fr(Lg(),1),s=Fr(Lg(),1),{fetch:v}=(0,Yv.abortableFetch)({fetch})});function Ug(e){return typeof e!="string"||e in{}}function Qg(){return Object.create(null)}function Kv(e){return typeof e=="string"&&!!e.trim()}function Bg(e,t){var r=e.split(";").filter(Kv),n=r.shift();if(!n)return null;var o=eO(n),i=o.name,a=o.value;if(t=t?Object.assign({},Nu,t):Nu,Ug(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var p=Qg();return p.name=i,p.value=a,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Ug(g)){var A=m.join("=").trim();if(g==="expires")p.expires=new Date(A);else if(g==="max-age"){var x=parseInt(A,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=A:g==="partitioned"?p.partitioned=!0:g&&(p[g]=A)}}),p}function eO(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Qi(e,t){if(t=t?Object.assign({},Nu,t):Nu,!e)return t.map?Qg():[];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(a){return a.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,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(Kv),n&&(e=e.map(Du).flat()),t.map){var i=Qg();return e.reduce(function(a,p){var f=Bg(p,t);return f&&!Ug(f.name)&&(a[f.name]=f),a},i)}else return e.map(function(a){return Bg(a,t)}).filter(Boolean)}function Du(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,p;function f(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function m(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;f();)if(o=e.charAt(r),o===","){for(i=r,r+=1,f(),a=r;r<e.length&&m();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Nu,Xv=Li(()=>{"use strict";d();c();l();u();Nu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Qi.parseSetCookie=Qi;Qi.parse=Qi;Qi.parseString=Bg;Qi.splitCookiesString=Du});function Xs(e){if(tO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Gg(e){return e.replace(rO,"")}function Zs(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||!nO(r))return!1}return!0}function nO(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Jv(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 tO,Zv,rO,eA,Bi,$g,tA,C,nA=Li(()=>{"use strict";d();c();l();u();Xv();tO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Zv=[`
19
+ `,"\r","\t"," "],rO=new RegExp(`(^[${Zv.join("")}]|$[${Zv.join("")}])`,"g");Bi=Symbol("normalizedHeaders"),$g=Symbol("rawHeaderNames"),tA=", ",C=class rA{constructor(t){this[Bi]={},this[$g]=new Map,this[eA]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof rA||typeof S.Headers<"u"&&t instanceof S.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(tA):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(tA):n)})}[(eA=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[Bi]).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(!Zs(t))throw new TypeError(`Invalid header name "${t}"`);return this[Bi].hasOwnProperty(Xs(t))}get(t){if(!Zs(t))throw TypeError(`Invalid header name "${t}"`);return this[Bi][Xs(t)]??null}set(t,r){if(!Zs(t)||!Jv(r))return;let n=Xs(t),o=Gg(r);this[Bi][n]=Gg(o),this[$g].set(n,t)}append(t,r){if(!Zs(t)||!Jv(r))return;let n=Xs(t),o=Gg(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Zs(t)||!this.has(t))return;let r=Xs(t);delete this[Bi][r],this[$g].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Du(t)}}});var d=Li(()=>{"use strict";nA()});var uA=Et(tc=>{"use strict";d();c();l();u();var Qu=tc&&tc.__assign||function(){return Qu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Qu.apply(this,arguments)};Object.defineProperty(tc,"__esModule",{value:!0});var pO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function fO(e){var t=Qu(Qu({},pO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}tc.getSanitizedOptions=fO});var lA=Et(Kg=>{"use strict";d();c();l();u();Object.defineProperty(Kg,"__esModule",{value:!0});function mO(e){var t=Math.random()*e;return Math.round(t)}Kg.fullJitter=mO});var dA=Et(Xg=>{"use strict";d();c();l();u();Object.defineProperty(Xg,"__esModule",{value:!0});function gO(e){return e}Xg.noJitter=gO});var pA=Et(Zg=>{"use strict";d();c();l();u();Object.defineProperty(Zg,"__esModule",{value:!0});var hO=lA(),yO=dA();function SO(e){return e.jitter==="full"?hO.fullJitter:yO.noJitter}Zg.JitterFactory=SO});var eh=Et(Jg=>{"use strict";d();c();l();u();Object.defineProperty(Jg,"__esModule",{value:!0});var vO=pA(),AO=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=vO.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,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Jg.Delay=AO});var fA=Et(Rn=>{"use strict";d();c();l();u();var CO=Rn&&Rn.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),bO=Rn&&Rn.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(A){a(A)}}function f(g){try{m(n.throw(g))}catch(A){a(A)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},xO=Rn&&Rn.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=m[0]&2?o.return:m[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,m[1])).done)return i;switch(o=0,i&&(m=[m[0]&2,i.value]),m[0]){case 0:case 1:i=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){r.label=m[1];break}if(m[0]===6&&r.label<i[1]){r.label=i[1],i=m;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(m);break}i[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=i=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Rn,"__esModule",{value:!0});var wO=eh(),RO=function(e){CO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return bO(this,void 0,void 0,function(){return xO(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}(wO.Delay);Rn.SkipFirstDelay=RO});var mA=Et(rc=>{"use strict";d();c();l();u();var IO=rc&&rc.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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(rc,"__esModule",{value:!0});var EO=eh(),FO=function(e){IO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(EO.Delay);rc.AlwaysDelay=FO});var gA=Et(th=>{"use strict";d();c();l();u();Object.defineProperty(th,"__esModule",{value:!0});var TO=fA(),PO=mA();function kO(e,t){var r=OO(e);return r.setAttemptNumber(t),r}th.DelayFactory=kO;function OO(e){return e.delayFirstAttempt?new PO.AlwaysDelay(e):new TO.SkipFirstDelay(e)}});var hA=Et(qo=>{"use strict";d();c();l();u();var rh=qo&&qo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(A){a(A)}}function f(g){try{m(n.throw(g))}catch(A){a(A)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},nh=qo&&qo.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=m[0]&2?o.return:m[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,m[1])).done)return i;switch(o=0,i&&(m=[m[0]&2,i.value]),m[0]){case 0:case 1:i=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){r.label=m[1];break}if(m[0]===6&&r.label<i[1]){r.label=i[1],i=m;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(m);break}i[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=i=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(qo,"__esModule",{value:!0});var _O=uA(),NO=gA();function DO(e,t){return t===void 0&&(t={}),rh(this,void 0,void 0,function(){var r,n;return nh(this,function(o){switch(o.label){case 0:return r=_O.getSanitizedOptions(t),n=new qO(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}qo.backOff=DO;var qO=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return rh(this,void 0,void 0,function(){var t,r;return nh(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 rh(this,void 0,void 0,function(){var t;return nh(this,function(r){switch(r.label){case 0:return t=NO.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Gu=Et((oh,ih)=>{"use strict";d();c();l();u();(function(e,t){typeof oh=="object"&&typeof ih<"u"?ih.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs=t()})(oh,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",p="day",f="week",m="month",g="quarter",A="year",x="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|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,w={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(N){var D=["th","st","nd","rd"],M=N%100;return"["+N+(D[(M-20)%10]||D[M]||D[0])+"]"}},I=function(N,D,M){var W=String(N);return!W||W.length>=D?N:""+Array(D+1-W.length).join(M)+N},F={s:I,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),z=M%60;return(D<=0?"+":"-")+I(W,2,"0")+":"+I(z,2,"0")},m:function N(D,M){if(D.date()<M.date())return-N(M,D);var W=12*(M.year()-D.year())+(M.month()-D.month()),z=D.clone().add(W,m),re=M-z<0,Z=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-z)/(re?z-Z:Z-z))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:A,w:f,d:p,D:x,h:a,m:i,s:o,ms:n,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",k={};k[E]=w;var T="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[T])},G=function N(D,M,W){var z;if(!D)return E;if(typeof D=="string"){var re=D.toLowerCase();k[re]&&(z=re),M&&(k[re]=M,z=re);var Z=D.split("-");if(!z&&Z.length>1)return N(Z[0])}else{var K=D.name;k[K]=D,z=K}return!W&&z&&(E=z),z||!W&&E},Q=function(N,D){if(q(N))return N.clone();var M=typeof D=="object"?D:{};return M.date=N,M.args=arguments,new B(M)},V=F;V.l=G,V.i=q,V.w=function(N,D){return Q(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var B=function(){function N(M){this.$L=G(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[T]=!0}var D=N.prototype;return D.parse=function(M){this.$d=function(W){var z=W.date,re=W.utc;if(z===null)return new Date(NaN);if(V.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var Z=z.match(y);if(Z){var K=Z[2]-1||0,ce=(Z[7]||"0").substring(0,3);return re?new Date(Date.UTC(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)):new Date(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)}}return new Date(z)}(M),this.init()},D.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},D.$utils=function(){return V},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(M,W){var z=Q(M);return this.startOf(W)<=z&&z<=this.endOf(W)},D.isAfter=function(M,W){return Q(M)<this.startOf(W)},D.isBefore=function(M,W){return this.endOf(W)<Q(M)},D.$g=function(M,W,z){return V.u(M)?this[W]:this.set(z,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var z=this,re=!!V.u(W)||W,Z=V.p(M),K=function(Te,Ie){var De=V.w(z.$u?Date.UTC(z.$y,Ie,Te):new Date(z.$y,Ie,Te),z);return re?De:De.endOf(p)},ce=function(Te,Ie){return V.w(z.toDate()[Te].apply(z.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(Ie)),z)},ve=this.$W,Le=this.$M,nt=this.$D,$e="set"+(this.$u?"UTC":"");switch(Z){case A:return re?K(1,0):K(31,11);case m:return re?K(1,Le):K(0,Le+1);case f:var Je=this.$locale().weekStart||0,et=(ve<Je?ve+7:ve)-Je;return K(re?nt-et:nt+(6-et),Le);case p:case x:return ce($e+"Hours",0);case a:return ce($e+"Minutes",1);case i:return ce($e+"Seconds",2);case o:return ce($e+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var z,re=V.p(M),Z="set"+(this.$u?"UTC":""),K=(z={},z[p]=Z+"Date",z[x]=Z+"Date",z[m]=Z+"Month",z[A]=Z+"FullYear",z[a]=Z+"Hours",z[i]=Z+"Minutes",z[o]=Z+"Seconds",z[n]=Z+"Milliseconds",z)[re],ce=re===p?this.$D+(W-this.$W):W;if(re===m||re===A){var ve=this.clone().set(x,1);ve.$d[K](ce),ve.init(),this.$d=ve.set(x,Math.min(this.$D,ve.daysInMonth())).$d}else K&&this.$d[K](ce);return this.init(),this},D.set=function(M,W){return this.clone().$set(M,W)},D.get=function(M){return this[V.p(M)]()},D.add=function(M,W){var z,re=this;M=Number(M);var Z=V.p(W),K=function(Le){var nt=Q(re);return V.w(nt.date(nt.date()+Math.round(Le*M)),re)};if(Z===m)return this.set(m,this.$M+M);if(Z===A)return this.set(A,this.$y+M);if(Z===p)return K(1);if(Z===f)return K(7);var ce=(z={},z[i]=t,z[a]=r,z[o]=e,z)[Z]||1,ve=this.$d.getTime()+M*ce;return V.w(ve,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,z=this.$locale();if(!this.isValid())return z.invalidDate||h;var re=M||"YYYY-MM-DDTHH:mm:ssZ",Z=V.z(this),K=this.$H,ce=this.$m,ve=this.$M,Le=z.weekdays,nt=z.months,$e=z.meridiem,Je=function(Ie,De,Pe,gt){return Ie&&(Ie[De]||Ie(W,re))||Pe[De].slice(0,gt)},et=function(Ie){return V.s(K%12||12,Ie,"0")},Te=$e||function(Ie,De,Pe){var gt=Ie<12?"AM":"PM";return Pe?gt.toLowerCase():gt};return re.replace(b,function(Ie,De){return De||function(Pe){switch(Pe){case"YY":return String(W.$y).slice(-2);case"YYYY":return V.s(W.$y,4,"0");case"M":return ve+1;case"MM":return V.s(ve+1,2,"0");case"MMM":return Je(z.monthsShort,ve,nt,3);case"MMMM":return Je(nt,ve);case"D":return W.$D;case"DD":return V.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Je(z.weekdaysMin,W.$W,Le,2);case"ddd":return Je(z.weekdaysShort,W.$W,Le,3);case"dddd":return Le[W.$W];case"H":return String(K);case"HH":return V.s(K,2,"0");case"h":return et(1);case"hh":return et(2);case"a":return Te(K,ce,!0);case"A":return Te(K,ce,!1);case"m":return String(ce);case"mm":return V.s(ce,2,"0");case"s":return String(W.$s);case"ss":return V.s(W.$s,2,"0");case"SSS":return V.s(W.$ms,3,"0");case"Z":return Z}return null}(Ie)||Z.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,z){var re,Z=this,K=V.p(W),ce=Q(M),ve=(ce.utcOffset()-this.utcOffset())*t,Le=this-ce,nt=function(){return V.m(Z,ce)};switch(K){case A:re=nt()/12;break;case m:re=nt();break;case g:re=nt()/3;break;case f:re=(Le-ve)/6048e5;break;case p:re=(Le-ve)/864e5;break;case a:re=Le/r;break;case i:re=Le/t;break;case o:re=Le/e;break;default:re=Le}return z?re:V.a(re)},D.daysInMonth=function(){return this.endOf(m).$D},D.$locale=function(){return k[this.$L]},D.locale=function(M,W){if(!M)return this.$L;var z=this.clone(),re=G(M,W,!0);return re&&(z.$L=re),z},D.clone=function(){return V.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N}(),L=B.prototype;return Q.prototype=L,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",p],["$M",m],["$y",A],["$D",x]].forEach(function(N){L[N[1]]=function(D){return this.$g(D,N[0],N[1])}}),Q.extend=function(N,D){return N.$i||(N(D,B,Q),N.$i=!0),Q},Q.locale=G,Q.isDayjs=q,Q.unix=function(N){return Q(1e3*N)},Q.en=k[E],Q.Ls=k,Q.p={},Q})});var CA=Et((ah,sh)=>{"use strict";d();c();l();u();(function(e,t){typeof ah=="object"&&typeof sh<"u"?sh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_quarterOfYear=t()})(ah,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var i=o.add;o.add=function(p,f){return p=Number(p),this.$utils().p(f)===t?this.add(3*p,e):i.bind(this)(p,f)};var a=o.startOf;o.startOf=function(p,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(p)===t){var A=this.quarter()-1;return g?this.month(3*A).startOf(e).startOf("day"):this.month(3*A+2).endOf(e).endOf("day")}return a.bind(this)(p,f)}}})});var bA=Et((ch,uh)=>{"use strict";d();c();l();u();(function(e,t){typeof ch=="object"&&typeof uh<"u"?uh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_customParseFormat=t()})(ch,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/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},p=function(y){return(y=+y)+(y>68?1900:2e3)},f=function(y){return function(b){this[y]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var w=b.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(y)}],g=function(y){var b=a[y];return b&&(b.indexOf?b:b.s.concat(b.f))},A=function(y,b){var w,I=a.meridiem;if(I){for(var F=1;F<=24;F+=1)if(y.indexOf(I(F,0,b))>-1){w=F>12;break}}else w=y===(b?"pm":"PM");return w},x={A:[i,function(y){this.afternoon=A(y,!1)}],a:[i,function(y){this.afternoon=A(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:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[i,function(y){var b=a.ordinal,w=y.match(/\d+/);if(this.day=w[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[i,function(y){var b=g("months"),w=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(y){this.year=p(y)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(y){var b,w;b=y,w=a&&a.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,V,B){var L=B&&B.toUpperCase();return V||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),F=I.length,E=0;E<F;E+=1){var k=I[E],T=x[k],q=T&&T[0],G=T&&T[1];I[E]=G?{regex:q,parser:G}:k.replace(/^\[|\]$/g,"")}return function(Q){for(var V={},B=0,L=0;B<F;B+=1){var N=I[B];if(typeof N=="string")L+=N.length;else{var D=N.regex,M=N.parser,W=Q.slice(L),z=D.exec(W)[0];M.call(V,z),Q=Q.replace(z,"")}}return function(re){var Z=re.afternoon;if(Z!==void 0){var K=re.hours;Z?K<12&&(re.hours+=12):K===12&&(re.hours=0),delete re.afternoon}}(V),V}}return function(y,b,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(p=y.parseTwoDigitYear);var I=b.prototype,F=I.parse;I.parse=function(E){var k=E.date,T=E.utc,q=E.args;this.$u=T;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,V=q[3]===!0,B=Q||V,L=q[2];V&&(L=q[2]),a=this.$locale(),!Q&&L&&(a=w.Ls[L]),this.$d=function(W,z,re,Z){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*W);var K=h(z)(W),ce=K.year,ve=K.month,Le=K.day,nt=K.hours,$e=K.minutes,Je=K.seconds,et=K.milliseconds,Te=K.zone,Ie=K.week,De=new Date,Pe=Le||(ce||ve?1:De.getDate()),gt=ce||De.getFullYear(),Ct=0;ce&&!ve||(Ct=ve>0?ve-1:De.getMonth());var Ir,ar=nt||0,Vr=$e||0,fr=Je||0,Er=et||0;return Te?new Date(Date.UTC(gt,Ct,Pe,ar,Vr,fr,Er+60*Te.offset*1e3)):re?new Date(Date.UTC(gt,Ct,Pe,ar,Vr,fr,Er)):(Ir=new Date(gt,Ct,Pe,ar,Vr,fr,Er),Ie&&(Ir=Z(Ir).week(Ie).toDate()),Ir)}catch{return new Date("")}}(k,G,T,w),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(G)&&(this.$d=new Date("")),a={}}else if(G instanceof Array)for(var N=G.length,D=1;D<=N;D+=1){q[1]=G[D-1];var M=w.apply(this,q);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}D===N&&(this.$d=new Date(""))}else F.call(this,E)}}})});var rR=Et((gS,hS)=>{"use strict";d();c();l();u();(function(e,t){typeof gS=="object"&&typeof hS<"u"?hS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(gS,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(g,A,x){x===void 0&&(x={});var h=new Date(g),y=function(b,w){w===void 0&&(w={});var I=w.timeZoneName||"short",F=b+"|"+I,E=t[F];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[F]=E),E}(A,x);return y.formatToParts(h)},p=function(g,A){for(var x=a(g,A),h=[],y=0;y<x.length;y+=1){var b=x[y],w=b.type,I=b.value,F=e[w];F>=0&&(h[F]=parseInt(I,10))}var E=h[3],k=E===24?0:E,T=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",q=+g;return(o.utc(T).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(g,A){g===void 0&&(g=i);var x,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),w=Math.round((y-new Date(b))/1e3/60),I=15*-Math.round(y.getTimezoneOffset()/15)-w;if(!Number(I))x=this.utcOffset(0,A);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),A){var F=x.utcOffset();x=x.add(h-F,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var A=this.$x.$timezone||o.tz.guess(),x=a(this.valueOf(),A,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,A){if(!this.$x||!this.$x.$timezone)return m.call(this,g,A);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,A).tz(this.$x.$timezone,!0)},o.tz=function(g,A,x){var h=x&&A,y=x||A||i,b=p(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=function(k,T,q){var G=k-60*T*1e3,Q=p(G,q);if(T===Q)return[G,T];var V=p(G-=60*(Q-T)*1e3,q);return Q===V?[G,Q]:[k-60*Math.min(Q,V)*1e3,Math.max(Q,V)]}(o.utc(g,h).valueOf(),b,y),I=w[0],F=w[1],E=o(I).utcOffset(F);return E.$x.$timezone=y,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var nR=Et((yS,SS)=>{"use strict";d();c();l();u();(function(e,t){typeof yS=="object"&&typeof SS<"u"?SS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_utc=t()})(yS,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},a.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var p=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var f=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=a.utcOffset;a.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(E){E===void 0&&(E="");var k=E.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],q=T[0],G=60*+T[1]+ +T[2];return G===0?0:q==="+"?G:-G}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=w,I.$u=!1,I;var F=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+F,e)).$offset=w,I.$x.$localOffset=F,I};var g=a.format;a.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},a.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var A=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():A.call(this)};var x=a.diff;a.diff=function(h,y,b){if(h&&this.$u===h.$u)return x.call(this,h,y,b);var w=this.local(),I=i(h).local();return x.call(w,I,y,b)}}})});var wE=Et((Ywe,xE)=>{"use strict";d();c();l();u();function oQ(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}xE.exports=iQ;function iQ(e,t,r){var n=r&&r.stringify||oQ,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var p=1;p<i;p++)a[p]=n(t[p]);return a.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var m="",g=1-o,A=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(A=A>-1?A:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;A<h&&(m+=e.slice(A,h)),m+=Number(t[g]),A=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;A<h&&(m+=e.slice(A,h)),m+=Math.floor(Number(t[g])),A=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;A<h&&(m+=e.slice(A,h));var y=typeof t[g];if(y==="string"){m+="'"+t[g]+"'",A=h+2,h++;break}if(y==="function"){m+=t[g].name||"<anonymous>",A=h+2,h++;break}m+=n(t[g]),A=h+2,h++;break;case 115:if(g>=f)break;A<h&&(m+=e.slice(A,h)),m+=String(t[g]),A=h+2,h++;break;case 37:A<h&&(m+=e.slice(A,h)),m+="%",A=h+2,h++,g--;break}++g}++h}return A===-1?e:(A<x&&(m+=e.slice(A)),m)}});var kE=Et((eRe,Vf)=>{"use strict";d();c();l();u();var RE=wE();Vf.exports=Vn;var du=AQ().console||{},aQ={mapHttpRequest:jf,mapHttpResponse:jf,wrapRequestSerializer:uv,wrapResponseSerializer:uv,wrapErrorSerializer:uv,req:jf,res:jf,err:EE,errWithCause:EE};function So(e,t){return e==="silent"?1/0:t.levels.values[e]}var pv=Symbol("pino.logFuncs"),lv=Symbol("pino.hierarchy"),sQ={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function IE(e,t){let r={logger:t,parent:e[lv]};t[lv]=r}function cQ(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:du[o]||du[sQ[o]||"log"]||ss}),e[pv]=n}function uQ(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Vn(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||du;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=uQ(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&p.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=ss),cQ(m,p,r),IE({},m),Object.defineProperty(m,"levelVal",{get:A}),Object.defineProperty(m,"level",{get:x,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:p,timestamp:yQ(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ss};m.levels=lQ(e),m.level=f,m.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=ss,m.serializers=n,m._serialize=o,m._stdErrSerialize=i,m.child=function(...b){return y.call(this,g,...b)},t&&(m._logEvent=dv());function A(){return So(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Oi(this,g,m,"error"),Oi(this,g,m,"fatal"),Oi(this,g,m,"warn"),Oi(this,g,m,"info"),Oi(this,g,m,"debug"),Oi(this,g,m,"trace"),a.forEach(w=>{Oi(this,g,m,w)})}function y(b,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let F=I.serializers;if(o&&F){var E=Object.assign({},n,F),k=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,fv([w],k,E,this._stdErrSerialize)}function T(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=k),t&&(this._logEvent=dv([].concat(G._logEvent.bindings,w)))}T.prototype=this;let q=new T(this);return IE(this,q),q.child=function(...G){return y.call(this,b,...G)},q.level=I.level||this.level,b.onChild(q),q}return m}function lQ(e){let t=e.customLevels||{},r=Object.assign({},Vn.levels.values,t),n=Object.assign({},Vn.levels.labels,dQ(t));return{values:r,labels:n}}function dQ(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Vn.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"}};Vn.stdSerializers=aQ;Vn.stdTimeFunctions=Object.assign({},{nullTime:TE,epochTime:PE,unixTime:SQ,isoTime:vQ});function pQ(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[lv];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Oi(e,t,r,n){if(Object.defineProperty(e,n,{value:So(e.level,r)>So(n,r)?ss:r[pv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ss){if(!t.transmit)return;let i=t.transmit.level||e.level,a=So(i,r);if(So(n,r)<a)return}e[n]=mQ(e,t,r,n);let o=pQ(e);o.length!==0&&(e[n]=fQ(o,e[n]))}function fQ(e,t){return function(){return t.apply(this,[...e,...arguments])}}function mQ(e,t,r,n){return function(o){return function(){let a=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===du?du:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(fv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let A=gQ(this,n,p,a,t);if(t.reportCaller&&A&&A.length>0&&A[0]&&typeof A[0]=="object")try{let x=FE();x&&(A[0].caller=x)}catch{}o.call(f,...A)}else{if(t.reportCaller)try{let A=FE();A&&p.push(A)}catch{}o.apply(f,p)}if(t.transmit){let A=t.transmit.level||e._level,x=So(A,r),h=So(n,r);if(h<x)return;hQ(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:A,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:So(e._level,r)},p,g)}}}(e[pv][n])}function gQ(e,t,r,n,o){let{level:i,log:a=A=>A}=o.formatters||{},p=r.slice(),f=p[0],m={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(m.time=n),i){let A=i(t,e.levels.values[t]);Object.assign(m,A)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());return[a(m),...p]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());f=p.length?RE(p.shift(),p):void 0}else typeof f=="string"&&(f=RE(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[a(m)]}}function fv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Vn.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function hQ(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,p=t.methodValue,f=t.val,m=e._logEvent.bindings;n||fv(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return m.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=p,o(a,e._logEvent,f),e._logEvent=dv(m)}function dv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function EE(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 yQ(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?TE:PE}function jf(){return{}}function uv(e){return e}function ss(){}function TE(){return!1}function PE(){return Date.now()}function SQ(){return Math.round(Date.now()/1e3)}function vQ(){return new Date(Date.now()).toISOString()}function AQ(){function e(t){return typeof t<"u"&&t}try{return typeof S<"u"?S:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),S)}catch{return e(self)||e(window)||e(this)||{}}}Vf.exports.default=Vn;Vf.exports.pino=Vn;function FE(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
+ `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],p=o[3];return i+":"+a+":"+p}}return null}});var C2={};Ys(C2,{HighlightUtils:()=>Yg,ResultTemplatesHelpers:()=>tw,SortOrder:()=>Ul,VERSION:()=>Wn,buildAttachToCase:()=>QE,buildAttachedResults:()=>BE,buildBreadcrumbManager:()=>SF,buildCategoryFacet:()=>BF,buildController:()=>he,buildCriterionExpression:()=>Hr,buildDateFacet:()=>uT,buildDateFilter:()=>dT,buildDateRange:()=>bs,buildDateSortCriterion:()=>zb,buildDidYouMean:()=>IF,buildFacet:()=>nT,buildFacetConditionsManager:()=>PF,buildFacetManager:()=>OF,buildFoldedResultList:()=>ET,buildGeneratedAnswer:()=>kT,buildInsightEngine:()=>jE,buildInsightInterface:()=>yk,buildInteractiveCitation:()=>_T,buildInteractiveResult:()=>eP,buildNotifyTrigger:()=>ck,buildNumericFacet:()=>gT,buildNumericFilter:()=>yT,buildNumericRange:()=>Hm,buildPager:()=>jT,buildQueryError:()=>LT,buildQuerySummary:()=>QT,buildQuickview:()=>HT,buildRecentQueriesList:()=>ZT,buildRelevanceSortCriterion:()=>Bl,buildResultList:()=>tP,buildResultTemplatesManager:()=>Ek,buildResultsPerPage:()=>nP,buildSearchBox:()=>hP,buildSearchParameterManager:()=>qP,buildSearchStatus:()=>XP,buildSmartSnippet:()=>QP,buildSmartSnippetQuestionsList:()=>$P,buildSort:()=>KP,buildTab:()=>JP,buildUserActions:()=>hk,deserializeRelativeDate:()=>_A,getAnalyticsNextApiBaseUrl:()=>Bu,getOrganizationEndpoint:()=>mt,getSampleInsightEngineConfiguration:()=>mv,loadAttachedResultsActions:()=>t2,loadAttachedResultsAnalyticsActions:()=>r2,loadCaseContextActions:()=>n2,loadContextActions:()=>i2,loadDateFacetSetActions:()=>a2,loadFieldActions:()=>c2,loadFoldingActions:()=>u2,loadGeneratedAnswerActions:()=>l2,loadGenericAnalyticsActions:()=>JG,loadInsightAnalyticsActions:()=>e2,loadInsightInterfaceActions:()=>d2,loadInsightSearchActions:()=>f2,loadInsightSearchAnalyticsActions:()=>m2,loadInsightUserActionsActions:()=>g2,loadNumericFacetSetActions:()=>s2,loadQuerySetActions:()=>p2,loadQuerySuggestActions:()=>h2,loadQuestionAnsweringActions:()=>y2,loadRecentResultsActions:()=>S2});module.exports=qk(C2);d();c();l();u();var Yg={};Ys(Yg,{escapeHtml:()=>Wi,getHighlightedSuggestion:()=>Wg,highlightString:()=>dO});d();c();l();u();d();c();l();u();function oO(e,t){let r=`
21
21
  The following properties are invalid:
22
22
 
23
23
  ${e.join(`
24
24
  `)}
25
25
 
26
26
  ${t}
27
- `;return new Do(r)}var Do=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Oe=class{constructor(e){le(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let a=this.definition[o].validate(r[o]);a&&n.push(`${o}: ${a}`)}if(n.length)throw nO(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}},He=class{constructor(e={}){le(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&J(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 Ga(e){return e===void 0}function oO(e){return e===null}function J(e){return Ga(e)||oO(e)}var pe=class{constructor(e={}){le(this,"value");this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(aO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function aO(e){return Ga(e)||qu(e)}function qu(e){return typeof e=="boolean"}var ne=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(iO(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 iO(e){return Ga(e)||aA(e)}function aA(e){return typeof e=="number"&&!Number.isNaN(e)}var sO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){le(this,"value");le(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new He(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:a}=this.config,i=this.value.validate(e);if(i)return i;if(Ga(e))return null;if(!$a(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}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:a&&!(sO.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 $a(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){le(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ga(e))return this.config.options.required?"value is required and is currently undefined":null;if(!iA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&J(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],a=n.validate(o);a!==null&&(t+=` ${a}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function iA(e){return e!==void 0&&typeof e=="object"}var oe=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new He(this.config)}validate(e){if(!J(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(J(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&&J(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return qu(e)||$a(e)||aA(e)||iA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ha(e){return Array.isArray(e)}var ec=class{constructor(e){le(this,"config");le(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ga(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}};d();c();l();u();var Mu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function ju(e){return Array.isArray(e)}function Vu(e){return e.trim()===""}function sA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function cO(e){return btoa(encodeURI(e))}function Lu(e,t){let{[e]:r,...n}=t;return n}function za(e){return cO(JSON.stringify(e))}var uO=new Set(["1",1,"yes",!0]);function $g(){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=>uO.has(r))}function cA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function uA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function tc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Uu(e,t,r={}){let n;return(...o)=>{let a=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),a)return e.apply(void 0,o)}}function lO(e){if(Vu(e.openingDelimiter)||Vu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(J(e.content)||Vu(e.content))return e.content;if(e.highlights.length===0)return Wa(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let a=e.highlights[o],i=a.offset,p=i+a.length;if(p>t)break;r+=Wa(e.content.slice(n,i)),r+=e.openingDelimiter,r+=Wa(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Wa(e.content.slice(n))),r}function zg(e,t){return e=Wa(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Hg(n,t.notMatchDelimiters):o?Hg(o,t.exactMatchDelimiters):a?Hg(a,t.correctionDelimiters):r)}function Hg(e,t){return t?t.open+e+t.close:e}function Wa(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,a=>t[a]):e}d();c();l();u();var CA=Fr(yA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),Ya=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."}},Mo=class extends Error{constructor(r,n){super();le(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function SA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function vA(e){return typeof e!="object"||!e?!1:Object.values(e).every(qO)}function qO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function AA(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=MO(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(a,i);if(AA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,CA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&AA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(A=>setTimeout(A,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Ya;case 404:throw new Mo(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new Mo(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=tc(f);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function mt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Gn(e,t,r="prod"){return e??mt(t,r)}function Kt(e,t="prod"){return`${mt(e,t)}/rest/search/v2`}function Bu(e,t="prod"){return`${mt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function MO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=jO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function jO(e,t){return t==="application/x-www-form-urlencoded"?vA(e)?SA(e):"":JSON.stringify(e)}d();c();l();u();var oc=Fr(Gu(),1),EA=Fr(bA(),1);d();c();l();u();var $u=Fr(Gu(),1),wA=Fr(xA(),1);$u.default.extend(wA.default);var RA="YYYY/MM/DD@HH:mm:ss",VO="1401-01-01";function Ka(e,t){let r=(0,$u.default)(e,t);return!r.isValid()&&!t?(0,$u.default)(e,RA):r}function Hu(e){return e.format(RA)}function IA(e,t){let r=Ka(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}uh(r)}function uh(e){if(e.isBefore(VO))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}oc.default.extend(EA.default);var FA=["past","now","next"],TA=["minute","hour","day","week","month","quarter","year"],LO=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new $({required:!t,constrainTo:TA}),period:new $({required:!0,constrainTo:FA})}};function zu(e){if(typeof e=="string"&&!$n(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?lh(e):e;new Oe(LO(t.period)).validate(t);let r=kA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);uh(r)}function PA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function kA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,oc.default)().subtract(r,n);case"next":return(0,oc.default)().add(r,n);case"now":return(0,oc.default)()}}function ac(e){return Hu(kA(lh(e)))}function OA(e){return e.toLocaleLowerCase().split("-")}function $n(e){let[t,r,n]=OA(e);if(t==="now")return!0;if(!FA.includes(t)||!TA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function _A(e){return!!e&&typeof e=="object"&&"period"in e}function lh(e){let[t,r,n]=OA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function NA(e){return zu(e),lh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function qA(_x3,_x4){return _qA.apply(this,arguments)}function _qA(){_qA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _qA.apply(this,arguments)}function MA(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=QO(t,i);let p=t.length,f=0;for(;r<p;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<p&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-f);break;case 13:o=!0,m=r;break;case 10:m=r;break}if(m===-1)break;e(t.subarray(f,m),n),f=r,n=-1}f===p?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function jA(e,t,r){let n=DA(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=DA();else if(p>0){let f=o.decode(i.subarray(0,p)),m=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
28
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":UO(g,n,t);break}}}}function UO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function QO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function DA(){return{data:"",event:"",id:"",retry:void 0}}var dh="text/event-stream",BO=1e3,VA="last-event-id";function LA(){return typeof window<"u"}function Wu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,A)=>{let x={...r};x.accept||(x.accept=dh);let h;function y(){h?.abort(),document.hidden||k()}!p&&LA()&&document.addEventListener("visibilitychange",y);let b=BO,w;function I(){LA()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let F=f??v,E=n??GO;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let T=yield F(e,{...m,headers:x,signal:h?.signal});yield E(T),yield qA(T.body,MA(jA(q=>{q?x[VA]=q:delete x[VA]},q=>{b=q},o))),a?.(),I(),g()}catch(T){if(!h?.signal?.aborted)try{let q=i?.(T)??b;clearTimeout(w),w=setTimeout(k,q)}catch(q){I(),A(q)}}});return _k2.apply(this,arguments)}k()})}function GO(e){let t=e.headers.get("content-type");if(!t?.startsWith(dh))throw new Error(`Expected content-type to be ${dh}, Actual: ${t}`)}d();c();l();u();var Hn=class{constructor(t){le(this,"_basePath");le(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}};var $O=(e,t,r)=>new Hn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,UA=3,HO=5e3,zO="text/event-stream",mh=1,ph=class extends Error{},ic=class extends Error{constructor(r){super(r.message);le(this,"payload",r)}},fh=class{constructor(){le(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},Yu=class{constructor(t){le(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,A=new fh;if(!a){this.logger.error("No stream ID found");return}let x=0,h,y=()=>{h&&!A.isActive(h)&&(w?.abort(),g(),I())},b=()=>{A.remove(h),h=uA(y,h,HO),A.add(h)},w=new s.AbortController,I=()=>Wu($O(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(F){return _asyncToGenerator(function*(){if(F.ok&&F.headers.get("content-type")===zO)return;throw F.status>=400&&F.status<500&&F.status!==429?new ic({message:"Error opening stream",code:F.status}):new ph})()},onmessage:F=>{if(w?.signal.aborted)return;let E=JSON.parse(F.data);if(E.finishReason==="ERROR"){A.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(A.remove(h),m()):b()},onerror:F=>{if(!w?.signal.aborted){if(A.remove(h),F instanceof ic)throw w?.abort(),f(F),F;if(++x>UA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:mh};throw w?.abort(),f(E),new ic(E)}this.logger.info(`Retrying...(${x}/${UA})`),g()}}});return I(),w}};d();c();l();u();var Ku=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function sc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var gh=e=>{let{response:t}=e;return t.body?WO(e):YO(t)},WO=e=>XO(e)?ZO(e):KO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},YO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function KO(e){return e.body.statusCode!==void 0}function XO(e){return e.body.exception!==void 0}var ZO=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function QA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var hh=(e,t,r,n)=>{let o=new Hn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var BA=(e,t)=>{let r=new Hn(`${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},yh=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...hh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:sc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=QA(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return JO(i)?{success:i}:{error:gh({response:r,body:i})}});return function yh(_x5,_x6){return _ref3.apply(this,arguments)}}();function JO(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Xa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Ct(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Xa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Xa(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function e_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function t_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Za(e,t){if(t&&e.name==="AbortError")return{error:t_(e)};if(e instanceof Mo)return{error:e_(e)};throw e}var zn=e=>e.success!==void 0,ze=e=>e.error!==void 0;function GA(e){return e.results!==void 0}function $A(e){let t=Xa();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Sh=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,r_=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,cc=(e,t,r,n)=>{n_(e);let o=Sh(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},HA=(e,t,r)=>{o_(e);let n=r_(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},vh=e=>{let{insightId:t,...r}=sc(e);return r},zA=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.")},n_=e=>{if(zA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},o_=e=>{if(zA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var WA=e=>({...cc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var YA=e=>({...cc(e,"POST","application/json","/search"),requestParams:vh(e)}),KA=e=>({...cc(e,"POST","application/json","/querysuggest"),requestParams:vh(e)});d();c();l();u();var XA=e=>({...HA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Xu=class{constructor(t){le(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...WA(t),..._this.options});if(r instanceof Error)return Za(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Lr.call({...YA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Za(n);let o=yield n.json();return GA(o)&&(o=$A(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...KA(t),..._this3.options});if(r instanceof Error)return Za(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...XA(t),..._this4.options});if(r instanceof Error)return Za(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return yh(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),lW=new $({required:!1,emptyAllowed:!0}),Zu=new oe({each:H,required:!0}),ZA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),JA=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dW=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new Oe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Do(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return eC(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return eC(e,t,r,o,"Controller initialization error")},eC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Et(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 a_=typeof Symbol=="function"&&Symbol.observable||"@@observable",tC=a_,Ah=()=>Math.random().toString(36).substring(7).split("").join("."),i_={INIT:`@@redux/INIT${Ah()}`,REPLACE:`@@redux/REPLACE${Ah()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ah()}`},Ju=i_;function Ur(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 Ch(e,t,r){if(typeof e!="function")throw new Error(Et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Et(1));return r(Ch)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,I)=>{i.set(I,w)}))}function g(){if(f)throw new Error(Et(3));return o}function A(w){if(typeof w!="function")throw new Error(Et(4));if(f)throw new Error(Et(5));let I=!0;m();let F=p++;return i.set(F,w),function(){if(I){if(f)throw new Error(Et(6));I=!1,m(),i.delete(F),a=null}}}function x(w){if(!Ur(w))throw new Error(Et(7));if(typeof w.type>"u")throw new Error(Et(8));if(typeof w.type!="string")throw new Error(Et(17));if(f)throw new Error(Et(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(F=>{F()}),w}function h(w){if(typeof w!="function")throw new Error(Et(10));n=w,x({type:Ju.REPLACE})}function y(){let w=A;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Et(11));function F(){let k=I;k.next&&k.next(g())}return F(),{unsubscribe:w(F)}},[tC](){return this}}}return x({type:Ju.INIT}),{dispatch:x,subscribe:A,getState:g,replaceReducer:h,[tC]:y}}function s_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ju.INIT})>"u")throw new Error(Et(12));if(typeof r(void 0,{type:Ju.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Et(13))})}function Ja(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{s_(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let A=0;A<n.length;A++){let x=n[A],h=r[x],y=p[x],b=h(y,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Et(14))}g[x]=b,m=m||b!==y}return m=m||n.length!==Object.keys(p).length,m?g:p}}function uc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function rC(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Et(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=uc(...p)(o.dispatch),{...o,dispatch:a}}}function lc(e){return Ur(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Ph=Symbol.for("immer-nothing"),dc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Ft(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,Vo=sr.getPrototypeOf,pc="constructor",yc="prototype",wh="configurable",nl="enumerable",tl="writable",fc="value",Ht=e=>!!e&&!!e[St];function Mt(e){return e?lC(e)||vc(e)||!!e[dc]||!!e[pc]?.[dc]||Ac(e)||Cc(e):!1}var c_=sr[yc][pc].toString(),nC=new WeakMap;function lC(e){if(!e||!ti(e))return!1;let t=Vo(e);if(t===null||t===sr[yc])return!0;let r=sr.hasOwnProperty.call(t,pc)&&t[pc];if(r===Object)return!0;if(!jo(r))return!1;let n=nC.get(r);return n===void 0&&(n=Function.toString.call(r),nC.set(r,n)),n===c_}function dC(e){return Ht(e)||Ft(15,e),e[St].base_}function Sc(e,t,r=!0){Lo(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Lo(e){let t=e[St];return t?t.type_:vc(e)?1:Ac(e)?2:Cc(e)?3:0}var ei=(e,t,r=Lo(e))=>r===2?e.has(t):sr[yc].hasOwnProperty.call(e,t),In=(e,t,r=Lo(e))=>r===2?e.get(t):e[t],ol=(e,t,r,n=Lo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function u_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var vc=Array.isArray,Ac=e=>e instanceof Map,Cc=e=>e instanceof Set,ti=e=>typeof e=="object",jo=e=>typeof e=="function",bh=e=>typeof e=="boolean";function l_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var d_=e=>ti(e)?e?.[St]:null,En=e=>e.copy_||e.base_;var kh=e=>e.modified_?e.copy_:e.base_;function Rh(e,t){if(Ac(e))return new Map(e);if(Cc(e))return new Set(e);if(vc(e))return Array[yc].slice.call(e);let r=lC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[St];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[tl]===!1&&(p[tl]=!0,p[wh]=!0),(p.get||p.set)&&(n[i]={[wh]:!0,[tl]:!0,[nl]:p[nl],[fc]:e[i]})}return sr.create(Vo(e),n)}else{let n=Vo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function Oh(e,t=!1){return ll(e)||Ht(e)||!Mt(e)||(Lo(e)>1&&sr.defineProperties(e,{set:el,add:el,clear:el,delete:el}),sr.freeze(e),t&&Sc(e,(r,n)=>{Oh(n,!0)},!1)),e}function p_(){Ft(2)}var el={[fc]:p_};function ll(e){return e===null||!ti(e)?!0:sr.isFrozen(e)}var al="MapSet",il="Patches",oC="ArrayMethods",sl={};function Uo(e){let t=sl[e];return t||Ft(0,e),t}var aC=e=>!!sl[e];function f_(e,t){sl[e]||(sl[e]=t)}var mc,pC=()=>mc,m_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aC(al)?Uo(al):void 0,arrayMethodsPlugin_:aC(oC)?Uo(oC):void 0});function iC(e,t){t&&(e.patchPlugin_=Uo(il),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ih(e){Eh(e),e.drafts_.forEach(g_),e.drafts_=null}function Eh(e){e===mc&&(mc=e.parent_)}var sC=e=>mc=m_(mc,e);function g_(e){let t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function cC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[St].modified_&&(Ih(t),Ft(4)),Mt(e)&&(e=uC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[St].base_,e,t)}else e=uC(t,r);return h_(t,e,!0),Ih(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ph?e:void 0}function uC(e,t){if(ll(t))return t;let r=t[St];if(!r)return cl(t,e.handledSet_,e);if(!dl(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);gC(r,e)}return r.copy_}function h_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Oh(t,r)}function fC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var dl=(e,t)=>e.scope_===t,y_=[];function mC(e,t,r,n){let o=En(e),a=e.type_;if(n!==void 0&&In(o,n,a)===t){ol(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Sc(o,(f,m)=>{if(Ht(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??y_;for(let p of i)ol(o,p,r,a)}function S_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!dl(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=kh(a);mC(e,a.draft_??a,i,r),gC(a,o)})}function gC(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 o=n.getPath(e);o&&n.generatePatches_(e,o,t)}fC(e)}}function v_(e,t,r){let{scope_:n}=e;if(Ht(r)){let o=r[St];dl(o,n)&&o.callbacks_.push(function(){rl(e);let i=kh(o);mC(e,r,i,t)})}else Mt(r)&&e.callbacks_.push(function(){let a=En(e);e.type_===3?a.has(r)&&cl(r,n.handledSet_,n):In(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&cl(In(e.copy_,t,e.type_),n.handledSet_,n)})}function cl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Ht(e)||t.has(e)||!Mt(e)||ll(e)||(t.add(e),Sc(e,(n,o)=>{if(Ht(o)){let a=o[St];if(dl(a,r)){let i=kh(a);ol(e,n,i,e.type_),fC(a)}}else Mt(o)&&cl(o,t,r)})),e}function A_(e,t){let r=vc(e),n={type_:r?1:0,scope_:t?t.scope_:pC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=ul;r&&(o=[n],a=gc);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var ul={get(e,t){if(t===St)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 o=En(e);if(!ei(o,t,e.type_))return b_(e,o,t);let a=o[t];if(e.finalized_||!Mt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&l_(t))return a;if(a===xh(e.base_,t)||C_(e,t,a)){rl(e);let i=e.type_===1?+t:t,p=Th(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in En(e)},ownKeys(e){return Reflect.ownKeys(En(e))},set(e,t,r){let n=hC(En(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=xh(En(e),t),a=o?.[St];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(u_(r,o)&&(r!==void 0||ei(e.base_,t,e.type_)))return!0;rl(e),Fh(e)}return e.copy_[t]===r&&(r!==void 0||ei(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),v_(e,t,r)),!0},deleteProperty(e,t){return rl(e),xh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Fh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=En(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[tl]:!0,[wh]:e.type_!==1||t!=="length",[nl]:n[nl],[fc]:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return Vo(e.base_)},setPrototypeOf(){Ft(12)}},gc={};for(let e in ul){let t=ul[e];gc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}gc.deleteProperty=function(e,t){return gc.set.call(this,e,t,void 0)};gc.set=function(e,t,r){return ul.set.call(this,e[0],t,r,e[0])};function xh(e,t){let r=e[St];return(r?En(r):e)[t]}function C_(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Mt(r)||r[St]?!1:e.baseRefs_.has(r)}function b_(e,t,r){let n=hC(t,r);return n?fc in n?n[fc]:n.get?.call(e.draft_):void 0}function hC(e,t){if(!(t in e))return;let r=Vo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vo(r)}}function Fh(e){e.modified_||(e.modified_=!0,e.parent_&&Fh(e.parent_))}function rl(e){e.copy_||(e.assigned_=new Map,e.copy_=Rh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var x_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(jo(t)&&!jo(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}jo(r)||Ft(6),n!==void 0&&!jo(n)&&Ft(7);let o;if(Mt(t)){let a=sC(this),i=Th(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?Ih(a):Eh(a)}return iC(a,n),cC(o,a)}else if(!t||!ti(t)){if(o=r(t),o===void 0&&(o=t),o===Ph&&(o=void 0),this.autoFreeze_&&Oh(o,!0),n){let a=[],i=[];Uo(il).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else Ft(1,t)},this.produceWithPatches=(t,r)=>{if(jo(t))return(i,...p)=>this.produceWithPatches(i,f=>t(f,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},bh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),bh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),bh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Mt(e)||Ft(8),Ht(e)&&(e=pl(e));let t=sC(this),r=Th(t,e,void 0);return r[St].isManual_=!0,Eh(t),r}finishDraft(e,t){let r=e&&e[St];(!r||!r.isManual_)&&Ft(9);let{scope_:n}=r;return iC(n,t),cC(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 o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Uo(il).applyPatches_;return Ht(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Th(e,t,r,n){let[o,a]=Ac(t)?Uo(al).proxyMap_(t,r):Cc(t)?Uo(al).proxySet_(t,r):A_(t,r);return(r?.scope_??pC()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?S_(r,a,n):a.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:m}=f;a.modified_&&m&&m.generatePatches_(a,[],f)}),o}function pl(e){return Ht(e)||Ft(10,e),yC(e)}function yC(e){if(!Mt(e)||ll(e))return e;let t=e[St],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Rh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Rh(e,!0);return Sc(r,(o,a)=>{ol(r,o,yC(a))},n),t&&(t.finalized_=!1),r}function SC(){function t(y,b=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,I=d_(In(w,y.key_)),F=In(w,y.key_);if(F===void 0||F!==y.draft_&&F!==y.base_&&F!==y.copy_||I!=null&&I.base_!==y.base_)return null;let E=y.parent_.type_===3,k;if(E){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(E&&w.size>k||ei(w,k)))return null;b.push(k)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let w=y;for(let I=0;I<b.length-1;I++){let F=b[I];if(w=In(w,F),!ti(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(y,b,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:F}=w;switch(y.type_){case 0:case 2:return f(y,b,I,F);case 1:return p(y,b,I,F);case 3:return m(y,b,I,F)}}function p(y,b,w,I){let{base_:F,assigned_:E}=y,k=y.copy_;k.length<F.length&&([F,k]=[k,F],[w,I]=[I,w]);let T=y.allIndicesReassigned_===!0;for(let q=0;q<F.length;q++){let G=k[q],Q=F[q];if((T||E?.get(q.toString()))&&G!==Q){let B=G?.[St];if(B&&B.modified_)continue;let L=b.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(Q)})}}for(let q=F.length;q<k.length;q++){let G=b.concat([q]);w.push({op:o,path:G,value:h(k[q])})}for(let q=k.length-1;F.length<=q;--q){let G=b.concat([q]);I.push({op:a,path:G})}}function f(y,b,w,I){let{base_:F,copy_:E,type_:k}=y;Sc(y.assigned_,(T,q)=>{let G=In(F,T,k),Q=In(E,T,k),V=q?ei(F,T)?n:o:a;if(G===Q&&V===n)return;let B=b.concat(T);w.push(V===a?{op:V,path:B}:{op:V,path:B,value:h(Q)}),I.push(V===o?{op:a,path:B}:V===a?{op:o,path:B,value:h(G)}:{op:n,path:B,value:h(G)})})}function m(y,b,w,I){let{base_:F,copy_:E}=y,k=0;F.forEach(T=>{if(!E.has(T)){let q=b.concat([k]);w.push({op:a,path:q,value:T}),I.unshift({op:o,path:q,value:T})}k++}),k=0,E.forEach(T=>{if(!F.has(T)){let q=b.concat([k]);w.push({op:o,path:q,value:T}),I.unshift({op:a,path:q,value:T})}k++})}function g(y,b,w){let{patches_:I,inversePatches_:F}=w;I.push({op:n,path:[],value:b===Ph?void 0:b}),F.push({op:n,path:[],value:y})}function A(y,b){return b.forEach(w=>{let{path:I,op:F}=w,E=y;for(let G=0;G<I.length-1;G++){let Q=Lo(E),V=I[G];typeof V!="string"&&typeof V!="number"&&(V=""+V),(Q===0||Q===1)&&(V==="__proto__"||V===pc)&&Ft(19),jo(E)&&V===yc&&Ft(19),E=In(E,V),(E===null||!ti(E))&&Ft(18,I.join("/"))}let k=Lo(E),T=x(w.value),q=I[I.length-1];switch(F){case n:switch(k){case 2:return E.set(q,T);case 3:Ft(16);default:return E[q]=T}case o:switch(k){case 1:return q==="-"?E.push(T):E.splice(q,0,T);case 2:return E.set(q,T);case 3:return E.add(T);default:return E[q]=T}case a:switch(k){case 1:return E.splice(q,1);case 2:return E.delete(q);case 3:return E.delete(w.value);default:return delete E[q]}default:Ft(17,F)}}),y}function x(y){if(!Mt(y))return y;if(vc(y))return y.map(x);if(Ac(y))return new Map(Array.from(y.entries()).map(([w,I])=>[w,x(I)]));if(Cc(y))return new Set(Array.from(y).map(x));let b=Object.create(Vo(y));for(let w in y)b[w]=x(y[w]);return ei(y,dc)&&(b[dc]=y[dc]),b}function h(y){return Ht(y)?x(y):y}f_(il,{applyPatches_:A,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var hc=new x_,Qo=hc.produce,_h=hc.produceWithPatches.bind(hc);var Nh=hc.applyPatches.bind(hc);d();c();l();u();function w_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function R_(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 vC=e=>Array.isArray(e)?e:[e];function I_(e){let t=Array.isArray(e[0])?e[0]:e;return R_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function E_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var F_=class{constructor(e){this.value=e}deref(){return this.value}},T_=()=>typeof WeakRef>"u"?F_:WeakRef,CC=T_(),P_=0,AC=1;function fl(){return{s:P_,v:void 0,o:null,p:null}}function k_(e){return e instanceof CC?e.deref():e}function bc(e,t={}){let r=fl(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let A=0,x=f;A<x;A++){let h=arguments[A];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=p.o;y===null&&(p.o=y=new WeakMap);let b=y.get(h);b===void 0?(p=fl(),y.set(h,p)):p=b}else{let y=p.p;y===null&&(p.p=y=new Map);let b=y.get(h);b===void 0?(p=fl(),y.set(h,p)):p=b}}let m=p,g;if(p.s===AC)g=p.v;else if(g=e.apply(null,arguments),a++,n){let A=k_(o);A!=null&&n(A,g)&&(g=A,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new CC(g):g}return m.s=AC,m.v=g,g}return i.clearCache=()=>{r=fl(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function O_(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),w_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:A,memoizeOptions:x=[],argsMemoize:h=bc,argsMemoizeOptions:y=[]}=g,b=vC(x),w=vC(y),I=I_(o),F=A(function(){return a++,m.apply(null,arguments)},...b),E=!0,k=h(function(){i++;let q=E_(I,arguments);return p=F.apply(null,q),p},...w);return Object.assign(k,{resultFunc:m,memoizedResultFunc:F,dependencies:I,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:A,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ct=O_(bc);d();c();l();u();function bC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var xC=bC(),wC=bC;var __=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?uc:uc.apply(null,arguments)},$W=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},N_=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>lc(n)&&n.type===e,r}var OC=class xc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,xc.prototype)}static get[Symbol.species](){return xc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new xc(...t[0].concat(this)):new xc(...t.concat(this))}};function RC(e){return Mt(e)?Qo(e,()=>{}):e}function ml(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function D_(e){return typeof e=="boolean"}var q_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new OC;return r&&(D_(r)?i.push(xC):i.push(wC(r.extraArgument))),i},wc="RTK_autoBatch",oi=()=>e=>({payload:e,meta:{[wc]:!0}}),IC=e=>t=>{setTimeout(t,e)},M_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},j_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?M_(window.requestAnimationFrame,100):IC(10):e.type==="callback"?e.queueNotification:IC(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let A=()=>o&&g(),x=n.subscribe(A);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[wc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},V_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new OC(e);return n&&o.push(j_(typeof n=="object"?n:void 0)),o};function _C(e){let t=q_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Ur(r))f=Ja(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=uc;o&&(g=__({trace:!1,...(typeof o=="object"&&o)}));let A=rC(...m),x=V_(A),h=typeof p=="function"?p(x):x(),y=g(...h);return Ch(f,i,y)}function NC(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function L_(e){return typeof e=="function"}function fe(e,t){let[r,n,o]=NC(t),a;if(L_(e))a=()=>RC(e());else{let p=RC(e);a=()=>p}function i(p=a(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,A)=>{if(A)if(Ht(g)){let h=A(g,f);return h===void 0?g:h}else{if(Mt(g))return Qo(g,x=>A(x,f));{let x=A(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var DC=(e,t)=>N_(e)?e.match(t):e(t);function Qr(...e){return t=>e.some(r=>DC(r,t))}function ni(...e){return t=>e.every(r=>DC(r,t))}function Sl(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 Rc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function vl(...e){return e.length===0?t=>Sl(t,["pending"]):Rc(e)?Qr(...e.map(t=>t.pending)):vl()(e[0])}function Go(...e){return e.length===0?t=>Sl(t,["rejected"]):Rc(e)?Qr(...e.map(t=>t.rejected)):Go()(e[0])}function Ic(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ni(Go(...e),t):Rc(e)?ni(Go(...e),t):Ic()(e[0])}function Fn(...e){return e.length===0?t=>Sl(t,["fulfilled"]):Rc(e)?Qr(...e.map(t=>t.fulfilled)):Fn()(e[0])}function Al(...e){return e.length===0?t=>Sl(t,["pending","fulfilled","rejected"]):Rc(e)?Qr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Al()(e[0])}var U_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ec=(e=21)=>{let t="",r=e;for(;r--;)t+=U_[Math.random()*64|0];return t},Q_=["name","message","stack","code"],Dh=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},EC=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},B_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Q_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},FC="External signal was aborted",me=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(f,m,g,A)=>({payload:f,meta:{...(A||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=P(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=P(t+"/rejected",(f,m,g,A,x)=>({payload:A,error:(n&&n.serializeError||B_)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!A,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,A,x)=>{let h=n?.idGenerator?n.idGenerator(f):Ec(),y=new s.AbortController,b,w;function I(E){w=E,y.abort()}m&&(m.aborted?I(FC):m.addEventListener("abort",()=>I(FC),{once:!0}));let F=_asyncToGenerator(function*(){let E;try{let T=n?.condition?.(f,{getState:A,extra:x});if($_(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:A,extra:x}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:A,extra:x,requestId:h,signal:y.signal,abort:I,rejectWithValue:(G,Q)=>new Dh(G,Q),fulfillWithValue:(G,Q)=>new EC(G,Q)})).then(G=>{if(G instanceof Dh)throw G;return G instanceof EC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(T){E=T instanceof Dh?i(null,h,f,T.payload,T.meta):i(T,h,f)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(E)&&E.meta.condition||g(E),E})();return Object.assign(F,{abort:I,requestId:h,arg:f,unwrap(){return F.then(G_)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Qr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function G_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function $_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var qC=Symbol.for("rtk-slice-createasyncthunk"),zW={[qC]:me};function H_(e,t){return`${e}/${t}`}function z_({creators:e}={}){let t=e?.asyncThunk?.[qC];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(Y_()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,k){let T=typeof E=="string"?E:E.type;if(!T)throw new Error(zt(12));if(T in f.sliceCaseReducersByType)throw new Error(zt(13));return f.sliceCaseReducersByType[T]=k,m},addMatcher(E,k){return f.sliceMatchers.push({matcher:E,reducer:k}),m},exposeAction(E,k){return f.actionCreators[E]=k,m},exposeCaseReducer(E,k){return f.sliceCaseReducersByName[E]=k,m}};p.forEach(E=>{let k=i[E],T={reducerName:E,type:H_(o,E),createNotation:typeof n.reducers=="function"};X_(k)?J_(T,k,m,t):K_(T,k,m)});function g(){let[E={},k=[],T=void 0]=typeof n.extraReducers=="function"?NC(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return fe(n.initialState,G=>{for(let Q in q)G.addCase(Q,q[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of k)G.addMatcher(Q.matcher,Q.reducer);T&&G.addDefaultCase(T)})}let A=E=>E,x=new Map,h=new WeakMap,y;function b(E,k){return y||(y=g()),y(E,k)}function w(){return y||(y=g()),y.getInitialState()}function I(E,k=!1){function T(G){let Q=G[E];return typeof Q>"u"&&k&&(Q=ml(h,T,w)),Q}function q(G=A){let Q=ml(x,k,()=>new WeakMap);return ml(Q,G,()=>{let V={};for(let[B,L]of Object.entries(n.selectors??{}))V[B]=W_(L,G,()=>ml(h,G,w),k);return V})}return{reducerPath:E,getSelectors:q,get selectors(){return q(T)},selectSlice:T}}let F={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(a),injectInto(E,{reducerPath:k,...T}={}){let q=k??a;return E.inject({reducerPath:q,reducer:b},T),{...F,...I(q,!0)}}};return F}}function W_(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var $o=z_();function Y_(){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 K_({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!Z_(n))throw new Error(zt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?P(e,i):P(e))}function X_(e){return e._reducerDefinitionType==="asyncThunk"}function Z_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function J_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,A=o(e,a,g);n.exposeAction(t,A),i&&n.addCase(A.fulfilled,i),p&&n.addCase(A.pending,p),f&&n.addCase(A.rejected,f),m&&n.addMatcher(A.settled,m),n.exposeCaseReducer(t,{fulfilled:i||gl,pending:p||gl,rejected:f||gl,settled:m||gl})}function gl(){}var e0="task",MC="listener",jC="completed",jh="cancelled",t0=`task-${jh}`,r0=`task-${jC}`,qh=`${MC}-${jh}`,n0=`${MC}-${jC}`,Cl=class{constructor(e){le(this,"code");le(this,"name","TaskAbortError");le(this,"message");this.code=e,this.message=`${e0} ${jh} (reason: ${e})`}},Vh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},hl=()=>{},VC=(e,t=hl)=>(e.catch(t),e),LC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bo=e=>{if(e.aborted)throw new Cl(e.reason)};function UC(e,t){let r=hl;return new Promise((n,o)=>{let a=()=>o(new Cl(e.reason));if(e.aborted){a();return}r=LC(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=hl})}var o0=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Cl?"cancelled":"rejected",error:r}}finally{t?.()}});return function o0(_x7,_x8){return _ref5.apply(this,arguments)}}(),yl=e=>t=>VC(UC(e,t).then(r=>(Bo(e),r))),QC=e=>{let t=yl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ri}=Object,TC={},bl="listenerMiddleware",a0=(e,t)=>{let r=n=>LC(e,()=>n.abort(e.reason));return(n,o)=>{Vh(n,"taskExecutor");let a=new s.AbortController;r(a);let i=o0(/*#__PURE__*/_asyncToGenerator(function*(){Bo(e),Bo(a.signal);let p=yield n({pause:yl(a.signal),delay:QC(a.signal),signal:a.signal});return Bo(a.signal),p}),()=>a.abort(r0));return o?.autoJoin&&t.push(i.catch(hl)),{result:yl(e)(i),cancel(){a.abort(t0)}}}},i0=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Bo(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(A,x)=>{x.unsubscribe(),f([A,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield UC(t,Promise.race(p));return Bo(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>VC(r(n,o))},BC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(zt(21));return Vh(a,"options.listener"),{predicate:o,type:t,effect:a}},GC=ri(e=>{let{type:t,predicate:r,effect:n}=BC(e);return{id:Ec(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>GC}),PC=(e,t)=>{let{type:r,effect:n,predicate:o}=BC(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},Mh=e=>{e.pending.forEach(t=>{t.abort(qh)})},s0=(e,t)=>()=>{for(let r of t.keys())Mh(r);e.clear()},kC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},$C=ri(P(`${bl}/add`),{withTypes:()=>$C}),c0=P(`${bl}/removeAll`),HC=ri(P(`${bl}/remove`),{withTypes:()=>HC}),u0=(...e)=>{console.error(`${bl}/error`,...e)},zC=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:a,onError:i=u0}=e;Vh(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Mh(h)}),f=h=>{let y=PC(t,h)??GC(h);return p(y)};ri(f,{withTypes:()=>f});let m=h=>{let y=PC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Mh(y)),!!y};ri(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,w){let I=new s.AbortController,F=i0(f,I.signal),E=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,ri({},b,{getOriginalState:w,condition:(k,T)=>F(k,T).then(Boolean),take:F,delay:QC(I.signal),pause:yl(I.signal),extra:a,signal:I.signal,fork:a0(I.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,T,q)=>{k!==I&&(k.abort(qh),q.delete(k))})},cancel:()=>{I.abort(qh),h.pending.delete(I)},throwIfCancelled:()=>{Bo(I.signal)}})))}catch(k){k instanceof Cl||kC(i,k,{raisedBy:"effect"})}finally{yield Promise.all(E),I.abort(n0),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),A=s0(t,r);return{middleware:h=>y=>b=>{if(!lc(b))return y(b);if($C.match(b))return f(b.payload);if(c0.match(b)){A();return}if(HC.match(b))return m(b.payload);let w=h.getState(),I=()=>{if(w===TC)throw new Error(zt(23));return w},F;try{if(F=y(b),t.size>0){let E=h.getState(),k=Array.from(t.values());for(let T of k){let q=!1;try{q=T.predicate(b,E,w)}catch(G){q=!1,kC(i,G,{raisedBy:"predicate"})}q&&g(T,b,h,I)}}}finally{w=TC}return F},startListening:f,stopListening:m,clearListeners:A}};function zt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function WC(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var YC=/^(?:[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 l0(e){return typeof e=="string"&&YC.test(e)}var Lh=l0;d();c();l();u();var Tt=[];for(let e=0;e<256;++e)Tt.push((e+256).toString(16).slice(1));function KC(e,t=0){return(Tt[e[t+0]]+Tt[e[t+1]]+Tt[e[t+2]]+Tt[e[t+3]]+"-"+Tt[e[t+4]]+Tt[e[t+5]]+"-"+Tt[e[t+6]]+Tt[e[t+7]]+"-"+Tt[e[t+8]]+Tt[e[t+9]]+"-"+Tt[e[t+10]]+Tt[e[t+11]]+Tt[e[t+12]]+Tt[e[t+13]]+Tt[e[t+14]]+Tt[e[t+15]]).toLowerCase()}d();c();l();u();var d0=new Uint8Array(16);function Uh(){return crypto.getRandomValues(d0)}d();c();l();u();function p0(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():f0(e,t,r)}function f0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Uh();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 o=0;o<16;++o)t[r+o]=n[o];return t}return KC(n)}var Qh=p0;function m0(_x13){return _m2.apply(this,arguments)}function _m2(){_m2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _m2.apply(this,arguments)}var rb="2.1.3",Bh=128,nb=192,XC=224,ZC=240,g0=248;function h0(e){return(e&g0)===ZC?4:(e&ZC)===XC?3:(e&XC)===nb?2:1}function y0(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&Bh)!=Bh)break;if(r-=3,(n&nb)!=Bh){t-r>=h0(n)*3&&(r=t);break}}return e.substring(0,r)}function S0(e){let{trackingId:t}=e;return{trackingId:t}}function v0(e){return(e.source||[]).concat([`relay@${rb}`])}function ob(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=S0(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:v0(t),clientId:p,userAgent:a(),referrer:JC(n()),location:JC(o())})}function JC(e){return e!==null?y0(e,1024):null}function A0(e,t,r,n){return{...t,meta:ob(e,r,n)}}var C0="*";function b0(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function a(f){if(f===C0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function i(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:p}}function eb({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 x0(e){let t=eb(e);return{get:()=>t,update:r=>{t=eb({...t,...r})}}}var Gh=w0();function w0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function R0(){return{getItem(e){return Gh.getItem(e)||localStorage.getItem(e)},removeItem(e){Gh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Gh.setItem(e,t,31556952e3)}}}var tb="visitorId";function I0(){let e=document.referrer;return e===""?null:e}function $h(){let e=R0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});WC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>I0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(tb);if(t&&Lh(t))return t;let r=Qh();return e.setItem(tb,r),r}}}function E0(){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 F0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function T0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=F0();return t&&r?{...r,runtime:"custom"}:t&&P0()&&E0()?$h():n}function P0(){try{return typeof window=="object"}catch{return!1}}function k0(e){return{get:()=>Object.freeze(T0(e))}}function ab(e){let t=x0(e),r=b0(),n=k0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=A0(o,a,i,p);return m0({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>ob(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:rb}}d();c();l();u();function ib(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Wn="3.55.1",sb=["@coveo/atomic","@coveo/quantic"];var ai=ct(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Wn}`));var Fc=ct(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ai(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=_0(p);return ab({mode:a?"emit":"disabled",url:o??Bu(e,t),token:r,trackingId:n??null,source:i,environment:f})}),O0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},_0=e=>{if(!e)return;let t=e();return{...(ib()?$h():O0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Br(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 o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function U(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(A){i(A)}}function f(g){try{m(n.throw(g))}catch(A){i(A)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var Me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Me||(Me={}));function Wh(){return typeof window<"u"}function cy(){return typeof navigator<"u"}function ii(){return typeof document<"u"}function Yh(){try{return typeof localStorage<"u"}catch{return!1}}function N0(){try{return typeof sessionStorage<"u"}catch{return!1}}function vb(){return cy()&&navigator.cookieEnabled}var D0=[Me.click,Me.custom,Me.search,Me.view],q0=(e,t)=>D0.indexOf(e)!==-1?Object.assign({language:ii()?document.documentElement.lang:"unknown",userAgent:cy()?navigator.userAgent:"unknown"},t):t,Pc=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?cb(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],cb(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function cb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function M0(){return Yh()?localStorage:vb()?new kc:N0()?sessionStorage:new ci}var kc=class e{getItem(t){return Pc.get(`${e.prefix}${t}`)}removeItem(t){Pc.erase(`${e.prefix}${t}`)}setItem(t,r,n){Pc.set(`${e.prefix}${t}`,r,n)}};kc.prefix="coveo_";var Kh=class{constructor(){this.cookieStorage=new kc}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)}},ci=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},xl="__coveo.analytics.history",j0=20,V0=1e3*60,L0=75,Rl=class{constructor(t){this.store=t||M0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(xl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(xl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(xl,JSON.stringify(t.slice(0,j0)))}catch{}}clear(){try{this.store.removeItem(xl)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,L0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>V0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var U0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Me.view?(yield Q0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Q0=e=>U(void 0,void 0,void 0,function*(){let t=new Rl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),B0=/^(?:[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 Il(e){return typeof e=="string"&&B0.test(e)}function ub(e){if(!Il(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function Ab(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}var G0=new Uint8Array(16);function $0(){return crypto.getRandomValues(G0)}function H0(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var z0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",W0="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Y0(e,t,r,n,o,a){let i=typeof r=="string"?H0(r):r,p=typeof n=="string"?ub(n):n;if(typeof n=="string"&&(n=ub(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+i.length);return f.set(p),f.set(i,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,Ab(f)}function Ho(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():K0(e,t,r)}function K0(e,t,r){e=e||{};let n=e.random??e.rng?.()??$0();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 o=0;o<16;++o)t[r+o]=n[o];return t}return Ab(n)}function X0(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 Hh(e,t){return e<<t|e>>>32-t}function Z0(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[p*64+m*4]<<24|e[p*64+m*4+1]<<16|e[p*64+m*4+2]<<8|e[p*64+m*4+3];i[p]=f}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let f=new Uint32Array(80);for(let y=0;y<16;++y)f[y]=i[p][y];for(let y=16;y<80;++y)f[y]=Hh(f[y-3]^f[y-8]^f[y-14]^f[y-16],1);let m=r[0],g=r[1],A=r[2],x=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),w=Hh(m,5)+X0(b,g,A,x)+h+t[b]+f[y]>>>0;h=x,x=A,A=Hh(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+A>>>0,r[3]=r[3]+x>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function El(e,t,r,n){return Y0(80,Z0,e,t)}El.DNS=z0;El.URL=W0;var Cb="2.33.0",lb=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Tc={pageview:"pageview",event:"event"},Fl=class{constructor({client:t,uuidGenerator:r=Ho}){this.client=t,this.uuidGenerator=r}},Xh=class extends Fl{constructor({client:t,uuidGenerator:r=Ho}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=lb(window.location),this.lastReferrer=ii()?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:ii()?document.title:"",encoding:ii()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===Tc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Tc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Tc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Tc.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return lb(window.location)}},Yn=class e{constructor(t,r){if(!Il(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(o=>new RegExp(o.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,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Il(a)?new e(a,Number.parseInt(o)*1e3):null}};Yn.cvo_cid="cvo_cid";Yn.expirationTime=120;var Zh=class extends Fl{constructor({client:t,uuidGenerator:r=Ho}){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 U(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(Yn.cvo_cid,new Yn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Zh.Id="link";var yr=Object.keys;function wl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var zh=128,bb=192,db=224,pb=240;function J0(e){return(e&248)===pb?4:(e&pb)===db?3:(e&db)===bb?2:1}function eN(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&zh)!=zh)break;if(r-=3,(n&bb)!=zh){t-r>=J0(n)*3&&(r=t);break}}return e.substring(0,r)}var Jh={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"},tN=yr(Jh).map(e=>Jh[e]),rN=[...tN].join("|"),nN=new RegExp(`^(${rN}$)`),oN={svcAction:"svc_action",svcActionData:"svc_action_data"},aN=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Jh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),iN=e=>nN.test(e),sN=[iN],fb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},mb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},Tl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},cN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ey={id:"quoteId",affiliation:"quoteAffiliation"},ty={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},uN={add:jt,bookmark_add:jt,bookmark_remove:jt,click:jt,checkout:jt,checkout_option:jt,detail:jt,impression:jt,remove:jt,refund:Object.assign(Object.assign({},jt),Tl),purchase:Object.assign(Object.assign({},jt),Tl),quickview:jt,quote:Object.assign(Object.assign({},jt),ey),review:Object.assign(Object.assign({},jt),ty)},lN=yr(fb).map(e=>fb[e]),dN=yr(mb).map(e=>mb[e]),pN=yr(jt).map(e=>jt[e]),fN=yr(Tl).map(e=>Tl[e]),mN=yr(ty).map(e=>ty[e]),gN=yr(ey).map(e=>ey[e]),hN=[...lN,"custom"].join("|"),yN=[...dN,"custom"].join("|"),xb="(pr[0-9]+)",wb="(il[0-9]+pi[0-9]+)",SN=new RegExp(`^${xb}(${hN})$`),vN=new RegExp(`^(${wb}(${yN}))|(il[0-9]+nm)$`),AN=new RegExp(`^(${pN.join("|")})$`),CN=new RegExp(`^(${fN.join("|")})$`),bN=new RegExp(`^${xb}custom$`),xN=new RegExp(`^${wb}custom$`),wN=new RegExp(`^(${[...cN,...mN,...gN].join("|")})$`),RN=e=>SN.test(e),IN=e=>vN.test(e),EN=e=>AN.test(e),FN=e=>CN.test(e),TN=e=>wN.test(e),PN=[IN,RN,EN,FN,TN],kN=[bN,xN],ON={anonymizeIp:"aip"},_N={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},NN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},DN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],qN=Object.assign(Object.assign(Object.assign(Object.assign({},ON),_N),NN),DN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ry=Object.assign(Object.assign({},qN),oN),MN=e=>{let t=!!e.action&&uN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||ry[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},jN=yr(ry).map(e=>ry[e]),VN=e=>jN.indexOf(e)!==-1,LN=e=>e==="custom",UN=e=>[...PN,...sN,VN,LN].some(t=>t(e)),QN=e=>yr(e).reduce((t,r)=>{let n=BN(r);return n?Object.assign(Object.assign({},t),GN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),BN=e=>{let t;return[...kN].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},GN=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ny=class{constructor(t){this.opts=t}sendEvent(t,r){return U(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:o}=this.opts,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=i;o=p||t;try{a=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(a=>!!a).join("&")})}isEventTypeLegacy(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},oy=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},gb=S.fetch,Pl=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:m}=f,g=Br(f,["url"]),A;try{A=yield gb(m,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(A.ok){let x=yield A.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{A.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,A,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield gb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},ay=class{constructor(t,r){Yh()&&vb()?this.storage=new Kh:Yh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ci),this.client=new Pl(t),this.beaconClient=new ny(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},iy=class{constructor(t,r){this.storage=r||new ci,this.client=new Pl(t)}getClientDependingOnEventType(t){return this.client}},kl=class{constructor(){this.storage=new ci,this.client=new oy}getClientDependingOnEventType(t){return this.client}},$N="xx",HN=e=>e?.startsWith($N)||!1,zN=`
27
+ `;return new Do(r)}var Do=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Oe=class{constructor(e){de(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw oO(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}},He=class{constructor(e={}){de(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&J(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 Gi(e){return e===void 0}function iO(e){return e===null}function J(e){return Gi(e)||iO(e)}var pe=class{constructor(e={}){de(this,"value");this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(aO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function aO(e){return Gi(e)||qu(e)}function qu(e){return typeof e=="boolean"}var ne=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t||(sO(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 sO(e){return Gi(e)||oA(e)}function oA(e){return typeof e=="number"&&!Number.isNaN(e)}var cO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){de(this,"value");de(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new He(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Gi(e))return null;if(!$i(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}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(cO.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 $i(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){de(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Gi(e))return this.config.options.required?"value is required and is currently undefined":null;if(!iA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&J(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function iA(e){return e!==void 0&&typeof e=="object"}var oe=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new He(this.config)}validate(e){if(!J(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(J(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&&J(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return qu(e)||$i(e)||oA(e)||iA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Hi(e){return Array.isArray(e)}var Js=class{constructor(e){de(this,"config");de(this,"value");this.config=e,this.value=new He(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Gi(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}};d();c();l();u();var Mu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function ju(e){return Array.isArray(e)}function Vu(e){return e.trim()===""}function aA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function uO(e){return btoa(encodeURI(e))}function Lu(e,t){let{[e]:r,...n}=t;return n}function zi(e){return uO(JSON.stringify(e))}var lO=new Set(["1",1,"yes",!0]);function Hg(){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=>lO.has(r))}function sA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function cA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function ec(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Uu(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function dO(e){if(Vu(e.openingDelimiter)||Vu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(J(e.content)||Vu(e.content))return e.content;if(e.highlights.length===0)return Wi(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,p=a+i.length;if(p>t)break;r+=Wi(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Wi(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Wi(e.content.slice(n))),r}function Wg(e,t){return e=Wi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?zg(n,t.notMatchDelimiters):o?zg(o,t.exactMatchDelimiters):i?zg(i,t.correctionDelimiters):r)}function zg(e,t){return t?t.open+e+t.close:e}function Wi(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}d();c();l();u();var AA=Fr(hA(),1);d();c();l();u();var ie=new Error("Failed to load reducers."),Yi=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."}},Mo=class extends Error{constructor(r,n){super();de(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function yA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function SA(e){return typeof e!="object"||!e?!1:Object.values(e).every(MO)}function MO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function vA(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=jO(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(i,a);if(vA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,AA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&vA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(A=>setTimeout(A,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Yi;case 404:throw new Mo(i,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new Mo(i):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...f}=t,m=ec(f);try{let g=yield o(t,n,a);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function mt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Gn(e,t,r="prod"){return e??mt(t,r)}function Kt(e,t="prod"){return`${mt(e,t)}/rest/search/v2`}function Bu(e,t="prod"){return`${mt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function jO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",f=VO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:f}),signal:a}}function VO(e,t){return t==="application/x-www-form-urlencoded"?SA(e)?yA(e):"":JSON.stringify(e)}d();c();l();u();var nc=Fr(Gu(),1),IA=Fr(CA(),1);d();c();l();u();var $u=Fr(Gu(),1),xA=Fr(bA(),1);$u.default.extend(xA.default);var wA="YYYY/MM/DD@HH:mm:ss",LO="1401-01-01";function Ki(e,t){let r=(0,$u.default)(e,t);return!r.isValid()&&!t?(0,$u.default)(e,wA):r}function Hu(e){return e.format(wA)}function RA(e,t){let r=Ki(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}lh(r)}function lh(e){if(e.isBefore(LO))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}nc.default.extend(IA.default);var EA=["past","now","next"],FA=["minute","hour","day","week","month","quarter","year"],UO=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new $({required:!t,constrainTo:FA}),period:new $({required:!0,constrainTo:EA})}};function zu(e){if(typeof e=="string"&&!$n(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?dh(e):e;new Oe(UO(t.period)).validate(t);let r=PA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);lh(r)}function TA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function PA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,nc.default)().subtract(r,n);case"next":return(0,nc.default)().add(r,n);case"now":return(0,nc.default)()}}function oc(e){return Hu(PA(dh(e)))}function kA(e){return e.toLocaleLowerCase().split("-")}function $n(e){let[t,r,n]=kA(e);if(t==="now")return!0;if(!EA.includes(t)||!FA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function OA(e){return!!e&&typeof e=="object"&&"period"in e}function dh(e){let[t,r,n]=kA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function _A(e){return zu(e),dh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function DA(_x3,_x4){return _DA.apply(this,arguments)}function _DA(){_DA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _DA.apply(this,arguments)}function qA(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=BO(t,a);let p=t.length,f=0;for(;r<p;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<p&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-f);break;case 13:o=!0,m=r;break;case 10:m=r;break}if(m===-1)break;e(t.subarray(f,m),n),f=r,n=-1}f===p?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function MA(e,t,r){let n=NA(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=NA();else if(p>0){let f=o.decode(a.subarray(0,p)),m=p+(a[p+1]===32?2:1),g=o.decode(a.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
28
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":QO(g,n,t);break}}}}function QO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function BO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function NA(){return{data:"",event:"",id:"",retry:void 0}}var ph="text/event-stream",GO=1e3,jA="last-event-id";function VA(){return typeof window<"u"}function Wu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((g,A)=>{let x={...r};x.accept||(x.accept=ph);let h;function y(){h?.abort(),document.hidden||k()}!p&&VA()&&document.addEventListener("visibilitychange",y);let b=GO,w;function I(){VA()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let F=f??v,E=n??$O;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let T=yield F(e,{...m,headers:x,signal:h?.signal});yield E(T),yield DA(T.body,qA(MA(q=>{q?x[jA]=q:delete x[jA]},q=>{b=q},o))),i?.(),I(),g()}catch(T){if(!h?.signal?.aborted)try{let q=a?.(T)??b;clearTimeout(w),w=setTimeout(k,q)}catch(q){I(),A(q)}}});return _k2.apply(this,arguments)}k()})}function $O(e){let t=e.headers.get("content-type");if(!t?.startsWith(ph))throw new Error(`Expected content-type to be ${ph}, Actual: ${t}`)}d();c();l();u();var Hn=class{constructor(t){de(this,"_basePath");de(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}};var HO=(e,t,r)=>new Hn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,LA=3,zO=5e3,WO="text/event-stream",gh=1,fh=class extends Error{},ic=class extends Error{constructor(r){super(r.message);de(this,"payload",r)}},mh=class{constructor(){de(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},Yu=class{constructor(t){de(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:i,accessToken:a}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,A=new mh;if(!i){this.logger.error("No stream ID found");return}let x=0,h,y=()=>{h&&!A.isActive(h)&&(w?.abort(),g(),I())},b=()=>{A.remove(h),h=cA(y,h,zO),A.add(h)},w=new s.AbortController,I=()=>Wu(HO(n,o,i),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(F){return _asyncToGenerator(function*(){if(F.ok&&F.headers.get("content-type")===WO)return;throw F.status>=400&&F.status<500&&F.status!==429?new ic({message:"Error opening stream",code:F.status}):new fh})()},onmessage:F=>{if(w?.signal.aborted)return;let E=JSON.parse(F.data);if(E.finishReason==="ERROR"){A.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(A.remove(h),m()):b()},onerror:F=>{if(!w?.signal.aborted){if(A.remove(h),F instanceof ic)throw w?.abort(),f(F),F;if(++x>LA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:gh};throw w?.abort(),f(E),new ic(E)}this.logger.info(`Retrying...(${x}/${LA})`),g()}}});return I(),w}};d();c();l();u();var Ku=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function ac(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var hh=e=>{let{response:t}=e;return t.body?YO(e):KO(t)},YO=e=>ZO(e)?JO(e):XO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},KO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function XO(e){return e.body.statusCode!==void 0}function ZO(e){return e.body.exception!==void 0}var JO=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function UA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var yh=(e,t,r,n)=>{let o=new Hn(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var QA=(e,t)=>{let r=new Hn(`${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},Sh=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...yh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:ac(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=UA(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return e_(a)?{success:a}:{error:hh({response:r,body:a})}});return function Sh(_x5,_x6){return _ref3.apply(this,arguments)}}();function e_(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Xi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function bt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Xi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Xi(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function t_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function r_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Zi(e,t){if(t&&e.name==="AbortError")return{error:r_(e)};if(e instanceof Mo)return{error:t_(e)};throw e}var zn=e=>e.success!==void 0,ze=e=>e.error!==void 0;function BA(e){return e.results!==void 0}function GA(e){let t=Xi();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var vh=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,n_=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,sc=(e,t,r,n)=>{o_(e);let o=vh(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},$A=(e,t,r)=>{i_(e);let n=n_(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},Ah=e=>{let{insightId:t,...r}=ac(e);return r},HA=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.")},o_=e=>{if(HA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},i_=e=>{if(HA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var zA=e=>({...sc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var WA=e=>({...sc(e,"POST","application/json","/search"),requestParams:Ah(e)}),YA=e=>({...sc(e,"POST","application/json","/querysuggest"),requestParams:Ah(e)});d();c();l();u();var KA=e=>({...$A(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Xu=class{constructor(t){de(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...zA(t),..._this.options});if(r instanceof Error)return Zi(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Lr.call({...WA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Zi(n);let o=yield n.json();return BA(o)&&(o=GA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...YA(t),..._this3.options});if(r instanceof Error)return Zi(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...KA(t),..._this4.options});if(r instanceof Error)return Zi(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return Sh(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),m4=new $({required:!1,emptyAllowed:!0}),Zu=new oe({each:H,required:!0}),XA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),ZA=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),g4=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new Oe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Do(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return JA(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return JA(e,t,r,o,"Controller initialization error")},JA=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};d();c();l();u();d();c();l();u();d();c();l();u();function Ft(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 a_=typeof Symbol=="function"&&Symbol.observable||"@@observable",eC=a_,Ch=()=>Math.random().toString(36).substring(7).split("").join("."),s_={INIT:`@@redux/INIT${Ch()}`,REPLACE:`@@redux/REPLACE${Ch()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ch()}`},Ju=s_;function Ur(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 bh(e,t,r){if(typeof e!="function")throw new Error(Ft(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ft(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ft(1));return r(bh)(e,t)}let n=e,o=t,i=new Map,a=i,p=0,f=!1;function m(){a===i&&(a=new Map,i.forEach((w,I)=>{a.set(I,w)}))}function g(){if(f)throw new Error(Ft(3));return o}function A(w){if(typeof w!="function")throw new Error(Ft(4));if(f)throw new Error(Ft(5));let I=!0;m();let F=p++;return a.set(F,w),function(){if(I){if(f)throw new Error(Ft(6));I=!1,m(),a.delete(F),i=null}}}function x(w){if(!Ur(w))throw new Error(Ft(7));if(typeof w.type>"u")throw new Error(Ft(8));if(typeof w.type!="string")throw new Error(Ft(17));if(f)throw new Error(Ft(9));try{f=!0,o=n(o,w)}finally{f=!1}return(i=a).forEach(F=>{F()}),w}function h(w){if(typeof w!="function")throw new Error(Ft(10));n=w,x({type:Ju.REPLACE})}function y(){let w=A;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Ft(11));function F(){let k=I;k.next&&k.next(g())}return F(),{unsubscribe:w(F)}},[eC](){return this}}}return x({type:Ju.INIT}),{dispatch:x,subscribe:A,getState:g,replaceReducer:h,[eC]:y}}function c_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ju.INIT})>"u")throw new Error(Ft(12));if(typeof r(void 0,{type:Ju.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ft(13))})}function Ji(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let p=t[a];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,i;try{c_(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,g={};for(let A=0;A<n.length;A++){let x=n[A],h=r[x],y=p[x],b=h(y,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Ft(14))}g[x]=b,m=m||b!==y}return m=m||n.length!==Object.keys(p).length,m?g:p}}function cc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function tC(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ft(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=cc(...p)(o.dispatch),{...o,dispatch:i}}}function uc(e){return Ur(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var kh=Symbol.for("immer-nothing"),lc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state");function Tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,Vo=sr.getPrototypeOf,dc="constructor",hc="prototype",Rh="configurable",nl="enumerable",tl="writable",pc="value",Ht=e=>!!e&&!!e[St];function jt(e){return e?uC(e)||Sc(e)||!!e[lc]||!!e[dc]?.[lc]||vc(e)||Ac(e):!1}var u_=sr[hc][dc].toString(),rC=new WeakMap;function uC(e){if(!e||!ta(e))return!1;let t=Vo(e);if(t===null||t===sr[hc])return!0;let r=sr.hasOwnProperty.call(t,dc)&&t[dc];if(r===Object)return!0;if(!jo(r))return!1;let n=rC.get(r);return n===void 0&&(n=Function.toString.call(r),rC.set(r,n)),n===u_}function lC(e){return Ht(e)||Tt(15,e),e[St].base_}function yc(e,t,r=!0){Lo(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Lo(e){let t=e[St];return t?t.type_:Sc(e)?1:vc(e)?2:Ac(e)?3:0}var ea=(e,t,r=Lo(e))=>r===2?e.has(t):sr[hc].hasOwnProperty.call(e,t),In=(e,t,r=Lo(e))=>r===2?e.get(t):e[t],ol=(e,t,r,n=Lo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function l_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Sc=Array.isArray,vc=e=>e instanceof Map,Ac=e=>e instanceof Set,ta=e=>typeof e=="object",jo=e=>typeof e=="function",xh=e=>typeof e=="boolean";function d_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var p_=e=>ta(e)?e?.[St]:null,En=e=>e.copy_||e.base_;var Oh=e=>e.modified_?e.copy_:e.base_;function Ih(e,t){if(vc(e))return new Map(e);if(Ac(e))return new Set(e);if(Sc(e))return Array[hc].slice.call(e);let r=uC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[St];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p[tl]===!1&&(p[tl]=!0,p[Rh]=!0),(p.get||p.set)&&(n[a]={[Rh]:!0,[tl]:!0,[nl]:p[nl],[pc]:e[a]})}return sr.create(Vo(e),n)}else{let n=Vo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function _h(e,t=!1){return ll(e)||Ht(e)||!jt(e)||(Lo(e)>1&&sr.defineProperties(e,{set:el,add:el,clear:el,delete:el}),sr.freeze(e),t&&yc(e,(r,n)=>{_h(n,!0)},!1)),e}function f_(){Tt(2)}var el={[pc]:f_};function ll(e){return e===null||!ta(e)?!0:sr.isFrozen(e)}var il="MapSet",al="Patches",nC="ArrayMethods",sl={};function Uo(e){let t=sl[e];return t||Tt(0,e),t}var oC=e=>!!sl[e];function m_(e,t){sl[e]||(sl[e]=t)}var fc,dC=()=>fc,g_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:oC(il)?Uo(il):void 0,arrayMethodsPlugin_:oC(nC)?Uo(nC):void 0});function iC(e,t){t&&(e.patchPlugin_=Uo(al),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Eh(e){Fh(e),e.drafts_.forEach(h_),e.drafts_=null}function Fh(e){e===fc&&(fc=e.parent_)}var aC=e=>fc=g_(fc,e);function h_(e){let t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function sC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[St].modified_&&(Eh(t),Tt(4)),jt(e)&&(e=cC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[St].base_,e,t)}else e=cC(t,r);return y_(t,e,!0),Eh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kh?e:void 0}function cC(e,t){if(ll(t))return t;let r=t[St];if(!r)return cl(t,e.handledSet_,e);if(!dl(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);mC(r,e)}return r.copy_}function y_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_h(t,r)}function pC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var dl=(e,t)=>e.scope_===t,S_=[];function fC(e,t,r,n){let o=En(e),i=e.type_;if(n!==void 0&&In(o,n,i)===t){ol(o,n,r,i);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;yc(o,(f,m)=>{if(Ht(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let a=e.draftLocations_.get(t)??S_;for(let p of a)ol(o,p,r,i)}function v_(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!dl(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Oh(i);fC(e,i.draft_??i,a,r),mC(i,o)})}function mC(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 o=n.getPath(e);o&&n.generatePatches_(e,o,t)}pC(e)}}function A_(e,t,r){let{scope_:n}=e;if(Ht(r)){let o=r[St];dl(o,n)&&o.callbacks_.push(function(){rl(e);let a=Oh(o);fC(e,r,a,t)})}else jt(r)&&e.callbacks_.push(function(){let i=En(e);e.type_===3?i.has(r)&&cl(r,n.handledSet_,n):In(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&cl(In(e.copy_,t,e.type_),n.handledSet_,n)})}function cl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Ht(e)||t.has(e)||!jt(e)||ll(e)||(t.add(e),yc(e,(n,o)=>{if(Ht(o)){let i=o[St];if(dl(i,r)){let a=Oh(i);ol(e,n,a,e.type_),pC(i)}}else jt(o)&&cl(o,t,r)})),e}function C_(e,t){let r=Sc(e),n={type_:r?1:0,scope_:t?t.scope_:dC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=ul;r&&(o=[n],i=mc);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,[p,n]}var ul={get(e,t){if(t===St)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 o=En(e);if(!ea(o,t,e.type_))return x_(e,o,t);let i=o[t];if(e.finalized_||!jt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&d_(t))return i;if(i===wh(e.base_,t)||b_(e,t,i)){rl(e);let a=e.type_===1?+t:t,p=Ph(e.scope_,i,e,a);return e.copy_[a]=p}return i},has(e,t){return t in En(e)},ownKeys(e){return Reflect.ownKeys(En(e))},set(e,t,r){let n=gC(En(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=wh(En(e),t),i=o?.[St];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(l_(r,o)&&(r!==void 0||ea(e.base_,t,e.type_)))return!0;rl(e),Th(e)}return e.copy_[t]===r&&(r!==void 0||ea(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),A_(e,t,r)),!0},deleteProperty(e,t){return rl(e),wh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Th(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=En(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[tl]:!0,[Rh]:e.type_!==1||t!=="length",[nl]:n[nl],[pc]:r[t]}},defineProperty(){Tt(11)},getPrototypeOf(e){return Vo(e.base_)},setPrototypeOf(){Tt(12)}},mc={};for(let e in ul){let t=ul[e];mc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}mc.deleteProperty=function(e,t){return mc.set.call(this,e,t,void 0)};mc.set=function(e,t,r){return ul.set.call(this,e[0],t,r,e[0])};function wh(e,t){let r=e[St];return(r?En(r):e)[t]}function b_(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jt(r)||r[St]?!1:e.baseRefs_.has(r)}function x_(e,t,r){let n=gC(t,r);return n?pc in n?n[pc]:n.get?.call(e.draft_):void 0}function gC(e,t){if(!(t in e))return;let r=Vo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Vo(r)}}function Th(e){e.modified_||(e.modified_=!0,e.parent_&&Th(e.parent_))}function rl(e){e.copy_||(e.assigned_=new Map,e.copy_=Ih(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var w_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(jo(t)&&!jo(r)){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,g=>r.call(this,g,...m))}}jo(r)||Tt(6),n!==void 0&&!jo(n)&&Tt(7);let o;if(jt(t)){let i=aC(this),a=Ph(i,t,void 0),p=!0;try{o=r(a),p=!1}finally{p?Eh(i):Fh(i)}return iC(i,n),sC(o,i)}else if(!t||!ta(t)){if(o=r(t),o===void 0&&(o=t),o===kh&&(o=void 0),this.autoFreeze_&&_h(o,!0),n){let i=[],a=[];Uo(al).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Tt(1,t)},this.produceWithPatches=(t,r)=>{if(jo(t))return(a,...p)=>this.produceWithPatches(a,f=>t(f,...p));let n,o;return[this.produce(t,r,(a,p)=>{n=a,o=p}),n,o]},xh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jt(e)||Tt(8),Ht(e)&&(e=pl(e));let t=aC(this),r=Ph(t,e,void 0);return r[St].isManual_=!0,Fh(t),r}finishDraft(e,t){let r=e&&e[St];(!r||!r.isManual_)&&Tt(9);let{scope_:n}=r;return iC(n,t),sC(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 o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Uo(al).applyPatches_;return Ht(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Ph(e,t,r,n){let[o,i]=vc(t)?Uo(il).proxyMap_(t,r):Ac(t)?Uo(il).proxySet_(t,r):C_(t,r);return(r?.scope_??dC()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?v_(r,i,n):i.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:m}=f;i.modified_&&m&&m.generatePatches_(i,[],f)}),o}function pl(e){return Ht(e)||Tt(10,e),hC(e)}function hC(e){if(!jt(e)||ll(e))return e;let t=e[St],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ih(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ih(e,!0);return yc(r,(o,i)=>{ol(r,o,hC(i))},n),t&&(t.finalized_=!1),r}function yC(){function t(y,b=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,I=p_(In(w,y.key_)),F=In(w,y.key_);if(F===void 0||F!==y.draft_&&F!==y.base_&&F!==y.copy_||I!=null&&I.base_!==y.base_)return null;let E=y.parent_.type_===3,k;if(E){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(E&&w.size>k||ea(w,k)))return null;b.push(k)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let w=y;for(let I=0;I<b.length-1;I++){let F=b[I];if(w=In(w,F),!ta(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",i="remove";function a(y,b,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:F}=w;switch(y.type_){case 0:case 2:return f(y,b,I,F);case 1:return p(y,b,I,F);case 3:return m(y,b,I,F)}}function p(y,b,w,I){let{base_:F,assigned_:E}=y,k=y.copy_;k.length<F.length&&([F,k]=[k,F],[w,I]=[I,w]);let T=y.allIndicesReassigned_===!0;for(let q=0;q<F.length;q++){let G=k[q],Q=F[q];if((T||E?.get(q.toString()))&&G!==Q){let B=G?.[St];if(B&&B.modified_)continue;let L=b.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(Q)})}}for(let q=F.length;q<k.length;q++){let G=b.concat([q]);w.push({op:o,path:G,value:h(k[q])})}for(let q=k.length-1;F.length<=q;--q){let G=b.concat([q]);I.push({op:i,path:G})}}function f(y,b,w,I){let{base_:F,copy_:E,type_:k}=y;yc(y.assigned_,(T,q)=>{let G=In(F,T,k),Q=In(E,T,k),V=q?ea(F,T)?n:o:i;if(G===Q&&V===n)return;let B=b.concat(T);w.push(V===i?{op:V,path:B}:{op:V,path:B,value:h(Q)}),I.push(V===o?{op:i,path:B}:V===i?{op:o,path:B,value:h(G)}:{op:n,path:B,value:h(G)})})}function m(y,b,w,I){let{base_:F,copy_:E}=y,k=0;F.forEach(T=>{if(!E.has(T)){let q=b.concat([k]);w.push({op:i,path:q,value:T}),I.unshift({op:o,path:q,value:T})}k++}),k=0,E.forEach(T=>{if(!F.has(T)){let q=b.concat([k]);w.push({op:o,path:q,value:T}),I.unshift({op:i,path:q,value:T})}k++})}function g(y,b,w){let{patches_:I,inversePatches_:F}=w;I.push({op:n,path:[],value:b===kh?void 0:b}),F.push({op:n,path:[],value:y})}function A(y,b){return b.forEach(w=>{let{path:I,op:F}=w,E=y;for(let G=0;G<I.length-1;G++){let Q=Lo(E),V=I[G];typeof V!="string"&&typeof V!="number"&&(V=""+V),(Q===0||Q===1)&&(V==="__proto__"||V===dc)&&Tt(19),jo(E)&&V===hc&&Tt(19),E=In(E,V),(E===null||!ta(E))&&Tt(18,I.join("/"))}let k=Lo(E),T=x(w.value),q=I[I.length-1];switch(F){case n:switch(k){case 2:return E.set(q,T);case 3:Tt(16);default:return E[q]=T}case o:switch(k){case 1:return q==="-"?E.push(T):E.splice(q,0,T);case 2:return E.set(q,T);case 3:return E.add(T);default:return E[q]=T}case i:switch(k){case 1:return E.splice(q,1);case 2:return E.delete(q);case 3:return E.delete(w.value);default:return delete E[q]}default:Tt(17,F)}}),y}function x(y){if(!jt(y))return y;if(Sc(y))return y.map(x);if(vc(y))return new Map(Array.from(y.entries()).map(([w,I])=>[w,x(I)]));if(Ac(y))return new Set(Array.from(y).map(x));let b=Object.create(Vo(y));for(let w in y)b[w]=x(y[w]);return ea(y,lc)&&(b[lc]=y[lc]),b}function h(y){return Ht(y)?x(y):y}m_(al,{applyPatches_:A,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var gc=new w_,Qo=gc.produce,Nh=gc.produceWithPatches.bind(gc);var Dh=gc.applyPatches.bind(gc);d();c();l();u();function R_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function I_(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 SC=e=>Array.isArray(e)?e:[e];function E_(e){let t=Array.isArray(e[0])?e[0]:e;return I_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function F_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var T_=class{constructor(e){this.value=e}deref(){return this.value}},P_=()=>typeof WeakRef>"u"?T_:WeakRef,AC=P_(),k_=0,vC=1;function fl(){return{s:k_,v:void 0,o:null,p:null}}function O_(e){return e instanceof AC?e.deref():e}function Cc(e,t={}){let r=fl(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let A=0,x=f;A<x;A++){let h=arguments[A];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=p.o;y===null&&(p.o=y=new WeakMap);let b=y.get(h);b===void 0?(p=fl(),y.set(h,p)):p=b}else{let y=p.p;y===null&&(p.p=y=new Map);let b=y.get(h);b===void 0?(p=fl(),y.set(h,p)):p=b}}let m=p,g;if(p.s===vC)g=p.v;else if(g=e.apply(null,arguments),i++,n){let A=O_(o);A!=null&&n(A,g)&&(g=A,i!==0&&i--),o=typeof g=="object"&&g!==null||typeof g=="function"?new AC(g):g}return m.s=vC,m.v=g,g}return a.clearCache=()=>{r=fl(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function __(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),R_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:A,memoizeOptions:x=[],argsMemoize:h=Cc,argsMemoizeOptions:y=[]}=g,b=SC(x),w=SC(y),I=E_(o),F=A(function(){return i++,m.apply(null,arguments)},...b),E=!0,k=h(function(){a++;let q=F_(I,arguments);return p=F.apply(null,q),p},...w);return Object.assign(k,{resultFunc:m,memoizedResultFunc:F,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:A,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ct=__(Cc);d();c();l();u();function CC(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var bC=CC(),xC=CC;var N_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?cc:cc.apply(null,arguments)},Y4=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},D_=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>uc(n)&&n.type===e,r}var kC=class bc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,bc.prototype)}static get[Symbol.species](){return bc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new bc(...t[0].concat(this)):new bc(...t.concat(this))}};function wC(e){return jt(e)?Qo(e,()=>{}):e}function ml(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function q_(e){return typeof e=="boolean"}var M_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new kC;return r&&(q_(r)?a.push(bC):a.push(xC(r.extraArgument))),a},xc="RTK_autoBatch",oa=()=>e=>({payload:e,meta:{[xc]:!0}}),RC=e=>t=>{setTimeout(t,e)},j_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(i),clearTimeout(a),r())},i=e(o),a=setTimeout(o,t)},V_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?j_(window.requestAnimationFrame,100):RC(10):e.type==="callback"?e.queueNotification:RC(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let A=()=>o&&g(),x=n.subscribe(A);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[xc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},L_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new kC(e);return n&&o.push(V_(typeof n=="object"?n:void 0)),o};function OC(e){let t=M_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Ur(r))f=Ji(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=cc;o&&(g=N_({trace:!1,...(typeof o=="object"&&o)}));let A=tC(...m),x=L_(A),h=typeof p=="function"?p(x):x(),y=g(...h);return bh(f,a,y)}function _C(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function U_(e){return typeof e=="function"}function fe(e,t){let[r,n,o]=_C(t),i;if(U_(e))i=()=>wC(e());else{let p=wC(e);i=()=>p}function a(p=i(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,A)=>{if(A)if(Ht(g)){let h=A(g,f);return h===void 0?g:h}else{if(jt(g))return Qo(g,x=>A(x,f));{let x=A(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return a.getInitialState=i,a}var NC=(e,t)=>D_(e)?e.match(t):e(t);function Qr(...e){return t=>e.some(r=>NC(r,t))}function na(...e){return t=>e.every(r=>NC(r,t))}function Sl(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 wc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function vl(...e){return e.length===0?t=>Sl(t,["pending"]):wc(e)?Qr(...e.map(t=>t.pending)):vl()(e[0])}function Go(...e){return e.length===0?t=>Sl(t,["rejected"]):wc(e)?Qr(...e.map(t=>t.rejected)):Go()(e[0])}function Rc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?na(Go(...e),t):wc(e)?na(Go(...e),t):Rc()(e[0])}function Fn(...e){return e.length===0?t=>Sl(t,["fulfilled"]):wc(e)?Qr(...e.map(t=>t.fulfilled)):Fn()(e[0])}function Al(...e){return e.length===0?t=>Sl(t,["pending","fulfilled","rejected"]):wc(e)?Qr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Al()(e[0])}var Q_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ic=(e=21)=>{let t="",r=e;for(;r--;)t+=Q_[Math.random()*64|0];return t},B_=["name","message","stack","code"],qh=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},IC=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},G_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of B_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},EC="External signal was aborted",me=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(f,m,g,A)=>({payload:f,meta:{...(A||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),i=P(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),a=P(t+"/rejected",(f,m,g,A,x)=>({payload:A,error:(n&&n.serializeError||G_)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!A,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,A,x)=>{let h=n?.idGenerator?n.idGenerator(f):Ic(),y=new s.AbortController,b,w;function I(E){w=E,y.abort()}m&&(m.aborted?I(EC):m.addEventListener("abort",()=>I(EC),{once:!0}));let F=_asyncToGenerator(function*(){let E;try{let T=n?.condition?.(f,{getState:A,extra:x});if(H_(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:A,extra:x}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:A,extra:x,requestId:h,signal:y.signal,abort:I,rejectWithValue:(G,Q)=>new qh(G,Q),fulfillWithValue:(G,Q)=>new IC(G,Q)})).then(G=>{if(G instanceof qh)throw G;return G instanceof IC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(T){E=T instanceof qh?a(null,h,f,T.payload,T.meta):a(T,h,f)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(E)&&E.meta.condition||g(E),E})();return Object.assign(F,{abort:I,requestId:h,arg:f,unwrap(){return F.then($_)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:Qr(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function $_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function H_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var DC=Symbol.for("rtk-slice-createasyncthunk"),X4={[DC]:me};function z_(e,t){return`${e}/${t}`}function W_({creators:e}={}){let t=e?.asyncThunk?.[DC];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(K_()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,k){let T=typeof E=="string"?E:E.type;if(!T)throw new Error(zt(12));if(T in f.sliceCaseReducersByType)throw new Error(zt(13));return f.sliceCaseReducersByType[T]=k,m},addMatcher(E,k){return f.sliceMatchers.push({matcher:E,reducer:k}),m},exposeAction(E,k){return f.actionCreators[E]=k,m},exposeCaseReducer(E,k){return f.sliceCaseReducersByName[E]=k,m}};p.forEach(E=>{let k=a[E],T={reducerName:E,type:z_(o,E),createNotation:typeof n.reducers=="function"};Z_(k)?e0(T,k,m,t):X_(T,k,m)});function g(){let[E={},k=[],T=void 0]=typeof n.extraReducers=="function"?_C(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return fe(n.initialState,G=>{for(let Q in q)G.addCase(Q,q[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of k)G.addMatcher(Q.matcher,Q.reducer);T&&G.addDefaultCase(T)})}let A=E=>E,x=new Map,h=new WeakMap,y;function b(E,k){return y||(y=g()),y(E,k)}function w(){return y||(y=g()),y.getInitialState()}function I(E,k=!1){function T(G){let Q=G[E];return typeof Q>"u"&&k&&(Q=ml(h,T,w)),Q}function q(G=A){let Q=ml(x,k,()=>new WeakMap);return ml(Q,G,()=>{let V={};for(let[B,L]of Object.entries(n.selectors??{}))V[B]=Y_(L,G,()=>ml(h,G,w),k);return V})}return{reducerPath:E,getSelectors:q,get selectors(){return q(T)},selectSlice:T}}let F={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(i),injectInto(E,{reducerPath:k,...T}={}){let q=k??i;return E.inject({reducerPath:q,reducer:b},T),{...F,...I(q,!0)}}};return F}}function Y_(e,t,r,n){function o(i,...a){let p=t(i);return typeof p>"u"&&n&&(p=r()),e(p,...a)}return o.unwrapped=e,o}var $o=W_();function K_(){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 X_({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!J_(n))throw new Error(zt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?P(e,a):P(e))}function Z_(e){return e._reducerDefinitionType==="asyncThunk"}function J_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function e0({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:g}=r,A=o(e,i,g);n.exposeAction(t,A),a&&n.addCase(A.fulfilled,a),p&&n.addCase(A.pending,p),f&&n.addCase(A.rejected,f),m&&n.addMatcher(A.settled,m),n.exposeCaseReducer(t,{fulfilled:a||gl,pending:p||gl,rejected:f||gl,settled:m||gl})}function gl(){}var t0="task",qC="listener",MC="completed",Vh="cancelled",r0=`task-${Vh}`,n0=`task-${MC}`,Mh=`${qC}-${Vh}`,o0=`${qC}-${MC}`,Cl=class{constructor(e){de(this,"code");de(this,"name","TaskAbortError");de(this,"message");this.code=e,this.message=`${t0} ${Vh} (reason: ${e})`}},Lh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},hl=()=>{},jC=(e,t=hl)=>(e.catch(t),e),VC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Bo=e=>{if(e.aborted)throw new Cl(e.reason)};function LC(e,t){let r=hl;return new Promise((n,o)=>{let i=()=>o(new Cl(e.reason));if(e.aborted){i();return}r=VC(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=hl})}var i0=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Cl?"cancelled":"rejected",error:r}}finally{t?.()}});return function i0(_x7,_x8){return _ref5.apply(this,arguments)}}(),yl=e=>t=>jC(LC(e,t).then(r=>(Bo(e),r))),UC=e=>{let t=yl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ra}=Object,FC={},bl="listenerMiddleware",a0=(e,t)=>{let r=n=>VC(e,()=>n.abort(e.reason));return(n,o)=>{Lh(n,"taskExecutor");let i=new s.AbortController;r(i);let a=i0(/*#__PURE__*/_asyncToGenerator(function*(){Bo(e),Bo(i.signal);let p=yield n({pause:yl(i.signal),delay:UC(i.signal),signal:i.signal});return Bo(i.signal),p}),()=>i.abort(n0));return o?.autoJoin&&t.push(a.catch(hl)),{result:yl(e)(a),cancel(){i.abort(r0)}}}},s0=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Bo(t);let i=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(A,x)=>{x.unsubscribe(),f([A,x.getState(),x.getOriginalState()])}});i=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield LC(t,Promise.race(p));return Bo(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>jC(r(n,o))},QC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(zt(21));return Lh(i,"options.listener"),{predicate:o,type:t,effect:i}},BC=ra(e=>{let{type:t,predicate:r,effect:n}=QC(e);return{id:Ic(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>BC}),TC=(e,t)=>{let{type:r,effect:n,predicate:o}=QC(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},jh=e=>{e.pending.forEach(t=>{t.abort(Mh)})},c0=(e,t)=>()=>{for(let r of t.keys())jh(r);e.clear()},PC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},GC=ra(P(`${bl}/add`),{withTypes:()=>GC}),u0=P(`${bl}/removeAll`),$C=ra(P(`${bl}/remove`),{withTypes:()=>$C}),l0=(...e)=>{console.error(`${bl}/error`,...e)},HC=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:i,onError:a=l0}=e;Lh(a,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&jh(h)}),f=h=>{let y=TC(t,h)??BC(h);return p(y)};ra(f,{withTypes:()=>f});let m=h=>{let y=TC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&jh(y)),!!y};ra(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,w){let I=new s.AbortController,F=s0(f,I.signal),E=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,ra({},b,{getOriginalState:w,condition:(k,T)=>F(k,T).then(Boolean),take:F,delay:UC(I.signal),pause:yl(I.signal),extra:i,signal:I.signal,fork:a0(I.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,T,q)=>{k!==I&&(k.abort(Mh),q.delete(k))})},cancel:()=>{I.abort(Mh),h.pending.delete(I)},throwIfCancelled:()=>{Bo(I.signal)}})))}catch(k){k instanceof Cl||PC(a,k,{raisedBy:"effect"})}finally{yield Promise.all(E),I.abort(o0),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),A=c0(t,r);return{middleware:h=>y=>b=>{if(!uc(b))return y(b);if(GC.match(b))return f(b.payload);if(u0.match(b)){A();return}if($C.match(b))return m(b.payload);let w=h.getState(),I=()=>{if(w===FC)throw new Error(zt(23));return w},F;try{if(F=y(b),t.size>0){let E=h.getState(),k=Array.from(t.values());for(let T of k){let q=!1;try{q=T.predicate(b,E,w)}catch(G){q=!1,PC(a,G,{raisedBy:"predicate"})}q&&g(T,b,h,I)}}}finally{w=FC}return F},startListening:f,stopListening:m,clearListeners:A}};function zt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function zC(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var WC=/^(?:[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 d0(e){return typeof e=="string"&&WC.test(e)}var Uh=d0;d();c();l();u();var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function YC(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var p0=new Uint8Array(16);function Qh(){return crypto.getRandomValues(p0)}d();c();l();u();function f0(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():m0(e,t,r)}function m0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Qh();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 o=0;o<16;++o)t[r+o]=n[o];return t}return YC(n)}var Bh=f0;function g0(_x13){return _g2.apply(this,arguments)}function _g2(){_g2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _g2.apply(this,arguments)}var tb="2.1.3",Gh=128,rb=192,KC=224,XC=240,h0=248;function y0(e){return(e&h0)===XC?4:(e&XC)===KC?3:(e&KC)===rb?2:1}function S0(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&Gh)!=Gh)break;if(r-=3,(n&rb)!=Gh){t-r>=y0(n)*3&&(r=t);break}}return e.substring(0,r)}function v0(e){let{trackingId:t}=e;return{trackingId:t}}function A0(e){return(e.source||[]).concat([`relay@${tb}`])}function nb(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=v0(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:A0(t),clientId:p,userAgent:i(),referrer:ZC(n()),location:ZC(o())})}function ZC(e){return e!==null?S0(e,1024):null}function C0(e,t,r,n){return{...t,meta:nb(e,r,n)}}var b0="*";function x0(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function i(f){if(f===b0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function a(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?a({type:f,callback:m}):i(f)}return{add:n,call:o,remove:p}}function JC({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 w0(e){let t=JC(e);return{get:()=>t,update:r=>{t=JC({...t,...r})}}}var $h=R0();function R0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function I0(){return{getItem(e){return $h.getItem(e)||localStorage.getItem(e)},removeItem(e){$h.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),$h.setItem(e,t,31556952e3)}}}var eb="visitorId";function E0(){let e=document.referrer;return e===""?null:e}function Hh(){let e=I0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});zC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let p;try{p=yield a.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>E0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(eb);if(t&&Uh(t))return t;let r=Bh();return e.setItem(eb,r),r}}}function F0(){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 T0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function P0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=T0();return t&&r?{...r,runtime:"custom"}:t&&k0()&&F0()?Hh():n}function k0(){try{return typeof window=="object"}catch{return!1}}function O0(e){return{get:()=>Object.freeze(P0(e))}}function ob(e){let t=w0(e),r=x0(),n=O0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),f=C0(o,i,a,p);return g0({config:a,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>nb(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:tb}}d();c();l();u();function ib(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Wn="3.55.2",ab=["@coveo/atomic","@coveo/quantic"];var ia=ct(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Wn}`));var Ec=ct(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ia(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=N0(p);return ob({mode:i?"emit":"disabled",url:o??Bu(e,t),token:r,trackingId:n??null,source:a,environment:f})}),_0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},N0=e=>{if(!e)return;let t=e();return{...(ib()?Hh():_0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Br(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 o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function U(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(A){a(A)}}function f(g){try{m(n.throw(g))}catch(A){a(A)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var Me;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Me||(Me={}));function Yh(){return typeof window<"u"}function uy(){return typeof navigator<"u"}function aa(){return typeof document<"u"}function Kh(){try{return typeof localStorage<"u"}catch{return!1}}function D0(){try{return typeof sessionStorage<"u"}catch{return!1}}function Sb(){return uy()&&navigator.cookieEnabled}var q0=[Me.click,Me.custom,Me.search,Me.view],M0=(e,t)=>q0.indexOf(e)!==-1?Object.assign({language:aa()?document.documentElement.lang:"unknown",userAgent:uy()?navigator.userAgent:"unknown"},t):t,Tc=class e{static set(t,r,n){var o,i,a,p;n&&(i=new Date,i.setTime(i.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?sb(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],sb(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function sb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function j0(){return Kh()?localStorage:Sb()?new Pc:D0()?sessionStorage:new ca}var Pc=class e{getItem(t){return Tc.get(`${e.prefix}${t}`)}removeItem(t){Tc.erase(`${e.prefix}${t}`)}setItem(t,r,n){Tc.set(`${e.prefix}${t}`,r,n)}};Pc.prefix="coveo_";var Xh=class{constructor(){this.cookieStorage=new Pc}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)}},ca=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},xl="__coveo.analytics.history",V0=20,L0=1e3*60,U0=75,Rl=class{constructor(t){this.store=t||j0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(xl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(xl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(xl,JSON.stringify(t.slice(0,V0)))}catch{}}clear(){try{this.store.removeItem(xl)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,U0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>L0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Q0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Me.view?(yield B0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),B0=e=>U(void 0,void 0,void 0,function*(){let t=new Rl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),G0=/^(?:[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 Il(e){return typeof e=="string"&&G0.test(e)}function cb(e){if(!Il(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var kt=[];for(let e=0;e<256;++e)kt.push((e+256).toString(16).slice(1));function vb(e,t=0){return(kt[e[t+0]]+kt[e[t+1]]+kt[e[t+2]]+kt[e[t+3]]+"-"+kt[e[t+4]]+kt[e[t+5]]+"-"+kt[e[t+6]]+kt[e[t+7]]+"-"+kt[e[t+8]]+kt[e[t+9]]+"-"+kt[e[t+10]]+kt[e[t+11]]+kt[e[t+12]]+kt[e[t+13]]+kt[e[t+14]]+kt[e[t+15]]).toLowerCase()}var $0=new Uint8Array(16);function H0(){return crypto.getRandomValues($0)}function z0(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var W0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Y0="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function K0(e,t,r,n,o,i){let a=typeof r=="string"?z0(r):r,p=typeof n=="string"?cb(n):n;if(typeof n=="string"&&(n=cb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+a.length);return f.set(p),f.set(a,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,vb(f)}function Ho(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():X0(e,t,r)}function X0(e,t,r){e=e||{};let n=e.random??e.rng?.()??H0();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 o=0;o<16;++o)t[r+o]=n[o];return t}return vb(n)}function Z0(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 zh(e,t){return e<<t|e>>>32-t}function J0(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let p=0;p<i;++p){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[p*64+m*4]<<24|e[p*64+m*4+1]<<16|e[p*64+m*4+2]<<8|e[p*64+m*4+3];a[p]=f}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<i;++p){let f=new Uint32Array(80);for(let y=0;y<16;++y)f[y]=a[p][y];for(let y=16;y<80;++y)f[y]=zh(f[y-3]^f[y-8]^f[y-14]^f[y-16],1);let m=r[0],g=r[1],A=r[2],x=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),w=zh(m,5)+Z0(b,g,A,x)+h+t[b]+f[y]>>>0;h=x,x=A,A=zh(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+A>>>0,r[3]=r[3]+x>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function El(e,t,r,n){return K0(80,J0,e,t)}El.DNS=W0;El.URL=Y0;var Ab="2.33.0",ub=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Fc={pageview:"pageview",event:"event"},Fl=class{constructor({client:t,uuidGenerator:r=Ho}){this.client=t,this.uuidGenerator=r}},Zh=class extends Fl{constructor({client:t,uuidGenerator:r=Ho}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ub(window.location),this.lastReferrer=aa()?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:aa()?document.title:"",encoding:aa()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Fc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Fc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Fc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Fc.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return ub(window.location)}},Yn=class e{constructor(t,r){if(!Il(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(o=>new RegExp(o.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,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Il(i)?new e(i,Number.parseInt(o)*1e3):null}};Yn.cvo_cid="cvo_cid";Yn.expirationTime=120;var Jh=class extends Fl{constructor({client:t,uuidGenerator:r=Ho}){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 U(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(Yn.cvo_cid,new Yn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Jh.Id="link";var yr=Object.keys;function wl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Wh=128,Cb=192,lb=224,db=240;function eN(e){return(e&248)===db?4:(e&db)===lb?3:(e&lb)===Cb?2:1}function tN(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&Wh)!=Wh)break;if(r-=3,(n&Cb)!=Wh){t-r>=eN(n)*3&&(r=t);break}}return e.substring(0,r)}var ey={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"},rN=yr(ey).map(e=>ey[e]),nN=[...rN].join("|"),oN=new RegExp(`^(${nN}$)`),iN={svcAction:"svc_action",svcActionData:"svc_action_data"},aN=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ey[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),sN=e=>oN.test(e),cN=[sN],pb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},fb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Vt={action:"pa",list:"pal",listSource:"pls"},Tl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},uN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ty={id:"quoteId",affiliation:"quoteAffiliation"},ry={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},lN={add:Vt,bookmark_add:Vt,bookmark_remove:Vt,click:Vt,checkout:Vt,checkout_option:Vt,detail:Vt,impression:Vt,remove:Vt,refund:Object.assign(Object.assign({},Vt),Tl),purchase:Object.assign(Object.assign({},Vt),Tl),quickview:Vt,quote:Object.assign(Object.assign({},Vt),ty),review:Object.assign(Object.assign({},Vt),ry)},dN=yr(pb).map(e=>pb[e]),pN=yr(fb).map(e=>fb[e]),fN=yr(Vt).map(e=>Vt[e]),mN=yr(Tl).map(e=>Tl[e]),gN=yr(ry).map(e=>ry[e]),hN=yr(ty).map(e=>ty[e]),yN=[...dN,"custom"].join("|"),SN=[...pN,"custom"].join("|"),bb="(pr[0-9]+)",xb="(il[0-9]+pi[0-9]+)",vN=new RegExp(`^${bb}(${yN})$`),AN=new RegExp(`^(${xb}(${SN}))|(il[0-9]+nm)$`),CN=new RegExp(`^(${fN.join("|")})$`),bN=new RegExp(`^(${mN.join("|")})$`),xN=new RegExp(`^${bb}custom$`),wN=new RegExp(`^${xb}custom$`),RN=new RegExp(`^(${[...uN,...gN,...hN].join("|")})$`),IN=e=>vN.test(e),EN=e=>AN.test(e),FN=e=>CN.test(e),TN=e=>bN.test(e),PN=e=>RN.test(e),kN=[EN,IN,FN,TN,PN],ON=[xN,wN],_N={anonymizeIp:"aip"},NN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},DN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},qN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],MN=Object.assign(Object.assign(Object.assign(Object.assign({},_N),NN),DN),qN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ny=Object.assign(Object.assign({},MN),iN),jN=e=>{let t=!!e.action&&lN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||ny[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},VN=yr(ny).map(e=>ny[e]),LN=e=>VN.indexOf(e)!==-1,UN=e=>e==="custom",QN=e=>[...kN,...cN,LN,UN].some(t=>t(e)),BN=e=>yr(e).reduce((t,r)=>{let n=GN(r);return n?Object.assign(Object.assign({},t),$N(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),GN=e=>{let t;return[...ON].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},$N=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),oy=class{constructor(t){this.opts=t}sendEvent(t,r){return U(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:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=a;o=p||t;try{i=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},iy=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},mb=S.fetch,Pl=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),i?yield i(p,"analyticsFetch"):{}),{url:m}=f,g=Br(f,["url"]),A;try{A=yield mb(m,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(A.ok){let x=yield A.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{A.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,A,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield mb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Me.click,Me.custom,Me.search,Me.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},ay=class{constructor(t,r){Kh()&&Sb()?this.storage=new Xh:Kh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ca),this.client=new Pl(t),this.beaconClient=new oy(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},sy=class{constructor(t,r){this.storage=r||new ca,this.client=new Pl(t)}getClientDependingOnEventType(t){return this.client}},kl=class{constructor(){this.storage=new ca,this.client=new iy}getClientDependingOnEventType(t){return this.client}},HN="xx",zN=e=>e?.startsWith(HN)||!1,WN=`
29
29
  We've detected you're using React Native but have not provided the corresponding runtime,
30
30
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
31
31
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
32
- `;function WN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var YN=["1",1,"yes",!0];function KN(){let e=[];return Wh()&&e.push(window.doNotTrack),cy()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>YN.indexOf(t)!==-1)}function Oc(e){return e===!0?!1:KN()}var Rb="v15",Ib={default:"https://analytics.cloud.coveo.com/rest/ua"};function XN(e=Ib.default,t=Rb,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 ZN="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:Ib.default,isCustomEndpoint:!1,token:"",version:Rb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Cb}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=[U0,q0].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};Oc(this.options.disableBrowserPrivacySignals)?this.runtime=new kl:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Me.view,{newEventType:Me.view,addClientIdParameter:!0}),this.addEventTypeMapping(Me.click,{newEventType:Me.click,addClientIdParameter:!0}),this.addEventTypeMapping(Me.custom,{newEventType:Me.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Me.search,{newEventType:Me.search,addClientIdParameter:!0})}initRuntime(t){return Wh()&&ii()?new ay(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(WN()&&console.warn(zN),new iy(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Wh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Ho()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Ho()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(Il(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(El(t,El(r,ZN)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(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(Ho()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Oc(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Yn.cvo_cid);if(r==null)return null;let n=Yn.fromString(r);return!n||!ii()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:a=!1,addClientIdParameter:i=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>U(this,void 0,void 0,function*(){let w=yield y;return yield b(t,w)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[A=>this.setTrackingIdIfTrackingIdNotPresent(A),A=>this.removeEmptyPayloadValues(A,t),A=>this.validateParams(A,t),A=>n?MN(A):A,A=>n?this.removeUnknownParameters(A):A,A=>n?this.processCustomParameters(A):this.mapCustomParametersToCustomData(A)].reduce((A,x)=>U(this,void 0,void 0,function*(){let h=yield A;return yield x(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),a=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:a,log:i=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},a),i)}),yield Promise.all(this.afterSendHooks.map(p=>p(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(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 Rl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Br(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Br(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Br(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield v(`${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 o=0,a=r.length;o<a;o++){let i=r[o];if(typeof i=="string")n[t[o]]=i;else if(typeof i=="object")return Object.assign(Object.assign({},n),i)}return n}isKeyAllowedEmpty(t,r){return({[Me.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,a)=>Object.assign(Object.assign({},o),{[a]:t[a]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(UN(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=Br(t,["custom"]),o={};r&&wl(r)&&(o=this.lowercaseKeys(r));let a=QN(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Br(t,["custom"]);if(r&&wl(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=Br(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Me.view||r==Me.click||r==Me.search||r==Me.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Me.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Br(t,["userId"]);return HN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Br(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&wl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&wl(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"?eN(t,r):t}get baseUrl(){return XN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},kt;(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"})(kt||(kt={}));var O;(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.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",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.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(O||(O={}));var sy={[O.triggerNotify]:"queryPipelineTriggers",[O.triggerExecute]:"queryPipelineTriggers",[O.triggerQuery]:"queryPipelineTriggers",[O.triggerRedirect]:"queryPipelineTriggers",[O.queryErrorBack]:"errors",[O.queryErrorClear]:"errors",[O.queryErrorRetry]:"errors",[O.pagerNext]:"getMoreResults",[O.pagerPrevious]:"getMoreResults",[O.pagerNumber]:"getMoreResults",[O.pagerResize]:"getMoreResults",[O.pagerScrolling]:"getMoreResults",[O.facetSearch]:"facet",[O.facetShowLess]:"facet",[O.facetShowMore]:"facet",[O.recommendation]:"recommendation",[O.likeSmartSnippet]:"smartSnippet",[O.dislikeSmartSnippet]:"smartSnippet",[O.expandSmartSnippet]:"smartSnippet",[O.collapseSmartSnippet]:"smartSnippet",[O.openSmartSnippetFeedbackModal]:"smartSnippet",[O.closeSmartSnippetFeedbackModal]:"smartSnippet",[O.sendSmartSnippetReason]:"smartSnippet",[O.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.clearRecentQueries]:"recentQueries",[O.recentResultClick]:"recentlyClickedDocuments",[O.clearRecentResults]:"recentlyClickedDocuments",[O.showLessFoldedResults]:"folding",[O.caseDetach]:"case",[O.likeGeneratedAnswer]:"generatedAnswer",[O.dislikeGeneratedAnswer]:"generatedAnswer",[O.openGeneratedAnswerSource]:"generatedAnswer",[O.generatedAnswerOpenInlineLink]:"generatedAnswer",[O.generatedAnswerFollowupOpenSource]:"generatedAnswer",[O.generatedAnswerStreamEnd]:"generatedAnswer",[O.generatedAnswerSourceHover]:"generatedAnswer",[O.generatedAnswerCopyToClipboard]:"generatedAnswer",[O.generatedAnswerHideAnswers]:"generatedAnswer",[O.generatedAnswerShowAnswers]:"generatedAnswer",[O.generatedAnswerExpand]:"generatedAnswer",[O.generatedAnswerCollapse]:"generatedAnswer",[O.generatedAnswerFeedbackSubmit]:"generatedAnswer",[O.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[kt.expandToFullUI]:"interface",[kt.openUserActions]:"User Actions",[kt.showPrecedingSessions]:"User Actions",[kt.showFollowingSessions]:"User Actions",[kt.clickViewedDocument]:"User Actions",[kt.clickPageView]:"User Actions",[kt.createArticle]:"createArticle"},Kn=class{constructor(){this.runtime=new kl,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(Me.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Me.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Me.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Me.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Cb}};function JN(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function eD(e){return e.map(t=>t.replace(/;/g,""))}function Eb(e){let r=e.join(";");return r.length<=256?r:Eb(e.slice(1))}var hb=e=>{let t=eD(e),r=JN(t);return Eb(r)};function yb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:hb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:hb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ol=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Oc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Kn:new cr(t)}disable(){this.coveoAnalyticsClient=new Kn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(O.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(O.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(O.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(O.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(O.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(O.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(O.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(O.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(O.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(O.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(O.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(O.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(O.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(O.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(O.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(O.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(O.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(O.omniboxAnalytics,yb(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(O.omniboxFromLink,yb(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(O.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(O.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(O.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(O.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(O.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(O.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(O.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(O.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(O.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(O.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(O.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(O.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(O.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(O.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(O.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(O.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(O.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(O.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(O.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(O.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(O.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(O.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(O.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(O.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(O.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(O.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(O.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(O.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(O.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(O.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(O.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(O.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(O.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(O.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(O.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(O.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(O.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(O.showLessFoldedResults)}logShowLessFoldedResults(){return U(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 U(this,arguments,void 0,function*(n,o,a=sy[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,a=sy[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),i=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({lastSearchQueryUid:p})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:a})=>o.log({searchQueryUid:a})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),i=yield this.coveoAnalyticsClient.makeClickEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({searchQueryUid:p})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(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 cr?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(O.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(O.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(O.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(O.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(O.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(O.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(O.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(O.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(O.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(O.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(O.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(O.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(O.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(O.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},_l=Object.assign({},Tc),Sb=Object.keys(_l).map(e=>_l[e]),si=class extends Xh{constructor({client:t,uuidGenerator:r=Ho}){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])=>Sb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Sb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(_l.pageview,{newEventType:Me.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(_l.event,{newEventType:Me.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=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}:{}),a=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},a),o),r)}getTicketPayload(){return aN(this.ticket)}};si.Id="svc";var Nl;(function(e){e.click="click",e.flowStart="flowStart"})(Nl||(Nl={}));var hr;(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"})(hr||(hr={}));var Dl;(function(e){e.quit="Quit",e.solved="Solved"})(Dl||(Dl={}));var ql=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Oc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new cr(t):new Kn,this.svc=new si({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Kn,this.svc=new si({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new si({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(hr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(hr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(hr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(hr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(hr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(hr.caseCancelled,{reason:Dl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(hr.caseSolved,{reason:Dl.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(hr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Nl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Nl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,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 cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,a;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:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(a=this.provider)===null||a===void 0?void 0:a.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var a,i;let p=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(i=(a=this.provider)===null||a===void 0?void 0:a.getSearchUID())!==null&&i!==void 0?i:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(p)})}},tD=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let a=`context_${r}`;t[a]=o}}),t},de=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,a=Br(e,["caseContext","caseId","caseNumber"]),i=tD(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},a),!!i.context_Case_Subject&&{CaseSubject:i.context_Case_Subject}),t&&i)},Ml=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Oc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Kn:new cr(t)}disable(){this.coveoAnalyticsClient=new Kn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}logInterfaceLoad(t){if(t){let r=de(t);return this.logSearchEvent(O.interfaceLoad,r)}return this.logSearchEvent(O.interfaceLoad)}logRecentQueryClick(t){if(t){let r=de(t);return this.logSearchEvent(O.recentQueryClick,r)}return this.logSearchEvent(O.recentQueryClick)}logClearRecentQueries(t){if(t){let r=de(t);return this.logCustomEvent(O.clearRecentQueries,r)}return this.logCustomEvent(O.clearRecentQueries)}logInterfaceChange(t){let r=de(t);return this.logSearchEvent(O.interfaceChange,r)}logStaticFilterDeselect(t){let r=de(t);return this.logSearchEvent(O.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=de(t);return this.logCustomEvent(O.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=de(t);return this.logSearchEvent(O.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=de(t);return this.logSearchEvent(O.breadcrumbResetAll,r)}return this.logSearchEvent(O.breadcrumbResetAll)}logFacetSelect(t){let r=de(t);return this.logSearchEvent(O.facetSelect,r)}logFacetExclude(t){let r=de(t);return this.logSearchEvent(O.facetExclude,r)}logFacetDeselect(t){let r=de(t);return this.logSearchEvent(O.facetDeselect,r)}logFacetUpdateSort(t){let r=de(t);return this.logSearchEvent(O.facetUpdateSort,r)}logFacetClearAll(t){let r=de(t);return this.logSearchEvent(O.facetClearAll,r)}logFacetShowMore(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowMore,r)}logFacetShowLess(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowLess,r)}logQueryError(t){let r=de(t,!1);return this.logCustomEvent(O.queryError,r)}logPagerNumber(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNumber,r)}logPagerNext(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNext,r)}logPagerPrevious(t){let r=de(t,!1);return this.logCustomEvent(O.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanAutomatic,r)}return this.logSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanClick,r)}return this.logSearchEvent(O.didyoumeanClick)}logResultsSort(t){let r=de(t);return this.logSearchEvent(O.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=de(t);return this.logSearchEvent(O.searchboxSubmit,r)}return this.logSearchEvent(O.searchboxSubmit)}logContextChanged(t){let r=de(t);return this.logSearchEvent(kt.contextChanged,r)}logExpandToFullUI(t){let r=de(t);return this.logCustomEvent(kt.expandToFullUI,r)}logOpenUserActions(t){let r=de(t,!1);return this.logCustomEvent(kt.openUserActions,r)}logShowPrecedingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(kt.clickViewedDocument,Object.assign(Object.assign({},de(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(kt.clickPageView,Object.assign(Object.assign({},de(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(kt.createArticle,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(O.documentOpen,t,r,n?de(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(O.copyToClipboard,t,r,n?de(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(O.caseSendEmail,t,r,n?de(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(O.feedItemTextPost,t,r,n?de(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(O.documentQuickview,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(O.caseAttach,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&de(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(O.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(O.likeSmartSnippet,t?de(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(O.dislikeSmartSnippet,t?de(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(O.expandSmartSnippet,t?de(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(O.collapseSmartSnippet,t?de(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.openSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.closeSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(O.sendSmartSnippetReason,n?Object.assign(Object.assign({},de(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSource,t,r,n?de(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(O.likeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(O.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(O.openGeneratedAnswerSource,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(O.generatedAnswerSourceHover,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(O.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(O.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(O.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(O.generatedAnswerExpand,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(O.generatedAnswerCollapse,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(O.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(O.retryGeneratedAnswer,t?Object.assign({},de(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(O.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(O.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logCustomEvent(t,r){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:sy[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}logShowMoreFoldedResults(t,r,n){return U(this,void 0,void 0,function*(){return this.logClickEvent(O.showMoreFoldedResults,t,r,n?de(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(O.showLessFoldedResults,t?de(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(O.triggerNotify,r?Object.assign(Object.assign({},de(r,!1)),t):t)}getBaseCustomEventRequest(t){return U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign({},this.getOrigins()),{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 cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var ui=()=>"default";var rD=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Xn=class{constructor(t){le(this,"getState",t);le(this,"state");this.state=t()}getLanguage(){return rD(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let p=`context_${a}`;o[p]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Wn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ui()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var Fb=e=>new cr(e).getCurrentVisitorId(),li=(e,t)=>typeof t=="function"?(...r)=>{let n=tc(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,di=(e,t)=>(...r)=>{let n=tc(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var _c=class extends Xn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Tb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new _c(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??mt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,A=new ql({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:li(e,n),beforeSendHooks:[di(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function jl(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function nD(e,t){return!!t&&t.facetId in e.facetSet}var Tn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),Pb=(e,t)=>e.facetSet[t]?.request,dy=(e,t)=>{let r=Tn(e,t);return nD(e,r)?r:void 0};var kb=(e,t)=>dy(e,t)?.values.filter(r=>r.state!=="idle")||[],Gr=e=>e.search.isLoading;d();c();l();u();function Ob(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function $r(e){let{activeValue:t,ancestryMap:r}=oD(e);return t?aD(t,r):[]}function oD(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 o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function aD(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function iD(e,t){return!!t&&t.facetId in e.categoryFacetSet}var py=(e,t)=>{let r=Tn(e,t);if(iD(e,r))return r},fy=(e,t)=>e.categoryFacetSet[t]?.request,_b=(e,t)=>{let r=py(e,t);return $r(r?.values??[])},my=(e,t)=>{let r=fy(e,t);return $r(r?.currentValues??[])};d();c();l();u();function pi(){return{}}d();c();l();u();function Nb(e,t){return{request:e,tabs:t}}function fi(){return{}}d();c();l();u();function Db(e,t){return{request:e,tabs:t}}function mi(){return{}}d();c();l();u();function qb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function gi(){return{}}var zo=(e,t)=>{let r=Lb(t,e),n=r?r.field:"",o=gy(n,e);return{facetId:e,facetField:n,facetTitle:o}};function hi(e,t){let{facetId:r,facetValue:n}=e,o=zo(r,t),a=Ub(t,r);return{...o,facetValue:a==="hierarchical"?Vb(t,r):n}}function Xt(e){return{facetSet:e.facetSet??gi(),categoryFacetSet:e.categoryFacetSet??pi(),dateFacetSet:e.dateFacetSet??fi(),numericFacetSet:e.numericFacetSet??mi(),automaticFacetSet:e.automaticFacetSet??jl()}}var Vl=e=>{let t=[];return uD(e).forEach((r,n)=>{let o=Ub(e,r.facetId),a=mD(r,n+1);if(cD(r)){if(!!!my(e,r.facetId).length)return;t.push({...a,...pD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=Mb(i,p+1,o),m=sD(r)?jb(i):dD(i);t.push({...a,...f,...m})})}),lD(e).forEach((r,n)=>{let o=fD(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=Mb(a,i+1,"specific"),f=jb(a);t.push({...o,...p,...f})})}),t},sD=e=>e.type==="specific",cD=e=>e.type==="hierarchical",uD=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),lD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Mb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),dD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),jb=e=>({displayValue:e.value,value:e.value}),Vb=(e,t)=>my(e,t).map(n=>n.value).join(";"),pD=(e,t)=>{let n=Vb(e,t);return{value:n,valuePosition:1,displayValue:n}},fD=(e,t)=>({title:gy(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),mD=(e,t)=>({title:gy(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),gy=(e,t)=>`${e}_${t}`,Lb=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Ub=(e,t)=>{let r=Lb(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var hy=e=>e.configuration.search.locale,Qb=e=>e.configuration.search.timezone,Bb=e=>e.configuration.accessToken,Gb=e=>e.configuration.organizationId,$b=e=>e.configuration.environment,Ll=e=>e.configuration?.knowledge?.agentId,Hb=e=>e.configuration.knowledge.debugAgentSession;var Ce=e=>{if(gD(e)||yy(e))return e.generatedAnswer?.answerId;if(hD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},gD=e=>"answer"in e&&"generatedAnswer"in e&&!J(e.generatedAnswer?.answerConfigurationId),yy=e=>{let t=Ll(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},hD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Sy=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Zn=e=>e.followUpAnswers?.conversationId,yD=e=>e.generatedAnswer?.citations,SD=e=>e.followUpAnswers?.followUpAnswers,vD=ct(SD,e=>e?.flatMap(t=>t.citations)),AD=(e,t)=>t,Pr=ct(yD,vD,AD,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ut=()=>({q:"",enableQuerySyntax:!1});var Nc=class extends Xn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||Ct().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Vl(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ce(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||Ct().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||Ct().response.results.length}},zb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new Nc(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??mt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,A=new Ml({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:li(e,n),beforeSendHooks:[di(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A};d();c();l();u();d();c();l();u();d();c();l();u();var Ul=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Ul||{}),Ql=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Ql||{}),Hr=e=>{if(Ha(e))return e.map(t=>Hr(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""}},Bl=()=>({by:"relevancy"}),Wb=e=>({by:"date",order:e});var Yb=new Y({values:{by:new ec({enum:Ql,required:!0}),order:new ec({enum:Ul}),field:new $}});function ur(){return Hr(Bl())}d();c();l();u();d();c();l();u();d();c();l();u();var yi=class e{static set(t,r,n){let o,a,i;n&&(a=new Date,a.setTime(a.getTime()+n));let p=window.location.hostname,f=/^(\d{1,3}\.){3}\d{1,3}$/,m=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;f.test(p)||m.test(p)||p.indexOf(".")===-1?vy(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],vy(t,r,a,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function vy(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}d();c();l();u();function CD(){return typeof navigator<"u"}function Kb(){try{return typeof localStorage<"u"}catch{return!1}}function Xb(){try{return typeof sessionStorage<"u"}catch{return!1}}function Zb(){return!!(CD()&&navigator.cookieEnabled)}var Jb=null;function ex(){return Jb||(Kb()?localStorage:Zb()?new Ay:Xb()?sessionStorage:new Cy)}var Si=class Si{getItem(t){return yi.get(`${Si.prefix}${t}`)}removeItem(t){yi.erase(`${Si.prefix}${t}`)}setItem(t,r,n){yi.set(`${Si.prefix}${t}`,r,n)}};le(Si,"prefix","coveo_");var Ay=Si;var Cy=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Gl="__coveo.analytics.history",bD=20,xD=1e3*60,wD=75,Wo=class Wo{constructor(t){le(this,"store");this.store=t||ex()}static getInstance(t){return Wo.instance||(Wo.instance=new Wo(t)),Wo.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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!==null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Gl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(Gl);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Gl,JSON.stringify(t.slice(0,bD)))}catch{}}clear(){try{this.store.removeItem(Gl)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,wD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>xD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};le(Wo,"instance",null);var by=Wo,Vt=by;var Dc=class Dc extends Xn{constructor(){super(...arguments);le(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 Vl(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Dc.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||Ct().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Dc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ce(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetValue:n,facetTitle:`${a}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,criteria:n,facetTitle:`${a}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${a}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ur()}}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 a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:a,categoryFacetPath:n,categoryFacetTitle:`${a}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:a.length>0?a:"",querySuggestResponseId:f}}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||ut().q}get responseTime(){return this.state.search?.duration||Ct().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Ct().response.totalCountFiltered}};le(Dc,"fallbackPipelineName","default");var Jn=Dc,tx=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??mt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,A=new Ol({token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:li(e,n),beforeSendHooks:[di(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A},xy=()=>{let t=Vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function $l(e){let t=rx(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return sA([e,...t,...r],o=>o.uniqueId)}function rx(e){return e.childResults?e.childResults.flatMap(t=>[t,...rx(t)]):[]}d();c();l();u();var vi=()=>"";function ox(e,t){return{...new Jn(t).getBaseMetadata(),actionCause:e,type:e}}function RD(e){return Object.assign(e,{instantlyCallable:!0})}function ID(e,t){let r=a=>{let i=me(e,a);return RD(Object.assign(i,{type:i.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(a,{getState:i,extra:p}){let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A})).log({state:i(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m}){let{description:g,log:A}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(x,{getState:h,extra:y}){return yield A({state:h(),extra:y})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var wy=(e,t,r)=>{function n(...o){let a=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return TD(a)}return n},ED=e=>e.configuration.analytics.analyticsMode==="legacy",FD=e=>e.configuration.analytics.analyticsMode==="next",TD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),ID(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A}){let x=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:F}){for(let E of x)yield E(F)});return function log(_x25){return _ref14.apply(this,arguments)}}()},y=p(),b=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:A,provider:r(p)}),w=yield t(b,p());h.description=w?.description,x.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(F){ED(F)&&(yield PD(w,r,F,g,b.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:I}=Fc(y);return x.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(F){if(FD(F)&&o&&n){let E=n(F);yield MD(I,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function PD(_x28,_x29,_x30,_x31,_x32){return _PD.apply(this,arguments)}function _PD(){_PD=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let a=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")});return _PD.apply(this,arguments)}var ax=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(a){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),Fe=wy(e=>tx({...e,provider:e.provider||new Jn(e.getState)}),e=>e,Jn),a9=wy(Tb,ax("caseAssist"),_c),te=e=>wy(zb,ax(e),Nc),Xe=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=ux(e,o),n<0&&(n=qD(e,o)),n<0&&(n=0),kD(e,r(n),t)};var qc=(e,t)=>({sourceName:sx(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||vi()}),ix=(e,t)=>({sourceName:sx(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||vi()});function sx(e){let t=e.source;return J(t)?"unknown":t}var Mc=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function kD(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:ND(e),...(nx(e)?{documentCategory:nx(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:DD(e),queryPipeline:r.pipeline||vi()}}function nx(e){return e.raw?.objecttype||void 0}var Ze=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||""}),cx={urihash:new $,sourcetype:new $,permanentid:new $},Hl={uniqueId:H,raw:new Y({values:cx}),title:H,uri:H,clickUri:H,rankingModifier:new $({required:!1,emptyAllowed:!0})};function OD(e){return Object.assign({},...Object.keys(cx).map(t=>({[t]:e[t]})))}function _D(e){return Object.assign({},...Object.keys(Hl).map(t=>({[t]:e[t]})),{raw:OD(e.raw)})}function ND(e){let t=e.raw.author;return J(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function DD(e){let t=e.raw.source;return J(t)?"unknown":t}var Ot=e=>new Oe(Hl).validate(_D(e));function qD(e,t){for(let[r,n]of t.entries()){let o=$l(n);if(ux(e,o)!==-1)return r}return-1}function ux(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function MD(_x34,_x35,_x36){return _MD.apply(this,arguments)}function _MD(){_MD=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _MD.apply(this,arguments)}var kr=(e,t)=>{let r=Ze(e),n=Xe(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Ry=e=>_(e,{evt:H,type:We}),lx=e=>Fe("analytics/generic/search",t=>{Ry(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),dx=e=>Fe("analytics/generic/click",(t,r)=>(Ot(e.result),Ry(e),t.makeClickEvent(e.evt,Xe(e.result,r),Ze(e.result),e.meta))),px=e=>Fe("analytics/generic/custom",t=>(Ry(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var fx=()=>({actionCause:"interfaceLoad"}),Ai=()=>({actionCause:"interfaceChange"});d();c();l();u();var Iy=()=>We,mx=()=>H,Ci=P("configuration/updateBasicConfiguration",e=>_(e,{accessToken:We,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:We})),bi=P("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:We,timezone:We,locale:We,authenticationProviders:new oe({required:!1,each:H})})),jD={enabled:new pe({default:!0}),originContext:Iy(),originLevel2:Iy(),originLevel3:Iy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new He,anonymous:new pe({default:!1}),deviceId:We,userDisplayName:We,documentLocation:We,trackingId:JA,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:sb.reduce((e,t)=>(e[t]=ZA,e),{})})},zl=P("configuration/updateAnalyticsConfiguration",e=>_(e,jD)),Wl=P("configuration/analytics/disable"),Yl=P("configuration/analytics/enable"),gx=P("configuration/analytics/originlevel2",e=>_(e,{originLevel2:mx()})),hx=P("configuration/analytics/originlevel3",e=>_(e,{originLevel3:mx()})),yx=P("knowledge/setAgentId",e=>_(e,new $({required:!0})));d();c();l();u();var Kl=P("insightConfiguration/set",e=>_(e,{insightId:H}));d();c();l();u();d();c();l();u();var Sx=()=>({insightId:""});var Xl=fe(Sx(),e=>{e.addCase(Kl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var vx=()=>({caseContext:{},caseId:"",caseNumber:""}),ee=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});d();c();l();u();var Pn=e=>{if(e==="yes")return!0;if(e==="no")return!1},VD=()=>Fe("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function LD(e,t){return Fe({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ce(n),a=Pr(n,e);if(!o||!a)return null;let i=Zn(n);return r.makeGeneratedAnswerCitationClick(qc(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:Mc(a),...(i&&{conversationId:i})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Pr(r,e);return{answerId:t??Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function UD(e,t,r){return Fe({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??Ce(o),i=Pr(o,e);if(!a||!i)return null;let p=Zn(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Pr(n,e);return{answerId:r??Ce(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function QD(e,t){return Fe({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function BD(e){return Fe({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"like"})})}function GD(e){return Fe({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"dislike"})})}var $D=e=>Fe({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Pn(o),documented:Pn(a),correctTopic:Pn(p),hallucinationFree:Pn(i)},additionalNotes:m,correctAnswerUrl:f}}}),Ey=(e,t,r)=>Fe({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ce(o);if(!a)return null;let i=Zn(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e??!1})}),xi=e=>Fe({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),HD=()=>Fe({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),zD=()=>Fe({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),WD=()=>Fe({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),YD=()=>Fe({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})});function KD(e){return Fe({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"copyToClipboard"})})}function XD(e,t){return Fe({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Pr(n,e);if(!o)return null;let a=Zn(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...ix(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var Ax=()=>({actionCause:"retryGeneratedAnswer"}),Zl={logCopyGeneratedAnswer:KD,logGeneratedAnswerHideAnswers:zD,logGeneratedAnswerShowAnswers:HD,logGeneratedAnswerStreamEnd:Ey,logGeneratedAnswerFeedback:$D,logDislikeGeneratedAnswer:GD,logLikeGeneratedAnswer:BD,logGeneratedAnswerOpenInlineLink:QD,logHoverCitation:UD,logOpenGeneratedAnswerSource:LD,logOpenGeneratedAnswerFollowUpSource:XD,logRetryGeneratedAnswer:VD,logGeneratedAnswerExpand:WD,logGeneratedAnswerCollapse:YD};var ZD=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(ee(t.insightCaseContext))),Fy=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ce(r),o=Pr(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(qc(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:Mc(o)},ee(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=Pr(t,e);return{answerId:Ce(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),JD=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ce(n),a=Pr(n,e);return!o||!a?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t},ee(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=Pr(r,e);return{answerId:Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),eq=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"like"})}),tq=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"dislike"})}),rq=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},ee(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Pn(o),documented:Pn(a),correctTopic:Pn(p),hallucinationFree:Pn(i)},additionalNotes:m,correctAnswerUrl:f}}}),nq=(e,t,r)=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ce(o);return a?n.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r},ee(o.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e})});var oq=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),aq=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),iq=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),sq=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})}),cq=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"copyToClipboard"})}),wi={logCopyGeneratedAnswer:cq,logGeneratedAnswerHideAnswers:aq,logGeneratedAnswerShowAnswers:oq,logGeneratedAnswerStreamEnd:nq,logGeneratedAnswerFeedback:rq,logDislikeGeneratedAnswer:tq,logLikeGeneratedAnswer:eq,logHoverCitation:JD,logOpenGeneratedAnswerSource:Fy,logRetryGeneratedAnswer:ZD,logGeneratedAnswerExpand:iq,logGeneratedAnswerCollapse:sq};d();c();l();u();d();c();l();u();var Jl=P("searchHub/set",e=>_(e,new $({required:!0,emptyAllowed:!0})));var zr=me("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let a=t(),i=yield o.getInterface(uq(a));return ze(i)?n(i.error):(r(Jl(i.success.searchHub)),{response:i.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),uq=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var Cx=()=>({loading:!1,config:void 0});var eo=fe(Cx(),e=>{e.addCase(zr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(zr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(zr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function bx(e){return e.type==="dateRange"}function xx(e){return`start${e}`}function wx(e){return`end${e}`}var Ty=()=>({dateFacetValueMap:{}});function lq(e,t,r){let n=e.start,o=e.end;return $n(n)&&(n=ac(n),r.dateFacetValueMap[t][xx(n)]=e.start),$n(o)&&(o=ac(o),r.dateFacetValueMap[t][wx(o)]=e.end),{...e,start:n,end:o}}function Py(e,t){if(bx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>lq(o,r,t))}}return e}function Wr(e){let t=Ty();return{request:{...e,facets:e.facets?.map(n=>Py(n,t))},mappings:t}}function dq(e,t,r){return{...e,start:r.dateFacetValueMap[t][xx(e.start)]||e.start,end:r.dateFacetValueMap[t][wx(e.end)]||e.end}}function pq(e,t){return e.facetId in t.dateFacetValueMap}function fq(e,t){return pq(e,t)?{...e,values:e.values.map(r=>dq(r,e.facetId,t))}:e}function Or(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>fq(n,t))}}:e}d();c();l();u();d();c();l();u();var to=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Fb(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}),...(xy()&&{pageId:xy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ai(e)})}}});return function to(_x39,_x40){return _ref19.apply(this,arguments)}}();var Rx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:mt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield to(t.configuration.analytics)))})}});return function Rx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var ed=P("didYouMean/enable"),Ix=P("didYouMean/disable"),td=P("didYouMean/automaticCorrections/disable"),Ex=P("didYouMean/automaticCorrections/enable"),Zt=P("didYouMean/correction",e=>_(e,H)),jc=P("didYouMean/automaticCorrections/mode",e=>_(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var mq=P("history/undo"),gq=P("history/redo"),bt=P("history/snapshot"),D5=me("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(mq()),yield t(tt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),q5=me("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(gq()),yield t(tt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),tt=me("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var kn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function rd(){return{contextValues:{}}}d();c();l();u();var nd=()=>!1;d();c();l();u();function Fx(){return{contextValues:{}}}d();c();l();u();function ky(){return{enabled:!0,tabs:{}}}function od(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Tx(){return[]}d();c();l();u();function Yr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function ad(){return{}}d();c();l();u();function Px(){return{}}d();c();l();u();function id(){return{}}function xt(e){return{context:e.context||rd(),dictionaryFieldContext:e.dictionaryFieldContext||Fx(),facetSet:e.facetSet||gi(),numericFacetSet:e.numericFacetSet||mi(),dateFacetSet:e.dateFacetSet||fi(),categoryFacetSet:e.categoryFacetSet||pi(),automaticFacetSet:e.automaticFacetSet??jl(),pagination:e.pagination||Yr(),query:e.query||ut(),tabSet:e.tabSet||id(),advancedSearchQueries:e.advancedSearchQueries||kn(),staticFilterSet:e.staticFilterSet||Px(),querySet:e.querySet||ad(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||vi(),searchHub:e.searchHub||ui(),facetOptions:e.facetOptions||od(),facetOrder:e.facetOrder??Tx(),debug:e.debug??nd()}}d();c();l();u();var Wt=P("query/updateQuery",e=>_(e,{q:new $,enableQuerySyntax:new pe}));d();c();l();u();var Oy=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(ee(t.insightCaseContext))),Ri=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...ee(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),kx=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),sd=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(ee(t.insightCaseContext))),ro=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...ee(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Kr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var Ox=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=yq(e),n=hq(e);return Wr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Gn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield to(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{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.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Ox(_x49,_x50){return _ref24.apply(this,arguments)}}(),Sr=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield Ox(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Sr(_x51,_x52){return _ref25.apply(this,arguments)}}(),_x=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield Ox(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function _x(_x53,_x54){return _ref26.apply(this,arguments)}}(),cd=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function cd(_x55,_x56){return _ref27.apply(this,arguments)}}(),ud=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,numberOfResults:0},r});return function ud(_x57,_x58){return _ref28.apply(this,arguments)}}();function hq(e){return Kr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function yq(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Yo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=Or(yield _this9.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this9.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(Ri(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!a)return!J(f)&&!J(f.correctedQuery)?_this1.processNextDidYouMeanAutoCorrection(t):null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(bt(xt(_this1.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this10.automaticallyRetryQueryWithCorrection(o);return ze(a.response)?(_this10.dispatch(Ri(a.response.error)),_this10.rejectWithValue(a.response.error)):(_this10.dispatch(bt(xt(_this10.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Sr(r));return _this11.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var Nx=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(ee(t.insightCaseContext))),_y=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(ee(t.insightCaseContext)));var Ko=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=Or(yield _this12.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this12.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(Ri(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:a,automaticallyCorrectQuery:i}=n.didYouMean,{results:p,queryCorrections:f,queryCorrection:m}=o;if(!a||!i)return null;let g=p.length===0&&f&&f.length!==0,A=!J(m)&&!J(m.correctedQuery);if(!g&&!A)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(bt(xt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this15.automaticallyRetryQueryWithCorrection(o);return ze(a.response)?(_this15.dispatch(Ri(a.response.error)),_this15.rejectWithValue(a.response.error)):(_this15.dispatch(bt(xt(_this15.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:_y()})})()}processNextDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:_y()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Wt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Sr(r));return _this16.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...Ct(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Or(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function Ny(_x63,_x64,_x65){return _Ny.apply(this,arguments)}function _Ny(){_Ny=_asyncToGenerator(function*(e,t,r){Vc(e);let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Ny.apply(this,arguments)}function Dy(_x66,_x67,_x68){return _Dy.apply(this,arguments)}function _Dy(){_Dy=_asyncToGenerator(function*(e,t,r){Vc(e);let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Dy.apply(this,arguments)}function qy(_x69,_x70){return _qy.apply(this,arguments)}function _qy(){_qy=_asyncToGenerator(function*(e,t){let r=new Ko({...t,analyticsAction:Oy}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield Oy().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield cd(e,i),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _qy.apply(this,arguments)}function My(_x71,_x72,_x73){return _My.apply(this,arguments)}function _My(){_My=_asyncToGenerator(function*(e,t,r){let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield ud(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _My.apply(this,arguments)}var Dx=me("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ny(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),qx=me("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dy(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),Mx=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield qy(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),jx=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield My(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var Vx=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let a=Date.now(),i=Or(yield e.query(r,o),n),p=Date.now()-a,f=t.query?.q||"";return{response:i,duration:p,queryExecuted:f,requestExecuted:r}});return function Vx(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),xe=me("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ny(r,t,e.legacy);Vc(r);let n=new Yo({...t}),o=e.next?jy(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),ld=me("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dy(r,t,e.legacy);Vc(r);let n=new Yo({...t}),o=e.next?jy(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),dd=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return qy(r,t);let n=new Yo({...t}),o=jy({actionCause:"browseResults"}),a=yield cd(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),Ii=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return My(r,t,e.legacy);let n=new Yo({...t}),o=yield ud(r),a=yield n.fetchFromAPI(o);return yield n.process(a)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),pd=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:H});let a=e.id,i=yield Rx(a,t()),p=yield n.querySuggest(i);return ze(p)?r(p.error):{id:a,q:i.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),Vc=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},jy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Jt=P("breadcrumb/deselectAll"),fd=P("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Ei=P("facet/updateFacetAutoSelection",e=>_(e,{allow:new pe({required:!0})}));d();c();l();u();d();c();l();u();var md=class extends Jn{constructor(r){super(r);le(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??ut().q}get responseTime(){return this.activeInstantResultCache?.duration??Ct().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Ct().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Lx=()=>Fe("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new md(e)),Ux=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Vy={id:H},Sq={...Vy,q:Ke},qee=P("instantResults/register",e=>_(e,Vy)),gd=P("instantResults/updateQuery",e=>_(e,Sq)),Mee=P("instantResults/clearExpired",e=>_(e,Vy));d();c();l();u();var hd=new ne({required:!0,min:0}),yd=P("pagination/registerNumberOfResults",e=>_(e,hd)),Sd=P("pagination/updateNumberOfResults",e=>_(e,hd)),vd=P("pagination/registerPage",e=>_(e,hd)),no=P("pagination/updatePage",e=>_(e,hd)),Ad=P("pagination/nextPage"),Cd=P("pagination/previousPage");d();c();l();u();d();c();l();u();var Xo=(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:ai(e)}});var Fi=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(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&&Xo(e.configuration.analytics,t,r)),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var oo=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(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:Vt.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 to(e.configuration.analytics,t))),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function oo(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var Ly=()=>Fe("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),ao=e=>Fe("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||kn().aq,cq:r.advancedSearchQueries?.cq||kn().cq,dq:r.advancedSearchQueries?.dq||kn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var Uy=()=>Fe("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),Qx=()=>({actionCause:"didYouMeanClick"}),Bx=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var jte=new Y({values:{undoneQuery:Ke},options:{required:!0}}),Gx=()=>Fe("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var Ti=P("trigger/query/ignore",e=>_(e,new $({emptyAllowed:!0,required:!0}))),Pi=P("trigger/query/modification",e=>_(e,new Y({values:{originalQuery:We,modification:We}})));d();c();l();u();d();c();l();u();function Lc(e,t){let r={};e.forEach(a=>{r[a.facetId]=a});let n=[];t.forEach(a=>{a in r&&(n.push(r[a]),delete r[a])});let o=Object.values(r);return[...n,...o]}function $x(e){return Kr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Qy={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function vq(e){return Kr(e).map(t=>{let r=Qy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Aq(e){return[...vq(e.facetSet??{}),...$x(e.numericFacetSet??{}),...$x(e.dateFacetSet??{}),...Kr(e.categoryFacetSet??{})]}function Cq(e){return Aq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function bd(e){return Lc(Cq(e),e.facetOrder??[])}var io=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=wq(e),n=bd(e),o=bq(e),a=yield oo(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Wr({...a,...(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:i(),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 io(_x98,_x99){return _ref40.apply(this,arguments)}}();function bq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(xq).filter(r=>r.currentValues.length>0):void 0}function xq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function wq(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Rq(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function Rq(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o})}var so=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Or(yield _this17.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this17.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(ao(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(bt(xt(_this19.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this20.automaticallyRetryQueryWithCorrection(o);return ze(a.response)?(_this20.dispatch(ao(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(bt(xt(_this20.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Uy()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Uy()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(Ti("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return ze(i.response)?(_this21.dispatch(ao(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(bt(xt(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:Gx()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...Ct(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield io(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Zt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Pi({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield io(_this23.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 Gre=me("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield xd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),$re=me("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Gy(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),Hre=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield $y(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),zre=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Tq(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),Wre=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return By(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),Iq=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield io(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function Iq(_x112,_x113){return _ref46.apply(this,arguments)}}(),Eq=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield oo(e);return Wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Eq(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),Fq=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield io(e,t);return r.request.numberOfResults=0,r});return function Fq(_x117,_x118){return _ref48.apply(this,arguments)}}(),Hx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function By(_x119,_x120){return _By.apply(this,arguments)}function _By(){_By=_asyncToGenerator(function*(e,t){_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new so({...t,analyticsAction:Lx()},m=>{t.dispatch(gd({q:m,id:e.id}))}),i=yield Eq(o,r,n),p=yield a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=yield a.process(p);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return _By.apply(this,arguments)}function Gy(_x121,_x122,_x123){return _Gy.apply(this,arguments)}function _Gy(){_Gy=_asyncToGenerator(function*(e,t,r){Hx(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new so({...t,analyticsAction:r}),f=yield io(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _Gy.apply(this,arguments)}function $y(_x124,_x125){return _$y.apply(this,arguments)}function _$y(){_$y=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Ly().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new so({...e,analyticsAction:Ly()}),p=yield Iq(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _$y.apply(this,arguments)}function Tq(_x126,_x127,_x128){return _Tq.apply(this,arguments)}function _Tq(){_Tq=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new so({...e,analyticsAction:t}),f=yield Fq(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _Tq.apply(this,arguments)}function xd(_x129,_x130,_x131){return _xd.apply(this,arguments)}function _xd(){_xd=_asyncToGenerator(function*(e,t,r){Hx(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield io(e,i),f=new so({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _xd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var zx=ct(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o}));var vr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=zy(e),o=Pq(e),a=kq(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield oo(e,r):Fi(e,t,r);return Wr({...i,...(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}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Hy(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:a}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function vr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function Hy(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function Pq(e){return Lc(_q(e),e.facetOrder??[])}function kq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(Oq).filter(r=>r.currentValues.length>0):void 0}function Oq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function _q(e){return Nq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Nq(e){return[...Dq(e.facetSet??{}),...Wx(e.numericFacetSet??{}),...Wx(e.dateFacetSet??{}),...Kr(e.categoryFacetSet??{})]}function Dq(e){return Kr(e).map(t=>{let r=Qy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Wx(e){return Kr(e).map(t=>{let r=t.currentValues,n=r.some(({state:a})=>a!=="idle"),o=r.some(a=>a.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function zy(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=zx(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var co=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Or(yield _this24.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this24.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(ao(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!a)return!J(f)&&!J(f.correctedQuery)?_this26.processModernDidYouMeanAutoCorrection(t):null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(bt(xt(_this26.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this27.automaticallyRetryQueryWithCorrection(o);return ze(a.response)?(_this27.dispatch(ao(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(bt(xt(_this27.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(Ti("")),null;let a=_this28.getCurrentQuery(),i=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return ze(i.response)?(_this28.dispatch(ao(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(bt(xt(_this28.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Bx(),o=yield _this29.fetchFromAPI(yield vr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Zt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(Pi({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield vr(_this30.getState(),_this30.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 ki=me("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new $,enableQuerySyntax:new pe,clearFilters:new pe}),e.clearFilters&&(r(Jt()),r(fd())),r(Ei({allow:!0})),r(Wt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(no(1))}),Yx=P("search/updateSearchAction"),_e=me("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return xd(r,t,e.legacy);Kx(r);let n=e.next?Xx(e.next):void 0,o=yield vr(r,t.extra.navigatorContext,n),a=new co({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Zr=me("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Kx(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Gy(r,t,e.legacy);let n=new co({...t,analyticsAction:e.next}),o=yield vr(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),uo=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return $y(t,r);let n=ox("browseResults",t.getState),o=new co({...t,analyticsAction:n}),a=yield qq(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),Oi=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return xd(r,t,e.legacy);let n=new co({...t,analyticsAction:{}}),o=yield jq(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),Zne=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return By(e,t);_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,a=Xx(Ux()),i=yield Mq(r,t.extra.navigatorContext,n,o,a),p=new co({...t,analyticsAction:a},g=>{t.dispatch(gd({q:g,id:e.id}))}),f=yield p.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=yield p.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),qq=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function qq(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),Mq=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let a=Fi(e,t,o);return Wr({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function Mq(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),jq=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request.numberOfResults=0,n});return function jq(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Kx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Xx=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Zx(_x158,_x159){return _Zx.apply(this,arguments)}function _Zx(){_Zx=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Zx.apply(this,arguments)}var Uc=me("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield Zx(o,e),i=yield t.apiClient.html(a);return ze(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),wd=P("resultPreview/next"),Rd=P("resultPreview/previous"),ew=P("resultPreview/prepare",e=>_(e,{results:new oe({required:!0})})),Jx=2048,Id=me("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=BA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Jx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Jx} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Wy(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Yy=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Wy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Ky=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),_i=fe(Wy(),e=>{e.addCase(Uc.pending,t=>{t.isLoading=!0}).addCase(Uc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(_e.fulfilled,(t,r)=>{Yy(t),t.resultsWithPreview=Ky(r.payload.response.results)}).addCase(uo.fulfilled,(t,r)=>{Yy(t),t.resultsWithPreview=t.resultsWithPreview.concat(Ky(r.payload.response.results))}).addCase(Zr.fulfilled,Yy).addCase(ew,(t,r)=>{t.resultsWithPreview=Ky(r.payload.results)}).addCase(wd,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Rd,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Id.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var lo=(e,t)=>{let r=e;return J(r[t])?J(e.raw[t])?null:e.raw[t]:r[t]},Vq=e=>t=>e.every(r=>!J(lo(t,r))),Lq=e=>t=>e.every(r=>J(lo(t,r))),Uq=(e,t)=>r=>{let n=tw(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},Qq=(e,t)=>r=>{let n=tw(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},tw=(e,t)=>{let r=lo(t,e);return ju(r)?r:[r]},rw={getResultProperty:lo,fieldsMustBeDefined:Vq,fieldsMustNotBeDefined:Lq,fieldMustMatch:Uq,fieldMustNotMatch:Qq};function Ed(e){return e.search.response.searchUid!==""}function nw(e,t,r){return e.search.results.find(n=>lo(n,t)===r)}var Xy=ct(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Ni=P("app/setError");function Zy(e,t){let r=t.payload??null;r&&(e.response=Ct().response,e.results=[],e.questionAnswer=Xa()),e.error=r,e.isLoading=!1}function Jy(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function Bq(e,t){Jy(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function ow(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function Gq(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Ee=fe(Ct(),e=>{e.addCase(_e.rejected,(t,r)=>Zy(t,r)),e.addCase(uo.rejected,(t,r)=>Zy(t,r)),e.addCase(Zr.rejected,(t,r)=>Zy(t,r)),e.addCase(_e.fulfilled,(t,r)=>{Bq(t,r)}),e.addCase(uo.fulfilled,(t,r)=>{Jy(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Zr.fulfilled,(t,r)=>{Jy(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Oi.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(_e.pending,ow),e.addCase(uo.pending,Gq),e.addCase(Zr.pending,ow),e.addCase(Yx,(t,r)=>{t.searchAction=r.payload}),e.addCase(Ni,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Fd=fe(ui(),e=>{e.addCase(Jl,(t,r)=>r.payload).addCase(tt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(bi,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var aw=class extends Error{constructor(t){super(t[0].message);le(this,"issues");this.name="SchemaError",this.issues=t}};var _n="uninitialized",tS="pending",Bc="fulfilled",Gc="rejected";function iw(e){return{status:e,isUninitialized:e===_n,isLoading:e===tS,isSuccess:e===Bc,isError:e===Gc}}var sw=Ur;function Cw(e,t){if(e===t||!(sw(e)&&sw(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,a=Array.isArray(t)?[]:{};for(let i of r)a[i]=Cw(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function rS(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function $q(e){return new RegExp("(^|:)//").test(e)}function Hq(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function iS(e){return e!=null}function cw(e){return[...(e?.values()??[])].filter(iS)}function zq(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Wq=e=>e.replace(/\/$/,""),Yq=e=>e.replace(/^\//,"");function Kq(e,t){if(!e)return t;if(!t)return e;if($q(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Wq(e),t=Yq(t),`${e}${r}${t}`}function kd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var nS=()=>new Map,Xq=e=>{let t=new s.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},Zq=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},uw=(...e)=>v(...e),Jq=e=>e.status>=200&&e.status<=299,eM=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function lw(e){if(!Ur(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var tM=e=>typeof e=="object"&&(Ur(e)||Array.isArray(e)||typeof e.toJSON=="function");function bw({baseUrl:e,prepareHeaders:t=A=>A,fetchFn:r=uw,paramsSerializer:n,isJsonContentType:o=eM,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===uw&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(x,h,y){let{getState:b,extra:w,endpoint:I,forced:F,type:E}=h,k,{url:T,headers:q=new C(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:V=m??Jq,timeout:B=p,...L}=typeof x=="string"?{url:x}:x,N={...g,signal:B?Zq(h.signal,Xq(B)):h.signal,...L};q=new C(lw(q)),N.headers=(yield t(q,{getState:b,arg:x,extra:w,endpoint:I,forced:F,type:E,extraOptions:y}))||q;let D=tM(N.body);if(N.body!=null&&!D&&typeof N.body!="string"&&N.headers.delete("content-type"),!N.headers.has("content-type")&&D&&N.headers.set("content-type",a),D&&o(N.headers)&&(N.body=JSON.stringify(N.body,i)),N.headers.has("accept")||(Q==="json"?N.headers.set("accept","application/json"):Q==="text"&&N.headers.set("accept","text/plain, text/html, */*")),G){let ce=~T.indexOf("?")?"&":"?",ve=n?n(G):new URLSearchParams(lw(G));T+=ce+ve}T=Kq(e,T);let M=new Request(T,N);k={request:new Request(T,N)};let z;try{z=yield r(M)}catch(ce){return{error:{status:(ce instanceof Error||typeof DOMException<"u"&&ce instanceof DOMException)&&ce.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:k}}let re=z.clone();k.response=re;let Z,K="";try{let ce;if(yield Promise.all([A(z,Q).then(ve=>Z=ve,ve=>ce=ve),re.text().then(ve=>K=ve,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:z.status,data:K,error:String(ce)},meta:k}}return V(z,Z)?{data:Z,meta:k}:{error:{status:z.status,data:Z},meta:k}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function A(_x167,_x168){return _A2.apply(this,arguments)}function _A2(){_A2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let y=yield x.text();return y.length?JSON.parse(y):null}return x.text()});return _A2.apply(this,arguments)}}var Di=class{constructor(e,t=void 0){le(this,"value");le(this,"meta");this.value=e,this.meta=t}};function rM(){return _rM.apply(this,arguments)}function _rM(){_rM=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((a,i)=>{let p=setTimeout(()=>a(),o);if(r){let f=()=>{clearTimeout(p),i(new Error("Aborted"))};r.aborted?(clearTimeout(p),i(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})});return _rM.apply(this,arguments)}function xw(e,t){throw Object.assign(new Di({error:e,meta:t}),{throwImmediately:!0})}function eS(e){e.aborted&&xw({status:"CUSTOM_ERROR",error:"Aborted"})}var dw={},nM=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let a=[5,(t||dw).maxRetries,(o||dw).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:rM,retryCondition:(g,A,{attempt:x})=>x<=i,...t,...o},m=0;for(;;){eS(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Di(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Di)return g.value;throw g}if(g instanceof Di){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};eS(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(A){throw eS(n.signal),A}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),ww=Object.assign(nM,{fail:xw}),_d="__rtkq/",oM="online",aM="offline";var Rw="focused";var sS=P(`${_d}${Rw}`),Iw=P(`${_d}un${Rw}`),cS=P(`${_d}${oM}`),Ew=P(`${_d}${aM}`);var zc="query",Fw="mutation",Tw="infinitequery";function Nd(e){return e.type===zc}function iM(e){return e.type===Fw}function Dd(e){return e.type===Tw}function Od(e){return Nd(e)||Dd(e)}function uS(e,t,r,n,o,a){let i=sM(e)?e(t,r,n,o):e;return i?rS(i,iS,p=>a(Pw(p))):[]}function sM(e){return typeof e=="function"}function Pw(e){return typeof e=="string"?{type:e}:e}function cM(e,t){return e.catch(t)}var qi=(e,t)=>e.endpointDefinitions[t],$c=Symbol("forceQueryFn"),oS=e=>typeof e[$c]=="function";function uM({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=T=>i(T)?.runningQueries,f=T=>i(T)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:A}=o.internalActions;return{buildInitiateQuery:F,buildInitiateInfiniteQuery:E,buildInitiateMutation:k,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function x(T,q){return G=>{let Q=qi(a,T),V=e({queryArgs:q,endpointDefinition:Q,endpointName:T});return p(G)?.get(V)}}function h(T,q){return G=>f(G)?.get(q)}function y(){return T=>cw(p(T))}function b(){return T=>cw(f(T))}function w(T){}function I(T,q){let G=(Q,{subscribe:V=!0,forceRefetch:B,subscriptionOptions:L,[$c]:N,...D}={})=>(M,W)=>{let z=e({queryArgs:Q,endpointDefinition:q,endpointName:T}),re,Z={...D,type:zc,subscribe:V,forceRefetch:B,subscriptionOptions:L,endpointName:T,originalArgs:Q,queryCacheKey:z,[$c]:N};if(Nd(q))re=t(Z);else{let{direction:Ie,initialPageParam:De,refetchCachedPages:Pe}=D;re=r({...Z,direction:Ie,initialPageParam:De,refetchCachedPages:Pe})}let K=o.endpoints[T].select(Q),ce=M(re),ve=K(W());let{requestId:Le,abort:nt}=ce,$e=ve.requestId!==Le,Je=p(M)?.get(z),et=()=>K(W()),Te=Object.assign(N?ce.then(et):$e&&!Je?Promise.resolve(ve):Promise.all([Je,ce]).then(et),{arg:Q,requestId:Le,subscriptionOptions:L,queryCacheKey:z,abort:nt,unwrap(){return _asyncToGenerator(function*(){let Ie=yield Te;if(Ie.isError)throw Ie.error;return Ie.data})()},refetch:Ie=>M(G(Q,{subscribe:!1,forceRefetch:!0,...Ie})),unsubscribe(){V&&M(m({queryCacheKey:z,requestId:Le}))},updateSubscriptionOptions(Ie){Te.subscriptionOptions=Ie,M(A({endpointName:T,requestId:Le,queryCacheKey:z,options:Ie}))}});if(!Je&&!$e&&!N){let Ie=p(M);Ie.set(z,Te),Te.then(()=>{Ie.delete(z)})}return Te};return G}function F(T,q){return I(T,q)}function E(T,q){return I(T,q)}function k(T){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(V,B)=>{let L=n({type:"mutation",endpointName:T,originalArgs:q,track:G,fixedCacheKey:Q}),N=V(L);let{requestId:D,abort:M,unwrap:W}=N,z=cM(N.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),re=()=>{V(g({requestId:D,fixedCacheKey:Q}))},Z=Object.assign(z,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(V);return K.set(D,Z),Z.then(()=>{K.delete(D)}),Q&&(K.set(Q,Z),Z.then(()=>{K.get(Q)===Z&&K.delete(Q)})),Z}}}var kw=class extends aw{constructor(t,r,n,o){super(t);le(this,"value");le(this,"schemaName");le(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Zo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Jo(_x172,_x173,_x174,_x175){return _Jo.apply(this,arguments)}function _Jo(){_Jo=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new kw(o.issues,t,r,n);return o.value});return _Jo.apply(this,arguments)}function pw(e){return e}var Qc=(e={})=>({...e,[wc]:!0});function lM({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,N,D,M)=>(W,z)=>{let re=r[L],Z=n({queryArgs:N,endpointDefinition:re,endpointName:L});if(W(o.internalActions.queryResultPatched({queryCacheKey:Z,patches:D})),!M)return;let K=o.endpoints[L].select(N)(z()),ce=uS(re.providesTags,K.data,void 0,N,{},a);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function A(L,N,D=0){let M=[N,...L];return D&&M.length>D?M.slice(0,-1):M}function x(L,N,D=0){let M=[...L,N];return D&&M.length>D?M.slice(1):M}let h=(L,N,D,M=!0)=>(W,z)=>{let Z=o.endpoints[L].select(N)(z()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(Z.status===_n)return K;let ce;if("data"in Z)if(Mt(Z.data)){let[ve,Le,nt]=_h(Z.data,D);K.patches.push(...Le),K.inversePatches.push(...nt),ce=ve}else ce=D(Z.data),K.patches.push({op:"replace",path:[],value:ce}),K.inversePatches.push({op:"replace",path:[],value:Z.data});return K.patches.length===0||W(o.util.patchQueryData(L,N,K.patches,M)),K},y=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[$c]:()=>({data:D})})),b=(L,N)=>L.query&&L[N]?L[N]:pw,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:z,getState:re,extra:Z}){let K=r[L.endpointName],{metaSchema:ce,skipSchemaValidation:ve=m}=K,Le=L.type===zc;try{let nt=pw,$e={signal:N,abort:D,dispatch:z,getState:re,extra:Z,endpoint:L.endpointName,type:L.type,forced:Le?I(L,re()):void 0,queryCacheKey:Le?L.queryCacheKey:void 0},Je=Le?L[$c]:void 0,et,Te=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(De,Pe,gt,At){if(Pe==null&&De.pages.length)return Promise.resolve({data:De});let Ir={queryArg:L.originalArgs,pageParam:Pe},ir=yield Ie(Ir),Vr=At?A:x;return{data:{pages:Vr(De.pages,ir.data,gt),pageParams:Vr(De.pageParams,Pe,gt)},meta:ir.meta}});return function Te(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Ie(_x182){return _Ie.apply(this,arguments)}function _Ie(){_Ie=_asyncToGenerator(function*(De){let Pe,{extraOptions:gt,argSchema:At,rawResponseSchema:Ir,responseSchema:ir}=K;if(At&&!Zo(ve,"arg")&&(De=yield Jo(At,De,"argSchema",{})),Je?Pe=Je():K.query?(nt=b(K,"transformResponse"),Pe=yield t(K.query(De),$e,gt)):Pe=yield K.queryFn(De,$e,gt,Er=>t(Er,$e,gt)),typeof process<"u",Pe.error)throw new Di(Pe.error,Pe.meta);let{data:Vr}=Pe;Ir&&!Zo(ve,"rawResponse")&&(Vr=yield Jo(Ir,Pe.data,"rawResponseSchema",Pe.meta));let fr=yield nt(Vr,Pe.meta,De);return ir&&!Zo(ve,"response")&&(fr=yield Jo(ir,fr,"responseSchema",Pe.meta)),{...Pe,data:fr}});return _Ie.apply(this,arguments)}if(Le&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:De}=K,{maxPages:Pe=1/0}=De,gt=L.refetchCachedPages??De.refetchCachedPages??!0,At,Ir={pages:[],pageParams:[]},ir=i.selectQueryEntry(re(),L.queryCacheKey)?.data,fr=I(L,re())&&!L.direction||!ir?Ir:ir;if("direction"in L&&L.direction&&fr.pages.length){let Er=L.direction==="backward",ku=(Er?Ow:aS)(De,fr,L.originalArgs);At=yield Te(fr,ku,Pe,Er)}else{let{initialPageParam:Er=De.initialPageParam}=L,Ws=ir?.pageParams??[],ku=Ws[0]??Er,Ek=Ws.length;if(At=yield Te(fr,ku,Pe),Je&&(At={data:At.data.pages[0]}),gt)for(let Bv=1;Bv<Ek;Bv++){let Fk=aS(De,At.data,L.originalArgs);At=yield Te(At.data,Fk,Pe)}}et=At}else et=yield Ie(L.originalArgs);return ce&&!Zo(ve,"meta")&&et.meta&&(et.meta=yield Jo(ce,et.meta,"metaSchema",et.meta)),W(et.data,Qc({fulfilledTimeStamp:Date.now(),baseQueryMeta:et.meta}))}catch(nt){let $e=nt;if($e instanceof Di){let Je=b(K,"transformErrorResponse"),{rawErrorResponseSchema:et,errorResponseSchema:Te}=K,{value:Ie,meta:De}=$e;try{et&&!Zo(ve,"rawErrorResponse")&&(Ie=yield Jo(et,Ie,"rawErrorResponseSchema",De)),ce&&!Zo(ve,"meta")&&(De=yield Jo(ce,De,"metaSchema",De));let Pe=yield Je(Ie,De,L.originalArgs);return Te&&!Zo(ve,"errorResponse")&&(Pe=yield Jo(Te,Pe,"errorResponseSchema",De)),M(Pe,Qc({baseQueryMeta:De}))}catch(Pe){$e=Pe}}try{if($e instanceof kw){let Je={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Le?L.queryCacheKey:void 0};K.onSchemaFailure?.($e,Je),p?.($e,Je);let{catchSchemaFailure:et=f}=K;if(et)return M(et($e,Je),Qc({baseQueryMeta:$e._bqMeta}))}}catch(Je){$e=Je}throw typeof process<"u",console.error($e),$e}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function I(L,N){let D=i.selectQueryEntry(N,L.queryCacheKey),M=i.selectConfig(N).refetchOnMountOrArgChange,W=D?.fulfilledTimeStamp,z=L.forceRefetch??(L.subscribe&&M);return z?z===!0||(Number(new Date)-Number(W))/1e3>=z:!1}let F=()=>me(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return Qc({startedTimeStamp:Date.now(),...(Dd(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=i.selectQueryEntry(M,N.queryCacheKey),z=W?.fulfilledTimeStamp,re=N.originalArgs,Z=W?.originalArgs,K=r[N.endpointName],ce=N.direction;return oS(N)?!0:W?.status==="pending"?!1:I(N,M)||Nd(K)&&K?.forceRefetch?.({currentArg:re,previousArg:Z,endpointState:W,state:M})?!0:!(z&&!ce)},dispatchConditionRejection:!0}),E=F(),k=F(),T=me(`${e}/executeMutation`,w,{getPendingMeta(){return Qc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let z=q(D)&&D.force,re=G(D)&&D.ifOlderThan,Z=(ce=!0)=>{let ve={forceRefetch:ce,subscribe:!1};return o.endpoints[L].initiate(N,ve)},K=o.endpoints[L].select(N)(W());if(z)M(Z());else if(re){let ce=K?.fulfilledTimeStamp;if(!ce){M(Z());return}(Number(new Date)-Number(new Date(ce)))/1e3>=re&&M(Z())}else M(Z(!1))};function V(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:ni(vl(L),V(N)),matchFulfilled:ni(Fn(L),V(N)),matchRejected:ni(Go(L),V(N))}}return{queryThunk:E,mutationThunk:T,infiniteQueryThunk:k,prefetch:Q,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:B}}function aS(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Ow(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function _w(e,t,r,n){return uS(r[e.meta.arg.endpointName][t],Fn(e)?e.payload:void 0,Ic(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function fw(e){return Ht(e)?pl(e):e}function Td(e,t,r){let n=e[t];n&&r(n)}function Hc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function mw(e,t,r){let n=e[Hc(t)];n&&r(n)}var Pd={};function dM({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=P(`${e}/resetApiState`);function A(V,B,L,N){var D;V[D=B.queryCacheKey]??(V[D]={status:_n,endpointName:B.endpointName}),Td(V,B.queryCacheKey,M=>{M.status=tS,M.requestId=L&&M.requestId?M.requestId:N.requestId,B.originalArgs!==void 0&&(M.originalArgs=B.originalArgs),M.startedTimeStamp=N.startedTimeStamp;let W=o[N.arg.endpointName];Dd(W)&&"direction"in B&&(M.direction=B.direction)})}function x(V,B,L,N){Td(V,B.arg.queryCacheKey,D=>{if(D.requestId!==B.requestId&&!N)return;let{merge:M}=o[B.arg.endpointName];if(D.status=Bc,M){if(D.data!==void 0){let{fulfilledTimeStamp:W,arg:z,baseQueryMeta:re,requestId:Z}=B,K=Qo(D.data,ce=>M(ce,L,{arg:z.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:Z}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?Cw(Ht(D.data)?dC(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=$o({name:`${e}/queries`,initialState:Pd,reducers:{removeQueryResult:{reducer(V,{payload:{queryCacheKey:B}}){delete V[B]},prepare:oi()},cacheEntriesUpserted:{reducer(V,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;A(V,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),x(V,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:V=>({payload:V.map(N=>{let{endpointName:D,arg:M,value:W}=N,z=o[D];return{queryDescription:{type:zc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:z,endpointName:D})},value:W}}),meta:{[wc]:!0,requestId:Ec(),timestamp:Date.now()}})},queryResultPatched:{reducer(V,{payload:{queryCacheKey:B,patches:L}}){Td(V,B,N=>{N.data=Nh(N.data,L.concat())})},prepare:oi()}},extraReducers(V){V.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=oS(N);A(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=oS(L.arg);x(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{Td(B,N.queryCacheKey,z=>{if(!L){if(z.requestId!==D)return;z.status=Gc,z.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===Bc||M?.status===Gc)&&(B[D]=M)})}}),y=$o({name:`${e}/mutations`,initialState:Pd,reducers:{removeMutationResult:{reducer(V,{payload:B}){let L=Hc(B);L in V&&delete V[L]},prepare:oi()}},extraReducers(V){V.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[Hc(L)]={requestId:N,status:tS,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&mw(B,N,D=>{D.requestId===N.requestId&&(D.status=Bc,D.data=L,D.fulfilledTimeStamp=N.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:N,meta:D})=>{D.arg.track&&mw(B,D,M=>{M.requestId===D.requestId&&(M.status=Gc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===Bc||M?.status===Gc)&&D!==M?.requestId&&(B[D]=M)})}}),b={tags:{},keys:{}},w=$o({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(V,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){I(V,M);for(let{type:z,id:re}of W){let Z=(N=(L=V.tags)[z]??(L[z]={}))[D=re||"__internal_without_id"]??(N[D]=[]);Z.includes(M)||Z.push(M)}V.keys[M]=W}},prepare:oi()}},extraReducers(V){V.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(p,(B,L)=>{var D,M,W;let{provided:N}=i(L);for(let[z,re]of Object.entries(N.tags??{}))for(let[Z,K]of Object.entries(re)){let ce=(M=(D=B.tags)[z]??(D[z]={}))[W=Z||"__internal_without_id"]??(M[W]=[]);for(let ve of K)ce.includes(ve)||ce.push(ve),B.keys[ve]=N.keys[ve]}}).addMatcher(Qr(Fn(t),Ic(t)),(B,L)=>{F(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let N=L.payload.map(({queryDescription:D,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:D}}));F(B,N)})}});function I(V,B){let L=fw(V.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=V.tags[D]?.[M];W&&(V.tags[D][M]=fw(W).filter(z=>z!==B))}delete V.keys[B]}function F(V,B){let L=B.map(N=>{let D=_w(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(V,w.actions.updateProvidedBy(L))}let E=$o({name:`${e}/subscriptions`,initialState:Pd,reducers:{updateSubscriptionOptions(V,B){},unsubscribeQueryResult(V,B){},internal_getRTKQSubscriptions(){}}}),k=$o({name:`${e}/internalSubscriptions`,initialState:Pd,reducers:{subscriptionsUpdated:{reducer(V,B){return Nh(V,B.payload)},prepare:oi()}}}),T=$o({name:`${e}/config`,initialState:{online:zq(),focused:Hq(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(V,{payload:B}){V.middlewareRegistered=V.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:V=>{V.addCase(cS,B=>{B.online=!0}).addCase(Ew,B=>{B.online=!1}).addCase(sS,B=>{B.focused=!0}).addCase(Iw,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Ja({queries:h.reducer,mutations:y.reducer,provided:w.reducer,subscriptions:k.reducer,config:T.reducer}),G=(V,B)=>q(g.match(B)?void 0:V,B),Q={...T.actions,...h.actions,...E.actions,...k.actions,...y.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var ea=Symbol.for("RTKQ/skipToken"),Nw={status:_n},gw=Qo(Nw,()=>{}),hw=Qo(Nw,()=>{});function pM({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>gw,o=E=>hw;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(E){return{...E,...iw(E.status)}}function i(E){return E[t]}function p(E){return i(E)?.queries}function f(E,k){return p(E)?.[k]}function m(E){return i(E)?.mutations}function g(E){return i(E)?.config}function A(E,k,T){return q=>{if(q===ea)return r(n,T);let G=e({queryArgs:q,endpointDefinition:k,endpointName:E});return r(V=>f(V,G)??gw,T)}}function x(E,k){return A(E,k,a)}function h(E,k){let{infiniteQueryOptions:T}=k;function q(G){let Q={...G,...iw(G.status)},{isLoading:V,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:I(T,Q.data,Q.originalArgs),hasPreviousPage:F(T,Q.data,Q.originalArgs),isFetchingNextPage:V&&N,isFetchingPreviousPage:V&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return A(E,k,q)}function y(){return E=>{let k;return typeof E=="object"?k=Hc(E)??ea:k=E,r(k===ea?o:G=>i(G)?.mutations?.[k]??hw,a)}}function b(E,k){let T=E[t],q=new Set,G=rS(k,iS,Pw);for(let Q of G){let V=T.provided.tags[Q.type];if(!V)continue;let B=(Q.id!==void 0?V[Q.id]:Object.values(V).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let V=T.queries[Q];return V?{queryCacheKey:Q,endpointName:V.endpointName,originalArgs:V.originalArgs}:[]})}function w(E,k){return rS(Object.values(p(E)),T=>T?.endpointName===k&&T.status!==_n,T=>T.originalArgs)}function I(E,k,T){return k?aS(E,k,T)!=null:!1}function F(E,k,T){return!k||!E.getPreviousPageParam?!1:Ow(E,k,T)!=null}}var yw=WeakMap?new WeakMap:void 0,Sw=({endpointName:e,queryArgs:t})=>{let r="",n=yw?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(a,i)=>(i=typeof i=="bigint"?{$bigint:i.toString()}:i,i=Ur(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));Ur(t)&&yw?.set(t,o),r=o}return`${e}(${r})`};function fM(...e){return function(r){let n=bc(m=>r.extractRehydrationInfo?.(m,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(m){let g=Sw;if("serializeQueryArgs"in m.endpointDefinition){let A=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=A(x);return typeof h=="string"?h:Sw({...x,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(m){m()},apiUid:Ec(),extractRehydrationInfo:n,hasRehydrationInfo:bc(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let A of m)o.tagTypes.includes(A)||o.tagTypes.push(A);if(g)for(let[A,x]of Object.entries(g))typeof x=="function"?x(qi(a,A)):Object.assign(qi(a,A)||{},x);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:A=>({...A,type:zc}),mutation:A=>({...A,type:Fw}),infiniteQuery:A=>({...A,type:Tw})});for(let[A,x]of Object.entries(g)){if(m.overrideExisting!==!0&&A in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(zt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[A]=x;for(let h of p)h.injectEndpoint(A,x)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function On(e,...t){return Object.assign(e,...t)}var mM=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(b,w)=>{if(p.match(w)){let{queryCacheKey:F,requestId:E,options:k}=w.payload,T=b.get(F);return T?.has(E)&&T.set(E,k),!0}if(f.match(w)){let{queryCacheKey:F,requestId:E}=w.payload,k=b.get(F);return k&&k.delete(E),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:F,requestId:E}}=w,k=kd(b,F.queryCacheKey,nS);return F.subscribe&&k.set(E,F.subscriptionOptions??k.get(E)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:F,arg:E,requestId:k}}=w;if(F&&E.subscribe){let T=kd(b,E.queryCacheKey,nS);T.set(k,E.subscriptionOptions??T.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(b,w)=>{if(a||(a=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=m(r.currentSubscriptions,b),F=!0;if(I){i||(i=setTimeout(()=>{let T=y(r.currentSubscriptions),[,q]=_h(a,()=>T);w.next(e.internalActions.subscriptionsUpdated(q)),a=T,i=null},500));let E=typeof b.type=="string"&&!!b.type.startsWith(o),k=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;F=!E&&!k}return[F,!1]}},gM=2147483647/1e3-1,hM=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:p,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:A}=t.internalActions,x=Qr(g.match,r.fulfilled,r.rejected,A.match);function h(E){let k=o.currentSubscriptions.get(E);return k?k.size>0:!1}let y={};function b(E){for(let k of E.values())k?.abort?.()}let w=(E,k)=>{let T=k.getState(),q=i(T);if(x(E)){let G;if(A.match(E))G=E.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(E)?E.payload:E.meta.arg;G=[Q]}I(G,k,q)}if(t.util.resetApiState.match(E)){for(let[G,Q]of Object.entries(y))Q&&clearTimeout(Q),delete y[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(E)){let{queries:G}=n.extractRehydrationInfo(E);I(Object.keys(G),k,q)}};function I(E,k,T){let q=k.getState();for(let G of E){let Q=a(q,G);Q?.endpointName&&F(G,Q.endpointName,k,T)}}function F(E,k,T,q){let Q=qi(n,k)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let V=Math.max(0,Math.min(Q,gM));if(!h(E)){let B=y[E];B&&clearTimeout(B),y[E]=setTimeout(()=>{if(!h(E)){let L=a(T.getState(),E);L?.endpointName&&T.dispatch(p(L.endpointName,L.originalArgs))?.abort(),T.dispatch(m({queryCacheKey:E}))}delete y[E]},V*1e3)}}return w},vw=new Error("Promise never resolved before cacheEntryRemoved."),yM=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=Al(n),m=Al(o),g=Fn(n,o),A={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(T,q,G){let Q=A[T];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(T){let q=A[T];q&&(delete A[T],q.cacheEntryRemoved())}function I(T){let{arg:q,requestId:G}=T.meta,{endpointName:Q,originalArgs:V}=q;return[Q,V,G]}let F=(T,q,G)=>{let Q=E(T);function V(B,L,N,D){let M=i(G,L),W=i(q.getState(),L);!M&&W&&k(B,D,L,q,N)}if(n.pending.match(T)){let[B,L,N]=I(T);V(B,Q,N,L)}else if(y.match(T))for(let{queryDescription:B,value:L}of T.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;V(N,M,T.meta.requestId,D),b(M,L,{})}else if(o.pending.match(T)){if(q.getState()[t].mutations[Q]){let[L,N,D]=I(T);k(L,N,Q,q,D)}}else if(g(T))b(Q,T.payload,T.meta.baseQueryMeta);else if(x.match(T)||h.match(T))w(Q);else if(e.util.resetApiState.match(T))for(let B of Object.keys(A))w(B)};function E(T){return f(T)?T.meta.arg.queryCacheKey:m(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:x.match(T)?T.payload.queryCacheKey:h.match(T)?Hc(T.payload):""}function k(T,q,G,Q,V){let B=qi(r,T),L=B?.onCacheEntryAdded;if(!L)return;let N={},D=new Promise(K=>{N.cacheEntryRemoved=K}),M=Promise.race([new Promise(K=>{N.valueResolved=K}),D.then(()=>{throw vw})]);M.catch(()=>{}),A[G]=N;let W=e.endpoints[T].select(Od(B)?q:G),z=Q.dispatch((K,ce,ve)=>ve),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:V,extra:z,updateCachedData:Od(B)?K=>Q.dispatch(e.util.updateQueryData(T,q,K)):void 0,cacheDataLoaded:M,cacheEntryRemoved:D},Z=L(q,re);Promise.resolve(Z).catch(K=>{if(K!==vw)throw K})}return F},SM=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},vM=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:p,internalState:f})=>{let{removeQueryResult:m}=a.internalActions,g=Qr(Fn(n),Ic(n)),A=Qr(Fn(o,n),Go(o,n)),x=[],h=0,y=(I,F)=>{(o.pending.match(I)||n.pending.match(I))&&h++,A(I)&&(h=Math.max(0,h-1)),g(I)?w(_w(I,"invalidatesTags",r,i),F):A(I)?w([],F):a.util.invalidateTags.match(I)&&w(uS(I.payload,void 0,void 0,void 0,void 0,i),F)};function b(){return h>0}function w(I,F){let E=F.getState(),k=E[e];if(x.push(...I),k.config.invalidationBehavior==="delayed"&&b())return;let T=x;if(x=[],T.length===0)return;let q=a.util.selectInvalidatedBy(E,T);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let V=k.queries[Q],B=kd(f.currentSubscriptions,Q,nS);V&&(B.size===0?F.dispatch(m({queryCacheKey:Q})):V.status!==_n&&F.dispatch(p(V)))}})}return y},AM=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,f=null,m=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&A(w.meta.arg,I),r.util.resetApiState.match(w)&&(y(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,I){p.add(w),f||(f=setTimeout(()=>{for(let F of p)x({queryCacheKey:F},I);p.clear(),f=null},0))}function A({queryCacheKey:w},I){let F=I.getState()[e],E=F.queries[w],k=i.get(w);if(!E||E.status===_n)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:q}=b(k);if(!Number.isFinite(T))return;let G=a.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+T;a.set(w,{nextPollTimestamp:Q,pollingInterval:T,timeout:setTimeout(()=>{(F.config.focused||!q)&&I.dispatch(n(E)),A({queryCacheKey:w},I)},T)})}function x({queryCacheKey:w},I){let E=I.getState()[e].queries[w],k=i.get(w);if(!E||E.status===_n)return;let{lowestPollingInterval:T}=b(k);if(!Number.isFinite(T)){h(w);return}let q=a.get(w),G=Date.now()+T;(!q||G<q.nextPollTimestamp)&&A({queryCacheKey:w},I)}function h(w){let I=a.get(w);I?.timeout&&clearTimeout(I.timeout),a.delete(w)}function y(){for(let w of a.keys())h(w)}function b(w=new Map){let I=!1,F=Number.POSITIVE_INFINITY;for(let E of w.values())E.pollingInterval&&(F=Math.min(E.pollingInterval,F),I=E.skipPollingIfUnfocused||I);return{lowestPollingInterval:F,skipPollingIfUnfocused:I}}return m},CM=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=vl(r,n),a=Go(r,n),i=Fn(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:A,arg:{endpointName:x,originalArgs:h}}=m.meta,y=qi(t,x),b=y?.onQueryStarted;if(b){let w={},I=new Promise((T,q)=>{w.resolve=T,w.reject=q});I.catch(()=>{}),p[A]=w;let F=e.endpoints[x].select(Od(y)?h:A),E=g.dispatch((T,q,G)=>G),k={...g,getCacheEntry:()=>F(g.getState()),requestId:A,extra:E,updateCachedData:Od(y)?T=>g.dispatch(e.util.updateQueryData(x,h,T)):void 0,queryFulfilled:I};b(h,k)}}else if(i(m)){let{requestId:A,baseQueryMeta:x}=m.meta;p[A]?.resolve({data:m.payload,meta:x}),delete p[A]}else if(a(m)){let{requestId:A,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[A]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[A]}}},bM=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{sS.match(f)&&p(m,"refetchOnFocus"),cS.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],A=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let y=A[h],b=x.get(h);if(!b||!y)continue;let w=[...b.values()];(w.some(F=>F[m]===!0)||w.every(F=>F[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(a({queryCacheKey:h})):y.status!==_n&&f.dispatch(n(y)))}})}return i};function xM(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:P(`${t}/invalidateTags`)},f=x=>x.type.startsWith(`${t}/`),m=[SM,hM,vM,AM,yM,CM];return{middleware:x=>{let h=!1,y=a(x.dispatch),b={...e,internalState:y,refetchQuery:A,isThisApiSliceAction:f,mwApi:x},w=m.map(E=>E(b)),I=mM(b),F=bM(b);return E=>k=>{if(!lc(k))return E(k);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(i)));let T={...x,next:E},q=x.getState(),[G,Q]=I(k,T,q),V;if(G?V=E(k):V=Q,x.getState()[t]&&(F(k,T,q),f(k)||o.hasRehydrationInfo(k)))for(let B of w)B(k,T,q);return V}},actions:p};function A(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Aw=Symbol(),wM=({createSelector:e=ct}={})=>({name:Aw,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:A,catchSchemaFailure:x,skipSchemaValidation:h},y){SC();let b=Te=>(typeof process<"u",Te);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:cS,onOffline:Ew,onFocus:sS,onFocusLost:Iw},util:{}});let w=pM({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:F,buildQuerySelector:E,buildInfiniteQuerySelector:k,buildMutationSelector:T}=w;On(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:F});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:V,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=lM({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:a,assertTagType:b,selectors:w,onSchemaFailure:A,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:M,actions:W}=dM({context:y,queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:a,reducerPath:o,assertTagType:b,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});On(t.util,{patchQueryData:V,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),On(t.internalActions,W);let z=new WeakMap,re=Te=>kd(z,Te,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:ve,getRunningMutationsThunk:Le,getRunningQueriesThunk:nt,getRunningQueryThunk:$e}=uM({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:a,context:y,getInternalState:re});On(t.util,{getRunningMutationThunk:ve,getRunningMutationsThunk:Le,getRunningQueryThunk:$e,getRunningQueriesThunk:nt});let{middleware:Je,actions:et}=xM({reducerPath:o,context:y,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:$e,getInternalState:re});return On(t.util,et),On(t,{reducer:M,middleware:Je}),{name:Aw,injectEndpoint(Te,Ie){var gt;let Pe=(gt=t.endpoints)[Te]??(gt[Te]={});Nd(Ie)&&On(Pe,{name:Te,select:E(Te,Ie),initiate:Z(Te,Ie)},D(q,Te)),iM(Ie)&&On(Pe,{name:Te,select:T(),initiate:ce(Te)},D(Q,Te)),Dd(Ie)&&On(Pe,{name:Te,select:k(Te,Ie),initiate:K(Te,Ie)},D(q,Te))}}}}),Dw=fM(wM());d();c();l();u();d();c();l();u();var ta=e=>e.query,qw=e=>e.query?.enableQuerySyntax;var Mw=ct(e=>ta(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),qd=ct(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var jw=ct(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});d();c();l();u();var lS=e=>e.context;d();c();l();u();var dS=e=>e.pipeline;d();c();l();u();var pS=e=>e.searchHub;d();c();l();u();var Lt=ct(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),xie=ct(e=>e,e=>{let t=Lt(e);return t&&e?e[t].expression:""});d();c();l();u();var Vw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var Lw=e=>e.excerptLength?.length;d();c();l();u();var Jr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,Uw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Qw=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var Bw=e=>e.sortCriteria;var Gw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Gn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Gw(_x183){return _ref64.apply(this,arguments)}}(),$w=(e,t)=>{let r=ta(e)?.q,{aq:n,cq:o,dq:a,lq:i}=Ww(e),p=lS(e),f=Xo(e.configuration.analytics,t,{actionCause:Xy(e)}),m=pS(e),g=dS(e),A=Sy(e)??[],x=zw(e),h=Lt(e.tabSet)||"default",y=hy(e),b=Qb(e),w=t.referrer||"",I=Uw(e),F=Bw(e),E=RM(e),k=Lw(e),T=Qw(e),q=Vw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:qw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:A}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(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:Hy(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(T??{}),...(k&&{excerptLength:k}),...(q&&{dictionaryFieldContext:q}),sortCriteria:F,...(I&&{facetOptions:I}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Hw=(e,t)=>{let r=ta(e)?.q,n=zw(e),o=Xo(e.configuration.analytics,t,{actionCause:Xy(e)}),a=hy(e),i=Lt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=Ww(e),g=pS(e),A=dS(e),x=lS(e),h=Sy(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(A?.length&&{pipeline:A}),...(x?.contextValues&&{context:x.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:i,referrer:p,...o,locale:a}},zw=e=>bd(e)?.map(t=>Py(t,Ty())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),RM=e=>({actionsHistory:e.configuration.analytics.enabled?Vt.getInstance().getHistory():[]}),Ww=e=>{let t=jw(e),r=zy(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Md=["searching","thinking","answering"];function jd(e){return e.toLowerCase()}var Vd=["search","generic"];function fS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var Yw=["text/plain","text/markdown"];var Mi=new $({required:!0}),Kw=new $,ji=new pe({required:!0}),mS={id:Mi,title:Mi,uri:Mi,permanentid:Mi,clickUri:Kw},Ld=new $({required:!0,constrainTo:Yw}),Xw=new $({required:!0,constrainTo:Md}),Zw=e=>({...e,name:jd(e.name)}),Vi=P("generatedAnswer/setIsVisible",e=>_(e,ji)),Li=P("generatedAnswer/setAnswerId",e=>_(e,H)),Ui=P("generatedAnswer/setAnswerGenerationMode",e=>_(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Qi=P("generatedAnswer/setIsEnabled",e=>_(e,ji)),na=P("generatedAnswer/updateMessage",e=>_(e,{textDelta:Mi})),oa=P("generatedAnswer/updateCitations",e=>_(e,{citations:new oe({required:!0,each:new Y({values:mS})})})),aa=P("generatedAnswer/updateError",e=>_(e,{message:Kw,code:new ne({min:0})})),lr=P("generatedAnswer/resetAnswer"),Ud=P("generatedAnswer/like"),Qd=P("generatedAnswer/dislike"),Bd=P("generatedAnswer/feedbackModal/open"),Wc=P("generatedAnswer/expand"),Gd=P("generatedAnswer/collapse"),$d=P("generatedAnswer/setId",e=>_(e,{id:new $({required:!0})})),Hd=P("generatedAnswer/feedbackModal/close"),Bi=P("generatedAnswer/sendFeedback"),en=P("generatedAnswer/setIsLoading",e=>_(e,ji)),ra=P("generatedAnswer/setIsStreaming",e=>_(e,ji)),ia=P("generatedAnswer/setAnswerContentFormat",e=>_(e,Ld)),zd=P("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new oe({each:Ld,default:["text/plain"]})})),Wd=P("knowledge/updateAnswerConfigurationId",e=>_(e,Mi)),Yd=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Zu)),Yc=P("generatedAnswer/setIsAnswerGenerated",e=>_(e,ji)),sa=P("generatedAnswer/setCannotAnswer",e=>_(e,ji)),gS=P("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new Y({}))),Kd=P("generatedAnswer/startStep",e=>_(Zw(e),{name:Xw,startedAt:new ne({min:0,required:!0})})),Xd=P("generatedAnswer/finishStep",e=>_(Zw(e),{name:Xw,finishedAt:new ne({min:0,required:!0})})),Zd=P("generatedAnswer/startToolCall",e=>_(e,{toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),Jd=P("generatedAnswer/finishToolCall",e=>_(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Gi=P("generatedAnswer/toolCallArgs",e=>_(e,{toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Vd})})),Jw=me("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:p}=a(),{queryExecuted:f}=p,{setAbortControllerRef:m}=e,g=yield Gw(r),A=(y,b)=>{switch(y){case"genqa.headerMessageType":{let w=JSON.parse(b);n(ia(w.contentFormat));break}case"genqa.messageType":n(na(JSON.parse(b)));break;case"genqa.citationsType":n(oa(JSON.parse(b)));break;case"genqa.endOfStreamType":{let w=JSON.parse(b).answerGenerated,{answerId:I,answer:F}=a().generatedAnswer,k=f.length!==0&&!w,T=!F?.trim();n(sa(k)),n(ra(!1)),n(Yc(w)),n((i??Zl).logGeneratedAnswerStreamEnd(w,I,w?T:void 0)),n(xi());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(en(!0));let x=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{x(g)&&(n(en(!1)),y.payload&&y.payloadType&&A(y.payloadType,y.payload))},abort:y=>{x(g)&&n(aa(y))},close:()=>{x(g)&&n(ra(!1))},resetAnswer:()=>{x(g)&&n(lr())}});h?m(h):n(en(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),ep=me("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(lr());let a=t();if(a.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(a.generatedAnswer.answerConfigurationId){let i=$w(a,n);r(gS(i)),yield r(tp(i))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var IM=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,p=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let m=Gn(n.configuration.search?.apiBaseUrl,i,a);return bw({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let A=g.url,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),v(A,x)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function IM(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),rp=Dw({reducerPath:"answer",baseQuery:ww(IM,{maxRetries:3}),endpoints:()=>({})});var EM=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},FM=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},TM=(e,t)=>{delete e.error,e.citations=t.citations},PM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},kM=(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})`)},OM=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&kM(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(EM(t,a),r(ia(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(FM(t,a),r(na({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(TM(t,a),r(oa({citations:a.citations})));break;case"genqa.endOfStreamType":{PM(t,a);let i=t.answerId,p=a.answerGenerated??!1,f=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,i,f)),r(xi());break}}},_M=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,a=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${a}/${r}/generate`},ca=rp.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,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){yield n;let{configuration:p,generatedAnswer:f,insightConfiguration:m}=r(),{generatedAnswerAnalyticsClient:g}=yield i,{organizationId:A,environment:x,accessToken:h}=p,y=Gn(p.search.apiBaseUrl,A,x),b=_M(y,A,f.answerConfigurationId,m?.insightId);yield Wu(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(w){let I=w.headers.get("x-answer-id");I&&o(F=>{F.answerId=I,a(Li(I))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:w=>{o(I=>{OM(w,I,a,g??Zl)})},onerror:w=>{throw w},onclose:()=>{o(w=>{a(sa(!w.generated))})}})}).apply(this,arguments)}})})}),tp=e=>ca.endpoints.getAnswer.initiate(e),hS=e=>{let t=qd(e);return ca.endpoints.getAnswer.select(t??ea)(e)};d();c();l();u();var eR=fe(Wn,e=>e);d();c();l();u();function NM(e){let t=e.payload?.analyticsAction;return tR(e)&&!J(t)}function tR(e){return"type"in e}var rR=e=>t=>r=>{let n;NM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return tR(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),o};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var np={q:new $,enableQuerySyntax:new pe,aq:new $,cq:new $,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new pe,sf:new Y,tab:new $,af:new Y};var ot=P("searchParameters/restore",e=>_(e,np)),op=P("searchParameters/restoreTab",e=>_(e,H));d();c();l();u();var ap=P("tab/register",e=>{let t=new Y({values:{id:H,expression:Ke}});return _(e,t)}),_t=P("tab/updateActiveTab",e=>_(e,H));d();c();l();u();var ip=Fr(Gu(),1),aR=Fr(nR(),1),iR=Fr(oR(),1);ip.default.extend(iR.default);ip.default.extend(aR.default);var sp=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:ip.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"});d();c();l();u();var DM=/(^|; )Coveo-Pendragon=([^;]*)/,qM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function sR(){return typeof window>"u"?!1:DM.exec(document.cookie)?.pop()||null}function cR(){return typeof window>"u"?!1:qM.test(document.cookie)}var cp=fe(sp(),e=>e.addCase(Ci,(t,r)=>{MM(t,r.payload)}).addCase(bi,(t,r)=>{jM(t,r.payload)}).addCase(zl,(t,r)=>{VM(t,r.payload)}).addCase(Wl,t=>{t.analytics.enabled=!1}).addCase(Yl,t=>{t.analytics.enabled=!0}).addCase(gx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(hx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(_t,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(op,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ot,(t,r)=>{J(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(yx,(t,{payload:r})=>{LM(t,r)}));function MM(e,t){J(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",J(t.organizationId)||(e.organizationId=t.organizationId)}function jM(e,t){J(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),J(t.locale)||(e.search.locale=t.locale),J(t.timezone)||(e.search.timezone=t.timezone),J(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function VM(e,t){J(t.enabled)||(e.analytics.enabled=t.enabled),J(t.originContext)||(e.analytics.originContext=t.originContext),J(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),J(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),J(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),J(t.trackingId)||(e.analytics.trackingId=t.trackingId),J(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),J(t.source)||(e.analytics.source=t.source);try{let r=sR();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}J(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),J(t.anonymous)||(e.analytics.anonymous=t.anonymous),J(t.deviceId)||(e.analytics.deviceId=t.deviceId),J(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),J(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function LM(e,t){e.knowledge.agentId=t;try{cR()&&(e.knowledge.debugAgentSession=!0)}catch{}}var we=cp;d();c();l();u();function UM(e){return e.instantlyCallable}var uR=()=>e=>t=>e(UM(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Nt=[];for(let e=0;e<256;++e)Nt.push((e+256).toString(16).slice(1));function lR(e,t=0){return(Nt[e[t+0]]+Nt[e[t+1]]+Nt[e[t+2]]+Nt[e[t+3]]+"-"+Nt[e[t+4]]+Nt[e[t+5]]+"-"+Nt[e[t+6]]+Nt[e[t+7]]+"-"+Nt[e[t+8]]+Nt[e[t+9]]+"-"+Nt[e[t+10]]+Nt[e[t+11]]+Nt[e[t+12]]+Nt[e[t+13]]+Nt[e[t+14]]+Nt[e[t+15]]).toLowerCase()}d();c();l();u();var CS,QM=new Uint8Array(16);function bS(){if(!CS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");CS=crypto.getRandomValues.bind(crypto)}return CS(QM)}d();c();l();u();d();c();l();u();var BM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xS={randomUUID:BM};function GM(e,t,r){if(xS.randomUUID&&!t&&!e)return xS.randomUUID();e=e||{};let n=e.random??e.rng?.()??bS();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 o=0;o<16;++o)t[r+o]=n[o];return t}return lR(n)}var po=GM;d();c();l();u();d();c();l();u();var R={};Ks(R,{BRAND:()=>hj,DIRTY:()=>ua,EMPTY_PATH:()=>WM,INVALID:()=>be,NEVER:()=>eV,OK:()=>Ut,ParseStatus:()=>Dt,Schema:()=>qe,ZodAny:()=>go,ZodArray:()=>Mn,ZodBigInt:()=>da,ZodBoolean:()=>pa,ZodBranded:()=>Xc,ZodCatch:()=>xa,ZodDate:()=>fa,ZodDefault:()=>ba,ZodDiscriminatedUnion:()=>dp,ZodEffects:()=>br,ZodEnum:()=>Aa,ZodError:()=>er,ZodFirstPartyTypeKind:()=>Re,ZodFunction:()=>fp,ZodIntersection:()=>ya,ZodIssueCode:()=>X,ZodLazy:()=>Sa,ZodLiteral:()=>va,ZodMap:()=>Ki,ZodNaN:()=>Zi,ZodNativeEnum:()=>Ca,ZodNever:()=>_r,ZodNull:()=>ga,ZodNullable:()=>nn,ZodNumber:()=>la,ZodObject:()=>tr,ZodOptional:()=>Ar,ZodParsedType:()=>ue,ZodPipeline:()=>Zc,ZodPromise:()=>ho,ZodReadonly:()=>wa,ZodRecord:()=>pp,ZodSchema:()=>qe,ZodSet:()=>Xi,ZodString:()=>mo,ZodSymbol:()=>Wi,ZodTransformer:()=>br,ZodTuple:()=>rn,ZodType:()=>qe,ZodUndefined:()=>ma,ZodUnion:()=>ha,ZodUnknown:()=>qn,ZodVoid:()=>Yi,addIssueToContext:()=>se,any:()=>Rj,array:()=>Tj,bigint:()=>Aj,boolean:()=>CR,coerce:()=>Jj,custom:()=>SR,date:()=>Cj,datetimeRegex:()=>hR,defaultErrorMap:()=>Nn,discriminatedUnion:()=>_j,effect:()=>$j,enum:()=>Qj,function:()=>Vj,getErrorMap:()=>$i,getParsedType:()=>tn,instanceof:()=>Sj,intersection:()=>Nj,isAborted:()=>up,isAsync:()=>Hi,isDirty:()=>lp,isValid:()=>fo,late:()=>yj,lazy:()=>Lj,literal:()=>Uj,makeIssue:()=>Kc,map:()=>Mj,nan:()=>vj,nativeEnum:()=>Bj,never:()=>Ej,null:()=>wj,nullable:()=>zj,number:()=>AR,object:()=>Pj,objectUtil:()=>wS,oboolean:()=>Zj,onumber:()=>Xj,optional:()=>Hj,ostring:()=>Kj,pipeline:()=>Yj,preprocess:()=>Wj,promise:()=>Gj,quotelessJson:()=>$M,record:()=>qj,set:()=>jj,setErrorMap:()=>zM,strictObject:()=>kj,string:()=>vR,symbol:()=>bj,transformer:()=>$j,tuple:()=>Dj,undefined:()=>xj,union:()=>Oj,unknown:()=>Ij,util:()=>Ve,void:()=>Fj});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ve;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let a={};for(let i of o)a[i]=i;return a},e.getValidEnumValues=o=>{let a=e.objectKeys(o).filter(p=>typeof o[o[p]]!="number"),i={};for(let p of a)i[p]=o[p];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(a){return o[a]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},e.find=(o,a)=>{for(let i of o)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(Ve||(Ve={}));var wS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(wS||(wS={}));var ue=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tn=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var X=Ve.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"]),$M=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),er=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(a){return a.message},n={_errors:[]},o=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let p=n,f=0;for(;f<i.path.length;){let m=i.path[f];f===i.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(r(i))):p[m]=p[m]||{_errors:[]},p=p[m],f++}}};return o(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,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];r[a]=r[a]||[],r[a].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=e=>new er(e);var HM=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.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}"`:Ve.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.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 X.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 X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ve.assertNever(e)}return{message:r}},Nn=HM;var dR=Nn;function zM(e){dR=e}function $i(){return dR}d();c();l();u();var Kc=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,a=[...r,...(o.path||[])],i={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let p="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)p=m(i,{data:t,defaultError:p}).message;return{...o,path:a,message:p}},WM=[];function se(e,t){let r=$i(),n=Kc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Nn?void 0:Nn].filter(o=>!!o)});e.common.issues.push(n)}var Dt=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 o of r){if(o.status==="aborted")return be;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let a=yield o.key,i=yield o.value;n.push({key:a,value:i})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return be;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}},be=Object.freeze({status:"aborted"}),ua=e=>({status:"dirty",value:e}),Ut=e=>({status:"valid",value:e}),up=e=>e.status==="aborted",lp=e=>e.status==="dirty",fo=e=>e.status==="valid",Hi=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));var Cr=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}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}},pR=(e,t)=>{if(fo(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 er(e.common.issues);return this._error=r,this._error}}};function ke(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(i,p)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??p.defaultError}:typeof p.data>"u"?{message:f??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:f??r??p.defaultError}},description:o}}var qe=class{get description(){return this._def.description}_getType(t){return tn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Dt,ctx:{common:t.parent.common,data:t.data,parsedType:tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Hi(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:tn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return pR(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:tn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return fo(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=>fo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:tn(t)},o=_this32._parse({data:t,path:n.path,parent:n}),a=yield Hi(o)?o:Promise.resolve(o);return pR(n,a)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,a)=>{let i=t(o),p=()=>a.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(p(),!1)):i?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new br({schema:this,typeName:Re.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 Ar.create(this,this._def)}nullable(){return nn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mn.create(this)}promise(){return ho.create(this,this._def)}or(t){return ha.create([this,t],this._def)}and(t){return ya.create(this,t,this._def)}transform(t){return new br({...ke(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ba({...ke(this._def),innerType:this,defaultValue:r,typeName:Re.ZodDefault})}brand(){return new Xc({typeName:Re.ZodBranded,type:this,...ke(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new xa({...ke(this._def),innerType:this,catchValue:r,typeName:Re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Zc.create(this,t)}readonly(){return wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},YM=/^c[^\s-]{8,}$/i,KM=/^[0-9a-z]+$/,XM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ZM=/^[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,JM=/^[a-z0-9_-]{21}$/i,ej=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tj=/^[-+]?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)?)??$/,rj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",RS,oj=/^(?:(?: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])$/,aj=/^(?:(?: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])$/,ij=/^(([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]))$/,sj=/^(([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])$/,cj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mR="((\\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])))",lj=new RegExp(`^${mR}$`);function gR(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 dj(e){return new RegExp(`^${gR(e)}$`)}function hR(e){let t=`${mR}T${gR(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 pj(e,t){return!!((t==="v4"||!t)&&oj.test(e)||(t==="v6"||!t)&&ij.test(e))}function fj(e,t){if(!ej.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function mj(e,t){return!!((t==="v4"||!t)&&aj.test(e)||(t==="v6"||!t)&&sj.test(e))}var mo=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.string,received:a.parsedType}),be}let n=new Dt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=t.data.length>a.value,p=t.data.length<a.value;(i||p)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")rj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")RS||(RS=new RegExp(nj,"u")),RS.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ZM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")JM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")YM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")KM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")XM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:X.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?hR(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?lj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?dj(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?tj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?pj(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?fj(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?mj(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?cj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?uj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:a.message}),n.dirty()):Ve.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...ge.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.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,...ge.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,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ge.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ge.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ge.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ge.errToObj(r)})}nonempty(t){return this.min(1,ge.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}};mo.create=e=>new mo({checks:[],typeName:Re.ZodString,coerce:e?.coerce??!1,...ke(e)});function gj(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,a=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return a%i/10**o}var la=class e extends qe{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)!==ue.number){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.number,received:a.parsedType}),be}let n,o=new Dt;for(let a of this._def.checks)a.kind==="int"?Ve.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?gj(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:a.message}),o.dirty()):Ve.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.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"&&Ve.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)}};la.create=e=>new la({checks:[],typeName:Re.ZodNumber,coerce:e?.coerce||!1,...ke(e)});var da=class e extends qe{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)!==ue.bigint)return this._getInvalidInput(t);let n,o=new Dt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):Ve.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.bigint,received:r.parsedType}),be}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_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:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.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}};da.create=e=>new da({checks:[],typeName:Re.ZodBigInt,coerce:e?.coerce??!1,...ke(e)});var pa=class extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.boolean,received:n.parsedType}),be}return Ut(t.data)}};pa.create=e=>new pa({typeName:Re.ZodBoolean,coerce:e?.coerce||!1,...ke(e)});var fa=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.date,received:a.parsedType}),be}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_date}),be}let n=new Dt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ve.assertNever(a);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:ge.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ge.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}};fa.create=e=>new fa({checks:[],coerce:e?.coerce||!1,typeName:Re.ZodDate,...ke(e)});var Wi=class extends qe{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.symbol,received:n.parsedType}),be}return Ut(t.data)}};Wi.create=e=>new Wi({typeName:Re.ZodSymbol,...ke(e)});var ma=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.undefined,received:n.parsedType}),be}return Ut(t.data)}};ma.create=e=>new ma({typeName:Re.ZodUndefined,...ke(e)});var ga=class extends qe{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.null,received:n.parsedType}),be}return Ut(t.data)}};ga.create=e=>new ga({typeName:Re.ZodNull,...ke(e)});var go=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Ut(t.data)}};go.create=e=>new go({typeName:Re.ZodAny,...ke(e)});var qn=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ut(t.data)}};qn.create=e=>new qn({typeName:Re.ZodUnknown,...ke(e)});var _r=class extends qe{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),be}};_r.create=e=>new _r({typeName:Re.ZodNever,...ke(e)});var Yi=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.void,received:n.parsedType}),be}return Ut(t.data)}};Yi.create=e=>new Yi({typeName:Re.ZodVoid,...ke(e)});var Mn=class e extends qe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return se(r,{code:X.invalid_type,expected:ue.array,received:r.parsedType}),be;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(se(r,{code:i?X.too_big:X.too_small,minimum:p?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(se(r,{code:X.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(se(r,{code:X.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,p)=>o.type._parseAsync(new Cr(r,i,r.path,p)))).then(i=>Dt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new Cr(r,i,r.path,p)));return Dt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ge.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ge.toString(r)}})}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...ke(t)});function zi(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(zi(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Mn?new Mn({...e._def,type:zi(e.element)}):e instanceof Ar?Ar.create(zi(e.unwrap())):e instanceof nn?nn.create(zi(e.unwrap())):e instanceof rn?rn.create(e.items.map(t=>zi(t))):e}var tr=class e extends qe{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=Ve.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let m=this._getOrReturnCtx(t);return se(m,{code:X.invalid_type,expected:ue.object,received:m.parsedType}),be}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof _r&&this._def.unknownKeys==="strip"))for(let m in o.data)i.includes(m)||p.push(m);let f=[];for(let m of i){let g=a[m],A=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Cr(o,A,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof _r){let m=this._def.unknownKeys;if(m==="passthrough")for(let g of p)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let g of p){let A=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Cr(o,A,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let m=[];for(let g of f){let A=yield g.key,x=yield g.value;m.push({key:A,value:x,alwaysSet:g.alwaysSet})}return m})).then(m=>Dt.mergeObjectSync(n,m)):Dt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(t).message??o}:{message:o}}}:{})})}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:Re.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 Ve.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 Ve.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return zi(this)}partial(t){let r={};for(let n of Ve.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ve.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ar;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return yR(Ve.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});var ha=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let i=a.map(p=>new er(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:i}),be}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(a){let i={...r,common:{...r.common,issues:[]},parent:null};return{result:yield a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}});return function(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let a,i=[];for(let f of n){let m={...r,common:{...r.common,issues:[]},parent:null},g=f._parseSync({data:r.data,path:r.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:m}),m.common.issues.length&&i.push(m.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=i.map(f=>new er(f));return se(r,{code:X.invalid_union,unionErrors:p}),be}}get options(){return this._def.options}};ha.create=(e,t)=>new ha({options:e,typeName:Re.ZodUnion,...ke(t)});var Dn=e=>e instanceof Sa?Dn(e.schema):e instanceof br?Dn(e.innerType()):e instanceof va?[e.value]:e instanceof Aa?e.options:e instanceof Ca?Ve.objectValues(e.enum):e instanceof ba?Dn(e._def.innerType):e instanceof ma?[void 0]:e instanceof ga?[null]:e instanceof Ar?[void 0,...Dn(e.unwrap())]:e instanceof nn?[null,...Dn(e.unwrap())]:e instanceof Xc||e instanceof wa?Dn(e.unwrap()):e instanceof xa?Dn(e._def.innerType):[],dp=class e extends qe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:X.invalid_type,expected:ue.object,received:r.parsedType}),be;let n=this.discriminator,o=r.data[n],a=this.optionsMap.get(o);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let a of r){let i=Dn(a.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of i){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,a)}}return new e({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ke(n)})}};function IS(e,t){let r=tn(e),n=tn(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Ve.objectKeys(t),a=Ve.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=IS(e[p],t[p]);if(!f.valid)return{valid:!1};i[p]=f.data}return{valid:!0,data:i}}else if(r===ue.array&&n===ue.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],p=t[a],f=IS(i,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ya=class extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(up(a)||up(i))return be;let p=IS(a.value,i.value);return p.valid?((lp(a)||lp(i))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),be)};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(([a,i])=>o(a,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ya.create=(e,t,r)=>new ya({left:e,right:t,typeName:Re.ZodIntersection,...ke(r)});var rn=class e extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return se(n,{code:X.invalid_type,expected:ue.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,p)=>{let f=this._def.items[p]||this._def.rest;return f?f._parse(new Cr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Dt.mergeArray(r,i)):Dt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};rn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rn({items:e,typeName:Re.ZodTuple,rest:null,...ke(t)})};var pp=class e extends qe{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!==ue.object)return se(n,{code:X.invalid_type,expected:ue.object,received:n.parsedType}),be;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new Cr(n,p,n.path,p)),value:i._parse(new Cr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?Dt.mergeObjectAsync(r,o):Dt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof qe?new e({keyType:t,valueType:r,typeName:Re.ZodRecord,...ke(n)}):new e({keyType:mo.create(),valueType:t,typeName:Re.ZodRecord,...ke(r)})}},Ki=class extends qe{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!==ue.map)return se(n,{code:X.invalid_type,expected:ue.map,received:n.parsedType}),be;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Cr(n,p,n.path,[m,"key"])),value:a._parse(new Cr(n,f,n.path,[m,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let f of i){let m=yield f.key,g=yield f.value;if(m.status==="aborted"||g.status==="aborted")return be;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let f of i){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return be;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Ki.create=(e,t,r)=>new Ki({valueType:t,keyType:e,typeName:Re.ZodMap,...ke(r)});var Xi=class e extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return se(n,{code:X.invalid_type,expected:ue.set,received:n.parsedType}),be;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(se(n,{code:X.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let a=this._def.valueType;function i(f){let m=new Set;for(let g of f){if(g.status==="aborted")return be;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let p=[...n.data.values()].map((f,m)=>a._parse(new Cr(n,f,n.path,m)));return n.common.async?Promise.all(p).then(f=>i(f)):i(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Xi.create=(e,t)=>new Xi({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...ke(t)});var fp=class e extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.function)return se(r,{code:X.invalid_type,expected:ue.function,received:r.parsedType}),be;function n(p,f){return Kc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,$i(),Nn].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return Kc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,$i(),Nn].filter(m=>!!m),issueData:{code:X.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ho){let p=this;return Ut(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new er([]),g=yield p._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),A=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(A,a).catch(h=>{throw m.addIssue(o(A,h)),m})}))}else{let p=this;return Ut(function(...f){let m=p._def.args.safeParse(f,a);if(!m.success)throw new er([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),A=p._def.returns.safeParse(g,a);if(!A.success)throw new er([o(g,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:rn.create(t).rest(qn.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||rn.create([]).rest(qn.create()),returns:r||qn.create(),typeName:Re.ZodFunction,...ke(n)})}},Sa=class extends qe{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})}};Sa.create=(e,t)=>new Sa({getter:e,typeName:Re.ZodLazy,...ke(t)});var va=class extends qe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:t.data}}get value(){return this._def.value}};va.create=(e,t)=>new va({value:e,typeName:Re.ZodLiteral,...ke(t)});function yR(e,t){return new Aa({values:e,typeName:Re.ZodEnum,...ke(t)})}var Aa=class e extends qe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Ve.joinValues(n),received:r.parsedType,code:X.invalid_type}),be}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 se(r,{received:r.data,code:X.invalid_enum_value,options:n}),be}return Ut(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})}};Aa.create=yR;var Ca=class extends qe{_parse(t){let r=Ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Ve.objectValues(r);return se(n,{expected:Ve.joinValues(o),received:n.parsedType,code:X.invalid_type}),be}if(this._cache||(this._cache=new Set(Ve.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ve.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),be}return Ut(t.data)}get enum(){return this._def.values}};Ca.create=(e,t)=>new Ca({values:e,typeName:Re.ZodNativeEnum,...ke(t)});var ho=class extends qe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ue.promise,received:r.parsedType}),be;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Ut(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ho.create=(e,t)=>new ho({type:e,typeName:Re.ZodPromise,...ke(t)});var br=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{se(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return be;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?be:f.status==="dirty"?ua(f.value):r.value==="dirty"?ua(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return be;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?be:p.status==="dirty"?ua(p.value):r.value==="dirty"?ua(p.value):p}}if(o.type==="refinement"){let i=p=>{let f=o.refinement(p,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),i(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),i(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fo(i))return be;let p=o.transform(i.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>fo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):be);Ve.assertNever(o)}};br.create=(e,t,r)=>new br({schema:e,typeName:Re.ZodEffects,effect:t,...ke(r)});br.createWithPreprocess=(e,t,r)=>new br({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...ke(r)});var Ar=class extends qe{_parse(t){return this._getType(t)===ue.undefined?Ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:Re.ZodOptional,...ke(t)});var nn=class extends qe{_parse(t){return this._getType(t)===ue.null?Ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:Re.ZodNullable,...ke(t)});var ba=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ba.create=(e,t)=>new ba({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ke(t)});var xa=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Hi(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};xa.create=(e,t)=>new xa({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ke(t)});var Zi=class extends qe{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.nan,received:n.parsedType}),be}return{status:"valid",value:t.data}}};Zi.create=e=>new Zi({typeName:Re.ZodNaN,...ke(e)});var hj=Symbol("zod_brand"),Xc=class extends qe{_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}},Zc=class e extends qe{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?be:a.status==="dirty"?(r.dirty(),ua(a.value)):_this34._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?be:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Re.ZodPipeline})}},wa=class extends qe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(fo(o)&&(o.value=Object.freeze(o.value)),o);return Hi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};wa.create=(e,t)=>new wa({innerType:e,typeName:Re.ZodReadonly,...ke(t)});function fR(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function SR(e,t={},r){return e?go.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=fR(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=fR(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):go.create()}var yj={object:tr.lazycreate},Re;(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"})(Re||(Re={}));var Sj=(e,t={message:`Input not instance of ${e.name}`})=>SR(r=>r instanceof e,t),vR=mo.create,AR=la.create,vj=Zi.create,Aj=da.create,CR=pa.create,Cj=fa.create,bj=Wi.create,xj=ma.create,wj=ga.create,Rj=go.create,Ij=qn.create,Ej=_r.create,Fj=Yi.create,Tj=Mn.create,Pj=tr.create,kj=tr.strictCreate,Oj=ha.create,_j=dp.create,Nj=ya.create,Dj=rn.create,qj=pp.create,Mj=Ki.create,jj=Xi.create,Vj=fp.create,Lj=Sa.create,Uj=va.create,Qj=Aa.create,Bj=Ca.create,Gj=ho.create,$j=br.create,Hj=Ar.create,zj=nn.create,Wj=br.createWithPreprocess,Yj=Zc.create,Kj=()=>vR().optional(),Xj=()=>AR().optional(),Zj=()=>CR().optional(),Jj={string:e=>mo.create({...e,coerce:!0}),number:e=>la.create({...e,coerce:!0}),boolean:e=>pa.create({...e,coerce:!0}),bigint:e=>da.create({...e,coerce:!0}),date:e=>fa.create({...e,coerce:!0})};var eV=be;var tV=R.object({name:R.string(),arguments:R.string()}),rV=R.object({id:R.string(),type:R.literal("function"),function:tV,encryptedValue:R.string().optional()}),mp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),nV=R.object({type:R.literal("text"),text:R.string()}),oV=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),aV=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),gp=R.discriminatedUnion("type",[oV,aV]),iV=R.object({type:R.literal("image"),source:gp,metadata:R.unknown().optional()}),sV=R.object({type:R.literal("audio"),source:gp,metadata:R.unknown().optional()}),cV=R.object({type:R.literal("video"),source:gp,metadata:R.unknown().optional()}),uV=R.object({type:R.literal("document"),source:gp,metadata:R.unknown().optional()});var bR=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()}),xR=(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"]})},vde=bR.superRefine((e,t)=>{xR(e,t)}),lV=R.discriminatedUnion("type",[nV,iV,sV,cV,uV,bR]),dV=lV.superRefine((e,t)=>{e.type==="binary"&&xR(e,t)}),pV=mp.extend({role:R.literal("developer"),content:R.string()}),fV=mp.extend({role:R.literal("system"),content:R.string()}),mV=mp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(rV).optional()}),gV=mp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(dV)])}),hV=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),yV=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),SV=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),wR=R.discriminatedUnion("role",[pV,fV,mV,gV,hV,yV,SV]),Ade=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),vV=R.object({description:R.string(),value:R.string()}),RR=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),AV=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional()}),CV=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional()}),bV=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(wR),tools:R.array(RR),context:R.array(vV),forwardedProps:R.any(),resume:R.array(CV).optional()}),xV=R.any(),at=class extends Error{constructor(e){super(e)}},ES=class extends at{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},wV=R.object({name:R.string(),description:R.string().optional()}),RV=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),IV=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),EV=R.object({supported:R.boolean().optional(),items:R.array(RR).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),FV=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),TV=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),PV=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(wV).optional()}),kV=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),OV=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),_V=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),NV=R.object({input:OV.optional(),output:_V.optional()}),DV=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),qV=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),Cde=R.object({identity:RV.optional(),transport:IV.optional(),tools:EV.optional(),output:FV.optional(),state:TV.optional(),multiAgent:PV.optional(),reasoning:kV.optional(),multimodal:NV.optional(),execution:DV.optional(),humanInTheLoop:qV.optional(),custom:R.record(R.unknown()).optional()}),IR=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),j=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}({}),Be=R.object({type:R.nativeEnum(j),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),MV=Be.extend({type:R.literal(j.TEXT_MESSAGE_START),messageId:R.string(),role:IR.default("assistant"),name:R.string().optional()}),ER=Be.extend({type:R.literal(j.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),jV=Be.extend({type:R.literal(j.TEXT_MESSAGE_END),messageId:R.string()}),VV=Be.extend({type:R.literal(j.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:IR.optional(),delta:R.string().optional(),name:R.string().optional()}),LV=Be.extend({type:R.literal(j.THINKING_TEXT_MESSAGE_START)}),UV=ER.omit({messageId:!0,type:!0}).extend({type:R.literal(j.THINKING_TEXT_MESSAGE_CONTENT)}),QV=Be.extend({type:R.literal(j.THINKING_TEXT_MESSAGE_END)}),BV=Be.extend({type:R.literal(j.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),GV=Be.extend({type:R.literal(j.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),$V=Be.extend({type:R.literal(j.TOOL_CALL_END),toolCallId:R.string()}),HV=Be.extend({messageId:R.string(),type:R.literal(j.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),zV=Be.extend({type:R.literal(j.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),WV=Be.extend({type:R.literal(j.THINKING_START),title:R.string().optional()}),YV=Be.extend({type:R.literal(j.THINKING_END)}),KV=Be.extend({type:R.literal(j.STATE_SNAPSHOT),snapshot:xV}),XV=Be.extend({type:R.literal(j.STATE_DELTA),delta:R.array(R.any())}),ZV=Be.extend({type:R.literal(j.MESSAGES_SNAPSHOT),messages:R.array(wR)}),JV=Be.extend({type:R.literal(j.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),eL=Be.extend({type:R.literal(j.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),tL=Be.extend({type:R.literal(j.RAW),event:R.any(),source:R.string().optional()}),rL=Be.extend({type:R.literal(j.CUSTOM),name:R.string(),value:R.any()}),nL=Be.extend({type:R.literal(j.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:bV.optional()}),oL=R.object({type:R.literal("success")}).strict(),aL=R.object({type:R.literal("interrupt"),interrupts:R.array(AV).min(1)}).strict(),iL=R.discriminatedUnion("type",[oL,aL]),sL=Be.extend({type:R.literal(j.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:iL.nullable().optional().transform(e=>e??void 0)}),cL=Be.extend({type:R.literal(j.RUN_ERROR),message:R.string(),code:R.string().optional()}),uL=Be.extend({type:R.literal(j.STEP_STARTED),stepName:R.string()}),lL=Be.extend({type:R.literal(j.STEP_FINISHED),stepName:R.string()}),dL=R.union([R.literal("tool-call"),R.literal("message")]),pL=Be.extend({type:R.literal(j.REASONING_START),messageId:R.string()}),fL=Be.extend({type:R.literal(j.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),mL=Be.extend({type:R.literal(j.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),gL=Be.extend({type:R.literal(j.REASONING_MESSAGE_END),messageId:R.string()}),hL=Be.extend({type:R.literal(j.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),yL=Be.extend({type:R.literal(j.REASONING_END),messageId:R.string()}),SL=Be.extend({type:R.literal(j.REASONING_ENCRYPTED_VALUE),subtype:dL,entityId:R.string(),encryptedValue:R.string()}),hp=R.discriminatedUnion("type",[MV,ER,jV,VV,WV,YV,LV,UV,QV,BV,GV,$V,zV,HV,KV,XV,ZV,JV,eL,tL,rL,nL,sL,cL,uL,lL,pL,fL,mL,gL,hL,yL,SL]);d();c();l();u();var FS={};Ks(FS,{JsonPatchError:()=>dt,_areEquals:()=>tu,applyOperation:()=>Ra,applyPatch:()=>xp,applyReducer:()=>xL,deepClone:()=>CL,getValueByPointer:()=>Cp,validate:()=>TR,validator:()=>bp});d();c();l();u();d();c();l();u();var vL=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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)}}(),AL=Object.prototype.hasOwnProperty;function Sp(e,t){return AL.call(e,t)}function vp(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 o in e)Sp(e,o)&&n.push(o);return n}function qt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ap(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 on(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Jc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function yp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(yp(e[t]))return!0}else if(typeof e=="object"){for(var n=vp(e),o=n.length,a=0;a<o;a++)if(yp(e[n[a]]))return!0}}return!1}function FR(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
- `)}var eu=function(e){vL(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,FR(r,{name:n,index:o,operation:a,tree:i}))||this;return f.name=n,f.index=o,f.operation=a,f.tree=i,Object.setPrototypeOf(f,p.prototype),f.message=FR(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var dt=eu,CL=qt,Ji={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=Cp(r,this.path);n&&(n=qt(n));var o=Ra(r,{op:"remove",path:this.from}).removed;return Ra(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Cp(r,this.from);return Ra(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:tu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},bL={add:function(e,t,r){return Ap(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:Ji.move,copy:Ji.copy,test:Ji.test,_get:Ji._get};function Cp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Ra(e,r),r.value}function Ra(e,t,r,n,o,a){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=0),r&&(typeof r=="function"?r(t,0,e,t.path):bp(t,0)),t.path===""){var i={newDocument:e};if(t.op==="add")return i.newDocument=t.value,i;if(t.op==="replace")return i.newDocument=t.value,i.removed=e,i;if(t.op==="move"||t.op==="copy")return i.newDocument=Cp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=tu(e,t.value),i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i.newDocument=e,i}else{if(t.op==="remove")return i.removed=e,i.newDocument=null,i;if(t.op==="_get")return t.value=e,i;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=qt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,A=f.length,x=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=bp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Jc(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-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&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==A-1&&(x=t.path),x!==void 0&&y(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Ap(h))throw new dt("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",a,t,e);Ap(h)&&(h=~~h)}if(g>=A){if(r&&t.op==="add"&&h>m.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);var i=bL[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=A){var i=Ji[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<A&&(!m||typeof m!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function xp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=qt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=Ra(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function xL(e,t,r){var n=Ra(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function bp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Ji[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("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 dt("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 dt("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")&&yp(e.value))throw new dt("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 o=e.path.split("/").length,a=n.split("/").length;if(o!==a+1&&o!==a)throw new dt("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 dt("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 i={op:"_get",path:e.from,value:void 0},p=TR([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function TR(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)xp(qt(t),qt(e),r||!0);else{r=r||bp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function tu(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),o,a,i;if(r&&n){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!tu(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=a;o--!==0;)if(i=p[o],!tu(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var OS={};Ks(OS,{compare:()=>kL,generate:()=>TS,observe:()=>PL,unobserve:()=>TL});d();c();l();u();var PS=new WeakMap,wL=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),RL=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function IL(e){return PS.get(e)}function EL(e,t){return e.observers.get(t)}function FL(e,t){e.observers.delete(t.callback)}function TL(e,t){t.unobserve()}function PL(e,t){var r=[],n,o=IL(e);if(!o)o=new wL(e),PS.set(e,o);else{var a=EL(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=qt(e),t){n.callback=t,n.next=null;var i=function(){TS(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){TS(n),clearTimeout(n.next),FL(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new RL(t,n)),n}function TS(e,t){t===void 0&&(t=!1);var r=PS.get(e.object);kS(r.value,e.object,e.patches,"",t),e.patches.length&&xp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function kS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=vp(t),i=vp(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],A=e[g];if(Sp(t,g)&&!(t[g]===void 0&&A!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof A=="object"&&A!=null&&typeof x=="object"&&x!=null&&Array.isArray(A)===Array.isArray(x)?kS(A,x,r,n+"/"+on(g),o):A!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+on(g),value:qt(A)}),r.push({op:"replace",path:n+"/"+on(g),value:qt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+on(g),value:qt(A)}),r.push({op:"remove",path:n+"/"+on(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!Sp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+on(g),value:qt(t[g])})}}}function kL(e,t,r){r===void 0&&(r=!1);var n=[];return kS(e,t,n,"",r),n}var wp=Object.assign({},FS,OS,{JsonPatchError:eu,deepClone:qt,escapePathComponent:on,unescapePathComponent:Jc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var _S=function(e,t){return _S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},_S(e,t)};function an(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_S(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function PR(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(A){i(A)}}function f(g){try{m(n.throw(g))}catch(A){i(A)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function Rp(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=p(0),i.throw=p(1),i.return=p(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function jn(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 es(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,a=[],i;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)a.push(o.value)}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function ts(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function Ia(e){return this instanceof Ia?(this.v=e,this):new Ia(e)}function kR(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(y){return Promise.resolve(y).then(h,A)}}function p(h,y){n[h]&&(o[h]=function(b){return new Promise(function(w,I){a.push([h,b,w,I])>1||f(h,b)})},y&&(o[h]=y(o[h])))}function f(h,y){try{m(n[h](y))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof Ia?Promise.resolve(h.value.v).then(g,A):x(a[0][2],h)}function g(h){f("next",h)}function A(h){f("throw",h)}function x(h,y){h(y),a.shift(),a.length&&f(a[0][0],a[0][1])}}function OR(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 jn=="function"?jn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(i){return new Promise(function(p,f){i=e[a](i),o(p,f,i.done,i.value)})}}function o(a,i,p,f){Promise.resolve(f).then(function(m){a({value:m,done:p})},i)}}d();c();l();u();function je(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function rs(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 Ip=rs(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function YN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var KN=["1",1,"yes",!0];function XN(){let e=[];return Yh()&&e.push(window.doNotTrack),uy()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>KN.indexOf(t)!==-1)}function kc(e){return e===!0?!1:XN()}var wb="v15",Rb={default:"https://analytics.cloud.coveo.com/rest/ua"};function ZN(e=Rb.default,t=wb,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 JN="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:Rb.default,isCustomEndpoint:!1,token:"",version:wb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Ab}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=[Q0,M0].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};kc(this.options.disableBrowserPrivacySignals)?this.runtime=new kl:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Me.view,{newEventType:Me.view,addClientIdParameter:!0}),this.addEventTypeMapping(Me.click,{newEventType:Me.click,addClientIdParameter:!0}),this.addEventTypeMapping(Me.custom,{newEventType:Me.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Me.search,{newEventType:Me.search,addClientIdParameter:!0})}initRuntime(t){return Yh()&&aa()?new ay(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(YN()&&console.warn(WN),new sy(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Yh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Ho()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Ho()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(Il(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(El(t,El(r,JN)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(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(Ho()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(kc(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Yn.cvo_cid);if(r==null)return null;let n=Yn.fromString(r);return!n||!aa()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>U(this,void 0,void 0,function*(){let w=yield y;return yield b(t,w)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[A=>this.setTrackingIdIfTrackingIdNotPresent(A),A=>this.removeEmptyPayloadValues(A,t),A=>this.validateParams(A,t),A=>n?jN(A):A,A=>n?this.removeUnknownParameters(A):A,A=>n?this.processCustomParameters(A):this.mapCustomParametersToCustomData(A)].reduce((A,x)=>U(this,void 0,void 0,function*(){let h=yield A;return yield x(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(p=>p(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(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 Rl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Br(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Br(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Br(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Me.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield v(`${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 o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Me.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(QN(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=Br(t,["custom"]),o={};r&&wl(r)&&(o=this.lowercaseKeys(r));let i=BN(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Br(t,["custom"]);if(r&&wl(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=Br(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Me.view||r==Me.click||r==Me.search||r==Me.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Me.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Br(t,["userId"]);return zN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Br(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&wl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&wl(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"?tN(t,r):t}get baseUrl(){return ZN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Ot;(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"})(Ot||(Ot={}));var O;(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.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",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.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(O||(O={}));var cy={[O.triggerNotify]:"queryPipelineTriggers",[O.triggerExecute]:"queryPipelineTriggers",[O.triggerQuery]:"queryPipelineTriggers",[O.triggerRedirect]:"queryPipelineTriggers",[O.queryErrorBack]:"errors",[O.queryErrorClear]:"errors",[O.queryErrorRetry]:"errors",[O.pagerNext]:"getMoreResults",[O.pagerPrevious]:"getMoreResults",[O.pagerNumber]:"getMoreResults",[O.pagerResize]:"getMoreResults",[O.pagerScrolling]:"getMoreResults",[O.facetSearch]:"facet",[O.facetShowLess]:"facet",[O.facetShowMore]:"facet",[O.recommendation]:"recommendation",[O.likeSmartSnippet]:"smartSnippet",[O.dislikeSmartSnippet]:"smartSnippet",[O.expandSmartSnippet]:"smartSnippet",[O.collapseSmartSnippet]:"smartSnippet",[O.openSmartSnippetFeedbackModal]:"smartSnippet",[O.closeSmartSnippetFeedbackModal]:"smartSnippet",[O.sendSmartSnippetReason]:"smartSnippet",[O.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.clearRecentQueries]:"recentQueries",[O.recentResultClick]:"recentlyClickedDocuments",[O.clearRecentResults]:"recentlyClickedDocuments",[O.showLessFoldedResults]:"folding",[O.caseDetach]:"case",[O.likeGeneratedAnswer]:"generatedAnswer",[O.dislikeGeneratedAnswer]:"generatedAnswer",[O.openGeneratedAnswerSource]:"generatedAnswer",[O.generatedAnswerOpenInlineLink]:"generatedAnswer",[O.generatedAnswerFollowupOpenSource]:"generatedAnswer",[O.generatedAnswerStreamEnd]:"generatedAnswer",[O.generatedAnswerSourceHover]:"generatedAnswer",[O.generatedAnswerCopyToClipboard]:"generatedAnswer",[O.generatedAnswerHideAnswers]:"generatedAnswer",[O.generatedAnswerShowAnswers]:"generatedAnswer",[O.generatedAnswerExpand]:"generatedAnswer",[O.generatedAnswerCollapse]:"generatedAnswer",[O.generatedAnswerFeedbackSubmit]:"generatedAnswer",[O.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Ot.expandToFullUI]:"interface",[Ot.openUserActions]:"User Actions",[Ot.showPrecedingSessions]:"User Actions",[Ot.showFollowingSessions]:"User Actions",[Ot.clickViewedDocument]:"User Actions",[Ot.clickPageView]:"User Actions",[Ot.createArticle]:"createArticle"},Kn=class{constructor(){this.runtime=new kl,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(Me.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Me.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Me.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Me.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Ab}};function eD(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function tD(e){return e.map(t=>t.replace(/;/g,""))}function Ib(e){let r=e.join(";");return r.length<=256?r:Ib(e.slice(1))}var gb=e=>{let t=tD(e),r=eD(t);return Ib(r)};function hb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:gb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:gb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ol=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||kc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Kn:new cr(t)}disable(){this.coveoAnalyticsClient=new Kn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(O.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(O.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(O.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(O.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(O.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(O.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(O.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(O.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(O.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(O.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(O.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(O.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(O.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(O.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(O.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(O.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(O.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(O.omniboxAnalytics,hb(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(O.omniboxFromLink,hb(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(O.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(O.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(O.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(O.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(O.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(O.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(O.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(O.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(O.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(O.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(O.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(O.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(O.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(O.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(O.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(O.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(O.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(O.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(O.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(O.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(O.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(O.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(O.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(O.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(O.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(O.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(O.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(O.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(O.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(O.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(O.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(O.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(O.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(O.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(O.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(O.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(O.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(O.showLessFoldedResults)}logShowLessFoldedResults(){return U(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 U(this,arguments,void 0,function*(n,o,i=cy[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=cy[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:p})=>a.log({lastSearchQueryUid:p})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:p})=>a.log({searchQueryUid:p})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(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 cr?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(O.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(O.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(O.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(O.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(O.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(O.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(O.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(O.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(O.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(O.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(O.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(O.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(O.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(O.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},_l=Object.assign({},Fc),yb=Object.keys(_l).map(e=>_l[e]),sa=class extends Zh{constructor({client:t,uuidGenerator:r=Ho}){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])=>yb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(yb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(_l.pageview,{newEventType:Me.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(_l.event,{newEventType:Me.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=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}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return aN(this.ticket)}};sa.Id="svc";var Nl;(function(e){e.click="click",e.flowStart="flowStart"})(Nl||(Nl={}));var hr;(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"})(hr||(hr={}));var Dl;(function(e){e.quit="Quit",e.solved="Solved"})(Dl||(Dl={}));var ql=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!kc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new cr(t):new Kn,this.svc=new sa({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Kn,this.svc=new sa({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new sa({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(hr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(hr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(hr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(hr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(hr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(hr.caseCancelled,{reason:Dl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(hr.caseSolved,{reason:Dl.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(hr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Nl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Nl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,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 cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;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:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var i,a;let p=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(p)})}},rD=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let i=`context_${r}`;t[i]=o}}),t},le=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,i=Br(e,["caseContext","caseId","caseNumber"]),a=rD(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},i),!!a.context_Case_Subject&&{CaseSubject:a.context_Case_Subject}),t&&a)},Ml=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||kc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Kn:new cr(t)}disable(){this.coveoAnalyticsClient=new Kn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}logInterfaceLoad(t){if(t){let r=le(t);return this.logSearchEvent(O.interfaceLoad,r)}return this.logSearchEvent(O.interfaceLoad)}logRecentQueryClick(t){if(t){let r=le(t);return this.logSearchEvent(O.recentQueryClick,r)}return this.logSearchEvent(O.recentQueryClick)}logClearRecentQueries(t){if(t){let r=le(t);return this.logCustomEvent(O.clearRecentQueries,r)}return this.logCustomEvent(O.clearRecentQueries)}logInterfaceChange(t){let r=le(t);return this.logSearchEvent(O.interfaceChange,r)}logStaticFilterDeselect(t){let r=le(t);return this.logSearchEvent(O.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=le(t);return this.logCustomEvent(O.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=le(t);return this.logSearchEvent(O.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=le(t);return this.logSearchEvent(O.breadcrumbResetAll,r)}return this.logSearchEvent(O.breadcrumbResetAll)}logFacetSelect(t){let r=le(t);return this.logSearchEvent(O.facetSelect,r)}logFacetExclude(t){let r=le(t);return this.logSearchEvent(O.facetExclude,r)}logFacetDeselect(t){let r=le(t);return this.logSearchEvent(O.facetDeselect,r)}logFacetUpdateSort(t){let r=le(t);return this.logSearchEvent(O.facetUpdateSort,r)}logFacetClearAll(t){let r=le(t);return this.logSearchEvent(O.facetClearAll,r)}logFacetShowMore(t){let r=le(t,!1);return this.logCustomEvent(O.facetShowMore,r)}logFacetShowLess(t){let r=le(t,!1);return this.logCustomEvent(O.facetShowLess,r)}logQueryError(t){let r=le(t,!1);return this.logCustomEvent(O.queryError,r)}logPagerNumber(t){let r=le(t,!1);return this.logCustomEvent(O.pagerNumber,r)}logPagerNext(t){let r=le(t,!1);return this.logCustomEvent(O.pagerNext,r)}logPagerPrevious(t){let r=le(t,!1);return this.logCustomEvent(O.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=le(t);return this.logSearchEvent(O.didyoumeanAutomatic,r)}return this.logSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=le(t);return this.logSearchEvent(O.didyoumeanClick,r)}return this.logSearchEvent(O.didyoumeanClick)}logResultsSort(t){let r=le(t);return this.logSearchEvent(O.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=le(t);return this.logSearchEvent(O.searchboxSubmit,r)}return this.logSearchEvent(O.searchboxSubmit)}logContextChanged(t){let r=le(t);return this.logSearchEvent(Ot.contextChanged,r)}logExpandToFullUI(t){let r=le(t);return this.logCustomEvent(Ot.expandToFullUI,r)}logOpenUserActions(t){let r=le(t,!1);return this.logCustomEvent(Ot.openUserActions,r)}logShowPrecedingSessions(t){let r=le(t,!1);return this.logCustomEvent(Ot.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=le(t,!1);return this.logCustomEvent(Ot.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(Ot.clickViewedDocument,Object.assign(Object.assign({},le(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(Ot.clickPageView,Object.assign(Object.assign({},le(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(Ot.createArticle,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(O.documentOpen,t,r,n?le(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(O.copyToClipboard,t,r,n?le(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(O.caseSendEmail,t,r,n?le(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(O.feedItemTextPost,t,r,n?le(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(O.documentQuickview,t,r,n?Object.assign(Object.assign({},le(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(O.caseAttach,t,r,n?Object.assign(Object.assign({},le(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&le(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(O.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(O.likeSmartSnippet,t?le(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(O.dislikeSmartSnippet,t?le(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(O.expandSmartSnippet,t?le(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(O.collapseSmartSnippet,t?le(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.openSmartSnippetFeedbackModal,t?le(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.closeSmartSnippetFeedbackModal,t?le(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(O.sendSmartSnippetReason,n?Object.assign(Object.assign({},le(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},le(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},le(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSource,t,r,n?le(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(O.likeGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(O.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(O.openGeneratedAnswerSource,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(O.generatedAnswerSourceHover,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(O.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(O.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(O.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(O.generatedAnswerExpand,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(O.generatedAnswerCollapse,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(O.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(O.retryGeneratedAnswer,t?Object.assign({},le(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(O.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(O.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logCustomEvent(t,r){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:cy[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(i)})}logShowMoreFoldedResults(t,r,n){return U(this,void 0,void 0,function*(){return this.logClickEvent(O.showMoreFoldedResults,t,r,n?le(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(O.showLessFoldedResults,t?le(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(O.triggerNotify,r?Object.assign(Object.assign({},le(r,!1)),t):t)}getBaseCustomEventRequest(t){return U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign({},this.getOrigins()),{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 cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var ua=()=>"default";var nD=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Xn=class{constructor(t){de(this,"getState",t);de(this,"state");this.state=t()}getLanguage(){return nD(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let p=`context_${i}`;o[p]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Wn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ua()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var Eb=e=>new cr(e).getCurrentVisitorId(),la=(e,t)=>typeof t=="function"?(...r)=>{let n=ec(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,da=(e,t)=>(...r)=>{let n=ec(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Oc=class extends Xn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Fb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o=new Oc(t),disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,f=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),m=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,A=new ql({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:i,preprocessRequest:la(e,n),beforeSendHooks:[da(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function jl(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function oD(e,t){return!!t&&t.facetId in e.facetSet}var Tn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),Tb=(e,t)=>e.facetSet[t]?.request,py=(e,t)=>{let r=Tn(e,t);return oD(e,r)?r:void 0};var Pb=(e,t)=>py(e,t)?.values.filter(r=>r.state!=="idle")||[],Gr=e=>e.search.isLoading;d();c();l();u();function kb(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function $r(e){let{activeValue:t,ancestryMap:r}=iD(e);return t?aD(t,r):[]}function iD(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 o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function aD(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function sD(e,t){return!!t&&t.facetId in e.categoryFacetSet}var fy=(e,t)=>{let r=Tn(e,t);if(sD(e,r))return r},my=(e,t)=>e.categoryFacetSet[t]?.request,Ob=(e,t)=>{let r=fy(e,t);return $r(r?.values??[])},gy=(e,t)=>{let r=my(e,t);return $r(r?.currentValues??[])};d();c();l();u();function pa(){return{}}d();c();l();u();function _b(e,t){return{request:e,tabs:t}}function fa(){return{}}d();c();l();u();function Nb(e,t){return{request:e,tabs:t}}function ma(){return{}}d();c();l();u();function Db(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ga(){return{}}var zo=(e,t)=>{let r=Vb(t,e),n=r?r.field:"",o=hy(n,e);return{facetId:e,facetField:n,facetTitle:o}};function ha(e,t){let{facetId:r,facetValue:n}=e,o=zo(r,t),i=Lb(t,r);return{...o,facetValue:i==="hierarchical"?jb(t,r):n}}function Xt(e){return{facetSet:e.facetSet??ga(),categoryFacetSet:e.categoryFacetSet??pa(),dateFacetSet:e.dateFacetSet??fa(),numericFacetSet:e.numericFacetSet??ma(),automaticFacetSet:e.automaticFacetSet??jl()}}var Vl=e=>{let t=[];return lD(e).forEach((r,n)=>{let o=Lb(e,r.facetId),i=gD(r,n+1);if(uD(r)){if(!!!gy(e,r.facetId).length)return;t.push({...i,...fD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,p)=>{if(a.state==="idle")return;let f=qb(a,p+1,o),m=cD(r)?Mb(a):pD(a);t.push({...i,...f,...m})})}),dD(e).forEach((r,n)=>{let o=mD(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let p=qb(i,a+1,"specific"),f=Mb(i);t.push({...o,...p,...f})})}),t},cD=e=>e.type==="specific",uD=e=>e.type==="hierarchical",lD=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),dD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),qb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),pD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Mb=e=>({displayValue:e.value,value:e.value}),jb=(e,t)=>gy(e,t).map(n=>n.value).join(";"),fD=(e,t)=>{let n=jb(e,t);return{value:n,valuePosition:1,displayValue:n}},mD=(e,t)=>({title:hy(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),gD=(e,t)=>({title:hy(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),hy=(e,t)=>`${e}_${t}`,Vb=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Lb=(e,t)=>{let r=Vb(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var yy=e=>e.configuration.search.locale,Ub=e=>e.configuration.search.timezone,Qb=e=>e.configuration.accessToken,Bb=e=>e.configuration.organizationId,Gb=e=>e.configuration.environment,Ll=e=>e.configuration?.knowledge?.agentId,$b=e=>e.configuration.knowledge.debugAgentSession;var Ce=e=>{if(hD(e)||Sy(e))return e.generatedAnswer?.answerId;if(yD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},hD=e=>"answer"in e&&"generatedAnswer"in e&&!J(e.generatedAnswer?.answerConfigurationId),Sy=e=>{let t=Ll(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},yD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",vy=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Zn=e=>e.followUpAnswers?.conversationId,SD=e=>e.generatedAnswer?.citations,vD=e=>e.followUpAnswers?.followUpAnswers,AD=ct(vD,e=>e?.flatMap(t=>t.citations)),CD=(e,t)=>t,Pr=ct(SD,AD,CD,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ut=()=>({q:"",enableQuerySyntax:!1});var _c=class extends Xn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||bt().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Vl(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ce(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||bt().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||bt().response.results.length}},Hb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o=new _c(t),disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,f=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),m=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,A=new Ml({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:i,preprocessRequest:la(e,n),beforeSendHooks:[da(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A};d();c();l();u();d();c();l();u();d();c();l();u();var Ul=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Ul||{}),Ql=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Ql||{}),Hr=e=>{if(Hi(e))return e.map(t=>Hr(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""}},Bl=()=>({by:"relevancy"}),zb=e=>({by:"date",order:e});var Wb=new Y({values:{by:new Js({enum:Ql,required:!0}),order:new Js({enum:Ul}),field:new $}});function ur(){return Hr(Bl())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function bD(){return typeof navigator<"u"}function Yb(){try{return typeof localStorage<"u"}catch{return!1}}function Kb(){try{return typeof sessionStorage<"u"}catch{return!1}}function Xb(){return bD()&&navigator.cookieEnabled}d();c();l();u();var ya=class e{static set(t,r,n){var o,i,a,p;n&&(i=new Date,i.setTime(i.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?Zb(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],Zb(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Zb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Jb(){return Yb()?localStorage:Xb()?new Gl:Kb()?sessionStorage:new Ay}var Gl=class e{getItem(t){return ya.get(`${e.prefix}${t}`)}removeItem(t){ya.erase(`${e.prefix}${t}`)}setItem(t,r,n){ya.set(`${e.prefix}${t}`,r,n)}};Gl.prefix="coveo_";var Ay=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var $l="__coveo.analytics.history",xD=20,wD=1e3*60,RD=75,Hl=class{constructor(t){this.store=t||Jb()}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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!=null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem($l);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem($l);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem($l,JSON.stringify(t.slice(0,xD)))}catch{}}clear(){try{this.store.removeItem($l)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,RD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>wD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Wo=class Wo extends Hl{static getInstance(t){return Wo.instance||(Wo.instance=new Wo(t)),Wo.instance}constructor(t){super(t)}};de(Wo,"instance",null);var vt=Wo;var Nc=class Nc extends Xn{constructor(){super(...arguments);de(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 Vl(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Nc.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||Nc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ce(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ur()}}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 i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(m=>m.expression),a=o.partialQueries.length-1,p=o.partialQueries[a]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:f}}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||ut().q}get responseTime(){return this.state.search?.duration||bt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||bt().response.totalCountFiltered}};de(Nc,"fallbackPipelineName","default");var Jn=Nc,ex=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,f=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),m=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,A=new Ol({token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:i,preprocessRequest:la(e,n),beforeSendHooks:[da(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||A.disable(),A},Cy=()=>{let t=vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function zl(e){let t=tx(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return aA([e,...t,...r],o=>o.uniqueId)}function tx(e){return e.childResults?e.childResults.flatMap(t=>[t,...tx(t)]):[]}d();c();l();u();var Sa=()=>"";function nx(e,t){return{...new Jn(t).getBaseMetadata(),actionCause:e,type:e}}function ID(e){return Object.assign(e,{instantlyCallable:!0})}function ED(e,t){let r=i=>{let a=me(e,i);return ID(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(i,{getState:a,extra:p}){let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A}=p;return yield(yield t({getState:a,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A})).log({state:a(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m}){let{description:g,log:A}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(x,{getState:h,extra:y}){return yield A({state:h(),extra:y})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var by=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return PD(i)}return n},FD=e=>e.configuration.analytics.analyticsMode==="legacy",TD=e=>e.configuration.analytics.analyticsMode==="next",PD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=p=>new a(p)),ED(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:A}){let x=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:F}){for(let E of x)yield E(F)});return function log(_x25){return _ref14.apply(this,arguments)}}()},y=p(),b=i({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:A,provider:r(p)}),w=yield t(b,p());h.description=w?.description,x.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(F){FD(F)&&(yield kD(w,r,F,g,b.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:I}=Ec(y);return x.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(F){if(TD(F)&&o&&n){let E=n(F);yield jD(I,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function kD(_x28,_x29,_x30,_x31,_x32){return _kD.apply(this,arguments)}function _kD(){_kD=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _kD.apply(this,arguments)}var ox=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(i){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),Fe=by(e=>ex({...e,provider:e.provider||new Jn(e.getState)}),e=>e,Jn),m9=by(Fb,ox("caseAssist"),Oc),te=e=>by(Hb,ox(e),_c),Xe=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=cx(e,o),n<0&&(n=MD(e,o)),n<0&&(n=0),OD(e,r(n),t)};var Dc=(e,t)=>({sourceName:ax(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Sa()}),ix=(e,t)=>({sourceName:ax(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Sa()});function ax(e){let t=e.source;return J(t)?"unknown":t}var qc=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function OD(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:DD(e),...(rx(e)?{documentCategory:rx(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:qD(e),queryPipeline:r.pipeline||Sa()}}function rx(e){return e.raw?.objecttype||void 0}var Ze=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||""}),sx={urihash:new $,sourcetype:new $,permanentid:new $},Wl={uniqueId:H,raw:new Y({values:sx}),title:H,uri:H,clickUri:H,rankingModifier:new $({required:!1,emptyAllowed:!0})};function _D(e){return Object.assign({},...Object.keys(sx).map(t=>({[t]:e[t]})))}function ND(e){return Object.assign({},...Object.keys(Wl).map(t=>({[t]:e[t]})),{raw:_D(e.raw)})}function DD(e){let t=e.raw.author;return J(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function qD(e){let t=e.raw.source;return J(t)?"unknown":t}var _t=e=>new Oe(Wl).validate(ND(e));function MD(e,t){for(let[r,n]of t.entries()){let o=zl(n);if(cx(e,o)!==-1)return r}return-1}function cx(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function jD(_x34,_x35,_x36){return _jD.apply(this,arguments)}function _jD(){_jD=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _jD.apply(this,arguments)}var kr=(e,t)=>{let r=Ze(e),n=Xe(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var xy=e=>_(e,{evt:H,type:We}),ux=e=>Fe("analytics/generic/search",t=>{xy(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),lx=e=>Fe("analytics/generic/click",(t,r)=>(_t(e.result),xy(e),t.makeClickEvent(e.evt,Xe(e.result,r),Ze(e.result),e.meta))),dx=e=>Fe("analytics/generic/custom",t=>(xy(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var px=()=>({actionCause:"interfaceLoad"}),va=()=>({actionCause:"interfaceChange"});d();c();l();u();var wy=()=>We,fx=()=>H,Aa=P("configuration/updateBasicConfiguration",e=>_(e,{accessToken:We,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:We})),Ca=P("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:We,timezone:We,locale:We,authenticationProviders:new oe({required:!1,each:H})})),VD={enabled:new pe({default:!0}),originContext:wy(),originLevel2:wy(),originLevel3:wy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new He,anonymous:new pe({default:!1}),deviceId:We,userDisplayName:We,documentLocation:We,trackingId:ZA,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:ab.reduce((e,t)=>(e[t]=XA,e),{})})},Yl=P("configuration/updateAnalyticsConfiguration",e=>_(e,VD)),Kl=P("configuration/analytics/disable"),Xl=P("configuration/analytics/enable"),mx=P("configuration/analytics/originlevel2",e=>_(e,{originLevel2:fx()})),gx=P("configuration/analytics/originlevel3",e=>_(e,{originLevel3:fx()})),hx=P("knowledge/setAgentId",e=>_(e,new $({required:!0})));d();c();l();u();var Zl=P("insightConfiguration/set",e=>_(e,{insightId:H}));d();c();l();u();d();c();l();u();var yx=()=>({insightId:""});var Jl=fe(yx(),e=>{e.addCase(Zl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Sx=()=>({caseContext:{},caseId:"",caseNumber:""}),ee=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});d();c();l();u();var Pn=e=>{if(e==="yes")return!0;if(e==="no")return!1},LD=()=>Fe("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function UD(e,t){return Fe({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ce(n),i=Pr(n,e);if(!o||!i)return null;let a=Zn(n);return r.makeGeneratedAnswerCitationClick(Dc(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:qc(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Pr(r,e);return{answerId:t??Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function QD(e,t,r){return Fe({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Ce(o),a=Pr(o,e);if(!i||!a)return null;let p=Zn(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Pr(n,e);return{answerId:r??Ce(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function BD(e,t){return Fe({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function GD(e){return Fe({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"like"})})}function $D(e){return Fe({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"dislike"})})}var HD=e=>Fe({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Pn(o),documented:Pn(i),correctTopic:Pn(p),hallucinationFree:Pn(a)},additionalNotes:m,correctAnswerUrl:f}}}),Ry=(e,t,r)=>Fe({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Ce(o);if(!i)return null;let a=Zn(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e??!1})}),ba=e=>Fe({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),zD=()=>Fe({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),WD=()=>Fe({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),YD=()=>Fe({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),KD=()=>Fe({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})});function XD(e){return Fe({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Zn(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"copyToClipboard"})})}function ZD(e,t){return Fe({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Pr(n,e);if(!o)return null;let i=Zn(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...ix(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var vx=()=>({actionCause:"retryGeneratedAnswer"}),ed={logCopyGeneratedAnswer:XD,logGeneratedAnswerHideAnswers:WD,logGeneratedAnswerShowAnswers:zD,logGeneratedAnswerStreamEnd:Ry,logGeneratedAnswerFeedback:HD,logDislikeGeneratedAnswer:$D,logLikeGeneratedAnswer:GD,logGeneratedAnswerOpenInlineLink:BD,logHoverCitation:QD,logOpenGeneratedAnswerSource:UD,logOpenGeneratedAnswerFollowUpSource:ZD,logRetryGeneratedAnswer:LD,logGeneratedAnswerExpand:YD,logGeneratedAnswerCollapse:KD};var JD=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(ee(t.insightCaseContext))),Iy=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ce(r),o=Pr(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Dc(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:qc(o)},ee(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=Pr(t,e);return{answerId:Ce(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),eq=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ce(n),i=Pr(n,e);return!o||!i?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t},ee(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=Pr(r,e);return{answerId:Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),tq=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"like"})}),rq=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"dislike"})}),nq=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},ee(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Pn(o),documented:Pn(i),correctTopic:Pn(p),hallucinationFree:Pn(a)},additionalNotes:m,correctAnswerUrl:f}}}),oq=(e,t,r)=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Ce(o);return i?n.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r},ee(o.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e})});var iq=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),aq=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),sq=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),cq=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})}),uq=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"copyToClipboard"})}),xa={logCopyGeneratedAnswer:uq,logGeneratedAnswerHideAnswers:aq,logGeneratedAnswerShowAnswers:iq,logGeneratedAnswerStreamEnd:oq,logGeneratedAnswerFeedback:nq,logDislikeGeneratedAnswer:rq,logLikeGeneratedAnswer:tq,logHoverCitation:eq,logOpenGeneratedAnswerSource:Iy,logRetryGeneratedAnswer:JD,logGeneratedAnswerExpand:sq,logGeneratedAnswerCollapse:cq};d();c();l();u();d();c();l();u();var td=P("searchHub/set",e=>_(e,new $({required:!0,emptyAllowed:!0})));var zr=me("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let i=t(),a=yield o.getInterface(lq(i));return ze(a)?n(a.error):(r(td(a.success.searchHub)),{response:a.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),lq=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var Ax=()=>({loading:!1,config:void 0});var eo=fe(Ax(),e=>{e.addCase(zr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(zr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(zr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function Cx(e){return e.type==="dateRange"}function bx(e){return`start${e}`}function xx(e){return`end${e}`}var Ey=()=>({dateFacetValueMap:{}});function dq(e,t,r){let n=e.start,o=e.end;return $n(n)&&(n=oc(n),r.dateFacetValueMap[t][bx(n)]=e.start),$n(o)&&(o=oc(o),r.dateFacetValueMap[t][xx(o)]=e.end),{...e,start:n,end:o}}function Fy(e,t){if(Cx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>dq(o,r,t))}}return e}function Wr(e){let t=Ey();return{request:{...e,facets:e.facets?.map(n=>Fy(n,t))},mappings:t}}function pq(e,t,r){return{...e,start:r.dateFacetValueMap[t][bx(e.start)]||e.start,end:r.dateFacetValueMap[t][xx(e.end)]||e.end}}function fq(e,t){return e.facetId in t.dateFacetValueMap}function mq(e,t){return fq(e,t)?{...e,values:e.values.map(r=>pq(r,e.facetId,t))}:e}function Or(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>mq(n,t))}}:e}d();c();l();u();d();c();l();u();var to=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Eb(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}),...(Cy()&&{pageId:Cy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ia(e)})}}});return function to(_x39,_x40){return _ref19.apply(this,arguments)}}();var wx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:mt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?vt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield to(t.configuration.analytics)))})}});return function wx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var rd=P("didYouMean/enable"),Rx=P("didYouMean/disable"),nd=P("didYouMean/automaticCorrections/disable"),Ix=P("didYouMean/automaticCorrections/enable"),Zt=P("didYouMean/correction",e=>_(e,H)),Mc=P("didYouMean/automaticCorrections/mode",e=>_(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var gq=P("history/undo"),hq=P("history/redo"),xt=P("history/snapshot"),G5=me("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(gq()),yield t(tt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),$5=me("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(hq()),yield t(tt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),tt=me("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var kn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function od(){return{contextValues:{}}}d();c();l();u();var id=()=>!1;d();c();l();u();function Ex(){return{contextValues:{}}}d();c();l();u();function Ty(){return{enabled:!0,tabs:{}}}function ad(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Fx(){return[]}d();c();l();u();function Yr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function sd(){return{}}d();c();l();u();function Tx(){return{}}d();c();l();u();function cd(){return{}}function wt(e){return{context:e.context||od(),dictionaryFieldContext:e.dictionaryFieldContext||Ex(),facetSet:e.facetSet||ga(),numericFacetSet:e.numericFacetSet||ma(),dateFacetSet:e.dateFacetSet||fa(),categoryFacetSet:e.categoryFacetSet||pa(),automaticFacetSet:e.automaticFacetSet??jl(),pagination:e.pagination||Yr(),query:e.query||ut(),tabSet:e.tabSet||cd(),advancedSearchQueries:e.advancedSearchQueries||kn(),staticFilterSet:e.staticFilterSet||Tx(),querySet:e.querySet||sd(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||Sa(),searchHub:e.searchHub||ua(),facetOptions:e.facetOptions||ad(),facetOrder:e.facetOrder??Fx(),debug:e.debug??id()}}d();c();l();u();var Wt=P("query/updateQuery",e=>_(e,{q:new $,enableQuerySyntax:new pe}));d();c();l();u();var Py=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(ee(t.insightCaseContext))),wa=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...ee(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Px=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),ud=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(ee(t.insightCaseContext))),ro=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...ee(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Kr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var kx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=Sq(e),n=yq(e);return Wr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Gn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield to(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{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.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function kx(_x49,_x50){return _ref24.apply(this,arguments)}}(),Sr=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield kx(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Sr(_x51,_x52){return _ref25.apply(this,arguments)}}(),Ox=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield kx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function Ox(_x53,_x54){return _ref26.apply(this,arguments)}}(),ld=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function ld(_x55,_x56){return _ref27.apply(this,arguments)}}(),dd=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,numberOfResults:0},r});return function dd(_x57,_x58){return _ref28.apply(this,arguments)}}();function yq(e){return Kr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function Sq(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Yo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Or(yield _this9.extra.apiClient.query(t,n),r),a=Date.now()-o,p=_this9.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(wa(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!i)return!J(f)&&!J(f.correctedQuery)?_this1.processNextDidYouMeanAutoCorrection(t):null;let m=a.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(xt(wt(_this1.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this10.automaticallyRetryQueryWithCorrection(o);return ze(i.response)?(_this10.dispatch(wa(i.response.error)),_this10.rejectWithValue(i.response.error)):(_this10.dispatch(xt(wt(_this10.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Sr(r));return _this11.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(xt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var _x=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(ee(t.insightCaseContext))),ky=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(ee(t.insightCaseContext)));var Ko=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Or(yield _this12.extra.apiClient.query(t,n),r),a=Date.now()-o,p=_this12.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(wa(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:a}=n.didYouMean,{results:p,queryCorrections:f,queryCorrection:m}=o;if(!i||!a)return null;let g=p.length===0&&f&&f.length!==0,A=!J(m)&&!J(m.correctedQuery);if(!g&&!A)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(xt(wt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this15.automaticallyRetryQueryWithCorrection(o);return ze(i.response)?(_this15.dispatch(wa(i.response.error)),_this15.rejectWithValue(i.response.error)):(_this15.dispatch(xt(wt(_this15.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:ky()})})()}processNextDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:ky()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Wt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Sr(r));return _this16.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(xt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...bt(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Or(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function Oy(_x63,_x64,_x65){return _Oy.apply(this,arguments)}function _Oy(){_Oy=_asyncToGenerator(function*(e,t,r){jc(e);let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Oy.apply(this,arguments)}function _y(_x66,_x67,_x68){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(e,t,r){jc(e);let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _y2.apply(this,arguments)}function Ny(_x69,_x70){return _Ny.apply(this,arguments)}function _Ny(){_Ny=_asyncToGenerator(function*(e,t){let r=new Ko({...t,analyticsAction:Py}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield Py().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield ld(e,a),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Ny.apply(this,arguments)}function Dy(_x71,_x72,_x73){return _Dy.apply(this,arguments)}function _Dy(){_Dy=_asyncToGenerator(function*(e,t,r){let n=new Ko({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),f=yield dd(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Dy.apply(this,arguments)}var Nx=me("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Oy(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Dx=me("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield _y(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),qx=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ny(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Mx=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dy(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var jx=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let i=Date.now(),a=Or(yield e.query(r,o),n),p=Date.now()-i,f=t.query?.q||"";return{response:a,duration:p,queryExecuted:f,requestExecuted:r}});return function jx(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),xe=me("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Oy(r,t,e.legacy);jc(r);let n=new Yo({...t}),o=e.next?qy(e.next):void 0,i=yield Sr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),pd=me("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return _y(r,t,e.legacy);jc(r);let n=new Yo({...t}),o=e.next?qy(e.next):void 0,i=yield Sr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),fd=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ny(r,t);let n=new Yo({...t}),o=qy({actionCause:"browseResults"}),i=yield ld(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),Ra=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dy(r,t,e.legacy);let n=new Yo({...t}),o=yield dd(r),i=yield n.fetchFromAPI(o);return yield n.process(i)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),md=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:H});let i=e.id,a=yield wx(i,t()),p=yield n.querySuggest(a);return ze(p)?r(p.error):{id:i,q:a.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),jc=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},qy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Jt=P("breadcrumb/deselectAll"),gd=P("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Ia=P("facet/updateFacetAutoSelection",e=>_(e,{allow:new pe({required:!0})}));d();c();l();u();d();c();l();u();var hd=class extends Jn{constructor(r){super(r);de(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??ut().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 Vx=()=>Fe("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new hd(e)),Lx=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var My={id:H},vq={...My,q:Ke},$ee=P("instantResults/register",e=>_(e,My)),yd=P("instantResults/updateQuery",e=>_(e,vq)),Hee=P("instantResults/clearExpired",e=>_(e,My));d();c();l();u();var Sd=new ne({required:!0,min:0}),vd=P("pagination/registerNumberOfResults",e=>_(e,Sd)),Ad=P("pagination/updateNumberOfResults",e=>_(e,Sd)),Cd=P("pagination/registerPage",e=>_(e,Sd)),no=P("pagination/updatePage",e=>_(e,Sd)),bd=P("pagination/nextPage"),xd=P("pagination/previousPage");d();c();l();u();d();c();l();u();var Xo=(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:ia(e)}});var Ea=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(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&&Xo(e.configuration.analytics,t,r)),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var oo=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(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:vt.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 to(e.configuration.analytics,t))),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function oo(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var jy=()=>Fe("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),io=e=>Fe("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||kn().aq,cq:r.advancedSearchQueries?.cq||kn().cq,dq:r.advancedSearchQueries?.dq||kn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var Vy=()=>Fe("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),Ux=()=>({actionCause:"didYouMeanClick"}),Qx=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var zte=new Y({values:{undoneQuery:Ke},options:{required:!0}}),Bx=()=>Fe("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var Fa=P("trigger/query/ignore",e=>_(e,new $({emptyAllowed:!0,required:!0}))),Ta=P("trigger/query/modification",e=>_(e,new Y({values:{originalQuery:We,modification:We}})));d();c();l();u();d();c();l();u();function Vc(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Gx(e){return Kr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Ly={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function Aq(e){return Kr(e).map(t=>{let r=Ly[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Cq(e){return[...Aq(e.facetSet??{}),...Gx(e.numericFacetSet??{}),...Gx(e.dateFacetSet??{}),...Kr(e.categoryFacetSet??{})]}function bq(e){return Cq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function wd(e){return Vc(bq(e),e.facetOrder??[])}var ao=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=Rq(e),n=wd(e),o=xq(e),i=yield oo(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Wr({...i,...(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:a(),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 ao(_x98,_x99){return _ref40.apply(this,arguments)}}();function xq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(wq).filter(r=>r.currentValues.length>0):void 0}function wq(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function Rq(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Iq(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function Iq(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var so=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Or(yield _this17.extra.apiClient.search(r,n),t),a=Date.now()-o,p=_this17.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(io(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:f}=n;if(!o||!i)return null;let m=a.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(xt(wt(_this19.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this20.automaticallyRetryQueryWithCorrection(o);return ze(i.response)?(_this20.dispatch(io(i.response.error)),_this20.rejectWithValue(i.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(xt(wt(_this20.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Vy()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Vy()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(Fa("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let i=_this21.getCurrentQuery(),a=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return ze(a.response)?(_this21.dispatch(io(a.response.error)),_this21.rejectWithValue(a.response.error)):(_this21.dispatch(xt(wt(_this21.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Bx()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...bt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(xt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield ao(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Zt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Ta({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield ao(_this23.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 Jre=me("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Rd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),ene=me("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Qy(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),tne=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield By(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),rne=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Pq(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),nne=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return Uy(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),Eq=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield ao(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function Eq(_x112,_x113){return _ref46.apply(this,arguments)}}(),Fq=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield oo(e);return Wr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function Fq(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),Tq=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield ao(e,t);return r.request.numberOfResults=0,r});return function Tq(_x117,_x118){return _ref48.apply(this,arguments)}}(),$x=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Uy(_x119,_x120){return _Uy.apply(this,arguments)}function _Uy(){_Uy=_asyncToGenerator(function*(e,t){_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new so({...t,analyticsAction:Vx()},m=>{t.dispatch(yd({q:m,id:e.id}))}),a=yield Fq(o,r,n),p=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),f=yield i.process(p);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return _Uy.apply(this,arguments)}function Qy(_x121,_x122,_x123){return _Qy.apply(this,arguments)}function _Qy(){_Qy=_asyncToGenerator(function*(e,t,r){$x(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=new so({...t,analyticsAction:r}),f=yield ao(e,a),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _Qy.apply(this,arguments)}function By(_x124,_x125){return _By.apply(this,arguments)}function _By(){_By=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield jy().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new so({...e,analyticsAction:jy()}),p=yield Eq(t,i),f=yield a.fetchFromAPI(p,{origin:"mainSearch"});return yield a.process(f)});return _By.apply(this,arguments)}function Pq(_x126,_x127,_x128){return _Pq.apply(this,arguments)}function _Pq(){_Pq=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=new so({...e,analyticsAction:t}),f=yield Tq(r,a),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _Pq.apply(this,arguments)}function Rd(_x129,_x130,_x131){return _Rd.apply(this,arguments)}function _Rd(){_Rd=_asyncToGenerator(function*(e,t,r){$x(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield ao(e,a),f=new so({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _Rd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var Hx=ct(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var vr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=$y(e),o=kq(e),i=Oq(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield oo(e,r):Ea(e,t,r);return Wr({...a,...(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}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Gy(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:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function vr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function Gy(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function kq(e){return Vc(Nq(e),e.facetOrder??[])}function Oq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(_q).filter(r=>r.currentValues.length>0):void 0}function _q(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function Nq(e){return Dq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Dq(e){return[...qq(e.facetSet??{}),...zx(e.numericFacetSet??{}),...zx(e.dateFacetSet??{}),...Kr(e.categoryFacetSet??{})]}function qq(e){return Kr(e).map(t=>{let r=Ly[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zx(e){return Kr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function $y(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Hx(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}var co=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Or(yield _this24.extra.apiClient.search(r,n),t),a=Date.now()-o,p=_this24.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ze(t.response)?(this.dispatch(io(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!i)return!J(f)&&!J(f.correctedQuery)?_this26.processModernDidYouMeanAutoCorrection(t):null;let m=a.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(xt(wt(_this26.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this27.automaticallyRetryQueryWithCorrection(o);return ze(i.response)?(_this27.dispatch(io(i.response.error)),_this27.rejectWithValue(i.response.error)):(_this27.dispatch(xt(wt(_this27.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(Fa("")),null;let i=_this28.getCurrentQuery(),a=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return ze(a.response)?(_this28.dispatch(io(a.response.error)),_this28.rejectWithValue(a.response.error)):(_this28.dispatch(xt(wt(_this28.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(xt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return zn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Qx(),o=yield _this29.fetchFromAPI(yield vr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Zt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(Ta({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield vr(_this30.getState(),_this30.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 Pa=me("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new $,enableQuerySyntax:new pe,clearFilters:new pe}),e.clearFilters&&(r(Jt()),r(gd())),r(Ia({allow:!0})),r(Wt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(no(1))}),Wx=P("search/updateSearchAction"),_e=me("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Rd(r,t,e.legacy);Yx(r);let n=e.next?Kx(e.next):void 0,o=yield vr(r,t.extra.navigatorContext,n),i=new co({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Zr=me("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Yx(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Qy(r,t,e.legacy);let n=new co({...t,analyticsAction:e.next}),o=yield vr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),uo=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return By(t,r);let n=nx("browseResults",t.getState),o=new co({...t,analyticsAction:n}),i=yield Mq(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),ka=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Rd(r,t,e.legacy);let n=new co({...t,analyticsAction:{}}),o=yield Vq(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),soe=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Uy(e,t);_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=Kx(Lx()),a=yield jq(r,t.extra.navigatorContext,n,o,i),p=new co({...t,analyticsAction:i},g=>{t.dispatch(yd({q:g,id:e.id}))}),f=yield p.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),m=yield p.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),Mq=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function Mq(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),jq=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let i=Ea(e,t,o);return Wr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function jq(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),Vq=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request.numberOfResults=0,n});return function Vq(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Yx=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Kx=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Xx(_x158,_x159){return _Xx.apply(this,arguments)}function _Xx(){_Xx=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Xx.apply(this,arguments)}var Lc=me("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield Xx(o,e),a=yield t.apiClient.html(i);return ze(a)?n(a.error):{content:a.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),Id=P("resultPreview/next"),Ed=P("resultPreview/previous"),Jx=P("resultPreview/prepare",e=>_(e,{results:new oe({required:!0})})),Zx=2048,Fd=me("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=QA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Zx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Zx} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Hy(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var zy=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Hy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Wy=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Oa=fe(Hy(),e=>{e.addCase(Lc.pending,t=>{t.isLoading=!0}).addCase(Lc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(_e.fulfilled,(t,r)=>{zy(t),t.resultsWithPreview=Wy(r.payload.response.results)}).addCase(uo.fulfilled,(t,r)=>{zy(t),t.resultsWithPreview=t.resultsWithPreview.concat(Wy(r.payload.response.results))}).addCase(Zr.fulfilled,zy).addCase(Jx,(t,r)=>{t.resultsWithPreview=Wy(r.payload.results)}).addCase(Id,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Ed,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Fd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var lo=(e,t)=>{let r=e;return J(r[t])?J(e.raw[t])?null:e.raw[t]:r[t]},Lq=e=>t=>e.every(r=>!J(lo(t,r))),Uq=e=>t=>e.every(r=>J(lo(t,r))),Qq=(e,t)=>r=>{let n=ew(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},Bq=(e,t)=>r=>{let n=ew(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},ew=(e,t)=>{let r=lo(t,e);return ju(r)?r:[r]},tw={getResultProperty:lo,fieldsMustBeDefined:Lq,fieldsMustNotBeDefined:Uq,fieldMustMatch:Qq,fieldMustNotMatch:Bq};function Td(e){return e.search.response.searchUid!==""}function rw(e,t,r){return e.search.results.find(n=>lo(n,t)===r)}var Yy=ct(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var _a=P("app/setError");function Ky(e,t){let r=t.payload??null;r&&(e.response=bt().response,e.results=[],e.questionAnswer=Xi()),e.error=r,e.isLoading=!1}function Xy(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function Gq(e,t){Xy(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function nw(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function $q(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Ee=fe(bt(),e=>{e.addCase(_e.rejected,(t,r)=>Ky(t,r)),e.addCase(uo.rejected,(t,r)=>Ky(t,r)),e.addCase(Zr.rejected,(t,r)=>Ky(t,r)),e.addCase(_e.fulfilled,(t,r)=>{Gq(t,r)}),e.addCase(uo.fulfilled,(t,r)=>{Xy(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Zr.fulfilled,(t,r)=>{Xy(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(ka.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(_e.pending,nw),e.addCase(uo.pending,$q),e.addCase(Zr.pending,nw),e.addCase(Wx,(t,r)=>{t.searchAction=r.payload}),e.addCase(_a,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Pd=fe(ua(),e=>{e.addCase(td,(t,r)=>r.payload).addCase(tt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ca,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var ow=class extends Error{constructor(t){super(t[0].message);de(this,"issues");this.name="SchemaError",this.issues=t}};var _n="uninitialized",Jy="pending",Qc="fulfilled",Bc="rejected";function iw(e){return{status:e,isUninitialized:e===_n,isLoading:e===Jy,isSuccess:e===Qc,isError:e===Bc}}var aw=Ur;function Aw(e,t){if(e===t||!(aw(e)&&aw(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=Aw(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function eS(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function Hq(e){return new RegExp("(^|:)//").test(e)}function zq(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function oS(e){return e!=null}function sw(e){return[...(e?.values()??[])].filter(oS)}function Wq(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Yq=e=>e.replace(/\/$/,""),Kq=e=>e.replace(/^\//,"");function Xq(e,t){if(!e)return t;if(!t)return e;if(Hq(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Yq(e),t=Kq(t),`${e}${r}${t}`}function _d(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var tS=()=>new Map,Zq=e=>{let t=new s.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},Jq=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},cw=(...e)=>v(...e),eM=e=>e.status>=200&&e.status<=299,tM=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function uw(e){if(!Ur(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var rM=e=>typeof e=="object"&&(Ur(e)||Array.isArray(e)||typeof e.toJSON=="function");function Cw({baseUrl:e,prepareHeaders:t=A=>A,fetchFn:r=cw,paramsSerializer:n,isJsonContentType:o=tM,jsonContentType:i="application/json",jsonReplacer:a,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===cw&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(x,h,y){let{getState:b,extra:w,endpoint:I,forced:F,type:E}=h,k,{url:T,headers:q=new C(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:V=m??eM,timeout:B=p,...L}=typeof x=="string"?{url:x}:x,N={...g,signal:B?Jq(h.signal,Zq(B)):h.signal,...L};q=new C(uw(q)),N.headers=(yield t(q,{getState:b,arg:x,extra:w,endpoint:I,forced:F,type:E,extraOptions:y}))||q;let D=rM(N.body);if(N.body!=null&&!D&&typeof N.body!="string"&&N.headers.delete("content-type"),!N.headers.has("content-type")&&D&&N.headers.set("content-type",i),D&&o(N.headers)&&(N.body=JSON.stringify(N.body,a)),N.headers.has("accept")||(Q==="json"?N.headers.set("accept","application/json"):Q==="text"&&N.headers.set("accept","text/plain, text/html, */*")),G){let ce=~T.indexOf("?")?"&":"?",ve=n?n(G):new URLSearchParams(uw(G));T+=ce+ve}T=Xq(e,T);let M=new Request(T,N);k={request:new Request(T,N)};let z;try{z=yield r(M)}catch(ce){return{error:{status:(ce instanceof Error||typeof DOMException<"u"&&ce instanceof DOMException)&&ce.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:k}}let re=z.clone();k.response=re;let Z,K="";try{let ce;if(yield Promise.all([A(z,Q).then(ve=>Z=ve,ve=>ce=ve),re.text().then(ve=>K=ve,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:z.status,data:K,error:String(ce)},meta:k}}return V(z,Z)?{data:Z,meta:k}:{error:{status:z.status,data:Z},meta:k}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function A(_x167,_x168){return _A2.apply(this,arguments)}function _A2(){_A2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let y=yield x.text();return y.length?JSON.parse(y):null}return x.text()});return _A2.apply(this,arguments)}}var Na=class{constructor(e,t=void 0){de(this,"value");de(this,"meta");this.value=e,this.meta=t}};function nM(){return _nM.apply(this,arguments)}function _nM(){_nM=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let p=setTimeout(()=>i(),o);if(r){let f=()=>{clearTimeout(p),a(new Error("Aborted"))};r.aborted?(clearTimeout(p),a(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})});return _nM.apply(this,arguments)}function bw(e,t){throw Object.assign(new Na({error:e,meta:t}),{throwImmediately:!0})}function Zy(e){e.aborted&&bw({status:"CUSTOM_ERROR",error:"Aborted"})}var lw={},oM=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let i=[5,(t||lw).maxRetries,(o||lw).maxRetries].filter(g=>g!==void 0),[a]=i.slice(-1),f={maxRetries:a,backoff:nM,retryCondition:(g,A,{attempt:x})=>x<=a,...t,...o},m=0;for(;;){Zy(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Na(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Na)return g.value;throw g}if(g instanceof Na){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Zy(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(A){throw Zy(n.signal),A}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),xw=Object.assign(oM,{fail:bw}),Dd="__rtkq/",iM="online",aM="offline";var ww="focused";var iS=P(`${Dd}${ww}`),Rw=P(`${Dd}un${ww}`),aS=P(`${Dd}${iM}`),Iw=P(`${Dd}${aM}`);var Hc="query",Ew="mutation",Fw="infinitequery";function qd(e){return e.type===Hc}function sM(e){return e.type===Ew}function Md(e){return e.type===Fw}function Nd(e){return qd(e)||Md(e)}function sS(e,t,r,n,o,i){let a=cM(e)?e(t,r,n,o):e;return a?eS(a,oS,p=>i(Tw(p))):[]}function cM(e){return typeof e=="function"}function Tw(e){return typeof e=="string"?{type:e}:e}function uM(e,t){return e.catch(t)}var Da=(e,t)=>e.endpointDefinitions[t],Gc=Symbol("forceQueryFn"),rS=e=>typeof e[Gc]=="function";function lM({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let p=T=>a(T)?.runningQueries,f=T=>a(T)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:A}=o.internalActions;return{buildInitiateQuery:F,buildInitiateInfiniteQuery:E,buildInitiateMutation:k,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function x(T,q){return G=>{let Q=Da(i,T),V=e({queryArgs:q,endpointDefinition:Q,endpointName:T});return p(G)?.get(V)}}function h(T,q){return G=>f(G)?.get(q)}function y(){return T=>sw(p(T))}function b(){return T=>sw(f(T))}function w(T){}function I(T,q){let G=(Q,{subscribe:V=!0,forceRefetch:B,subscriptionOptions:L,[Gc]:N,...D}={})=>(M,W)=>{let z=e({queryArgs:Q,endpointDefinition:q,endpointName:T}),re,Z={...D,type:Hc,subscribe:V,forceRefetch:B,subscriptionOptions:L,endpointName:T,originalArgs:Q,queryCacheKey:z,[Gc]:N};if(qd(q))re=t(Z);else{let{direction:Ie,initialPageParam:De,refetchCachedPages:Pe}=D;re=r({...Z,direction:Ie,initialPageParam:De,refetchCachedPages:Pe})}let K=o.endpoints[T].select(Q),ce=M(re),ve=K(W());let{requestId:Le,abort:nt}=ce,$e=ve.requestId!==Le,Je=p(M)?.get(z),et=()=>K(W()),Te=Object.assign(N?ce.then(et):$e&&!Je?Promise.resolve(ve):Promise.all([Je,ce]).then(et),{arg:Q,requestId:Le,subscriptionOptions:L,queryCacheKey:z,abort:nt,unwrap(){return _asyncToGenerator(function*(){let Ie=yield Te;if(Ie.isError)throw Ie.error;return Ie.data})()},refetch:Ie=>M(G(Q,{subscribe:!1,forceRefetch:!0,...Ie})),unsubscribe(){V&&M(m({queryCacheKey:z,requestId:Le}))},updateSubscriptionOptions(Ie){Te.subscriptionOptions=Ie,M(A({endpointName:T,requestId:Le,queryCacheKey:z,options:Ie}))}});if(!Je&&!$e&&!N){let Ie=p(M);Ie.set(z,Te),Te.then(()=>{Ie.delete(z)})}return Te};return G}function F(T,q){return I(T,q)}function E(T,q){return I(T,q)}function k(T){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(V,B)=>{let L=n({type:"mutation",endpointName:T,originalArgs:q,track:G,fixedCacheKey:Q}),N=V(L);let{requestId:D,abort:M,unwrap:W}=N,z=uM(N.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),re=()=>{V(g({requestId:D,fixedCacheKey:Q}))},Z=Object.assign(z,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(V);return K.set(D,Z),Z.then(()=>{K.delete(D)}),Q&&(K.set(Q,Z),Z.then(()=>{K.get(Q)===Z&&K.delete(Q)})),Z}}}var Pw=class extends ow{constructor(t,r,n,o){super(t);de(this,"value");de(this,"schemaName");de(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Zo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Jo(_x172,_x173,_x174,_x175){return _Jo.apply(this,arguments)}function _Jo(){_Jo=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Pw(o.issues,t,r,n);return o.value});return _Jo.apply(this,arguments)}function dw(e){return e}var Uc=(e={})=>({...e,[xc]:!0});function dM({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,N,D,M)=>(W,z)=>{let re=r[L],Z=n({queryArgs:N,endpointDefinition:re,endpointName:L});if(W(o.internalActions.queryResultPatched({queryCacheKey:Z,patches:D})),!M)return;let K=o.endpoints[L].select(N)(z()),ce=sS(re.providesTags,K.data,void 0,N,{},i);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function A(L,N,D=0){let M=[N,...L];return D&&M.length>D?M.slice(0,-1):M}function x(L,N,D=0){let M=[...L,N];return D&&M.length>D?M.slice(1):M}let h=(L,N,D,M=!0)=>(W,z)=>{let Z=o.endpoints[L].select(N)(z()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(Z.status===_n)return K;let ce;if("data"in Z)if(jt(Z.data)){let[ve,Le,nt]=Nh(Z.data,D);K.patches.push(...Le),K.inversePatches.push(...nt),ce=ve}else ce=D(Z.data),K.patches.push({op:"replace",path:[],value:ce}),K.inversePatches.push({op:"replace",path:[],value:Z.data});return K.patches.length===0||W(o.util.patchQueryData(L,N,K.patches,M)),K},y=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[Gc]:()=>({data:D})})),b=(L,N)=>L.query&&L[N]?L[N]:dw,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:z,getState:re,extra:Z}){let K=r[L.endpointName],{metaSchema:ce,skipSchemaValidation:ve=m}=K,Le=L.type===Hc;try{let nt=dw,$e={signal:N,abort:D,dispatch:z,getState:re,extra:Z,endpoint:L.endpointName,type:L.type,forced:Le?I(L,re()):void 0,queryCacheKey:Le?L.queryCacheKey:void 0},Je=Le?L[Gc]:void 0,et,Te=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(De,Pe,gt,Ct){if(Pe==null&&De.pages.length)return Promise.resolve({data:De});let Ir={queryArg:L.originalArgs,pageParam:Pe},ar=yield Ie(Ir),Vr=Ct?A:x;return{data:{pages:Vr(De.pages,ar.data,gt),pageParams:Vr(De.pageParams,Pe,gt)},meta:ar.meta}});return function Te(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Ie(_x182){return _Ie.apply(this,arguments)}function _Ie(){_Ie=_asyncToGenerator(function*(De){let Pe,{extraOptions:gt,argSchema:Ct,rawResponseSchema:Ir,responseSchema:ar}=K;if(Ct&&!Zo(ve,"arg")&&(De=yield Jo(Ct,De,"argSchema",{})),Je?Pe=Je():K.query?(nt=b(K,"transformResponse"),Pe=yield t(K.query(De),$e,gt)):Pe=yield K.queryFn(De,$e,gt,Er=>t(Er,$e,gt)),typeof process<"u",Pe.error)throw new Na(Pe.error,Pe.meta);let{data:Vr}=Pe;Ir&&!Zo(ve,"rawResponse")&&(Vr=yield Jo(Ir,Pe.data,"rawResponseSchema",Pe.meta));let fr=yield nt(Vr,Pe.meta,De);return ar&&!Zo(ve,"response")&&(fr=yield Jo(ar,fr,"responseSchema",Pe.meta)),{...Pe,data:fr}});return _Ie.apply(this,arguments)}if(Le&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:De}=K,{maxPages:Pe=1/0}=De,gt=L.refetchCachedPages??De.refetchCachedPages??!0,Ct,Ir={pages:[],pageParams:[]},ar=a.selectQueryEntry(re(),L.queryCacheKey)?.data,fr=I(L,re())&&!L.direction||!ar?Ir:ar;if("direction"in L&&L.direction&&fr.pages.length){let Er=L.direction==="backward",ku=(Er?kw:nS)(De,fr,L.originalArgs);Ct=yield Te(fr,ku,Pe,Er)}else{let{initialPageParam:Er=De.initialPageParam}=L,zs=ar?.pageParams??[],ku=zs[0]??Er,Fk=zs.length;if(Ct=yield Te(fr,ku,Pe),Je&&(Ct={data:Ct.data.pages[0]}),gt)for(let Qv=1;Qv<Fk;Qv++){let Tk=nS(De,Ct.data,L.originalArgs);Ct=yield Te(Ct.data,Tk,Pe)}}et=Ct}else et=yield Ie(L.originalArgs);return ce&&!Zo(ve,"meta")&&et.meta&&(et.meta=yield Jo(ce,et.meta,"metaSchema",et.meta)),W(et.data,Uc({fulfilledTimeStamp:Date.now(),baseQueryMeta:et.meta}))}catch(nt){let $e=nt;if($e instanceof Na){let Je=b(K,"transformErrorResponse"),{rawErrorResponseSchema:et,errorResponseSchema:Te}=K,{value:Ie,meta:De}=$e;try{et&&!Zo(ve,"rawErrorResponse")&&(Ie=yield Jo(et,Ie,"rawErrorResponseSchema",De)),ce&&!Zo(ve,"meta")&&(De=yield Jo(ce,De,"metaSchema",De));let Pe=yield Je(Ie,De,L.originalArgs);return Te&&!Zo(ve,"errorResponse")&&(Pe=yield Jo(Te,Pe,"errorResponseSchema",De)),M(Pe,Uc({baseQueryMeta:De}))}catch(Pe){$e=Pe}}try{if($e instanceof Pw){let Je={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Le?L.queryCacheKey:void 0};K.onSchemaFailure?.($e,Je),p?.($e,Je);let{catchSchemaFailure:et=f}=K;if(et)return M(et($e,Je),Uc({baseQueryMeta:$e._bqMeta}))}}catch(Je){$e=Je}throw typeof process<"u",console.error($e),$e}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function I(L,N){let D=a.selectQueryEntry(N,L.queryCacheKey),M=a.selectConfig(N).refetchOnMountOrArgChange,W=D?.fulfilledTimeStamp,z=L.forceRefetch??(L.subscribe&&M);return z?z===!0||(Number(new Date)-Number(W))/1e3>=z:!1}let F=()=>me(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return Uc({startedTimeStamp:Date.now(),...(Md(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=a.selectQueryEntry(M,N.queryCacheKey),z=W?.fulfilledTimeStamp,re=N.originalArgs,Z=W?.originalArgs,K=r[N.endpointName],ce=N.direction;return rS(N)?!0:W?.status==="pending"?!1:I(N,M)||qd(K)&&K?.forceRefetch?.({currentArg:re,previousArg:Z,endpointState:W,state:M})?!0:!(z&&!ce)},dispatchConditionRejection:!0}),E=F(),k=F(),T=me(`${e}/executeMutation`,w,{getPendingMeta(){return Uc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let z=q(D)&&D.force,re=G(D)&&D.ifOlderThan,Z=(ce=!0)=>{let ve={forceRefetch:ce,subscribe:!1};return o.endpoints[L].initiate(N,ve)},K=o.endpoints[L].select(N)(W());if(z)M(Z());else if(re){let ce=K?.fulfilledTimeStamp;if(!ce){M(Z());return}(Number(new Date)-Number(new Date(ce)))/1e3>=re&&M(Z())}else M(Z(!1))};function V(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:na(vl(L),V(N)),matchFulfilled:na(Fn(L),V(N)),matchRejected:na(Go(L),V(N))}}return{queryThunk:E,mutationThunk:T,infiniteQueryThunk:k,prefetch:Q,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:B}}function nS(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function kw(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ow(e,t,r,n){return sS(r[e.meta.arg.endpointName][t],Fn(e)?e.payload:void 0,Rc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function pw(e){return Ht(e)?pl(e):e}function kd(e,t,r){let n=e[t];n&&r(n)}function $c(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function fw(e,t,r){let n=e[$c(t)];n&&r(n)}var Od={};function pM({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=P(`${e}/resetApiState`);function A(V,B,L,N){var D;V[D=B.queryCacheKey]??(V[D]={status:_n,endpointName:B.endpointName}),kd(V,B.queryCacheKey,M=>{M.status=Jy,M.requestId=L&&M.requestId?M.requestId:N.requestId,B.originalArgs!==void 0&&(M.originalArgs=B.originalArgs),M.startedTimeStamp=N.startedTimeStamp;let W=o[N.arg.endpointName];Md(W)&&"direction"in B&&(M.direction=B.direction)})}function x(V,B,L,N){kd(V,B.arg.queryCacheKey,D=>{if(D.requestId!==B.requestId&&!N)return;let{merge:M}=o[B.arg.endpointName];if(D.status=Qc,M){if(D.data!==void 0){let{fulfilledTimeStamp:W,arg:z,baseQueryMeta:re,requestId:Z}=B,K=Qo(D.data,ce=>M(ce,L,{arg:z.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:Z}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?Aw(Ht(D.data)?lC(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=$o({name:`${e}/queries`,initialState:Od,reducers:{removeQueryResult:{reducer(V,{payload:{queryCacheKey:B}}){delete V[B]},prepare:oa()},cacheEntriesUpserted:{reducer(V,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;A(V,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),x(V,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:V=>({payload:V.map(N=>{let{endpointName:D,arg:M,value:W}=N,z=o[D];return{queryDescription:{type:Hc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:z,endpointName:D})},value:W}}),meta:{[xc]:!0,requestId:Ic(),timestamp:Date.now()}})},queryResultPatched:{reducer(V,{payload:{queryCacheKey:B,patches:L}}){kd(V,B,N=>{N.data=Dh(N.data,L.concat())})},prepare:oa()}},extraReducers(V){V.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=rS(N);A(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=rS(L.arg);x(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{kd(B,N.queryCacheKey,z=>{if(!L){if(z.requestId!==D)return;z.status=Bc,z.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=a(L);for(let[D,M]of Object.entries(N))(M?.status===Qc||M?.status===Bc)&&(B[D]=M)})}}),y=$o({name:`${e}/mutations`,initialState:Od,reducers:{removeMutationResult:{reducer(V,{payload:B}){let L=$c(B);L in V&&delete V[L]},prepare:oa()}},extraReducers(V){V.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[$c(L)]={requestId:N,status:Jy,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&fw(B,N,D=>{D.requestId===N.requestId&&(D.status=Qc,D.data=L,D.fulfilledTimeStamp=N.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:N,meta:D})=>{D.arg.track&&fw(B,D,M=>{M.requestId===D.requestId&&(M.status=Bc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=a(L);for(let[D,M]of Object.entries(N))(M?.status===Qc||M?.status===Bc)&&D!==M?.requestId&&(B[D]=M)})}}),b={tags:{},keys:{}},w=$o({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(V,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){I(V,M);for(let{type:z,id:re}of W){let Z=(N=(L=V.tags)[z]??(L[z]={}))[D=re||"__internal_without_id"]??(N[D]=[]);Z.includes(M)||Z.push(M)}V.keys[M]=W}},prepare:oa()}},extraReducers(V){V.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(p,(B,L)=>{var D,M,W;let{provided:N}=a(L);for(let[z,re]of Object.entries(N.tags??{}))for(let[Z,K]of Object.entries(re)){let ce=(M=(D=B.tags)[z]??(D[z]={}))[W=Z||"__internal_without_id"]??(M[W]=[]);for(let ve of K)ce.includes(ve)||ce.push(ve),B.keys[ve]=N.keys[ve]}}).addMatcher(Qr(Fn(t),Rc(t)),(B,L)=>{F(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let N=L.payload.map(({queryDescription:D,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:D}}));F(B,N)})}});function I(V,B){let L=pw(V.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=V.tags[D]?.[M];W&&(V.tags[D][M]=pw(W).filter(z=>z!==B))}delete V.keys[B]}function F(V,B){let L=B.map(N=>{let D=Ow(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(V,w.actions.updateProvidedBy(L))}let E=$o({name:`${e}/subscriptions`,initialState:Od,reducers:{updateSubscriptionOptions(V,B){},unsubscribeQueryResult(V,B){},internal_getRTKQSubscriptions(){}}}),k=$o({name:`${e}/internalSubscriptions`,initialState:Od,reducers:{subscriptionsUpdated:{reducer(V,B){return Dh(V,B.payload)},prepare:oa()}}}),T=$o({name:`${e}/config`,initialState:{online:Wq(),focused:zq(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(V,{payload:B}){V.middlewareRegistered=V.middlewareRegistered==="conflict"||i!==B?"conflict":!0}},extraReducers:V=>{V.addCase(aS,B=>{B.online=!0}).addCase(Iw,B=>{B.online=!1}).addCase(iS,B=>{B.focused=!0}).addCase(Rw,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Ji({queries:h.reducer,mutations:y.reducer,provided:w.reducer,subscriptions:k.reducer,config:T.reducer}),G=(V,B)=>q(g.match(B)?void 0:V,B),Q={...T.actions,...h.actions,...E.actions,...k.actions,...y.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var ei=Symbol.for("RTKQ/skipToken"),_w={status:_n},mw=Qo(_w,()=>{}),gw=Qo(_w,()=>{});function fM({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>mw,o=E=>gw;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:a,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function i(E){return{...E,...iw(E.status)}}function a(E){return E[t]}function p(E){return a(E)?.queries}function f(E,k){return p(E)?.[k]}function m(E){return a(E)?.mutations}function g(E){return a(E)?.config}function A(E,k,T){return q=>{if(q===ei)return r(n,T);let G=e({queryArgs:q,endpointDefinition:k,endpointName:E});return r(V=>f(V,G)??mw,T)}}function x(E,k){return A(E,k,i)}function h(E,k){let{infiniteQueryOptions:T}=k;function q(G){let Q={...G,...iw(G.status)},{isLoading:V,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:I(T,Q.data,Q.originalArgs),hasPreviousPage:F(T,Q.data,Q.originalArgs),isFetchingNextPage:V&&N,isFetchingPreviousPage:V&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return A(E,k,q)}function y(){return E=>{let k;return typeof E=="object"?k=$c(E)??ei:k=E,r(k===ei?o:G=>a(G)?.mutations?.[k]??gw,i)}}function b(E,k){let T=E[t],q=new Set,G=eS(k,oS,Tw);for(let Q of G){let V=T.provided.tags[Q.type];if(!V)continue;let B=(Q.id!==void 0?V[Q.id]:Object.values(V).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let V=T.queries[Q];return V?{queryCacheKey:Q,endpointName:V.endpointName,originalArgs:V.originalArgs}:[]})}function w(E,k){return eS(Object.values(p(E)),T=>T?.endpointName===k&&T.status!==_n,T=>T.originalArgs)}function I(E,k,T){return k?nS(E,k,T)!=null:!1}function F(E,k,T){return!k||!E.getPreviousPageParam?!1:kw(E,k,T)!=null}}var hw=WeakMap?new WeakMap:void 0,yw=({endpointName:e,queryArgs:t})=>{let r="",n=hw?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=Ur(a)?Object.keys(a).sort().reduce((p,f)=>(p[f]=a[f],p),{}):a,a));Ur(t)&&hw?.set(t,o),r=o}return`${e}(${r})`};function mM(...e){return function(r){let n=Cc(m=>r.extractRehydrationInfo?.(m,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(m){let g=yw;if("serializeQueryArgs"in m.endpointDefinition){let A=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=A(x);return typeof h=="string"?h:yw({...x,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(m){m()},apiUid:Ic(),extractRehydrationInfo:n,hasRehydrationInfo:Cc(m=>n(m)!=null)},a={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let A of m)o.tagTypes.includes(A)||o.tagTypes.push(A);if(g)for(let[A,x]of Object.entries(g))typeof x=="function"?x(Da(i,A)):Object.assign(Da(i,A)||{},x);return a}},p=e.map(m=>m.init(a,o,i));function f(m){let g=m.endpoints({query:A=>({...A,type:Hc}),mutation:A=>({...A,type:Ew}),infiniteQuery:A=>({...A,type:Fw})});for(let[A,x]of Object.entries(g)){if(m.overrideExisting!==!0&&A in i.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(zt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[A]=x;for(let h of p)h.injectEndpoint(A,x)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function On(e,...t){return Object.assign(e,...t)}var gM=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(b,w)=>{if(p.match(w)){let{queryCacheKey:F,requestId:E,options:k}=w.payload,T=b.get(F);return T?.has(E)&&T.set(E,k),!0}if(f.match(w)){let{queryCacheKey:F,requestId:E}=w.payload,k=b.get(F);return k&&k.delete(E),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:F,requestId:E}}=w,k=_d(b,F.queryCacheKey,tS);return F.subscribe&&k.set(E,F.subscriptionOptions??k.get(E)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:F,arg:E,requestId:k}}=w;if(F&&E.subscribe){let T=_d(b,E.queryCacheKey,tS);T.set(k,E.subscriptionOptions??T.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(b,w)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=m(r.currentSubscriptions,b),F=!0;if(I){a||(a=setTimeout(()=>{let T=y(r.currentSubscriptions),[,q]=Nh(i,()=>T);w.next(e.internalActions.subscriptionsUpdated(q)),i=T,a=null},500));let E=typeof b.type=="string"&&!!b.type.startsWith(o),k=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;F=!E&&!k}return[F,!1]}},hM=2147483647/1e3-1,yM=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:p,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:A}=t.internalActions,x=Qr(g.match,r.fulfilled,r.rejected,A.match);function h(E){let k=o.currentSubscriptions.get(E);return k?k.size>0:!1}let y={};function b(E){for(let k of E.values())k?.abort?.()}let w=(E,k)=>{let T=k.getState(),q=a(T);if(x(E)){let G;if(A.match(E))G=E.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(E)?E.payload:E.meta.arg;G=[Q]}I(G,k,q)}if(t.util.resetApiState.match(E)){for(let[G,Q]of Object.entries(y))Q&&clearTimeout(Q),delete y[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(E)){let{queries:G}=n.extractRehydrationInfo(E);I(Object.keys(G),k,q)}};function I(E,k,T){let q=k.getState();for(let G of E){let Q=i(q,G);Q?.endpointName&&F(G,Q.endpointName,k,T)}}function F(E,k,T,q){let Q=Da(n,k)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let V=Math.max(0,Math.min(Q,hM));if(!h(E)){let B=y[E];B&&clearTimeout(B),y[E]=setTimeout(()=>{if(!h(E)){let L=i(T.getState(),E);L?.endpointName&&T.dispatch(p(L.endpointName,L.originalArgs))?.abort(),T.dispatch(m({queryCacheKey:E}))}delete y[E]},V*1e3)}}return w},Sw=new Error("Promise never resolved before cacheEntryRemoved."),SM=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:p}})=>{let f=Al(n),m=Al(o),g=Fn(n,o),A={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(T,q,G){let Q=A[T];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(T){let q=A[T];q&&(delete A[T],q.cacheEntryRemoved())}function I(T){let{arg:q,requestId:G}=T.meta,{endpointName:Q,originalArgs:V}=q;return[Q,V,G]}let F=(T,q,G)=>{let Q=E(T);function V(B,L,N,D){let M=a(G,L),W=a(q.getState(),L);!M&&W&&k(B,D,L,q,N)}if(n.pending.match(T)){let[B,L,N]=I(T);V(B,Q,N,L)}else if(y.match(T))for(let{queryDescription:B,value:L}of T.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;V(N,M,T.meta.requestId,D),b(M,L,{})}else if(o.pending.match(T)){if(q.getState()[t].mutations[Q]){let[L,N,D]=I(T);k(L,N,Q,q,D)}}else if(g(T))b(Q,T.payload,T.meta.baseQueryMeta);else if(x.match(T)||h.match(T))w(Q);else if(e.util.resetApiState.match(T))for(let B of Object.keys(A))w(B)};function E(T){return f(T)?T.meta.arg.queryCacheKey:m(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:x.match(T)?T.payload.queryCacheKey:h.match(T)?$c(T.payload):""}function k(T,q,G,Q,V){let B=Da(r,T),L=B?.onCacheEntryAdded;if(!L)return;let N={},D=new Promise(K=>{N.cacheEntryRemoved=K}),M=Promise.race([new Promise(K=>{N.valueResolved=K}),D.then(()=>{throw Sw})]);M.catch(()=>{}),A[G]=N;let W=e.endpoints[T].select(Nd(B)?q:G),z=Q.dispatch((K,ce,ve)=>ve),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:V,extra:z,updateCachedData:Nd(B)?K=>Q.dispatch(e.util.updateQueryData(T,q,K)):void 0,cacheDataLoaded:M,cacheEntryRemoved:D},Z=L(q,re);Promise.resolve(Z).catch(K=>{if(K!==Sw)throw K})}return F},vM=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},AM=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:p,internalState:f})=>{let{removeQueryResult:m}=i.internalActions,g=Qr(Fn(n),Rc(n)),A=Qr(Fn(o,n),Go(o,n)),x=[],h=0,y=(I,F)=>{(o.pending.match(I)||n.pending.match(I))&&h++,A(I)&&(h=Math.max(0,h-1)),g(I)?w(Ow(I,"invalidatesTags",r,a),F):A(I)?w([],F):i.util.invalidateTags.match(I)&&w(sS(I.payload,void 0,void 0,void 0,void 0,a),F)};function b(){return h>0}function w(I,F){let E=F.getState(),k=E[e];if(x.push(...I),k.config.invalidationBehavior==="delayed"&&b())return;let T=x;if(x=[],T.length===0)return;let q=i.util.selectInvalidatedBy(E,T);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let V=k.queries[Q],B=_d(f.currentSubscriptions,Q,tS);V&&(B.size===0?F.dispatch(m({queryCacheKey:Q})):V.status!==_n&&F.dispatch(p(V)))}})}return y},CM=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,p=new Set,f=null,m=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&A(w.meta.arg,I),r.util.resetApiState.match(w)&&(y(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,I){p.add(w),f||(f=setTimeout(()=>{for(let F of p)x({queryCacheKey:F},I);p.clear(),f=null},0))}function A({queryCacheKey:w},I){let F=I.getState()[e],E=F.queries[w],k=a.get(w);if(!E||E.status===_n)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:q}=b(k);if(!Number.isFinite(T))return;let G=i.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+T;i.set(w,{nextPollTimestamp:Q,pollingInterval:T,timeout:setTimeout(()=>{(F.config.focused||!q)&&I.dispatch(n(E)),A({queryCacheKey:w},I)},T)})}function x({queryCacheKey:w},I){let E=I.getState()[e].queries[w],k=a.get(w);if(!E||E.status===_n)return;let{lowestPollingInterval:T}=b(k);if(!Number.isFinite(T)){h(w);return}let q=i.get(w),G=Date.now()+T;(!q||G<q.nextPollTimestamp)&&A({queryCacheKey:w},I)}function h(w){let I=i.get(w);I?.timeout&&clearTimeout(I.timeout),i.delete(w)}function y(){for(let w of i.keys())h(w)}function b(w=new Map){let I=!1,F=Number.POSITIVE_INFINITY;for(let E of w.values())E.pollingInterval&&(F=Math.min(E.pollingInterval,F),I=E.skipPollingIfUnfocused||I);return{lowestPollingInterval:F,skipPollingIfUnfocused:I}}return m},bM=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=vl(r,n),i=Go(r,n),a=Fn(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:A,arg:{endpointName:x,originalArgs:h}}=m.meta,y=Da(t,x),b=y?.onQueryStarted;if(b){let w={},I=new Promise((T,q)=>{w.resolve=T,w.reject=q});I.catch(()=>{}),p[A]=w;let F=e.endpoints[x].select(Nd(y)?h:A),E=g.dispatch((T,q,G)=>G),k={...g,getCacheEntry:()=>F(g.getState()),requestId:A,extra:E,updateCachedData:Nd(y)?T=>g.dispatch(e.util.updateQueryData(x,h,T)):void 0,queryFulfilled:I};b(h,k)}}else if(a(m)){let{requestId:A,baseQueryMeta:x}=m.meta;p[A]?.resolve({data:m.payload,meta:x}),delete p[A]}else if(i(m)){let{requestId:A,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[A]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[A]}}},xM=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(f,m)=>{iS.match(f)&&p(m,"refetchOnFocus"),aS.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],A=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let y=A[h],b=x.get(h);if(!b||!y)continue;let w=[...b.values()];(w.some(F=>F[m]===!0)||w.every(F=>F[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(i({queryCacheKey:h})):y.status!==_n&&f.dispatch(n(y)))}})}return a};function wM(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,p={invalidateTags:P(`${t}/invalidateTags`)},f=x=>x.type.startsWith(`${t}/`),m=[vM,yM,AM,CM,SM,bM];return{middleware:x=>{let h=!1,y=i(x.dispatch),b={...e,internalState:y,refetchQuery:A,isThisApiSliceAction:f,mwApi:x},w=m.map(E=>E(b)),I=gM(b),F=xM(b);return E=>k=>{if(!uc(k))return E(k);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(a)));let T={...x,next:E},q=x.getState(),[G,Q]=I(k,T,q),V;if(G?V=E(k):V=Q,x.getState()[t]&&(F(k,T,q),f(k)||o.hasRehydrationInfo(k)))for(let B of w)B(k,T,q);return V}},actions:p};function A(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var vw=Symbol(),RM=({createSelector:e=ct}={})=>({name:vw,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:A,catchSchemaFailure:x,skipSchemaValidation:h},y){yC();let b=Te=>(typeof process<"u",Te);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:aS,onOffline:Iw,onFocus:iS,onFocusLost:Rw},util:{}});let w=fM({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:F,buildQuerySelector:E,buildInfiniteQuerySelector:k,buildMutationSelector:T}=w;On(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:F});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:V,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=dM({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:w,onSchemaFailure:A,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:M,actions:W}=pM({context:y,queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});On(t.util,{patchQueryData:V,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),On(t.internalActions,W);let z=new WeakMap,re=Te=>_d(z,Te,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:ve,getRunningMutationsThunk:Le,getRunningQueriesThunk:nt,getRunningQueryThunk:$e}=lM({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:i,context:y,getInternalState:re});On(t.util,{getRunningMutationThunk:ve,getRunningMutationsThunk:Le,getRunningQueryThunk:$e,getRunningQueriesThunk:nt});let{middleware:Je,actions:et}=wM({reducerPath:o,context:y,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:$e,getInternalState:re});return On(t.util,et),On(t,{reducer:M,middleware:Je}),{name:vw,injectEndpoint(Te,Ie){var gt;let Pe=(gt=t.endpoints)[Te]??(gt[Te]={});qd(Ie)&&On(Pe,{name:Te,select:E(Te,Ie),initiate:Z(Te,Ie)},D(q,Te)),sM(Ie)&&On(Pe,{name:Te,select:T(),initiate:ce(Te)},D(Q,Te)),Md(Ie)&&On(Pe,{name:Te,select:k(Te,Ie),initiate:K(Te,Ie)},D(q,Te))}}}}),Nw=mM(RM());d();c();l();u();d();c();l();u();var ti=e=>e.query,Dw=e=>e.query?.enableQuerySyntax;var qw=ct(e=>ti(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),jd=ct(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var Mw=ct(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});d();c();l();u();var cS=e=>e.context;d();c();l();u();var uS=e=>e.pipeline;d();c();l();u();var lS=e=>e.searchHub;d();c();l();u();var Lt=ct(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Oae=ct(e=>e,e=>{let t=Lt(e);return t&&e?e[t].expression:""});d();c();l();u();var jw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var Vw=e=>e.excerptLength?.length;d();c();l();u();var Jr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,Lw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Uw=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var Qw=e=>e.sortCriteria;var Bw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Gn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Bw(_x183){return _ref64.apply(this,arguments)}}(),Gw=(e,t)=>{let r=ti(e)?.q,{aq:n,cq:o,dq:i,lq:a}=zw(e),p=cS(e),f=Xo(e.configuration.analytics,t,{actionCause:Yy(e)}),m=lS(e),g=uS(e),A=vy(e)??[],x=Hw(e),h=Lt(e.tabSet)||"default",y=yy(e),b=Ub(e),w=t.referrer||"",I=Lw(e),F=Qw(e),E=IM(e),k=Vw(e),T=Uw(e),q=jw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Dw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:A}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(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:Gy(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(T??{}),...(k&&{excerptLength:k}),...(q&&{dictionaryFieldContext:q}),sortCriteria:F,...(I&&{facetOptions:I}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},$w=(e,t)=>{let r=ti(e)?.q,n=Hw(e),o=Xo(e.configuration.analytics,t,{actionCause:Yy(e)}),i=yy(e),a=Lt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=zw(e),g=lS(e),A=uS(e),x=cS(e),h=vy(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(A?.length&&{pipeline:A}),...(x?.contextValues&&{context:x.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:a,referrer:p,...o,locale:i}},Hw=e=>wd(e)?.map(t=>Fy(t,Ey())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),IM=e=>({actionsHistory:e.configuration.analytics.enabled?vt.getInstance().getHistory():[]}),zw=e=>{let t=Mw(e),r=$y(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Vd=["searching","thinking","answering"];function Ld(e){return e.toLowerCase()}var Ud=["search","generic"];function dS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var Ww=["text/plain","text/markdown"];var qa=new $({required:!0}),Yw=new $,Ma=new pe({required:!0}),pS={id:qa,title:qa,uri:qa,permanentid:qa,clickUri:Yw},Qd=new $({required:!0,constrainTo:Ww}),Kw=new $({required:!0,constrainTo:Vd}),Xw=e=>({...e,name:Ld(e.name)}),ja=P("generatedAnswer/setIsVisible",e=>_(e,Ma)),Va=P("generatedAnswer/setAnswerId",e=>_(e,H)),La=P("generatedAnswer/setAnswerGenerationMode",e=>_(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Ua=P("generatedAnswer/setIsEnabled",e=>_(e,Ma)),ni=P("generatedAnswer/updateMessage",e=>_(e,{textDelta:qa})),oi=P("generatedAnswer/updateCitations",e=>_(e,{citations:new oe({required:!0,each:new Y({values:pS})})})),ii=P("generatedAnswer/updateError",e=>_(e,{message:Yw,code:new ne({min:0})})),lr=P("generatedAnswer/resetAnswer"),Bd=P("generatedAnswer/like"),Gd=P("generatedAnswer/dislike"),$d=P("generatedAnswer/feedbackModal/open"),zc=P("generatedAnswer/expand"),Hd=P("generatedAnswer/collapse"),zd=P("generatedAnswer/setId",e=>_(e,{id:new $({required:!0})})),Wd=P("generatedAnswer/feedbackModal/close"),Qa=P("generatedAnswer/sendFeedback"),en=P("generatedAnswer/setIsLoading",e=>_(e,Ma)),ri=P("generatedAnswer/setIsStreaming",e=>_(e,Ma)),ai=P("generatedAnswer/setAnswerContentFormat",e=>_(e,Qd)),Yd=P("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new oe({each:Qd,default:["text/plain"]})})),Kd=P("knowledge/updateAnswerConfigurationId",e=>_(e,qa)),Xd=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Zu)),Wc=P("generatedAnswer/setIsAnswerGenerated",e=>_(e,Ma)),si=P("generatedAnswer/setCannotAnswer",e=>_(e,Ma)),fS=P("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new Y({}))),Zd=P("generatedAnswer/startStep",e=>_(Xw(e),{name:Kw,startedAt:new ne({min:0,required:!0})})),Jd=P("generatedAnswer/finishStep",e=>_(Xw(e),{name:Kw,finishedAt:new ne({min:0,required:!0})})),ep=P("generatedAnswer/startToolCall",e=>_(e,{toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),tp=P("generatedAnswer/finishToolCall",e=>_(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Ba=P("generatedAnswer/toolCallArgs",e=>_(e,{toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Ud})})),Zw=me("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:p}=i(),{queryExecuted:f}=p,{setAbortControllerRef:m}=e,g=yield Bw(r),A=(y,b)=>{switch(y){case"genqa.headerMessageType":{let w=JSON.parse(b);n(ai(w.contentFormat));break}case"genqa.messageType":n(ni(JSON.parse(b)));break;case"genqa.citationsType":n(oi(JSON.parse(b)));break;case"genqa.endOfStreamType":{let w=JSON.parse(b).answerGenerated,{answerId:I,answer:F}=i().generatedAnswer,k=f.length!==0&&!w,T=!F?.trim();n(si(k)),n(ri(!1)),n(Wc(w)),n((a??ed).logGeneratedAnswerStreamEnd(w,I,w?T:void 0)),n(ba());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(en(!0));let x=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{x(g)&&(n(en(!1)),y.payload&&y.payloadType&&A(y.payloadType,y.payload))},abort:y=>{x(g)&&n(ii(y))},close:()=>{x(g)&&n(ri(!1))},resetAnswer:()=>{x(g)&&n(lr())}});h?m(h):n(en(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),rp=me("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(lr());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=Gw(i,n);r(fS(a)),yield r(np(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var EM=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,p=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let m=Gn(n.configuration.search?.apiBaseUrl,a,i);return Cw({baseUrl:`${m}/rest/organizations/${a}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let A=g.url,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),v(A,x)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function EM(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),op=Nw({reducerPath:"answer",baseQuery:xw(EM,{maxRetries:3}),endpoints:()=>({})});var FM=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},TM=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},PM=(e,t)=>{delete e.error,e.citations=t.citations},kM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},OM=(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})`)},_M=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&OM(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(FM(t,i),r(ai(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(TM(t,i),r(ni({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(PM(t,i),r(oi({citations:i.citations})));break;case"genqa.endOfStreamType":{kM(t,i);let a=t.answerId,p=i.answerGenerated??!1,f=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,a,f)),r(ba());break}}},NM=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},ci=op.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,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:p,generatedAnswer:f,insightConfiguration:m}=r(),{generatedAnswerAnalyticsClient:g}=yield a,{organizationId:A,environment:x,accessToken:h}=p,y=Gn(p.search.apiBaseUrl,A,x),b=NM(y,A,f.answerConfigurationId,m?.insightId);yield Wu(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(w){let I=w.headers.get("x-answer-id");I&&o(F=>{F.answerId=I,i(Va(I))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:w=>{o(I=>{_M(w,I,i,g??ed)})},onerror:w=>{throw w},onclose:()=>{o(w=>{i(si(!w.generated))})}})}).apply(this,arguments)}})})}),np=e=>ci.endpoints.getAnswer.initiate(e),mS=e=>{let t=jd(e);return ci.endpoints.getAnswer.select(t??ei)(e)};d();c();l();u();var Jw=fe(Wn,e=>e);d();c();l();u();function DM(e){let t=e.payload?.analyticsAction;return eR(e)&&!J(t)}function eR(e){return"type"in e}var tR=e=>t=>r=>{let n;DM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return eR(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),o};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var ip={q:new $,enableQuerySyntax:new pe,aq:new $,cq:new $,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new pe,sf:new Y,tab:new $,af:new Y};var ot=P("searchParameters/restore",e=>_(e,ip)),ap=P("searchParameters/restoreTab",e=>_(e,H));d();c();l();u();var sp=P("tab/register",e=>{let t=new Y({values:{id:H,expression:Ke}});return _(e,t)}),Nt=P("tab/updateActiveTab",e=>_(e,H));d();c();l();u();var cp=Fr(Gu(),1),oR=Fr(rR(),1),iR=Fr(nR(),1);cp.default.extend(iR.default);cp.default.extend(oR.default);var up=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:cp.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"});d();c();l();u();var qM=/(^|; )Coveo-Pendragon=([^;]*)/,MM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function aR(){return typeof window>"u"?!1:qM.exec(document.cookie)?.pop()||null}function sR(){return typeof window>"u"?!1:MM.test(document.cookie)}var lp=fe(up(),e=>e.addCase(Aa,(t,r)=>{jM(t,r.payload)}).addCase(Ca,(t,r)=>{VM(t,r.payload)}).addCase(Yl,(t,r)=>{LM(t,r.payload)}).addCase(Kl,t=>{t.analytics.enabled=!1}).addCase(Xl,t=>{t.analytics.enabled=!0}).addCase(mx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(gx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Nt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ap,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ot,(t,r)=>{J(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(hx,(t,{payload:r})=>{UM(t,r)}));function jM(e,t){J(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",J(t.organizationId)||(e.organizationId=t.organizationId)}function VM(e,t){J(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),J(t.locale)||(e.search.locale=t.locale),J(t.timezone)||(e.search.timezone=t.timezone),J(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function LM(e,t){J(t.enabled)||(e.analytics.enabled=t.enabled),J(t.originContext)||(e.analytics.originContext=t.originContext),J(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),J(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),J(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),J(t.trackingId)||(e.analytics.trackingId=t.trackingId),J(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),J(t.source)||(e.analytics.source=t.source);try{let r=aR();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}J(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),J(t.anonymous)||(e.analytics.anonymous=t.anonymous),J(t.deviceId)||(e.analytics.deviceId=t.deviceId),J(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),J(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function UM(e,t){e.knowledge.agentId=t;try{sR()&&(e.knowledge.debugAgentSession=!0)}catch{}}var we=lp;d();c();l();u();function QM(e){return e.instantlyCallable}var cR=()=>e=>t=>e(QM(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function uR(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}d();c();l();u();var vS,BM=new Uint8Array(16);function AS(){if(!vS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vS=crypto.getRandomValues.bind(crypto)}return vS(BM)}d();c();l();u();d();c();l();u();var GM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),CS={randomUUID:GM};function $M(e,t,r){if(CS.randomUUID&&!t&&!e)return CS.randomUUID();e=e||{};let n=e.random??e.rng?.()??AS();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 o=0;o<16;++o)t[r+o]=n[o];return t}return uR(n)}var po=$M;d();c();l();u();d();c();l();u();var R={};Ys(R,{BRAND:()=>yj,DIRTY:()=>ui,EMPTY_PATH:()=>YM,INVALID:()=>be,NEVER:()=>tV,OK:()=>Ut,ParseStatus:()=>qt,Schema:()=>qe,ZodAny:()=>go,ZodArray:()=>Mn,ZodBigInt:()=>di,ZodBoolean:()=>pi,ZodBranded:()=>Kc,ZodCatch:()=>xi,ZodDate:()=>fi,ZodDefault:()=>bi,ZodDiscriminatedUnion:()=>fp,ZodEffects:()=>br,ZodEnum:()=>Ai,ZodError:()=>er,ZodFirstPartyTypeKind:()=>Re,ZodFunction:()=>gp,ZodIntersection:()=>yi,ZodIssueCode:()=>X,ZodLazy:()=>Si,ZodLiteral:()=>vi,ZodMap:()=>Ya,ZodNaN:()=>Xa,ZodNativeEnum:()=>Ci,ZodNever:()=>_r,ZodNull:()=>gi,ZodNullable:()=>nn,ZodNumber:()=>li,ZodObject:()=>tr,ZodOptional:()=>Ar,ZodParsedType:()=>ue,ZodPipeline:()=>Xc,ZodPromise:()=>ho,ZodReadonly:()=>wi,ZodRecord:()=>mp,ZodSchema:()=>qe,ZodSet:()=>Ka,ZodString:()=>mo,ZodSymbol:()=>za,ZodTransformer:()=>br,ZodTuple:()=>rn,ZodType:()=>qe,ZodUndefined:()=>mi,ZodUnion:()=>hi,ZodUnknown:()=>qn,ZodVoid:()=>Wa,addIssueToContext:()=>se,any:()=>Ij,array:()=>Pj,bigint:()=>Cj,boolean:()=>AR,coerce:()=>eV,custom:()=>yR,date:()=>bj,datetimeRegex:()=>gR,defaultErrorMap:()=>Nn,discriminatedUnion:()=>Nj,effect:()=>Hj,enum:()=>Bj,function:()=>Lj,getErrorMap:()=>Ga,getParsedType:()=>tn,instanceof:()=>vj,intersection:()=>Dj,isAborted:()=>dp,isAsync:()=>$a,isDirty:()=>pp,isValid:()=>fo,late:()=>Sj,lazy:()=>Uj,literal:()=>Qj,makeIssue:()=>Yc,map:()=>jj,nan:()=>Aj,nativeEnum:()=>Gj,never:()=>Fj,null:()=>Rj,nullable:()=>Wj,number:()=>vR,object:()=>kj,objectUtil:()=>bS,oboolean:()=>Jj,onumber:()=>Zj,optional:()=>zj,ostring:()=>Xj,pipeline:()=>Kj,preprocess:()=>Yj,promise:()=>$j,quotelessJson:()=>HM,record:()=>Mj,set:()=>Vj,setErrorMap:()=>WM,strictObject:()=>Oj,string:()=>SR,symbol:()=>xj,transformer:()=>Hj,tuple:()=>qj,undefined:()=>wj,union:()=>_j,unknown:()=>Ej,util:()=>Ve,void:()=>Tj});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ve;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(p=>typeof o[o[p]]!="number"),a={};for(let p of i)a[p]=o[p];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ve||(Ve={}));var bS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bS||(bS={}));var ue=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tn=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var X=Ve.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"]),HM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),er=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(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let p=n,f=0;for(;f<a.path.length;){let m=a.path[f];f===a.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(r(a))):p[m]=p[m]||{_errors:[]},p=p[m],f++}}};return o(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,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=e=>new er(e);var zM=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.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}"`:Ve.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.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 X.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 X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ve.assertNever(e)}return{message:r}},Nn=zM;var lR=Nn;function WM(e){lR=e}function Ga(){return lR}d();c();l();u();var Yc=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let p="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)p=m(a,{data:t,defaultError:p}).message;return{...o,path:i,message:p}},YM=[];function se(e,t){let r=Ga(),n=Yc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Nn?void 0:Nn].filter(o=>!!o)});e.common.issues.push(n)}var qt=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 o of r){if(o.status==="aborted")return be;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return be;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},be=Object.freeze({status:"aborted"}),ui=e=>({status:"dirty",value:e}),Ut=e=>({status:"valid",value:e}),dp=e=>e.status==="aborted",pp=e=>e.status==="dirty",fo=e=>e.status==="valid",$a=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));var Cr=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}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}},dR=(e,t)=>{if(fo(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 er(e.common.issues);return this._error=r,this._error}}};function ke(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(a,p)=>{let{message:f}=e;return a.code==="invalid_enum_value"?{message:f??p.defaultError}:typeof p.data>"u"?{message:f??n??p.defaultError}:a.code!=="invalid_type"?{message:p.defaultError}:{message:f??r??p.defaultError}},description:o}}var qe=class{get description(){return this._def.description}_getType(t){return tn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qt,ctx:{common:t.parent.common,data:t.data,parsedType:tn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if($a(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:tn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return dR(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:tn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return fo(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=>fo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:tn(t)},o=_this32._parse({data:t,path:n.path,parent:n}),i=yield $a(o)?o:Promise.resolve(o);return dR(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),p=()=>i.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(f=>f?!0:(p(),!1)):a?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new br({schema:this,typeName:Re.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 Ar.create(this,this._def)}nullable(){return nn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mn.create(this)}promise(){return ho.create(this,this._def)}or(t){return hi.create([this,t],this._def)}and(t){return yi.create(this,t,this._def)}transform(t){return new br({...ke(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new bi({...ke(this._def),innerType:this,defaultValue:r,typeName:Re.ZodDefault})}brand(){return new Kc({typeName:Re.ZodBranded,type:this,...ke(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new xi({...ke(this._def),innerType:this,catchValue:r,typeName:Re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Xc.create(this,t)}readonly(){return wi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},KM=/^c[^\s-]{8,}$/i,XM=/^[0-9a-z]+$/,ZM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JM=/^[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,ej=/^[a-z0-9_-]{21}$/i,tj=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rj=/^[-+]?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)?)??$/,nj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xS,ij=/^(?:(?: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])$/,aj=/^(?:(?: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])$/,sj=/^(([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]))$/,cj=/^(([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])$/,uj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fR="((\\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])))",dj=new RegExp(`^${fR}$`);function mR(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 pj(e){return new RegExp(`^${mR(e)}$`)}function gR(e){let t=`${fR}T${mR(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 fj(e,t){return!!((t==="v4"||!t)&&ij.test(e)||(t==="v6"||!t)&&sj.test(e))}function mj(e,t){if(!tj.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function gj(e,t){return!!((t==="v4"||!t)&&aj.test(e)||(t==="v6"||!t)&&cj.test(e))}var mo=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ue.string,received:i.parsedType}),be}let n=new qt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,p=t.data.length<i.value;(a||p)&&(o=this._getOrReturnCtx(t,o),a?se(o,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):p&&se(o,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")nj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")xS||(xS=new RegExp(oj,"u")),xS.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")JM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")ej.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")KM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")XM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")ZM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:X.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?gR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?dj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?pj(i).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?rj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?fj(t.data,i.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?mj(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?gj(t.data,i.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?uj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?lj.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:i.message}),n.dirty()):Ve.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...ge.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.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,...ge.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,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ge.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ge.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ge.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ge.errToObj(r)})}nonempty(t){return this.min(1,ge.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}};mo.create=e=>new mo({checks:[],typeName:Re.ZodString,coerce:e?.coerce??!1,...ke(e)});function hj(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var li=class e extends qe{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)!==ue.number){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ue.number,received:i.parsedType}),be}let n,o=new qt;for(let i of this._def.checks)i.kind==="int"?Ve.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?hj(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:i.message}),o.dirty()):Ve.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.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"&&Ve.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)}};li.create=e=>new li({checks:[],typeName:Re.ZodNumber,coerce:e?.coerce||!1,...ke(e)});var di=class e extends qe{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)!==ue.bigint)return this._getInvalidInput(t);let n,o=new qt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ve.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.bigint,received:r.parsedType}),be}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_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:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.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}};di.create=e=>new di({checks:[],typeName:Re.ZodBigInt,coerce:e?.coerce??!1,...ke(e)});var pi=class extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.boolean,received:n.parsedType}),be}return Ut(t.data)}};pi.create=e=>new pi({typeName:Re.ZodBoolean,coerce:e?.coerce||!1,...ke(e)});var fi=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ue.date,received:i.parsedType}),be}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_date}),be}let n=new qt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ve.assertNever(i);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:ge.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ge.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}};fi.create=e=>new fi({checks:[],coerce:e?.coerce||!1,typeName:Re.ZodDate,...ke(e)});var za=class extends qe{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.symbol,received:n.parsedType}),be}return Ut(t.data)}};za.create=e=>new za({typeName:Re.ZodSymbol,...ke(e)});var mi=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.undefined,received:n.parsedType}),be}return Ut(t.data)}};mi.create=e=>new mi({typeName:Re.ZodUndefined,...ke(e)});var gi=class extends qe{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.null,received:n.parsedType}),be}return Ut(t.data)}};gi.create=e=>new gi({typeName:Re.ZodNull,...ke(e)});var go=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Ut(t.data)}};go.create=e=>new go({typeName:Re.ZodAny,...ke(e)});var qn=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ut(t.data)}};qn.create=e=>new qn({typeName:Re.ZodUnknown,...ke(e)});var _r=class extends qe{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),be}};_r.create=e=>new _r({typeName:Re.ZodNever,...ke(e)});var Wa=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.void,received:n.parsedType}),be}return Ut(t.data)}};Wa.create=e=>new Wa({typeName:Re.ZodVoid,...ke(e)});var Mn=class e extends qe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return se(r,{code:X.invalid_type,expected:ue.array,received:r.parsedType}),be;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(a||p)&&(se(r,{code:a?X.too_big:X.too_small,minimum:p?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(se(r,{code:X.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(se(r,{code:X.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,p)=>o.type._parseAsync(new Cr(r,a,r.path,p)))).then(a=>qt.mergeArray(n,a));let i=[...r.data].map((a,p)=>o.type._parseSync(new Cr(r,a,r.path,p)));return qt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ge.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ge.toString(r)}})}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...ke(t)});function Ha(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(Ha(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Mn?new Mn({...e._def,type:Ha(e.element)}):e instanceof Ar?Ar.create(Ha(e.unwrap())):e instanceof nn?nn.create(Ha(e.unwrap())):e instanceof rn?rn.create(e.items.map(t=>Ha(t))):e}var tr=class e extends qe{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=Ve.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let m=this._getOrReturnCtx(t);return se(m,{code:X.invalid_type,expected:ue.object,received:m.parsedType}),be}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),p=[];if(!(this._def.catchall instanceof _r&&this._def.unknownKeys==="strip"))for(let m in o.data)a.includes(m)||p.push(m);let f=[];for(let m of a){let g=i[m],A=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Cr(o,A,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof _r){let m=this._def.unknownKeys;if(m==="passthrough")for(let g of p)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let g of p){let A=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Cr(o,A,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let m=[];for(let g of f){let A=yield g.key,x=yield g.value;m.push({key:A,value:x,alwaysSet:g.alwaysSet})}return m})).then(m=>qt.mergeObjectSync(n,m)):qt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(t).message??o}:{message:o}}}:{})})}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:Re.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 Ve.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 Ve.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ha(this)}partial(t){let r={};for(let n of Ve.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ve.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ar;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return hR(Ve.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:_r.create(),typeName:Re.ZodObject,...ke(t)});var hi=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let p of i)if(p.result.status==="valid")return p.result;for(let p of i)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let a=i.map(p=>new er(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:a}),be}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let i,a=[];for(let f of n){let m={...r,common:{...r.common,issues:[]},parent:null},g=f._parseSync({data:r.data,path:r.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let p=a.map(f=>new er(f));return se(r,{code:X.invalid_union,unionErrors:p}),be}}get options(){return this._def.options}};hi.create=(e,t)=>new hi({options:e,typeName:Re.ZodUnion,...ke(t)});var Dn=e=>e instanceof Si?Dn(e.schema):e instanceof br?Dn(e.innerType()):e instanceof vi?[e.value]:e instanceof Ai?e.options:e instanceof Ci?Ve.objectValues(e.enum):e instanceof bi?Dn(e._def.innerType):e instanceof mi?[void 0]:e instanceof gi?[null]:e instanceof Ar?[void 0,...Dn(e.unwrap())]:e instanceof nn?[null,...Dn(e.unwrap())]:e instanceof Kc||e instanceof wi?Dn(e.unwrap()):e instanceof xi?Dn(e._def.innerType):[],fp=class e extends qe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:X.invalid_type,expected:ue.object,received:r.parsedType}),be;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Dn(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of a){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,i)}}return new e({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ke(n)})}};function wS(e,t){let r=tn(e),n=tn(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Ve.objectKeys(t),i=Ve.objectKeys(e).filter(p=>o.indexOf(p)!==-1),a={...e,...t};for(let p of i){let f=wS(e[p],t[p]);if(!f.valid)return{valid:!1};a[p]=f.data}return{valid:!0,data:a}}else if(r===ue.array&&n===ue.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],p=t[i],f=wS(a,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var yi=class extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(dp(i)||dp(a))return be;let p=wS(i.value,a.value);return p.valid?((pp(i)||pp(a))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),be)};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(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};yi.create=(e,t,r)=>new yi({left:e,right:t,typeName:Re.ZodIntersection,...ke(r)});var rn=class e extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return se(n,{code:X.invalid_type,expected:ue.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,p)=>{let f=this._def.items[p]||this._def.rest;return f?f._parse(new Cr(n,a,n.path,p)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>qt.mergeArray(r,a)):qt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};rn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rn({items:e,typeName:Re.ZodTuple,rest:null,...ke(t)})};var mp=class e extends qe{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!==ue.object)return se(n,{code:X.invalid_type,expected:ue.object,received:n.parsedType}),be;let o=[],i=this._def.keyType,a=this._def.valueType;for(let p in n.data)o.push({key:i._parse(new Cr(n,p,n.path,p)),value:a._parse(new Cr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?qt.mergeObjectAsync(r,o):qt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof qe?new e({keyType:t,valueType:r,typeName:Re.ZodRecord,...ke(n)}):new e({keyType:mo.create(),valueType:t,typeName:Re.ZodRecord,...ke(r)})}},Ya=class extends qe{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!==ue.map)return se(n,{code:X.invalid_type,expected:ue.map,received:n.parsedType}),be;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Cr(n,p,n.path,[m,"key"])),value:i._parse(new Cr(n,f,n.path,[m,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let f of a){let m=yield f.key,g=yield f.value;if(m.status==="aborted"||g.status==="aborted")return be;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let f of a){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return be;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Ya.create=(e,t,r)=>new Ya({valueType:t,keyType:e,typeName:Re.ZodMap,...ke(r)});var Ka=class e extends qe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return se(n,{code:X.invalid_type,expected:ue.set,received:n.parsedType}),be;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(se(n,{code:X.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(f){let m=new Set;for(let g of f){if(g.status==="aborted")return be;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let p=[...n.data.values()].map((f,m)=>i._parse(new Cr(n,f,n.path,m)));return n.common.async?Promise.all(p).then(f=>a(f)):a(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ka.create=(e,t)=>new Ka({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...ke(t)});var gp=class e extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.function)return se(r,{code:X.invalid_type,expected:ue.function,received:r.parsedType}),be;function n(p,f){return Yc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ga(),Nn].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return Yc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ga(),Nn].filter(m=>!!m),issueData:{code:X.invalid_return_type,returnTypeError:f}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ho){let p=this;return Ut(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new er([]),g=yield p._def.args.parseAsync(f,i).catch(h=>{throw m.addIssue(n(f,h)),m}),A=yield Reflect.apply(a,this,g);return yield p._def.returns._def.type.parseAsync(A,i).catch(h=>{throw m.addIssue(o(A,h)),m})}))}else{let p=this;return Ut(function(...f){let m=p._def.args.safeParse(f,i);if(!m.success)throw new er([n(f,m.error)]);let g=Reflect.apply(a,this,m.data),A=p._def.returns.safeParse(g,i);if(!A.success)throw new er([o(g,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:rn.create(t).rest(qn.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||rn.create([]).rest(qn.create()),returns:r||qn.create(),typeName:Re.ZodFunction,...ke(n)})}},Si=class extends qe{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})}};Si.create=(e,t)=>new Si({getter:e,typeName:Re.ZodLazy,...ke(t)});var vi=class extends qe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:t.data}}get value(){return this._def.value}};vi.create=(e,t)=>new vi({value:e,typeName:Re.ZodLiteral,...ke(t)});function hR(e,t){return new Ai({values:e,typeName:Re.ZodEnum,...ke(t)})}var Ai=class e extends qe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Ve.joinValues(n),received:r.parsedType,code:X.invalid_type}),be}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 se(r,{received:r.data,code:X.invalid_enum_value,options:n}),be}return Ut(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})}};Ai.create=hR;var Ci=class extends qe{_parse(t){let r=Ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Ve.objectValues(r);return se(n,{expected:Ve.joinValues(o),received:n.parsedType,code:X.invalid_type}),be}if(this._cache||(this._cache=new Set(Ve.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ve.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),be}return Ut(t.data)}get enum(){return this._def.values}};Ci.create=(e,t)=>new Ci({values:e,typeName:Re.ZodNativeEnum,...ke(t)});var ho=class extends qe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ue.promise,received:r.parsedType}),be;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Ut(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ho.create=(e,t)=>new ho({type:e,typeName:Re.ZodPromise,...ke(t)});var br=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{se(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return be;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?be:f.status==="dirty"?ui(f.value):r.value==="dirty"?ui(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return be;let p=this._def.schema._parseSync({data:a,path:n.path,parent:n});return p.status==="aborted"?be:p.status==="dirty"?ui(p.value):r.value==="dirty"?ui(p.value):p}}if(o.type==="refinement"){let a=p=>{let f=o.refinement(p,i);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),a(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),a(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fo(a))return be;let p=o.transform(a.value,i);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>fo(a)?Promise.resolve(o.transform(a.value,i)).then(p=>({status:r.value,value:p})):be);Ve.assertNever(o)}};br.create=(e,t,r)=>new br({schema:e,typeName:Re.ZodEffects,effect:t,...ke(r)});br.createWithPreprocess=(e,t,r)=>new br({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...ke(r)});var Ar=class extends qe{_parse(t){return this._getType(t)===ue.undefined?Ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:Re.ZodOptional,...ke(t)});var nn=class extends qe{_parse(t){return this._getType(t)===ue.null?Ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:Re.ZodNullable,...ke(t)});var bi=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};bi.create=(e,t)=>new bi({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ke(t)});var xi=class extends qe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return $a(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};xi.create=(e,t)=>new xi({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ke(t)});var Xa=class extends qe{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.nan,received:n.parsedType}),be}return{status:"valid",value:t.data}}};Xa.create=e=>new Xa({typeName:Re.ZodNaN,...ke(e)});var yj=Symbol("zod_brand"),Kc=class extends qe{_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}},Xc=class e extends qe{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?be:i.status==="dirty"?(r.dirty(),ui(i.value)):_this34._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?be:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Re.ZodPipeline})}},wi=class extends qe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(fo(o)&&(o.value=Object.freeze(o.value)),o);return $a(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};wi.create=(e,t)=>new wi({innerType:e,typeName:Re.ZodReadonly,...ke(t)});function pR(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function yR(e,t={},r){return e?go.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let p=pR(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!i){let a=pR(t,n),p=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:p})}}):go.create()}var Sj={object:tr.lazycreate},Re;(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"})(Re||(Re={}));var vj=(e,t={message:`Input not instance of ${e.name}`})=>yR(r=>r instanceof e,t),SR=mo.create,vR=li.create,Aj=Xa.create,Cj=di.create,AR=pi.create,bj=fi.create,xj=za.create,wj=mi.create,Rj=gi.create,Ij=go.create,Ej=qn.create,Fj=_r.create,Tj=Wa.create,Pj=Mn.create,kj=tr.create,Oj=tr.strictCreate,_j=hi.create,Nj=fp.create,Dj=yi.create,qj=rn.create,Mj=mp.create,jj=Ya.create,Vj=Ka.create,Lj=gp.create,Uj=Si.create,Qj=vi.create,Bj=Ai.create,Gj=Ci.create,$j=ho.create,Hj=br.create,zj=Ar.create,Wj=nn.create,Yj=br.createWithPreprocess,Kj=Xc.create,Xj=()=>SR().optional(),Zj=()=>vR().optional(),Jj=()=>AR().optional(),eV={string:e=>mo.create({...e,coerce:!0}),number:e=>li.create({...e,coerce:!0}),boolean:e=>pi.create({...e,coerce:!0}),bigint:e=>di.create({...e,coerce:!0}),date:e=>fi.create({...e,coerce:!0})};var tV=be;var rV=R.object({name:R.string(),arguments:R.string()}),nV=R.object({id:R.string(),type:R.literal("function"),function:rV,encryptedValue:R.string().optional()}),hp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),oV=R.object({type:R.literal("text"),text:R.string()}),iV=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),aV=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),yp=R.discriminatedUnion("type",[iV,aV]),sV=R.object({type:R.literal("image"),source:yp,metadata:R.unknown().optional()}),cV=R.object({type:R.literal("audio"),source:yp,metadata:R.unknown().optional()}),uV=R.object({type:R.literal("video"),source:yp,metadata:R.unknown().optional()}),lV=R.object({type:R.literal("document"),source:yp,metadata:R.unknown().optional()});var CR=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()}),bR=(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"]})},Fde=CR.superRefine((e,t)=>{bR(e,t)}),dV=R.discriminatedUnion("type",[oV,sV,cV,uV,lV,CR]),pV=dV.superRefine((e,t)=>{e.type==="binary"&&bR(e,t)}),fV=hp.extend({role:R.literal("developer"),content:R.string()}),mV=hp.extend({role:R.literal("system"),content:R.string()}),gV=hp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(nV).optional()}),hV=hp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(pV)])}),yV=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),SV=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),vV=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),xR=R.discriminatedUnion("role",[fV,mV,gV,hV,yV,SV,vV]),Tde=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),AV=R.object({description:R.string(),value:R.string()}),wR=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),CV=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional()}),bV=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional()}),xV=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(xR),tools:R.array(wR),context:R.array(AV),forwardedProps:R.any(),resume:R.array(bV).optional()}),wV=R.any(),it=class extends Error{constructor(e){super(e)}},RS=class extends it{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},RV=R.object({name:R.string(),description:R.string().optional()}),IV=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),EV=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),FV=R.object({supported:R.boolean().optional(),items:R.array(wR).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),TV=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),PV=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),kV=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(RV).optional()}),OV=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),_V=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),NV=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),DV=R.object({input:_V.optional(),output:NV.optional()}),qV=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),MV=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),Pde=R.object({identity:IV.optional(),transport:EV.optional(),tools:FV.optional(),output:TV.optional(),state:PV.optional(),multiAgent:kV.optional(),reasoning:OV.optional(),multimodal:DV.optional(),execution:qV.optional(),humanInTheLoop:MV.optional(),custom:R.record(R.unknown()).optional()}),RR=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),j=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}({}),Be=R.object({type:R.nativeEnum(j),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),jV=Be.extend({type:R.literal(j.TEXT_MESSAGE_START),messageId:R.string(),role:RR.default("assistant"),name:R.string().optional()}),IR=Be.extend({type:R.literal(j.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),VV=Be.extend({type:R.literal(j.TEXT_MESSAGE_END),messageId:R.string()}),LV=Be.extend({type:R.literal(j.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:RR.optional(),delta:R.string().optional(),name:R.string().optional()}),UV=Be.extend({type:R.literal(j.THINKING_TEXT_MESSAGE_START)}),QV=IR.omit({messageId:!0,type:!0}).extend({type:R.literal(j.THINKING_TEXT_MESSAGE_CONTENT)}),BV=Be.extend({type:R.literal(j.THINKING_TEXT_MESSAGE_END)}),GV=Be.extend({type:R.literal(j.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),$V=Be.extend({type:R.literal(j.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),HV=Be.extend({type:R.literal(j.TOOL_CALL_END),toolCallId:R.string()}),zV=Be.extend({messageId:R.string(),type:R.literal(j.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),WV=Be.extend({type:R.literal(j.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),YV=Be.extend({type:R.literal(j.THINKING_START),title:R.string().optional()}),KV=Be.extend({type:R.literal(j.THINKING_END)}),XV=Be.extend({type:R.literal(j.STATE_SNAPSHOT),snapshot:wV}),ZV=Be.extend({type:R.literal(j.STATE_DELTA),delta:R.array(R.any())}),JV=Be.extend({type:R.literal(j.MESSAGES_SNAPSHOT),messages:R.array(xR)}),eL=Be.extend({type:R.literal(j.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),tL=Be.extend({type:R.literal(j.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),rL=Be.extend({type:R.literal(j.RAW),event:R.any(),source:R.string().optional()}),nL=Be.extend({type:R.literal(j.CUSTOM),name:R.string(),value:R.any()}),oL=Be.extend({type:R.literal(j.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:xV.optional()}),iL=R.object({type:R.literal("success")}).strict(),aL=R.object({type:R.literal("interrupt"),interrupts:R.array(CV).min(1)}).strict(),sL=R.discriminatedUnion("type",[iL,aL]),cL=Be.extend({type:R.literal(j.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:sL.nullable().optional().transform(e=>e??void 0)}),uL=Be.extend({type:R.literal(j.RUN_ERROR),message:R.string(),code:R.string().optional()}),lL=Be.extend({type:R.literal(j.STEP_STARTED),stepName:R.string()}),dL=Be.extend({type:R.literal(j.STEP_FINISHED),stepName:R.string()}),pL=R.union([R.literal("tool-call"),R.literal("message")]),fL=Be.extend({type:R.literal(j.REASONING_START),messageId:R.string()}),mL=Be.extend({type:R.literal(j.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),gL=Be.extend({type:R.literal(j.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),hL=Be.extend({type:R.literal(j.REASONING_MESSAGE_END),messageId:R.string()}),yL=Be.extend({type:R.literal(j.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),SL=Be.extend({type:R.literal(j.REASONING_END),messageId:R.string()}),vL=Be.extend({type:R.literal(j.REASONING_ENCRYPTED_VALUE),subtype:pL,entityId:R.string(),encryptedValue:R.string()}),Sp=R.discriminatedUnion("type",[jV,IR,VV,LV,YV,KV,UV,QV,BV,GV,$V,HV,WV,zV,XV,ZV,JV,eL,tL,rL,nL,oL,cL,uL,lL,dL,fL,mL,gL,hL,yL,SL,vL]);d();c();l();u();var IS={};Ys(IS,{JsonPatchError:()=>dt,_areEquals:()=>eu,applyOperation:()=>Ri,applyPatch:()=>Rp,applyReducer:()=>wL,deepClone:()=>bL,getValueByPointer:()=>xp,validate:()=>FR,validator:()=>wp});d();c();l();u();d();c();l();u();var AL=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},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)}}(),CL=Object.prototype.hasOwnProperty;function Ap(e,t){return CL.call(e,t)}function Cp(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 o in e)Ap(e,o)&&n.push(o);return n}function Mt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function bp(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 on(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Zc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function vp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(vp(e[t]))return!0}else if(typeof e=="object"){for(var n=Cp(e),o=n.length,i=0;i<o;i++)if(vp(e[n[i]]))return!0}}return!1}function ER(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
+ `)}var Jc=function(e){AL(t,e);function t(r,n,o,i,a){var p=this.constructor,f=e.call(this,ER(r,{name:n,index:o,operation:i,tree:a}))||this;return f.name=n,f.index=o,f.operation=i,f.tree=a,Object.setPrototypeOf(f,p.prototype),f.message=ER(r,{name:n,index:o,operation:i,tree:a}),f}return t}(Error);var dt=Jc,bL=Mt,Za={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=xp(r,this.path);n&&(n=Mt(n));var o=Ri(r,{op:"remove",path:this.from}).removed;return Ri(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=xp(r,this.from);return Ri(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:eu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},xL={add:function(e,t,r){return bp(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:Za.move,copy:Za.copy,test:Za.test,_get:Za._get};function xp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Ri(e,r),r.value}function Ri(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):wp(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=xp(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=eu(e,t.value),a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Mt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,A=f.length,x=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=wp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Zc(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-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&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==A-1&&(x=t.path),x!==void 0&&y(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!bp(h))throw new dt("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",i,t,e);bp(h)&&(h=~~h)}if(g>=A){if(r&&t.op==="add"&&h>m.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=xL[t.op].call(t,m,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=A){var a=Za[t.op].call(t,m,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(m=m[h],r&&g<A&&(!m||typeof m!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Rp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Mt(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=Ri(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function wL(e,t,r){var n=Ri(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function wp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Za[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("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 dt("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 dt("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")&&vp(e.value))throw new dt("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 o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new dt("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 dt("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 a={op:"_get",path:e.from,value:void 0},p=FR([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function FR(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Rp(Mt(t),Mt(e),r||!0);else{r=r||wp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function eu(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),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!eu(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(i=p.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=i;o--!==0;)if(a=p[o],!eu(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var PS={};Ys(PS,{compare:()=>OL,generate:()=>ES,observe:()=>kL,unobserve:()=>PL});d();c();l();u();var FS=new WeakMap,RL=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),IL=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function EL(e){return FS.get(e)}function FL(e,t){return e.observers.get(t)}function TL(e,t){e.observers.delete(t.callback)}function PL(e,t){t.unobserve()}function kL(e,t){var r=[],n,o=EL(e);if(!o)o=new RL(e),FS.set(e,o);else{var i=FL(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var a=function(){ES(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){ES(n),clearTimeout(n.next),TL(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new IL(t,n)),n}function ES(e,t){t===void 0&&(t=!1);var r=FS.get(e.object);TS(r.value,e.object,e.patches,"",t),e.patches.length&&Rp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function TS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Cp(t),a=Cp(e),p=!1,f=!1,m=a.length-1;m>=0;m--){var g=a[m],A=e[g];if(Ap(t,g)&&!(t[g]===void 0&&A!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof A=="object"&&A!=null&&typeof x=="object"&&x!=null&&Array.isArray(A)===Array.isArray(x)?TS(A,x,r,n+"/"+on(g),o):A!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+on(g),value:Mt(A)}),r.push({op:"replace",path:n+"/"+on(g),value:Mt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+on(g),value:Mt(A)}),r.push({op:"remove",path:n+"/"+on(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&i.length==a.length))for(var m=0;m<i.length;m++){var g=i[m];!Ap(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+on(g),value:Mt(t[g])})}}}function OL(e,t,r){r===void 0&&(r=!1);var n=[];return TS(e,t,n,"",r),n}var Ip=Object.assign({},IS,PS,{JsonPatchError:Jc,deepClone:Mt,escapePathComponent:on,unescapePathComponent:Zc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var kS=function(e,t){return kS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},kS(e,t)};function an(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");kS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function TR(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function p(g){try{m(n.next(g))}catch(A){a(A)}}function f(g){try{m(n.throw(g))}catch(A){a(A)}}function m(g){g.done?i(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function Ep(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=p(0),a.throw=p(1),a.return=p(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(i=m[0]&2?o.return:m[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,m[1])).done)return i;switch(o=0,i&&(m=[m[0]&2,i.value]),m[0]){case 0:case 1:i=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){r.label=m[1];break}if(m[0]===6&&r.label<i[1]){r.label=i[1],i=m;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(m);break}i[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=i=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function jn(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 Ja(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(p){a={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function es(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Ii(e){return this instanceof Ii?(this.v=e,this):new Ii(e)}function PR(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,A)}}function p(h,y){n[h]&&(o[h]=function(b){return new Promise(function(w,I){i.push([h,b,w,I])>1||f(h,b)})},y&&(o[h]=y(o[h])))}function f(h,y){try{m(n[h](y))}catch(b){x(i[0][3],b)}}function m(h){h.value instanceof Ii?Promise.resolve(h.value.v).then(g,A):x(i[0][2],h)}function g(h){f("next",h)}function A(h){f("throw",h)}function x(h,y){h(y),i.shift(),i.length&&f(i[0][0],i[0][1])}}function kR(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 jn=="function"?jn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(p,f){a=e[i](a),o(p,f,a.done,a.value)})}}function o(i,a,p,f){Promise.resolve(f).then(function(m){i({value:m,done:p})},a)}}d();c();l();u();function je(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function ts(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 Fp=ts(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
34
34
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
35
- `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function ru(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ns=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,o,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var p=jn(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(je(g))try{g()}catch(b){a=b instanceof Ip?b.errors:[b]}var A=this._finalizers;if(A){this._finalizers=null;try{for(var x=jn(A),h=x.next();!h.done;h=x.next()){var y=h.value;try{_R(y)}catch(b){a=a??[],b instanceof Ip?a=ts(ts([],es(a)),es(b.errors)):a.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(a)throw new Ip(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_R(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)&&ru(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ru(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var NS=ns.EMPTY;function Ep(e){return e instanceof ns||e&&"closed"in e&&je(e.remove)&&je(e.add)&&je(e.unsubscribe)}function _R(e){je(e)?e():e.unsubscribe()}d();c();l();u();var Nr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var os={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=os.delegate;return o?.setTimeout?o.setTimeout.apply(o,ts([e,t],es(r))):setTimeout.apply(void 0,ts([e,t],es(r)))},clearTimeout:function(e){var t=os.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Fp(e){os.setTimeout(function(){var t=Nr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function nu(){}d();c();l();u();var NR=function(){return DS("C",void 0,void 0)}();function DR(e){return DS("E",void 0,e)}function qR(e){return DS("N",e,void 0)}function DS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var Ea=null;function as(e){if(Nr.useDeprecatedSynchronousErrorHandling){var t=!Ea;if(t&&(Ea={errorThrown:!1,error:null}),e(),t){var r=Ea,n=r.errorThrown,o=r.error;if(Ea=null,n)throw o}}else e()}function MR(e){Nr.useDeprecatedSynchronousErrorHandling&&Ea&&(Ea.errorThrown=!0,Ea.error=e)}var ou=function(e){an(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ep(r)&&r.add(n)):n.destination=DL,n}return t.create=function(r,n,o){return new Pp(r,n,o)},t.prototype.next=function(r){this.isStopped?MS(qR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?MS(DR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?MS(NR,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}(ns);var OL=Function.prototype.bind;function qS(e,t){return OL.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){Tp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Tp(n)}else Tp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Tp(r)}},e}(),Pp=function(e){an(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(je(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&Nr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&qS(r.next,p),error:r.error&&qS(r.error,p),complete:r.complete&&qS(r.complete,p)}):i=r}return a.destination=new _L(i),a}return t}(ou);function Tp(e){Nr.useDeprecatedSynchronousErrorHandling?MR(e):Fp(e)}function NL(e){throw e}function MS(e,t){var r=Nr.onStoppedNotification;r&&os.setTimeout(function(){return r(e,t)})}var DL={closed:!0,next:nu,error:NL,complete:nu};d();c();l();u();var is=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function ss(e){return e}function kp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return jS(e)}function jS(e){return e.length===0?ss:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var it=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 o=this,a=ML(t)?t:new Pp(t,r,n);return as(function(){var i=o,p=i.operator,f=i.source;a.add(p?p.call(a,f):f?o._subscribe(a):o._trySubscribe(a))}),a},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=jR(r),new r(function(o,a){var i=new Pp({next:function(p){try{t(p)}catch(f){a(f),i.unsubscribe()}},error:a,complete:o});n.subscribe(i)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[is]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return jS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=jR(t),new t(function(n,o){var a;r.subscribe(function(i){return a=i},function(i){return o(i)},function(){return n(a)})})},e.create=function(t){return new e(t)},e}();function jR(e){var t;return(t=e??Nr.Promise)!==null&&t!==void 0?t:Promise}function qL(e){return e&&je(e.next)&&je(e.error)&&je(e.complete)}function ML(e){return e&&e instanceof ou||qL(e)&&Ep(e)}d();c();l();u();function jL(e){return je(e?.lift)}function yt(e){return function(t){if(jL(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")}}d();c();l();u();function wt(e,t,r,n,o){return new VL(e,t,r,n,o)}var VL=function(e){an(t,e);function t(r,n,o,a,i,p){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=a?function(m){try{a(m)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,f._complete=o?function(){try{o()}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._complete,f}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}(ou);d();c();l();u();d();c();l();u();var VR=rs(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var sn=function(e){an(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 LR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new VR},t.prototype.next=function(r){var n=this;as(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=jn(n.currentObservers),p=i.next();!p.done;p=i.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;as(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;as(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,o=this,a=o.hasError,i=o.isStopped,p=o.observers;return a||i?NS:(this.currentObservers=null,p.push(r),new ns(function(){n.currentObservers=null,ru(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,a=n.thrownError,i=n.isStopped;o?r.error(a):i&&r.complete()},t.prototype.asObservable=function(){var r=new it;return r.source=this,r},t.create=function(r,n){return new LR(r,n)},t}(it);var LR=function(e){an(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:NS},t}(sn);d();c();l();u();d();c();l();u();var VS={now:function(){return(VS.delegate||Date).now()},delegate:void 0};var Op=function(e){an(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=VS);var a=e.call(this)||this;return a._bufferSize=r,a._windowTime=n,a._timestampProvider=o,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,r),a._windowTime=Math.max(1,n),a}return t.prototype.next=function(r){var n=this,o=n.isStopped,a=n._buffer,i=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,a=o._infiniteTimeWindow,i=o._buffer,p=i.slice(),f=0;f<p.length&&!r.closed;f+=a?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,a=r._buffer,i=r._infiniteTimeWindow,p=(i?1:2)*n;if(n<1/0&&p<a.length&&a.splice(0,a.length-p),!i){for(var f=o.now(),m=0,g=1;g<a.length&&a[g]<=f;g+=2)m=g;m&&a.splice(0,m+1)}},t}(sn);d();c();l();u();var _p=new it(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function UR(e){return e&&je(e.schedule)}function LL(e){return e[e.length-1]}function QR(e){return UR(LL(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Np=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Dp(e){return je(e?.then)}d();c();l();u();function qp(e){return je(e[is])}d();c();l();u();function Mp(e){return Symbol.asyncIterator&&je(e?.[Symbol.asyncIterator])}d();c();l();u();function jp(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.")}d();c();l();u();d();c();l();u();function UL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Vp=UL();function Lp(e){return je(e?.[Vp])}d();c();l();u();function Up(e){return kR(this,arguments,function(){var r,n,o,a;return Rp(this,function(i){switch(i.label){case 0:r=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Ia(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,Ia(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ia(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Qp(e){return je(e?.getReader)}function Rt(e){if(e instanceof it)return e;if(e!=null){if(qp(e))return QL(e);if(Np(e))return BL(e);if(Dp(e))return GL(e);if(Mp(e))return BR(e);if(Lp(e))return $L(e);if(Qp(e))return HL(e)}throw jp(e)}function QL(e){return new it(function(t){var r=e[is]();if(je(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function BL(e){return new it(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function GL(e){return new it(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Fp)})}function $L(e){return new it(function(t){var r,n;try{for(var o=jn(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(p){r={error:p}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function BR(e){return new it(function(t){zL(e,t).catch(function(r){return t.error(r)})})}function HL(e){return BR(Up(e))}function zL(e,t){var r,n,o,a;return PR(this,void 0,void 0,function(){var i,p;return Rp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=OR(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=f.sent(),o={error:p},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}d();c();l();u();d();c();l();u();function xr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var a=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!o)return a}function Bp(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(wt(n,function(o){return xr(n,e,function(){return n.next(o)},t)},function(){return xr(n,e,function(){return n.complete()},t)},function(o){return xr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Gp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function GR(e,t){return Rt(e).pipe(Gp(t),Bp(t))}d();c();l();u();function $R(e,t){return Rt(e).pipe(Gp(t),Bp(t))}d();c();l();u();function HR(e,t){return new it(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function zR(e,t){return new it(function(r){var n;return xr(r,t,function(){n=e[Vp](),xr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(p){r.error(p);return}i?r.complete():r.next(a)},0,!0)}),function(){return je(n?.return)&&n.return()}})}d();c();l();u();function $p(e,t){if(!e)throw new Error("Iterable cannot be null");return new it(function(r){xr(r,t,function(){var n=e[Symbol.asyncIterator]();xr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function WR(e,t){return $p(Up(e),t)}function YR(e,t){if(e!=null){if(qp(e))return GR(e,t);if(Np(e))return HR(e,t);if(Dp(e))return $R(e,t);if(Mp(e))return $p(e,t);if(Lp(e))return zR(e,t);if(Qp(e))return WR(e,t)}throw jp(e)}function Fa(e,t){return t?YR(e,t):Rt(e)}function lt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=QR(e);return Fa(e,r)}d();c();l();u();function st(e,t){var r=je(e)?e:function(){return e},n=function(o){return o.error(r())};return new it(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var KR=rs(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Hp(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(p){i=p,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new KR)}})})}d();c();l();u();function Ta(e,t){return yt(function(r,n){var o=0;r.subscribe(wt(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function XR(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,A=!1,x=function(){A&&!f.length&&!m&&t.complete()},h=function(b){return m<n?y(b):f.push(b)},y=function(b){a&&t.next(b),m++;var w=!1;Rt(r(b,g++)).subscribe(wt(t,function(I){o?.(I),a?h(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{m--;for(var I=function(){var F=f.shift();i?xr(t,i,function(){return y(F)}):y(F)};f.length&&m<n;)I();x()}catch(F){t.error(F)}}))};return e.subscribe(wt(t,h,function(){A=!0,x()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),je(t)?rr(function(n,o){return Ta(function(a,i){return t(n,a,o,i)})(Rt(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return XR(n,o,e,r)}))}function LS(e){return e===void 0&&(e=1/0),rr(ss,e)}d();c();l();u();function zp(e){return new it(function(t){Rt(e()).subscribe(t)})}d();c();l();u();function au(e){return yt(function(t,r){var n=null,o=!1,a;n=t.subscribe(wt(r,void 0,void 0,function(i){a=Rt(e(i,au(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}d();c();l();u();function Wp(e,t){return je(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function US(e){return yt(function(t,r){var n=!1;t.subscribe(wt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Pa(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function QS(e,t){return yt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(wt(n,function(f){o?.unsubscribe();var m=0,g=a++;Rt(e(f,g)).subscribe(o=wt(n,function(A){return n.next(t?t(f,A,g,m++):A)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Yp(e){return yt(function(t,r){Rt(e).subscribe(wt(r,function(){return r.complete()},nu)),!r.closed&&t.subscribe(r)})}d();c();l();u();function BS(e,t,r){var n=je(e)||t||r?{next:e,error:t,complete:r}:e;return n?yt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(wt(a,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),a.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;p&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):ss}d();c();l();u();d();c();l();u();function ZR(e){return` \r
36
- `.indexOf(e)>=0}function Kp(e){for(var t=["topLevel"],r=0,n,o,a,i=function(F){return t.push(F)},p=function(F){return t[t.length-1]=F},f=function(F){n==null&&(n=r,o=t.length,a=F)},m=function(F){F===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},A=function(){return r--},x=function(F){if("0"<=F&&F<="9"){i("number");return}switch(F){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":x(y);break;case"string":switch(y){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":y==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(A(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(A(),g());break;case"arrayNeedsValue":y==="]"?g():ZR(y)||(m("collectionItem"),p("arrayNeedsComma"),x(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":ZR(y)||(m("collectionItem"),p("objectNeedsComma"),x(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(F){return b.push(F.slice(e.length-e.lastIndexOf(F[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function eI(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&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 o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Zp(e,t,r){for(let a=0;a<28;a=a+7){let i=e>>>a,p=!(!(i>>>7)&&t==0),f=(p?i|128:i)&255;if(r.push(f),!p)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let a=3;a<31;a=a+7){let i=t>>>a,p=!!(i>>>7),f=(p?i|128:i)&255;if(r.push(f),!p)return}r.push(t>>>31&1)}}var Xp=4294967296;function GS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let f=Number(e.slice(i,p));o*=r,n=n*r+f,n>=Xp&&(o=o+(n/Xp|0),n=n%Xp)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?rI(n,o):HS(n,o)}function tI(e,t){let r=HS(e,t),n=r.hi&2147483648;n&&(r=rI(r.lo,r.hi));let o=$S(r.lo,r.hi);return n?"-"+o:o}function $S(e,t){if({lo:e,hi:t}=WL(e,t),t<=2097151)return String(Xp*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(p+=Math.floor(i/f),i%=f),p.toString()+JR(i)+JR(a)}function WL(e,t){return{lo:e>>>0,hi:t>>>0}}function HS(e,t){return{lo:e|0,hi:t|0}}function rI(e,t){return t=~t,e?e=~e+1:t+=1,HS(e,t)}var JR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function zS(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 nI(){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}d();c();l();u();var Dr=YL();function YL(){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"&&(!!S.Deno||!!S.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),oI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),aI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),oI(r),GS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),aI(r),GS(r)},dec(r,n){return tI(r,n)},uDec(r,n){return $S(r,n)}}}function oI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function aI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var WS=Symbol.for("@bufbuild/protobuf/text-encoding");function YS(){if(S[WS]==null){let e=new S.TextEncoder,t=new S.TextDecoder,r;S[WS]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new S.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return S[WS]}var yo;(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"})(yo||(yo={}));var KL=34028234663852886e22,XL=-34028234663852886e22,ZL=4294967295,JL=2147483647,eU=-2147483648,Ne=class{constructor(t=YS().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 o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].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(iI(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return KS(t),zS(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){tU(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){iI(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){KS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return KS(t),t=(t<<1^t>>31)>>>0,zS(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Dr.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Dr.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Dr.enc(t);return Zp(r.lo,r.hi,this.buf),this}sint64(t){let r=Dr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return Zp(o,a,this.buf),this}uint64(t){let r=Dr.uEnc(t);return Zp(r.lo,r.hi,this.buf),this}},ie=class{constructor(t,r=YS().decodeUtf8){this.decodeUtf8=r,this.varint64=eI,this.uint32=nI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case yo.Varint:for(;this.buf[this.pos++]&128;);break;case yo.Bit64:this.pos+=4;case yo.Bit32:this.pos+=4;break;case yo.LengthDelimited:let a=this.uint32();this.pos+=a;break;case yo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===yo.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,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 Dr.dec(...this.varint64())}uint64(){return Dr.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Dr.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 Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.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(t){return this.decodeUtf8(this.bytes(),t)}};function KS(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>JL||e<eU)throw new Error("invalid int32: "+e)}function iI(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>ZL||e<0)throw new Error("invalid uint32: "+e)}function tU(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>KL||e<XL))throw new Error("invalid float32: "+e)}var rU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function XS(){return{fields:{}}}var iu={encode(e,t=new Ne){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&ev.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=ev.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return iu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=XS();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 sI(){return{key:"",value:void 0}}var ev={encode(e,t=new Ne){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ev.fromPartial(e??{})},fromPartial(e){let t=sI();return t.key=e.key??"",t.value=e.value??void 0,t}};function ZS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Ne){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&&iu.encode(iu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&su.encode(su.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=iu.unwrap(iu.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=su.unwrap(su.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=ZS();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=ZS();if(e===null)t.nullValue=rU.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(S.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new S.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 JS(){return{values:[]}}var su={encode(e,t=new Ne){for(let r of e.values)Se.encode(Se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=JS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=JS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=JS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},nU=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 cI(){return{op:0,path:"",from:void 0,value:void 0}}var ef={encode(e,t=new Ne){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&&Se.encode(Se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ef.fromPartial(e??{})},fromPartial(e){let t=cI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function uI(){return{id:"",type:"",function:void 0}}var tf={encode(e,t=new Ne){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&rf.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=rf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tf.fromPartial(e??{})},fromPartial(e){let t=uI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?rf.fromPartial(e.function):void 0,t}};function lI(){return{name:"",arguments:""}}var rf={encode(e,t=new Ne){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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rf.fromPartial(e??{})},fromPartial(e){let t=lI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function dI(){return{value:"",mimeType:""}}var nf={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=dI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function pI(){return{value:"",mimeType:void 0}}var of={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=pI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function fI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Ne){return e.data!==void 0&&nf.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&of.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=nf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=of.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=fI();return t.data=e.data!==void 0&&e.data!==null?nf.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?of.fromPartial(e.url):void 0,t}};function mI(){return{text:""}}var af={encode(e,t=new Ne){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=mI();return t.text=e.text??"",t}};function gI(){return{source:void 0,metadata:void 0}}var sf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var cf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var uf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var lf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function vI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var df={encode(e,t=new Ne){return e.text!==void 0&&af.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&sf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&cf.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&uf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&lf.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=af.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=sf.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=cf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=uf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=lf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=vI();return t.text=e.text!==void 0&&e.text!==null?af.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?sf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?cf.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?uf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?lf.fromPartial(e.document):void 0,t}};function AI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var pf={encode(e,t=new Ne){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)tf.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)df.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(tf.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(df.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=AI();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=>tf.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>df.fromPartial(r))||[],t}};function CI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var ff={encode(e,t=new Ne){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Se.encode(Se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.reason=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.toolCallId=r.string();continue;case 5:if(a!==42)break;o.responseSchema=Se.unwrap(Se.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=CI();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}},oU=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 bI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ae={encode(e,t=new Ne){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=aU(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=bI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function xI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var mf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function wI(){return{baseEvent:void 0,messageId:"",delta:""}}var gf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function RI(){return{baseEvent:void 0,messageId:""}}var hf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function II(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var yf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function EI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function FI(){return{baseEvent:void 0,toolCallId:""}}var vf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function TI(){return{baseEvent:void 0,snapshot:void 0}}var Af={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function PI(){return{baseEvent:void 0,delta:[]}}var Cf={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)ef.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(ef.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>ef.fromPartial(r))||[],t}};function kI(){return{baseEvent:void 0,messages:[]}}var bf={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)pf.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(pf.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>pf.fromPartial(r))||[],t}};function OI(){return{baseEvent:void 0,event:void 0,source:void 0}}var xf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function _I(){return{baseEvent:void 0,name:"",value:void 0}}var wf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function NI(){return{baseEvent:void 0,threadId:"",runId:""}}var Rf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function DI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var If={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.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&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)ff.encode(r,t.uint32(50).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=Se.unwrap(Se.decode(r,r.uint32()));continue;case 5:if(a!==42)break;o.outcome=r.string();continue;case 6:if(a!==50)break;o.interrupts.push(ff.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>ff.fromPartial(r))||[],t}};function qI(){return{baseEvent:void 0,code:void 0,message:""}}var Ef={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=qI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function MI(){return{baseEvent:void 0,stepName:""}}var Ff={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=MI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function jI(){return{baseEvent:void 0,stepName:""}}var Tf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=jI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function VI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Pf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function LI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var kf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=LI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.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 UI(){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 QI={encode(e,t=new Ne){return e.textMessageStart!==void 0&&mf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&gf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&hf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&yf.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Sf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&vf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Af.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Cf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&bf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&xf.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&wf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Rf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&If.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ef.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Ff.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Tf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Pf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&kf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=UI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=mf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=gf.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=hf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=yf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=Sf.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=vf.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Af.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Cf.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=bf.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=xf.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=wf.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=Rf.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=If.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=Ef.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Ff.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=Tf.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Pf.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=kf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return QI.fromPartial(e??{})},fromPartial(e){let t=UI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?mf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?gf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?hf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?yf.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Sf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?vf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Af.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Cf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?bf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?xf.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?wf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Rf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?If.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ef.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Ff.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Tf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Pf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?kf.fromPartial(e.toolCallChunk):void 0,t}};function aU(e){let t=S.Number(e.toString());if(t>S.Number.MAX_SAFE_INTEGER)throw new S.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<S.Number.MIN_SAFE_INTEGER)throw new S.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Jp=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},iU=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Jp(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Jp(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Jp(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Jp(e.document.source),metadata:e.document.metadata}}};function BI(e){let t=QI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=oU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===j.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>iU(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===j.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:a}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===j.STATE_DELTA)for(let n of r.delta)n.op=nU[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),hp.parse(r)}var tv="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var cU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,rv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(cU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},GI=e=>e==="*"||e==="x"||e==="X",$I=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},uU=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],lU=(e,t)=>{if(GI(e)||GI(t))return 0;let[r,n]=uU($I(e),$I(t));return r>n?1:r<n?-1:0},nv=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=lU(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var cu=(e,t)=>{let r=rv(e),n=rv(t),o=r.pop(),a=n.pop(),i=nv(r,n);return i!==0?i:o&&a?nv(o.split("."),a.split(".")):o||a?o?-1:1:0};var Qe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function uu(){return po()}function iv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&iv(t);return e}var HI=512*1024;function zI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let p=0;p<i.length;p++)o.push(i[p]);else{let p=Object.keys(i);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=i&&!zI(t,r,HI),f=p?Qe(t):t,m=p?Qe(r):r,g=!1,A=!1,x;for(let h of e)try{p&&(iv(f),iv(m));let y=yield n(h,f,m);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==f&&(f=Qe(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==m&&(m=Qe(y.state),A=!0,b=!0),p&&b&&zI(f,m,HI)&&(p=!1),x=y.stopPropagation,x===!0)break}catch(y){if(i&&y instanceof TypeError){if(a)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else a||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(f)?Qe(f):f}:{}),...(A?{state:Object.isFrozen(m)?Qe(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _Ye.apply(this,arguments)}function Of(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function lu(e){if(e instanceof sv)return e;if(e===!0)return new sv(Of(!0))}var sv=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function ov(e){return e.enabled?new sv(e):void 0}function dU(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var JI=(e,t,r,n,o)=>{let a=lu(o),i=Qe(r.messages),p=Qe(e.state),f={},m=A=>{A.messages!==void 0&&(i=A.messages,f.messages=A.messages),A.state!==void 0&&(p=A.state,f.state=A.state)},g=()=>{let A=Qe(f);return f={},A.messages!==void 0||A.state!==void 0?lt(A):_p};return t.pipe(Wp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(A){let x=yield Ye(n,i,p,(h,y,b)=>h.onEvent?.({event:A,agent:r,input:e,messages:y,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",A,{type:A.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",A,{type:A.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(A.type){case j.TEXT_MESSAGE_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onTextMessageStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:w}=A;if(!i.find(I=>I.id===y)){let I={id:y,role:b,content:"",...(w!==void 0&&{name:w})};i.push(I),m({messages:i})}}return g()}case j.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=A,b=i.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,F,E)=>I.onTextMessageContentEvent?.({event:A,messages:F,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:i})),g()}case j.TEXT_MESSAGE_END:{let{messageId:h}=A,y=i.find(b=>b.id===h);return y?(m(yield Ye(n,i,p,(b,w,I)=>b.onTextMessageEndEvent?.({event:A,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case j.TOOL_CALL_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onToolCallStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:w}=A,I=dU(i,w,y);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:y,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case j.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=A,b=i.find(F=>F.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(F=>F.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,i,p,(F,E,k)=>{let T=w.function.arguments,q=w.function.name,G={};try{G=Kp(T)}catch{}return F.onToolCallArgsEvent?.({event:A,messages:E,state:k,agent:r,input:e,toolCallBuffer:T,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=y,m({messages:i})),g()}case j.TOOL_CALL_END:{let{toolCallId:h}=A,y=i.find(w=>w.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(w=>w.id===h);return b?(m(yield Ye(n,i,p,(w,I,F)=>{let E=b.function.arguments,k=b.function.name,T={};try{T=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:A,messages:I,state:F,agent:r,input:e,toolCallName:k,toolCallArgs:T})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case j.TOOL_CALL_RESULT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onToolCallResultEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:w,role:I}=A,F={id:y,toolCallId:b,role:I||"tool",content:w},E=i.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(T=>T.id===b));if(E===-1)i.push(F);else{let k=E+1;for(;k<i.length&&i[k].role==="tool";)k++;i.splice(k,0,F)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:F,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case j.STATE_SNAPSHOT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onStateSnapshotEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:y}=A;p=y,m({state:p})}return g()}case j.STATE_DELTA:{let h=yield Ye(n,i,p,(y,b,w)=>y.onStateDeltaEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:y}=A;try{p=wp.applyPatch(p,y,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function tu(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var rs=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,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var p=jn(a),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(je(g))try{g()}catch(b){i=b instanceof Fp?b.errors:[b]}var A=this._finalizers;if(A){this._finalizers=null;try{for(var x=jn(A),h=x.next();!h.done;h=x.next()){var y=h.value;try{OR(y)}catch(b){i=i??[],b instanceof Fp?i=es(es([],Ja(i)),Ja(b.errors)):i.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(i)throw new Fp(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)OR(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)&&tu(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&tu(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var OS=rs.EMPTY;function Tp(e){return e instanceof rs||e&&"closed"in e&&je(e.remove)&&je(e.add)&&je(e.unsubscribe)}function OR(e){je(e)?e():e.unsubscribe()}d();c();l();u();var Nr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var ns={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ns.delegate;return o?.setTimeout?o.setTimeout.apply(o,es([e,t],Ja(r))):setTimeout.apply(void 0,es([e,t],Ja(r)))},clearTimeout:function(e){var t=ns.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Pp(e){ns.setTimeout(function(){var t=Nr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function ru(){}d();c();l();u();var _R=function(){return _S("C",void 0,void 0)}();function NR(e){return _S("E",void 0,e)}function DR(e){return _S("N",e,void 0)}function _S(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var Ei=null;function os(e){if(Nr.useDeprecatedSynchronousErrorHandling){var t=!Ei;if(t&&(Ei={errorThrown:!1,error:null}),e(),t){var r=Ei,n=r.errorThrown,o=r.error;if(Ei=null,n)throw o}}else e()}function qR(e){Nr.useDeprecatedSynchronousErrorHandling&&Ei&&(Ei.errorThrown=!0,Ei.error=e)}var nu=function(e){an(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Tp(r)&&r.add(n)):n.destination=qL,n}return t.create=function(r,n,o){return new Op(r,n,o)},t.prototype.next=function(r){this.isStopped?DS(DR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?DS(NR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?DS(_R,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}(rs);var _L=Function.prototype.bind;function NS(e,t){return _L.call(e,t)}var NL=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){kp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){kp(n)}else kp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){kp(r)}},e}(),Op=function(e){an(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(je(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&Nr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&NS(r.next,p),error:r.error&&NS(r.error,p),complete:r.complete&&NS(r.complete,p)}):a=r}return i.destination=new NL(a),i}return t}(nu);function kp(e){Nr.useDeprecatedSynchronousErrorHandling?qR(e):Pp(e)}function DL(e){throw e}function DS(e,t){var r=Nr.onStoppedNotification;r&&ns.setTimeout(function(){return r(e,t)})}var qL={closed:!0,next:ru,error:DL,complete:ru};d();c();l();u();var is=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function as(e){return e}function _p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qS(e)}function qS(e){return e.length===0?as:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var at=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 o=this,i=jL(t)?t:new Op(t,r,n);return os(function(){var a=o,p=a.operator,f=a.source;i.add(p?p.call(i,f):f?o._subscribe(i):o._trySubscribe(i))}),i},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=MR(r),new r(function(o,i){var a=new Op({next:function(p){try{t(p)}catch(f){i(f),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[is]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=MR(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function MR(e){var t;return(t=e??Nr.Promise)!==null&&t!==void 0?t:Promise}function ML(e){return e&&je(e.next)&&je(e.error)&&je(e.complete)}function jL(e){return e&&e instanceof nu||ML(e)&&Tp(e)}d();c();l();u();function VL(e){return je(e?.lift)}function yt(e){return function(t){if(VL(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")}}d();c();l();u();function Rt(e,t,r,n,o){return new LL(e,t,r,n,o)}var LL=function(e){an(t,e);function t(r,n,o,i,a,p){var f=e.call(this,r)||this;return f.onFinalize=a,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=i?function(m){try{i(m)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,f._complete=o?function(){try{o()}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._complete,f}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}(nu);d();c();l();u();d();c();l();u();var jR=ts(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var sn=function(e){an(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 VR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new jR},t.prototype.next=function(r){var n=this;os(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=jn(n.currentObservers),p=a.next();!p.done;p=a.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;os(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;os(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,o=this,i=o.hasError,a=o.isStopped,p=o.observers;return i||a?OS:(this.currentObservers=null,p.push(r),new rs(function(){n.currentObservers=null,tu(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new at;return r.source=this,r},t.create=function(r,n){return new VR(r,n)},t}(at);var VR=function(e){an(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:OS},t}(sn);d();c();l();u();d();c();l();u();var MS={now:function(){return(MS.delegate||Date).now()},delegate:void 0};var Np=function(e){an(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=MS);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(i.push(r),!a&&i.push(p.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,p=a.slice(),f=0;f<p.length&&!r.closed;f+=i?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,p=(a?1:2)*n;if(n<1/0&&p<i.length&&i.splice(0,i.length-p),!a){for(var f=o.now(),m=0,g=1;g<i.length&&i[g]<=f;g+=2)m=g;m&&i.splice(0,m+1)}},t}(sn);d();c();l();u();var Dp=new at(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function LR(e){return e&&je(e.schedule)}function UL(e){return e[e.length-1]}function UR(e){return LR(UL(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var qp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Mp(e){return je(e?.then)}d();c();l();u();function jp(e){return je(e[is])}d();c();l();u();function Vp(e){return Symbol.asyncIterator&&je(e?.[Symbol.asyncIterator])}d();c();l();u();function Lp(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.")}d();c();l();u();d();c();l();u();function QL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Up=QL();function Qp(e){return je(e?.[Up])}d();c();l();u();function Bp(e){return PR(this,arguments,function(){var r,n,o,i;return Ep(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Ii(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Ii(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ii(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Gp(e){return je(e?.getReader)}function It(e){if(e instanceof at)return e;if(e!=null){if(jp(e))return BL(e);if(qp(e))return GL(e);if(Mp(e))return $L(e);if(Vp(e))return QR(e);if(Qp(e))return HL(e);if(Gp(e))return zL(e)}throw Lp(e)}function BL(e){return new at(function(t){var r=e[is]();if(je(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function GL(e){return new at(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function $L(e){return new at(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Pp)})}function HL(e){return new at(function(t){var r,n;try{for(var o=jn(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(p){r={error:p}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function QR(e){return new at(function(t){WL(e,t).catch(function(r){return t.error(r)})})}function zL(e){return QR(Bp(e))}function WL(e,t){var r,n,o,i;return TR(this,void 0,void 0,function(){var a,p;return Ep(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=kR(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=f.sent(),o={error:p},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}d();c();l();u();d();c();l();u();function xr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function $p(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(Rt(n,function(o){return xr(n,e,function(){return n.next(o)},t)},function(){return xr(n,e,function(){return n.complete()},t)},function(o){return xr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Hp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function BR(e,t){return It(e).pipe(Hp(t),$p(t))}d();c();l();u();function GR(e,t){return It(e).pipe(Hp(t),$p(t))}d();c();l();u();function $R(e,t){return new at(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function HR(e,t){return new at(function(r){var n;return xr(r,t,function(){n=e[Up](),xr(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(p){r.error(p);return}a?r.complete():r.next(i)},0,!0)}),function(){return je(n?.return)&&n.return()}})}d();c();l();u();function zp(e,t){if(!e)throw new Error("Iterable cannot be null");return new at(function(r){xr(r,t,function(){var n=e[Symbol.asyncIterator]();xr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function zR(e,t){return zp(Bp(e),t)}function WR(e,t){if(e!=null){if(jp(e))return BR(e,t);if(qp(e))return $R(e,t);if(Mp(e))return GR(e,t);if(Vp(e))return zp(e,t);if(Qp(e))return HR(e,t);if(Gp(e))return zR(e,t)}throw Lp(e)}function Fi(e,t){return t?WR(e,t):It(e)}function lt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=UR(e);return Fi(e,r)}d();c();l();u();function st(e,t){var r=je(e)?e:function(){return e},n=function(o){return o.error(r())};return new at(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var YR=ts(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Wp(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(p){a=p,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new YR)}})})}d();c();l();u();function Ti(e,t){return yt(function(r,n){var o=0;r.subscribe(Rt(n,function(i){n.next(e.call(t,i,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function KR(e,t,r,n,o,i,a,p){var f=[],m=0,g=0,A=!1,x=function(){A&&!f.length&&!m&&t.complete()},h=function(b){return m<n?y(b):f.push(b)},y=function(b){i&&t.next(b),m++;var w=!1;It(r(b,g++)).subscribe(Rt(t,function(I){o?.(I),i?h(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{m--;for(var I=function(){var F=f.shift();a?xr(t,a,function(){return y(F)}):y(F)};f.length&&m<n;)I();x()}catch(F){t.error(F)}}))};return e.subscribe(Rt(t,h,function(){A=!0,x()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),je(t)?rr(function(n,o){return Ti(function(i,a){return t(n,i,o,a)})(It(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return KR(n,o,e,r)}))}function jS(e){return e===void 0&&(e=1/0),rr(as,e)}d();c();l();u();function Yp(e){return new at(function(t){It(e()).subscribe(t)})}d();c();l();u();function ou(e){return yt(function(t,r){var n=null,o=!1,i;n=t.subscribe(Rt(r,void 0,void 0,function(a){i=It(e(a,ou(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}d();c();l();u();function Kp(e,t){return je(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function VS(e){return yt(function(t,r){var n=!1;t.subscribe(Rt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Pi(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function LS(e,t){return yt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(Rt(n,function(f){o?.unsubscribe();var m=0,g=i++;It(e(f,g)).subscribe(o=Rt(n,function(A){return n.next(t?t(f,A,g,m++):A)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function Xp(e){return yt(function(t,r){It(e).subscribe(Rt(r,function(){return r.complete()},ru)),!r.closed&&t.subscribe(r)})}d();c();l();u();function US(e,t,r){var n=je(e)||t||r?{next:e,error:t,complete:r}:e;return n?yt(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var p=!0;o.subscribe(Rt(i,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),i.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),i.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),i.error(f)},function(){var f,m;p&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):as}d();c();l();u();d();c();l();u();function XR(e){return` \r
36
+ `.indexOf(e)>=0}function Zp(e){for(var t=["topLevel"],r=0,n,o,i,a=function(F){return t.push(F)},p=function(F){return t[t.length-1]=F},f=function(F){n==null&&(n=r,o=t.length,i=F)},m=function(F){F===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},A=function(){return r--},x=function(F){if("0"<=F&&F<="9"){a("number");return}switch(F){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":x(y);break;case"string":switch(y){case"\"":g();break;case"\\":f("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(A(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(A(),g());break;case"arrayNeedsValue":y==="]"?g():XR(y)||(m("collectionItem"),p("arrayNeedsComma"),x(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(f("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":XR(y)||(m("collectionItem"),p("objectNeedsComma"),x(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(F){return b.push(F.slice(e.length-e.lastIndexOf(F[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function JR(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Jp=4294967296;function QS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,p){let f=Number(e.slice(a,p));o*=r,n=n*r+f,n>=Jp&&(o=o+(n/Jp|0),n=n%Jp)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?tI(n,o):GS(n,o)}function eI(e,t){let r=GS(e,t),n=r.hi&2147483648;n&&(r=tI(r.lo,r.hi));let o=BS(r.lo,r.hi);return n?"-"+o:o}function BS(e,t){if({lo:e,hi:t}=YL(e,t),t<=2097151)return String(Jp*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,p=o*2,f=1e7;return i>=f&&(a+=Math.floor(i/f),i%=f),a>=f&&(p+=Math.floor(a/f),a%=f),p.toString()+ZR(a)+ZR(i)}function YL(e,t){return{lo:e>>>0,hi:t>>>0}}function GS(e,t){return{lo:e|0,hi:t|0}}function tI(e,t){return t=~t,e?e=~e+1:t+=1,GS(e,t)}var ZR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function rI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;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}d();c();l();u();var Dr=KL();function KL(){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"&&(!!S.Deno||!!S.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>n||p<r)throw new Error(`invalid int64: ${a}`);return p},uParse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>i||p<o)throw new Error(`invalid uint64: ${a}`);return p},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),nI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),oI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),nI(r),QS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),oI(r),QS(r)},dec(r,n){return eI(r,n)},uDec(r,n){return BS(r,n)}}}function nI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function oI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var $S=Symbol.for("@bufbuild/protobuf/text-encoding");function XL(e){var t;S[$S]=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:zS(e.encodeUtf8.bind(e))})}function HS(){let e=S;if(!e[$S]){let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),XL(o)}return e[$S]}function zS(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var yo;(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"})(yo||(yo={}));var ZL=34028234663852886e22,JL=-34028234663852886e22,eU=4294967295,tU=2147483647,rU=-2147483648,Ne=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?zS(t):HS().encodeUtf8Into,this.buffer=aI,this.viewCache=oU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||nU;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(iu),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-iu,n=WS(r);return n>iu&&(this.ensureCapacity(n-iu),this.buffer.copyWithin(t+n,t+iu,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(iI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(YS(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=sI){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let A=t.charCodeAt(g);if(A>127)break;f[m++]=A}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=WS(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),p=WS(a);return p!=n&&o.copyWithin(i+p,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return iU(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return iI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return YS(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return YS(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Dr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Dr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Dr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Dr.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=Dr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let f=t>>>p,m=!(!(f>>>7)&&r==0);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let p=3;p<31;p=p+7){let f=r>>>p,m=!!(f>>>7);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},nU=128,iu=1,aI=new Uint8Array(0),oU=new DataView(aI.buffer),sI=32;function WS(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ae=class{constructor(t,r=HS().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=JR,this.uint32=rI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case yo.Varint:for(;this.buf[this.pos++]&128;);break;case yo.Bit64:this.pos+=4;case yo.Bit32:this.pos+=4;break;case yo.LengthDelimited:let i=this.uint32();this.pos+=i;break;case yo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,p]=this.tag();if(p===yo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(p,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,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 this.varint64(),Dr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Dr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Dr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.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(t){let r=this.bytes(),n=r.length;if(n<=sI){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function YS(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>tU||e<rU)throw new Error("invalid int32: "+e)}function iI(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>eU||e<0)throw new Error("invalid uint32: "+e)}function iU(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>ZL||e<JL))throw new Error("invalid float32: "+e)}var aU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function KS(){return{fields:{}}}var au={encode(e,t=new Ne){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&JS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=JS.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return au.fromPartial(e??{})},fromPartial(e){let t=KS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=KS();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 cI(){return{key:"",value:void 0}}var JS={encode(e,t=new Ne){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return JS.fromPartial(e??{})},fromPartial(e){let t=cI();return t.key=e.key??"",t.value=e.value??void 0,t}};function XS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Ne){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&&au.encode(au.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&su.encode(su.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=au.unwrap(au.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=su.unwrap(su.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=XS();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=XS();if(e===null)t.nullValue=aU.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(S.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new S.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 ZS(){return{values:[]}}var su={encode(e,t=new Ne){for(let r of e.values)Se.encode(Se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=ZS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},sU=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 uI(){return{op:0,path:"",from:void 0,value:void 0}}var tf={encode(e,t=new Ne){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&&Se.encode(Se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tf.fromPartial(e??{})},fromPartial(e){let t=uI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function lI(){return{id:"",type:"",function:void 0}}var rf={encode(e,t=new Ne){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&nf.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=nf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return rf.fromPartial(e??{})},fromPartial(e){let t=lI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?nf.fromPartial(e.function):void 0,t}};function dI(){return{name:"",arguments:""}}var nf={encode(e,t=new Ne){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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=dI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function pI(){return{value:"",mimeType:""}}var of={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=pI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function fI(){return{value:"",mimeType:void 0}}var af={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=fI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function mI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Ne){return e.data!==void 0&&of.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&af.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=of.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=af.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=mI();return t.data=e.data!==void 0&&e.data!==null?of.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?af.fromPartial(e.url):void 0,t}};function gI(){return{text:""}}var sf={encode(e,t=new Ne){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=gI();return t.text=e.text??"",t}};function hI(){return{source:void 0,metadata:void 0}}var cf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var uf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var lf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function vI(){return{source:void 0,metadata:void 0}}var df={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=vI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function AI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var pf={encode(e,t=new Ne){return e.text!==void 0&&sf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&cf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&uf.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&lf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&df.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=sf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=cf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=uf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=lf.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=df.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=AI();return t.text=e.text!==void 0&&e.text!==null?sf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?cf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?uf.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?lf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?df.fromPartial(e.document):void 0,t}};function CI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var ff={encode(e,t=new Ne){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)rf.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)pf.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(rf.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue;case 8:if(i!==66)break;o.contentParts.push(pf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=CI();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=>rf.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>pf.fromPartial(r))||[],t}};function bI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var mf={encode(e,t=new Ne){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Se.encode(Se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=Se.unwrap(Se.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=bI();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}},cU=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 xI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ae={encode(e,t=new Ne){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=uU(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=xI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function wI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var gf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function RI(){return{baseEvent:void 0,messageId:"",delta:""}}var hf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function II(){return{baseEvent:void 0,messageId:""}}var yf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function EI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function FI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var vf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function TI(){return{baseEvent:void 0,toolCallId:""}}var Af={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function PI(){return{baseEvent:void 0,snapshot:void 0}}var Cf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function kI(){return{baseEvent:void 0,delta:[]}}var bf={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)tf.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(tf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>tf.fromPartial(r))||[],t}};function OI(){return{baseEvent:void 0,messages:[]}}var xf={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)ff.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(ff.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>ff.fromPartial(r))||[],t}};function _I(){return{baseEvent:void 0,event:void 0,source:void 0}}var wf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function NI(){return{baseEvent:void 0,name:"",value:void 0}}var Rf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function DI(){return{baseEvent:void 0,threadId:"",runId:""}}var If={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function qI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var Ef={encode(e,t=new Ne){e.baseEvent!==void 0&&Ae.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&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)mf.encode(r,t.uint32(50).fork()).join();return t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=qI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=Se.unwrap(Se.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(mf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>mf.fromPartial(r))||[],t}};function MI(){return{baseEvent:void 0,code:void 0,message:""}}var Ff={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=MI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function jI(){return{baseEvent:void 0,stepName:""}}var Tf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=jI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function VI(){return{baseEvent:void 0,stepName:""}}var Pf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function LI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var kf={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=LI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function UI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Of={encode(e,t=new Ne){return e.baseEvent!==void 0&&Ae.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 ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=UI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Of.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.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 QI(){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 BI={encode(e,t=new Ne){return e.textMessageStart!==void 0&&gf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&hf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&yf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Sf.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&vf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Af.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Cf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&bf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&xf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&wf.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Rf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&If.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ef.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ff.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Tf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Pf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&kf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Of.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ae?e:new ae(e),n=t===void 0?r.len:r.pos+t,o=QI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=gf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=hf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=yf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Sf.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=vf.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Af.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Cf.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=bf.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=xf.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=wf.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Rf.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=If.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Ef.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Ff.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Tf.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Pf.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=kf.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Of.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return BI.fromPartial(e??{})},fromPartial(e){let t=QI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?gf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?hf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?yf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Sf.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?vf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Af.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Cf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?bf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?xf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?wf.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Rf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?If.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ef.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ff.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Tf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Pf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?kf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Of.fromPartial(e.toolCallChunk):void 0,t}};function uU(e){let t=S.Number(e.toString());if(t>S.Number.MAX_SAFE_INTEGER)throw new S.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<S.Number.MIN_SAFE_INTEGER)throw new S.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var ef=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},lU=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:ef(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:ef(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:ef(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:ef(e.document.source),metadata:e.document.metadata}}};function GI(e){let t=BI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=cU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===j.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>lU(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===j.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===j.STATE_DELTA)for(let n of r.delta)n.op=sU[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Sp.parse(r)}var ev="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var pU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,tv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(pU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},$I=e=>e==="*"||e==="x"||e==="X",HI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},fU=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],mU=(e,t)=>{if($I(e)||$I(t))return 0;let[r,n]=fU(HI(e),HI(t));return r>n?1:r<n?-1:0},rv=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=mU(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var cu=(e,t)=>{let r=tv(e),n=tv(t),o=r.pop(),i=n.pop(),a=rv(r,n);return a!==0?a:o&&i?rv(o.split("."),i.split(".")):o||i?o?-1:1:0};var Qe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function uu(){return po()}function iv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&iv(t);return e}var zI=512*1024;function WI(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let p=0;p<a.length;p++)o.push(a[p]);else{let p=Object.keys(a);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(a[m])}}}}return!1}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,p=a&&!WI(t,r,zI),f=p?Qe(t):t,m=p?Qe(r):r,g=!1,A=!1,x;for(let h of e)try{p&&(iv(f),iv(m));let y=yield n(h,f,m);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==f&&(f=Qe(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==m&&(m=Qe(y.state),A=!0,b=!0),p&&b&&WI(f,m,zI)&&(p=!1),x=y.stopPropagation,x===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(f)?Qe(f):f}:{}),...(A?{state:Object.isFrozen(m)?Qe(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _Ye.apply(this,arguments)}function _f(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function lu(e){if(e instanceof av)return e;if(e===!0)return new av(_f(!0))}var av=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function nv(e){return e.enabled?new av(e):void 0}function gU(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var eE=(e,t,r,n,o)=>{let i=lu(o),a=Qe(r.messages),p=Qe(e.state),f={},m=A=>{A.messages!==void 0&&(a=A.messages,f.messages=A.messages),A.state!==void 0&&(p=A.state,f.state=A.state)},g=()=>{let A=Qe(f);return f={},A.messages!==void 0||A.state!==void 0?lt(A):Dp};return t.pipe(Kp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(A){let x=yield Ye(n,a,p,(h,y,b)=>h.onEvent?.({event:A,agent:r,input:e,messages:y,state:b}));if(m(x),x.stopPropagation===!0?i?.event("APPLY","Event dropped:",A,{type:A.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",A,{type:A.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(A.type){case j.TEXT_MESSAGE_START:{let h=yield Ye(n,a,p,(y,b,w)=>y.onTextMessageStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:w}=A;if(!a.find(I=>I.id===y)){let I={id:y,role:b,content:"",...(w!==void 0&&{name:w})};a.push(I),m({messages:a})}}return g()}case j.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=A,b=a.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,a,p,(I,F,E)=>I.onTextMessageContentEvent?.({event:A,messages:F,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:a})),g()}case j.TEXT_MESSAGE_END:{let{messageId:h}=A,y=a.find(b=>b.id===h);return y?(m(yield Ye(n,a,p,(b,w,I)=>b.onTextMessageEndEvent?.({event:A,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case j.TOOL_CALL_START:{let h=yield Ye(n,a,p,(y,b,w)=>y.onToolCallStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:w}=A,I=gU(a,w,y);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:y,type:"function",function:{name:b,arguments:""}}),m({messages:a})}return g()}case j.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=A,b=a.find(F=>F.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(F=>F.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,a,p,(F,E,k)=>{let T=w.function.arguments,q=w.function.name,G={};try{G=Zp(T)}catch{}return F.onToolCallArgsEvent?.({event:A,messages:E,state:k,agent:r,input:e,toolCallBuffer:T,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=y,m({messages:a})),g()}case j.TOOL_CALL_END:{let{toolCallId:h}=A,y=a.find(w=>w.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(w=>w.id===h);return b?(m(yield Ye(n,a,p,(w,I,F)=>{let E=b.function.arguments,k=b.function.name,T={};try{T=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:A,messages:I,state:F,agent:r,input:e,toolCallName:k,toolCallArgs:T})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case j.TOOL_CALL_RESULT:{let h=yield Ye(n,a,p,(y,b,w)=>y.onToolCallResultEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:w,role:I}=A,F={id:y,toolCallId:b,role:I||"tool",content:w},E=a.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(T=>T.id===b));if(E===-1)a.push(F);else{let k=E+1;for(;k<a.length&&a[k].role==="tool";)k++;a.splice(k,0,F)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:F,messages:a,state:p,agent:r,input:e})})),m({messages:a})}return g()}case j.STATE_SNAPSHOT:{let h=yield Ye(n,a,p,(y,b,w)=>y.onStateSnapshotEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:y}=A;p=y,m({state:p})}return g()}case j.STATE_DELTA:{let h=yield Ye(n,a,p,(y,b,w)=>y.onStateDeltaEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:y}=A;try{p=Ip.applyPatch(p,y,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
38
  Patch operations: ${JSON.stringify(y,null,2)}
39
- Error: ${w}`)}}return g()}case j.MESSAGES_SNAPSHOT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onMessagesSnapshotEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:y}=A,b=new Map(y.map(E=>[E.id,E])),w=y.some(E=>E.role==="reasoning"),I=E=>E.role==="activity"||E.role==="reasoning"&&!w;i=i.filter(E=>I(E)||b.has(E.id)).map(E=>I(E)?E:b.get(E.id));let F=new Set(i.map(E=>E.id));for(let E of y)F.has(E.id)||i.push(E);m({messages:i})}return g()}case j.ACTIVITY_SNAPSHOT:{let h=A,y=i.findIndex(E=>E.id===h.messageId),b=y>=0?i[y]:void 0,w=b?.role==="activity"?b:void 0,I=h.replace??!0,F=yield Ye(n,i,p,(E,k,T)=>E.onActivitySnapshotEvent?.({event:h,messages:k,state:T,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(F),F.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:Qe(h.content)},k;y===-1?(i.push(E),k=E):w?I&&(i[y]={...w,activityType:h.activityType,content:Qe(h.content)}):I&&(i[y]=E,k=E),m({messages:i}),k&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:k,messages:i,state:p,agent:r,input:e}))))}return g()}case j.ACTIVITY_DELTA:{let h=A,y=i.findIndex(F=>F.id===h.messageId);if(y===-1)return g();let b=i[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,I=yield Ye(n,i,p,(F,E,k)=>F.onActivityDeltaEvent?.({event:h,messages:E,state:k,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let F=Qe(w.content??{}),E=wp.applyPatch(F,h.patch??[],!0,!1).newDocument;i[y]={...w,content:Qe(E),activityType:h.activityType},m({messages:i})}catch(F){let E=F instanceof Error?F.message:String(F);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case j.RAW:return m(yield Ye(n,i,p,(h,y,b)=>h.onRawEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.CUSTOM:return m(yield Ye(n,i,p,(h,y,b)=>h.onCustomEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.RUN_STARTED:{let h=yield Ye(n,i,p,(y,b,w)=>y.onRunStartedEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let y=A;if(y.input?.messages){for(let b of y.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case j.RUN_FINISHED:{let h=A,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield Ye(n,i,p,(w,I,F)=>w.onRunFinishedEvent?.({...y,messages:I,state:F,agent:r,input:e}));return m(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case j.RUN_ERROR:return m(yield Ye(n,i,p,(h,y,b)=>h.onRunErrorEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.STEP_STARTED:return m(yield Ye(n,i,p,(h,y,b)=>h.onStepStartedEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.STEP_FINISHED:return m(yield Ye(n,i,p,(h,y,b)=>h.onStepFinishedEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case j.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case j.THINKING_START:return g();case j.THINKING_END:return g();case j.THINKING_TEXT_MESSAGE_START:return g();case j.THINKING_TEXT_MESSAGE_CONTENT:return g();case j.THINKING_TEXT_MESSAGE_END:return g();case j.REASONING_START:return m(yield Ye(n,i,p,(h,y,b)=>h.onReasoningStartEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.REASONING_MESSAGE_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onReasoningMessageStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y}=A;if(!i.find(b=>b.id===y)){let b={id:y,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case j.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=A,b=i.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,F,E)=>I.onReasoningMessageContentEvent?.({event:A,messages:F,state:E,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:i})),g()}case j.REASONING_MESSAGE_END:{let{messageId:h}=A,y=i.find(b=>b.id===h);return y?(m(yield Ye(n,i,p,(b,w,I)=>b.onReasoningMessageEndEvent?.({event:A,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case j.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case j.REASONING_END:return m(yield Ye(n,i,p,(h,y,b)=>h.onReasoningEndEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=A,w=yield Ye(n,i,p,(I,F,E)=>I.onReasoningEncryptedValueEvent?.({event:A,messages:F,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let F of i)if(F.role==="assistant"&&F.toolCalls){let E=F.toolCalls.find(k=>k.id===y);if(E){E.encryptedValue=b,I=!0;break}}}else{let F=i.find(E=>E.id===y);F?.role!=="activity"&&F&&(F.encryptedValue=b,I=!0)}I&&(f.messages=i)}return g()}}return A.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),LS(),n.length>0?US({}):A=>A)},av=e=>t=>{let r=lu(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,A=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,A=!0};return t.pipe(rr(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return st(()=>new at(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&y!==j.RUN_ERROR&&y!==j.RUN_STARTED)return st(()=>new at(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(y===j.RUN_STARTED){if(A&&!a)return st(()=>new at("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&x()}}else if(p=!0,y!==j.RUN_STARTED&&y!==j.RUN_ERROR)return st(()=>new at("First event must be 'RUN_STARTED'"));switch(y){case j.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?st(()=>new at(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),lt(h))}case j.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?lt(h):st(()=>new at(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case j.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),lt(h)):st(()=>new at(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case j.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?st(()=>new at(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),lt(h))}case j.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?lt(h):st(()=>new at(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case j.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),lt(h)):st(()=>new at(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case j.STEP_STARTED:{let b=h.stepName;return f.has(b)?st(()=>new at(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),lt(h))}case j.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),lt(h)):st(()=>new at(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case j.RUN_STARTED:return A=!0,lt(h);case j.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,lt(h);case j.RUN_ERROR:return i=!0,lt(h);case j.CUSTOM:return lt(h);case j.THINKING_TEXT_MESSAGE_START:return m?g?st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,lt(h)):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case j.THINKING_TEXT_MESSAGE_CONTENT:return g?lt(h):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case j.THINKING_TEXT_MESSAGE_END:return g?(g=!1,lt(h)):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case j.THINKING_START:return m?st(()=>new at("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,lt(h));case j.THINKING_END:return m?(m=!1,lt(h)):st(()=>new at("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return lt(h)}}))},ka=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),pU=e=>zp(()=>Fa(e())).pipe(QS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Fa(t.text()).pipe(rr(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let p=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return p.status=t.status,p.payload=i,st(()=>p)}))}let r={type:ka.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new it(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:ka.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):st(()=>Error("Failed to getReader() from response"))})),fU=(e,t)=>{let r=lu(t),n=new sn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==ka.HEADERS&&p.type===ka.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
39
+ Error: ${w}`)}}return g()}case j.MESSAGES_SNAPSHOT:{let h=yield Ye(n,a,p,(y,b,w)=>y.onMessagesSnapshotEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:y}=A,b=new Map(y.map(E=>[E.id,E])),w=y.some(E=>E.role==="reasoning"),I=E=>E.role==="activity"||E.role==="reasoning"&&!w;a=a.filter(E=>I(E)||b.has(E.id)).map(E=>I(E)?E:b.get(E.id));let F=new Set(a.map(E=>E.id));for(let E of y)F.has(E.id)||a.push(E);m({messages:a})}return g()}case j.ACTIVITY_SNAPSHOT:{let h=A,y=a.findIndex(E=>E.id===h.messageId),b=y>=0?a[y]:void 0,w=b?.role==="activity"?b:void 0,I=h.replace??!0,F=yield Ye(n,a,p,(E,k,T)=>E.onActivitySnapshotEvent?.({event:h,messages:k,state:T,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(F),F.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:Qe(h.content)},k;y===-1?(a.push(E),k=E):w?I&&(a[y]={...w,activityType:h.activityType,content:Qe(h.content)}):I&&(a[y]=E,k=E),m({messages:a}),k&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:k,messages:a,state:p,agent:r,input:e}))))}return g()}case j.ACTIVITY_DELTA:{let h=A,y=a.findIndex(F=>F.id===h.messageId);if(y===-1)return g();let b=a[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,I=yield Ye(n,a,p,(F,E,k)=>F.onActivityDeltaEvent?.({event:h,messages:E,state:k,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let F=Qe(w.content??{}),E=Ip.applyPatch(F,h.patch??[],!0,!1).newDocument;a[y]={...w,content:Qe(E),activityType:h.activityType},m({messages:a})}catch(F){let E=F instanceof Error?F.message:String(F);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case j.RAW:return m(yield Ye(n,a,p,(h,y,b)=>h.onRawEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.CUSTOM:return m(yield Ye(n,a,p,(h,y,b)=>h.onCustomEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.RUN_STARTED:{let h=yield Ye(n,a,p,(y,b,w)=>y.onRunStartedEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let y=A;if(y.input?.messages){for(let b of y.input.messages)a.find(w=>w.id===b.id)||a.push(b);m({messages:a})}}return g()}case j.RUN_FINISHED:{let h=A,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield Ye(n,a,p,(w,I,F)=>w.onRunFinishedEvent?.({...y,messages:I,state:F,agent:r,input:e}));return m(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case j.RUN_ERROR:return m(yield Ye(n,a,p,(h,y,b)=>h.onRunErrorEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.STEP_STARTED:return m(yield Ye(n,a,p,(h,y,b)=>h.onStepStartedEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.STEP_FINISHED:return m(yield Ye(n,a,p,(h,y,b)=>h.onStepFinishedEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case j.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case j.THINKING_START:return g();case j.THINKING_END:return g();case j.THINKING_TEXT_MESSAGE_START:return g();case j.THINKING_TEXT_MESSAGE_CONTENT:return g();case j.THINKING_TEXT_MESSAGE_END:return g();case j.REASONING_START:return m(yield Ye(n,a,p,(h,y,b)=>h.onReasoningStartEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.REASONING_MESSAGE_START:{let h=yield Ye(n,a,p,(y,b,w)=>y.onReasoningMessageStartEvent?.({event:A,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y}=A;if(!a.find(b=>b.id===y)){let b={id:y,role:"reasoning",content:""};a.push(b),m({messages:a})}}return g()}case j.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=A,b=a.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,a,p,(I,F,E)=>I.onReasoningMessageContentEvent?.({event:A,messages:F,state:E,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:a})),g()}case j.REASONING_MESSAGE_END:{let{messageId:h}=A,y=a.find(b=>b.id===h);return y?(m(yield Ye(n,a,p,(b,w,I)=>b.onReasoningMessageEndEvent?.({event:A,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case j.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case j.REASONING_END:return m(yield Ye(n,a,p,(h,y,b)=>h.onReasoningEndEvent?.({event:A,messages:y,state:b,agent:r,input:e}))),g();case j.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=A,w=yield Ye(n,a,p,(I,F,E)=>I.onReasoningEncryptedValueEvent?.({event:A,messages:F,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let F of a)if(F.role==="assistant"&&F.toolCalls){let E=F.toolCalls.find(k=>k.id===y);if(E){E.encryptedValue=b,I=!0;break}}}else{let F=a.find(E=>E.id===y);F?.role!=="activity"&&F&&(F.encryptedValue=b,I=!0)}I&&(f.messages=a)}return g()}}return A.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),jS(),n.length>0?VS({}):A=>A)},ov=e=>t=>{let r=lu(e),n=new Map,o=new Map,i=!1,a=!1,p=!1,f=new Map,m=!1,g=!1,A=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,i=!1,a=!1,A=!0};return t.pipe(rr(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),a)return st(()=>new it(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(i&&y!==j.RUN_ERROR&&y!==j.RUN_STARTED)return st(()=>new it(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(y===j.RUN_STARTED){if(A&&!i)return st(()=>new it("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&&x()}}else if(p=!0,y!==j.RUN_STARTED&&y!==j.RUN_ERROR)return st(()=>new it("First event must be 'RUN_STARTED'"));switch(y){case j.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?st(()=>new it(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),lt(h))}case j.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?lt(h):st(()=>new it(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case j.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),lt(h)):st(()=>new it(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case j.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?st(()=>new it(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),lt(h))}case j.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?lt(h):st(()=>new it(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case j.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),lt(h)):st(()=>new it(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case j.STEP_STARTED:{let b=h.stepName;return f.has(b)?st(()=>new it(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),lt(h))}case j.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),lt(h)):st(()=>new it(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case j.RUN_STARTED:return A=!0,lt(h);case j.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return st(()=>new it(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return i=!0,lt(h);case j.RUN_ERROR:return a=!0,lt(h);case j.CUSTOM:return lt(h);case j.THINKING_TEXT_MESSAGE_START:return m?g?st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,lt(h)):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case j.THINKING_TEXT_MESSAGE_CONTENT:return g?lt(h):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case j.THINKING_TEXT_MESSAGE_END:return g?(g=!1,lt(h)):st(()=>new it("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case j.THINKING_START:return m?st(()=>new it("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,lt(h));case j.THINKING_END:return m?(m=!1,lt(h)):st(()=>new it("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return lt(h)}}))},ki=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),hU=e=>Yp(()=>Fi(e())).pipe(LS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Fi(t.text()).pipe(rr(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let p=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return p.status=t.status,p.payload=a,st(()=>p)}))}let r={type:ki.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new at(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let p={type:ki.DATA,data:a};o.next(p)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):st(()=>Error("Failed to getReader() from response"))})),yU=(e,t)=>{let r=lu(t),n=new sn,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:p=>{if(p.type!==ki.HEADERS&&p.type===ki.DATA&&p.data){let f=o.decode(p.data,{stream:!0});i+=f;let m=i.split(/\n\n/);i=m.pop()||"";for(let g of m)a(g)}},error:p=>n.error(p),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(p){let f=p.split(`
40
40
  `),m=[];for(let g of f)g.startsWith("data:")&&m.push(g.slice(5).replace(/^ /,""));if(m.length>0)try{let g=m.join(`
41
- `),A=JSON.parse(g);r?.event("SSE","Event received:",A,{type:A.type}),n.next(A)}catch(g){n.error(g)}}return n.asObservable()},mU=e=>{let t=new sn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==ka.HEADERS&&o.type===ka.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,n()}},error:o=>t.error(o),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 o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let a=r.slice(4,o),i=BI(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},gU=(e,t)=>{let r=lu(t),n=new sn,o=new Op,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===ka.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===tv?"protobuf":"sse"}),p===tv?mU(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):fU(o,r).subscribe({next:f=>{try{let m=hp.parse(f);r?.event("HTTP","Event validated:",m,{type:m.type,valid:!0}),n.next(m)}catch(m){r?.event("HTTP","Event invalid:",{json:f,error:String(m)}),n.error(m)}},error:f=>{if(f?.name==="AbortError"){n.next({type:j.RUN_ERROR,message:f.message||"Request aborted",code:"abort",rawEvent:f}),n.complete();return}return n.error(f)},complete:()=>n.complete()})}else a||n.error(Error("No headers event received before data events"))},error:i=>{o.error(i),n.error(i)},complete:()=>{o.complete()}}),n.asObservable()},rt=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),hU=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),yU=R.object({type:R.literal(rt.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),SU=R.object({type:R.literal(rt.enum.TextMessageContent),messageId:R.string(),content:R.string()}),vU=R.object({type:R.literal(rt.enum.TextMessageEnd),messageId:R.string()}),AU=R.object({type:R.literal(rt.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),CU=R.object({type:R.literal(rt.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),bU=R.object({type:R.literal(rt.enum.ActionExecutionEnd),actionExecutionId:R.string()}),xU=R.object({type:R.literal(rt.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),wU=R.object({type:R.literal(rt.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()}),RU=R.object({type:R.literal(rt.enum.MetaEvent),name:hU,value:R.any()}),IU=R.object({type:R.literal(rt.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[yU,SU,vU,AU,CU,bU,xU,wU,RU,IU]),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 EU=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(`
42
- `)},FU=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],A={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(rr(h=>{switch(h.type){case j.TEXT_MESSAGE_START:{let y=h;return[{type:rt.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case j.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:rt.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case j.TEXT_MESSAGE_END:{let y=h;return[{type:rt.enum.TextMessageEnd,messageId:y.messageId}]}case j.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),i=!0,A[y.toolCallId]=y.toolCallName,[{type:rt.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case j.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let w=!1;if(m){let I=m.find(F=>F.tool==b.function.name);if(I)try{let F=JSON.parse(Kp(b.function.arguments));I.tool_argument&&I.tool_argument in F?(x({...o,[I.state_key]:F[I.tool_argument]}),w=!0):I.tool_argument||(x({...o,[I.state_key]:F}),w=!0)}catch{}}return[{type:rt.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case j.TOOL_CALL_END:{let y=h;return[{type:rt.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case j.TOOL_CALL_RESULT:{let y=h;return[{type:rt.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:A[y.toolCallId]||"unknown"}]}case j.RAW:return[];case j.CUSTOM:{let y=h;switch(y.name){case"Exit":a=!1;break;case"PredictState":m=y.value;break}return[{type:rt.enum.MetaEvent,name:y.name,value:y.value}]}case j.STATE_SNAPSHOT:return x(h.snapshot),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case j.STATE_DELTA:{let y=h,b=wp.applyPatch(o,y.delta,!0,!1);return b?(x(b.newDocument),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case j.MESSAGES_SNAPSHOT:return f=h.messages,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case j.RUN_STARTED:return[];case j.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:TU(f)}:{})}),active:!1}];case j.RUN_ERROR:{let y=h;return[{type:rt.enum.RunError,message:y.message,code:y.code}]}case j.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case j.STEP_FINISHED:return g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function TU(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=EU(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let a={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(a)}}else if(r.role==="tool"){let n="unknown";for(let a of e)if(a.role==="assistant"&&a.toolCalls?.length){for(let i of a.toolCalls)if(i.id===r.toolCallId){n=i.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var _f=e=>t=>{let r=lu(e),n,o,a,i,p=()=>{if(!n||i!=="text")throw Error("No text message to close");let A={type:j.TEXT_MESSAGE_END,messageId:n.messageId};return i=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",A,{messageId:A.messageId}),A},f=()=>{if(!o||i!=="tool")throw Error("No tool call to close");let A={type:j.TOOL_CALL_END,toolCallId:o.toolCallId};return i=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",A,{toolCallId:A.toolCallId}),A},m=()=>{if(!a||i!=="reasoning")throw Error("No reasoning message to close");let A={type:j.REASONING_MESSAGE_END,messageId:a.messageId};return i=void 0,a=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",A,{messageId:A.messageId}),A},g=()=>i==="text"?[p()]:i==="tool"?[f()]:i==="reasoning"?[m()]:[];return t.pipe(rr(A=>{switch(A.type){case j.TEXT_MESSAGE_START:case j.TEXT_MESSAGE_CONTENT:case j.TEXT_MESSAGE_END:case j.TOOL_CALL_START:case j.TOOL_CALL_ARGS:case j.TOOL_CALL_END:case j.TOOL_CALL_RESULT:case j.STATE_SNAPSHOT:case j.STATE_DELTA:case j.MESSAGES_SNAPSHOT:case j.CUSTOM:case j.RUN_STARTED:case j.RUN_FINISHED:case j.RUN_ERROR:case j.STEP_STARTED:case j.STEP_FINISHED:case j.THINKING_START:case j.THINKING_END:case j.THINKING_TEXT_MESSAGE_START:case j.THINKING_TEXT_MESSAGE_CONTENT:case j.THINKING_TEXT_MESSAGE_END:case j.REASONING_START:case j.REASONING_MESSAGE_START:case j.REASONING_MESSAGE_CONTENT:case j.REASONING_MESSAGE_END:case j.REASONING_END:return[...g(),A];case j.RAW:case j.ACTIVITY_SNAPSHOT:case j.ACTIVITY_DELTA:case j.REASONING_ENCRYPTED_VALUE:return[A];case j.TEXT_MESSAGE_CHUNK:let x=A,h=[];if((i!=="text"||x.messageId!==void 0&&x.messageId!==n?.messageId)&&h.push(...g()),i!=="text"){if(x.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:x.messageId,name:x.name},i="text";let F={type:j.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_START",F,{messageId:x.messageId})}if(x.delta!==void 0){let F={type:j.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",F,{messageId:n.messageId})}return h;case j.TOOL_CALL_CHUNK:let y=A,b=[];if((i!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&b.push(...g()),i!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},i="tool";let F={type:j.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};b.push(F),r?.event("TRANSFORM","TOOL_CALL_START",F,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let F={type:j.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};b.push(F),r?.event("TRANSFORM","TOOL_CALL_ARGS",F,{toolCallId:o.toolCallId})}return b;case j.REASONING_MESSAGE_CHUNK:let w=A,I=[];if((i!=="reasoning"||w.messageId&&w.messageId!==a?.messageId)&&I.push(...g()),i!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");a={messageId:w.messageId},i="reasoning";let F={type:j.REASONING_MESSAGE_START,messageId:w.messageId};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_START",F,{messageId:w.messageId})}if(w.delta!==void 0){let F={type:j.REASONING_MESSAGE_CONTENT,messageId:a.messageId,delta:w.delta};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",F,{messageId:a.messageId})}return I}return A.type,[]}),Pa(()=>{g()}))};function PU(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Nf=class{runNext(e,t){return t.run(e).pipe(_f(!1))}runNextWithState(e,t){let r=Qe(e.messages||[]),n=Qe(e.state||{}),o=new Op;return JI(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(Wp(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Qe(r),state:Qe(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},kU=class extends Nf{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function OU(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 _U=class extends Nf{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(OU)};return this.runNext(o,t)}},WI="THINKING_START",YI="THINKING_END",KI="THINKING_TEXT_MESSAGE_START",XI="THINKING_TEXT_MESSAGE_CONTENT",ZI="THINKING_TEXT_MESSAGE_END",NU=class extends Nf{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&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(Ta(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case WI:{this.currentReasoningId=uu();let{title:t,...r}=e;return this.warnAboutTransformation(WI,j.REASONING_START),{...r,type:j.REASONING_START,messageId:this.currentReasoningId}}case KI:return this.currentMessageId=uu(),this.warnAboutTransformation(KI,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case XI:{let{delta:t,...r}=e;return this.warnAboutTransformation(XI,j.REASONING_MESSAGE_CONTENT),{...r,type:j.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??uu(),delta:t}}case ZI:{let t=this.currentMessageId??uu();return this.warnAboutTransformation(ZI,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case YI:{let t=this.currentReasoningId??uu();return this.warnAboutTransformation(YI,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}default:return e}}};function DU(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function qU(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function MU(e){let t=DU(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function jU(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>qU(n)?MU(n):n);return{...e,content:r}}var VU=class extends Nf{run(e,t){let r={...e,messages:e.messages.map(jU)};return this.runNext(r,t)}},LU="0.0.57",UU=class{get maxVersion(){return LU}get debug(){return this._debug}set debug(e){this._debug=Of(e),this._debugLogger=ov(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?ov(Of(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??po(),this.messages=Qe(n??[]),this.state=Qe(o??{}),this._debug=Of(a),this._debugLogger=ov(this._debug),cu(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new _U),cu(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new NU),cu(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new VU)}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 kU(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??po();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,a),_this35.activeRunDetach$=new sn;let i;_this35.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Hp(kp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),_this35).run(r),_f(_this35.debugLogger),av(_this35.debugLogger),f=>f.pipe(Yp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,a),f=>_this35.processApplyEvents(r,f,a),au(f=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:f instanceof Error?f.message:String(f)}),_this35.isRunning=!1,_this35.onError(r,f,a))),Pa(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,a),i?.(),i=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(lt(null)));let p=Qe(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new ES}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??po();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,a),_this36.activeRunDetach$=new sn;let i;_this36.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Hp(kp(()=>zp(()=>_this36.connect(r)),_f(_this36.debugLogger),av(_this36.debugLogger),f=>f.pipe(Yp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,a),f=>_this36.processApplyEvents(r,f,a),au(f=>(_this36.isRunning=!1,f instanceof ES?_p:_this36.onError(r,f,a))),Pa(()=>{_this36.isRunning=!1,_this36.onFinalize(r,a),i?.(),i=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(lt(null)),{defaultValue:void 0});let p=Qe(_this36.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return JI(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(BS(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Qe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||po(),tools:Qe(e?.tools??[]),context:Qe(e?.context??[]),forwardedProps:Qe(e?.forwardedProps??{}),state:Qe(this.state),messages:t,...(e?.resume===void 0?{}:{resume:Qe(e.resume)})}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){if(_this38.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=_this38.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new at(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this38.pendingInterrupts)if(PU(a))throw new at(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield Ye(t,_this38.messages,_this38.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return Fa(Ye(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ta(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(a=>{a.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(a=>{a.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let a=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||a==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield Ye(t,_this39.messages,_this39.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Qe(this.messages),e.state=Qe(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Qe(this.pendingInterrupts),e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Qe(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Qe(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??po();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(_f(this.debugLogger),av(this.debugLogger),FU(this.threadId,t.runId,this.agentId),r=>r.pipe(Ta(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},eE=class extends UU{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 s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Qe(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return gU(pU(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Qe(this.headers??{}),e.fetch=this.fetch;let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var tE=(e,t,r)=>{let n=mt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let a=`/api/v1/organizations/${t}/agents`;return`${n}${a}/${o}`};var cv=class extends eE{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},a={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(a),signal:this.abortController.signal}}},rE=(e,t,r)=>new cv({url:`${tE(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var QU=new $({required:!0}),nE=new $({required:!0,constrainTo:Md}),oE=e=>({...e,name:jd(e.name)}),aE=P("followUpAnswers/setIsEnabled",e=>_(e,new pe({required:!0}))),iE=P("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,H)),sE=P("followUpAnswers/setFollowUpAnswersConversationToken",e=>_(e,H)),cE=P("followUpAnswers/clearFollowUpAnswersConversationToken"),kbe=P("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:H})),Obe=P("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,H)),_be=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Ld,answerId:H})),Nbe=P("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new pe({required:!0}),answerId:H})),Dbe=P("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new pe({required:!0}),answerId:H})),qbe=P("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:QU,answerId:H})),Mbe=P("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new oe({required:!0,each:new Y({values:mS})}),answerId:H})),jbe=P("followUpAnswers/followUpCompleted",e=>_(e,{answerId:H,cannotAnswer:new pe({required:!1})})),Vbe=P("followUpAnswers/followUpFailed",e=>_(e,{message:new $,code:new ne({min:0}),answerId:H})),Lbe=P("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new $})),Ube=P("followUpAnswers/likeFollowUp",e=>_(e,{answerId:H})),Qbe=P("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:H})),Bbe=P("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:H})),uE=P("followUpAnswers/resetFollowUpAnswers"),Gbe=P("followUpAnswers/stepStarted",e=>_(oE(e),{answerId:H,name:nE,startedAt:new ne({min:0,required:!0})})),$be=P("followUpAnswers/stepFinished",e=>_(oE(e),{answerId:H,name:nE,finishedAt:new ne({min:0,required:!0})})),Hbe=P("followUpAnswers/startToolCall",e=>_(e,{answerId:H,toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),zbe=P("followUpAnswers/finishToolCall",e=>_(e,{answerId:H,finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Wbe=P("followUpAnswers/toolCallArgs",e=>_(e,{answerId:H,toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Vd})}));d();c();l();u();var BU={"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:SSE_TURN_LIMIT_REACHED":1005};function lE(e){return e?BU[e]??1004:1004}function GU(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function Df(e){if(e)return GU({...e})}var dE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Li(n.runId)),e(en(!1)),e(ra(!0)),e(iE(n.threadId)),e(cE())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Kd({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Xd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:a,toolCallId:i,timestamp:p}=n;e(Zd({toolCallId:i,toolCallName:a,startedAt:p??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,timestamp:i}=n;e(Jd({toolCallId:a,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,delta:i}=n;try{let p=JSON.parse(i);typeof p?.q=="string"?e(Gi({toolCallId:a,args:p,type:"search"})):e(Gi({toolCallId:a,args:{raw:i},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${i}`),e(Gi({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(na({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:a,value:i}=n;switch(a){case"header":{i?.contentFormat&&e(ia(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(aE(i.followUpEnabled)),i?.conversationToken&&e(sE(i.conversationToken));return}case"citations":{e(oa({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=lE(n.code);e(aa({message:n.message,code:a}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=n.result?.completionReason==="ANSWERED",i=a?!r:void 0;e(Yc(a)),e(sa(!a)),e(ra(!1)),e(Ey(a,t,i)),e(xi())}}};var pE=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,a){t();let i=Ll(n),p=Gb(n),f=$b(n),m=Bb(n),g=Hb(n),A=rE(i,p,f);e=A;let x=dE(o),h=Hw(n,a());try{o(en(!0)),yield A.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(y){o(en(!1)),o(aa({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var fE=e=>{let t=zC({extra:e}),r=pE();return t.startListening({actionCreator:_e.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let a=o.getState();if(!yy(a)||(r.abortRun(),o.dispatch(lr()),o.dispatch(uE()),a.generatedAnswer.isEnabled===!1))return;let i=ta(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var mE=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},gE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var uv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:a}};d();c();l();u();function hE(e,t){let r={...e},n,o=a=>(i,p)=>{let f=a(i,p);return n?n(f,p):f};return{get combinedReducer(){let a=cA(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Ja({...a,...r}))},containsAll(a){return Object.keys(a).every(p=>p in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}d();c();l();u();d();c();l();u();function $U(e){if(!e||!HU(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(a=>`%${`00${a.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function yE(e,t=60){if(!e)return!1;let r=$U(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function HU(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function vE(e,t){let r=0,n=null,o=Uu(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(f,m=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!m)throw x;return null}})().finally(()=>{n=null}));let A=yield n;return g&&A&&f.dispatch(Ci({accessToken:A})),A});return function a(_x208){return _ref85.apply(this,arguments)}}(),i=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),g=WU(m);if(!(!g||!yE(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(f))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(A){e.warn(A,"Access token renewal failed. A retry will occur if necessary.")}}});return function i(_x209){return _ref87.apply(this,arguments)}}(),p=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(f,m,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),SE(f,m.error),m;!n&&(r++,o());try{yield a(f,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}f.dispatch(g)});return function p(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(g){let A=typeof g=="function",x=typeof t=="function";if(!A)return m(g);x&&(yield i(f));let h=yield m(g);return zU(h)?x?yield p(f,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),SE(f,h.error),h):h});return function(_x213){return _ref89.apply(this,arguments)}}())}function zU(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ya().name}function SE(e,t){e.dispatch(Ni({status:401,statusCode:401,message:t.message,type:t.name}))}function WU(e){return e.configuration.accessToken}d();c();l();u();function AE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return _C({reducer:e,preloadedState:t,devTools:{stateSanitizer:a=>a.history?{...a,history:"<<OMIT>>"}:a,name:o,shouldHotReload:!1},middleware:a=>a({thunk:{extraArgument:n}}).prepend(...r).concat(gE(n.logger))})}function YU(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...a}=r??{},i={...a,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=i.analyticsMode!=="next",f=i.analyticsMode==="legacy"&&o===!0;return p&&$g()&&!f?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):(p&&$g()&&f&&i.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),i)}function CE(e,t){let r={...e.reducers,configuration:we,version:eR},n=KU({...e,reducers:r},t,we),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(Ci({accessToken:o,environment:a,organizationId:i}));let p=YU(e.configuration,n.logger);return p&&n.dispatch(zl(p)),n}function KU(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=hE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return Fc(m.state,o)},get navigatorContext(){return uv(this.relay,o)}},f=XU(e,p,a),m={addReducers(g){a.containsAll(g)||(a.add(g),f.replaceReducer(a.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(Yl())},disableAnalytics(){f.dispatch(Wl())},get state(){return f.getState()},get relay(){return Fc(this.state,o)},get navigatorContext(){return uv(this.relay,o)},logger:i,store:f};return m}function XU(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=ZU(e,t.logger,()=>t.navigatorContext);return AE({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function ZU(e,t,r){let{renewAccessToken:n}=e.configuration,o=vE(t,n),a=fE({getNavigatorContext:r});return[uR,o,mE(t),rR].concat(ca.middleware,a.middleware,e.middlewares||[])}var JU=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
41
+ `),A=JSON.parse(g);r?.event("SSE","Event received:",A,{type:A.type}),n.next(A)}catch(g){n.error(g)}}return n.asObservable()},SU=e=>{let t=new sn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==ki.HEADERS&&o.type===ki.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),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 o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=GI(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},vU=(e,t)=>{let r=lu(t),n=new sn,o=new Np,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===ki.HEADERS&&!i){i=!0;let p=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===ev?"protobuf":"sse"}),p===ev?SU(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):yU(o,r).subscribe({next:f=>{try{let m=Sp.parse(f);r?.event("HTTP","Event validated:",m,{type:m.type,valid:!0}),n.next(m)}catch(m){r?.event("HTTP","Event invalid:",{json:f,error:String(m)}),n.error(m)}},error:f=>{if(f?.name==="AbortError"){n.next({type:j.RUN_ERROR,message:f.message||"Request aborted",code:"abort",rawEvent:f}),n.complete();return}return n.error(f)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:a=>{o.error(a),n.error(a)},complete:()=>{o.complete()}}),n.asObservable()},rt=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),AU=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),CU=R.object({type:R.literal(rt.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),bU=R.object({type:R.literal(rt.enum.TextMessageContent),messageId:R.string(),content:R.string()}),xU=R.object({type:R.literal(rt.enum.TextMessageEnd),messageId:R.string()}),wU=R.object({type:R.literal(rt.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),RU=R.object({type:R.literal(rt.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),IU=R.object({type:R.literal(rt.enum.ActionExecutionEnd),actionExecutionId:R.string()}),EU=R.object({type:R.literal(rt.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),FU=R.object({type:R.literal(rt.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()}),TU=R.object({type:R.literal(rt.enum.MetaEvent),name:AU,value:R.any()}),PU=R.object({type:R.literal(rt.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[CU,bU,xU,wU,RU,IU,EU,FU,TU,PU]),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 kU=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(`
42
+ `)},OU=(e,t,r)=>n=>{let o={},i=!0,a=!0,p="",f=null,m=null,g=[],A={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(rr(h=>{switch(h.type){case j.TEXT_MESSAGE_START:{let y=h;return[{type:rt.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case j.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:rt.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case j.TEXT_MESSAGE_END:{let y=h;return[{type:rt.enum.TextMessageEnd,messageId:y.messageId}]}case j.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,A[y.toolCallId]=y.toolCallName,[{type:rt.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case j.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let w=!1;if(m){let I=m.find(F=>F.tool==b.function.name);if(I)try{let F=JSON.parse(Zp(b.function.arguments));I.tool_argument&&I.tool_argument in F?(x({...o,[I.state_key]:F[I.tool_argument]}),w=!0):I.tool_argument||(x({...o,[I.state_key]:F}),w=!0)}catch{}}return[{type:rt.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case j.TOOL_CALL_END:{let y=h;return[{type:rt.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case j.TOOL_CALL_RESULT:{let y=h;return[{type:rt.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:A[y.toolCallId]||"unknown"}]}case j.RAW:return[];case j.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":m=y.value;break}return[{type:rt.enum.MetaEvent,name:y.name,value:y.value}]}case j.STATE_SNAPSHOT:return x(h.snapshot),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case j.STATE_DELTA:{let y=h,b=Ip.applyPatch(o,y.delta,!0,!1);return b?(x(b.newDocument),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case j.MESSAGES_SNAPSHOT:return f=h.messages,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case j.RUN_STARTED:return[];case j.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:_U(f)}:{})}),active:!1}];case j.RUN_ERROR:{let y=h;return[{type:rt.enum.RunError,message:y.message,code:y.code}]}case j.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case j.STEP_FINISHED:return g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function _U(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=kU(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var Nf=e=>t=>{let r=lu(e),n,o,i,a,p=()=>{if(!n||a!=="text")throw Error("No text message to close");let A={type:j.TEXT_MESSAGE_END,messageId:n.messageId};return a=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",A,{messageId:A.messageId}),A},f=()=>{if(!o||a!=="tool")throw Error("No tool call to close");let A={type:j.TOOL_CALL_END,toolCallId:o.toolCallId};return a=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",A,{toolCallId:A.toolCallId}),A},m=()=>{if(!i||a!=="reasoning")throw Error("No reasoning message to close");let A={type:j.REASONING_MESSAGE_END,messageId:i.messageId};return a=void 0,i=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",A,{messageId:A.messageId}),A},g=()=>a==="text"?[p()]:a==="tool"?[f()]:a==="reasoning"?[m()]:[];return t.pipe(rr(A=>{switch(A.type){case j.TEXT_MESSAGE_START:case j.TEXT_MESSAGE_CONTENT:case j.TEXT_MESSAGE_END:case j.TOOL_CALL_START:case j.TOOL_CALL_ARGS:case j.TOOL_CALL_END:case j.TOOL_CALL_RESULT:case j.STATE_SNAPSHOT:case j.STATE_DELTA:case j.MESSAGES_SNAPSHOT:case j.CUSTOM:case j.RUN_STARTED:case j.RUN_FINISHED:case j.RUN_ERROR:case j.STEP_STARTED:case j.STEP_FINISHED:case j.THINKING_START:case j.THINKING_END:case j.THINKING_TEXT_MESSAGE_START:case j.THINKING_TEXT_MESSAGE_CONTENT:case j.THINKING_TEXT_MESSAGE_END:case j.REASONING_START:case j.REASONING_MESSAGE_START:case j.REASONING_MESSAGE_CONTENT:case j.REASONING_MESSAGE_END:case j.REASONING_END:return[...g(),A];case j.RAW:case j.ACTIVITY_SNAPSHOT:case j.ACTIVITY_DELTA:case j.REASONING_ENCRYPTED_VALUE:return[A];case j.TEXT_MESSAGE_CHUNK:let x=A,h=[];if((a!=="text"||x.messageId!==void 0&&x.messageId!==n?.messageId)&&h.push(...g()),a!=="text"){if(x.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:x.messageId,name:x.name},a="text";let F={type:j.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_START",F,{messageId:x.messageId})}if(x.delta!==void 0){let F={type:j.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",F,{messageId:n.messageId})}return h;case j.TOOL_CALL_CHUNK:let y=A,b=[];if((a!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&b.push(...g()),a!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},a="tool";let F={type:j.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};b.push(F),r?.event("TRANSFORM","TOOL_CALL_START",F,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let F={type:j.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};b.push(F),r?.event("TRANSFORM","TOOL_CALL_ARGS",F,{toolCallId:o.toolCallId})}return b;case j.REASONING_MESSAGE_CHUNK:let w=A,I=[];if((a!=="reasoning"||w.messageId&&w.messageId!==i?.messageId)&&I.push(...g()),a!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");i={messageId:w.messageId},a="reasoning";let F={type:j.REASONING_MESSAGE_START,messageId:w.messageId};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_START",F,{messageId:w.messageId})}if(w.delta!==void 0){let F={type:j.REASONING_MESSAGE_CONTENT,messageId:i.messageId,delta:w.delta};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",F,{messageId:i.messageId})}return I}return A.type,[]}),Pi(()=>{g()}))};function NU(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Df=class{runNext(e,t){return t.run(e).pipe(Nf(!1))}runNextWithState(e,t){let r=Qe(e.messages||[]),n=Qe(e.state||{}),o=new Np;return eE(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Kp(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Qe(r),state:Qe(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},DU=class extends Df{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function qU(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 MU=class extends Df{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(qU)};return this.runNext(o,t)}},YI="THINKING_START",KI="THINKING_END",XI="THINKING_TEXT_MESSAGE_START",ZI="THINKING_TEXT_MESSAGE_CONTENT",JI="THINKING_TEXT_MESSAGE_END",jU=class extends Df{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&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(Ti(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case YI:{this.currentReasoningId=uu();let{title:t,...r}=e;return this.warnAboutTransformation(YI,j.REASONING_START),{...r,type:j.REASONING_START,messageId:this.currentReasoningId}}case XI:return this.currentMessageId=uu(),this.warnAboutTransformation(XI,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case ZI:{let{delta:t,...r}=e;return this.warnAboutTransformation(ZI,j.REASONING_MESSAGE_CONTENT),{...r,type:j.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??uu(),delta:t}}case JI:{let t=this.currentMessageId??uu();return this.warnAboutTransformation(JI,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case KI:{let t=this.currentReasoningId??uu();return this.warnAboutTransformation(KI,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}default:return e}}};function VU(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function LU(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function UU(e){let t=VU(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function QU(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>LU(n)?UU(n):n);return{...e,content:r}}var BU=class extends Df{run(e,t){let r={...e,messages:e.messages.map(QU)};return this.runNext(r,t)}},GU="0.0.57",$U=class{get maxVersion(){return GU}get debug(){return this._debug}set debug(e){this._debug=_f(e),this._debugLogger=nv(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?nv(_f(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??po(),this.messages=Qe(n??[]),this.state=Qe(o??{}),this._debug=_f(i),this._debugLogger=nv(this._debug),cu(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new MU),cu(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new jU),cu(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new BU)}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 DU(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??po();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(f=>f.id)),i=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,i),_this35.activeRunDetach$=new sn;let a;_this35.activeRunCompletionPromise=new Promise(f=>{a=f}),yield Wp(_p(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),_this35).run(r),Nf(_this35.debugLogger),ov(_this35.debugLogger),f=>f.pipe(Xp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,i),f=>_this35.processApplyEvents(r,f,i),ou(f=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:f instanceof Error?f.message:String(f)}),_this35.isRunning=!1,_this35.onError(r,f,i))),Pi(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,i),a?.(),a=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(lt(null)));let p=Qe(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new RS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??po();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),i=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,i),_this36.activeRunDetach$=new sn;let a;_this36.activeRunCompletionPromise=new Promise(f=>{a=f}),yield Wp(_p(()=>Yp(()=>_this36.connect(r)),Nf(_this36.debugLogger),ov(_this36.debugLogger),f=>f.pipe(Xp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,i),f=>_this36.processApplyEvents(r,f,i),ou(f=>(_this36.isRunning=!1,f instanceof RS?Dp:_this36.onError(r,f,i))),Pi(()=>{_this36.isRunning=!1,_this36.onFinalize(r,i),a?.(),a=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(lt(null)),{defaultValue:void 0});let p=Qe(_this36.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return eE(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(US(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Qe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||po(),tools:Qe(e?.tools??[]),context:Qe(e?.context??[]),forwardedProps:Qe(e?.forwardedProps??{}),state:Qe(this.state),messages:t,...(e?.resume===void 0?{}:{resume:Qe(e.resume)})}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){if(_this38.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this38.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new it(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this38.pendingInterrupts)if(NU(i))throw new it(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Ye(t,_this38.messages,_this38.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return Fi(Ye(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Ti(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield Ye(t,_this39.messages,_this39.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Qe(this.messages),e.state=Qe(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Qe(this.pendingInterrupts),e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Qe(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Qe(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??po();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(Nf(this.debugLogger),ov(this.debugLogger),OU(this.threadId,t.runId,this.agentId),r=>r.pipe(Ti(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},tE=class extends $U{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 s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Qe(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return vU(hU(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Qe(this.headers??{}),e.fetch=this.fetch;let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var rE=(e,t,r)=>{let n=mt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var sv=class extends tE{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},nE=(e,t,r)=>new sv({url:`${rE(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var HU=new $({required:!0}),oE=new $({required:!0,constrainTo:Vd}),iE=e=>({...e,name:Ld(e.name)}),aE=P("followUpAnswers/setIsEnabled",e=>_(e,new pe({required:!0}))),sE=P("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,H)),cE=P("followUpAnswers/setFollowUpAnswersConversationToken",e=>_(e,H)),uE=P("followUpAnswers/clearFollowUpAnswersConversationToken"),Lbe=P("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:H})),Ube=P("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,H)),Qbe=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Qd,answerId:H})),Bbe=P("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new pe({required:!0}),answerId:H})),Gbe=P("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new pe({required:!0}),answerId:H})),$be=P("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:HU,answerId:H})),Hbe=P("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new oe({required:!0,each:new Y({values:pS})}),answerId:H})),zbe=P("followUpAnswers/followUpCompleted",e=>_(e,{answerId:H,cannotAnswer:new pe({required:!1})})),Wbe=P("followUpAnswers/followUpFailed",e=>_(e,{message:new $,code:new ne({min:0}),answerId:H})),Ybe=P("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new $})),Kbe=P("followUpAnswers/likeFollowUp",e=>_(e,{answerId:H})),Xbe=P("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:H})),Zbe=P("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:H})),lE=P("followUpAnswers/resetFollowUpAnswers"),Jbe=P("followUpAnswers/stepStarted",e=>_(iE(e),{answerId:H,name:oE,startedAt:new ne({min:0,required:!0})})),exe=P("followUpAnswers/stepFinished",e=>_(iE(e),{answerId:H,name:oE,finishedAt:new ne({min:0,required:!0})})),txe=P("followUpAnswers/startToolCall",e=>_(e,{answerId:H,toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),rxe=P("followUpAnswers/finishToolCall",e=>_(e,{answerId:H,finishedAt:new ne({min:0,required:!0}),toolCallId:H})),nxe=P("followUpAnswers/toolCallArgs",e=>_(e,{answerId:H,toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Ud})}));d();c();l();u();var zU={"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:SSE_TURN_LIMIT_REACHED":1005};function dE(e){return e?zU[e]??1004:1004}function WU(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function qf(e){if(e)return WU({...e})}var pE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Va(n.runId)),e(en(!1)),e(ri(!0)),e(sE(n.threadId)),e(uE())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Zd({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Jd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:p}=n;e(ep({toolCallId:a,toolCallName:i,startedAt:p??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(tp({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let p=JSON.parse(a);typeof p?.q=="string"?e(Ba({toolCallId:i,args:p,type:"search"})):e(Ba({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(Ba({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(ni({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(ai(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(aE(a.followUpEnabled)),a?.conversationToken&&e(cE(a.conversationToken));return}case"citations":{e(oi({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=dE(n.code);e(ii({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(Wc(i)),e(si(!i)),e(ri(!1)),e(Ry(i,t,a)),e(ba())}}};var fE=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,i){t();let a=Ll(n),p=Bb(n),f=Gb(n),m=Qb(n),g=$b(n),A=nE(a,p,f);e=A;let x=pE(o),h=$w(n,i());try{o(en(!0)),yield A.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(y){o(en(!1)),o(ii({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var mE=e=>{let t=HC({extra:e}),r=fE();return t.startListening({actionCreator:_e.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Sy(i)||(r.abortRun(),o.dispatch(lr()),o.dispatch(lE()),i.generatedAnswer.isEnabled===!1))return;let a=ti(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var gE=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},hE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var cv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};d();c();l();u();function yE(e,t){let r={...e},n,o=i=>(a,p)=>{let f=i(a,p);return n?n(f,p):f};return{get combinedReducer(){let i=sA(Object.entries(t).filter(([a])=>!(a in r)).map(([a,p])=>[a,()=>p]));return o(Ji({...i,...r}))},containsAll(i){return Object.keys(i).every(p=>p in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}d();c();l();u();d();c();l();u();function YU(e){if(!e||!KU(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function SE(e,t=60){if(!e)return!1;let r=YU(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function KU(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function AE(e,t){let r=0,n=null,o=Uu(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(f,m=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!m)throw x;return null}})().finally(()=>{n=null}));let A=yield n;return g&&A&&f.dispatch(Aa({accessToken:A})),A});return function i(_x208){return _ref85.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),g=ZU(m);if(!(!g||!SE(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(f))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(A){e.warn(A,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x209){return _ref87.apply(this,arguments)}}(),p=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(f,m,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),vE(f,m.error),m;!n&&(r++,o());try{yield i(f,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}f.dispatch(g)});return function p(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(g){let A=typeof g=="function",x=typeof t=="function";if(!A)return m(g);x&&(yield a(f));let h=yield m(g);return XU(h)?x?yield p(f,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),vE(f,h.error),h):h});return function(_x213){return _ref89.apply(this,arguments)}}())}function XU(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Yi().name}function vE(e,t){e.dispatch(_a({status:401,statusCode:401,message:t.message,type:t.name}))}function ZU(e){return e.configuration.accessToken}d();c();l();u();function CE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return OC({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(hE(n.logger))})}function JU(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=a.analyticsMode!=="next",f=a.analyticsMode==="legacy"&&o===!0;return p&&Hg()&&!f?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(p&&Hg()&&f&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function bE(e,t){let r={...e.reducers,configuration:we,version:Jw},n=eQ({...e,reducers:r},t,we),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Aa({accessToken:o,environment:i,organizationId:a}));let p=JU(e.configuration,n.logger);return p&&n.dispatch(Yl(p)),n}function eQ(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=yE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,p={...t,get relay(){return Ec(m.state,o)},get navigatorContext(){return cv(this.relay,o)}},f=tQ(e,p,i),m={addReducers(g){i.containsAll(g)||(i.add(g),f.replaceReducer(i.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(Xl())},disableAnalytics(){f.dispatch(Kl())},get state(){return f.getState()},get relay(){return Ec(this.state,o)},get navigatorContext(){return cv(this.relay,o)},logger:a,store:f};return m}function tQ(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=rQ(e,t.logger,()=>t.navigatorContext);return CE({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function rQ(e,t,r){let{renewAccessToken:n}=e.configuration,o=AE(t,n),i=mE({getNavigatorContext:r});return[cR,o,gE(t),tR].concat(ci.middleware,i.middleware,e.middlewares||[])}var nQ=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function qf(e){e==="next"&&console.warn(JU)}d();c();l();u();var kE=Fr(PE(),1);function OE(e){return(0,kE.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function _E(e,t){let r=yQ(e),n=mr,o=SQ(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function yQ(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function SQ(e){return e.preprocessRequest||Ku}d();c();l();u();d();c();l();u();var NE={organizationId:H,accessToken:H,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new pe({required:!1}),originContext:new $({required:!1}),originLevel2:new $({required:!1}),originLevel3:new $({required:!1}),analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new $({required:!1,url:!0}),trackingId:new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new pe({required:!1})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function DE(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var qE=new Oe({...NE,insightId:H,search:new Y({options:{required:!1},values:{locale:We}})}),vQ="2729db39-d7fd-4504-a06e-668c64968c95";function gv(){return{...DE(),insightId:vQ}}var AQ={insightConfiguration:Xl,search:Ee,insightInterface:eo,searchHub:Fd,resultPreview:_i};function CQ(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function ME(e){let t=OE(e.loggerOptions);bQ(e.configuration,t);let r=xQ(e.configuration,t),n=wQ(t),o={..._E(e.configuration,t),apiClient:r,streamingClient:n,generatedAnswerAnalyticsClient:wi},a={...e,reducers:AQ},i=CE(a,o);qf(i.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,f=CQ(e.configuration);return i.dispatch(Kl({insightId:p})),i.dispatch(zr()),f&&i.dispatch(bi(f)),{...i,get state(){return i.state},executeFirstSearch(m=sd()){Ed(i.state)||i.dispatch(xe({legacy:m,next:fx()}))}}}function bQ(e,t){try{qE.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function xQ(e,t){return new Xu({logger:t,preprocessRequest:e.preprocessRequest||Ku})}function wQ(e){return new Yu({logger:e})}d();c();l();u();function he(e){let t,r=new Map,n=()=>r.size===0,o=a=>{try{let i=JSON.stringify(a),p=t!==i;return t=i,p}catch(i){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",i),!0}};return{subscribe(a){a();let i=Symbol(),p;return n()&&(t=JSON.stringify(this.state),p=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(i,a),()=>{r.delete(i),n()&&p?.()}},get state(){return{}}}}d();c();l();u();d();c();l();u();var jE={articleLanguage:We,articlePublishStatus:We,articleVersionNumber:We,caseId:H,knowledgeArticleId:We,name:We,permanentId:We,resultUrl:We,source:We,title:H,uriHash:We,isAttachedFromCitation:new pe({required:!1,default:!1})},RQ=new Y({options:{required:!0},values:jE}),Vf=P("insight/attachToCase/setAttachedResults",e=>_(e,{results:new oe({each:RQ}),loading:new pe({required:!1,default:!1})})),vo=P("insight/attachToCase/attach",e=>VE(e)),Ao=P("insight/attachToCase/detach",e=>VE(e)),VE=e=>J(e.permanentId)&&J(e.uriHash)?{payload:e,error:Tr(new Do("Either permanentId or uriHash is required"))}:_(e,jE);d();c();l();u();d();c();l();u();var qr=e=>{let t=ee(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var us=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCaseAttach(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:qr(t)}}}),ls=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,ee(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:kr(e,t),context:qr(t)})});d();c();l();u();d();c();l();u();function LE(){return{results:[],loading:!1}}var Co=fe(LE(),e=>{e.addCase(Vf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(vo,(t,r)=>{(!J(r.payload.permanentId)||!J(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(Ao,(t,r)=>{t.results=t.results.filter(n=>IQ(n,r.payload))})}),IQ=(e,t)=>{let r=!J(e.permanentId)&&e?.permanentId===t?.permanentId,n=!J(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Lf=(e,t)=>$a(e.raw[t])?String(e.raw[t]):void 0,ds=(e,t)=>({articleLanguage:Lf(e,"sflanguage"),articleVersionNumber:Lf(e,"sflanguage"),articlePublishStatus:Lf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Lf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function UE(e,t){if(!EQ(e))throw ae;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=he(e),{result:a,caseId:i}=t.options,p=()=>J(i)||J(a.raw.permanentid)&&J(a.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=i===f.caseId,g=!J(f.permanentId)&&f.permanentId===a.raw.permanentid,A=!J(f.uriHash)&&f.uriHash===a.raw.urihash;return m&&(g||A)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(vo(ds(a,i))),r(us(a))},detach(){r(Ao(ds(a,i))),r(ls(a))}}}function EQ(e){return e.addReducers({configuration:we,attachedResults:Co}),!0}d();c();l();u();function QE(e,t){if(!FQ(e))throw ae;let{dispatch:r}=e,n=he(e),{caseId:o}=t.options,a=p=>J(o)||J(p.raw.permanentid)&&J(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,g=!J(f.permanentId)&&f.permanentId===p.raw.permanentid,A=!J(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(g||A)}),i=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:i(),loading:e.state.attachedResults.loading}},isAttached(p){return a(p)},attach(p){r(vo(ds(p,o))),r(us(p))},detach(p){r(Ao(ds(p,o))),r(ls(p))}}}function FQ(e){return e.addReducers({configuration:we,attachedResults:Co}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ye=H;d();c();l();u();var TQ={state:new He({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new oe({required:!0,each:H}),moreValuesAvailable:new pe({required:!1})};function hv(e){e.children.forEach(t=>{hv(t)}),mr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},TQ)}var ps={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),basePath:new oe({required:!1,each:H}),filterByBasePath:new pe({required:!1})};var fs=P("categoryFacet/register",e=>_(e,ps)),ms=P("categoryFacet/toggleSelectValue",e=>{try{return mr(e.facetId,H),hv(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),bo=P("categoryFacet/deselectAll",e=>_(e,ps.facetId)),pu=P("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:ps.facetId,numberOfValues:ps.numberOfValues})),Uf=P("categoryFacet/updateSortCriterion",e=>_(e,{facetId:ps.facetId,criterion:new He})),BE=P("categoryFacet/updateBasePath",e=>_(e,{facetId:ps.facetId,basePath:new oe({each:H})}));d();c();l();u();var GEe={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})};var GE=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var PQ={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})},kQ=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Qf=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,PQ);let n={...kQ(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Ge=P("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new pe({required:!1})})),nr=P("facetOptions/facet/enable",e=>_(e,ye)),pt=P("facetOptions/facet/disable",e=>_(e,ye));d();c();l();u();var or=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var fu={facetId:ye,captions:new Y({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var OQ={path:new oe({required:!0,each:H}),displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})},Bf=P("categoryFacet/selectSearchResult",e=>_(e,{facetId:ye,value:new Y({values:OQ})})),$E=P("categoryFacetSearch/register",e=>_(e,fu));d();c();l();u();function gs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function hs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Gf(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function mu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function $f(e,t,r){e.currentValues=_Q(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function _Q(e,t){if(!e.length)return[];let r=HE(e[0],t),n=r;for(let o of e.splice(1)){let a=HE(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function HE(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Hf=fe(pi(),e=>{e.addCase(fs,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=DQ(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(tt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(a=>{let i=t[a],p=i.request;if((i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,o)){p.currentValues.length&&$f(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&$f(p,m,i.initialNumberOfValues)})}).addCase(Uf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(BE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(ms,(t,r)=>{let{facetId:n,selection:o,retrieveCount:a}=r.payload,i=t[n]?.request;if(!i)return;let{path:p}=o,f=p.slice(0,p.length-1),m=NQ(i,f,a);if(m.length){let A=m[0];A.retrieveChildren=!0,A.state="selected",A.previousState="idle",A.children=[];return}let g=WE(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(bo,(t,r)=>{let n=r.payload;mu(t,n)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>mu(t,r))}).addCase(Ei,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(pu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Gf(a,o);qQ(t,r.payload)}}).addCase(Bf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];$f(a.request,i,a.initialNumberOfValues)}).addCase(Oi.fulfilled,(t,r)=>{zE(t,r.payload.response.facets)}).addCase(_e.fulfilled,(t,r)=>{zE(t,r.payload.response.facets)}).addCase(pt,(t,r)=>{mu(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&mu(t,o)})})}),yv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function NQ(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=WE(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function DQ(e){return{...yv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function WE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function zE(e,t){t.forEach(r=>{if(!MQ(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=jQ(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function qQ(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function MQ(e,t){return t.facetId in e}function jQ(e,t){let r=$r(e.currentValues),n=$r(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var cn=new $({regex:/^[a-zA-Z0-9-_]+$/}),un=new $({required:!0}),YE=new oe({each:new $}),KE=new $,XE=new pe,ln=new pe,dn=new ne({min:0}),Mr=new ne({min:1}),zf=new pe({required:!0}),VQ=new Y,LQ=new $,UQ={captions:VQ,numberOfValues:Mr,query:LQ},ys=new Y({values:UQ}),Wf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new oe({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),gTe=new pe,Yf=new oe({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var _a={value:H,numberOfResults:new ne({min:0}),state:H};var QQ={facetId:ye,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),resultsMustMatch:new He({required:!1}),allowedValues:Wf,customSort:Yf},Ss=P("facet/register",e=>_(e,QQ)),xo=P("facet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),wo=P("facet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),vt=P("facet/deselectAll",e=>_(e,ye)),Kf=P("facet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new He({required:!0})})),gu=P("facet/updateNumberOfValues",e=>_(e,{facetId:ye,numberOfValues:new ne({required:!0,min:1})})),hu=P("facet/updateIsFieldExpanded",e=>_(e,{facetId:ye,isFieldExpanded:new pe({required:!0})})),Na=P("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ye,freezeCurrentValues:new pe({required:!0})}));d();c();l();u();var vs=e=>Fe("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o=hi(e,n);return t.makeFacetUnexclude(o)});var ar=()=>({actionCause:"facetClearAll"}),pr=()=>({actionCause:"facetSelect"}),Xf=()=>({actionCause:"facetExclude"}),Ln=()=>({actionCause:"facetDeselect"});var Sv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var As=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ye);let n={...zo(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowMore(n)}),Cs=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ye);let n={...zo(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowLess(n)}),pn=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ye,sortCriterion:new He({required:!0})});let{facetId:n,sortCriterion:o}=e,a=Xt(r),p={...zo(n,a),criteria:o,...ee(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Qt=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ye);let n=Xt(r),o={...zo(e,n),...ee(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...hi(e,n),...ee(r.insightCaseContext)};return t.logFacetSelect(o)}),jr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...hi(e,n),...ee(r.insightCaseContext)};return t.logFacetDeselect(o)}),yu=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n={...hi(e,Xt(r)),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var ZE={facetId:ye,value:new Y({values:{displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})}})},JE=P("facetSearch/register",e=>_(e,fu)),Zf=P("facetSearch/update",e=>_(e,fu)),Jf=P("facetSearch/toggleSelectValue",e=>_(e,ZE)),em=P("facetSearch/toggleExcludeValue",e=>_(e,ZE));var bs=fe(gi(),e=>{e.addCase(Ss,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=qb(BQ(r.payload),o))}).addCase(tt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(ot,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:p}=t[i],f=n[i]||[],m=o[i]||[],g=f.length+m.length,A=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(tF),...m.map(rF),...A.map($Q)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(xo,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){tm(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(wo,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){tm(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(Na,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(vt,(t,r)=>{hs(t[r.payload]?.request)}).addCase(Jt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>hs(r))}).addCase(fd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>hs(r))}).addCase(Ei,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Kf,(t,r)=>{gs(t,r.payload)}).addCase(gu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Gf(t[n]?.request,o)}).addCase(hu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(_e.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>eF(t[o.facetId]?.request,o))}).addCase(Oi.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>eF(t[o.facetId]?.request,o))}).addCase(Jf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="selected";return}let m=tF(i);tm(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(em,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="excluded";return}let m=rF(i);tm(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(pt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];hs(n)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&hs(a.request)})})});function tm(e,t){let{currentValues:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function eF(e,t){e&&(e.currentValues=t.values.map(GQ),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var vv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function BQ(e){return{...vv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function GQ(e){let{value:t,state:r}=e;return{value:t,state:r}}function tF(e){return{value:e,state:"selected"}}function rF(e){return{value:e,state:"excluded"}}function $Q(e){return{...e,state:"idle"}}d();c();l();u();var rm=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();function xs(e){let t=nF(e.start,e),r=nF(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function nF(e,t){let{dateFormat:r}=t;return _A(e)?(zu(e),PA(e)):typeof e=="string"&&$n(e)?(zu(e),e):(IA(e,r),Hu(Ka(e,r)))}d();c();l();u();var ws=P("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new He({required:!0})}));d();c();l();u();var Da={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new pe({required:!0}),numberOfResults:new ne({required:!0,min:0})},qa={start:H,end:H,endInclusive:new pe({required:!0}),state:H,numberOfResults:new ne({required:!0,min:0})},Un=e=>({facetId:ye,selection:typeof e.start=="string"?new Y({values:qa}):new Y({values:Da})});var HQ={start:H,end:H,endInclusive:new pe({required:!0}),state:H},zQ={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:HQ})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),rangeAlgorithm:new He({required:!1})};function oF(e){return $n(e)?ac(e):e}function nm(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=xs(t);if(Ka(oF(r)).isAfter(Ka(oF(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var fn=P("dateFacet/register",e=>{try{return mr(e,zQ),nm(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),mn=P("dateFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:qa})})),gn=P("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:qa})})),Qn=P("dateFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:qa})})}),nm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),om=ws,am=vt;d();c();l();u();d();c();l();u();var im=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},sm=()=>({actionCause:"breadcrumbFacet"});var Av=sm;d();c();l();u();var Su=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,Un(e.selection));let n={...im(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function WQ(e,t){return!!t&&t.facetId in e.dateFacetSet}var aF=(e,t)=>{let r=Tn(e,t);if(WQ(e,r))return r},iF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),sF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var um={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function lm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=cF(r);r.numberOfValues=o,e[n]=t}function dm(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=cF(n))}function pm(e,t,r){let n=e[t]?.request;if(!n)return;let o=cm(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function fm(e,t,r){let n=e[t]?.request;if(!n)return;let o=cm(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function hn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function mm(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!cm(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let a=o.filter(p=>!cm(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function gm(e,t,r){t.forEach(n=>{let o=n.facetId,a=e[o]?.request;if(!a)return;let i=r(n.values);a.currentValues=i,a.preventAutoSelect=!1})}function cm(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function cF(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var yn=fe(fi(),e=>{e.addCase(fn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=YQ(n);lm(t,Nb(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.df||{};mm(t,n)}).addCase(mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;pm(t,n,o)}).addCase(gn,(t,r)=>{let{facetId:n,selection:o}=r.payload;fm(t,n,o)}).addCase(Qn,(t,r)=>{let{facetId:n,values:o}=r.payload;dm(t,n,o)}).addCase(am,(t,r)=>{hn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{hn(t,r)})}).addCase(om,(t,r)=>{gs(t,r.payload)}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.facets;gm(t,n,KQ)}).addCase(pt,(t,r)=>{hn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&hn(t,o)})})});function YQ(e){return{...um,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function KQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var XQ={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new pe({required:!0})},ZQ={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:XQ})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),rangeAlgorithm:new He({required:!1})};function hm(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Sn=P("numericFacet/register",e=>{try{return _(e,ZQ),hm(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),vn=P("numericFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Da})})),An=P("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Da})})),Bn=P("numericFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:Da})})}),hm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),ym=ws,Sm=vt;d();c();l();u();var Cv=sm;d();c();l();u();d();c();l();u();var uF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var vu=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,Un(e.selection));let n={...uF(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function JQ(e,t){return!!t&&t.facetId in e.numericFacetSet}var lF=(e,t)=>{let r=Tn(e,t);if(JQ(e,r))return r},dF=(e,t)=>(lF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),pF=(e,t)=>(lF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Ro=fe(mi(),e=>{e.addCase(Sn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=eB(n);lm(t,Db(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.nf||{};mm(t,n)}).addCase(vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;pm(t,n,o)}).addCase(An,(t,r)=>{let{facetId:n,selection:o}=r.payload;fm(t,n,o)}).addCase(Bn,(t,r)=>{let{facetId:n,values:o}=r.payload;dm(t,n,o)}).addCase(Sm,(t,r)=>{hn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{hn(t,r)})}).addCase(ym,(t,r)=>{gs(t,r.payload)}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.facets;gm(t,n,tB)}).addCase(pt,(t,r)=>{hn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&hn(t,o)})})});function eB(e){return{...um,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function tB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Au=H,vm=new Y({options:{required:!0},values:{caption:Ke,expression:Ke,state:new $({constrainTo:["idle","selected","excluded"]})}}),fF=new oe({required:!0,each:vm});var H_e=P("staticFilter/register",e=>_(e,{id:Au,values:fF})),mF=P("staticFilter/toggleSelect",e=>_(e,{id:Au,value:vm})),gF=P("staticFilter/toggleExclude",e=>_(e,{id:Au,value:vm})),z_e=P("staticFilter/deselectAllFilterValues",e=>_(e,Au));d();c();l();u();var Am=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...ee(r.insightCaseContext)}));d();c();l();u();var Cm=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function hF(e){let t=he(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Jt())},deselectBreadcrumb(n){n.deselect()}}}function yF(e){if(!rB(e))throw ae;let t=hF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:y,selection:b})=>{let w=yu({facetId:y,facetValue:b.value});r(xo({facetId:y,selection:b})),r(Na({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:Sv()}))},executeToggleExclude:({facetId:y,selection:b})=>{let w=yu({facetId:y,facetValue:b.value});r(wo({facetId:y,selection:b})),r(Na({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:Sv()}))},facetValuesSelector:kb};return Cm(h)},a=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:y=>{r(vn(y)),r(xe({legacy:vu(y),next:Cv()}))},executeToggleExclude:y=>{r(An(y)),r(xe({legacy:vu(y),next:Cv()}))},facetValuesSelector:dF};return Cm(h)},i=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:y=>{r(mn(y)),r(xe({legacy:Su(y),next:Av()}))},executeToggleExclude:y=>{r(gn(y)),r(xe({legacy:Su(y),next:Av()}))},facetValuesSelector:sF};return Cm(h)},p=h=>{let y=_b(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:y,deselect:()=>{r(bo(h)),r(xe({legacy:Qf({categoryFacetPath:y.map(b=>b.value),categoryFacetId:h}),next:GE()}))}}},f=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),m=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:y,values:b}=h,w=b.filter(I=>I.state!=="idle").map(I=>A(y,I));return{id:y,values:w}},A=(h,y)=>({value:y,deselect:()=>{let{caption:b,expression:w}=y,I=Am({staticFilterId:h,staticFilterValue:{caption:b,expression:w}});y.state==="selected"?r(mF({id:h,value:y})):y.state==="excluded"&&r(gF({id:h,value:y})),r(xe({legacy:I}))}});function x(){return!![...o(),...a(),...i(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:x()}},deselectAll:()=>{t.deselectAll(),r(xe({legacy:rm(),next:{actionCause:"breadcrumbResetAll"}}))}}}function rB(e){return e.addReducers({configuration:we,search:Ee,facetSet:bs,numericFacetSet:Ro,dateFacetSet:yn,categoryFacetSet:Hf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var SF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var bm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),vF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function AF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:bm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var CF=(e,t)=>{let r={...vF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var bF=fe(AF(),e=>{e.addCase(ed,t=>{t.enableDidYouMean=!0}).addCase(Ix,t=>{t.enableDidYouMean=!1}).addCase(Ex,t=>{t.automaticallyCorrectQuery=!0}).addCase(td,t=>{t.automaticallyCorrectQuery=!1}).addCase(_e.pending,t=>{t.queryCorrection=bm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(_e.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:bm();t.queryCorrection=a}t.queryCorrectionMode==="next"&&CF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Zt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(jc,(t,r)=>{t.queryCorrectionMode=r.payload})});function xF(e,t={}){if(!nB(e))throw ae;let r=he(e),{dispatch:n}=e;n(ed()),t.options?.automaticallyCorrectQuery===!1&&n(td()),n(jc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>SF(o().didYouMean);return{...r,get state(){let i=o();return{originalQuery:i.didYouMean.originalQuery,wasCorrectedTo:i.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:i.didYouMean.wasAutomaticallyCorrected,queryCorrection:i.didYouMean.queryCorrection,hasQueryCorrection:a()}},applyCorrection(){n(Zt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(jc(i))}}}function nB(e){return e.addReducers({configuration:we,didYouMean:bF}),!0}var wF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function RF(e,t={options:wF}){let r={...wF,...t.options},n=xF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(xe({legacy:Nx(),next:Qx()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Bt=fe(od(),e=>{e.addCase(Ge,(t,r)=>({...t,...r.payload})).addCase(_e.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(_e.rejected,t=>{t.freezeFacetOrder=!1}).addCase(tt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(fs,(t,r)=>{let{facetId:n,tabs:o}=r.payload;xm(o,t,n)}).addCase(Ss,(t,r)=>{let{facetId:n,tabs:o}=r.payload;xm(o,t,n)}).addCase(fn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;xm(o,t,n)}).addCase(Sn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;xm(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(pt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(ot,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=ky()),t.facets[n].enabled=!0})})});function xm(e,t,r){let n={...ky(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var wm=fe(id(),e=>{e.addCase(ap,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(_t,(t,r)=>{let n=r.payload;IF(t,n)}).addCase(op,(t,r)=>{let n=r.payload;IF(t,n)}).addCase(tt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(ot,(t,r)=>{let n=r.payload.tab;J(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function IF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function EF(e){if(!oB(e))throw ae;let t=he(e),r=ct(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function oB(e){return e.addReducers({tabSet:wm}),!0}function FF(e,t){if(!aB(e))throw ae;let r=EF(e),n=y=>e.state.facetOptions.facets[y]?.enabled??!1,o=y=>e.state.facetSet?.[y]?.request?.currentValues??e.state.categoryFacetSet?.[y]?.request?.currentValues??e.state.numericFacetSet?.[y]?.request?.currentValues??e.state.dateFacetSet?.[y]?.request?.currentValues??null,a=y=>y in e.state.facetOptions.facets,i=y=>e.state.facetOptions.facets[y]?.tabs,p=()=>za({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:y})=>a(y)?{enabled:n(y),values:o(y)}:null),isTabEnabled:or(i(t.facetId),r.state.activeTab)}),f=()=>{let y=p();return y===x?!1:(x=y,!0)},m=()=>t.conditions.length>0?t.conditions.some(y=>{if(!n(y.parentFacetId))return!1;let b=o(y.parentFacetId);return b===null?!1:y.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([y,b])=>b.request.freezeCurrentValues&&e.dispatch(Na({facetId:y,freezeCurrentValues:!1})))},A=()=>{if(!a(t.facetId))return;let y=n(t.facetId),b=m(),w=or(i(t.facetId),r.state.activeTab),I=b&&w;y!==I&&(e.dispatch(I?nr(t.facetId):pt(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&A()});return A(),{stopWatching(){h()}}}function aB(e){return e.addReducers({facetOptions:Bt}),!0}function TF(e,t){return FF(e,t)}d();c();l();u();d();c();l();u();function PF(e){if(!iB(e))throw ae;let t=he(e),r=()=>e.state;return{...t,sort(n){return Lc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function iB(e){return e.addReducers({search:Ee,facetOptions:Bt}),!0}function kF(e){return PF(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Rm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...Rs,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Im(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Em(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Fm(e,t){let r=e[t];r&&(r.isLoading=!1)}function Tm(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function Cu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=Rs.query)}function Pm(e,t){Object.keys(e).forEach(r=>Cu(e,{facetId:r},t))}var Rs={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var OF=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:p,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:A,filterFacetCount:x}=a,h=sB(a),y=h.length?[h]:[],b=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:A,captions:i,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:y,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function OF(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),sB=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var _F=/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:p,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(x=>x.state!=="idle").map(x=>x.value),A=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:i,query:A,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function _F(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var NF=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,H),cB(i,t)?p=yield _F(t,i,a,e):p=yield OF(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),Io=me("facetSearch/executeSearch",NF(!1)),Rqe=me("facetSearch/executeSearch",NF(!0)),km=P("facetSearch/clearResults",e=>_(e,{facetId:ye})),cB=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function DF(){return{}}var qF=fe(DF(),e=>{e.addCase($E,(t,r)=>{let n=r.payload;Rm(t,n,bv)}).addCase(Zf,(t,r)=>{Im(t,r.payload)}).addCase(Io.pending,(t,r)=>{let n=r.meta.arg;Em(t,n,r.meta.requestId)}).addCase(Io.rejected,(t,r)=>{let n=r.meta.arg;Fm(t,n)}).addCase(Io.fulfilled,(t,r)=>{Tm(t,r.payload,r.meta.requestId)}).addCase(km,(t,{payload:{facetId:r}})=>{Cu(t,{facetId:r},bv)}).addCase(_e.fulfilled,t=>{Pm(t,bv)})});function bv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function MF(e,t){let{field:r,state:n}=e;if(!uB(e))return r;let o=`${r}_`,a=lB(o,n);return pB(r,t),`${o}${a}`}function uB(e){let{field:t,state:r}=e;return jF(r).some(o=>o&&t in o)}function lB(e,t){let n=jF(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return dB(n,e)+1}function jF(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function dB(e,t){return e.map(a=>{let i=a.split(t)[1],p=parseInt(i,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function pB(e,t){let r=`A facet with field "${e}" already exists.
46
- To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function wr(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||MF({field:o,state:r},n)}d();c();l();u();d();c();l();u();var VF=["alphanumeric","occurrences"];var LF=new Oe({field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),basePath:YE,delimitingCharacter:KE,facetId:cn,facetSearch:ys,filterByBasePath:XE,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:VF})});function UF(e,t){if(!fB(e))throw ae;let r=he(e),{dispatch:n}=e,o=wr(e,t.options),a=t.options.tabs??{},i=Lt(e.state.tabSet),p={...yv,...Lu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...Rs,...t.options.facetSearch},...p};ht(e,LF,f,"buildCategoryFacet");let m=()=>fy(e.state,o),g=()=>py(e.state,o),A=()=>Gr(e.state),x=()=>Jr(e.state,o);return n(fs(p)),{...r,toggleSelect(h){let y=f.numberOfValues;n(ms({facetId:o,selection:h,retrieveCount:y})),n(Ge())},deselectAll(){n(bo(o)),n(Ge())},sortBy(h){n(Uf({facetId:o,criterion:h})),n(Ge())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:y,valuesAsTrees:b}=this.state,w=(y?.children.length??b.length)+h;n(pu({facetId:o,numberOfValues:w})),n(Ge())},showLessValues(){let{numberOfValues:h}=f;n(pu({facetId:o,numberOfValues:h})),n(Ge())},enable(){n(nr(o))},disable(){n(pt(o))},get state(){let h=m(),y=g(),b=A(),w=x(),I=y?.values??[],F=I.some(B=>B.children.length>0)??!1,{parents:E,values:k}=Ob(y?.values),T=$r(I),q=T.length?T[T.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??y?.moreValuesAvailable??!1,V=q?q.children.length>f.numberOfValues:I.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:T,values:k,isHierarchical:F,valuesAsTrees:I,activeValue:q,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:V,sortCriteria:h.sortCriteria,enabled:w}}}}function fB(e){return e.addReducers({categoryFacetSet:Hf,categoryFacetSearchSet:qF,facetOptions:Bt,configuration:we,search:Ee}),!0}function QF(e,t){let r=UF(e,t),{dispatch:n}=e,o=()=>r.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...r,facetSearch:f,toggleSelect(m){r.toggleSelect(m);let g=mB(o(),m);n(xe({legacy:g,next:gB(m)}))},deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ar()}))},sortBy(m){r.sortBy(m),n(xe({legacy:pn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(Ii({legacy:As(o())}))},showLessValues(){r.showLessValues(),n(Ii({legacy:Cs(o())}))},get state(){return{...r.state,facetSearch:i.state}}}}function mB(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?jr(r):Yt(r)}function gB(e){return e.state==="selected"?Ln():pr()}d();c();l();u();d();c();l();u();d();c();l();u();function BF(){return{}}var Om=fe(BF(),e=>{e.addCase(JE,(t,r)=>{let n=r.payload;Rm(t,n,xv)}).addCase(Zf,(t,r)=>{Im(t,r.payload)}).addCase(Io.pending,(t,r)=>{let n=r.meta.arg;Em(t,n,r.meta.requestId)}).addCase(Io.rejected,(t,r)=>{let n=r.meta.arg;Fm(t,n)}).addCase(Io.fulfilled,(t,r)=>{Tm(t,r.payload,r.meta.requestId)}).addCase(km,(t,{payload:r})=>{Cu(t,r,xv)}).addCase(_e.fulfilled,t=>{Pm(t,xv)})});function xv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var hB=e=>e.state==="selected",GF=(e,t)=>{let r={facetId:e,facetValue:t.value};return hB(t)?jr(r):Yt(r)};d();c();l();u();var wv=e=>e.state==="selected",WF=e=>e.state==="excluded";var YF=e=>wv(e)?Ln():pr();d();c();l();u();d();c();l();u();var KF={facetId:ye,selection:new Y({values:_a})},XF=me("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},KF),n(xo({facetId:e,selection:t})),n(Ge())}),ZF=me("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},KF),n(wo({facetId:e,selection:t})),n(Ge())});d();c();l();u();d();c();l();u();var Is=["allValues","atLeastOneValue"];d();c();l();u();var _m=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var JF=new Oe({facetId:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:un,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:_m}),resultsMustMatch:new $({constrainTo:Is}),facetSearch:ys});function eT(e,t,r=JF){if(!yB(e))throw ae;let{dispatch:n}=e,o=he(e),a=wr(e,t.options),i=t.options.tabs??{},p=Lt(e.state.tabSet),f={...vv,...Lu("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...Rs,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let g=()=>Pb(e.state,a),A=()=>dy(e.state,a),x=()=>Gr(e.state),h=()=>Jr(e.state,a),y=()=>{let{currentValues:w}=g();return w.filter(I=>I.state!=="idle").length},b=()=>{let{currentValues:w}=g(),I=m.numberOfValues,F=!!w.find(E=>E.state==="idle");return I<w.length&&F};return n(Ss(f)),{...o,toggleSelect:w=>n(XF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(ZF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(vt(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(vt(a)),this.toggleExclude(w)},isValueSelected:wv,isValueExcluded:WF,deselectAll(){n(vt(a)),n(Ge())},sortBy(w){n(Kf({facetId:a,criterion:w})),n(Ge())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,I=m.numberOfValues,F=I-w%I,E=w+F;n(gu({facetId:a,numberOfValues:E})),n(hu({facetId:a,isFieldExpanded:!0})),n(Ge())},showLessValues(){let w=m.numberOfValues,I=Math.max(w,y());n(gu({facetId:a,numberOfValues:I})),n(hu({facetId:a,isFieldExpanded:!1})),n(Ge())},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let w=g(),I=A(),F=x(),E=h(),k;typeof w.sortCriteria=="object"?k=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":k=w.sortCriteria;let T=I?I.values:[],q=T.some(V=>V.state!=="idle"),G=I?I.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:I?.label,facetId:a,tabs:i,values:T,sortCriterion:k,resultsMustMatch:Q,isLoading:F,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:b(),enabled:E}}}}function yB(e){return e.addReducers({facetSet:bs,facetOptions:Bt,configuration:we,facetSearchSet:Om}),!0}d();c();l();u();var tT=new Oe({facetId:cn,field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:_m}),resultsMustMatch:new $({constrainTo:Is}),facetSearch:ys,allowedValues:Wf,customSort:Yf});function rT(e,t){if(!SB(e))throw ae;let{dispatch:r}=e,n=eT(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},tT),o=()=>n.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(xe({legacy:GF(o(),m),next:YF(m)}))},deselectAll(){n.deselectAll(),r(xe({legacy:Qt(o()),next:ar()}))},sortBy(m){n.sortBy(m),r(xe({legacy:pn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ii({legacy:As(o())}))},showLessValues(){n.showLessValues(),r(Ii({legacy:Cs(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function SB(e){return e.addReducers({facetSet:bs,configuration:we,facetSearchSet:Om,search:Ee}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var bu=e=>e.state==="selected",nT=e=>e.state==="excluded";var Nm=e=>bu(e)?Ln():pr();var Dm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return bu(t)?jr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var qm=P("rangeFacet/executeToggleSelect",e=>_(e,Un(e.selection))),Mm=P("rangeFacet/executeToggleExclude",e=>_(e,Un(e.selection)));var oT={facetId:ye,selection:new Y({values:qa})},aT=me("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,oT),t(mn(e)),t(qm(e)),t(Ge())}),iT=me("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,oT),t(gn(e)),t(Mm(e)),t(Ge())});d();c();l();u();function jm(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function Vm(e,t){let{facetId:r,getRequest:n}=t,o=he(e),a=e.dispatch,i=()=>Jr(e.state,r);return{...o,isValueSelected:bu,isValueExcluded:nT,deselectAll(){a(vt(r)),a(Ge())},sortBy(p){a(ws({facetId:r,criterion:p})),a(Ge())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(nr(r))},disable(){a(pt(r))},get state(){let p=n(),f=Tn(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,A=f?f.values:[],x=Gr(e.state),h=i(),y=A.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:A,sortCriterion:m,resultsMustMatch:g,hasActiveValues:y,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var Lm=["idle","selected","excluded"];d();c();l();u();var Um=["ascending","descending"],Qm=["even","equiprobable"];var vB={start:new $,end:new $,endInclusive:new pe,state:new $({constrainTo:Lm})},AB=new Oe({facetId:cn,field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),generateAutomaticRanges:zf,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,currentValues:new oe({each:new Y({values:vB})}),sortCriteria:new $({constrainTo:Um}),rangeAlgorithm:new $({constrainTo:Qm})});function Bm(e,t){ht(e,AB,t,"buildDateFacet"),nm(t)}function sT(e,t){if(!CB(e))throw ae;jm(t.options,"buildDateFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=Lt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Bm(e,i),r(fn(i));let p=Vm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(aT({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(vt(n)),this.toggleSelect(f)},toggleExclude:f=>r(iT({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(vt(n)),this.toggleExclude(f)},get state(){return p.state}}}function CB(e){return e.addReducers({configuration:we,search:Ee,dateFacetSet:yn,facetOptions:Bt}),!0}function cT(e,t){let r=sT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(xe({legacy:pn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(xe({legacy:Dm(o(),a),next:Nm(a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function uT(e,t){if(!bB(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=Lt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Bm(e,f),n(fn(f));let m=()=>Jr(e.state,a);return{...r,clear:()=>{n(Qn({facetId:a,values:[]})),n(Ge())},setRange:g=>{let A={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Qn({facetId:a,values:[A]});return x.error?!1:(n(x),n(Ge()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Gr(o()),A=m(),x=iF(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:A}}}}function bB(e){return e.addReducers({dateFacetSet:yn,facetOptions:Bt,configuration:we,search:Ee}),!0}function lT(e,t){if(!xB(e))throw ae;let r=uT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Qt(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(xe({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}function xB(e){return e.addReducers({dateFacetSet:yn,configuration:we,search:Ee}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var dT={facetId:ye,selection:new Y({values:Da})},pT=me("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,dT),t(vn(e)),t(qm(e)),t(Ge())}),TQe=me("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,dT),t(An(e)),t(Mm(e)),t(Ge())});d();c();l();u();var wB={start:new ne,end:new ne,endInclusive:new pe,state:new $({constrainTo:Lm})},RB=new Oe({facetId:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:un,generateAutomaticRanges:zf,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,currentValues:new oe({each:new Y({values:wB})}),sortCriteria:new $({constrainTo:Um}),resultsMustMatch:new $({constrainTo:Is}),rangeAlgorithm:new $({constrainTo:Qm})});function Gm(e,t){ht(e,RB,t,"buildNumericFacet"),hm(t)}d();c();l();u();function $m(e){return{endInclusive:!1,state:"idle",...e}}function fT(e,t){if(!IB(e))throw ae;jm(t.options,"buildNumericFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=Lt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Gm(e,i),r(Sn(i));let p=Vm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(pT({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(vt(n)),this.toggleSelect(f)},get state(){return p.state}}}function IB(e){return e.addReducers({numericFacetSet:Ro,facetOptions:Bt,configuration:we,search:Ee}),!0}function mT(e,t){let r=fT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(xe({legacy:pn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(xe({legacy:Dm(o(),a),next:Nm(a)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function gT(e,t){if(!EB(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=Lt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Gm(e,f),n(Sn(f));let m=()=>Jr(e.state,a);return{...r,clear:()=>{n(Bn({facetId:a,values:[]})),n(Ge())},setRange:g=>{let A={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Bn({facetId:a,values:[A]});return x.error?!1:(n(x),n(Ge()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Gr(o()),A=m(),x=pF(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:A}}}}function EB(e){return e.addReducers({numericFacetSet:Ro,facetOptions:Bt,configuration:we,search:Ee}),!0}function hT(e,t){let r=gT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Qt(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(xe({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var FB=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ot(e),t.logShowMoreFoldedResults(Xe(e,r),Ze(e),ee(r.insightCaseContext)))),TB=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(ee(t.insightCaseContext))),yT={logShowMoreFoldedResults:FB,logShowLessFoldedResults:TB};d();c();l();u();d();c();l();u();var xu={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},Es=P("folding/register",e=>_(e,xu)),Hm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield oo(a):Fi(a,o),p=yield n.search({...i,q:PB(a),enableQuerySyntax:!0,cq:`@${a.folding.fields.collection}="${e}"`,filterField:a.folding.fields.collection,childField:a.folding.fields.parent,parentField:a.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return ze(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x224,_x225){return _ref93.apply(this,arguments)}}());function PB(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var ST=P("folding/register",e=>_(e,xu)),zm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield _x(o,e),p=(yield Vx(n,o,a,{origin:"foldingCollection"})).response;return ze(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x226,_x227){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Wm=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function kB(e,t){return e.raw[t.collection]}function Rv(e,t){return e.raw[t.parent]}function wu(e,t){let r=e.raw[t.child];return ju(r)?r[0]:r}function OB(e,t){return(e||t)!==void 0&&e===t}function AT(e,t,r,n=[]){let o=wu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=wu(a,r)===wu(e,r);return Rv(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:AT(i,t,r,[...n,o])}}):[]}function _B(e,t){return e.find(r=>{let n=Rv(r,t)===void 0,o=OB(Rv(r,t),wu(r,t));return n||o})}function CT(e){return e.parentResult?CT(e.parentResult):e}function NB(e,t,r,n){let o=$l(e),i={...(n??_B(o,t)??CT(e)),searchUid:r},p=AT(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Ym(e,t,r,n){let o={};return e.forEach(a=>{let i=kB(a,t);i&&(!wu(a,t)&&!a.parentResult||(o[i]=NB(a,t,r,n)))}),o}function vT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var Km=fe(Wm(),e=>e.addCase(_e.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Ym(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Zr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Ym(r.response.results,t.fields,r.response.searchUid):{}}).addCase(uo.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Ym(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Es,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(Hm.pending,(t,{meta:r})=>{let n=r.arg;vT(t,n).isLoadingMoreResults=!0}).addCase(Hm.rejected,(t,{meta:r})=>{let n=r.arg;vT(t,n).isLoadingMoreResults=!1}).addCase(Hm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=Ym(n,t.fields,a,o);if(!i||!i[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=i[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var Ru={id:H},Eo=P("querySuggest/register",e=>_(e,{...Ru,count:new ne({min:0})})),bT=P("querySuggest/unregister",e=>_(e,Ru)),Fo=P("querySuggest/selectSuggestion",e=>_(e,{...Ru,expression:Ke})),To=P("querySuggest/clear",e=>_(e,Ru)),Fs=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,Ru);let i=e.id,p=yield DB(i,t(),a),f=yield n.querySuggest(p);return ze(f)?r(f.error):{id:i,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),DB=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield to(t.configuration.analytics):Xo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function DB(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Po=fe(ut(),e=>e.addCase(Wt,(t,r)=>({...t,...r.payload})).addCase(Zt,(t,r)=>{t.q=r.payload}).addCase(Fo,(t,r)=>{t.q=r.payload.expression}).addCase(tt.fulfilled,(t,r)=>r.payload?.query??t).addCase(ot,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var ko=P("fields/registerFieldsToInclude",e=>_(e,Zu)),Xm=P("fields/fetchall/enable"),Zm=P("fields/fetchall/disable"),Jm=me("fields/fetchDescription",/*#__PURE__*/function(){var _ref97=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:a,environment:i,organizationId:p}=o.configuration,{apiBaseUrl:f}=o.configuration.search,m=yield t.apiClient.fieldDescriptions({accessToken:a,organizationId:p,url:f??Kt(p,i)});return ze(m)?n(m.error):m.success.fields});return function(_x233,_x234){return _ref97.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var xT=["author","language","urihash","objecttype","collection","source","permanentid"],qB=[...xT,"date","filetype","parents"],FGe=[...qB,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],wT=()=>({fieldsToInclude:xT,fetchAllFields:!1,fieldsDescription:[]});var Ts=fe(wT(),e=>e.addCase(ko,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Xm,t=>{t.fetchAllFields=!0}).addCase(Zm,t=>{t.fetchAllFields=!1}).addCase(Jm.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Es,(t,{payload:r})=>{let n=Wm().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Ps(e){if(!MB(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:Ed(n)}}}}function MB(e){return e.addReducers({search:Ee}),!0}var jB=new Oe({fieldsToInclude:new oe({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function eg(e,t){if(!VB(e))throw ae;let r=he(e),n=Ps(e),{dispatch:o}=e,a=()=>e.state,i=ht(e,jB,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(ko(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,A=200,x=!1;return{...r,get state(){let y=a();return{...n.state,results:y.search.results,moreResultsAvailable:p(),searchResponseId:y.search.searchResponseId}},fetchMoreResults:function(){var _ref98=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-f<A){if(m++,m>=g){f=Date.now(),!x&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),x=!0;return}}else m=0;x=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function VB(e){return e.addReducers({search:Ee,configuration:we,fields:Ts}),!0}var LB=new Oe(xu);function RT(e,t,r){if(!UB(e))throw ae;let n=eg(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?ht(e,LB,t.options.folding,"buildFoldedResultList"):{};return o(Es({...i})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return Iv(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return Iv(this.state.results,f=>f.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=a();return{...n.state,results:n.state.results.map(f=>{let m=f.raw[p.folding.fields.collection];return!m||!p.folding.collections[m]?{result:f,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[m]})}}}}function UB(e){return e.addReducers({search:Ee,configuration:cp,folding:Km,query:Po}),!0}function Iv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=Iv(n.children,t);if(o)return o}}return null}function IT(e,t={}){let r=RT(e,{...t,loadCollectionActionCreator:zm,fetchMoreResultsActionCreator:dd},yT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function tg(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var ks=fe(fS(),e=>e.addCase(Vi,(t,{payload:r})=>{t.isVisible=r}).addCase(Qi,(t,{payload:r})=>{t.isEnabled=r}).addCase($d,(t,{payload:r})=>{t.id=r.id}).addCase(na,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),a=n.trim().length>0;if(o){t.answer+=n;return}t.answer=a?n:void 0}).addCase(oa,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=tg([...t.citations,...r.citations]),delete t.error}).addCase(aa,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===mh},t.citations=[],delete t.answer}).addCase(Ud,t=>{t.liked=!0,t.disliked=!1}).addCase(Qd,t=>{t.liked=!1,t.disliked=!0}).addCase(Bd,t=>{t.feedbackModalOpen=!0}).addCase(Hd,t=>{t.feedbackModalOpen=!1}).addCase(Bi,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...fS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(en,(t,{payload:r})=>{t.isLoading=r}).addCase(ra,(t,{payload:r})=>{t.isStreaming=r}).addCase(ia,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(zd,(t,{payload:r})=>{t.responseFormat=r}).addCase(Yd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Yc,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Wc,t=>{t.expanded=!0}).addCase(Gd,t=>{t.expanded=!1}).addCase(Wd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(sa,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(gS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Li,(t,{payload:r})=>{t.answerId=r}).addCase(Ui,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(Kd,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Xd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}).addCase(Zd,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a}=r,i=t.generationSteps.findLast(p=>p.status==="active");i&&(i.toolCalls=i.toolCalls||[],i.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:a,status:"active"}))}).addCase(Gi,(t,{payload:r})=>{let{toolCallId:n,args:o,type:a}=r,p=t.generationSteps.findLast(f=>f.status==="active")?.toolCalls?.find(f=>f.toolCallId===n);p&&(p.toolCallArgs=o,p.type=a==="search"?"search":"generic")}).addCase(Jd,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o}=r,i=t.generationSteps.findLast(p=>p.status==="active")?.toolCalls?.find(p=>p.toolCallId===n);i&&(i.finishedAt=o,i.status="completed")}));d();c();l();u();function rg(e,t,r={}){if(!QB(e))throw ae;let{dispatch:n}=e,o=he(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Vi(i));let p=r.initialState?.isEnabled;p!==void 0&&n(Qi(p));let f=r.initialState?.responseFormat;f&&n(zd(f));let m=r.fieldsToIncludeInCitations;return m&&n(Yd(m)),r.initialState?.expanded&&n(Wc()),{...o,get state(){let A=a().generatedAnswer;return{...A,error:Df(A.error)}},like(){this.state.liked||(n(Ud()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Qd()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Bd())},closeFeedbackModal(){n(Hd())},sendFeedback(A){n(t.logGeneratedAnswerFeedback(A)),n(Bi())},logCitationClick(A,x){n(t.logOpenGeneratedAnswerSource(A,x))},logCitationHover(A,x,h){n(t.logHoverCitation(A,x,h))},show(){this.state.isVisible||(n(Vi(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Vi(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Wc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Gd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Qi(!0))},disable(){this.state.isEnabled&&n(Qi(!1))},logCopyToClipboard(A){n(t.logCopyGeneratedAnswer(A))},retry(){}}}function QB(e){return e.addReducers({generatedAnswer:ks}),!0}var Gt={engines:{},setAbortControllerRef:(e,t)=>{Gt.engines[t].abortController=e},getIsStreamInProgress:e=>!Gt.engines[e].abortController||Gt.engines[e].abortController?.signal.aborted?(Gt.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,a=r.generatedAnswer.id;if(Gt.engines[a].lastRequestId!==n){if(Gt.engines[a].lastRequestId=n,Gt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Gt.getIsStreamInProgress(a)&&o&&o!==Gt.engines[a].lastStreamId){if(Gt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Jw({setAbortControllerRef:p=>Gt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function ET(e,t,r={}){if(!BB(e))throw ae;let n=rg(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Gt.engines[e.state.generatedAnswer.id]&&(Gt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let i=Mu("genQA-",12);e.dispatch($d({id:i}))}Gt.engines[e.state.generatedAnswer.id]||(Gt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Gt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(_e({legacy:t.logRetryGeneratedAnswer()}))}}}function BB(e){return e.addReducers({generatedAnswer:ks}),!0}d();c();l();u();d();c();l();u();var FT=rp.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var ng=e=>e==="yes"?!0:e==="no"?!1:null,GB=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:ng(t.correctTopic),documented:ng(t.documented),hallucinationFree:ng(t.hallucinationFree),readable:ng(t.readable)},helpful:t.helpful,question:r}),$B=e=>{let t="",r=()=>{let n=e.state,o=Mw(n),a=o.requestId;if(a!==t){if(t=a,e.dispatch(lr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Ui("automatic")),e.dispatch(ep()))}};e.subscribe(r)};function TT(e,t,r={}){if(!HB(e))throw ae;qf(e.state.configuration.analytics.analyticsMode);let{...n}=rg(e,t,r),o=()=>e.state;return e.dispatch(Wd(r.answerConfigurationId)),$B(e),{...n,get state(){let a=hS(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:tg(a?.citations??[]),error:Df({message:a?.error?.message,code:a?.error?.code}),isLoading:a?.isLoading??!1,isStreaming:a?.isStreaming??!1,answerContentFormat:a?.contentFormat??"text/plain",isAnswerGenerated:a?.generated??!1,cannotAnswer:i.cannotAnswer||a?.generated===!1&&!a?.isLoading&&!a?.isStreaming}},retry(){let a=qd(o());e.dispatch(tp(a??ea))},reset(){e.dispatch(lr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=GB({query:o().query.q,feedback:a,answerApiState:hS(e.state).data});e.dispatch(FT.endpoints.post.initiate(i)),e.dispatch(Bi())})()}}}function HB(e){return e.addReducers({[ca.reducerPath]:ca.reducer,query:Po}),!0}function PT(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?TT(e,wi,t):ET(e,wi,t);return{...n,get state(){return n.state},retry(){r(xe({legacy:wi.logRetryGeneratedAnswer(),next:Ax()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function Cn(e,t,r){if(!zB(e))throw ae;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Uu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function zB(e){return e.addReducers({configuration:we}),!0}function kT(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return Cn(e,r,()=>{o()})}function OT(e,t){return kT(e,{logCitationOpen:r=>Fy(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var XB=new ne({min:1,default:8,required:!1}),ZB=new ne({min:1,max:20,default:5,required:!1}),JB={desiredCount:ZB,numberOfValues:XB},xHe=P("automaticFacet/setOptions",e=>_(e,JB)),wHe=P("automaticFacet/deselectAll",e=>_(e,ye)),e1=H,_T=P("automaticFacet/toggleSelectValue",e=>_(e,{field:e1,selection:new Y({values:_a})}));var _s=fe(Yr(),e=>{e.addCase(yd,(t,r)=>{let n=Ev(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Iu(n,o)}).addCase(Sd,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(_t,t=>{t.firstResult=0}).addCase(vd,(t,r)=>{let n=r.payload;t.firstResult=Iu(n,t.numberOfResults)}).addCase(no,(t,r)=>{let n=r.payload;t.firstResult=Iu(n,t.numberOfResults)}).addCase(Cd,t=>{let r=Ev(t),n=Math.max(r-1,1);t.firstResult=Iu(n,t.numberOfResults)}).addCase(Ad,t=>{let r=Ev(t),n=t1(t),o=Math.min(r+1,n);t.firstResult=Iu(o,t.numberOfResults)}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(ot,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(_e.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Zr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(vt,t=>{$t(t)}).addCase(gn,t=>{$t(t)}).addCase(wo,t=>{$t(t)}).addCase(An,t=>{$t(t)}).addCase(em,t=>{$t(t)}).addCase(xo,t=>{$t(t)}).addCase(bo,t=>{$t(t)}).addCase(ms,t=>{$t(t)}).addCase(Bf,t=>{$t(t)}).addCase(mn,t=>{$t(t)}).addCase(vn,t=>{$t(t)}).addCase(Jt,t=>{$t(t)}).addCase(Qn,t=>{$t(t)}).addCase(Bn,t=>{$t(t)}).addCase(Jf,t=>{$t(t)}).addCase(_T,t=>{$t(t)})});function $t(e){e.firstResult=Yr().firstResult}function Ev(e){let{firstResult:t,numberOfResults:r}=e;return Fv(t,r)}function t1(e){let{totalCountFiltered:t,numberOfResults:r}=e;return Tv(t,r)}function Iu(e,t){return(e-1)*t}function Fv(e,t){return Math.round(e/t)+1}function Tv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function r1(e){return e.pagination.firstResult}function NT(e){return e.pagination.numberOfResults}function n1(e){return e.pagination.totalCountFiltered}var Oo=e=>{let t=r1(e),r=NT(e);return Fv(t,r)},Pv=e=>{let t=n1(e),r=NT(e);return Tv(t,r)},DT=(e,t)=>{let r=Oo(e),n=Pv(e),o=o1(r,t);return o=a1(o),o=i1(o,n),s1(o)};function o1(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,a=e-n,i=e+o;return{start:a,end:i}}function a1(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function i1(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function s1(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var kv=()=>Fe("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Yr().numberOfResults}));var Ns=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var og=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Oo(t),...ee(t.insightCaseContext)})),ag=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Oo(t),...ee(t.insightCaseContext)})),ig=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Oo(t),...ee(t.insightCaseContext)}));d();c();l();u();var c1=new Oe({numberOfPages:new ne({default:5,min:0})}),u1=new Oe({page:new ne({min:1})});function qT(e,t={}){if(!l1(e))throw ae;let r=he(e),{dispatch:n}=e,o=ht(e,c1,t.options,"buildPager"),i=gr(e,u1,t.initialState,"buildPager").page;i&&n(vd(i));let p=()=>Oo(e.state),f=()=>{let{numberOfPages:g}=o;return DT(e.state,g)},m=()=>Pv(e.state);return{...r,get state(){let g=p(),A=m(),x=g>1&&A>0,h=g<A;return{currentPage:g,currentPages:f(),maxPage:A,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(no(g))},nextPage(){n(Ad())},previousPage(){n(Cd())},isCurrentPage(g){return g===this.state.currentPage}}}function l1(e){return e.addReducers({configuration:we,pagination:_s}),!0}function MT(e,t={}){let{dispatch:r}=e,n=qT(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(ld({legacy:og(),next:Ns()}))},nextPage(){n.nextPage(),r(ld({legacy:ag(),next:Ns()}))},previousPage(){n.previousPage(),r(ld({legacy:ig(),next:Ns()}))}}}d();c();l();u();d();c();l();u();function jT(e){if(!d1(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function d1(e){return e.addReducers({search:Ee}),!0}function VT(e){return jT(e)}d();c();l();u();d();c();l();u();function LT(e){if(!p1(e))throw ae;let t=he(e),r=Ps(e),n=()=>e.state,o=()=>{let a=n().search.duration/1e3;return Math.round((a+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function p1(e){return e.addReducers({search:Ee,pagination:_s}),!0}function UT(e){return LT(e)}d();c();l();u();d();c();l();u();function QT(_x235,_x236){return _QT.apply(this,arguments)}function _QT(){_QT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:a}=e.insightConfiguration,i=e.query?.q||"";return{url:Sh({url:mt(n,o),accessToken:r,organizationId:n,insightId:a}),accessToken:r,organizationId:n,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0}});return _QT.apply(this,arguments)}d();c();l();u();var BT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Xe(e,r),o=Ze(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{action:"preview",itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:qr(t)}}});d();c();l();u();function GT(e,t,r,n,o){if(!f1(e))throw ae;let{dispatch:a}=e,i=()=>e.state,p=he(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=i().resultPreview;return x[h]},A=x=>{a(Id({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Uc({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){A(f.uniqueId)},next(){a(wd()),A(g())},previous(){a(Rd()),A(g())},get state(){let x=i(),h=f.hasHtmlVersion,y=x.resultPreview,b=f.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,I=y.contentURL,F=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:I,currentResultUniqueId:F}}}}function f1(e){return e.addReducers({configuration:we,resultPreview:_i}),!0}function $T(e,t){if(!m1(e))throw ae;let r=()=>{e.dispatch(BT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return GT(e,o,(a,i)=>QT(a,i),n,r)}function m1(e){return e.addReducers({configuration:we,resultPreview:_i,insightInterface:eo}),!0}d();c();l();u();d();c();l();u();var HT=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(ee(t.insightCaseContext))),zT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var g1={queries:new oe({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},Eu=P("recentQueries/registerRecentQueries",e=>_(e,g1)),sg=P("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function WT(){return{queries:[],maxLength:10}}var YT=fe(WT(),e=>{e.addCase(Eu,h1).addCase(sg,y1).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||S1(n,t)})});function h1(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function y1(e){e.queries=[]}function S1(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var v1={queries:[]},A1={maxLength:10,clearFilters:!0},C1=new Oe({queries:new oe({required:!0})}),b1=new Oe({maxLength:new ne({required:!0,min:1}),clearFilters:new pe});function x1(e,t){ht(e,b1,t?.options,"buildRecentQueriesList"),gr(e,C1,t?.initialState,"buildRecentQueriesList")}function KT(e,t){if(!w1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a={...A1,...t?.options},i={...v1,...t?.initialState};x1(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(Eu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(sg())},updateRecentQueries(f){let m=new oe({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Eu({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new ne({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={q:this.state.queries[f],clearFilters:a.clearFilters};qu(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(ki(g))}}}function w1(e){return e.addReducers({search:Ee,recentQueries:YT,query:Po}),!0}function XT(e,t){let r=KT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(HT()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(xe({legacy:zT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var R1={results:new oe({required:!0,each:new Y({values:Hl})}),maxLength:new ne({required:!0,min:1,default:10})},cg=P("recentResults/registerRecentResults",e=>_(e,R1)),bn=P("recentResults/pushRecentResult",e=>(Ot(e),{payload:e})),ug=P("recentResults/clearRecentResults");d();c();l();u();var ZT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logDocumentOpen(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:qr(t)}}});function JT(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(ZT(t.options.result)))};return Cn(e,t,()=>{n(),e.dispatch(bn(t.options.result))})}d();c();l();u();function eP(e,t){return eg(e,{...t,fetchMoreResultsActionCreator:dd})}d();c();l();u();d();c();l();u();var I1=new Oe({numberOfResults:new ne({min:0})});function tP(e,t={}){if(!E1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=gr(e,I1,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(yd(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Sd(p))},isSetTo(p){return p===this.state.numberOfResults}}}function E1(e){return e.addReducers({pagination:_s,configuration:we}),!0}function rP(e,t={}){let r=tP(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(xe({legacy:kv(),next:Ns()}))}}}d();c();l();u();d();c();l();u();var Ov=()=>Fe("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),lg=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var dg=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var nP={id:H,query:Ke},Ds=P("querySet/register",e=>_(e,nP)),Ma=P("querySet/update",e=>_(e,nP));d();c();l();u();var qs=fe(ad(),e=>{e.addCase(Ds,(t,r)=>T1(t,r.payload)).addCase(Ma,(t,r)=>{let{id:n,query:o}=r.payload;_v(t,n,o)}).addCase(Fo,(t,r)=>{let{id:n,expression:o}=r.payload;_v(t,n,o)}).addCase(_e.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;oP(t,n)}).addCase(ot,F1).addCase(tt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))_v(t,n,o)})});function F1(e,t){J(t.payload.q)||oP(e,t.payload.q)}function oP(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var _v=(e,t,r)=>{t in e&&(e[t]=r)},T1=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var aP=e=>Fe("analytics/querySuggest",(t,r)=>{let n=P1(r,e);return t.makeOmniboxAnalytics(n)}),iP=()=>({actionCause:"omniboxAnalytics"});function P1(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:a,querySuggestResponseId:f}}d();c();l();u();d();c();l();u();function sP(e,t){let r=t.id;r in e||(e[r]=k1(t))}function cP(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function uP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function lP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function k1(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var dP=()=>({});var pg=fe(dP(),e=>e.addCase(Eo,(t,r)=>{sP(t,r.payload)}).addCase(bT,(t,r)=>{delete t[r.payload.id]}).addCase(Fs.pending,cP).addCase(Fs.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(Fs.rejected,uP).addCase(To,(t,r)=>{lP(t,r.payload)}).addCase(Ni,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var pP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},Nv={open:new $,close:new $},O1={id:H,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new pe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:Nv}),exactMatchDelimiters:new Y({values:Nv}),correctionDelimiters:new Y({values:Nv})}}),clearFilters:new pe},fP=new Oe(O1);function mP(e,t){if(!N1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||Mu("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...pP,...t.options};ht(e,fP,i,"buildSearchBox"),n(Ds({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(Eo({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Wt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:A}=i;n(ki({q:p(),enableQuerySyntax:g,clearFilters:A})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x237){return _ref99.apply(this,arguments)}}();return{...r,updateText(m){n(Ma({id:a,query:m})),this.showSuggestions()},clear(){n(Ma({id:a,query:""})),n(To({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Fo({id:a,expression:m})),f({legacy:aP({id:a,suggestion:m}),next:iP()}).then(()=>{n(To({id:a}))})},submit(m=Ov(),g){f({legacy:m,next:g}),n(To({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],A=_1(g,i.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:A,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function _1(e,t){return e?e.completions.map(r=>({highlightedValue:zg(r.highlighted,t),rawValue:r.expression})):[]}function N1(e){return e.addReducers({query:Po,querySuggest:pg,configuration:we,querySet:qs,search:Ee}),!0}function gP(e,t={}){let r=mP(e,{...t,executeSearchActionCreator:xe,fetchQuerySuggestionsActionCreator:pd,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(dg(),lg())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var fg=()=>({actionCause:"resultsSort"});function hP(e,t){return e.q!==t.q?lg():e.sortCriteria!==t.sortCriteria?fg():Ms(e.f,t.f)?js(e.f,t.f):Ms(e.fExcluded,t.fExcluded)?js(e.fExcluded,t.fExcluded,!0):Ms(e.cf,t.cf)?js(e.cf,t.cf):Ms(e.af,t.af)?js(e.af,t.af):Ms(e.nf,t.nf)?js(mg(e.nf),mg(t.nf)):Ms(e.df,t.df)?js(mg(e.df),mg(t.df)):Ai()}function Ms(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function js(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?ar():Ln()}if(o.filter(x=>!n.includes(x)).length)return r?Xf():pr();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return Ai();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?Xf():pr():f.filter(x=>!m.includes(x)).length?Ln():Ai()}function mg(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var Vs=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...ee(t.insightCaseContext)}));function vP(e,t){return e.q!==t.q?dg():e.sortCriteria!==t.sortCriteria?Vs():Fu(e.f,t.f)?Fu(e.cf,t.cf)?Fu(e.nf,t.nf)?Fu(e.df,t.df)?Fu(e.fExcluded,t.fExcluded)?ro():D1(e.fExcluded,t.fExcluded):SP(e.df,t.df):SP(e.nf,t.nf):gg(e.cf,t.cf):gg(e.f,t.f)}function Fu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function yP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function gg(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?Qt(x):(r?vs:jr)({facetId:x,facetValue:e[x][0]})}let i=o.filter(x=>!n.includes(x));if(i.length){let x=i[0];return Yt({facetId:x,facetValue:t[x][0]})}let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return ro();let f=e[p],m=t[p],g=m.filter(x=>!f.includes(x));if(g.length)return Yt({facetId:p,facetValue:g[0]});let A=f.filter(x=>!m.includes(x));return A.length?(r?vs:jr)({facetId:p,facetValue:A[0]}):ro()}function SP(e={},t={}){return gg(yP(e),yP(t))}function D1(e={},t={}){return gg(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:q1,getOwnPropertySymbols:M1}=Object,{hasOwnProperty:j1}=Object.prototype;function Dv(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function hg(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:a}=o,i=a.get(r),p=a.get(n);if(i&&p)return i===n&&p===r;a.set(r,n),a.set(n,r);let f=e(r,n,o);return a.delete(r),a.delete(n),f}}function AP(e){return q1(e).concat(M1(e))}var V1=Object.hasOwn||((e,t)=>j1.call(e,t)),L1="__v",U1="__o",Q1="_owner",{getOwnPropertyDescriptor:CP,keys:bP}=Object,ja=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function B1(e,t){return e===t}function G1(e,t){return e.byteLength===t.byteLength&&yg(new Uint8Array(e),new Uint8Array(t))}function $1(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function H1(e,t){return e.byteLength===t.byteLength&&yg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function z1(e,t){return ja(e.getTime(),t.getTime())}function W1(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function xP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.entries(),i,p,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=!1,A=0;for(;(p=m.next())&&!p.done;){if(o[A]){A++;continue}let x=i.value,h=p.value;if(r.equals(x[0],h[0],f,A,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[A]=!0;break}A++}if(!g)return!1;f++}return!0}function Y1(e,t,r){let n=bP(e),o=n.length;if(bP(t).length!==o)return!1;for(;o-->0;)if(!RP(e,t,r,n[o]))return!1;return!0}function Tu(e,t,r){let n=AP(e),o=n.length;if(AP(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!RP(e,t,r,a)||(i=CP(e,a),p=CP(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function K1(e,t){return ja(e.valueOf(),t.valueOf())}function X1(e,t){return e.source===t.source&&e.flags===t.flags}function wP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let f=t.values(),m=!1,g=0;for(;(p=f.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){m=o[g]=!0;break}g++}if(!m)return!1}return!0}function yg(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function Z1(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function RP(e,t,r,n){return(n===Q1||n===U1||n===L1)&&(e.$$typeof||t.$$typeof)?!0:V1(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var J1=Object.prototype.toString;function eG(e){let t=oG(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,y){if(x===h)return!0;if(x==null||h==null)return!1;let b=typeof x;if(b!==typeof h)return!1;if(b!=="object")return b==="number"||b==="bigint"?i(x,h,y):b==="function"?o(x,h,y):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,y);if(w===Array)return r(x,h,y);if(w===Date)return n(x,h,y);if(w===RegExp)return f(x,h,y);if(w===Map)return a(x,h,y);if(w===Set)return m(x,h,y);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,y);let I=J1.call(x),F=t[I];if(F)return F(x,h,y);let E=g&&g(x,h,y,I);return E?E(x,h,y):!1}}function tG({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:G1,areArraysEqual:r?Tu:$1,areDataViewsEqual:H1,areDatesEqual:z1,areErrorsEqual:W1,areFunctionsEqual:B1,areMapsEqual:r?Dv(xP,Tu):xP,areNumbersEqual:ja,areObjectsEqual:r?Tu:Y1,arePrimitiveWrappersEqual:K1,areRegExpsEqual:X1,areSetsEqual:r?Dv(wP,Tu):wP,areTypedArraysEqual:r?Dv(yg,Tu):yg,areUrlsEqual:Z1,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=hg(n.areArraysEqual),a=hg(n.areMapsEqual),i=hg(n.areObjectsEqual),p=hg(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:i,areSetsEqual:p})}return n}function rG(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function nG({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(p,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(p,f){return t(p,f,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let a={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,f){return t(p,f,a)}}function oG({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:A,areTypedArraysEqual:x,areUrlsEqual:h}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":p,"[object BigInt64Array]":x,"[object BigUint64Array]":x,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":x,"[object Float32Array]":x,"[object Float64Array]":x,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":x,"[object Int16Array]":x,"[object Int32Array]":x,"[object Map]":i,"[object Number]":m,"[object Object]":(y,b,w)=>typeof y.then!="function"&&typeof b.then!="function"&&f(y,b,w),"[object RegExp]":g,"[object Set]":A,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var qv=xn(),L6e=xn({strict:!0}),U6e=xn({circular:!0}),Q6e=xn({circular:!0,strict:!0}),B6e=xn({createInternalComparator:()=>ja}),G6e=xn({strict:!0,createInternalComparator:()=>ja}),$6e=xn({circular:!0,createInternalComparator:()=>ja}),H6e=xn({circular:!0,createInternalComparator:()=>ja,strict:!0});function xn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=tG(e),i=eG(a),p=r?r(i):rG(i);return nG({circular:t,comparator:i,createState:n,equals:p,strict:o})}function IP(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function aG(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Mv(r,n))!==-1)}var Mv=xn({createCustomConfig:e=>({...e,areArraysEqual:aG})});d();c();l();u();d();c();l();u();function EP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function FP(e,t,r){if(e===void 0)return{};let n=t(e);return!qv(n,r)?{sortCriteria:n}:{}}function Sg(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let p=r(i);return p.length?{[a]:p}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}function TP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function PP(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??kn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??kn().defaultFilters.cq,firstResult:Yr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Yr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:nd(),sf:{},tab:"",af:{},mnf:{}}}var iG=new Oe({parameters:new Y({options:{required:!0},values:np})});function _P(e,t){let{dispatch:r}=e,n=he(e);gr(e,iG,t.initialState,"buildSearchParameterManager");let o=kP(e.state.tabSet,t.initialState.parameters);return r(ot(o)),{...n,synchronize(a){let i=kP(e.state.tabSet,vg(e,a));r(ot(i))},get state(){return{parameters:jv(e)}}}}function vg(e,t){let n={...PP(e.state),...t},o={};if(e.state.dateFacetSet)for(let i of Object.keys(e.state.dateFacetSet))o[i]=[];let a={};if(e.state.numericFacetSet)for(let i of Object.keys(e.state.numericFacetSet))a[i]=[];return{...n,df:{...o,...n.df},nf:{...a,...n.nf}}}function kP(e,t){if(J(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:OP(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??OP(e)}}return t}function OP(e){return Object.keys(e)[0]??""}function jv(e){let t=e.state;return{...EP(t.query,r=>r.q,ut().q),...TP(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...FP(t.sortCriteria,r=>r,ur()),...cG(t),...uG(t),...lG(t),...dG(t),...pG(t)}}function sG(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function Ag(e){let t=sG(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=or(n?.tabs,t);return o&&a}}function NP(e){return e.currentValues.filter(t=>t.state==="selected")}function cG(e){let t=e.facetSet;if(t===void 0)return{};let r=Ag(e),n={},o={};for(let[a,{request:i}]of Object.entries(t)){if(!r(a))continue;let p=i.currentValues.filter(m=>m.state==="selected").map(m=>m.value),f=i.currentValues.filter(m=>m.state==="excluded").map(m=>m.value);p.length&&(n[a]=p),f.length&&(o[a]=f)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function uG(e){return Sg(e.categoryFacetSet,Ag(e),t=>$r(t.currentValues).map(r=>r.value),"cf")}function lG(e){return Sg(e.numericFacetSet,Ag(e),NP,"nf")}function dG(e){return Sg(e.dateFacetSet,Ag(e),NP,"df")}function pG(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=fG(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function fG(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function DP(e,t){let{dispatch:r}=e,n=_P(e,t);return{...n,synchronize(o){let a=jv(e),i=vg(e,a),p=vg(e,o);Mv(i,p)||(n.synchronize(o),r(xe({legacy:vP(i,p),next:hP(i,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Pu=()=>new Y({values:{questionAnswerId:H},options:{required:!0}}),Cg=()=>new Y({values:{linkText:Ke,linkURL:Ke},options:{required:!0}});function Va(e){return _(e,Pu())}d();c();l();u();function ft(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&nw(e,r.contentIdKey,r.contentIdValue)}function Rr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var qP={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var mG=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),gG=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),hG=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),yG=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),SG=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ft(t);return e.logOpenSmartSnippetSource(Xe(r,t),Ze(r),ee(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),Vv=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,Cg());let n=ft(r);return t.logOpenSmartSnippetInlineLink(Xe(n,r),{...Ze(n),...e},ee(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),vG=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(ee(t.insightCaseContext))),AG=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(ee(t.insightCaseContext))),CG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:qP[e]}}}),bG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),xG=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Va(e);let n=Rr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),wG=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Va(e);let n=Rr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),Lv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,Pu());let n=Rr(r,e.questionAnswerId);if(!n)return null;let o=ft(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Xe(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),MP=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,Pu()),_(t,Cg());let o=Rr(n,e.questionAnswerId);if(!o)return null;let a=ft(n,o.documentId);return a?r.logOpenSmartSnippetSuggestionInlineLink(Xe(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},ee(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Rr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ft(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),bg={logExpandSmartSnippet:mG,logCollapseSmartSnippet:gG,logLikeSmartSnippet:hG,logDislikeSmartSnippet:yG,logOpenSmartSnippetSource:SG,logOpenSmartSnippetInlineLink:Vv,logOpenSmartSnippetFeedbackModal:vG,logCloseSmartSnippetFeedbackModal:AG,logSmartSnippetFeedback:CG,logSmartSnippetDetailedFeedback:bG,logExpandSmartSnippetSuggestion:xG,logCollapseSmartSnippetSuggestion:wG,logOpenSmartSnippetSuggestionSource:Lv};d();c();l();u();d();c();l();u();var Ls=P("smartSnippet/expand"),Us=P("smartSnippet/collapse"),Qs=P("smartSnippet/like"),Bs=P("smartSnippet/dislike"),Gs=P("smartSnippet/feedbackModal/open"),_o=P("smartSnippet/feedbackModal/close"),$s=P("smartSnippet/related/expand",e=>Va(e)),Hs=P("smartSnippet/related/collapse",e=>Va(e));d();c();l();u();d();c();l();u();var Uv=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var jP=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function VP({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return za({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function RG(e,t){let r=VP(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var wn=fe(Uv(),e=>e.addCase(Ls,t=>{t.expanded=!0}).addCase(Us,t=>{t.expanded=!1}).addCase(Qs,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Bs,t=>{t.liked=!1,t.disliked=!0}).addCase(Gs,t=>{t.feedbackModalOpen=!0}).addCase(_o,t=>{t.feedbackModalOpen=!1}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>RG(a,t.relatedQuestions[i])),o=VP(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...Uv(),relatedQuestions:n,questionAnswerId:o}}).addCase($s,(t,r)=>{let n=jP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Hs,(t,r)=>{let n=jP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function LP(e,t,r){if(!IG(e))throw ae;let n=he(e),o=()=>e.state,a=()=>ft(o()),i=null,p=Cn(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let f=a();if(!f){i=null;return}let{searchResponseId:m}=o().search;i!==m&&(i=m,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(bn(f)))});return{...n,get state(){let f=o();return{question:f.search.questionAnswer.question,answer:f.search.questionAnswer.answerSnippet,documentId:f.search.questionAnswer.documentId,expanded:f.questionAnswering.expanded,answerFound:f.search.questionAnswer.answerSnippet!=="",liked:f.questionAnswering.liked,disliked:f.questionAnswering.disliked,feedbackModalOpen:f.questionAnswering.feedbackModalOpen,source:a()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Ls())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Us())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Qs())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Bs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Gs())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(_o())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(_o())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(_o())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function IG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}d();c();l();u();function xg(e,t){if(!EG(e))throw ae;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),a=null,i=g=>{a!==g&&(a=g,f={},n.clear())},p=(g,A,x)=>Cn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(A)||e.dispatch(x?MP({questionAnswerId:x},g):Vv(g))}),f={},m=(g,A)=>{let{searchResponseId:x}=r().search;i(x);let h=za({...g,questionAnswerId:A});return h in f||(f[h]=p(g,h,A)),f[h]};return{selectInlineLink(g,A){m(g,A)?.select()},beginDelayedSelectInlineLink(g,A){m(g,A)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,A){m(g,A)?.cancelPendingSelect()}}}function EG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}function UP(e,t){let r=LP(e,bg,t),n=xg(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function QP(e,t){if(!FG(e))throw ae;let r=he(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>lo(f,i)===p)};return{...r,get state(){let a=n();return{questions:a.search.questionAnswer.relatedQuestions.map((i,p)=>({question:i.question,answer:i.answerSnippet,documentId:i.documentId,questionAnswerId:a.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:a.questionAnswering.relatedQuestions[p].expanded,source:o(i.documentId)}))}},expand(a){let i={questionAnswerId:a};e.dispatch(t.logExpandSmartSnippetSuggestion(i)),e.dispatch($s(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(Hs(i))}}}function FG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}d();c();l();u();function BP(e,t){if(!TG(e))throw ae;let r=()=>e.state,n=A=>{let x=r(),h=Rr(x,A);return h?ft(x,h.documentId):null},o=new Set,a=A=>o.has(A)?!0:(o.add(A),!1),i=null,p=A=>{i!==A&&(i=A,m={},o.clear())},f=(A,x)=>Cn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(x)||(e.dispatch(Lv({questionAnswerId:x})),e.dispatch(bn(A)))}),m={},g=A=>{let{searchResponseId:x}=r().search;p(x);let h=n(A);return h?(A in m||(m[A]=f(h,A)),m[A]):null};return{selectSource(A){g(A)?.select()},beginDelayedSelectSource(A){g(A)?.beginDelayedSelect()},cancelPendingSelectSource(A){g(A)?.cancelPendingSelect()}}}function TG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}function GP(e,t){let r=QP(e,bg),n=xg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=BP(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(a){o.selectSource(a)},beginDelayedSelectSource(a){o.beginDelayedSelectSource(a)},cancelPendingSelectSource(a){o.cancelPendingSelectSource(a)},selectInlineLink(a,i){n.selectInlineLink(i,a)},beginDelayedSelectInlineLink(a,i){n.beginDelayedSelectInlineLink(i,a)},cancelPendingSelectInlineLink(a,i){n.cancelPendingSelectInlineLink(i,a)}}}d();c();l();u();d();c();l();u();d();c();l();u();var $P={by:new ec({enum:Ql,required:!0})},wg=P("sortCriteria/register",e=>HP(e)),Rg=P("sortCriteria/update",e=>HP(e)),HP=e=>Ha(e)?(e.forEach(t=>_(t,$P)),{payload:e}):_(e,$P);d();c();l();u();var zP=fe(ur(),e=>{e.addCase(wg,(t,r)=>Hr(r.payload)).addCase(Rg,(t,r)=>Hr(r.payload)).addCase(tt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(ot,(t,r)=>r.payload.sortCriteria??t)});function PG(e,t){if(!t)return;let r=new Oe({criterion:new oe({each:Yb})}),n=kG(t),o={...t,criterion:n};gr(e,r,o,"buildSort")}function kG(e){return e.criterion?Ha(e.criterion)?e.criterion:[e.criterion]:[]}function WP(e,t){if(!OG(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state;PG(e,t.initialState);let a=t.initialState?.criterion;return a&&n(wg(a)),{...r,sortBy(i){n(Rg(i)),n(no(1))},isSortedBy(i){return this.state.sortCriteria===Hr(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function OG(e){return e.addReducers({configuration:we,sortCriteria:zP}),!0}function YP(e,t={}){let{dispatch:r}=e,n=WP(e,t),o=()=>r(xe({legacy:Vs(),next:fg()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();function KP(e){return Ps(e)}d();c();l();u();d();c();l();u();var _G=new Oe({expression:Ke,id:H,clearFiltersOnTabChange:new pe}),NG=new Oe({isActive:new pe});function XP(e,t){if(qG(t.options.id),!DG(e))throw ae;let r=he(e),{dispatch:n}=e;ht(e,_G,t.options,"buildTab");let o=gr(e,NG,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(ap({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(_t(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(ki({q:"",clearFilters:!0})),n(_t(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function DG(e){return e.addReducers({configuration:we,tabSet:wm}),!0}function qG(e){let t=sp().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function ZP(e,t){let{dispatch:r}=e,n=XP(e,t),o=()=>r(xe({legacy:ro(),next:Ai()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var JP=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},ee(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function ek(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function tk(e,t){let r=[],n=[],o=[],a=[];return t.forEach(i=>{switch(i.type){case"redirect":r.push(i.content);break;case"query":n.push(i.content);break;case"execute":o.push({functionName:i.content.name,params:i.content.params});break;case"notify":a.push(i.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=a,e}function rk(e,t){return e.queryModification={...t,queryToIgnore:""},e}function nk(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var ok=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var ak=fe(ok(),e=>e.addCase(_e.pending,ek).addCase(_e.fulfilled,(t,r)=>tk(t,r.payload.response.triggers)).addCase(Pi,(t,r)=>rk(t,r.payload)).addCase(Ti,(t,r)=>nk(t,r.payload)));function ik(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!MG(e))throw ae;let n=he(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!IP(i,this.state.notifications);i=this.state.notifications,m&&(p(),o(r()))};return f(),e.subscribe(f)},get state(){return{notifications:a().triggers.notifications}}}}function MG(e){return e.addReducers({triggers:ak}),!0}function sk(e){return ik(e,{options:{logNotifyTriggerActionCreator:JP}})}d();c();l();u();d();c();l();u();var ck=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=ee(n.insightCaseContext),a={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(a)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=ee(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),uk=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:H}),t.logCreateArticle(e,ee(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=ee(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Ig=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(ee(t.insightCaseContext))});d();c();l();u();d();c();l();u();var lk=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function lk(_x238,_x239){return _ref100.apply(this,arguments)}}();var jG={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new oe({required:!1,each:We})},zs=P("insight/userActions/registerUserActions",e=>_(e,jG)),No=me("insight/userActions/fetch",/*#__PURE__*/function(){var _ref101=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield n.userActions(yield lk(o,e));return ze(a)?r(a.error):{response:a.success}});return function(_x240,_x241){return _ref101.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function dk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var VG=1e3,LG=VG*60,Qv=30*LG,UG=2,QG=2,mk=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,a=GG(t);return HG(a,n,o)},BG=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},GG=e=>{let t=!1,r=e.reduce((n,o)=>{try{let a=BG(o);n.push(a)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},$G=(e,t)=>Math.abs(e.timestamp-t)<Qv,pk=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-Qv&&t<=e.end+Qv){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(a=>a.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},fk=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},HG=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(a=>{if($G(a,o.start)){o.actions.push(a),o.start=a.timestamp;return}o.actions=o.actions.filter(i=>!fk(i,r)),pk(o,t,n),o={start:a.timestamp,end:a.timestamp,actions:[a]}}),o.actions=o.actions.filter(a=>!fk(a,r)),pk(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,UG),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-QG)}};var Eg=fe(dk(),e=>{e.addCase(zs,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(No.pending,t=>{t.loading=!0,t.error=void 0}).addCase(No.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(No.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=mk(t,r.payload.response.value)})});function gk(e,t){if(!zG(e))throw ae;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=he(e),{ticketCreationDate:a,excludedCustomActions:i}=t.options;return r(zs({ticketCreationDate:a,excludedCustomActions:i})),{...o,get state(){return n()},fetchUserActions(p){r(No(p))},logOpenUserActions(){r(Ig())}}}function zG(e){return e.addReducers({configuration:we,insightUserActions:Eg}),!0}d();c();l();u();function hk(e){if(!WG(e))throw ae;let t=he(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(zr())}}}function WG(e){return e.addReducers({configuration:we,insightConfiguration:Xl,insightInterface:eo,searchHub:Fd}),!0}d();c();l();u();function YG(e){return e.addReducers({}),{logSearchEvent:lx,logClickEvent:dx,logCustomEvent:px}}d();c();l();u();d();c();l();u();var yk=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCopyToClipboard(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:qr(t)}}}),Sk=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCaseSendEmail(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:qr(t)}}}),vk=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logFeedItemTextPost(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:qr(t)}}});function KG(e){return e.addReducers({}),{logClearBreadcrumbs:rm,logInterfaceLoad:sd,logInterfaceChange:ro,logCreateArticle:uk,logCategoryFacetBreadcrumb:Qf,logFacetBreadcrumb:yu,logFacetClearAll:Qt,logFacetDeselect:jr,logFacetSelect:Yt,logFacetShowLess:Cs,logFacetShowMore:As,logFacetUpdateSort:pn,logDateFacetBreadcrumb:Su,logNumericFacetBreadcrumb:vu,logPageNext:ag,logPageNumber:og,logPagePrevious:ig,logResultsSort:Vs,logStaticFilterDeselect:Am,logCopyToClipboard:yk,logCaseSendEmail:Sk,logFeedItemTextPost:vk,logOpenUserActions:Ig}}d();c();l();u();function XG(e){return e.addReducers({attachedResults:Co}),{setAttachedResults:Vf,detachResult:Ao,attachResult:vo}}d();c();l();u();function ZG(e){return e.addReducers({attachedResults:Co}),{logCaseDetach:ls,logCaseAttach:us}}d();c();l();u();d();c();l();u();d();c();l();u();var Fg=P("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new oe({each:Ke}),a=_(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Tg=P("insight/caseId/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}}),Pg=P("insight/caseNumber/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}});var Ak=fe(vx(),e=>{e.addCase(Fg,(t,r)=>{t.caseContext=r.payload}).addCase(Tg,(t,r)=>{t.caseId=r.payload}).addCase(Pg,(t,r)=>{t.caseNumber=r.payload})});function JG(e){return e.addReducers({insightCaseContext:Ak}),{setCaseContext:Fg,setCaseId:Tg,setCaseNumber:Pg}}d();c();l();u();d();c();l();u();d();c();l();u();var e2=new oe({each:H,required:!0}),Ck=(e,t)=>(_(e,H),$a(t)?_(t,H):_(t,e2),{payload:{contextKey:e,contextValue:t}}),kg=P("context/set",e=>{for(let[t,r]of Object.entries(e))Ck(t,r);return{payload:e}}),Og=P("context/add",e=>Ck(e.contextKey,e.contextValue)),_g=P("context/remove",e=>_(e,H));var bk=fe(rd(),e=>{e.addCase(kg,(t,r)=>{t.contextValues=r.payload}).addCase(Og,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(_g,(t,r)=>{delete t.contextValues[r.payload]}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function t2(e){return e.addReducers({context:bk}),{addContext:Og,removeContext:_g,setContext:kg}}d();c();l();u();function r2(e){return e.addReducers({dateFacetSet:yn}),{deselectAllDateFacetValues:am,registerDateFacet:fn,toggleSelectDateFacetValue:mn,toggleExcludeDateFacetValue:gn,updateDateFacetSortCriterion:om,updateDateFacetValues:Qn}}d();c();l();u();function n2(e){return e.addReducers({numericFacetSet:Ro}),{deselectAllNumericFacetValues:Sm,registerNumericFacet:Sn,toggleSelectNumericFacetValue:vn,toggleExcludeNumericFacetValue:An,updateNumericFacetSortCriterion:ym,updateNumericFacetValues:Bn}}d();c();l();u();function o2(e){return e.addReducers({fields:Ts}),{registerFieldsToInclude:ko,enableFetchAllFields:Xm,disableFetchAllFields:Zm,fetchFieldsDescription:Jm}}d();c();l();u();function a2(e){return e.addReducers({folding:Km}),{registerFolding:ST,loadCollection:zm}}d();c();l();u();function i2(e){return e.addReducers({generatedAnswer:ks}),{generateAnswer:ep,resetAnswer:lr,setAnswerGenerationMode:Ui}}d();c();l();u();function s2(e){return e.addReducers({insightInterface:eo}),{fetch:zr}}d();c();l();u();function c2(e){return e.addReducers({querySet:qs}),{registerQuerySetQuery:Ds,updateQuerySetQuery:Ma}}d();c();l();u();function u2(e){return e.addReducers({search:Ee}),{executeSearch:Dx,fetchFacetValues:jx,fetchMoreResults:Mx,fetchPage:qx,fetchQuerySuggestions:pd,registerQuerySuggest:Eo}}d();c();l();u();function l2(e){return e.addReducers({}),{logContextChanged:kx,logExpandToFullUI:ck}}d();c();l();u();function d2(e){return e.addReducers({insightUserActions:Eg}),{registerUserActions:zs,fetchUserActions:No}}d();c();l();u();function p2(e){return e.addReducers({querySuggest:pg,querySet:qs}),{clearQuerySuggest:To,fetchQuerySuggestions:Fs,registerQuerySuggest:Eo,selectQuerySuggestion:Fo}}d();c();l();u();function f2(e){return e.addReducers({questionAnswering:wn}),{collapseSmartSnippet:Us,expandSmartSnippet:Ls,dislikeSmartSnippet:Bs,likeSmartSnippet:Qs,openFeedbackModal:Gs,closeFeedbackModal:_o,expandSmartSnippetRelatedQuestion:$s,collapseSmartSnippetRelatedQuestion:Hs}}d();c();l();u();d();c();l();u();d();c();l();u();function xk(){return{results:[],maxLength:10}}var wk=fe(xk(),e=>{e.addCase(cg,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(ug,t=>{t.results=[]}).addCase(bn,(t,r)=>{let n=r.payload;t.results=t.results.filter(a=>a.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function m2(e){return e.addReducers({recentResults:wk}),{registerRecentResults:cg,clearRecentResults:ug,pushRecentResult:bn}}d();c();l();u();d();c();l();u();var g2=new Oe({content:new He({required:!0}),conditions:new He({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new oe({required:!1,each:H})});function Rk(){let e=[],t=r=>{let n=g2.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Do("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(a=>a(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(a=>a(r)));return n?n.linkContent:null}}}function Ik(e){if(!h2(e))throw ae;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Rk();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(ko(a))},selectTemplate:r,selectLinkTemplate:n}}function h2(e){return e.addReducers({fields:Ts}),!0}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Mf(e){e==="next"&&console.warn(nQ)}d();c();l();u();var OE=Fr(kE(),1);function _E(e){return(0,OE.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function NE(e,t){let r=CQ(e),n=mr,o=bQ(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function CQ(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function bQ(e){return e.preprocessRequest||Ku}d();c();l();u();d();c();l();u();var DE={organizationId:H,accessToken:H,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new pe({required:!1}),originContext:new $({required:!1}),originLevel2:new $({required:!1}),originLevel3:new $({required:!1}),analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new $({required:!1,url:!0}),trackingId:new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new pe({required:!1})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function qE(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var ME=new Oe({...DE,insightId:H,search:new Y({options:{required:!1},values:{locale:We}})}),xQ="2729db39-d7fd-4504-a06e-668c64968c95";function mv(){return{...qE(),insightId:xQ}}var wQ={insightConfiguration:Jl,search:Ee,insightInterface:eo,searchHub:Pd,resultPreview:Oa};function RQ(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function jE(e){let t=_E(e.loggerOptions);IQ(e.configuration,t);let r=EQ(e.configuration,t),n=FQ(t),o={...NE(e.configuration,t),apiClient:r,streamingClient:n,generatedAnswerAnalyticsClient:xa},i={...e,reducers:wQ},a=bE(i,o);Mf(a.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,f=RQ(e.configuration);return a.dispatch(Zl({insightId:p})),a.dispatch(zr()),f&&a.dispatch(Ca(f)),{...a,get state(){return a.state},executeFirstSearch(m=ud()){Td(a.state)||a.dispatch(xe({legacy:m,next:px()}))}}}function IQ(e,t){try{ME.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function EQ(e,t){return new Xu({logger:t,preprocessRequest:e.preprocessRequest||Ku})}function FQ(e){return new Yu({logger:e})}d();c();l();u();function he(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),p=t!==a;return t=a,p}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),p;return n()&&(t=JSON.stringify(this.state),p=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(a,i),()=>{r.delete(a),n()&&p?.()}},get state(){return{}}}}d();c();l();u();d();c();l();u();var VE={articleLanguage:We,articlePublishStatus:We,articleVersionNumber:We,caseId:H,knowledgeArticleId:We,name:We,permanentId:We,resultUrl:We,source:We,title:H,uriHash:We,isAttachedFromCitation:new pe({required:!1,default:!1})},TQ=new Y({options:{required:!0},values:VE}),Lf=P("insight/attachToCase/setAttachedResults",e=>_(e,{results:new oe({each:TQ}),loading:new pe({required:!1,default:!1})})),vo=P("insight/attachToCase/attach",e=>LE(e)),Ao=P("insight/attachToCase/detach",e=>LE(e)),LE=e=>J(e.permanentId)&&J(e.uriHash)?{payload:e,error:Tr(new Do("Either permanentId or uriHash is required"))}:_(e,VE);d();c();l();u();d();c();l();u();var qr=e=>{let t=ee(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var cs=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCaseAttach(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:qr(t)}}}),us=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,ee(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:kr(e,t),context:qr(t)})});d();c();l();u();d();c();l();u();function UE(){return{results:[],loading:!1}}var Co=fe(UE(),e=>{e.addCase(Lf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(vo,(t,r)=>{(!J(r.payload.permanentId)||!J(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(Ao,(t,r)=>{t.results=t.results.filter(n=>PQ(n,r.payload))})}),PQ=(e,t)=>{let r=!J(e.permanentId)&&e?.permanentId===t?.permanentId,n=!J(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Uf=(e,t)=>$i(e.raw[t])?String(e.raw[t]):void 0,ls=(e,t)=>({articleLanguage:Uf(e,"sflanguage"),articleVersionNumber:Uf(e,"sflanguage"),articlePublishStatus:Uf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Uf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function QE(e,t){if(!kQ(e))throw ie;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=he(e),{result:i,caseId:a}=t.options,p=()=>J(a)||J(i.raw.permanentid)&&J(i.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=a===f.caseId,g=!J(f.permanentId)&&f.permanentId===i.raw.permanentid,A=!J(f.uriHash)&&f.uriHash===i.raw.urihash;return m&&(g||A)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(vo(ls(i,a))),r(cs(i))},detach(){r(Ao(ls(i,a))),r(us(i))}}}function kQ(e){return e.addReducers({configuration:we,attachedResults:Co}),!0}d();c();l();u();function BE(e,t){if(!OQ(e))throw ie;let{dispatch:r}=e,n=he(e),{caseId:o}=t.options,i=p=>J(o)||J(p.raw.permanentid)&&J(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,g=!J(f.permanentId)&&f.permanentId===p.raw.permanentid,A=!J(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(g||A)}),a=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:a(),loading:e.state.attachedResults.loading}},isAttached(p){return i(p)},attach(p){r(vo(ls(p,o))),r(cs(p))},detach(p){r(Ao(ls(p,o))),r(us(p))}}}function OQ(e){return e.addReducers({configuration:we,attachedResults:Co}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ye=H;d();c();l();u();var _Q={state:new He({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new oe({required:!0,each:H}),moreValuesAvailable:new pe({required:!1})};function gv(e){e.children.forEach(t=>{gv(t)}),mr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},_Q)}var ds={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),basePath:new oe({required:!1,each:H}),filterByBasePath:new pe({required:!1})};var ps=P("categoryFacet/register",e=>_(e,ds)),fs=P("categoryFacet/toggleSelectValue",e=>{try{return mr(e.facetId,H),gv(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),bo=P("categoryFacet/deselectAll",e=>_(e,ds.facetId)),pu=P("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:ds.facetId,numberOfValues:ds.numberOfValues})),Qf=P("categoryFacet/updateSortCriterion",e=>_(e,{facetId:ds.facetId,criterion:new He})),GE=P("categoryFacet/updateBasePath",e=>_(e,{facetId:ds.facetId,basePath:new oe({each:H})}));d();c();l();u();var JEe={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})};var $E=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var NQ={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})},DQ=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,i=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:i}},Bf=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,NQ);let n={...DQ(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Ge=P("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new pe({required:!1})})),nr=P("facetOptions/facet/enable",e=>_(e,ye)),pt=P("facetOptions/facet/disable",e=>_(e,ye));d();c();l();u();var or=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var fu={facetId:ye,captions:new Y({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var qQ={path:new oe({required:!0,each:H}),displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})},Gf=P("categoryFacet/selectSearchResult",e=>_(e,{facetId:ye,value:new Y({values:qQ})})),HE=P("categoryFacetSearch/register",e=>_(e,fu));d();c();l();u();function ms(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function gs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function $f(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function mu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Hf(e,t,r){e.currentValues=MQ(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function MQ(e,t){if(!e.length)return[];let r=zE(e[0],t),n=r;for(let o of e.splice(1)){let i=zE(o,t);n.children.push(i),n=i}return n.state="selected",n.retrieveChildren=!0,[r]}function zE(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var zf=fe(pa(),e=>{e.addCase(ps,(t,r)=>{let n=r.payload,{facetId:o,tabs:i}=n;if(o in t)return;let a=VQ(n),p=a.numberOfValues;t[o]={request:a,initialNumberOfValues:p,tabs:i}}).addCase(tt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(i=>{let a=t[i],p=a.request;if((a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,o)){p.currentValues.length&&Hf(p,[],a.initialNumberOfValues);return}let m=n[i]||[];(m.length||p.currentValues.length)&&Hf(p,m,a.initialNumberOfValues)})}).addCase(Qf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,i=t[n]?.request;i&&(i.sortCriteria=o)}).addCase(GE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,i=t[n]?.request;i&&(i.basePath=[...o])}).addCase(fs,(t,r)=>{let{facetId:n,selection:o,retrieveCount:i}=r.payload,a=t[n]?.request;if(!a)return;let{path:p}=o,f=p.slice(0,p.length-1),m=jQ(a,f,i);if(m.length){let A=m[0];A.retrieveChildren=!0,A.state="selected",A.previousState="idle",A.children=[];return}let g=YE(o.value,i);g.state="selected",g.previousState="idle",m.push(g),a.numberOfValues=1}).addCase(bo,(t,r)=>{let n=r.payload;mu(t,n)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>mu(t,r))}).addCase(Ia,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(pu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,i=t[n]?.request;if(i){if(!i.currentValues.length)return $f(i,o);LQ(t,r.payload)}}).addCase(Gf,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n];if(!i)return;let a=[...o.path,o.rawValue];Hf(i.request,a,i.initialNumberOfValues)}).addCase(ka.fulfilled,(t,r)=>{WE(t,r.payload.response.facets)}).addCase(_e.fulfilled,(t,r)=>{WE(t,r.payload.response.facets)}).addCase(pt,(t,r)=>{mu(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,n)&&mu(t,o)})})}),hv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function jQ(e,t,r){let n=e.currentValues;for(let o of t){let i=n[0];(!i||o!==i.value)&&(i=YE(o,r),n.length=0,n.push(i)),i.retrieveChildren=!1,i.previousState=void 0,i.state="idle",n=i.children}return n}function VQ(e){return{...hv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function YE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function WE(e,t){t.forEach(r=>{if(!UQ(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let i=QQ(o,r);o.currentValues=i?[]:o.currentValues,o.preventAutoSelect=!1})}function LQ(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function UQ(e,t){return t.facetId in e}function QQ(e,t){let r=$r(e.currentValues),n=$r(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var cn=new $({regex:/^[a-zA-Z0-9-_]+$/}),un=new $({required:!0}),KE=new oe({each:new $}),XE=new $,ZE=new pe,ln=new pe,dn=new ne({min:0}),Mr=new ne({min:1}),Wf=new pe({required:!0}),BQ=new Y,GQ=new $,$Q={captions:BQ,numberOfValues:Mr,query:GQ},hs=new Y({values:$Q}),Yf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new oe({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),wTe=new pe,Kf=new oe({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var _i={value:H,numberOfResults:new ne({min:0}),state:H};var HQ={facetId:ye,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),resultsMustMatch:new He({required:!1}),allowedValues:Yf,customSort:Kf},ys=P("facet/register",e=>_(e,HQ)),xo=P("facet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:_i})})),wo=P("facet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:_i})})),At=P("facet/deselectAll",e=>_(e,ye)),Xf=P("facet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new He({required:!0})})),gu=P("facet/updateNumberOfValues",e=>_(e,{facetId:ye,numberOfValues:new ne({required:!0,min:1})})),hu=P("facet/updateIsFieldExpanded",e=>_(e,{facetId:ye,isFieldExpanded:new pe({required:!0})})),Ni=P("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ye,freezeCurrentValues:new pe({required:!0})}));d();c();l();u();var Ss=e=>Fe("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o=ha(e,n);return t.makeFacetUnexclude(o)});var ir=()=>({actionCause:"facetClearAll"}),pr=()=>({actionCause:"facetSelect"}),Zf=()=>({actionCause:"facetExclude"}),Ln=()=>({actionCause:"facetDeselect"});var yv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var vs=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ye);let n={...zo(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowMore(n)}),As=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ye);let n={...zo(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowLess(n)}),pn=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ye,sortCriterion:new He({required:!0})});let{facetId:n,sortCriterion:o}=e,i=Xt(r),p={...zo(n,i),criteria:o,...ee(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Qt=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ye);let n=Xt(r),o={...zo(e,n),...ee(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...ha(e,n),...ee(r.insightCaseContext)};return t.logFacetSelect(o)}),jr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...ha(e,n),...ee(r.insightCaseContext)};return t.logFacetDeselect(o)}),yu=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n={...ha(e,Xt(r)),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var JE={facetId:ye,value:new Y({values:{displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})}})},eF=P("facetSearch/register",e=>_(e,fu)),Jf=P("facetSearch/update",e=>_(e,fu)),em=P("facetSearch/toggleSelectValue",e=>_(e,JE)),tm=P("facetSearch/toggleExcludeValue",e=>_(e,JE));var Cs=fe(ga(),e=>{e.addCase(ys,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Db(zQ(r.payload),o))}).addCase(tt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(ot,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(a=>{let{request:p}=t[a],f=n[a]||[],m=o[a]||[],g=f.length+m.length,A=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(rF),...m.map(nF),...A.map(YQ)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(xo,(t,r)=>{let{facetId:n,selection:o}=r.payload,i=t[n]?.request;if(!i)return;i.preventAutoSelect=!0;let a=i.currentValues.find(f=>f.value===o.value);if(!a){rm(i,o);return}let p=a.state==="selected";a.previousState=a.state,a.state=p?"idle":"selected",i.freezeCurrentValues=!0}).addCase(wo,(t,r)=>{let{facetId:n,selection:o}=r.payload,i=t[n]?.request;if(!i)return;i.preventAutoSelect=!0;let a=i.currentValues.find(f=>f.value===o.value);if(!a){rm(i,o);return}let p=a.state==="excluded";a.previousState=a.state,a.state=p?"idle":"excluded",i.freezeCurrentValues=!0}).addCase(Ni,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,i=t[n]?.request;i&&(i.freezeCurrentValues=o)}).addCase(At,(t,r)=>{gs(t[r.payload]?.request)}).addCase(Jt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>gs(r))}).addCase(gd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>gs(r))}).addCase(Ia,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Xf,(t,r)=>{ms(t,r.payload)}).addCase(gu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;$f(t[n]?.request,o)}).addCase(hu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,i=t[n]?.request;i&&(i.isFieldExpanded=o)}).addCase(_e.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>tF(t[o.facetId]?.request,o))}).addCase(ka.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>tF(t[o.facetId]?.request,o))}).addCase(em,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n]?.request;if(!i)return;let{rawValue:a}=o,{currentValues:p}=i,f=p.find(g=>g.value===a);if(f){f.state="selected";return}let m=rF(a);rm(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(tm,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n]?.request;if(!i)return;let{rawValue:a}=o,{currentValues:p}=i,f=p.find(g=>g.value===a);if(f){f.state="excluded";return}let m=nF(a);rm(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(pt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];gs(n)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,n)&&gs(i.request)})})});function rm(e,t){let{currentValues:r}=e,n=r.findIndex(i=>i.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function tF(e,t){e&&(e.currentValues=t.values.map(WQ),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var Sv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function zQ(e){return{...Sv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function WQ(e){let{value:t,state:r}=e;return{value:t,state:r}}function rF(e){return{value:e,state:"selected"}}function nF(e){return{value:e,state:"excluded"}}function YQ(e){return{...e,state:"idle"}}d();c();l();u();var nm=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();function bs(e){let t=oF(e.start,e),r=oF(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function oF(e,t){let{dateFormat:r}=t;return OA(e)?(zu(e),TA(e)):typeof e=="string"&&$n(e)?(zu(e),e):(RA(e,r),Hu(Ki(e,r)))}d();c();l();u();var xs=P("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new He({required:!0})}));d();c();l();u();var Di={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new pe({required:!0}),numberOfResults:new ne({required:!0,min:0})},qi={start:H,end:H,endInclusive:new pe({required:!0}),state:H,numberOfResults:new ne({required:!0,min:0})},Un=e=>({facetId:ye,selection:typeof e.start=="string"?new Y({values:qi}):new Y({values:Di})});var KQ={start:H,end:H,endInclusive:new pe({required:!0}),state:H},XQ={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:KQ})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),rangeAlgorithm:new He({required:!1})};function iF(e){return $n(e)?oc(e):e}function om(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=bs(t);if(Ki(iF(r)).isAfter(Ki(iF(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var fn=P("dateFacet/register",e=>{try{return mr(e,XQ),om(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),mn=P("dateFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:qi})})),gn=P("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:qi})})),Qn=P("dateFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:qi})})}),om({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),im=xs,am=At;d();c();l();u();d();c();l();u();var sm=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,i=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:i,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},cm=()=>({actionCause:"breadcrumbFacet"});var vv=cm;d();c();l();u();var Su=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,Un(e.selection));let n={...sm(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function ZQ(e,t){return!!t&&t.facetId in e.dateFacetSet}var aF=(e,t)=>{let r=Tn(e,t);if(ZQ(e,r))return r},sF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),cF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var lm={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function dm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=uF(r);r.numberOfValues=o,e[n]=t}function pm(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=uF(n))}function fm(e,t,r){let n=e[t]?.request;if(!n)return;let o=um(n.currentValues,r);if(!o)return;let i=o.state==="selected";o.previousState=o.state,o.state=i?"idle":"selected",n.preventAutoSelect=!0}function mm(e,t,r){let n=e[t]?.request;if(!n)return;let o=um(n.currentValues,r);if(!o)return;let i=o.state==="excluded";o.previousState=o.state,o.state=i?"idle":"excluded",n.preventAutoSelect=!0}function hn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function gm(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!um(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let i=o.filter(p=>!um(n.currentValues,p)),a=n.currentValues;a.push(...i),n.numberOfValues=Math.max(n.numberOfValues,a.length)})}function hm(e,t,r){t.forEach(n=>{let o=n.facetId,i=e[o]?.request;if(!i)return;let a=r(n.values);i.currentValues=a,i.preventAutoSelect=!1})}function um(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function uF(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var yn=fe(fa(),e=>{e.addCase(fn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=JQ(n);dm(t,_b(i,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.df||{};gm(t,n)}).addCase(mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;fm(t,n,o)}).addCase(gn,(t,r)=>{let{facetId:n,selection:o}=r.payload;mm(t,n,o)}).addCase(Qn,(t,r)=>{let{facetId:n,values:o}=r.payload;pm(t,n,o)}).addCase(am,(t,r)=>{hn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{hn(t,r)})}).addCase(im,(t,r)=>{ms(t,r.payload)}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.facets;hm(t,n,eB)}).addCase(pt,(t,r)=>{hn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,n)&&hn(t,o)})})});function JQ(e){return{...lm,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function eB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var tB={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new pe({required:!0})},rB={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:tB})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new He({required:!1}),rangeAlgorithm:new He({required:!1})};function ym(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Sn=P("numericFacet/register",e=>{try{return _(e,rB),ym(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),vn=P("numericFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Di})})),An=P("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Di})})),Bn=P("numericFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:Di})})}),ym({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Sm=xs,vm=At;d();c();l();u();var Av=cm;d();c();l();u();d();c();l();u();var lF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,i=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:i,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var vu=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,Un(e.selection));let n={...lF(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function nB(e,t){return!!t&&t.facetId in e.numericFacetSet}var dF=(e,t)=>{let r=Tn(e,t);if(nB(e,r))return r},pF=(e,t)=>(dF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),fF=(e,t)=>(dF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Ro=fe(ma(),e=>{e.addCase(Sn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=oB(n);dm(t,Nb(i,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.nf||{};gm(t,n)}).addCase(vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;fm(t,n,o)}).addCase(An,(t,r)=>{let{facetId:n,selection:o}=r.payload;mm(t,n,o)}).addCase(Bn,(t,r)=>{let{facetId:n,values:o}=r.payload;pm(t,n,o)}).addCase(vm,(t,r)=>{hn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{hn(t,r)})}).addCase(Sm,(t,r)=>{ms(t,r.payload)}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.facets;hm(t,n,iB)}).addCase(pt,(t,r)=>{hn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,n)&&hn(t,o)})})});function oB(e){return{...lm,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function iB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Au=H,Am=new Y({options:{required:!0},values:{caption:Ke,expression:Ke,state:new $({constrainTo:["idle","selected","excluded"]})}}),mF=new oe({required:!0,each:Am});var t0e=P("staticFilter/register",e=>_(e,{id:Au,values:mF})),gF=P("staticFilter/toggleSelect",e=>_(e,{id:Au,value:Am})),hF=P("staticFilter/toggleExclude",e=>_(e,{id:Au,value:Am})),r0e=P("staticFilter/deselectAllFilterValues",e=>_(e,Au));d();c();l();u();var Cm=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...ee(r.insightCaseContext)}));d();c();l();u();var bm=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function yF(e){let t=he(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Jt())},deselectBreadcrumb(n){n.deselect()}}}function SF(e){if(!aB(e))throw ie;let t=yF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:y,selection:b})=>{let w=yu({facetId:y,facetValue:b.value});r(xo({facetId:y,selection:b})),r(Ni({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:yv()}))},executeToggleExclude:({facetId:y,selection:b})=>{let w=yu({facetId:y,facetValue:b.value});r(wo({facetId:y,selection:b})),r(Ni({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:yv()}))},facetValuesSelector:Pb};return bm(h)},i=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:y=>{r(vn(y)),r(xe({legacy:vu(y),next:Av()}))},executeToggleExclude:y=>{r(An(y)),r(xe({legacy:vu(y),next:Av()}))},facetValuesSelector:pF};return bm(h)},a=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:y=>{r(mn(y)),r(xe({legacy:Su(y),next:vv()}))},executeToggleExclude:y=>{r(gn(y)),r(xe({legacy:Su(y),next:vv()}))},facetValuesSelector:cF};return bm(h)},p=h=>{let y=Ob(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:y,deselect:()=>{r(bo(h)),r(xe({legacy:Bf({categoryFacetPath:y.map(b=>b.value),categoryFacetId:h}),next:$E()}))}}},f=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),m=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:y,values:b}=h,w=b.filter(I=>I.state!=="idle").map(I=>A(y,I));return{id:y,values:w}},A=(h,y)=>({value:y,deselect:()=>{let{caption:b,expression:w}=y,I=Cm({staticFilterId:h,staticFilterValue:{caption:b,expression:w}});y.state==="selected"?r(gF({id:h,value:y})):y.state==="excluded"&&r(hF({id:h,value:y})),r(xe({legacy:I}))}});function x(){return!![...o(),...i(),...a(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:i(),dateFacetBreadcrumbs:a(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:x()}},deselectAll:()=>{t.deselectAll(),r(xe({legacy:nm(),next:{actionCause:"breadcrumbResetAll"}}))}}}function aB(e){return e.addReducers({configuration:we,search:Ee,facetSet:Cs,numericFacetSet:Ro,dateFacetSet:yn,categoryFacetSet:zf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var vF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var xm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),AF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function CF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:xm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var bF=(e,t)=>{let r={...AF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var xF=fe(CF(),e=>{e.addCase(rd,t=>{t.enableDidYouMean=!0}).addCase(Rx,t=>{t.enableDidYouMean=!1}).addCase(Ix,t=>{t.automaticallyCorrectQuery=!0}).addCase(nd,t=>{t.automaticallyCorrectQuery=!1}).addCase(_e.pending,t=>{t.queryCorrection=xm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(_e.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let i=o?.[0]?o[0]:xm();t.queryCorrection=i}t.queryCorrectionMode==="next"&&bF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Zt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Mc,(t,r)=>{t.queryCorrectionMode=r.payload})});function wF(e,t={}){if(!sB(e))throw ie;let r=he(e),{dispatch:n}=e;n(rd()),t.options?.automaticallyCorrectQuery===!1&&n(nd()),n(Mc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,i=()=>vF(o().didYouMean);return{...r,get state(){let a=o();return{originalQuery:a.didYouMean.originalQuery,wasCorrectedTo:a.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:a.didYouMean.wasAutomaticallyCorrected,queryCorrection:a.didYouMean.queryCorrection,hasQueryCorrection:i()}},applyCorrection(){n(Zt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(a){n(Mc(a))}}}function sB(e){return e.addReducers({configuration:we,didYouMean:xF}),!0}var RF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function IF(e,t={options:RF}){let r={...RF,...t.options},n=wF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(xe({legacy:_x(),next:Ux()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Bt=fe(ad(),e=>{e.addCase(Ge,(t,r)=>({...t,...r.payload})).addCase(_e.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(_e.rejected,t=>{t.freezeFacetOrder=!1}).addCase(tt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(ps,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wm(o,t,n)}).addCase(ys,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wm(o,t,n)}).addCase(fn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wm(o,t,n)}).addCase(Sn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wm(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(pt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(ot,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=Ty()),t.facets[n].enabled=!0})})});function wm(e,t,r){let n={...Ty(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Rm=fe(cd(),e=>{e.addCase(sp,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(Nt,(t,r)=>{let n=r.payload;EF(t,n)}).addCase(ap,(t,r)=>{let n=r.payload;EF(t,n)}).addCase(tt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(ot,(t,r)=>{let n=r.payload.tab;J(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function EF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function FF(e){if(!cB(e))throw ie;let t=he(e),r=ct(n=>n.tabSet,n=>Object.values(n).find(i=>i.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function cB(e){return e.addReducers({tabSet:Rm}),!0}function TF(e,t){if(!uB(e))throw ie;let r=FF(e),n=y=>e.state.facetOptions.facets[y]?.enabled??!1,o=y=>e.state.facetSet?.[y]?.request?.currentValues??e.state.categoryFacetSet?.[y]?.request?.currentValues??e.state.numericFacetSet?.[y]?.request?.currentValues??e.state.dateFacetSet?.[y]?.request?.currentValues??null,i=y=>y in e.state.facetOptions.facets,a=y=>e.state.facetOptions.facets[y]?.tabs,p=()=>zi({isFacetRegistered:i(t.facetId),parentFacets:t.conditions.map(({parentFacetId:y})=>i(y)?{enabled:n(y),values:o(y)}:null),isTabEnabled:or(a(t.facetId),r.state.activeTab)}),f=()=>{let y=p();return y===x?!1:(x=y,!0)},m=()=>t.conditions.length>0?t.conditions.some(y=>{if(!n(y.parentFacetId))return!1;let b=o(y.parentFacetId);return b===null?!1:y.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([y,b])=>b.request.freezeCurrentValues&&e.dispatch(Ni({facetId:y,freezeCurrentValues:!1})))},A=()=>{if(!i(t.facetId))return;let y=n(t.facetId),b=m(),w=or(a(t.facetId),r.state.activeTab),I=b&&w;y!==I&&(e.dispatch(I?nr(t.facetId):pt(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&A()});return A(),{stopWatching(){h()}}}function uB(e){return e.addReducers({facetOptions:Bt}),!0}function PF(e,t){return TF(e,t)}d();c();l();u();d();c();l();u();function kF(e){if(!lB(e))throw ie;let t=he(e),r=()=>e.state;return{...t,sort(n){return Vc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(i=>i.facetId)}}}}function lB(e){return e.addReducers({search:Ee,facetOptions:Bt}),!0}function OF(e){return kF(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Im(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,i={...ws,...t},a=r();e[n]={options:i,isLoading:o,response:a,initialNumberOfValues:i.numberOfValues,requestId:""}}function Em(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Fm(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Tm(e,t){let r=e[t];r&&(r.isLoading=!1)}function Pm(e,t,r){let{facetId:n,response:o}=t,i=e[n];i&&i.requestId===r&&(i.isLoading=!1,i.response=o)}function Cu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=ws.query)}function km(e,t){Object.keys(e).forEach(r=>Cu(e,{facetId:r},t))}var ws={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var _F=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,i=t.categoryFacetSet[e].request,{captions:a,query:p,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:A,filterFacetCount:x}=i,h=dB(i),y=h.length?[h]:[],b=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:A,captions:a,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:y,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function _F(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),dB=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var NF=/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:i,numberOfValues:a}=t.facetSearchSet[e].options,{field:p,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(x=>x.state!=="idle").map(x=>x.value),A=`*${i}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:a,query:A,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function NF(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var DF=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){let a=r(),p;o(t,H),pB(a,t)?p=yield NF(t,a,i,e):p=yield _F(t,a,i,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),Io=me("facetSearch/executeSearch",DF(!1)),Nqe=me("facetSearch/executeSearch",DF(!0)),Om=P("facetSearch/clearResults",e=>_(e,{facetId:ye})),pB=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function qF(){return{}}var MF=fe(qF(),e=>{e.addCase(HE,(t,r)=>{let n=r.payload;Im(t,n,Cv)}).addCase(Jf,(t,r)=>{Em(t,r.payload)}).addCase(Io.pending,(t,r)=>{let n=r.meta.arg;Fm(t,n,r.meta.requestId)}).addCase(Io.rejected,(t,r)=>{let n=r.meta.arg;Tm(t,n)}).addCase(Io.fulfilled,(t,r)=>{Pm(t,r.payload,r.meta.requestId)}).addCase(Om,(t,{payload:{facetId:r}})=>{Cu(t,{facetId:r},Cv)}).addCase(_e.fulfilled,t=>{km(t,Cv)})});function Cv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function jF(e,t){let{field:r,state:n}=e;if(!fB(e))return r;let o=`${r}_`,i=mB(o,n);return hB(r,t),`${o}${i}`}function fB(e){let{field:t,state:r}=e;return VF(r).some(o=>o&&t in o)}function mB(e,t){let n=VF(t).map(o=>Object.keys(o||{})).reduce((o,i)=>o.concat(i),[]);return gB(n,e)+1}function VF(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function gB(e,t){return e.map(i=>{let a=i.split(t)[1],p=parseInt(a,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function hB(e,t){let r=`A facet with field "${e}" already exists.
46
+ To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function wr(e,t){let{state:r,logger:n}=e,{field:o,facetId:i}=t;return i||jF({field:o,state:r},n)}d();c();l();u();d();c();l();u();var LF=["alphanumeric","occurrences"];var UF=new Oe({field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),basePath:KE,delimitingCharacter:XE,facetId:cn,facetSearch:hs,filterByBasePath:ZE,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:LF})});function QF(e,t){if(!yB(e))throw ie;let r=he(e),{dispatch:n}=e,o=wr(e,t.options),i=t.options.tabs??{},a=Lt(e.state.tabSet),p={...hv,...Lu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:i,activeTab:a},f={facetSearch:{...ws,...t.options.facetSearch},...p};ht(e,UF,f,"buildCategoryFacet");let m=()=>my(e.state,o),g=()=>fy(e.state,o),A=()=>Gr(e.state),x=()=>Jr(e.state,o);return n(ps(p)),{...r,toggleSelect(h){let y=f.numberOfValues;n(fs({facetId:o,selection:h,retrieveCount:y})),n(Ge())},deselectAll(){n(bo(o)),n(Ge())},sortBy(h){n(Qf({facetId:o,criterion:h})),n(Ge())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:y,valuesAsTrees:b}=this.state,w=(y?.children.length??b.length)+h;n(pu({facetId:o,numberOfValues:w})),n(Ge())},showLessValues(){let{numberOfValues:h}=f;n(pu({facetId:o,numberOfValues:h})),n(Ge())},enable(){n(nr(o))},disable(){n(pt(o))},get state(){let h=m(),y=g(),b=A(),w=x(),I=y?.values??[],F=I.some(B=>B.children.length>0)??!1,{parents:E,values:k}=kb(y?.values),T=$r(I),q=T.length?T[T.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??y?.moreValuesAvailable??!1,V=q?q.children.length>f.numberOfValues:I.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:T,values:k,isHierarchical:F,valuesAsTrees:I,activeValue:q,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:V,sortCriteria:h.sortCriteria,enabled:w}}}}function yB(e){return e.addReducers({categoryFacetSet:zf,categoryFacetSearchSet:MF,facetOptions:Bt,configuration:we,search:Ee}),!0}function BF(e,t){let r=QF(e,t),{dispatch:n}=e,o=()=>r.state.facetId,a={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=a;return{...r,facetSearch:f,toggleSelect(m){r.toggleSelect(m);let g=SB(o(),m);n(xe({legacy:g,next:vB(m)}))},deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ir()}))},sortBy(m){r.sortBy(m),n(xe({legacy:pn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(Ra({legacy:vs(o())}))},showLessValues(){r.showLessValues(),n(Ra({legacy:As(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function SB(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?jr(r):Yt(r)}function vB(e){return e.state==="selected"?Ln():pr()}d();c();l();u();d();c();l();u();d();c();l();u();function GF(){return{}}var _m=fe(GF(),e=>{e.addCase(eF,(t,r)=>{let n=r.payload;Im(t,n,bv)}).addCase(Jf,(t,r)=>{Em(t,r.payload)}).addCase(Io.pending,(t,r)=>{let n=r.meta.arg;Fm(t,n,r.meta.requestId)}).addCase(Io.rejected,(t,r)=>{let n=r.meta.arg;Tm(t,n)}).addCase(Io.fulfilled,(t,r)=>{Pm(t,r.payload,r.meta.requestId)}).addCase(Om,(t,{payload:r})=>{Cu(t,r,bv)}).addCase(_e.fulfilled,t=>{km(t,bv)})});function bv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var AB=e=>e.state==="selected",$F=(e,t)=>{let r={facetId:e,facetValue:t.value};return AB(t)?jr(r):Yt(r)};d();c();l();u();var xv=e=>e.state==="selected",YF=e=>e.state==="excluded";var KF=e=>xv(e)?Ln():pr();d();c();l();u();d();c();l();u();var XF={facetId:ye,selection:new Y({values:_i})},ZF=me("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},XF),n(xo({facetId:e,selection:t})),n(Ge())}),JF=me("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},XF),n(wo({facetId:e,selection:t})),n(Ge())});d();c();l();u();d();c();l();u();var Rs=["allValues","atLeastOneValue"];d();c();l();u();var Nm=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var eT=new Oe({facetId:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:un,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:Nm}),resultsMustMatch:new $({constrainTo:Rs}),facetSearch:hs});function tT(e,t,r=eT){if(!CB(e))throw ie;let{dispatch:n}=e,o=he(e),i=wr(e,t.options),a=t.options.tabs??{},p=Lt(e.state.tabSet),f={...Sv,...Lu("facetSearch",t.options),field:t.options.field,facetId:i,tabs:a,activeTab:p},m={facetSearch:{...ws,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let g=()=>Tb(e.state,i),A=()=>py(e.state,i),x=()=>Gr(e.state),h=()=>Jr(e.state,i),y=()=>{let{currentValues:w}=g();return w.filter(I=>I.state!=="idle").length},b=()=>{let{currentValues:w}=g(),I=m.numberOfValues,F=!!w.find(E=>E.state==="idle");return I<w.length&&F};return n(ys(f)),{...o,toggleSelect:w=>n(ZF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(JF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(At(i)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(At(i)),this.toggleExclude(w)},isValueSelected:xv,isValueExcluded:YF,deselectAll(){n(At(i)),n(Ge())},sortBy(w){n(Xf({facetId:i,criterion:w})),n(Ge())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,I=m.numberOfValues,F=I-w%I,E=w+F;n(gu({facetId:i,numberOfValues:E})),n(hu({facetId:i,isFieldExpanded:!0})),n(Ge())},showLessValues(){let w=m.numberOfValues,I=Math.max(w,y());n(gu({facetId:i,numberOfValues:I})),n(hu({facetId:i,isFieldExpanded:!1})),n(Ge())},enable(){n(nr(i))},disable(){n(pt(i))},get state(){let w=g(),I=A(),F=x(),E=h(),k;typeof w.sortCriteria=="object"?k=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":k=w.sortCriteria;let T=I?I.values:[],q=T.some(V=>V.state!=="idle"),G=I?I.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:I?.label,facetId:i,tabs:a,values:T,sortCriterion:k,resultsMustMatch:Q,isLoading:F,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:b(),enabled:E}}}}function CB(e){return e.addReducers({facetSet:Cs,facetOptions:Bt,configuration:we,facetSearchSet:_m}),!0}d();c();l();u();var rT=new Oe({facetId:cn,field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,sortCriteria:new $({constrainTo:Nm}),resultsMustMatch:new $({constrainTo:Rs}),facetSearch:hs,allowedValues:Yf,customSort:Kf});function nT(e,t){if(!bB(e))throw ie;let{dispatch:r}=e,n=tT(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},rT),o=()=>n.state.facetId,a={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=a;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(xe({legacy:$F(o(),m),next:KF(m)}))},deselectAll(){n.deselectAll(),r(xe({legacy:Qt(o()),next:ir()}))},sortBy(m){n.sortBy(m),r(xe({legacy:pn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ra({legacy:vs(o())}))},showLessValues(){n.showLessValues(),r(Ra({legacy:As(o())}))},get state(){return{...n.state,facetSearch:a.state}}}}function bB(e){return e.addReducers({facetSet:Cs,configuration:we,facetSearchSet:_m,search:Ee}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var bu=e=>e.state==="selected",oT=e=>e.state==="excluded";var Dm=e=>bu(e)?Ln():pr();var qm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return bu(t)?jr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Mm=P("rangeFacet/executeToggleSelect",e=>_(e,Un(e.selection))),jm=P("rangeFacet/executeToggleExclude",e=>_(e,Un(e.selection)));var iT={facetId:ye,selection:new Y({values:qi})},aT=me("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,iT),t(mn(e)),t(Mm(e)),t(Ge())}),sT=me("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,iT),t(gn(e)),t(jm(e)),t(Ge())});d();c();l();u();function Vm(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function Lm(e,t){let{facetId:r,getRequest:n}=t,o=he(e),i=e.dispatch,a=()=>Jr(e.state,r);return{...o,isValueSelected:bu,isValueExcluded:oT,deselectAll(){i(At(r)),i(Ge())},sortBy(p){i(xs({facetId:r,criterion:p})),i(Ge())},isSortedBy(p){return this.state.sortCriterion===p},enable(){i(nr(r))},disable(){i(pt(r))},get state(){let p=n(),f=Tn(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,A=f?f.values:[],x=Gr(e.state),h=a(),y=A.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:A,sortCriterion:m,resultsMustMatch:g,hasActiveValues:y,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var Um=["idle","selected","excluded"];d();c();l();u();var Qm=["ascending","descending"],Bm=["even","equiprobable"];var xB={start:new $,end:new $,endInclusive:new pe,state:new $({constrainTo:Um})},wB=new Oe({facetId:cn,field:un,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),generateAutomaticRanges:Wf,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,currentValues:new oe({each:new Y({values:xB})}),sortCriteria:new $({constrainTo:Qm}),rangeAlgorithm:new $({constrainTo:Bm})});function Gm(e,t){ht(e,wB,t,"buildDateFacet"),om(t)}function cT(e,t){if(!RB(e))throw ie;Vm(t.options,"buildDateFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},i=Lt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};Gm(e,a),r(fn(a));let p=Lm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(aT({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(At(n)),this.toggleSelect(f)},toggleExclude:f=>r(sT({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(At(n)),this.toggleExclude(f)},get state(){return p.state}}}function RB(e){return e.addReducers({configuration:we,search:Ee,dateFacetSet:yn,facetOptions:Bt}),!0}function uT(e,t){let r=cT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ir()}))},sortBy(i){r.sortBy(i),n(xe({legacy:pn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(xe({legacy:qm(o(),i),next:Dm(i)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function lT(e,t){if(!IB(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=wr(e,t.options),a=t.options.tabs??{},p=Lt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:i,tabs:a,activeTab:p};Gm(e,f),n(fn(f));let m=()=>Jr(e.state,i);return{...r,clear:()=>{n(Qn({facetId:i,values:[]})),n(Ge())},setRange:g=>{let A={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Qn({facetId:i,values:[A]});return x.error?!1:(n(x),n(Ge()),!0)},enable(){n(nr(i))},disable(){n(pt(i))},get state(){let g=Gr(o()),A=m(),x=sF(o(),i),h=x.length?x[0]:void 0;return{facetId:i,isLoading:g,range:h,enabled:A}}}}function IB(e){return e.addReducers({dateFacetSet:yn,facetOptions:Bt,configuration:we,search:Ee}),!0}function dT(e,t){if(!EB(e))throw ie;let r=lT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Qt(o()),next:ir()}))},setRange:i=>{let a=r.setRange(i);return a&&n(xe({legacy:Yt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:pr()})),a},get state(){return{...r.state}}}}function EB(e){return e.addReducers({dateFacetSet:yn,configuration:we,search:Ee}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var pT={facetId:ye,selection:new Y({values:Di})},fT=me("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,pT),t(vn(e)),t(Mm(e)),t(Ge())}),jQe=me("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,pT),t(An(e)),t(jm(e)),t(Ge())});d();c();l();u();var FB={start:new ne,end:new ne,endInclusive:new pe,state:new $({constrainTo:Um})},TB=new Oe({facetId:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:un,generateAutomaticRanges:Wf,filterFacetCount:ln,injectionDepth:dn,numberOfValues:Mr,currentValues:new oe({each:new Y({values:FB})}),sortCriteria:new $({constrainTo:Qm}),resultsMustMatch:new $({constrainTo:Rs}),rangeAlgorithm:new $({constrainTo:Bm})});function $m(e,t){ht(e,TB,t,"buildNumericFacet"),ym(t)}d();c();l();u();function Hm(e){return{endInclusive:!1,state:"idle",...e}}function mT(e,t){if(!PB(e))throw ie;Vm(t.options,"buildNumericFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},i=Lt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};$m(e,a),r(Sn(a));let p=Lm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(fT({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(At(n)),this.toggleSelect(f)},get state(){return p.state}}}function PB(e){return e.addReducers({numericFacetSet:Ro,facetOptions:Bt,configuration:we,search:Ee}),!0}function gT(e,t){let r=mT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Qt(o()),next:ir()}))},sortBy(i){r.sortBy(i),n(xe({legacy:pn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(xe({legacy:qm(o(),i),next:Dm(i)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function hT(e,t){if(!kB(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=wr(e,t.options),a=t.options.tabs??{},p=Lt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:i,tabs:a,activeTab:p};$m(e,f),n(Sn(f));let m=()=>Jr(e.state,i);return{...r,clear:()=>{n(Bn({facetId:i,values:[]})),n(Ge())},setRange:g=>{let A={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Bn({facetId:i,values:[A]});return x.error?!1:(n(x),n(Ge()),!0)},enable(){n(nr(i))},disable(){n(pt(i))},get state(){let g=Gr(o()),A=m(),x=fF(o(),i),h=x.length?x[0]:void 0;return{facetId:i,isLoading:g,range:h,enabled:A}}}}function kB(e){return e.addReducers({numericFacetSet:Ro,facetOptions:Bt,configuration:we,search:Ee}),!0}function yT(e,t){let r=hT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Qt(o()),next:ir()}))},setRange:i=>{let a=r.setRange(i);return a&&n(xe({legacy:Yt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:pr()})),a},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var OB=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(_t(e),t.logShowMoreFoldedResults(Xe(e,r),Ze(e),ee(r.insightCaseContext)))),_B=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(ee(t.insightCaseContext))),ST={logShowMoreFoldedResults:OB,logShowLessFoldedResults:_B};d();c();l();u();d();c();l();u();var xu={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},Is=P("folding/register",e=>_(e,xu)),zm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield oo(i):Ea(i,o),p=yield n.search({...a,q:NB(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return ze(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x224,_x225){return _ref93.apply(this,arguments)}}());function NB(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var vT=P("folding/register",e=>_(e,xu)),Wm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield Ox(o,e),p=(yield jx(n,o,i,{origin:"foldingCollection"})).response;return ze(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x226,_x227){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Ym=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function DB(e,t){return e.raw[t.collection]}function wv(e,t){return e.raw[t.parent]}function wu(e,t){let r=e.raw[t.child];return ju(r)?r[0]:r}function qB(e,t){return(e||t)!==void 0&&e===t}function CT(e,t,r,n=[]){let o=wu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(i=>{let a=wu(i,r)===wu(e,r);return wv(i,r)===o&&!a}).map(i=>{let a={...i,searchUid:e.searchUid};return{result:a,children:CT(a,t,r,[...n,o])}}):[]}function MB(e,t){return e.find(r=>{let n=wv(r,t)===void 0,o=qB(wv(r,t),wu(r,t));return n||o})}function bT(e){return e.parentResult?bT(e.parentResult):e}function jB(e,t,r,n){let o=zl(e),a={...(n??MB(o,t)??bT(e)),searchUid:r},p=CT(a,o,t);return{result:a,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Km(e,t,r,n){let o={};return e.forEach(i=>{let a=DB(i,t);a&&(!wu(i,t)&&!i.parentResult||(o[a]=jB(i,t,r,n)))}),o}function AT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var Xm=fe(Ym(),e=>e.addCase(_e.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Km(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Zr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Km(r.response.results,t.fields,r.response.searchUid):{}}).addCase(uo.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Km(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Is,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(zm.pending,(t,{meta:r})=>{let n=r.arg;AT(t,n).isLoadingMoreResults=!0}).addCase(zm.rejected,(t,{meta:r})=>{let n=r.arg;AT(t,n).isLoadingMoreResults=!1}).addCase(zm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:i}})=>{let a=Km(n,t.fields,i,o);if(!a||!a[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=a[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var Ru={id:H},Eo=P("querySuggest/register",e=>_(e,{...Ru,count:new ne({min:0})})),xT=P("querySuggest/unregister",e=>_(e,Ru)),Fo=P("querySuggest/selectSuggestion",e=>_(e,{...Ru,expression:Ke})),To=P("querySuggest/clear",e=>_(e,Ru)),Es=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){o(e,Ru);let a=e.id,p=yield VB(a,t(),i),f=yield n.querySuggest(p);return ze(f)?r(f.error):{id:a,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),VB=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?vt.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield to(t.configuration.analytics):Xo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function VB(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Po=fe(ut(),e=>e.addCase(Wt,(t,r)=>({...t,...r.payload})).addCase(Zt,(t,r)=>{t.q=r.payload}).addCase(Fo,(t,r)=>{t.q=r.payload.expression}).addCase(tt.fulfilled,(t,r)=>r.payload?.query??t).addCase(ot,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var ko=P("fields/registerFieldsToInclude",e=>_(e,Zu)),Zm=P("fields/fetchall/enable"),Jm=P("fields/fetchall/disable"),eg=me("fields/fetchDescription",/*#__PURE__*/function(){var _ref97=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:p}=o.configuration,{apiBaseUrl:f}=o.configuration.search,m=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:p,url:f??Kt(p,a)});return ze(m)?n(m.error):m.success.fields});return function(_x233,_x234){return _ref97.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var wT=["author","language","urihash","objecttype","collection","source","permanentid"],LB=[...wT,"date","filetype","parents"],MGe=[...LB,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],RT=()=>({fieldsToInclude:wT,fetchAllFields:!1,fieldsDescription:[]});var Fs=fe(RT(),e=>e.addCase(ko,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Zm,t=>{t.fetchAllFields=!0}).addCase(Jm,t=>{t.fetchAllFields=!1}).addCase(eg.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Is,(t,{payload:r})=>{let n=Ym().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Ts(e){if(!UB(e))throw ie;let t=he(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:Td(n)}}}}function UB(e){return e.addReducers({search:Ee}),!0}var QB=new Oe({fieldsToInclude:new oe({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function tg(e,t){if(!BB(e))throw ie;let r=he(e),n=Ts(e),{dispatch:o}=e,i=()=>e.state,a=ht(e,QB,t?.options,"buildCoreResultList");a.fieldsToInclude&&o(ko(a.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,A=200,x=!1;return{...r,get state(){let y=i();return{...n.state,results:y.search.results,moreResultsAvailable:p(),searchResponseId:y.search.searchResponseId}},fetchMoreResults:function(){var _ref98=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-f<A){if(m++,m>=g){f=Date.now(),!x&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),x=!0;return}}else m=0;x=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function BB(e){return e.addReducers({search:Ee,configuration:we,fields:Fs}),!0}var GB=new Oe(xu);function IT(e,t,r){if(!$B(e))throw ie;let n=tg(e,t),{dispatch:o}=e,i=()=>e.state,a=t.options?.folding?ht(e,GB,t.options.folding,"buildFoldedResultList"):{};return o(Is({...a})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return Rv(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return Rv(this.state.results,f=>f.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=i();return{...n.state,results:n.state.results.map(f=>{let m=f.raw[p.folding.fields.collection];return!m||!p.folding.collections[m]?{result:f,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[m]})}}}}function $B(e){return e.addReducers({search:Ee,configuration:lp,folding:Xm,query:Po}),!0}function Rv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=Rv(n.children,t);if(o)return o}}return null}function ET(e,t={}){let r=IT(e,{...t,loadCollectionActionCreator:Wm,fetchMoreResultsActionCreator:fd},ST);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function rg(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Ps=fe(dS(),e=>e.addCase(ja,(t,{payload:r})=>{t.isVisible=r}).addCase(Ua,(t,{payload:r})=>{t.isEnabled=r}).addCase(zd,(t,{payload:r})=>{t.id=r.id}).addCase(ni,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),i=n.trim().length>0;if(o){t.answer+=n;return}t.answer=i?n:void 0}).addCase(oi,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=rg([...t.citations,...r.citations]),delete t.error}).addCase(ii,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===gh},t.citations=[],delete t.answer}).addCase(Bd,t=>{t.liked=!0,t.disliked=!1}).addCase(Gd,t=>{t.liked=!1,t.disliked=!0}).addCase($d,t=>{t.feedbackModalOpen=!0}).addCase(Wd,t=>{t.feedbackModalOpen=!1}).addCase(Qa,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...dS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(en,(t,{payload:r})=>{t.isLoading=r}).addCase(ri,(t,{payload:r})=>{t.isStreaming=r}).addCase(ai,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(Yd,(t,{payload:r})=>{t.responseFormat=r}).addCase(Xd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Wc,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(zc,t=>{t.expanded=!0}).addCase(Hd,t=>{t.expanded=!1}).addCase(Kd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(si,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(fS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Va,(t,{payload:r})=>{t.answerId=r}).addCase(La,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(Zd,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Jd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}).addCase(ep,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:i}=r,a=t.generationSteps.findLast(p=>p.status==="active");a&&(a.toolCalls=a.toolCalls||[],a.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:i,status:"active"}))}).addCase(Ba,(t,{payload:r})=>{let{toolCallId:n,args:o,type:i}=r,p=t.generationSteps.findLast(f=>f.status==="active")?.toolCalls?.find(f=>f.toolCallId===n);p&&(p.toolCallArgs=o,p.type=i==="search"?"search":"generic")}).addCase(tp,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o}=r,a=t.generationSteps.findLast(p=>p.status==="active")?.toolCalls?.find(p=>p.toolCallId===n);a&&(a.finishedAt=o,a.status="completed")}));d();c();l();u();function ng(e,t,r={}){if(!HB(e))throw ie;let{dispatch:n}=e,o=he(e),i=()=>e.state,a=r.initialState?.isVisible;a!==void 0&&n(ja(a));let p=r.initialState?.isEnabled;p!==void 0&&n(Ua(p));let f=r.initialState?.responseFormat;f&&n(Yd(f));let m=r.fieldsToIncludeInCitations;return m&&n(Xd(m)),r.initialState?.expanded&&n(zc()),{...o,get state(){let A=i().generatedAnswer;return{...A,error:qf(A.error)}},like(){this.state.liked||(n(Bd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Gd()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n($d())},closeFeedbackModal(){n(Wd())},sendFeedback(A){n(t.logGeneratedAnswerFeedback(A)),n(Qa())},logCitationClick(A,x){n(t.logOpenGeneratedAnswerSource(A,x))},logCitationHover(A,x,h){n(t.logHoverCitation(A,x,h))},show(){this.state.isVisible||(n(ja(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(ja(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(zc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Hd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Ua(!0))},disable(){this.state.isEnabled&&n(Ua(!1))},logCopyToClipboard(A){n(t.logCopyGeneratedAnswer(A))},retry(){}}}function HB(e){return e.addReducers({generatedAnswer:Ps}),!0}var Gt={engines:{},setAbortControllerRef:(e,t)=>{Gt.engines[t].abortController=e},getIsStreamInProgress:e=>!Gt.engines[e].abortController||Gt.engines[e].abortController?.signal.aborted?(Gt.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,i=r.generatedAnswer.id;if(Gt.engines[i].lastRequestId!==n){if(Gt.engines[i].lastRequestId=n,Gt.engines[i].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Gt.getIsStreamInProgress(i)&&o&&o!==Gt.engines[i].lastStreamId){if(Gt.engines[i].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Zw({setAbortControllerRef:p=>Gt.setAbortControllerRef(p,i)}))}};return e.subscribe(t)}};function FT(e,t,r={}){if(!zB(e))throw ie;let n=ng(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Gt.engines[e.state.generatedAnswer.id]&&(Gt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let a=Mu("genQA-",12);e.dispatch(zd({id:a}))}Gt.engines[e.state.generatedAnswer.id]||(Gt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Gt.subscribeToSearchRequests(e);let i=a=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in a;return{...n,get state(){return o().generatedAnswer},retry(){i(e)&&e.dispatch(_e({legacy:t.logRetryGeneratedAnswer()}))}}}function zB(e){return e.addReducers({generatedAnswer:Ps}),!0}d();c();l();u();d();c();l();u();var TT=op.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var og=e=>e==="yes"?!0:e==="no"?!1:null,WB=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:og(t.correctTopic),documented:og(t.documented),hallucinationFree:og(t.hallucinationFree),readable:og(t.readable)},helpful:t.helpful,question:r}),YB=e=>{let t="",r=()=>{let n=e.state,o=qw(n),i=o.requestId;if(i!==t){if(t=i,e.dispatch(lr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(La("automatic")),e.dispatch(rp()))}};e.subscribe(r)};function PT(e,t,r={}){if(!KB(e))throw ie;Mf(e.state.configuration.analytics.analyticsMode);let{...n}=ng(e,t,r),o=()=>e.state;return e.dispatch(Kd(r.answerConfigurationId)),YB(e),{...n,get state(){let i=mS(e.state).data,a=o().generatedAnswer;return{...a,answer:i?.answer,citations:rg(i?.citations??[]),error:qf({message:i?.error?.message,code:i?.error?.code}),isLoading:i?.isLoading??!1,isStreaming:i?.isStreaming??!1,answerContentFormat:i?.contentFormat??"text/plain",isAnswerGenerated:i?.generated??!1,cannotAnswer:a.cannotAnswer||i?.generated===!1&&!i?.isLoading&&!i?.isStreaming}},retry(){let i=jd(o());e.dispatch(np(i??ei))},reset(){e.dispatch(lr())},sendFeedback(i){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(i));let a=WB({query:o().query.q,feedback:i,answerApiState:mS(e.state).data});e.dispatch(TT.endpoints.post.initiate(a)),e.dispatch(Qa())})()}}}function KB(e){return e.addReducers({[ci.reducerPath]:ci.reducer,query:Po}),!0}function kT(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?PT(e,xa,t):FT(e,xa,t);return{...n,get state(){return n.state},retry(){r(xe({legacy:xa.logRetryGeneratedAnswer(),next:vx()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function Cn(e,t,r){if(!XB(e))throw ie;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Uu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function XB(e){return e.addReducers({configuration:we}),!0}function OT(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return Cn(e,r,()=>{o()})}function _T(e,t){return OT(e,{logCitationOpen:r=>Iy(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var t1=new ne({min:1,default:8,required:!1}),r1=new ne({min:1,max:20,default:5,required:!1}),n1={desiredCount:r1,numberOfValues:t1},OHe=P("automaticFacet/setOptions",e=>_(e,n1)),_He=P("automaticFacet/deselectAll",e=>_(e,ye)),o1=H,NT=P("automaticFacet/toggleSelectValue",e=>_(e,{field:o1,selection:new Y({values:_i})}));var Os=fe(Yr(),e=>{e.addCase(vd,(t,r)=>{let n=Iv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Iu(n,o)}).addCase(Ad,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(Nt,t=>{t.firstResult=0}).addCase(Cd,(t,r)=>{let n=r.payload;t.firstResult=Iu(n,t.numberOfResults)}).addCase(no,(t,r)=>{let n=r.payload;t.firstResult=Iu(n,t.numberOfResults)}).addCase(xd,t=>{let r=Iv(t),n=Math.max(r-1,1);t.firstResult=Iu(n,t.numberOfResults)}).addCase(bd,t=>{let r=Iv(t),n=i1(t),o=Math.min(r+1,n);t.firstResult=Iu(o,t.numberOfResults)}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(ot,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(_e.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Zr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(At,t=>{$t(t)}).addCase(gn,t=>{$t(t)}).addCase(wo,t=>{$t(t)}).addCase(An,t=>{$t(t)}).addCase(tm,t=>{$t(t)}).addCase(xo,t=>{$t(t)}).addCase(bo,t=>{$t(t)}).addCase(fs,t=>{$t(t)}).addCase(Gf,t=>{$t(t)}).addCase(mn,t=>{$t(t)}).addCase(vn,t=>{$t(t)}).addCase(Jt,t=>{$t(t)}).addCase(Qn,t=>{$t(t)}).addCase(Bn,t=>{$t(t)}).addCase(em,t=>{$t(t)}).addCase(NT,t=>{$t(t)})});function $t(e){e.firstResult=Yr().firstResult}function Iv(e){let{firstResult:t,numberOfResults:r}=e;return Ev(t,r)}function i1(e){let{totalCountFiltered:t,numberOfResults:r}=e;return Fv(t,r)}function Iu(e,t){return(e-1)*t}function Ev(e,t){return Math.round(e/t)+1}function Fv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function a1(e){return e.pagination.firstResult}function DT(e){return e.pagination.numberOfResults}function s1(e){return e.pagination.totalCountFiltered}var Oo=e=>{let t=a1(e),r=DT(e);return Ev(t,r)},Tv=e=>{let t=s1(e),r=DT(e);return Fv(t,r)},qT=(e,t)=>{let r=Oo(e),n=Tv(e),o=c1(r,t);return o=u1(o),o=l1(o,n),d1(o)};function c1(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,i=e-n,a=e+o;return{start:i,end:a}}function u1(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function l1(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function d1(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var Pv=()=>Fe("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Yr().numberOfResults}));var _s=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var ig=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Oo(t),...ee(t.insightCaseContext)})),ag=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Oo(t),...ee(t.insightCaseContext)})),sg=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Oo(t),...ee(t.insightCaseContext)}));d();c();l();u();var p1=new Oe({numberOfPages:new ne({default:5,min:0})}),f1=new Oe({page:new ne({min:1})});function MT(e,t={}){if(!m1(e))throw ie;let r=he(e),{dispatch:n}=e,o=ht(e,p1,t.options,"buildPager"),a=gr(e,f1,t.initialState,"buildPager").page;a&&n(Cd(a));let p=()=>Oo(e.state),f=()=>{let{numberOfPages:g}=o;return qT(e.state,g)},m=()=>Tv(e.state);return{...r,get state(){let g=p(),A=m(),x=g>1&&A>0,h=g<A;return{currentPage:g,currentPages:f(),maxPage:A,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(no(g))},nextPage(){n(bd())},previousPage(){n(xd())},isCurrentPage(g){return g===this.state.currentPage}}}function m1(e){return e.addReducers({configuration:we,pagination:Os}),!0}function jT(e,t={}){let{dispatch:r}=e,n=MT(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(pd({legacy:ig(),next:_s()}))},nextPage(){n.nextPage(),r(pd({legacy:ag(),next:_s()}))},previousPage(){n.previousPage(),r(pd({legacy:sg(),next:_s()}))}}}d();c();l();u();d();c();l();u();function VT(e){if(!g1(e))throw ie;let t=he(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function g1(e){return e.addReducers({search:Ee}),!0}function LT(e){return VT(e)}d();c();l();u();d();c();l();u();function UT(e){if(!h1(e))throw ie;let t=he(e),r=Ts(e),n=()=>e.state,o=()=>{let i=n().search.duration/1e3;return Math.round((i+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function h1(e){return e.addReducers({search:Ee,pagination:Os}),!0}function QT(e){return UT(e)}d();c();l();u();d();c();l();u();function BT(_x235,_x236){return _BT.apply(this,arguments)}function _BT(){_BT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:i}=e.insightConfiguration,a=e.query?.q||"";return{url:vh({url:mt(n,o),accessToken:r,organizationId:n,insightId:i}),accessToken:r,organizationId:n,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0}});return _BT.apply(this,arguments)}d();c();l();u();var GT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=Xe(e,r),o=Ze(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{action:"preview",itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:qr(t)}}});d();c();l();u();function $T(e,t,r,n,o){if(!y1(e))throw ie;let{dispatch:i}=e,a=()=>e.state,p=he(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=a().resultPreview;return x[h]},A=x=>{i(Fd({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Lc({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){A(f.uniqueId)},next(){i(Id()),A(g())},previous(){i(Ed()),A(g())},get state(){let x=a(),h=f.hasHtmlVersion,y=x.resultPreview,b=f.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,I=y.contentURL,F=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:I,currentResultUniqueId:F}}}}function y1(e){return e.addReducers({configuration:we,resultPreview:Oa}),!0}function HT(e,t){if(!S1(e))throw ie;let r=()=>{e.dispatch(GT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return $T(e,o,(i,a)=>BT(i,a),n,r)}function S1(e){return e.addReducers({configuration:we,resultPreview:Oa,insightInterface:eo}),!0}d();c();l();u();d();c();l();u();var zT=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(ee(t.insightCaseContext))),WT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var v1={queries:new oe({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},Eu=P("recentQueries/registerRecentQueries",e=>_(e,v1)),cg=P("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function YT(){return{queries:[],maxLength:10}}var KT=fe(YT(),e=>{e.addCase(Eu,A1).addCase(cg,C1).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||b1(n,t)})});function A1(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function C1(e){e.queries=[]}function b1(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var x1={queries:[]},w1={maxLength:10,clearFilters:!0},R1=new Oe({queries:new oe({required:!0})}),I1=new Oe({maxLength:new ne({required:!0,min:1}),clearFilters:new pe});function E1(e,t){ht(e,I1,t?.options,"buildRecentQueriesList"),gr(e,R1,t?.initialState,"buildRecentQueriesList")}function XT(e,t){if(!F1(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state,i={...w1,...t?.options},a={...x1,...t?.initialState};E1(e,{options:i,initialState:a});let p={queries:a.queries,maxLength:i.maxLength};return n(Eu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(cg())},updateRecentQueries(f){let m=new oe({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Eu({queries:f,maxLength:i.maxLength}))},executeRecentQuery(f){let m=new ne({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={q:this.state.queries[f],clearFilters:i.clearFilters};qu(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Pa(g))}}}function F1(e){return e.addReducers({search:Ee,recentQueries:KT,query:Po}),!0}function ZT(e,t){let r=XT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(zT()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(xe({legacy:WT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var T1={results:new oe({required:!0,each:new Y({values:Wl})}),maxLength:new ne({required:!0,min:1,default:10})},ug=P("recentResults/registerRecentResults",e=>_(e,T1)),bn=P("recentResults/pushRecentResult",e=>(_t(e),{payload:e})),lg=P("recentResults/clearRecentResults");d();c();l();u();var JT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logDocumentOpen(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:qr(t)}}});function eP(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(JT(t.options.result)))};return Cn(e,t,()=>{n(),e.dispatch(bn(t.options.result))})}d();c();l();u();function tP(e,t){return tg(e,{...t,fetchMoreResultsActionCreator:fd})}d();c();l();u();d();c();l();u();var P1=new Oe({numberOfResults:new ne({min:0})});function rP(e,t={}){if(!k1(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=gr(e,P1,t.initialState,"buildResultsPerPage").numberOfResults;return a!==void 0&&n(vd(a)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Ad(p))},isSetTo(p){return p===this.state.numberOfResults}}}function k1(e){return e.addReducers({pagination:Os,configuration:we}),!0}function nP(e,t={}){let r=rP(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(xe({legacy:Pv(),next:_s()}))}}}d();c();l();u();d();c();l();u();var kv=()=>Fe("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),dg=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var pg=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var oP={id:H,query:Ke},Ns=P("querySet/register",e=>_(e,oP)),Mi=P("querySet/update",e=>_(e,oP));d();c();l();u();var Ds=fe(sd(),e=>{e.addCase(Ns,(t,r)=>_1(t,r.payload)).addCase(Mi,(t,r)=>{let{id:n,query:o}=r.payload;Ov(t,n,o)}).addCase(Fo,(t,r)=>{let{id:n,expression:o}=r.payload;Ov(t,n,o)}).addCase(_e.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;iP(t,n)}).addCase(ot,O1).addCase(tt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))Ov(t,n,o)})});function O1(e,t){J(t.payload.q)||iP(e,t.payload.q)}function iP(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var Ov=(e,t,r)=>{t in e&&(e[t]=r)},_1=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var aP=e=>Fe("analytics/querySuggest",(t,r)=>{let n=N1(r,e);return t.makeOmniboxAnalytics(n)}),sP=()=>({actionCause:"omniboxAnalytics"});function N1(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let i=o.completions.map(m=>m.expression),a=o.partialQueries.length-1,p=o.partialQueries[a]||"",f=o.responseId;return{suggestionRanking:i.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:i,querySuggestResponseId:f}}d();c();l();u();d();c();l();u();function cP(e,t){let r=t.id;r in e||(e[r]=D1(t))}function uP(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function lP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function dP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function D1(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var pP=()=>({});var fg=fe(pP(),e=>e.addCase(Eo,(t,r)=>{cP(t,r.payload)}).addCase(xT,(t,r)=>{delete t[r.payload.id]}).addCase(Es.pending,uP).addCase(Es.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(Es.rejected,lP).addCase(To,(t,r)=>{dP(t,r.payload)}).addCase(_a,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var fP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},_v={open:new $,close:new $},q1={id:H,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new pe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:_v}),exactMatchDelimiters:new Y({values:_v}),correctionDelimiters:new Y({values:_v})}}),clearFilters:new pe},mP=new Oe(q1);function gP(e,t){if(!j1(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=t.options?.id||Mu("search_box"),a={id:i,highlightOptions:{...t.options?.highlightOptions},...fP,...t.options};ht(e,mP,a,"buildSearchBox"),n(Ns({id:i,query:e.state.query.q})),a.numberOfSuggestions&&n(Eo({id:i,count:a.numberOfSuggestions})),a.enableQuerySyntax&&n(Wt({enableQuerySyntax:a.enableQuerySyntax}));let p=()=>e.state.querySet[a.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:A}=a;n(Pa({q:p(),enableQuerySyntax:g,clearFilters:A})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x237){return _ref99.apply(this,arguments)}}();return{...r,updateText(m){n(Mi({id:i,query:m})),this.showSuggestions()},clear(){n(Mi({id:i,query:""})),n(To({id:i}))},showSuggestions(){a.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:i}))},selectSuggestion(m){n(Fo({id:i,expression:m})),f({legacy:aP({id:i,suggestion:m}),next:sP()}).then(()=>{n(To({id:i}))})},submit(m=kv(),g){f({legacy:m,next:g}),n(To({id:i}))},get state(){let m=o(),g=m.querySuggest[a.id],A=M1(g,a.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:i,value:p(),suggestions:A,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function M1(e,t){return e?e.completions.map(r=>({highlightedValue:Wg(r.highlighted,t),rawValue:r.expression})):[]}function j1(e){return e.addReducers({query:Po,querySuggest:fg,configuration:we,querySet:Ds,search:Ee}),!0}function hP(e,t={}){let r=gP(e,{...t,executeSearchActionCreator:xe,fetchQuerySuggestionsActionCreator:md,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(pg(),dg())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var mg=()=>({actionCause:"resultsSort"});function yP(e,t){return e.q!==t.q?dg():e.sortCriteria!==t.sortCriteria?mg():qs(e.f,t.f)?Ms(e.f,t.f):qs(e.fExcluded,t.fExcluded)?Ms(e.fExcluded,t.fExcluded,!0):qs(e.cf,t.cf)?Ms(e.cf,t.cf):qs(e.af,t.af)?Ms(e.af,t.af):qs(e.nf,t.nf)?Ms(gg(e.nf),gg(t.nf)):qs(e.df,t.df)?Ms(gg(e.df),gg(t.df)):va()}function qs(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Ms(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(x=>!o.includes(x));if(i.length){let x=i[0];return e[x].length>1?ir():Ln()}if(o.filter(x=>!n.includes(x)).length)return r?Zf():pr();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return va();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?Zf():pr():f.filter(x=>!m.includes(x)).length?Ln():va()}function gg(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var js=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...ee(t.insightCaseContext)}));function AP(e,t){return e.q!==t.q?pg():e.sortCriteria!==t.sortCriteria?js():Fu(e.f,t.f)?Fu(e.cf,t.cf)?Fu(e.nf,t.nf)?Fu(e.df,t.df)?Fu(e.fExcluded,t.fExcluded)?ro():V1(e.fExcluded,t.fExcluded):vP(e.df,t.df):vP(e.nf,t.nf):hg(e.cf,t.cf):hg(e.f,t.f)}function Fu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function SP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function hg(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(x=>!o.includes(x));if(i.length){let x=i[0];return e[x].length>1?Qt(x):(r?Ss:jr)({facetId:x,facetValue:e[x][0]})}let a=o.filter(x=>!n.includes(x));if(a.length){let x=a[0];return Yt({facetId:x,facetValue:t[x][0]})}let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return ro();let f=e[p],m=t[p],g=m.filter(x=>!f.includes(x));if(g.length)return Yt({facetId:p,facetValue:g[0]});let A=f.filter(x=>!m.includes(x));return A.length?(r?Ss:jr)({facetId:p,facetValue:A[0]}):ro()}function vP(e={},t={}){return hg(SP(e),SP(t))}function V1(e={},t={}){return hg(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:L1,getOwnPropertySymbols:U1}=Object,{hasOwnProperty:Q1}=Object.prototype;function Nv(e,t){return function(n,o,i){return e(n,o,i)&&t(n,o,i)}}function yg(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:i}=o,a=i.get(r),p=i.get(n);if(a&&p)return a===n&&p===r;i.set(r,n),i.set(n,r);let f=e(r,n,o);return i.delete(r),i.delete(n),f}}function CP(e){return L1(e).concat(U1(e))}var B1=Object.hasOwn||((e,t)=>Q1.call(e,t)),G1="__v",$1="__o",H1="_owner",{getOwnPropertyDescriptor:bP,keys:xP}=Object,ji=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function z1(e,t){return e===t}function W1(e,t){return e.byteLength===t.byteLength&&Sg(new Uint8Array(e),new Uint8Array(t))}function Y1(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function K1(e,t){return e.byteLength===t.byteLength&&Sg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function X1(e,t){return ji(e.getTime(),t.getTime())}function Z1(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function wP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),i=e.entries(),a,p,f=0;for(;(a=i.next())&&!a.done;){let m=t.entries(),g=!1,A=0;for(;(p=m.next())&&!p.done;){if(o[A]){A++;continue}let x=a.value,h=p.value;if(r.equals(x[0],h[0],f,A,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[A]=!0;break}A++}if(!g)return!1;f++}return!0}function J1(e,t,r){let n=xP(e),o=n.length;if(xP(t).length!==o)return!1;for(;o-->0;)if(!IP(e,t,r,n[o]))return!1;return!0}function Tu(e,t,r){let n=CP(e),o=n.length;if(CP(t).length!==o)return!1;let i,a,p;for(;o-->0;)if(i=n[o],!IP(e,t,r,i)||(a=bP(e,i),p=bP(t,i),(a||p)&&(!a||!p||a.configurable!==p.configurable||a.enumerable!==p.enumerable||a.writable!==p.writable)))return!1;return!0}function eG(e,t){return ji(e.valueOf(),t.valueOf())}function tG(e,t){return e.source===t.source&&e.flags===t.flags}function RP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),i=e.values(),a,p;for(;(a=i.next())&&!a.done;){let f=t.values(),m=!1,g=0;for(;(p=f.next())&&!p.done;){if(!o[g]&&r.equals(a.value,p.value,a.value,p.value,e,t,r)){m=o[g]=!0;break}g++}if(!m)return!1}return!0}function Sg(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function rG(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function IP(e,t,r,n){return(n===H1||n===$1||n===G1)&&(e.$$typeof||t.$$typeof)?!0:B1(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var nG=Object.prototype.toString;function oG(e){let t=cG(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,y){if(x===h)return!0;if(x==null||h==null)return!1;let b=typeof x;if(b!==typeof h)return!1;if(b!=="object")return b==="number"||b==="bigint"?a(x,h,y):b==="function"?o(x,h,y):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,y);if(w===Array)return r(x,h,y);if(w===Date)return n(x,h,y);if(w===RegExp)return f(x,h,y);if(w===Map)return i(x,h,y);if(w===Set)return m(x,h,y);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,y);let I=nG.call(x),F=t[I];if(F)return F(x,h,y);let E=g&&g(x,h,y,I);return E?E(x,h,y):!1}}function iG({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:W1,areArraysEqual:r?Tu:Y1,areDataViewsEqual:K1,areDatesEqual:X1,areErrorsEqual:Z1,areFunctionsEqual:z1,areMapsEqual:r?Nv(wP,Tu):wP,areNumbersEqual:ji,areObjectsEqual:r?Tu:J1,arePrimitiveWrappersEqual:eG,areRegExpsEqual:tG,areSetsEqual:r?Nv(RP,Tu):RP,areTypedArraysEqual:r?Nv(Sg,Tu):Sg,areUrlsEqual:rG,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=yg(n.areArraysEqual),i=yg(n.areMapsEqual),a=yg(n.areObjectsEqual),p=yg(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:i,areObjectsEqual:a,areSetsEqual:p})}return n}function aG(e){return function(t,r,n,o,i,a,p){return e(t,r,p)}}function sG({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(p,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(p,f){return t(p,f,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let i={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,f){return t(p,f,i)}}function cG({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:A,areTypedArraysEqual:x,areUrlsEqual:h}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":i,"[object BigInt]":p,"[object BigInt64Array]":x,"[object BigUint64Array]":x,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":x,"[object Float32Array]":x,"[object Float64Array]":x,"[object Function]":i,"[object GeneratorFunction]":i,"[object Int8Array]":x,"[object Int16Array]":x,"[object Int32Array]":x,"[object Map]":a,"[object Number]":m,"[object Object]":(y,b,w)=>typeof y.then!="function"&&typeof b.then!="function"&&f(y,b,w),"[object RegExp]":g,"[object Set]":A,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var Dv=xn(),YKe=xn({strict:!0}),KKe=xn({circular:!0}),XKe=xn({circular:!0,strict:!0}),ZKe=xn({createInternalComparator:()=>ji}),JKe=xn({strict:!0,createInternalComparator:()=>ji}),e8e=xn({circular:!0,createInternalComparator:()=>ji}),t8e=xn({circular:!0,createInternalComparator:()=>ji,strict:!0});function xn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,i=iG(e),a=oG(i),p=r?r(a):aG(a);return sG({circular:t,comparator:a,createState:n,equals:p,strict:o})}function EP(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function uG(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>qv(r,n))!==-1)}var qv=xn({createCustomConfig:e=>({...e,areArraysEqual:uG})});d();c();l();u();d();c();l();u();function FP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function TP(e,t,r){if(e===void 0)return{};let n=t(e);return!Dv(n,r)?{sortCriteria:n}:{}}function vg(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([i])=>t(i)).map(([i,{request:a}])=>{let p=r(a);return p.length?{[i]:p}:{}}).reduce((i,a)=>({...i,...a}),{});return Object.keys(o).length?{[n]:o}:{}}function PP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function kP(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??kn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??kn().defaultFilters.cq,firstResult:Yr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Yr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:id(),sf:{},tab:"",af:{},mnf:{}}}var lG=new Oe({parameters:new Y({options:{required:!0},values:ip})});function NP(e,t){let{dispatch:r}=e,n=he(e);gr(e,lG,t.initialState,"buildSearchParameterManager");let o=OP(e.state.tabSet,t.initialState.parameters);return r(ot(o)),{...n,synchronize(i){let a=OP(e.state.tabSet,Ag(e,i));r(ot(a))},get state(){return{parameters:Mv(e)}}}}function Ag(e,t){let n={...kP(e.state),...t},o={};if(e.state.dateFacetSet)for(let a of Object.keys(e.state.dateFacetSet))o[a]=[];let i={};if(e.state.numericFacetSet)for(let a of Object.keys(e.state.numericFacetSet))i[a]=[];return{...n,df:{...o,...n.df},nf:{...i,...n.nf}}}function OP(e,t){if(J(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:_P(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??_P(e)}}return t}function _P(e){return Object.keys(e)[0]??""}function Mv(e){let t=e.state;return{...FP(t.query,r=>r.q,ut().q),...PP(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...TP(t.sortCriteria,r=>r,ur()),...pG(t),...fG(t),...mG(t),...gG(t),...hG(t)}}function dG(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function Cg(e){let t=dG(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,i=or(n?.tabs,t);return o&&i}}function DP(e){return e.currentValues.filter(t=>t.state==="selected")}function pG(e){let t=e.facetSet;if(t===void 0)return{};let r=Cg(e),n={},o={};for(let[i,{request:a}]of Object.entries(t)){if(!r(i))continue;let p=a.currentValues.filter(m=>m.state==="selected").map(m=>m.value),f=a.currentValues.filter(m=>m.state==="excluded").map(m=>m.value);p.length&&(n[i]=p),f.length&&(o[i]=f)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function fG(e){return vg(e.categoryFacetSet,Cg(e),t=>$r(t.currentValues).map(r=>r.value),"cf")}function mG(e){return vg(e.numericFacetSet,Cg(e),DP,"nf")}function gG(e){return vg(e.dateFacetSet,Cg(e),DP,"df")}function hG(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let i=yG(o);return i.length?{[n]:i}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function yG(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function qP(e,t){let{dispatch:r}=e,n=NP(e,t);return{...n,synchronize(o){let i=Mv(e),a=Ag(e,i),p=Ag(e,o);qv(a,p)||(n.synchronize(o),r(xe({legacy:AP(a,p),next:yP(a,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Pu=()=>new Y({values:{questionAnswerId:H},options:{required:!0}}),bg=()=>new Y({values:{linkText:Ke,linkURL:Ke},options:{required:!0}});function Vi(e){return _(e,Pu())}d();c();l();u();function ft(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&rw(e,r.contentIdKey,r.contentIdValue)}function Rr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var MP={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var SG=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),vG=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),AG=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),CG=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),bG=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ft(t);return e.logOpenSmartSnippetSource(Xe(r,t),Ze(r),ee(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),jv=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,bg());let n=ft(r);return t.logOpenSmartSnippetInlineLink(Xe(n,r),{...Ze(n),...e},ee(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),xG=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(ee(t.insightCaseContext))),wG=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(ee(t.insightCaseContext))),RG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:MP[e]}}}),IG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),EG=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Vi(e);let n=Rr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),FG=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Vi(e);let n=Rr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),Vv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,Pu());let n=Rr(r,e.questionAnswerId);if(!n)return null;let o=ft(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Xe(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),jP=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,Pu()),_(t,bg());let o=Rr(n,e.questionAnswerId);if(!o)return null;let i=ft(n,o.documentId);return i?r.logOpenSmartSnippetSuggestionInlineLink(Xe(i,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},ee(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Rr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let i=ft(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:i?.title,url:i?.clickUri}}}}}),xg={logExpandSmartSnippet:SG,logCollapseSmartSnippet:vG,logLikeSmartSnippet:AG,logDislikeSmartSnippet:CG,logOpenSmartSnippetSource:bG,logOpenSmartSnippetInlineLink:jv,logOpenSmartSnippetFeedbackModal:xG,logCloseSmartSnippetFeedbackModal:wG,logSmartSnippetFeedback:RG,logSmartSnippetDetailedFeedback:IG,logExpandSmartSnippetSuggestion:EG,logCollapseSmartSnippetSuggestion:FG,logOpenSmartSnippetSuggestionSource:Vv};d();c();l();u();d();c();l();u();var Vs=P("smartSnippet/expand"),Ls=P("smartSnippet/collapse"),Us=P("smartSnippet/like"),Qs=P("smartSnippet/dislike"),Bs=P("smartSnippet/feedbackModal/open"),_o=P("smartSnippet/feedbackModal/close"),Gs=P("smartSnippet/related/expand",e=>Vi(e)),$s=P("smartSnippet/related/collapse",e=>Vi(e));d();c();l();u();d();c();l();u();var Lv=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var VP=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function LP({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return zi({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function TG(e,t){let r=LP(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var wn=fe(Lv(),e=>e.addCase(Vs,t=>{t.expanded=!0}).addCase(Ls,t=>{t.expanded=!1}).addCase(Us,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Qs,t=>{t.liked=!1,t.disliked=!0}).addCase(Bs,t=>{t.feedbackModalOpen=!0}).addCase(_o,t=>{t.feedbackModalOpen=!1}).addCase(_e.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((i,a)=>TG(i,t.relatedQuestions[a])),o=LP(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...Lv(),relatedQuestions:n,questionAnswerId:o}}).addCase(Gs,(t,r)=>{let n=VP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase($s,(t,r)=>{let n=VP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function UP(e,t,r){if(!PG(e))throw ie;let n=he(e),o=()=>e.state,i=()=>ft(o()),a=null,p=Cn(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let f=i();if(!f){a=null;return}let{searchResponseId:m}=o().search;a!==m&&(a=m,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(bn(f)))});return{...n,get state(){let f=o();return{question:f.search.questionAnswer.question,answer:f.search.questionAnswer.answerSnippet,documentId:f.search.questionAnswer.documentId,expanded:f.questionAnswering.expanded,answerFound:f.search.questionAnswer.answerSnippet!=="",liked:f.questionAnswering.liked,disliked:f.questionAnswering.disliked,feedbackModalOpen:f.questionAnswering.feedbackModalOpen,source:i()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Vs())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ls())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Us())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Qs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Bs())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(_o())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(_o())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(_o())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function PG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}d();c();l();u();function wg(e,t){if(!kG(e))throw ie;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),i=null,a=g=>{i!==g&&(i=g,f={},n.clear())},p=(g,A,x)=>Cn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(A)||e.dispatch(x?jP({questionAnswerId:x},g):jv(g))}),f={},m=(g,A)=>{let{searchResponseId:x}=r().search;a(x);let h=zi({...g,questionAnswerId:A});return h in f||(f[h]=p(g,h,A)),f[h]};return{selectInlineLink(g,A){m(g,A)?.select()},beginDelayedSelectInlineLink(g,A){m(g,A)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,A){m(g,A)?.cancelPendingSelect()}}}function kG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}function QP(e,t){let r=UP(e,xg,t),n=wg(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function BP(e,t){if(!OG(e))throw ie;let r=he(e),n=()=>e.state,o=i=>{let{contentIdKey:a,contentIdValue:p}=i;return e.state.search.results.find(f=>lo(f,a)===p)};return{...r,get state(){let i=n();return{questions:i.search.questionAnswer.relatedQuestions.map((a,p)=>({question:a.question,answer:a.answerSnippet,documentId:a.documentId,questionAnswerId:i.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:i.questionAnswering.relatedQuestions[p].expanded,source:o(a.documentId)}))}},expand(i){let a={questionAnswerId:i};e.dispatch(t.logExpandSmartSnippetSuggestion(a)),e.dispatch(Gs(a))},collapse(i){let a={questionAnswerId:i};e.dispatch(t.logCollapseSmartSnippetSuggestion(a)),e.dispatch($s(a))}}}function OG(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}d();c();l();u();function GP(e,t){if(!_G(e))throw ie;let r=()=>e.state,n=A=>{let x=r(),h=Rr(x,A);return h?ft(x,h.documentId):null},o=new Set,i=A=>o.has(A)?!0:(o.add(A),!1),a=null,p=A=>{a!==A&&(a=A,m={},o.clear())},f=(A,x)=>Cn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{i(x)||(e.dispatch(Vv({questionAnswerId:x})),e.dispatch(bn(A)))}),m={},g=A=>{let{searchResponseId:x}=r().search;p(x);let h=n(A);return h?(A in m||(m[A]=f(h,A)),m[A]):null};return{selectSource(A){g(A)?.select()},beginDelayedSelectSource(A){g(A)?.beginDelayedSelect()},cancelPendingSelectSource(A){g(A)?.cancelPendingSelect()}}}function _G(e){return e.addReducers({search:Ee,questionAnswering:wn}),!0}function $P(e,t){let r=BP(e,xg),n=wg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=GP(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(i){o.selectSource(i)},beginDelayedSelectSource(i){o.beginDelayedSelectSource(i)},cancelPendingSelectSource(i){o.cancelPendingSelectSource(i)},selectInlineLink(i,a){n.selectInlineLink(a,i)},beginDelayedSelectInlineLink(i,a){n.beginDelayedSelectInlineLink(a,i)},cancelPendingSelectInlineLink(i,a){n.cancelPendingSelectInlineLink(a,i)}}}d();c();l();u();d();c();l();u();d();c();l();u();var HP={by:new Js({enum:Ql,required:!0})},Rg=P("sortCriteria/register",e=>zP(e)),Ig=P("sortCriteria/update",e=>zP(e)),zP=e=>Hi(e)?(e.forEach(t=>_(t,HP)),{payload:e}):_(e,HP);d();c();l();u();var WP=fe(ur(),e=>{e.addCase(Rg,(t,r)=>Hr(r.payload)).addCase(Ig,(t,r)=>Hr(r.payload)).addCase(tt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(ot,(t,r)=>r.payload.sortCriteria??t)});function NG(e,t){if(!t)return;let r=new Oe({criterion:new oe({each:Wb})}),n=DG(t),o={...t,criterion:n};gr(e,r,o,"buildSort")}function DG(e){return e.criterion?Hi(e.criterion)?e.criterion:[e.criterion]:[]}function YP(e,t){if(!qG(e))throw ie;let r=he(e),{dispatch:n}=e,o=()=>e.state;NG(e,t.initialState);let i=t.initialState?.criterion;return i&&n(Rg(i)),{...r,sortBy(a){n(Ig(a)),n(no(1))},isSortedBy(a){return this.state.sortCriteria===Hr(a)},get state(){return{sortCriteria:o().sortCriteria}}}}function qG(e){return e.addReducers({configuration:we,sortCriteria:WP}),!0}function KP(e,t={}){let{dispatch:r}=e,n=YP(e,t),o=()=>r(xe({legacy:js(),next:mg()}));return{...n,get state(){return n.state},sortBy(i){n.sortBy(i),o()}}}d();c();l();u();function XP(e){return Ts(e)}d();c();l();u();d();c();l();u();var MG=new Oe({expression:Ke,id:H,clearFiltersOnTabChange:new pe}),jG=new Oe({isActive:new pe});function ZP(e,t){if(LG(t.options.id),!VG(e))throw ie;let r=he(e),{dispatch:n}=e;ht(e,MG,t.options,"buildTab");let o=gr(e,jG,t.initialState,"buildTab"),{id:i,expression:a}=t.options;return n(sp({id:i,expression:a})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(Nt(i)),{...r,select(){t.options.clearFiltersOnTabChange&&n(Pa({q:"",clearFilters:!0})),n(Nt(i))},get state(){return{isActive:e.state.tabSet[i]?.isActive}}}}function VG(e){return e.addReducers({configuration:we,tabSet:Rm}),!0}function LG(e){let t=up().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function JP(e,t){let{dispatch:r}=e,n=ZP(e,t),o=()=>r(xe({legacy:ro(),next:va()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var ek=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},ee(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function tk(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function rk(e,t){let r=[],n=[],o=[],i=[];return t.forEach(a=>{switch(a.type){case"redirect":r.push(a.content);break;case"query":n.push(a.content);break;case"execute":o.push({functionName:a.content.name,params:a.content.params});break;case"notify":i.push(a.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=i,e}function nk(e,t){return e.queryModification={...t,queryToIgnore:""},e}function ok(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var ik=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var ak=fe(ik(),e=>e.addCase(_e.pending,tk).addCase(_e.fulfilled,(t,r)=>rk(t,r.payload.response.triggers)).addCase(Ta,(t,r)=>nk(t,r.payload)).addCase(Fa,(t,r)=>ok(t,r.payload)));function sk(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!UG(e))throw ie;let n=he(e),{dispatch:o}=e,i=()=>e.state,a=i().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!EP(a,this.state.notifications);a=this.state.notifications,m&&(p(),o(r()))};return f(),e.subscribe(f)},get state(){return{notifications:i().triggers.notifications}}}}function UG(e){return e.addReducers({triggers:ak}),!0}function ck(e){return sk(e,{options:{logNotifyTriggerActionCreator:ek}})}d();c();l();u();d();c();l();u();var uk=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=ee(n.insightCaseContext),i={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(i)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=ee(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),lk=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:H}),t.logCreateArticle(e,ee(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=ee(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Eg=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(ee(t.insightCaseContext))});d();c();l();u();d();c();l();u();var dk=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function dk(_x238,_x239){return _ref100.apply(this,arguments)}}();var QG={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new oe({required:!1,each:We})},Hs=P("insight/userActions/registerUserActions",e=>_(e,QG)),No=me("insight/userActions/fetch",/*#__PURE__*/function(){var _ref101=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.userActions(yield dk(o,e));return ze(i)?r(i.error):{response:i.success}});return function(_x240,_x241){return _ref101.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function pk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var BG=1e3,GG=BG*60,Uv=30*GG,$G=2,HG=2,gk=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,i=WG(t);return KG(i,n,o)},zG=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},WG=e=>{let t=!1,r=e.reduce((n,o)=>{try{let i=zG(o);n.push(i)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},YG=(e,t)=>Math.abs(e.timestamp-t)<Uv,fk=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-Uv&&t<=e.end+Uv){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(i=>i.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},mk=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},KG=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(i=>{if(YG(i,o.start)){o.actions.push(i),o.start=i.timestamp;return}o.actions=o.actions.filter(a=>!mk(a,r)),fk(o,t,n),o={start:i.timestamp,end:i.timestamp,actions:[i]}}),o.actions=o.actions.filter(i=>!mk(i,r)),fk(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,$G),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-HG)}};var Fg=fe(pk(),e=>{e.addCase(Hs,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(No.pending,t=>{t.loading=!0,t.error=void 0}).addCase(No.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(No.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=gk(t,r.payload.response.value)})});function hk(e,t){if(!XG(e))throw ie;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=he(e),{ticketCreationDate:i,excludedCustomActions:a}=t.options;return r(Hs({ticketCreationDate:i,excludedCustomActions:a})),{...o,get state(){return n()},fetchUserActions(p){r(No(p))},logOpenUserActions(){r(Eg())}}}function XG(e){return e.addReducers({configuration:we,insightUserActions:Fg}),!0}d();c();l();u();function yk(e){if(!ZG(e))throw ie;let t=he(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(zr())}}}function ZG(e){return e.addReducers({configuration:we,insightConfiguration:Jl,insightInterface:eo,searchHub:Pd}),!0}d();c();l();u();function JG(e){return e.addReducers({}),{logSearchEvent:ux,logClickEvent:lx,logCustomEvent:dx}}d();c();l();u();d();c();l();u();var Sk=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCopyToClipboard(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:qr(t)}}}),vk=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCaseSendEmail(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:qr(t)}}}),Ak=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logFeedItemTextPost(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:kr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:qr(t)}}});function e2(e){return e.addReducers({}),{logClearBreadcrumbs:nm,logInterfaceLoad:ud,logInterfaceChange:ro,logCreateArticle:lk,logCategoryFacetBreadcrumb:Bf,logFacetBreadcrumb:yu,logFacetClearAll:Qt,logFacetDeselect:jr,logFacetSelect:Yt,logFacetShowLess:As,logFacetShowMore:vs,logFacetUpdateSort:pn,logDateFacetBreadcrumb:Su,logNumericFacetBreadcrumb:vu,logPageNext:ag,logPageNumber:ig,logPagePrevious:sg,logResultsSort:js,logStaticFilterDeselect:Cm,logCopyToClipboard:Sk,logCaseSendEmail:vk,logFeedItemTextPost:Ak,logOpenUserActions:Eg}}d();c();l();u();function t2(e){return e.addReducers({attachedResults:Co}),{setAttachedResults:Lf,detachResult:Ao,attachResult:vo}}d();c();l();u();function r2(e){return e.addReducers({attachedResults:Co}),{logCaseDetach:us,logCaseAttach:cs}}d();c();l();u();d();c();l();u();d();c();l();u();var Tg=P("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new oe({each:Ke}),i=_(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Pg=P("insight/caseId/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}}),kg=P("insight/caseNumber/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}});var Ck=fe(Sx(),e=>{e.addCase(Tg,(t,r)=>{t.caseContext=r.payload}).addCase(Pg,(t,r)=>{t.caseId=r.payload}).addCase(kg,(t,r)=>{t.caseNumber=r.payload})});function n2(e){return e.addReducers({insightCaseContext:Ck}),{setCaseContext:Tg,setCaseId:Pg,setCaseNumber:kg}}d();c();l();u();d();c();l();u();d();c();l();u();var o2=new oe({each:H,required:!0}),bk=(e,t)=>(_(e,H),$i(t)?_(t,H):_(t,o2),{payload:{contextKey:e,contextValue:t}}),Og=P("context/set",e=>{for(let[t,r]of Object.entries(e))bk(t,r);return{payload:e}}),_g=P("context/add",e=>bk(e.contextKey,e.contextValue)),Ng=P("context/remove",e=>_(e,H));var xk=fe(od(),e=>{e.addCase(Og,(t,r)=>{t.contextValues=r.payload}).addCase(_g,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Ng,(t,r)=>{delete t.contextValues[r.payload]}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function i2(e){return e.addReducers({context:xk}),{addContext:_g,removeContext:Ng,setContext:Og}}d();c();l();u();function a2(e){return e.addReducers({dateFacetSet:yn}),{deselectAllDateFacetValues:am,registerDateFacet:fn,toggleSelectDateFacetValue:mn,toggleExcludeDateFacetValue:gn,updateDateFacetSortCriterion:im,updateDateFacetValues:Qn}}d();c();l();u();function s2(e){return e.addReducers({numericFacetSet:Ro}),{deselectAllNumericFacetValues:vm,registerNumericFacet:Sn,toggleSelectNumericFacetValue:vn,toggleExcludeNumericFacetValue:An,updateNumericFacetSortCriterion:Sm,updateNumericFacetValues:Bn}}d();c();l();u();function c2(e){return e.addReducers({fields:Fs}),{registerFieldsToInclude:ko,enableFetchAllFields:Zm,disableFetchAllFields:Jm,fetchFieldsDescription:eg}}d();c();l();u();function u2(e){return e.addReducers({folding:Xm}),{registerFolding:vT,loadCollection:Wm}}d();c();l();u();function l2(e){return e.addReducers({generatedAnswer:Ps}),{generateAnswer:rp,resetAnswer:lr,setAnswerGenerationMode:La}}d();c();l();u();function d2(e){return e.addReducers({insightInterface:eo}),{fetch:zr}}d();c();l();u();function p2(e){return e.addReducers({querySet:Ds}),{registerQuerySetQuery:Ns,updateQuerySetQuery:Mi}}d();c();l();u();function f2(e){return e.addReducers({search:Ee}),{executeSearch:Nx,fetchFacetValues:Mx,fetchMoreResults:qx,fetchPage:Dx,fetchQuerySuggestions:md,registerQuerySuggest:Eo}}d();c();l();u();function m2(e){return e.addReducers({}),{logContextChanged:Px,logExpandToFullUI:uk}}d();c();l();u();function g2(e){return e.addReducers({insightUserActions:Fg}),{registerUserActions:Hs,fetchUserActions:No}}d();c();l();u();function h2(e){return e.addReducers({querySuggest:fg,querySet:Ds}),{clearQuerySuggest:To,fetchQuerySuggestions:Es,registerQuerySuggest:Eo,selectQuerySuggestion:Fo}}d();c();l();u();function y2(e){return e.addReducers({questionAnswering:wn}),{collapseSmartSnippet:Ls,expandSmartSnippet:Vs,dislikeSmartSnippet:Qs,likeSmartSnippet:Us,openFeedbackModal:Bs,closeFeedbackModal:_o,expandSmartSnippetRelatedQuestion:Gs,collapseSmartSnippetRelatedQuestion:$s}}d();c();l();u();d();c();l();u();d();c();l();u();function wk(){return{results:[],maxLength:10}}var Rk=fe(wk(),e=>{e.addCase(ug,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(lg,t=>{t.results=[]}).addCase(bn,(t,r)=>{let n=r.payload;t.results=t.results.filter(i=>i.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function S2(e){return e.addReducers({recentResults:Rk}),{registerRecentResults:ug,clearRecentResults:lg,pushRecentResult:bn}}d();c();l();u();d();c();l();u();var v2=new Oe({content:new He({required:!0}),conditions:new He({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new oe({required:!1,each:H})});function Ik(){let e=[],t=r=>{let n=v2.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new Do("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function Ek(e){if(!A2(e))throw ie;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Ik();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(ko(i))},selectTemplate:r,selectLinkTemplate:n}}function A2(e){return e.addReducers({fields:Fs}),!0}/**
47
47
  * @license
48
48
  *
49
49
  * Copyright 2026 Coveo Solutions Inc.
@@ -76,4 +76,4 @@ fast-json-patch/module/duplex.mjs:
76
76
  *)
77
77
  */if(__exports!=exports)module.exports=exports;return module.exports});
78
78
 
79
- window.coveoQuanticVersion = '3.43.6';
79
+ window.coveoQuanticVersion = '3.44.1';