@coveo/quantic 3.37.5 → 3.37.7

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.
@@ -14,35 +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 UP=Object.create;var Us=Object.defineProperty;var QP=Object.getOwnPropertyDescriptor;var BP=Object.getOwnPropertyNames;var GP=Object.getPrototypeOf,$P=Object.prototype.hasOwnProperty;var HP=(e,t,r)=>t in e?Us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var qi=(e,t)=>()=>(e&&(t=e(e=0)),t);var It=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qs=(e,t)=>{for(var r in t)Us(e,r,{get:t[r],enumerable:!0})},yv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of BP(t))!$P.call(e,o)&&o!==r&&Us(e,o,{get:()=>t[o],enumerable:!(n=QP(t,o))||n.enumerable});return e};var Er=(e,t,r)=>(r=e!=null?UP(GP(e)):{},yv(t||!e||!e.__esModule?Us(r,"default",{value:e,enumerable:!0}):r,e)),zP=e=>yv(Us({},"__esModule",{value:!0}),e);var De=(e,t,r)=>HP(e,typeof t!="symbol"?t+"":t,r);var y,c=qi(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function wu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?wu=function(t){return typeof t}:wu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(e)}function KP(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=XP.bind(this))}function XP(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","*/*"),WP(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):YP(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var WP,YP,u=qi(()=>{"use strict";WP=function(t){return typeof t=="string"},YP=function(t){return t instanceof Blob};KP.call((typeof window>"u"?"undefined":wu(window))==="object"?window:{})});var hg=It(Bs=>{"use strict";d();c();l();u();Object.defineProperty(Bs,"__esModule",{value:!0});function Sv(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 JP(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ZP(e,t,r){return t=Mi(t),tk(e,bv()?Reflect.construct(t,r||[],Mi(e).constructor):t.apply(e,r))}function fg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vv(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,ik(n.key),n)}}function mg(e,t,r){return t&&vv(e.prototype,t),r&&vv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Av(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ak(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=rk(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 Mi(e){return Mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mi(e)}function ek(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&&pg(e,t)}function bv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bv=function(){return!!e})()}function tk(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 JP(e)}function pg(e,t){return pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},pg(e,t)}function rk(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Mi(e))!==null;);return e}function nk(e,t,r,n){var o=dg(Mi(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function ok(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 ik(e){var t=ok(e,"string");return typeof t=="symbol"?t:t+""}function ak(e,t){if(e){if(typeof e=="string")return Sv(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)?Sv(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function sk(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 ck(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 Cv=function(){function e(){fg(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],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 h=i[p];try{h.callback.call(n,r)}catch(C){Promise.resolve().then(function(){throw C})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},p=0,f=i.length;p<f;p++)a();return!r.defaultPrevented}}}])}(),gg=function(e){function t(){var r;return fg(this,t),r=ZP(this,t),r.listeners||Cv.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 ek(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)),nk(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 Ru;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 Ru;function i(){o.abort(this.reason),a()}function a(){var h=Av(n),C;try{for(h.s();!(C=h.n()).done;){var b=C.value;b.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var p=Av(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(h){p.e(h)}finally{p.f()}return o.signal}}])}(Cv),Ru=function(){function e(){fg(this,e),Object.defineProperty(this,"signal",{value:new gg,writable:!0,configurable:!0})}return mg(e,[{key:"abort",value:function(r){var n=ck(r),o=sk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ru.prototype[Symbol.toStringTag]="AbortController",gg.prototype[Symbol.toStringTag]="AbortSignal");function uk(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 lk(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(!uk({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(b,g){var S;g&&g.signal&&(S=g.signal,delete g.signal);var x=new o(b,g);return S&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:S}),x},f.prototype=o.prototype);var m=r,h=function(b,g){var S=f&&f.prototype.isPrototypeOf(b)?b.signal:g?g.signal:void 0;if(S){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(S.aborted)return Promise.reject(x);var w=new Promise(function(R,P){S.addEventListener("abort",function(){return P(x)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([w,m(b,g)])}return m(b,g)};return{fetch:h,Request:f}}Bs.AbortController=Ru;Bs.AbortSignal=gg;Bs.abortableFetch=lk});var xv,s,v,l=qi(()=>{"use strict";xv=Er(hg(),1),s=Er(hg(),1),{fetch:v}=(0,xv.abortableFetch)({fetch})});function yg(e){return typeof e!="string"||e in{}}function Sg(){return Object.create(null)}function wv(e){return typeof e=="string"&&!!e.trim()}function vg(e,t){var r=e.split(";").filter(wv),n=r.shift(),o=dk(n),i=o.name,a=o.value;if(t=t?Object.assign({},Iu,t):Iu,yg(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=Sg();return p.name=i,p.value=a,r.forEach(function(f){var m=f.split("="),h=m.shift().trimLeft().toLowerCase();if(!yg(h)){var C=m.join("=");if(h==="expires")p.expires=new Date(C);else if(h==="max-age"){var b=parseInt(C,10);Number.isNaN(b)||(p.maxAge=b)}else h==="secure"?p.secure=!0:h==="httponly"?p.httpOnly=!0:h==="samesite"?p.sameSite=C:h==="partitioned"?p.partitioned=!0:h&&(p[h]=C)}}),p}function dk(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Vi(e,t){if(t=t?Object.assign({},Iu,t):Iu,!e)return t.map?Sg():[];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(wv),n&&(e=e.map(Eu).flat()),t.map){var i=Sg();return e.reduce(function(a,p){var f=vg(p,t);return f&&!yg(f.name)&&(a[f.name]=f),a},i)}else return e.map(function(a){return vg(a,t)}).filter(Boolean)}function Eu(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 Iu,Rv=qi(()=>{"use strict";d();c();l();u();Iu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Vi.parseSetCookie=Vi;Vi.parse=Vi;Vi.parseString=vg;Vi.splitCookiesString=Eu});function Gs(e){if(pk.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Ag(e){return e.replace(fk,"")}function $s(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||!mk(r))return!1}return!0}function mk(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Ev(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 pk,Iv,fk,Fv,ji,Cg,Tv,A,kv=qi(()=>{"use strict";d();c();l();u();Rv();pk=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Iv=[`
19
- `,"\r","\t"," "],fk=new RegExp(`(^[${Iv.join("")}]|$[${Iv.join("")}])`,"g");ji=Symbol("normalizedHeaders"),Cg=Symbol("rawHeaderNames"),Tv=", ",A=class Pv{constructor(t){this[ji]={},this[Cg]=new Map,this[Fv]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Pv||typeof y.Headers<"u"&&t instanceof y.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(Tv):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Tv):n)})}[(Fv=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[ji]).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(!$s(t))throw new TypeError(`Invalid header name "${t}"`);return this[ji].hasOwnProperty(Gs(t))}get(t){if(!$s(t))throw TypeError(`Invalid header name "${t}"`);return this[ji][Gs(t)]??null}set(t,r){if(!$s(t)||!Ev(r))return;let n=Gs(t),o=Ag(r);this[ji][n]=Ag(o),this[Cg].set(n,t)}append(t,r){if(!$s(t)||!Ev(r))return;let n=Gs(t),o=Ag(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!$s(t)||!this.has(t))return;let r=Gs(t);delete this[ji][r],this[Cg].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===""?[""]:Eu(t)}}});var d=qi(()=>{"use strict";kv()});var Vv=It(Ws=>{"use strict";d();c();l();u();var Nu=Ws&&Ws.__assign||function(){return Nu=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},Nu.apply(this,arguments)};Object.defineProperty(Ws,"__esModule",{value:!0});var xk={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function wk(e){var t=Nu(Nu({},xk),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Ws.getSanitizedOptions=wk});var jv=It(Rg=>{"use strict";d();c();l();u();Object.defineProperty(Rg,"__esModule",{value:!0});function Rk(e){var t=Math.random()*e;return Math.round(t)}Rg.fullJitter=Rk});var Lv=It(Ig=>{"use strict";d();c();l();u();Object.defineProperty(Ig,"__esModule",{value:!0});function Ik(e){return e}Ig.noJitter=Ik});var Uv=It(Eg=>{"use strict";d();c();l();u();Object.defineProperty(Eg,"__esModule",{value:!0});var Ek=jv(),Fk=Lv();function Tk(e){return e.jitter==="full"?Ek.fullJitter:Fk.noJitter}Eg.JitterFactory=Tk});var Tg=It(Fg=>{"use strict";d();c();l();u();Object.defineProperty(Fg,"__esModule",{value:!0});var Pk=Uv(),kk=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=Pk.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}();Fg.Delay=kk});var Qv=It(xn=>{"use strict";d();c();l();u();var Ok=xn&&xn.__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)}}(),_k=xn&&xn.__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(h){try{m(n.next(h))}catch(C){a(C)}}function f(h){try{m(n.throw(h))}catch(C){a(C)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},Nk=xn&&xn.__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(h){return f([m,h])}}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(h){m=[6,h],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(xn,"__esModule",{value:!0});var Dk=Tg(),qk=function(e){Ok(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return _k(this,void 0,void 0,function(){return Nk(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}(Dk.Delay);xn.SkipFirstDelay=qk});var Bv=It(Ys=>{"use strict";d();c();l();u();var Mk=Ys&&Ys.__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(Ys,"__esModule",{value:!0});var Vk=Tg(),jk=function(e){Mk(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Vk.Delay);Ys.AlwaysDelay=jk});var Gv=It(Pg=>{"use strict";d();c();l();u();Object.defineProperty(Pg,"__esModule",{value:!0});var Lk=Qv(),Uk=Bv();function Qk(e,t){var r=Bk(e);return r.setAttemptNumber(t),r}Pg.DelayFactory=Qk;function Bk(e){return e.delayFirstAttempt?new Uk.AlwaysDelay(e):new Lk.SkipFirstDelay(e)}});var $v=It(Oo=>{"use strict";d();c();l();u();var kg=Oo&&Oo.__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(h){try{m(n.next(h))}catch(C){a(C)}}function f(h){try{m(n.throw(h))}catch(C){a(C)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},Og=Oo&&Oo.__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(h){return f([m,h])}}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(h){m=[6,h],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(Oo,"__esModule",{value:!0});var Gk=Vv(),$k=Gv();function Hk(e,t){return t===void 0&&(t={}),kg(this,void 0,void 0,function(){var r,n;return Og(this,function(o){switch(o.label){case 0:return r=Gk.getSanitizedOptions(t),n=new zk(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Oo.backOff=Hk;var zk=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return kg(this,void 0,void 0,function(){var t,r;return Og(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 kg(this,void 0,void 0,function(){var t;return Og(this,function(r){switch(r.label){case 0:return t=$k.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var qu=It((_g,Ng)=>{"use strict";d();c();l();u();(function(e,t){typeof _g=="object"&&typeof Ng<"u"?Ng.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(_g,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",p="day",f="week",m="month",h="quarter",C="year",b="date",g="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,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])+"]"}},R=function(N,D,M){var W=String(N);return!W||W.length>=D?N:""+Array(D+1-W.length).join(M)+N},P={s:R,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),H=M%60;return(D<=0?"+":"-")+R(W,2,"0")+":"+R(H,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()),H=D.clone().add(W,m),re=M-H<0,J=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-H)/(re?H-J:J-H))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:C,w:f,d:p,D:b,h:a,m:i,s:o,ms:n,Q:h}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",_={};_[E]=w;var F="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[F])},G=function N(D,M,W){var H;if(!D)return E;if(typeof D=="string"){var re=D.toLowerCase();_[re]&&(H=re),M&&(_[re]=M,H=re);var J=D.split("-");if(!H&&J.length>1)return N(J[0])}else{var K=D.name;_[K]=D,H=K}return!W&&H&&(E=H),H||!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)},j=P;j.l=G,j.i=q,j.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[F]=!0}var D=N.prototype;return D.parse=function(M){this.$d=function(W){var H=W.date,re=W.utc;if(H===null)return new Date(NaN);if(j.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var J=H.match(S);if(J){var K=J[2]-1||0,se=(J[7]||"0").substring(0,3);return re?new Date(Date.UTC(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)):new Date(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)}}return new Date(H)}(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 j},D.isValid=function(){return this.$d.toString()!==g},D.isSame=function(M,W){var H=Q(M);return this.startOf(W)<=H&&H<=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,H){return j.u(M)?this[W]:this.set(H,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var H=this,re=!!j.u(W)||W,J=j.p(M),K=function(Re,xe){var Pe=j.w(H.$u?Date.UTC(H.$y,xe,Re):new Date(H.$y,xe,Re),H);return re?Pe:Pe.endOf(p)},se=function(Re,xe){return j.w(H.toDate()[Re].apply(H.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(xe)),H)},ye=this.$W,qe=this.$M,ot=this.$D,Be="set"+(this.$u?"UTC":"");switch(J){case C:return re?K(1,0):K(31,11);case m:return re?K(1,qe):K(0,qe+1);case f:var et=this.$locale().weekStart||0,tt=(ye<et?ye+7:ye)-et;return K(re?ot-tt:ot+(6-tt),qe);case p:case b:return se(Be+"Hours",0);case a:return se(Be+"Minutes",1);case i:return se(Be+"Seconds",2);case o:return se(Be+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var H,re=j.p(M),J="set"+(this.$u?"UTC":""),K=(H={},H[p]=J+"Date",H[b]=J+"Date",H[m]=J+"Month",H[C]=J+"FullYear",H[a]=J+"Hours",H[i]=J+"Minutes",H[o]=J+"Seconds",H[n]=J+"Milliseconds",H)[re],se=re===p?this.$D+(W-this.$W):W;if(re===m||re===C){var ye=this.clone().set(b,1);ye.$d[K](se),ye.init(),this.$d=ye.set(b,Math.min(this.$D,ye.daysInMonth())).$d}else K&&this.$d[K](se);return this.init(),this},D.set=function(M,W){return this.clone().$set(M,W)},D.get=function(M){return this[j.p(M)]()},D.add=function(M,W){var H,re=this;M=Number(M);var J=j.p(W),K=function(qe){var ot=Q(re);return j.w(ot.date(ot.date()+Math.round(qe*M)),re)};if(J===m)return this.set(m,this.$M+M);if(J===C)return this.set(C,this.$y+M);if(J===p)return K(1);if(J===f)return K(7);var se=(H={},H[i]=t,H[a]=r,H[o]=e,H)[J]||1,ye=this.$d.getTime()+M*se;return j.w(ye,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,H=this.$locale();if(!this.isValid())return H.invalidDate||g;var re=M||"YYYY-MM-DDTHH:mm:ssZ",J=j.z(this),K=this.$H,se=this.$m,ye=this.$M,qe=H.weekdays,ot=H.months,Be=H.meridiem,et=function(xe,Pe,Ie,gt){return xe&&(xe[Pe]||xe(W,re))||Ie[Pe].slice(0,gt)},tt=function(xe){return j.s(K%12||12,xe,"0")},Re=Be||function(xe,Pe,Ie){var gt=xe<12?"AM":"PM";return Ie?gt.toLowerCase():gt};return re.replace(x,function(xe,Pe){return Pe||function(Ie){switch(Ie){case"YY":return String(W.$y).slice(-2);case"YYYY":return j.s(W.$y,4,"0");case"M":return ye+1;case"MM":return j.s(ye+1,2,"0");case"MMM":return et(H.monthsShort,ye,ot,3);case"MMMM":return et(ot,ye);case"D":return W.$D;case"DD":return j.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return et(H.weekdaysMin,W.$W,qe,2);case"ddd":return et(H.weekdaysShort,W.$W,qe,3);case"dddd":return qe[W.$W];case"H":return String(K);case"HH":return j.s(K,2,"0");case"h":return tt(1);case"hh":return tt(2);case"a":return Re(K,se,!0);case"A":return Re(K,se,!1);case"m":return String(se);case"mm":return j.s(se,2,"0");case"s":return String(W.$s);case"ss":return j.s(W.$s,2,"0");case"SSS":return j.s(W.$ms,3,"0");case"Z":return J}return null}(xe)||J.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,H){var re,J=this,K=j.p(W),se=Q(M),ye=(se.utcOffset()-this.utcOffset())*t,qe=this-se,ot=function(){return j.m(J,se)};switch(K){case C:re=ot()/12;break;case m:re=ot();break;case h:re=ot()/3;break;case f:re=(qe-ye)/6048e5;break;case p:re=(qe-ye)/864e5;break;case a:re=qe/r;break;case i:re=qe/t;break;case o:re=qe/e;break;default:re=qe}return H?re:j.a(re)},D.daysInMonth=function(){return this.endOf(m).$D},D.$locale=function(){return _[this.$L]},D.locale=function(M,W){if(!M)return this.$L;var H=this.clone(),re=G(M,W,!0);return re&&(H.$L=re),H},D.clone=function(){return j.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",C],["$D",b]].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=_[E],Q.Ls=_,Q.p={},Q})});var Kv=It((Dg,qg)=>{"use strict";d();c();l();u();(function(e,t){typeof Dg=="object"&&typeof qg<"u"?qg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(Dg,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(),h=!!m.u(f)||f;if(m.p(p)===t){var C=this.quarter()-1;return h?this.month(3*C).startOf(e).startOf("day"):this.month(3*C+2).endOf(e).endOf("day")}return a.bind(this)(p,f)}}})});var Xv=It((Mg,Vg)=>{"use strict";d();c();l();u();(function(e,t){typeof Mg=="object"&&typeof Vg<"u"?Vg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(Mg,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(S){return(S=+S)+(S>68?1900:2e3)},f=function(S){return function(x){this[S]=+x}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var w=x.match(/([+-]|\d\d)/g),R=60*w[1]+(+w[2]||0);return R===0?0:w[0]==="+"?-R:R}(S)}],h=function(S){var x=a[S];return x&&(x.indexOf?x:x.s.concat(x.f))},C=function(S,x){var w,R=a.meridiem;if(R){for(var P=1;P<=24;P+=1)if(S.indexOf(R(P,0,x))>-1){w=P>12;break}}else w=S===(x?"pm":"PM");return w},b={A:[i,function(S){this.afternoon=C(S,!1)}],a:[i,function(S){this.afternoon=C(S,!0)}],Q:[r,function(S){this.month=3*(S-1)+1}],S:[r,function(S){this.milliseconds=100*+S}],SS:[n,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],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(S){var x=a.ordinal,w=S.match(/\d+/);if(this.day=w[0],x)for(var R=1;R<=31;R+=1)x(R).replace(/\[|\]/g,"")===S&&(this.day=R)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[i,function(S){var x=h("months"),w=(h("monthsShort")||x.map(function(R){return R.slice(0,3)})).indexOf(S)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(S){var x=h("months").indexOf(S)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(S){this.year=p(S)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function g(S){var x,w;x=S,w=a&&a.formats;for(var R=(S=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,j,B){var L=B&&B.toUpperCase();return j||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),P=R.length,E=0;E<P;E+=1){var _=R[E],F=b[_],q=F&&F[0],G=F&&F[1];R[E]=G?{regex:q,parser:G}:_.replace(/^\[|\]$/g,"")}return function(Q){for(var j={},B=0,L=0;B<P;B+=1){var N=R[B];if(typeof N=="string")L+=N.length;else{var D=N.regex,M=N.parser,W=Q.slice(L),H=D.exec(W)[0];M.call(j,H),Q=Q.replace(H,"")}}return function(re){var J=re.afternoon;if(J!==void 0){var K=re.hours;J?K<12&&(re.hours+=12):K===12&&(re.hours=0),delete re.afternoon}}(j),j}}return function(S,x,w){w.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(p=S.parseTwoDigitYear);var R=x.prototype,P=R.parse;R.parse=function(E){var _=E.date,F=E.utc,q=E.args;this.$u=F;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,j=q[3]===!0,B=Q||j,L=q[2];j&&(L=q[2]),a=this.$locale(),!Q&&L&&(a=w.Ls[L]),this.$d=function(W,H,re,J){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*W);var K=g(H)(W),se=K.year,ye=K.month,qe=K.day,ot=K.hours,Be=K.minutes,et=K.seconds,tt=K.milliseconds,Re=K.zone,xe=K.week,Pe=new Date,Ie=qe||(se||ye?1:Pe.getDate()),gt=se||Pe.getFullYear(),vt=0;se&&!ye||(vt=ye>0?ye-1:Pe.getMonth());var Rr,ar=ot||0,Mr=Be||0,pr=et||0,Ir=tt||0;return Re?new Date(Date.UTC(gt,vt,Ie,ar,Mr,pr,Ir+60*Re.offset*1e3)):re?new Date(Date.UTC(gt,vt,Ie,ar,Mr,pr,Ir)):(Rr=new Date(gt,vt,Ie,ar,Mr,pr,Ir),xe&&(Rr=J(Rr).week(xe).toDate()),Rr)}catch{return new Date("")}}(_,G,F,w),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&_!=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 P.call(this,E)}}})});var Fw=It((Hy,zy)=>{"use strict";d();c();l();u();(function(e,t){typeof Hy=="object"&&typeof zy<"u"?zy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(Hy,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(h,C,b){b===void 0&&(b={});var g=new Date(h),S=function(x,w){w===void 0&&(w={});var R=w.timeZoneName||"short",P=x+"|"+R,E=t[P];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:R}),t[P]=E),E}(C,b);return S.formatToParts(g)},p=function(h,C){for(var b=a(h,C),g=[],S=0;S<b.length;S+=1){var x=b[S],w=x.type,R=x.value,P=e[w];P>=0&&(g[P]=parseInt(R,10))}var E=g[3],_=E===24?0:E,F=g[0]+"-"+g[1]+"-"+g[2]+" "+_+":"+g[4]+":"+g[5]+":000",q=+h;return(o.utc(F).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(h,C){h===void 0&&(h=i);var b,g=this.utcOffset(),S=this.toDate(),x=S.toLocaleString("en-US",{timeZone:h}),w=Math.round((S-new Date(x))/1e3/60),R=15*-Math.round(S.getTimezoneOffset()/15)-w;if(!Number(R))b=this.utcOffset(0,C);else if(b=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(R,!0),C){var P=b.utcOffset();b=b.add(g-P,"minute")}return b.$x.$timezone=h,b},f.offsetName=function(h){var C=this.$x.$timezone||o.tz.guess(),b=a(this.valueOf(),C,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return b&&b.value};var m=f.startOf;f.startOf=function(h,C){if(!this.$x||!this.$x.$timezone)return m.call(this,h,C);var b=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(b,h,C).tz(this.$x.$timezone,!0)},o.tz=function(h,C,b){var g=b&&C,S=b||C||i,x=p(+o(),S);if(typeof h!="string")return o(h).tz(S);var w=function(_,F,q){var G=_-60*F*1e3,Q=p(G,q);if(F===Q)return[G,F];var j=p(G-=60*(Q-F)*1e3,q);return Q===j?[G,Q]:[_-60*Math.min(Q,j)*1e3,Math.max(Q,j)]}(o.utc(h,g).valueOf(),x,S),R=w[0],P=w[1],E=o(R).utcOffset(P);return E.$x.$timezone=S,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var Tw=It((Wy,Yy)=>{"use strict";d();c();l();u();(function(e,t){typeof Wy=="object"&&typeof Yy<"u"?Yy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(Wy,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(g){var S={date:g,utc:!0,args:arguments};return new o(S)},a.utc=function(g){var S=i(this.toDate(),{locale:this.$L,utc:!0});return g?S.add(this.utcOffset(),e):S},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var p=a.parse;a.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),p.call(this,g)};var f=a.init;a.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else f.call(this)};var m=a.utcOffset;a.utcOffset=function(g,S){var x=this.$utils().u;if(x(g))return this.$u?0:x(this.$offset)?m.call(this):this.$offset;if(typeof g=="string"&&(g=function(E){E===void 0&&(E="");var _=E.match(t);if(!_)return null;var F=(""+_[0]).match(r)||["-",0,0],q=F[0],G=60*+F[1]+ +F[2];return G===0?0:q==="+"?G:-G}(g),g===null))return this;var w=Math.abs(g)<=16?60*g:g;if(w===0)return this.utc(S);var R=this.clone();if(S)return R.$offset=w,R.$u=!1,R;var P=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(w+P,e)).$offset=w,R.$x.$localOffset=P,R};var h=a.format;a.format=function(g){var S=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,S)},a.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var C=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():C.call(this)};var b=a.diff;a.diff=function(g,S,x){if(g&&this.$u===g.$u)return b.call(this,g,S,x);var w=this.local(),R=i(g).local();return b.call(w,R,S,x)}}})});var qI=It((Wbe,DI)=>{"use strict";d();c();l();u();function gL(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}DI.exports=hL;function hL(e,t,r){var n=r&&r.stringify||gL,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="",h=1-o,C=-1,b=e&&e.length||0,g=0;g<b;){if(e.charCodeAt(g)===37&&g+1<b){switch(C=C>-1?C:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=f||t[h]==null)break;C<g&&(m+=e.slice(C,g)),m+=Number(t[h]),C=g+2,g++;break;case 105:if(h>=f||t[h]==null)break;C<g&&(m+=e.slice(C,g)),m+=Math.floor(Number(t[h])),C=g+2,g++;break;case 79:case 111:case 106:if(h>=f||t[h]===void 0)break;C<g&&(m+=e.slice(C,g));var S=typeof t[h];if(S==="string"){m+="'"+t[h]+"'",C=g+2,g++;break}if(S==="function"){m+=t[h].name||"<anonymous>",C=g+2,g++;break}m+=n(t[h]),C=g+2,g++;break;case 115:if(h>=f)break;C<g&&(m+=e.slice(C,g)),m+=String(t[h]),C=g+2,g++;break;case 37:C<g&&(m+=e.slice(C,g)),m+="%",C=g+2,g++,h--;break}++h}++g}return C===-1?e:(C<b&&(m+=e.slice(C)),m)}});var QI=It((Zbe,mf)=>{"use strict";d();c();l();u();var MI=qI();mf.exports=qn;var nu=kL().console||{},yL={mapHttpRequest:ff,mapHttpResponse:ff,wrapRequestSerializer:MS,wrapResponseSerializer:MS,wrapErrorSerializer:MS,req:ff,res:ff,err:jI,errWithCause:jI};function mo(e,t){return e==="silent"?1/0:t.levels.values[e]}var LS=Symbol("pino.logFuncs"),VS=Symbol("pino.hierarchy"),SL={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function VI(e,t){let r={logger:t,parent:e[VS]};t[VS]=r}function vL(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:nu[o]||nu[SL[o]||"log"]||es}),e[LS]=n}function AL(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function qn(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||nu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=AL(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(x){r[x]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=es),vL(m,p,r),VI({},m),Object.defineProperty(m,"levelVal",{get:C}),Object.defineProperty(m,"level",{get:b,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:p,timestamp:FL(e),messageKey:e.messageKey||"msg",onChild:e.onChild||es};m.levels=CL(e),m.level=f,m.isLevelEnabled=function(x){return this.levels.values[x]?this.levels.values[x]>=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=es,m.serializers=n,m._serialize=o,m._stdErrSerialize=i,m.child=function(...x){return S.call(this,h,...x)},t&&(m._logEvent=jS());function C(){return mo(this.level,this)}function b(){return this._level}function g(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,Fi(this,h,m,"error"),Fi(this,h,m,"fatal"),Fi(this,h,m,"warn"),Fi(this,h,m,"info"),Fi(this,h,m,"debug"),Fi(this,h,m,"trace"),a.forEach(w=>{Fi(this,h,m,w)})}function S(x,w,R){if(!w)throw new Error("missing bindings for child Pino");R=R||{},o&&w.serializers&&(R.serializers=w.serializers);let P=R.serializers;if(o&&P){var E=Object.assign({},n,P),_=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,US([w],_,E,this._stdErrSerialize)}function F(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=_),t&&(this._logEvent=jS([].concat(G._logEvent.bindings,w)))}F.prototype=this;let q=new F(this);return VI(this,q),q.child=function(...G){return S.call(this,x,...G)},q.level=R.level||this.level,x.onChild(q),q}return m}function CL(e){let t=e.customLevels||{},r=Object.assign({},qn.levels.values,t),n=Object.assign({},qn.levels.labels,bL(t));return{values:r,labels:n}}function bL(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}qn.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"}};qn.stdSerializers=yL;qn.stdTimeFunctions=Object.assign({},{nullTime:LI,epochTime:UI,unixTime:TL,isoTime:PL});function xL(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[VS];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Fi(e,t,r,n){if(Object.defineProperty(e,n,{value:mo(e.level,r)>mo(n,r)?es:r[LS][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===es){if(!t.transmit)return;let i=t.transmit.level||e.level,a=mo(i,r);if(mo(n,r)<a)return}e[n]=RL(e,t,r,n);let o=xL(e);o.length!==0&&(e[n]=wL(o,e[n]))}function wL(e,t){return function(){return t.apply(this,[...e,...arguments])}}function RL(e,t,r,n){return function(o){return function(){let a=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===nu?nu:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var h=!1;if(t.serialize&&(US(p,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?o.call(f,...IL(this,n,p,a,t)):o.apply(f,p),t.transmit){let C=t.transmit.level||e._level,b=mo(C,r),g=mo(n,r);if(g<b)return;EL(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:C,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:mo(e._level,r)},p,h)}}}(e[LS][n])}function IL(e,t,r,n,o){let{level:i,log:a=C=>C}=o.formatters||{},p=r.slice(),f=p[0],m={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(m.time=n),i){let C=i(t,e.levels.values[t]);Object.assign(m,C)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;h--&&typeof p[0]=="object";)Object.assign(m,p.shift());return[a(m),...p]}else{if(f!==null&&typeof f=="object"){for(;h--&&typeof p[0]=="object";)Object.assign(m,p.shift());f=p.length?MI(p.shift(),p):void 0}else typeof f=="string"&&(f=MI(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[a(m)]}}function US(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=qn.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 EL(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||US(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(h){return m.indexOf(h)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=p,o(a,e._logEvent,f),e._logEvent=jS(m)}function jS(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function jI(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 FL(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?LI:UI}function ff(){return{}}function MS(e){return e}function es(){}function LI(){return!1}function UI(){return Date.now()}function TL(){return Math.round(Date.now()/1e3)}function PL(){return new Date(Date.now()).toISOString()}function kL(){function e(t){return typeof t<"u"&&t}try{return typeof y<"u"?y:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),y)}catch{return e(self)||e(window)||e(this)||{}}}mf.exports.default=qn;mf.exports.pino=qn});var Q1={};Qs(Q1,{HighlightUtils:()=>wg,ResultTemplatesHelpers:()=>Ix,SortOrder:()=>_l,VERSION:()=>Gn,buildAttachToCase:()=>ZI,buildAttachedResults:()=>eE,buildBreadcrumbManager:()=>TE,buildCategoryFacet:()=>eF,buildController:()=>me,buildCriterionExpression:()=>Gr,buildDateFacet:()=>AF,buildDateFilter:()=>bF,buildDateRange:()=>gs,buildDateSortCriterion:()=>bb,buildDidYouMean:()=>ME,buildFacet:()=>mF,buildFacetConditionsManager:()=>UE,buildFacetManager:()=>BE,buildFoldedResultList:()=>VF,buildGeneratedAnswer:()=>QF,buildInsightEngine:()=>YI,buildInsightInterface:()=>FP,buildInteractiveCitation:()=>GF,buildInteractiveResult:()=>dT,buildNotifyTrigger:()=>vP,buildNumericFacet:()=>IF,buildNumericFilter:()=>FF,buildNumericRange:()=>Cm,buildPager:()=>YF,buildQueryError:()=>XF,buildQuerySummary:()=>ZF,buildQuickview:()=>nT,buildRecentQueriesList:()=>uT,buildRelevanceSortCriterion:()=>Dl,buildResultList:()=>pT,buildResultTemplatesManager:()=>VP,buildResultsPerPage:()=>mT,buildSearchBox:()=>ET,buildSearchParameterManager:()=>zT,buildSearchStatus:()=>cP,buildSmartSnippet:()=>ZT,buildSmartSnippetQuestionsList:()=>rP,buildSort:()=>sP,buildTab:()=>lP,buildUserActions:()=>EP,deserializeRelativeDate:()=>cA,getAnalyticsNextApiBaseUrl:()=>Du,getOrganizationEndpoint:()=>Ye,getSampleInsightEngineConfiguration:()=>QS,loadAttachedResultsActions:()=>b1,loadAttachedResultsAnalyticsActions:()=>x1,loadCaseContextActions:()=>w1,loadContextActions:()=>I1,loadDateFacetSetActions:()=>E1,loadFieldActions:()=>T1,loadFoldingActions:()=>P1,loadGeneratedAnswerActions:()=>k1,loadGenericAnalyticsActions:()=>A1,loadInsightAnalyticsActions:()=>C1,loadInsightInterfaceActions:()=>O1,loadInsightSearchActions:()=>N1,loadInsightSearchAnalyticsActions:()=>D1,loadInsightUserActionsActions:()=>q1,loadNumericFacetSetActions:()=>F1,loadQuerySetActions:()=>_1,loadQuerySuggestActions:()=>M1,loadQuestionAnsweringActions:()=>V1,loadRecentResultsActions:()=>j1});module.exports=zP(Q1);d();c();l();u();var wg={};Qs(wg,{escapeHtml:()=>Gi,getHighlightedSuggestion:()=>xg,highlightString:()=>bk});d();c();l();u();d();c();l();u();function gk(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 hk=Object.create;var Qs=Object.defineProperty;var yk=Object.getOwnPropertyDescriptor;var Sk=Object.getOwnPropertyNames;var vk=Object.getPrototypeOf,Ak=Object.prototype.hasOwnProperty;var Ck=(e,t,r)=>t in e?Qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ma=(e,t)=>()=>(e&&(t=e(e=0)),t);var It=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bs=(e,t)=>{for(var r in t)Qs(e,r,{get:t[r],enumerable:!0})},Dv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sk(t))!Ak.call(e,o)&&o!==r&&Qs(e,o,{get:()=>t[o],enumerable:!(n=yk(t,o))||n.enumerable});return e};var Fr=(e,t,r)=>(r=e!=null?hk(vk(e)):{},Dv(t||!e||!e.__esModule?Qs(r,"default",{value:e,enumerable:!0}):r,e)),bk=e=>Dv(Qs({},"__esModule",{value:!0}),e);var he=(e,t,r)=>Ck(e,typeof t!="symbol"?t+"":t,r);var y,c=Ma(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function Iu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Iu=function(t){return typeof t}:Iu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function Rk(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Ik.bind(this))}function Ik(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","*/*"),xk(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):wk(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var xk,wk,u=Ma(()=>{"use strict";xk=function(t){return typeof t=="string"},wk=function(t){return t instanceof Blob};Rk.call((typeof window>"u"?"undefined":Iu(window))==="object"?window:{})});var Pg=It(Gs=>{"use strict";d();c();l();u();Object.defineProperty(Gs,"__esModule",{value:!0});function qv(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 Ek(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fk(e,t,r){return t=Va(t),Pk(e,Lv()?Reflect.construct(t,r||[],Va(e).constructor):t.apply(e,r))}function Eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mv(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,Nk(n.key),n)}}function Fg(e,t,r){return t&&Mv(e.prototype,t),r&&Mv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Dk(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 Rg(){return Rg=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=kk(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Rg.apply(null,arguments)}function Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(e)}function Tk(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&&Ig(e,t)}function Lv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lv=function(){return!!e})()}function Pk(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 Ek(e)}function Ig(e,t){return Ig=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ig(e,t)}function kk(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Va(e))!==null;);return e}function Ok(e,t,r,n){var o=Rg(Va(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function _k(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 Nk(e){var t=_k(e,"string");return typeof t=="symbol"?t:t+""}function Dk(e,t){if(e){if(typeof e=="string")return qv(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)?qv(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function qk(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 Mk(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 jv=function(){function e(){Eg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Fg(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(C){Promise.resolve().then(function(){throw C})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),Tg=function(e){function t(){var r;return Eg(this,t),r=Fk(this,t),r.listeners||jv.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 Tk(t,e),Fg(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)),Ok(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 Eu;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 Eu;function a(){o.abort(this.reason),i()}function i(){var g=Vv(n),C;try{for(g.s();!(C=g.n()).done;){var x=C.value;x.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=Vv(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}}])}(jv),Eu=function(){function e(){Eg(this,e),Object.defineProperty(this,"signal",{value:new Tg,writable:!0,configurable:!0})}return Fg(e,[{key:"abort",value:function(r){var n=Mk(r),o=qk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Eu.prototype[Symbol.toStringTag]="AbortController",Tg.prototype[Symbol.toStringTag]="AbortSignal");function Vk(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,a=t.AbortController,i=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=i===void 0?!1:i;if(!Vk({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 S;h&&h.signal&&(S=h.signal,delete h.signal);var b=new o(x,h);return S&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:S}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var S=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(S){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(S.aborted)return Promise.reject(b);var w=new Promise(function(I,E){S.addEventListener("abort",function(){return E(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}}Gs.AbortController=Eu;Gs.AbortSignal=Tg;Gs.abortableFetch=jk});var Uv,s,v,l=Ma(()=>{"use strict";Uv=Fr(Pg(),1),s=Fr(Pg(),1),{fetch:v}=(0,Uv.abortableFetch)({fetch})});function kg(e){return typeof e!="string"||e in{}}function Og(){return Object.create(null)}function Qv(e){return typeof e=="string"&&!!e.trim()}function _g(e,t){var r=e.split(";").filter(Qv),n=r.shift(),o=Lk(n),a=o.name,i=o.value;if(t=t?Object.assign({},Fu,t):Fu,kg(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=Og();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trimLeft().toLowerCase();if(!kg(g)){var C=m.join("=");if(g==="expires")p.expires=new Date(C);else if(g==="max-age"){var x=parseInt(C,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=C:g==="partitioned"?p.partitioned=!0:g&&(p[g]=C)}}),p}function Lk(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function ja(e,t){if(t=t?Object.assign({},Fu,t):Fu,!e)return t.map?Og():[];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(Qv),n&&(e=e.map(Tu).flat()),t.map){var a=Og();return e.reduce(function(i,p){var f=_g(p,t);return f&&!kg(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return _g(i,t)}).filter(Boolean)}function Tu(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 Fu,Bv=Ma(()=>{"use strict";d();c();l();u();Fu={decodeValues:!0,map:!1,silent:!1,split:"auto"};ja.parseSetCookie=ja;ja.parse=ja;ja.parseString=_g;ja.splitCookiesString=Tu});function $s(e){if(Uk.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Ng(e){return e.replace(Qk,"")}function Hs(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||!Bk(r))return!1}return!0}function Bk(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function $v(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 Uk,Gv,Qk,Hv,La,Dg,zv,A,Yv=Ma(()=>{"use strict";d();c();l();u();Bv();Uk=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Gv=[`
19
+ `,"\r","\t"," "],Qk=new RegExp(`(^[${Gv.join("")}]|$[${Gv.join("")}])`,"g");La=Symbol("normalizedHeaders"),Dg=Symbol("rawHeaderNames"),zv=", ",A=class Wv{constructor(t){this[La]={},this[Dg]=new Map,this[Hv]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Wv||typeof y.Headers<"u"&&t instanceof y.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(zv):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(zv):n)})}[(Hv=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[La]).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(!Hs(t))throw new TypeError(`Invalid header name "${t}"`);return this[La].hasOwnProperty($s(t))}get(t){if(!Hs(t))throw TypeError(`Invalid header name "${t}"`);return this[La][$s(t)]??null}set(t,r){if(!Hs(t)||!$v(r))return;let n=$s(t),o=Ng(r);this[La][n]=Ng(o),this[Dg].set(n,t)}append(t,r){if(!Hs(t)||!$v(r))return;let n=$s(t),o=Ng(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Hs(t)||!this.has(t))return;let r=$s(t);delete this[La][r],this[Dg].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===""?[""]:Tu(t)}}});var d=Ma(()=>{"use strict";Yv()});var rA=It(Ys=>{"use strict";d();c();l();u();var qu=Ys&&Ys.__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(Ys,"__esModule",{value:!0});var Zk={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Jk(e){var t=qu(qu({},Zk),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Ys.getSanitizedOptions=Jk});var nA=It(jg=>{"use strict";d();c();l();u();Object.defineProperty(jg,"__esModule",{value:!0});function eO(e){var t=Math.random()*e;return Math.round(t)}jg.fullJitter=eO});var oA=It(Lg=>{"use strict";d();c();l();u();Object.defineProperty(Lg,"__esModule",{value:!0});function tO(e){return e}Lg.noJitter=tO});var aA=It(Ug=>{"use strict";d();c();l();u();Object.defineProperty(Ug,"__esModule",{value:!0});var rO=nA(),nO=oA();function oO(e){return e.jitter==="full"?rO.fullJitter:nO.noJitter}Ug.JitterFactory=oO});var Bg=It(Qg=>{"use strict";d();c();l();u();Object.defineProperty(Qg,"__esModule",{value:!0});var aO=aA(),iO=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=aO.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}();Qg.Delay=iO});var iA=It(wn=>{"use strict";d();c();l();u();var sO=wn&&wn.__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=wn&&wn.__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(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},uO=wn&&wn.__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(wn,"__esModule",{value:!0});var lO=Bg(),dO=function(e){sO(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 uO(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}(lO.Delay);wn.SkipFirstDelay=dO});var sA=It(Ks=>{"use strict";d();c();l();u();var pO=Ks&&Ks.__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(Ks,"__esModule",{value:!0});var fO=Bg(),mO=function(e){pO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(fO.Delay);Ks.AlwaysDelay=mO});var cA=It(Gg=>{"use strict";d();c();l();u();Object.defineProperty(Gg,"__esModule",{value:!0});var gO=iA(),hO=sA();function yO(e,t){var r=SO(e);return r.setAttemptNumber(t),r}Gg.DelayFactory=yO;function SO(e){return e.delayFirstAttempt?new hO.AlwaysDelay(e):new gO.SkipFirstDelay(e)}});var uA=It(_o=>{"use strict";d();c();l();u();var $g=_o&&_o.__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(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},Hg=_o&&_o.__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(_o,"__esModule",{value:!0});var vO=rA(),AO=cA();function CO(e,t){return t===void 0&&(t={}),$g(this,void 0,void 0,function(){var r,n;return Hg(this,function(o){switch(o.label){case 0:return r=vO.getSanitizedOptions(t),n=new bO(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}_o.backOff=CO;var bO=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return $g(this,void 0,void 0,function(){var t,r;return Hg(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 $g(this,void 0,void 0,function(){var t;return Hg(this,function(r){switch(r.label){case 0:return t=AO.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Vu=It((zg,Wg)=>{"use strict";d();c();l();u();(function(e,t){typeof zg=="object"&&typeof Wg<"u"?Wg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(zg,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",C="year",x="date",h="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,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},E={s:I,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),H=M%60;return(D<=0?"+":"-")+I(W,2,"0")+":"+I(H,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()),H=D.clone().add(W,m),re=M-H<0,Z=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-H)/(re?H-Z:Z-H))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:C,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}},F="en",k={};k[F]=w;var T="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[T])},G=function N(D,M,W){var H;if(!D)return F;if(typeof D=="string"){var re=D.toLowerCase();k[re]&&(H=re),M&&(k[re]=M,H=re);var Z=D.split("-");if(!H&&Z.length>1)return N(Z[0])}else{var K=D.name;k[K]=D,H=K}return!W&&H&&(F=H),H||!W&&F},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)},j=E;j.l=G,j.i=q,j.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 H=W.date,re=W.utc;if(H===null)return new Date(NaN);if(j.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var Z=H.match(S);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(H)}(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 j},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(M,W){var H=Q(M);return this.startOf(W)<=H&&H<=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,H){return j.u(M)?this[W]:this.set(H,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var H=this,re=!!j.u(W)||W,Z=j.p(M),K=function(Ee,Re){var Oe=j.w(H.$u?Date.UTC(H.$y,Re,Ee):new Date(H.$y,Re,Ee),H);return re?Oe:Oe.endOf(p)},ce=function(Ee,Re){return j.w(H.toDate()[Ee].apply(H.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(Re)),H)},Se=this.$W,Ve=this.$M,ot=this.$D,Ge="set"+(this.$u?"UTC":"");switch(Z){case C:return re?K(1,0):K(31,11);case m:return re?K(1,Ve):K(0,Ve+1);case f:var et=this.$locale().weekStart||0,tt=(Se<et?Se+7:Se)-et;return K(re?ot-tt:ot+(6-tt),Ve);case p:case x:return ce(Ge+"Hours",0);case i:return ce(Ge+"Minutes",1);case a:return ce(Ge+"Seconds",2);case o:return ce(Ge+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var H,re=j.p(M),Z="set"+(this.$u?"UTC":""),K=(H={},H[p]=Z+"Date",H[x]=Z+"Date",H[m]=Z+"Month",H[C]=Z+"FullYear",H[i]=Z+"Hours",H[a]=Z+"Minutes",H[o]=Z+"Seconds",H[n]=Z+"Milliseconds",H)[re],ce=re===p?this.$D+(W-this.$W):W;if(re===m||re===C){var Se=this.clone().set(x,1);Se.$d[K](ce),Se.init(),this.$d=Se.set(x,Math.min(this.$D,Se.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[j.p(M)]()},D.add=function(M,W){var H,re=this;M=Number(M);var Z=j.p(W),K=function(Ve){var ot=Q(re);return j.w(ot.date(ot.date()+Math.round(Ve*M)),re)};if(Z===m)return this.set(m,this.$M+M);if(Z===C)return this.set(C,this.$y+M);if(Z===p)return K(1);if(Z===f)return K(7);var ce=(H={},H[a]=t,H[i]=r,H[o]=e,H)[Z]||1,Se=this.$d.getTime()+M*ce;return j.w(Se,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,H=this.$locale();if(!this.isValid())return H.invalidDate||h;var re=M||"YYYY-MM-DDTHH:mm:ssZ",Z=j.z(this),K=this.$H,ce=this.$m,Se=this.$M,Ve=H.weekdays,ot=H.months,Ge=H.meridiem,et=function(Re,Oe,Fe,gt){return Re&&(Re[Oe]||Re(W,re))||Fe[Oe].slice(0,gt)},tt=function(Re){return j.s(K%12||12,Re,"0")},Ee=Ge||function(Re,Oe,Fe){var gt=Re<12?"AM":"PM";return Fe?gt.toLowerCase():gt};return re.replace(b,function(Re,Oe){return Oe||function(Fe){switch(Fe){case"YY":return String(W.$y).slice(-2);case"YYYY":return j.s(W.$y,4,"0");case"M":return Se+1;case"MM":return j.s(Se+1,2,"0");case"MMM":return et(H.monthsShort,Se,ot,3);case"MMMM":return et(ot,Se);case"D":return W.$D;case"DD":return j.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return et(H.weekdaysMin,W.$W,Ve,2);case"ddd":return et(H.weekdaysShort,W.$W,Ve,3);case"dddd":return Ve[W.$W];case"H":return String(K);case"HH":return j.s(K,2,"0");case"h":return tt(1);case"hh":return tt(2);case"a":return Ee(K,ce,!0);case"A":return Ee(K,ce,!1);case"m":return String(ce);case"mm":return j.s(ce,2,"0");case"s":return String(W.$s);case"ss":return j.s(W.$s,2,"0");case"SSS":return j.s(W.$ms,3,"0");case"Z":return Z}return null}(Re)||Z.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,H){var re,Z=this,K=j.p(W),ce=Q(M),Se=(ce.utcOffset()-this.utcOffset())*t,Ve=this-ce,ot=function(){return j.m(Z,ce)};switch(K){case C:re=ot()/12;break;case m:re=ot();break;case g:re=ot()/3;break;case f:re=(Ve-Se)/6048e5;break;case p:re=(Ve-Se)/864e5;break;case i:re=Ve/r;break;case a:re=Ve/t;break;case o:re=Ve/e;break;default:re=Ve}return H?re:j.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 H=this.clone(),re=G(M,W,!0);return re&&(H.$L=re),H},D.clone=function(){return j.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",C],["$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[F],Q.Ls=k,Q.p={},Q})});var mA=It((Yg,Kg)=>{"use strict";d();c();l();u();(function(e,t){typeof Yg=="object"&&typeof Kg<"u"?Kg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(Yg,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 C=this.quarter()-1;return g?this.month(3*C).startOf(e).startOf("day"):this.month(3*C+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var gA=It((Xg,Zg)=>{"use strict";d();c();l();u();(function(e,t){typeof Xg=="object"&&typeof Zg<"u"?Zg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(Xg,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(S){return(S=+S)+(S>68?1900:2e3)},f=function(S){return function(b){this[S]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(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}(S)}],g=function(S){var b=i[S];return b&&(b.indexOf?b:b.s.concat(b.f))},C=function(S,b){var w,I=i.meridiem;if(I){for(var E=1;E<=24;E+=1)if(S.indexOf(I(E,0,b))>-1){w=E>12;break}}else w=S===(b?"pm":"PM");return w},x={A:[a,function(S){this.afternoon=C(S,!1)}],a:[a,function(S){this.afternoon=C(S,!0)}],Q:[r,function(S){this.month=3*(S-1)+1}],S:[r,function(S){this.milliseconds=100*+S}],SS:[n,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],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(S){var b=i.ordinal,w=S.match(/\d+/);if(this.day=w[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===S&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(S){var b=g("months"),w=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(S)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(S){var b=g("months").indexOf(S)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(S){this.year=p(S)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(S){var b,w;b=S,w=i&&i.formats;for(var I=(S=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,j,B){var L=B&&B.toUpperCase();return j||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),E=I.length,F=0;F<E;F+=1){var k=I[F],T=x[k],q=T&&T[0],G=T&&T[1];I[F]=G?{regex:q,parser:G}:k.replace(/^\[|\]$/g,"")}return function(Q){for(var j={},B=0,L=0;B<E;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),H=D.exec(W)[0];M.call(j,H),Q=Q.replace(H,"")}}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}}(j),j}}return function(S,b,w){w.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(p=S.parseTwoDigitYear);var I=b.prototype,E=I.parse;I.parse=function(F){var k=F.date,T=F.utc,q=F.args;this.$u=T;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,j=q[3]===!0,B=Q||j,L=q[2];j&&(L=q[2]),i=this.$locale(),!Q&&L&&(i=w.Ls[L]),this.$d=function(W,H,re,Z){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*W);var K=h(H)(W),ce=K.year,Se=K.month,Ve=K.day,ot=K.hours,Ge=K.minutes,et=K.seconds,tt=K.milliseconds,Ee=K.zone,Re=K.week,Oe=new Date,Fe=Ve||(ce||Se?1:Oe.getDate()),gt=ce||Oe.getFullYear(),vt=0;ce&&!Se||(vt=Se>0?Se-1:Oe.getMonth());var Ir,ir=ot||0,Vr=Ge||0,fr=et||0,Er=tt||0;return Ee?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er+60*Ee.offset*1e3)):re?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er)):(Ir=new Date(gt,vt,Fe,ir,Vr,fr,Er),Re&&(Ir=Z(Ir).week(Re).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 E.call(this,F)}}})});var zw=It((iS,sS)=>{"use strict";d();c();l();u();(function(e,t){typeof iS=="object"&&typeof sS<"u"?sS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(iS,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,C,x){x===void 0&&(x={});var h=new Date(g),S=function(b,w){w===void 0&&(w={});var I=w.timeZoneName||"short",E=b+"|"+I,F=t[E];return F||(F=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[E]=F),F}(C,x);return S.formatToParts(h)},p=function(g,C){for(var x=i(g,C),h=[],S=0;S<x.length;S+=1){var b=x[S],w=b.type,I=b.value,E=e[w];E>=0&&(h[E]=parseInt(I,10))}var F=h[3],k=F===24?0:F,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,C){g===void 0&&(g=a);var x,h=this.utcOffset(),S=this.toDate(),b=S.toLocaleString("en-US",{timeZone:g}),w=Math.round((S-new Date(b))/1e3/60),I=15*-Math.round(S.getTimezoneOffset()/15)-w;if(!Number(I))x=this.utcOffset(0,C);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),C){var E=x.utcOffset();x=x.add(h-E,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var C=this.$x.$timezone||o.tz.guess(),x=i(this.valueOf(),C,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,C){if(!this.$x||!this.$x.$timezone)return m.call(this,g,C);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,C).tz(this.$x.$timezone,!0)},o.tz=function(g,C,x){var h=x&&C,S=x||C||a,b=p(+o(),S);if(typeof g!="string")return o(g).tz(S);var w=function(k,T,q){var G=k-60*T*1e3,Q=p(G,q);if(T===Q)return[G,T];var j=p(G-=60*(Q-T)*1e3,q);return Q===j?[G,Q]:[k-60*Math.min(Q,j)*1e3,Math.max(Q,j)]}(o.utc(g,h).valueOf(),b,S),I=w[0],E=w[1],F=o(I).utcOffset(E);return F.$x.$timezone=S,F},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var Ww=It((cS,uS)=>{"use strict";d();c();l();u();(function(e,t){typeof cS=="object"&&typeof uS<"u"?uS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(cS,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 S={date:h,utc:!0,args:arguments};return new o(S)},i.utc=function(h){var S=a(this.toDate(),{locale:this.$L,utc:!0});return h?S.add(this.utcOffset(),e):S},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,S){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(F){F===void 0&&(F="");var k=F.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(S);var I=this.clone();if(S)return I.$offset=w,I.$u=!1,I;var E=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+E,e)).$offset=w,I.$x.$localOffset=E,I};var g=i.format;i.format=function(h){var S=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},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 C=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():C.call(this)};var x=i.diff;i.diff=function(h,S,b){if(h&&this.$u===h.$u)return x.call(this,h,S,b);var w=this.local(),I=a(h).local();return x.call(w,I,S,b)}}})});var lE=It((Zxe,uE)=>{"use strict";d();c();l();u();function lU(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}uE.exports=dU;function dU(e,t,r){var n=r&&r.stringify||lU,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,C=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(C=C>-1?C:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Number(t[g]),C=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Math.floor(Number(t[g])),C=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;C<h&&(m+=e.slice(C,h));var S=typeof t[g];if(S==="string"){m+="'"+t[g]+"'",C=h+2,h++;break}if(S==="function"){m+=t[g].name||"<anonymous>",C=h+2,h++;break}m+=n(t[g]),C=h+2,h++;break;case 115:if(g>=f)break;C<h&&(m+=e.slice(C,h)),m+=String(t[g]),C=h+2,h++;break;case 37:C<h&&(m+=e.slice(C,h)),m+="%",C=h+2,h++,g--;break}++g}++h}return C===-1?e:(C<x&&(m+=e.slice(C)),m)}});var yE=It((nwe,Ff)=>{"use strict";d();c();l();u();var dE=lE();Ff.exports=Mn;var au=IU().console||{},pU={mapHttpRequest:Ef,mapHttpResponse:Ef,wrapRequestSerializer:ev,wrapResponseSerializer:ev,wrapErrorSerializer:ev,req:Ef,res:Ef,err:fE,errWithCause:fE};function go(e,t){return e==="silent"?1/0:t.levels.values[e]}var nv=Symbol("pino.logFuncs"),tv=Symbol("pino.hierarchy"),fU={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function pE(e,t){let r={logger:t,parent:e[tv]};t[tv]=r}function mU(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:au[o]||au[fU[o]||"log"]||ts}),e[nv]=n}function gU(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Mn(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||au;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=gU(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=ts),mU(m,p,r),pE({},m),Object.defineProperty(m,"levelVal",{get:C}),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:xU(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ts};m.levels=hU(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=ts,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...b){return S.call(this,g,...b)},t&&(m._logEvent=rv());function C(){return go(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,Ta(this,g,m,"error"),Ta(this,g,m,"fatal"),Ta(this,g,m,"warn"),Ta(this,g,m,"info"),Ta(this,g,m,"debug"),Ta(this,g,m,"trace"),i.forEach(w=>{Ta(this,g,m,w)})}function S(b,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let E=I.serializers;if(o&&E){var F=Object.assign({},n,E),k=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,ov([w],k,F,this._stdErrSerialize)}function T(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,F&&(this.serializers=F,this._serialize=k),t&&(this._logEvent=rv([].concat(G._logEvent.bindings,w)))}T.prototype=this;let q=new T(this);return pE(this,q),q.child=function(...G){return S.call(this,b,...G)},q.level=I.level||this.level,b.onChild(q),q}return m}function hU(e){let t=e.customLevels||{},r=Object.assign({},Mn.levels.values,t),n=Object.assign({},Mn.levels.labels,yU(t));return{values:r,labels:n}}function yU(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Mn.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"}};Mn.stdSerializers=pU;Mn.stdTimeFunctions=Object.assign({},{nullTime:gE,epochTime:hE,unixTime:wU,isoTime:RU});function SU(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[tv];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Ta(e,t,r,n){if(Object.defineProperty(e,n,{value:go(e.level,r)>go(n,r)?ts:r[nv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ts){if(!t.transmit)return;let a=t.transmit.level||e.level,i=go(a,r);if(go(n,r)<i)return}e[n]=AU(e,t,r,n);let o=SU(e);o.length!==0&&(e[n]=vU(o,e[n]))}function vU(e,t){return function(){return t.apply(this,[...e,...arguments])}}function AU(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===au?au:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(ov(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let C=CU(this,n,p,i,t);if(t.reportCaller&&C&&C.length>0&&C[0]&&typeof C[0]=="object")try{let x=mE();x&&(C[0].caller=x)}catch{}o.call(f,...C)}else{if(t.reportCaller)try{let C=mE();C&&p.push(C)}catch{}o.apply(f,p)}if(t.transmit){let C=t.transmit.level||e._level,x=go(C,r),h=go(n,r);if(h<x)return;bU(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:C,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:go(e._level,r)},p,g)}}}(e[nv][n])}function CU(e,t,r,n,o){let{level:a,log:i=C=>C}=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 C=a(t,e.levels.values[t]);Object.assign(m,C)}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?dE(p.shift(),p):void 0}else typeof f=="string"&&(f=dE(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function ov(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Mn.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 bU(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||ov(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=rv(m)}function rv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function fE(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 xU(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?gE:hE}function Ef(){return{}}function ev(e){return e}function ts(){}function gE(){return!1}function hE(){return Date.now()}function wU(){return Math.round(Date.now()/1e3)}function RU(){return new Date(Date.now()).toISOString()}function IU(){function e(t){return typeof t<"u"&&t}try{return typeof y<"u"?y:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),y)}catch{return e(self)||e(window)||e(this)||{}}}Ff.exports.default=Mn;Ff.exports.pino=Mn;function mE(){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 VG={};Bs(VG,{HighlightUtils:()=>Vg,ResultTemplatesHelpers:()=>$x,SortOrder:()=>Dl,VERSION:()=>$n,buildAttachToCase:()=>FE,buildAttachedResults:()=>TE,buildBreadcrumbManager:()=>oF,buildCategoryFacet:()=>TF,buildController:()=>ge,buildCriterionExpression:()=>$r,buildDateFacet:()=>YF,buildDateFilter:()=>XF,buildDateRange:()=>hs,buildDateSortCriterion:()=>Lb,buildDidYouMean:()=>pF,buildFacet:()=>BF,buildFacetConditionsManager:()=>hF,buildFacetManager:()=>SF,buildFoldedResultList:()=>fT,buildGeneratedAnswer:()=>yT,buildInsightEngine:()=>wE,buildInsightInterface:()=>nk,buildInteractiveCitation:()=>vT,buildInteractiveResult:()=>LT,buildNotifyTrigger:()=>WP,buildNumericFacet:()=>tT,buildNumericFilter:()=>nT,buildNumericRange:()=>Dm,buildPager:()=>wT,buildQueryError:()=>IT,buildQuerySummary:()=>FT,buildQuickview:()=>OT,buildRecentQueriesList:()=>VT,buildRelevanceSortCriterion:()=>Ml,buildResultList:()=>UT,buildResultTemplatesManager:()=>fk,buildResultsPerPage:()=>BT,buildSearchBox:()=>rP,buildSearchParameterManager:()=>bP,buildSearchStatus:()=>MP,buildSmartSnippet:()=>FP,buildSmartSnippetQuestionsList:()=>kP,buildSort:()=>qP,buildTab:()=>jP,buildUserActions:()=>rk,deserializeRelativeDate:()=>IA,getAnalyticsNextApiBaseUrl:()=>Mu,getOrganizationEndpoint:()=>Ke,getSampleInsightEngineConfiguration:()=>av,loadAttachedResultsActions:()=>SG,loadAttachedResultsAnalyticsActions:()=>vG,loadCaseContextActions:()=>AG,loadContextActions:()=>bG,loadDateFacetSetActions:()=>xG,loadFieldActions:()=>RG,loadFoldingActions:()=>IG,loadGeneratedAnswerActions:()=>EG,loadGenericAnalyticsActions:()=>hG,loadInsightAnalyticsActions:()=>yG,loadInsightInterfaceActions:()=>FG,loadInsightSearchActions:()=>PG,loadInsightSearchAnalyticsActions:()=>kG,loadInsightUserActionsActions:()=>OG,loadNumericFacetSetActions:()=>wG,loadQuerySetActions:()=>TG,loadQuerySuggestActions:()=>_G,loadQuestionAnsweringActions:()=>NG,loadRecentResultsActions:()=>DG});module.exports=bk(VG);d();c();l();u();var Vg={};Bs(Vg,{escapeHtml:()=>$a,getHighlightedSuggestion:()=>Mg,highlightString:()=>Xk});d();c();l();u();d();c();l();u();function Gk(e,t){let r=`
20
21
  The following properties are invalid:
21
22
 
22
23
  ${e.join(`
23
24
  `)}
24
25
 
25
26
  ${t}
26
- `;return new ko(r)}var ko=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Fe=class{constructor(e){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 gk(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}},Ge=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&ee(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 Li(e){return e===void 0}function hk(e){return e===null}function ee(e){return Li(e)||hk(e)}var de=class{constructor(e={}){De(this,"value");this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(yk(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function yk(e){return Li(e)||Fu(e)}function Fu(e){return typeof e=="boolean"}var oe=class{constructor(e={}){De(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(Sk(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 Sk(e){return Li(e)||Ov(e)}function Ov(e){return typeof e=="number"&&!Number.isNaN(e)}var vk=/^\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 Ge(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(Li(e))return null;if(!Ui(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&&!(vk.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 Ui(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(Li(e))return this.config.options.required?"value is required and is currently undefined":null;if(!_v(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ee(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 _v(e){return e!==void 0&&typeof e=="object"}var ne=class{constructor(e={}){De(this,"value");this.config=e,this.value=new Ge(this.config)}validate(e){if(!ee(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ee(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&&ee(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 Fu(e)||Ui(e)||Ov(e)||_v(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Qi(e){return Array.isArray(e)}var Hs=class{constructor(e){De(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Li(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 Tu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Pu(e){return Array.isArray(e)}function ku(e){return e.trim()===""}function Nv(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function Ak(e){return btoa(encodeURI(e))}function Ou(e,t){let{[e]:r,...n}=t;return n}function Bi(e){return Ak(JSON.stringify(e))}var Ck=new Set(["1",1,"yes",!0]);function Dv(){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=>Ck.has(r))}function qv(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Mv(e,t,r){return clearTimeout(t),setTimeout(e,r)}function zs(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function _u(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 bk(e){if(ku(e.openingDelimiter)||ku(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ee(e.content)||ku(e.content))return e.content;if(e.highlights.length===0)return Gi(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+=Gi(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Gi(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Gi(e.content.slice(n))),r}function xg(e,t){return e=Gi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?bg(n,t.notMatchDelimiters):o?bg(o,t.exactMatchDelimiters):i?bg(i,t.correctionDelimiters):r)}function bg(e,t){return t?t.open+e+t.close:e}function Gi(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 Yv=Er($v(),1);d();c();l();u();var ie=new Error("Failed to load reducers."),$i=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."}},_o=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 Hv(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function zv(e){return typeof e!="object"||!e?!1:Object.values(e).every(Wk)}function Wk(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Wv(e){return e===429}var Vr=class e{static call(t){return _asyncToGenerator(function*(){let r=Yk(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(Wv(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,Yv.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let h=m&&Wv(m.status);return h&&(n.info("Platform retrying request"),yield new Promise(C=>setTimeout(C,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new $i;case 404:throw new _o(i,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new _o(i):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...f}=t,m=zs(f);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function Ye(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Kt(e,t="prod"){return`${Ye(e,t)}/rest/search/v2`}function Du(e,t="prod"){return`${Ye(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Yk(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",f=Kk(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:f}),signal:a}}function Kk(e,t){return t==="application/x-www-form-urlencoded"?zv(e)?Hv(e):"":JSON.stringify(e)}d();c();l();u();var Ks=Er(qu(),1),tA=Er(Kv(),1);d();c();l();u();var Mu=Er(qu(),1),Jv=Er(Xv(),1);Mu.default.extend(Jv.default);var Zv="YYYY/MM/DD@HH:mm:ss",Xk="1401-01-01";function Hi(e,t){let r=(0,Mu.default)(e,t);return!r.isValid()&&!t?(0,Mu.default)(e,Zv):r}function Vu(e){return e.format(Zv)}function eA(e,t){let r=Hi(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}`)}jg(r)}function jg(e){if(e.isBefore(Xk))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ks.default.extend(tA.default);var rA=["past","now","next"],nA=["minute","hour","day","week","month","quarter","year"],Jk=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new $({required:!t,constrainTo:nA}),period:new $({required:!0,constrainTo:rA})}};function ju(e){if(typeof e=="string"&&!Un(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Lg(e):e;new Fe(Jk(t.period)).validate(t);let r=iA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);jg(r)}function oA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function iA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ks.default)().subtract(r,n);case"next":return(0,Ks.default)().add(r,n);case"now":return(0,Ks.default)()}}function Xs(e){return Vu(iA(Lg(e)))}function aA(e){return e.toLocaleLowerCase().split("-")}function Un(e){let[t,r,n]=aA(e);if(t==="now")return!0;if(!rA.includes(t)||!nA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function sA(e){return!!e&&typeof e=="object"&&"period"in e}function Lg(e){let[t,r,n]=aA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function cA(e){return ju(e),Lg(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function lA(_x3,_x4){return _lA.apply(this,arguments)}function _lA(){_lA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _lA.apply(this,arguments)}function dA(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=eO(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 pA(e,t,r){let n=uA(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=uA();else if(p>0){let f=o.decode(a.subarray(0,p)),m=p+(a[p+1]===32?2:1),h=o.decode(a.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
27
- ${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":Zk(h,n,t);break}}}}function Zk(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function eO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function uA(){return{data:"",event:"",id:"",retry:void 0}}var Ug="text/event-stream",tO=1e3,fA="last-event-id";function mA(){return typeof window<"u"}function Lu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((h,C)=>{let b={...r};b.accept||(b.accept=Ug);let g;function S(){g?.abort(),document.hidden||_()}!p&&mA()&&document.addEventListener("visibilitychange",S);let x=tO,w;function R(){mA()&&document.removeEventListener("visibilitychange",S),clearTimeout(w),g?.abort()}t?.addEventListener("abort",()=>{R(),h()});let P=f??v,E=n??rO;function _(){return _2.apply(this,arguments)}function _2(){_2=_asyncToGenerator(function*(){g=s.AbortController?new s.AbortController:null;try{let F=yield P(e,{...m,headers:b,signal:g?.signal});yield E(F),yield lA(F.body,dA(pA(q=>{q?b[fA]=q:delete b[fA]},q=>{x=q},o))),i?.(),R(),h()}catch(F){if(!g?.signal?.aborted)try{let q=a?.(F)??x;clearTimeout(w),w=setTimeout(_,q)}catch(q){R(),C(q)}}});return _2.apply(this,arguments)}_()})}function rO(e){let t=e.headers.get("content-type");if(!t?.startsWith(Ug))throw new Error(`Expected content-type to be ${Ug}, Actual: ${t}`)}d();c();l();u();var Qn=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 nO=(e,t,r)=>new Qn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,gA=3,oO=5e3,iO="text/event-stream",Gg=1,Qg=class extends Error{},Js=class extends Error{constructor(r){super(r.message);this.payload=r}},Bg=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)}},Uu=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:h}=r,C=new Bg;if(!i){this.logger.error("No stream ID found");return}let b=0,g,S=()=>{g&&!C.isActive(g)&&(w?.abort(),h(),R())},x=()=>{C.remove(g),g=Mv(S,g,oO),C.add(g)},w=new s.AbortController,R=()=>Lu(nO(n,o,i),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(P){return _asyncToGenerator(function*(){if(P.ok&&P.headers.get("content-type")===iO)return;throw P.status>=400&&P.status<500&&P.status!==429?new Js({message:"Error opening stream",code:P.status}):new Qg})()},onmessage:P=>{if(w?.signal.aborted)return;let E=JSON.parse(P.data);if(E.finishReason==="ERROR"){C.remove(g),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),b=0,E.finishReason==="COMPLETED"?(C.remove(g),m()):x()},onerror:P=>{if(!w?.signal.aborted){if(C.remove(g),P instanceof Js)throw w?.abort(),f(P),P;if(++b>gA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:Gg};throw w?.abort(),f(E),new Js(E)}this.logger.info(`Retrying...(${b}/${gA})`),h()}}});return R(),w}};d();c();l();u();var Qu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function Zs(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var $g=e=>{let{response:t}=e;return t.body?aO(e):sO(t)},aO=e=>uO(e)?lO(e):cO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},sO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function cO(e){return e.body.statusCode!==void 0}function uO(e){return e.body.exception!==void 0}var lO=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function hA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Hg=(e,t,r,n)=>{let o=new Qn(`${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 yA=(e,t)=>{let r=new Qn(`${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},zg=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Vr.call({...Hg(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Zs(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=hA(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return dO(a)?{success:a}:{error:$g({response:r,body:a})}});return function zg(_x5,_x6){return _ref3.apply(this,arguments)}}();function dO(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function zi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function At(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:zi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:zi(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function pO(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function fO(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Wi(e,t){if(t&&e.name==="AbortError")return{error:fO(e)};if(e instanceof _o)return{error:pO(e)};throw e}var Bn=e=>e.success!==void 0,$e=e=>e.error!==void 0;function SA(e){return e.results!==void 0}function vA(e){let t=zi();return ee(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Wg=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,mO=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,ec=(e,t,r,n)=>{gO(e);let o=Wg(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},AA=(e,t,r)=>{hO(e);let n=mO(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},Yg=e=>{let{insightId:t,...r}=Zs(e);return r},CA=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.")},gO=e=>{if(CA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},hO=e=>{if(CA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var bA=e=>({...ec(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var xA=e=>({...ec(e,"POST","application/json","/search"),requestParams:Yg(e)}),wA=e=>({...ec(e,"POST","application/json","/querysuggest"),requestParams:Yg(e)});d();c();l();u();var RA=e=>({...AA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Bu=class{constructor(t){this.options=t}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Vr.call({...bA(t),..._this.options});if(r instanceof Error)return Wi(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 Vr.call({...xA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Wi(n);let o=yield n.json();return SA(o)&&(o=vA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Vr.call({...wA(t),..._this3.options});if(r instanceof Error)return Wi(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Vr.call({...RA(t),..._this4.options});if(r instanceof Error)return Wi(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return zg(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var z=new $({required:!0,emptyAllowed:!1}),ze=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),N3=new $({required:!1,emptyAllowed:!0}),Gu=new ne({each:z,required:!0}),IA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),EA=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),D3=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Fr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),fr=(e,t)=>{if("required"in t)return{payload:new Fe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new ko(o);return{payload:e}},O=(e,t)=>{try{return fr(e,t)}catch(r){return{payload:e,error:Fr(r)}}},mr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return FA(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return FA(e,t,r,o,"Controller initialization error")},FA=(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 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 yO=typeof Symbol=="function"&&Symbol.observable||"@@observable",TA=yO,Kg=()=>Math.random().toString(36).substring(7).split("").join("."),SO={INIT:`@@redux/INIT${Kg()}`,REPLACE:`@@redux/REPLACE${Kg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Kg()}`},$u=SO;function jr(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 Xg(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(Xg)(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,R)=>{a.set(R,w)}))}function h(){if(f)throw new Error(Et(3));return o}function C(w){if(typeof w!="function")throw new Error(Et(4));if(f)throw new Error(Et(5));let R=!0;m();let P=p++;return a.set(P,w),function(){if(R){if(f)throw new Error(Et(6));R=!1,m(),a.delete(P),i=null}}}function b(w){if(!jr(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(i=a).forEach(P=>{P()}),w}function g(w){if(typeof w!="function")throw new Error(Et(10));n=w,b({type:$u.REPLACE})}function S(){let w=C;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Et(11));function P(){let _=R;_.next&&_.next(h())}return P(),{unsubscribe:w(P)}},[TA](){return this}}}return b({type:$u.INIT}),{dispatch:b,subscribe:C,getState:h,replaceReducer:g,[TA]:S}}function vO(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:$u.INIT})>"u")throw new Error(Et(12));if(typeof r(void 0,{type:$u.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Et(13))})}function Yi(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{vO(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,h={};for(let C=0;C<n.length;C++){let b=n[C],g=r[b],S=p[b],x=g(S,f);if(typeof x>"u"){let w=f&&f.type;throw new Error(Et(14))}h[b]=x,m=m||x!==S}return m=m||n.length!==Object.keys(p).length,m?h:p}}function tc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function PA(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Et(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=tc(...p)(o.dispatch),{...o,dispatch:i}}}function rc(e){return jr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var ah=Symbol.for("immer-nothing"),nc=Symbol.for("immer-draftable"),Ct=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,Do=sr.getPrototypeOf,ic="constructor",lc="prototype",eh="configurable",Yu="enumerable",zu="writable",ac="value",Gt=e=>!!e&&!!e[Ct];function $t(e){return e?VA(e)||pc(e)||!!e[nc]||!!e[ic]?.[nc]||fc(e)||mc(e):!1}var AO=sr[lc][ic].toString(),kA=new WeakMap;function VA(e){if(!e||!Ki(e))return!1;let t=Do(e);if(t===null||t===sr[lc])return!0;let r=sr.hasOwnProperty.call(t,ic)&&t[ic];if(r===Object)return!0;if(!No(r))return!1;let n=kA.get(r);return n===void 0&&(n=Function.toString.call(r),kA.set(r,n)),n===AO}function jA(e){return Gt(e)||Ft(15,e),e[Ct].base_}function dc(e,t,r=!0){qo(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 qo(e){let t=e[Ct];return t?t.type_:pc(e)?1:fc(e)?2:mc(e)?3:0}var oc=(e,t,r=qo(e))=>r===2?e.has(t):sr[lc].hasOwnProperty.call(e,t),wn=(e,t,r=qo(e))=>r===2?e.get(t):e[t],Ku=(e,t,r,n=qo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function CO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var pc=Array.isArray,fc=e=>e instanceof Map,mc=e=>e instanceof Set,Ki=e=>typeof e=="object",No=e=>typeof e=="function",Jg=e=>typeof e=="boolean";function bO(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var xO=e=>Ki(e)?e?.[Ct]:null,Rn=e=>e.copy_||e.base_;var sh=e=>e.modified_?e.copy_:e.base_;function th(e,t){if(fc(e))return new Map(e);if(mc(e))return new Set(e);if(pc(e))return Array[lc].slice.call(e);let r=VA(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[Ct];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p[zu]===!1&&(p[zu]=!0,p[eh]=!0),(p.get||p.set)&&(n[a]={[eh]:!0,[zu]:!0,[Yu]:p[Yu],[ac]:e[a]})}return sr.create(Do(e),n)}else{let n=Do(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function ch(e,t=!1){return rl(e)||Gt(e)||!$t(e)||(qo(e)>1&&sr.defineProperties(e,{set:Hu,add:Hu,clear:Hu,delete:Hu}),sr.freeze(e),t&&dc(e,(r,n)=>{ch(n,!0)},!1)),e}function wO(){Ft(2)}var Hu={[ac]:wO};function rl(e){return e===null||!Ki(e)?!0:sr.isFrozen(e)}var Xu="MapSet",Ju="Patches",OA="ArrayMethods",Zu={};function Mo(e){let t=Zu[e];return t||Ft(0,e),t}var _A=e=>!!Zu[e];function RO(e,t){Zu[e]||(Zu[e]=t)}var sc,LA=()=>sc,IO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:_A(Xu)?Mo(Xu):void 0,arrayMethodsPlugin_:_A(OA)?Mo(OA):void 0});function NA(e,t){t&&(e.patchPlugin_=Mo(Ju),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rh(e){nh(e),e.drafts_.forEach(EO),e.drafts_=null}function nh(e){e===sc&&(sc=e.parent_)}var DA=e=>sc=IO(sc,e);function EO(e){let t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function qA(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ct].modified_&&(rh(t),Ft(4)),$t(e)&&(e=MA(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ct].base_,e,t)}else e=MA(t,r);return FO(t,e,!0),rh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ah?e:void 0}function MA(e,t){if(rl(t))return t;let r=t[Ct];if(!r)return el(t,e.handledSet_,e);if(!nl(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);BA(r,e)}return r.copy_}function FO(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ch(t,r)}function UA(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var nl=(e,t)=>e.scope_===t,TO=[];function QA(e,t,r,n){let o=Rn(e),i=e.type_;if(n!==void 0&&wn(o,n,i)===t){Ku(o,n,r,i);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;dc(o,(f,m)=>{if(Gt(m)){let h=p.get(m)||[];h.push(f),p.set(m,h)}})}let a=e.draftLocations_.get(t)??TO;for(let p of a)Ku(o,p,r,i)}function PO(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!nl(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=sh(i);QA(e,i.draft_??i,a,r),BA(i,o)})}function BA(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)}UA(e)}}function kO(e,t,r){let{scope_:n}=e;if(Gt(r)){let o=r[Ct];nl(o,n)&&o.callbacks_.push(function(){Wu(e);let a=sh(o);QA(e,r,a,t)})}else $t(r)&&e.callbacks_.push(function(){let i=Rn(e);e.type_===3?i.has(r)&&el(r,n.handledSet_,n):wn(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&el(wn(e.copy_,t,e.type_),n.handledSet_,n)})}function el(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Gt(e)||t.has(e)||!$t(e)||rl(e)||(t.add(e),dc(e,(n,o)=>{if(Gt(o)){let i=o[Ct];if(nl(i,r)){let a=sh(i);Ku(e,n,a,e.type_),UA(i)}}else $t(o)&&el(o,t,r)})),e}function OO(e,t){let r=pc(e),n={type_:r?1:0,scope_:t?t.scope_:LA(),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=tl;r&&(o=[n],i=cc);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,[p,n]}var tl={get(e,t){if(t===Ct)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=Rn(e);if(!oc(o,t,e.type_))return _O(e,o,t);let i=o[t];if(e.finalized_||!$t(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&bO(t))return i;if(i===Zg(e.base_,t)){Wu(e);let a=e.type_===1?+t:t,p=ih(e.scope_,i,e,a);return e.copy_[a]=p}return i},has(e,t){return t in Rn(e)},ownKeys(e){return Reflect.ownKeys(Rn(e))},set(e,t,r){let n=GA(Rn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Zg(Rn(e),t),i=o?.[Ct];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(CO(r,o)&&(r!==void 0||oc(e.base_,t,e.type_)))return!0;Wu(e),oh(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),kO(e,t,r)),!0},deleteProperty(e,t){return Wu(e),Zg(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),oh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Rn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[zu]:!0,[eh]:e.type_!==1||t!=="length",[Yu]:n[Yu],[ac]:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return Do(e.base_)},setPrototypeOf(){Ft(12)}},cc={};for(let e in tl){let t=tl[e];cc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}cc.deleteProperty=function(e,t){return cc.set.call(this,e,t,void 0)};cc.set=function(e,t,r){return tl.set.call(this,e[0],t,r,e[0])};function Zg(e,t){let r=e[Ct];return(r?Rn(r):e)[t]}function _O(e,t,r){let n=GA(t,r);return n?ac in n?n[ac]:n.get?.call(e.draft_):void 0}function GA(e,t){if(!(t in e))return;let r=Do(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Do(r)}}function oh(e){e.modified_||(e.modified_=!0,e.parent_&&oh(e.parent_))}function Wu(e){e.copy_||(e.assigned_=new Map,e.copy_=th(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var NO=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(No(t)&&!No(r)){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,h=>r.call(this,h,...m))}}No(r)||Ft(6),n!==void 0&&!No(n)&&Ft(7);let o;if($t(t)){let i=DA(this),a=ih(i,t,void 0),p=!0;try{o=r(a),p=!1}finally{p?rh(i):nh(i)}return NA(i,n),qA(o,i)}else if(!t||!Ki(t)){if(o=r(t),o===void 0&&(o=t),o===ah&&(o=void 0),this.autoFreeze_&&ch(o,!0),n){let i=[],a=[];Mo(Ju).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Ft(1,t)},this.produceWithPatches=(t,r)=>{if(No(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]},Jg(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Jg(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Jg(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){$t(e)||Ft(8),Gt(e)&&(e=ol(e));let t=DA(this),r=ih(t,e,void 0);return r[Ct].isManual_=!0,nh(t),r}finishDraft(e,t){let r=e&&e[Ct];(!r||!r.isManual_)&&Ft(9);let{scope_:n}=r;return NA(n,t),qA(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=Mo(Ju).applyPatches_;return Gt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function ih(e,t,r,n){let[o,i]=fc(t)?Mo(Xu).proxyMap_(t,r):mc(t)?Mo(Xu).proxySet_(t,r):OO(t,r);return(r?.scope_??LA()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?PO(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 ol(e){return Gt(e)||Ft(10,e),$A(e)}function $A(e){if(!$t(e)||rl(e))return e;let t=e[Ct],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=th(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=th(e,!0);return dc(r,(o,i)=>{Ku(r,o,$A(i))},n),t&&(t.finalized_=!1),r}function HA(){function t(S,x=[]){if(S.key_!==void 0){let w=S.parent_.copy_??S.parent_.base_,R=xO(wn(w,S.key_)),P=wn(w,S.key_);if(P===void 0||P!==S.draft_&&P!==S.base_&&P!==S.copy_||R!=null&&R.base_!==S.base_)return null;let E=S.parent_.type_===3,_;if(E){let F=S.parent_;_=Array.from(F.drafts_.keys()).indexOf(S.key_)}else _=S.key_;if(!(E&&w.size>_||oc(w,_)))return null;x.push(_)}if(S.parent_)return t(S.parent_,x);x.reverse();try{r(S.copy_,x)}catch{return null}return x}function r(S,x){let w=S;for(let R=0;R<x.length-1;R++){let P=x[R];if(w=wn(w,P),!Ki(w)||w===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return w}let n="replace",o="add",i="remove";function a(S,x,w){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);let{patches_:R,inversePatches_:P}=w;switch(S.type_){case 0:case 2:return f(S,x,R,P);case 1:return p(S,x,R,P);case 3:return m(S,x,R,P)}}function p(S,x,w,R){let{base_:P,assigned_:E}=S,_=S.copy_;_.length<P.length&&([P,_]=[_,P],[w,R]=[R,w]);let F=S.allIndicesReassigned_===!0;for(let q=0;q<P.length;q++){let G=_[q],Q=P[q];if((F||E?.get(q.toString()))&&G!==Q){let B=G?.[Ct];if(B&&B.modified_)continue;let L=x.concat([q]);w.push({op:n,path:L,value:g(G)}),R.push({op:n,path:L,value:g(Q)})}}for(let q=P.length;q<_.length;q++){let G=x.concat([q]);w.push({op:o,path:G,value:g(_[q])})}for(let q=_.length-1;P.length<=q;--q){let G=x.concat([q]);R.push({op:i,path:G})}}function f(S,x,w,R){let{base_:P,copy_:E,type_:_}=S;dc(S.assigned_,(F,q)=>{let G=wn(P,F,_),Q=wn(E,F,_),j=q?oc(P,F)?n:o:i;if(G===Q&&j===n)return;let B=x.concat(F);w.push(j===i?{op:j,path:B}:{op:j,path:B,value:g(Q)}),R.push(j===o?{op:i,path:B}:j===i?{op:o,path:B,value:g(G)}:{op:n,path:B,value:g(G)})})}function m(S,x,w,R){let{base_:P,copy_:E}=S,_=0;P.forEach(F=>{if(!E.has(F)){let q=x.concat([_]);w.push({op:i,path:q,value:F}),R.unshift({op:o,path:q,value:F})}_++}),_=0,E.forEach(F=>{if(!P.has(F)){let q=x.concat([_]);w.push({op:o,path:q,value:F}),R.unshift({op:i,path:q,value:F})}_++})}function h(S,x,w){let{patches_:R,inversePatches_:P}=w;R.push({op:n,path:[],value:x===ah?void 0:x}),P.push({op:n,path:[],value:S})}function C(S,x){return x.forEach(w=>{let{path:R,op:P}=w,E=S;for(let G=0;G<R.length-1;G++){let Q=qo(E),j=R[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(Q===0||Q===1)&&(j==="__proto__"||j===ic)&&Ft(19),No(E)&&j===lc&&Ft(19),E=wn(E,j),Ki(E)||Ft(18,R.join("/"))}let _=qo(E),F=b(w.value),q=R[R.length-1];switch(P){case n:switch(_){case 2:return E.set(q,F);case 3:Ft(16);default:return E[q]=F}case o:switch(_){case 1:return q==="-"?E.push(F):E.splice(q,0,F);case 2:return E.set(q,F);case 3:return E.add(F);default:return E[q]=F}case i:switch(_){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,P)}}),S}function b(S){if(!$t(S))return S;if(pc(S))return S.map(b);if(fc(S))return new Map(Array.from(S.entries()).map(([w,R])=>[w,b(R)]));if(mc(S))return new Set(Array.from(S).map(b));let x=Object.create(Do(S));for(let w in S)x[w]=b(S[w]);return oc(S,nc)&&(x[nc]=S[nc]),x}function g(S){return Gt(S)?b(S):S}RO(Ju,{applyPatches_:C,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var uc=new NO,Vo=uc.produce,uh=uc.produceWithPatches.bind(uc);var lh=uc.applyPatches.bind(uc);d();c();l();u();function DO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function qO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function MO(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 zA=e=>Array.isArray(e)?e:[e];function VO(e){let t=Array.isArray(e[0])?e[0]:e;return MO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function jO(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var J3=Object.getPrototypeOf({});var LO=class{constructor(e){this.value=e}deref(){return this.value}},UO=typeof WeakRef<"u"?WeakRef:LO,QO=0,WA=1;function il(){return{s:QO,v:void 0,o:null,p:null}}function gc(e,t={}){let r=il(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let C=0,b=f;C<b;C++){let g=arguments[C];if(typeof g=="function"||typeof g=="object"&&g!==null){let S=p.o;S===null&&(p.o=S=new WeakMap);let x=S.get(g);x===void 0?(p=il(),S.set(g,p)):p=x}else{let S=p.p;S===null&&(p.p=S=new Map);let x=S.get(g);x===void 0?(p=il(),S.set(g,p)):p=x}}let m=p,h;if(p.s===WA)h=p.v;else if(h=e.apply(null,arguments),i++,n){let C=o?.deref?.()??o;C!=null&&n(C,h)&&(h=C,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new UO(h):h}return m.s=WA,m.v=h,h}return a.clearCache=()=>{r=il(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function BO(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()),DO(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let h={...r,...f},{memoize:C,memoizeOptions:b=[],argsMemoize:g=gc,argsMemoizeOptions:S=[],devModeChecks:x={}}=h,w=zA(b),R=zA(S),P=VO(o),E=C(function(){return i++,m.apply(null,arguments)},...w),_=!0,F=g(function(){a++;let G=jO(P,arguments);return p=E.apply(null,G),p},...R);return Object.assign(F,{resultFunc:m,memoizedResultFunc:E,dependencies:P,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:C,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var it=BO(gc),GO=Object.assign((e,t=it)=>{qO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((a,p,f)=>(a[r[f]]=p,a),{}))},{withTypes:()=>GO});d();c();l();u();function YA(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var KA=YA(),XA=YA;var $O=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?tc:tc.apply(null,arguments)},hz=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},HO=e=>e&&typeof e.match=="function";function T(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Ht(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=>rc(n)&&n.type===e,r}var iC=class hc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,hc.prototype)}static get[Symbol.species](){return hc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new hc(...t[0].concat(this)):new hc(...t.concat(this))}};function JA(e){return $t(e)?Vo(e,()=>{}):e}function al(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function zO(e){return typeof e=="boolean"}var WO=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new iC;return r&&(zO(r)?a.push(KA):a.push(XA(r.extraArgument))),a},yc="RTK_autoBatch",Zi=()=>e=>({payload:e,meta:{[yc]:!0}}),ZA=e=>t=>{setTimeout(t,e)},YO=(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?window.requestAnimationFrame:ZA(10):e.type==="callback"?e.queueNotification:ZA(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let C=()=>o&&h(),b=n.subscribe(C);return p.add(h),()=>{b(),p.delete(h)}},dispatch(h){try{return o=!h?.meta?.[yc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(h)}finally{o=!0}}})},KO=e=>function(r){let{autoBatch:n=!0}=r??{},o=new iC(e);return n&&o.push(YO(typeof n=="object"?n:void 0)),o};function aC(e){let t=WO(),{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(jr(r))f=Yi(r);else throw new Error(Ht(1));let m;typeof n=="function"?m=n(t):m=t();let h=tc;o&&(h=$O({trace:!1,...(typeof o=="object"&&o)}));let C=PA(...m),b=KO(C),g=typeof p=="function"?p(b):b(),S=h(...g);return Xg(f,a,S)}function sC(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(Ht(28));if(p in t)throw new Error(Ht(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 XO(e){return typeof e=="function"}function le(e,t){let[r,n,o]=sC(t),i;if(XO(e))i=()=>JA(e());else{let p=JA(e);i=()=>p}function a(p=i(),f){let m=[r[f.type],...n.filter(({matcher:h})=>h(f)).map(({reducer:h})=>h)];return m.filter(h=>!!h).length===0&&(m=[o]),m.reduce((h,C)=>{if(C)if(Gt(h)){let g=C(h,f);return g===void 0?h:g}else{if($t(h))return Vo(h,b=>C(b,f));{let b=C(h,f);if(b===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return h},p)}return a.getInitialState=i,a}var cC=(e,t)=>HO(e)?e.match(t):e(t);function Lr(...e){return t=>e.some(r=>cC(r,t))}function Ji(...e){return t=>e.every(r=>cC(r,t))}function ll(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 Sc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function dl(...e){return e.length===0?t=>ll(t,["pending"]):Sc(e)?Lr(...e.map(t=>t.pending)):dl()(e[0])}function Lo(...e){return e.length===0?t=>ll(t,["rejected"]):Sc(e)?Lr(...e.map(t=>t.rejected)):Lo()(e[0])}function vc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ji(Lo(...e),t):Sc(e)?Ji(Lo(...e),t):vc()(e[0])}function In(...e){return e.length===0?t=>ll(t,["fulfilled"]):Sc(e)?Lr(...e.map(t=>t.fulfilled)):In()(e[0])}function pl(...e){return e.length===0?t=>ll(t,["pending","fulfilled","rejected"]):Sc(e)?Lr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):pl()(e[0])}var JO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ac=(e=21)=>{let t="",r=e;for(;r--;)t+=JO[Math.random()*64|0];return t},ZO=["name","message","stack","code"],dh=class{constructor(e,t){De(this,"_type");this.payload=e,this.meta=t}},eC=class{constructor(e,t){De(this,"_type");this.payload=e,this.meta=t}},e_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of ZO)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},tC="External signal was aborted",pe=(()=>{function e(t,r,n){let o=T(t+"/fulfilled",(f,m,h,C)=>({payload:f,meta:{...(C||{}),arg:h,requestId:m,requestStatus:"fulfilled"}})),i=T(t+"/pending",(f,m,h)=>({payload:void 0,meta:{...(h||{}),arg:m,requestId:f,requestStatus:"pending"}})),a=T(t+"/rejected",(f,m,h,C,b)=>({payload:C,error:(n&&n.serializeError||e_)(f||"Rejected"),meta:{...(b||{}),arg:h,requestId:m,rejectedWithValue:!!C,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(h,C,b)=>{let g=n?.idGenerator?n.idGenerator(f):Ac(),S=new s.AbortController,x,w;function R(E){w=E,S.abort()}m&&(m.aborted?R(tC):m.addEventListener("abort",()=>R(tC),{once:!0}));let P=_asyncToGenerator(function*(){let E;try{let F=n?.condition?.(f,{getState:C,extra:b});if(r_(F)&&(F=yield F),F===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,Q)=>{x=()=>{Q({name:"AbortError",message:w||"Aborted"})},S.signal.addEventListener("abort",x,{once:!0})});h(i(g,f,n?.getPendingMeta?.({requestId:g,arg:f},{getState:C,extra:b}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:h,getState:C,extra:b,requestId:g,signal:S.signal,abort:R,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,g,f,G.meta):o(G,g,f)})])}catch(F){E=F instanceof dh?a(null,g,f,F.payload,F.meta):a(F,g,f)}finally{x&&S.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(E)&&E.meta.condition||h(E),E})();return Object.assign(P,{abort:R,requestId:g,arg:f,unwrap(){return P.then(t_)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:Lr(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function t_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function r_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var uC=Symbol.for("rtk-slice-createasyncthunk"),Sz={[uC]:pe};function n_(e,t){return`${e}/${t}`}function o_({creators:e}={}){let t=e?.asyncThunk?.[uC];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(Ht(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(a_()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,_){let F=typeof E=="string"?E:E.type;if(!F)throw new Error(Ht(12));if(F in f.sliceCaseReducersByType)throw new Error(Ht(13));return f.sliceCaseReducersByType[F]=_,m},addMatcher(E,_){return f.sliceMatchers.push({matcher:E,reducer:_}),m},exposeAction(E,_){return f.actionCreators[E]=_,m},exposeCaseReducer(E,_){return f.sliceCaseReducersByName[E]=_,m}};p.forEach(E=>{let _=a[E],F={reducerName:E,type:n_(o,E),createNotation:typeof n.reducers=="function"};c_(_)?l_(F,_,m,t):s_(F,_,m)});function h(){let[E={},_=[],F=void 0]=typeof n.extraReducers=="function"?sC(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return le(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 _)G.addMatcher(Q.matcher,Q.reducer);F&&G.addDefaultCase(F)})}let C=E=>E,b=new Map,g=new WeakMap,S;function x(E,_){return S||(S=h()),S(E,_)}function w(){return S||(S=h()),S.getInitialState()}function R(E,_=!1){function F(G){let Q=G[E];return typeof Q>"u"&&_&&(Q=al(g,F,w)),Q}function q(G=C){let Q=al(b,_,()=>new WeakMap);return al(Q,G,()=>{let j={};for(let[B,L]of Object.entries(n.selectors??{}))j[B]=i_(L,G,()=>al(g,G,w),_);return j})}return{reducerPath:E,getSelectors:q,get selectors(){return q(F)},selectSlice:F}}let P={name:o,reducer:x,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...R(i),injectInto(E,{reducerPath:_,...F}={}){let q=_??i;return E.inject({reducerPath:q,reducer:x},F),{...P,...R(q,!0)}}};return P}}function i_(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 Uo=o_();function a_(){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 s_({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!u_(n))throw new Error(Ht(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?T(e,a):T(e))}function c_(e){return e._reducerDefinitionType==="asyncThunk"}function u_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function l_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Ht(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:h}=r,C=o(e,i,h);n.exposeAction(t,C),a&&n.addCase(C.fulfilled,a),p&&n.addCase(C.pending,p),f&&n.addCase(C.rejected,f),m&&n.addMatcher(C.settled,m),n.exposeCaseReducer(t,{fulfilled:a||sl,pending:p||sl,rejected:f||sl,settled:m||sl})}function sl(){}var d_="task",lC="listener",dC="completed",mh="cancelled",p_=`task-${mh}`,f_=`task-${dC}`,ph=`${lC}-${mh}`,m_=`${lC}-${dC}`,fl=class{constructor(e){De(this,"name","TaskAbortError");De(this,"message");this.code=e,this.message=`${d_} ${mh} (reason: ${e})`}},gh=(e,t)=>{if(typeof e!="function")throw new TypeError(Ht(32))},cl=()=>{},pC=(e,t=cl)=>(e.catch(t),e),fC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),jo=e=>{if(e.aborted)throw new fl(e.reason)};function mC(e,t){let r=cl;return new Promise((n,o)=>{let i=()=>o(new fl(e.reason));if(e.aborted){i();return}r=fC(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=cl})}var g_=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof fl?"cancelled":"rejected",error:r}}finally{t?.()}});return function g_(_x7,_x8){return _ref5.apply(this,arguments)}}(),ul=e=>t=>pC(mC(e,t).then(r=>(jo(e),r))),gC=e=>{let t=ul(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Xi}=Object,rC={},ml="listenerMiddleware",h_=(e,t)=>{let r=n=>fC(e,()=>n.abort(e.reason));return(n,o)=>{gh(n,"taskExecutor");let i=new s.AbortController;r(i);let a=g_(/*#__PURE__*/_asyncToGenerator(function*(){jo(e),jo(i.signal);let p=yield n({pause:ul(i.signal),delay:gC(i.signal),signal:i.signal});return jo(i.signal),p}),()=>i.abort(f_));return o?.autoJoin&&t.push(a.catch(cl)),{result:ul(e)(a),cancel(){i.abort(p_)}}}},y_=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){jo(t);let i=()=>{},p=[new Promise((f,m)=>{let h=e({predicate:n,effect:(C,b)=>{b.unsubscribe(),f([C,b.getState(),b.getOriginalState()])}});i=()=>{h(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield mC(t,Promise.race(p));return jo(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>pC(r(n,o))},hC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=T(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Ht(21));return gh(i,"options.listener"),{predicate:o,type:t,effect:i}},yC=Xi(e=>{let{type:t,predicate:r,effect:n}=hC(e);return{id:Ac(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Ht(22))}}},{withTypes:()=>yC}),nC=(e,t)=>{let{type:r,effect:n,predicate:o}=hC(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},fh=e=>{e.pending.forEach(t=>{t.abort(ph)})},S_=(e,t)=>()=>{for(let r of t.keys())fh(r);e.clear()},oC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},SC=Xi(T(`${ml}/add`),{withTypes:()=>SC}),v_=T(`${ml}/removeAll`),vC=Xi(T(`${ml}/remove`),{withTypes:()=>vC}),A_=(...e)=>{console.error(`${ml}/error`,...e)},AC=(e={})=>{let t=new Map,r=new Map,n=g=>{let S=r.get(g)??0;r.set(g,S+1)},o=g=>{let S=r.get(g)??1;S===1?r.delete(g):r.set(g,S-1)},{extra:i,onError:a=A_}=e;gh(a,"onError");let p=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),S=>{g.unsubscribe(),S?.cancelActive&&fh(g)}),f=g=>{let S=nC(t,g)??yC(g);return p(S)};Xi(f,{withTypes:()=>f});let m=g=>{let S=nC(t,g);return S&&(S.unsubscribe(),g.cancelActive&&fh(S)),!!S};Xi(m,{withTypes:()=>m});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,S,x,w){let R=new s.AbortController,P=y_(f,R.signal),E=[];try{g.pending.add(R),n(g),yield Promise.resolve(g.effect(S,Xi({},x,{getOriginalState:w,condition:(_,F)=>P(_,F).then(Boolean),take:P,delay:gC(R.signal),pause:ul(R.signal),extra:i,signal:R.signal,fork:h_(R.signal,E),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((_,F,q)=>{_!==R&&(_.abort(ph),q.delete(_))})},cancel:()=>{R.abort(ph),g.pending.delete(R)},throwIfCancelled:()=>{jo(R.signal)}})))}catch(_){_ instanceof fl||oC(a,_,{raisedBy:"effect"})}finally{yield Promise.all(E),R.abort(m_),o(g),g.pending.delete(R)}});return function h(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),C=S_(t,r);return{middleware:g=>S=>x=>{if(!rc(x))return S(x);if(SC.match(x))return f(x.payload);if(v_.match(x)){C();return}if(vC.match(x))return m(x.payload);let w=g.getState(),R=()=>{if(w===rC)throw new Error(Ht(23));return w},P;try{if(P=S(x),t.size>0){let E=g.getState(),_=Array.from(t.values());for(let F of _){let q=!1;try{q=F.predicate(x,E,w)}catch(G){q=!1,oC(a,G,{raisedBy:"predicate"})}q&&h(F,x,g,R)}}}finally{w=rC}return P},startListening:f,stopListening:m,clearListeners:C}};function Ht(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 CC(){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 bC=/^(?:[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 C_(e){return typeof e=="string"&&bC.test(e)}var hh=C_;d();c();l();u();var Tt=[];for(let e=0;e<256;++e)Tt.push((e+256).toString(16).slice(1));function xC(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 yh,b_=new Uint8Array(16);function Sh(){if(!yh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yh=crypto.getRandomValues.bind(crypto)}return yh(b_)}d();c();l();u();d();c();l();u();var x_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vh={randomUUID:x_};function w_(e,t,r){e=e||{};let n=e.random??e.rng?.()??Sh();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 xC(n)}function R_(e,t,r){return vh.randomUUID&&!t&&!e?vh.randomUUID():w_(e,t,r)}var Ah=R_;function I_(_x13){return _I_.apply(this,arguments)}function _I_(){_I_=_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 _I_.apply(this,arguments)}var TC="2.1.1",Ch=128,PC=192,wC=224,RC=240,E_=248;function F_(e){return(e&E_)===RC?4:(e&RC)===wC?3:(e&wC)===PC?2:1}function T_(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&Ch)!=Ch)break;if(r-=3,(n&PC)!=Ch){t-r>=F_(n)*3&&(r=t);break}}return e.substring(0,r)}function P_(e){let{trackingId:t}=e;return{trackingId:t}}function k_(e){return(e.source||[]).concat([`relay@${TC}`])}function kC(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=P_(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:k_(t),clientId:p,userAgent:i(),referrer:IC(n()),location:IC(o())})}function IC(e){return e!==null?T_(e,1024):null}function O_(e,t,r,n){return{...t,meta:kC(e,r,n)}}var __="*";function N_(){let e=[];function t({type:f,callback:m}){return e.findIndex(h=>h.type===f&&h.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(h){console.error(h)}})}function i(f){if(f===__)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 EC({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 D_(e){let t=EC(e);return{get:()=>t,update:r=>{t=EC({...t,...r})}}}var bh=q_();function q_(){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 M_(){return{getItem(e){return bh.getItem(e)||localStorage.getItem(e)},removeItem(e){bh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),bh.setItem(e,t,31556952e3)}}}var FC="visitorId";function V_(){let e=document.referrer;return e===""?null:e}function xh(){let e=M_();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}`}});CC().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:()=>V_(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(FC);if(t&&hh(t))return t;let r=Ah();return e.setItem(FC,r),r}}}function j_(){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 L_(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function U_(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=L_();return t&&r?{...r,runtime:"custom"}:t&&Q_()&&j_()?xh():n}function Q_(){try{return typeof window=="object"}catch{return!1}}function B_(e){return{get:()=>Object.freeze(U_(e))}}function OC(e){let t=D_(e),r=N_(),n=B_(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),f=O_(o,i,a,p);return I_({config:a,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>kC(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:TC}}d();c();l();u();function _C(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Gn="3.49.2",NC=["@coveo/atomic","@coveo/quantic"];var ea=it(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Gn}`));var Cc=it(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ea(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=$_(p);return OC({mode:i?"emit":"disabled",url:o??Du(e,t),token:r,trackingId:n??null,source:a,environment:f})}),G_={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},$_=e=>{if(!e)return;let t=e();return{...(_C()?xh():G_),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Ur(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(h){try{m(n.next(h))}catch(C){a(C)}}function f(h){try{m(n.throw(h))}catch(C){a(C)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var Oe;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Oe||(Oe={}));function Ih(){return typeof window<"u"}function Lh(){return typeof navigator<"u"}function ta(){return typeof document<"u"}function Eh(){try{return typeof localStorage<"u"}catch{return!1}}function H_(){try{return typeof sessionStorage<"u"}catch{return!1}}function zC(){return Lh()&&navigator.cookieEnabled}var z_=[Oe.click,Oe.custom,Oe.search,Oe.view],W_=(e,t)=>z_.indexOf(e)!==-1?Object.assign({language:ta()?document.documentElement.lang:"unknown",userAgent:Lh()?navigator.userAgent:"unknown"},t):t,xc=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?DC(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],DC(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 DC(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function Y_(){return Eh()?localStorage:zC()?new wc:H_()?sessionStorage:new na}var wc=class e{getItem(t){return xc.get(`${e.prefix}${t}`)}removeItem(t){xc.erase(`${e.prefix}${t}`)}setItem(t,r,n){xc.set(`${e.prefix}${t}`,r,n)}};wc.prefix="coveo_";var Fh=class{constructor(){this.cookieStorage=new wc}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)}},na=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},gl="__coveo.analytics.history",K_=20,X_=1e3*60,J_=75,Sl=class{constructor(t){this.store=t||Y_()}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(gl);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(gl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(gl,JSON.stringify(t.slice(0,K_)))}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,J_)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>X_:!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 Z_=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Oe.view?(yield eN(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),eN=e=>U(void 0,void 0,void 0,function*(){let t=new Sl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),hl,tN=new Uint8Array(16);function rN(){if(!hl&&(hl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hl(tN)}var nN=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vl(e){return typeof e=="string"&&nN.test(e)}var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function WC(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]]}function oN(e){if(!vl(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function iN(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var aN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function cN(e,t,r){function n(o,i,a,p){var f;if(typeof o=="string"&&(o=iN(o)),typeof i=="string"&&(i=oN(i)),((f=i)===null||f===void 0?void 0:f.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+o.length);if(m.set(i),m.set(o,i.length),m=r(m),m[6]=m[6]&15|t,m[8]=m[8]&63|128,a){p=p||0;for(let h=0;h<16;++h)a[p+h]=m[h];return a}return WC(m)}try{n.name=e}catch{}return n.DNS=aN,n.URL=sN,n}var uN=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qC={randomUUID:uN};function Qo(e,t,r){if(qC.randomUUID&&!t&&!e)return qC.randomUUID();e=e||{};let n=e.random||(e.rng||rN)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return WC(n)}function lN(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 wh(e,t){return e<<t|e>>>32-t}function dN(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let p=0;p<a.length;++p)e.push(a.charCodeAt(p))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let p=new Uint32Array(16);for(let f=0;f<16;++f)p[f]=e[a*64+f*4]<<24|e[a*64+f*4+1]<<16|e[a*64+f*4+2]<<8|e[a*64+f*4+3];i[a]=p}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let p=new Uint32Array(80);for(let g=0;g<16;++g)p[g]=i[a][g];for(let g=16;g<80;++g)p[g]=wh(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);let f=r[0],m=r[1],h=r[2],C=r[3],b=r[4];for(let g=0;g<80;++g){let S=Math.floor(g/20),x=wh(f,5)+lN(S,m,h,C)+b+t[S]+p[g]>>>0;b=C,C=h,h=wh(m,30)>>>0,m=f,f=x}r[0]=r[0]+f>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var pN=cN("v5",80,dN),MC=pN,YC="2.30.54",VC=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,bc={pageview:"pageview",event:"event"},Al=class{constructor({client:t,uuidGenerator:r=Qo}){this.client=t,this.uuidGenerator=r}},Th=class extends Al{constructor({client:t,uuidGenerator:r=Qo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=VC(window.location),this.lastReferrer=ta()?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:ta()?document.title:"",encoding:ta()?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===bc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===bc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===bc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===bc.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 VC(window.location)}},$n=class e{constructor(t,r){if(!vl(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 vl(i)?new e(i,Number.parseInt(o)*1e3):null}};$n.cvo_cid="cvo_cid";$n.expirationTime=120;var Ph=class extends Al{constructor({client:t,uuidGenerator:r=Qo}){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($n.cvo_cid,new $n(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Ph.Id="link";var hr=Object.keys;function yl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Rh=128,KC=192,jC=224,LC=240;function fN(e){return(e&248)===LC?4:(e&LC)===jC?3:(e&jC)===KC?2:1}function mN(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&Rh)!=Rh)break;if(r-=3,(n&KC)!=Rh){t-r>=fN(n)*3&&(r=t);break}}return e.substring(0,r)}var kh={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"},gN=hr(kh).map(e=>kh[e]),hN=[...gN].join("|"),yN=new RegExp(`^(${hN}$)`),SN={svcAction:"svc_action",svcActionData:"svc_action_data"},vN=e=>hr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=kh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),AN=e=>yN.test(e),CN=[AN],UC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},QC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Mt={action:"pa",list:"pal",listSource:"pls"},Cl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},bN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Oh={id:"quoteId",affiliation:"quoteAffiliation"},_h={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},xN={add:Mt,bookmark_add:Mt,bookmark_remove:Mt,click:Mt,checkout:Mt,checkout_option:Mt,detail:Mt,impression:Mt,remove:Mt,refund:Object.assign(Object.assign({},Mt),Cl),purchase:Object.assign(Object.assign({},Mt),Cl),quickview:Mt,quote:Object.assign(Object.assign({},Mt),Oh),review:Object.assign(Object.assign({},Mt),_h)},wN=hr(UC).map(e=>UC[e]),RN=hr(QC).map(e=>QC[e]),IN=hr(Mt).map(e=>Mt[e]),EN=hr(Cl).map(e=>Cl[e]),FN=hr(_h).map(e=>_h[e]),TN=hr(Oh).map(e=>Oh[e]),PN=[...wN,"custom"].join("|"),kN=[...RN,"custom"].join("|"),XC="(pr[0-9]+)",JC="(il[0-9]+pi[0-9]+)",ON=new RegExp(`^${XC}(${PN})$`),_N=new RegExp(`^(${JC}(${kN}))|(il[0-9]+nm)$`),NN=new RegExp(`^(${IN.join("|")})$`),DN=new RegExp(`^(${EN.join("|")})$`),qN=new RegExp(`^${XC}custom$`),MN=new RegExp(`^${JC}custom$`),VN=new RegExp(`^(${[...bN,...FN,...TN].join("|")})$`),jN=e=>ON.test(e),LN=e=>_N.test(e),UN=e=>NN.test(e),QN=e=>DN.test(e),BN=e=>VN.test(e),GN=[LN,jN,UN,QN,BN],$N=[qN,MN],HN={anonymizeIp:"aip"},zN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},WN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},YN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],KN=Object.assign(Object.assign(Object.assign(Object.assign({},HN),zN),WN),YN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Nh=Object.assign(Object.assign({},KN),SN),XN=e=>{let t=!!e.action&&xN[e.action]||{};return hr(e).reduce((r,n)=>{let o=t[n]||Nh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},JN=hr(Nh).map(e=>Nh[e]),ZN=e=>JN.indexOf(e)!==-1,e0=e=>e==="custom",t0=e=>[...GN,...CN,ZN,e0].some(t=>t(e)),r0=e=>hr(e).reduce((t,r)=>{let n=n0(r);return n?Object.assign(Object.assign({},t),o0(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),n0=e=>{let t;return[...$N].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},o0=(e,t)=>hr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Dh=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[Oe.click,Oe.custom,Oe.search,Oe.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}},qh=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()})}},BC=y.fetch,bl=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,h=Ur(f,["url"]),C;try{C=yield BC(m,h)}catch(b){console.error("An error has occured when sending the event.",b);return}if(C.ok){let b=yield C.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}else{try{C.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,C,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 BC(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Oe.click,Oe.custom,Oe.search,Oe.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"})}},Mh=class{constructor(t,r){Eh()&&zC()?this.storage=new Fh:Eh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new na),this.client=new bl(t),this.beaconClient=new Dh(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}},Vh=class{constructor(t,r){this.storage=r||new na,this.client=new bl(t)}getClientDependingOnEventType(t){return this.client}},xl=class{constructor(){this.storage=new na,this.client=new qh}getClientDependingOnEventType(t){return this.client}},i0="xx",a0=e=>e?.startsWith(i0)||!1,s0=`
27
+ `;return new Oo(r)}var Oo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Pe=class{constructor(e){he(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 Gk(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}},$e=class{constructor(e={}){he(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ee(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 Ua(e){return e===void 0}function $k(e){return e===null}function ee(e){return Ua(e)||$k(e)}var pe=class{constructor(e={}){he(this,"value");this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(Hk(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Hk(e){return Ua(e)||Pu(e)}function Pu(e){return typeof e=="boolean"}var oe=class{constructor(e={}){he(this,"config");he(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(zk(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 zk(e){return Ua(e)||Kv(e)}function Kv(e){return typeof e=="number"&&!Number.isNaN(e)}var Wk=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){he(this,"value");he(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new $e(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(Ua(e))return null;if(!Qa(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&&!(Wk.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 Qa(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){he(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ua(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Xv(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ee(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 Xv(e){return e!==void 0&&typeof e=="object"}var ne=class{constructor(e={}){he(this,"config");he(this,"value");this.config=e,this.value=new $e(this.config)}validate(e){if(!ee(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ee(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&&ee(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 Pu(e)||Qa(e)||Kv(e)||Xv(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ba(e){return Array.isArray(e)}var zs=class{constructor(e){he(this,"config");he(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ua(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 ku=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Ou(e){return Array.isArray(e)}function _u(e){return e.trim()===""}function Zv(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function Yk(e){return btoa(encodeURI(e))}function Nu(e,t){let{[e]:r,...n}=t;return n}function Ga(e){return Yk(JSON.stringify(e))}var Kk=new Set(["1",1,"yes",!0]);function Jv(){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=>Kk.has(r))}function eA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function tA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Ws(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Du(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 Xk(e){if(_u(e.openingDelimiter)||_u(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ee(e.content)||_u(e.content))return e.content;if(e.highlights.length===0)return $a(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+=$a(e.content.slice(n,i)),r+=e.openingDelimiter,r+=$a(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=$a(e.content.slice(n))),r}function Mg(e,t){return e=$a(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?qg(n,t.notMatchDelimiters):o?qg(o,t.exactMatchDelimiters):a?qg(a,t.correctionDelimiters):r)}function qg(e,t){return t?t.open+e+t.close:e}function $a(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 fA=Fr(uA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),Ha=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."}},No=class extends Error{constructor(r,n){super();he(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 lA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function dA(e){return typeof e!="object"||!e?!1:Object.values(e).every(xO)}function xO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function pA(e){return e===429}var jr=class e{static call(t){return _asyncToGenerator(function*(){let r=wO(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(pA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,fA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&pA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(C=>setTimeout(C,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 Ha;case 404:throw new No(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new No(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Ws(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 Ke(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Kt(e,t="prod"){return`${Ke(e,t)}/rest/search/v2`}function Mu(e,t="prod"){return`${Ke(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function wO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=RO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function RO(e,t){return t==="application/x-www-form-urlencoded"?dA(e)?lA(e):"":JSON.stringify(e)}d();c();l();u();var Xs=Fr(Vu(),1),vA=Fr(mA(),1);d();c();l();u();var ju=Fr(Vu(),1),hA=Fr(gA(),1);ju.default.extend(hA.default);var yA="YYYY/MM/DD@HH:mm:ss",IO="1401-01-01";function za(e,t){let r=(0,ju.default)(e,t);return!r.isValid()&&!t?(0,ju.default)(e,yA):r}function Lu(e){return e.format(yA)}function SA(e,t){let r=za(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}`)}Jg(r)}function Jg(e){if(e.isBefore(IO))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Xs.default.extend(vA.default);var AA=["past","now","next"],CA=["minute","hour","day","week","month","quarter","year"],EO=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new $({required:!t,constrainTo:CA}),period:new $({required:!0,constrainTo:AA})}};function Uu(e){if(typeof e=="string"&&!Qn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?eh(e):e;new Pe(EO(t.period)).validate(t);let r=xA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Jg(r)}function bA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function xA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Xs.default)().subtract(r,n);case"next":return(0,Xs.default)().add(r,n);case"now":return(0,Xs.default)()}}function Zs(e){return Lu(xA(eh(e)))}function wA(e){return e.toLocaleLowerCase().split("-")}function Qn(e){let[t,r,n]=wA(e);if(t==="now")return!0;if(!AA.includes(t)||!CA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function RA(e){return!!e&&typeof e=="object"&&"period"in e}function eh(e){let[t,r,n]=wA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function IA(e){return Uu(e),eh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function FA(_x3,_x4){return _FA.apply(this,arguments)}function _FA(){_FA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _FA.apply(this,arguments)}function TA(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=TO(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 PA(e,t,r){let n=EA(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=EA();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":FO(g,n,t);break}}}}function FO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function TO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function EA(){return{data:"",event:"",id:"",retry:void 0}}var th="text/event-stream",PO=1e3,kA="last-event-id";function OA(){return typeof window<"u"}function Qu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,C)=>{let x={...r};x.accept||(x.accept=th);let h;function S(){h?.abort(),document.hidden||k()}!p&&OA()&&document.addEventListener("visibilitychange",S);let b=PO,w;function I(){OA()&&document.removeEventListener("visibilitychange",S),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let E=f??v,F=n??kO;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let T=yield E(e,{...m,headers:x,signal:h?.signal});yield F(T),yield FA(T.body,TA(PA(q=>{q?x[kA]=q:delete x[kA]},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(),C(q)}}});return _k2.apply(this,arguments)}k()})}function kO(e){let t=e.headers.get("content-type");if(!t?.startsWith(th))throw new Error(`Expected content-type to be ${th}, Actual: ${t}`)}d();c();l();u();var Bn=class{constructor(t){he(this,"_basePath");he(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 OO=(e,t,r)=>new Bn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,_A=3,_O=5e3,NO="text/event-stream",oh=1,rh=class extends Error{},Js=class extends Error{constructor(r){super(r.message);he(this,"payload",r)}},nh=class{constructor(){he(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)}},Bu=class{constructor(t){he(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,C=new nh;if(!a){this.logger.error("No stream ID found");return}let x=0,h,S=()=>{h&&!C.isActive(h)&&(w?.abort(),g(),I())},b=()=>{C.remove(h),h=tA(S,h,_O),C.add(h)},w=new s.AbortController,I=()=>Qu(OO(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(E){return _asyncToGenerator(function*(){if(E.ok&&E.headers.get("content-type")===NO)return;throw E.status>=400&&E.status<500&&E.status!==429?new Js({message:"Error opening stream",code:E.status}):new rh})()},onmessage:E=>{if(w?.signal.aborted)return;let F=JSON.parse(E.data);if(F.finishReason==="ERROR"){C.remove(h),w?.abort(),f({message:F.errorMessage,code:F.statusCode});return}p(F),x=0,F.finishReason==="COMPLETED"?(C.remove(h),m()):b()},onerror:E=>{if(!w?.signal.aborted){if(C.remove(h),E instanceof Js)throw w?.abort(),f(E),E;if(++x>_A){this.logger.info("Maximum retry exceeded.");let F={message:"Failed to complete stream.",code:oh};throw w?.abort(),f(F),new Js(F)}this.logger.info(`Retrying...(${x}/${_A})`),g()}}});return I(),w}};d();c();l();u();var Gu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function ec(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var ah=e=>{let{response:t}=e;return t.body?DO(e):qO(t)},DO=e=>VO(e)?jO(e):MO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},qO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function MO(e){return e.body.statusCode!==void 0}function VO(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 NA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var ih=(e,t,r,n)=>{let o=new Bn(`${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 DA=(e,t)=>{let r=new Bn(`${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 jr.call({...ih(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:ec(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=NA(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return LO(i)?{success:i}:{error:ah({response:r,body:i})}});return function sh(_x5,_x6){return _ref3.apply(this,arguments)}}();function LO(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Wa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function At(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Wa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Wa(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function UO(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function QO(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ya(e,t){if(t&&e.name==="AbortError")return{error:QO(e)};if(e instanceof No)return{error:UO(e)};throw e}var Gn=e=>e.success!==void 0,He=e=>e.error!==void 0;function qA(e){return e.results!==void 0}function MA(e){let t=Wa();return ee(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var ch=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,BO=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,tc=(e,t,r,n)=>{GO(e);let o=ch(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},VA=(e,t,r)=>{$O(e);let n=BO(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},uh=e=>{let{insightId:t,...r}=ec(e);return r},jA=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.")},GO=e=>{if(jA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},$O=e=>{if(jA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var LA=e=>({...tc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var UA=e=>({...tc(e,"POST","application/json","/search"),requestParams:uh(e)}),QA=e=>({...tc(e,"POST","application/json","/querysuggest"),requestParams:uh(e)});d();c();l();u();var BA=e=>({...VA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var $u=class{constructor(t){he(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield jr.call({...LA(t),..._this.options});if(r instanceof Error)return Ya(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 jr.call({...UA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Ya(n);let o=yield n.json();return qA(o)&&(o=MA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield jr.call({...QA(t),..._this3.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield jr.call({...BA(t),..._this4.options});if(r instanceof Error)return Ya(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 z=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Xe=new $({required:!0,emptyAllowed:!0}),kz=new $({required:!1,emptyAllowed:!0}),Hu=new ne({each:z,required:!0}),GA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),$A=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Oz=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 Pe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Oo(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 HA(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return HA(e,t,r,o,"Controller initialization error")},HA=(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 HO=typeof Symbol=="function"&&Symbol.observable||"@@observable",zA=HO,lh=()=>Math.random().toString(36).substring(7).split("").join("."),zO={INIT:`@@redux/INIT${lh()}`,REPLACE:`@@redux/REPLACE${lh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lh()}`},zu=zO;function Lr(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 dh(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(dh)(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 C(w){if(typeof w!="function")throw new Error(Et(4));if(f)throw new Error(Et(5));let I=!0;m();let E=p++;return i.set(E,w),function(){if(I){if(f)throw new Error(Et(6));I=!1,m(),i.delete(E),a=null}}}function x(w){if(!Lr(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(E=>{E()}),w}function h(w){if(typeof w!="function")throw new Error(Et(10));n=w,x({type:zu.REPLACE})}function S(){let w=C;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Et(11));function E(){let k=I;k.next&&k.next(g())}return E(),{unsubscribe:w(E)}},[zA](){return this}}}return x({type:zu.INIT}),{dispatch:x,subscribe:C,getState:g,replaceReducer:h,[zA]:S}}function WO(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:zu.INIT})>"u")throw new Error(Et(12));if(typeof r(void 0,{type:zu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Et(13))})}function Ka(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{WO(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let C=0;C<n.length;C++){let x=n[C],h=r[x],S=p[x],b=h(S,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Et(14))}g[x]=b,m=m||b!==S}return m=m||n.length!==Object.keys(p).length,m?g:p}}function rc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function WA(...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=rc(...p)(o.dispatch),{...o,dispatch:a}}}function nc(e){return Lr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Ah=Symbol.for("immer-nothing"),oc=Symbol.for("immer-draftable"),Ct=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,qo=sr.getPrototypeOf,ic="constructor",dc="prototype",mh="configurable",Xu="enumerable",Yu="writable",sc="value",Gt=e=>!!e&&!!e[Ct];function $t(e){return e?rC(e)||fc(e)||!!e[oc]||!!e[ic]?.[oc]||mc(e)||gc(e):!1}var YO=sr[dc][ic].toString(),YA=new WeakMap;function rC(e){if(!e||!Xa(e))return!1;let t=qo(e);if(t===null||t===sr[dc])return!0;let r=sr.hasOwnProperty.call(t,ic)&&t[ic];if(r===Object)return!0;if(!Do(r))return!1;let n=YA.get(r);return n===void 0&&(n=Function.toString.call(r),YA.set(r,n)),n===YO}function nC(e){return Gt(e)||Ft(15,e),e[Ct].base_}function pc(e,t,r=!0){Mo(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 Mo(e){let t=e[Ct];return t?t.type_:fc(e)?1:mc(e)?2:gc(e)?3:0}var ac=(e,t,r=Mo(e))=>r===2?e.has(t):sr[dc].hasOwnProperty.call(e,t),Rn=(e,t,r=Mo(e))=>r===2?e.get(t):e[t],Zu=(e,t,r,n=Mo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function KO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var fc=Array.isArray,mc=e=>e instanceof Map,gc=e=>e instanceof Set,Xa=e=>typeof e=="object",Do=e=>typeof e=="function",ph=e=>typeof e=="boolean";function XO(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ZO=e=>Xa(e)?e?.[Ct]:null,In=e=>e.copy_||e.base_;var Ch=e=>e.modified_?e.copy_:e.base_;function gh(e,t){if(mc(e))return new Map(e);if(gc(e))return new Set(e);if(fc(e))return Array[dc].slice.call(e);let r=rC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[Ct];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Yu]===!1&&(p[Yu]=!0,p[mh]=!0),(p.get||p.set)&&(n[i]={[mh]:!0,[Yu]:!0,[Xu]:p[Xu],[sc]:e[i]})}return sr.create(qo(e),n)}else{let n=qo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function bh(e,t=!1){return ol(e)||Gt(e)||!$t(e)||(Mo(e)>1&&sr.defineProperties(e,{set:Wu,add:Wu,clear:Wu,delete:Wu}),sr.freeze(e),t&&pc(e,(r,n)=>{bh(n,!0)},!1)),e}function JO(){Ft(2)}var Wu={[sc]:JO};function ol(e){return e===null||!Xa(e)?!0:sr.isFrozen(e)}var Ju="MapSet",el="Patches",KA="ArrayMethods",tl={};function Vo(e){let t=tl[e];return t||Ft(0,e),t}var XA=e=>!!tl[e];function e_(e,t){tl[e]||(tl[e]=t)}var cc,oC=()=>cc,t_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:XA(Ju)?Vo(Ju):void 0,arrayMethodsPlugin_:XA(KA)?Vo(KA):void 0});function ZA(e,t){t&&(e.patchPlugin_=Vo(el),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function hh(e){yh(e),e.drafts_.forEach(r_),e.drafts_=null}function yh(e){e===cc&&(cc=e.parent_)}var JA=e=>cc=t_(cc,e);function r_(e){let t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function eC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ct].modified_&&(hh(t),Ft(4)),$t(e)&&(e=tC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ct].base_,e,t)}else e=tC(t,r);return n_(t,e,!0),hh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ah?e:void 0}function tC(e,t){if(ol(t))return t;let r=t[Ct];if(!r)return rl(t,e.handledSet_,e);if(!al(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);sC(r,e)}return r.copy_}function n_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&bh(t,r)}function aC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var al=(e,t)=>e.scope_===t,o_=[];function iC(e,t,r,n){let o=In(e),a=e.type_;if(n!==void 0&&Rn(o,n,a)===t){Zu(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;pc(o,(f,m)=>{if(Gt(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??o_;for(let p of i)Zu(o,p,r,a)}function a_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!al(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=Ch(a);iC(e,a.draft_??a,i,r),sC(a,o)})}function sC(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)}aC(e)}}function i_(e,t,r){let{scope_:n}=e;if(Gt(r)){let o=r[Ct];al(o,n)&&o.callbacks_.push(function(){Ku(e);let i=Ch(o);iC(e,r,i,t)})}else $t(r)&&e.callbacks_.push(function(){let a=In(e);e.type_===3?a.has(r)&&rl(r,n.handledSet_,n):Rn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&rl(Rn(e.copy_,t,e.type_),n.handledSet_,n)})}function rl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Gt(e)||t.has(e)||!$t(e)||ol(e)||(t.add(e),pc(e,(n,o)=>{if(Gt(o)){let a=o[Ct];if(al(a,r)){let i=Ch(a);Zu(e,n,i,e.type_),aC(a)}}else $t(o)&&rl(o,t,r)})),e}function s_(e,t){let r=fc(e),n={type_:r?1:0,scope_:t?t.scope_:oC(),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=nl;r&&(o=[n],a=uc);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var nl={get(e,t){if(t===Ct)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=In(e);if(!ac(o,t,e.type_))return c_(e,o,t);let a=o[t];if(e.finalized_||!$t(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&XO(t))return a;if(a===fh(e.base_,t)){Ku(e);let i=e.type_===1?+t:t,p=vh(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in In(e)},ownKeys(e){return Reflect.ownKeys(In(e))},set(e,t,r){let n=cC(In(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=fh(In(e),t),a=o?.[Ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(KO(r,o)&&(r!==void 0||ac(e.base_,t,e.type_)))return!0;Ku(e),Sh(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),i_(e,t,r)),!0},deleteProperty(e,t){return Ku(e),fh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Sh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=In(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Yu]:!0,[mh]:e.type_!==1||t!=="length",[Xu]:n[Xu],[sc]:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return qo(e.base_)},setPrototypeOf(){Ft(12)}},uc={};for(let e in nl){let t=nl[e];uc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}uc.deleteProperty=function(e,t){return uc.set.call(this,e,t,void 0)};uc.set=function(e,t,r){return nl.set.call(this,e[0],t,r,e[0])};function fh(e,t){let r=e[Ct];return(r?In(r):e)[t]}function c_(e,t,r){let n=cC(t,r);return n?sc in n?n[sc]:n.get?.call(e.draft_):void 0}function cC(e,t){if(!(t in e))return;let r=qo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qo(r)}}function Sh(e){e.modified_||(e.modified_=!0,e.parent_&&Sh(e.parent_))}function Ku(e){e.copy_||(e.assigned_=new Map,e.copy_=gh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var u_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Do(t)&&!Do(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}Do(r)||Ft(6),n!==void 0&&!Do(n)&&Ft(7);let o;if($t(t)){let a=JA(this),i=vh(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?hh(a):yh(a)}return ZA(a,n),eC(o,a)}else if(!t||!Xa(t)){if(o=r(t),o===void 0&&(o=t),o===Ah&&(o=void 0),this.autoFreeze_&&bh(o,!0),n){let a=[],i=[];Vo(el).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else Ft(1,t)},this.produceWithPatches=(t,r)=>{if(Do(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]},ph(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ph(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ph(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){$t(e)||Ft(8),Gt(e)&&(e=il(e));let t=JA(this),r=vh(t,e,void 0);return r[Ct].isManual_=!0,yh(t),r}finishDraft(e,t){let r=e&&e[Ct];(!r||!r.isManual_)&&Ft(9);let{scope_:n}=r;return ZA(n,t),eC(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=Vo(el).applyPatches_;return Gt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function vh(e,t,r,n){let[o,a]=mc(t)?Vo(Ju).proxyMap_(t,r):gc(t)?Vo(Ju).proxySet_(t,r):s_(t,r);return(r?.scope_??oC()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?a_(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 il(e){return Gt(e)||Ft(10,e),uC(e)}function uC(e){if(!$t(e)||ol(e))return e;let t=e[Ct],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=gh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=gh(e,!0);return pc(r,(o,a)=>{Zu(r,o,uC(a))},n),t&&(t.finalized_=!1),r}function lC(){function t(S,b=[]){if(S.key_!==void 0){let w=S.parent_.copy_??S.parent_.base_,I=ZO(Rn(w,S.key_)),E=Rn(w,S.key_);if(E===void 0||E!==S.draft_&&E!==S.base_&&E!==S.copy_||I!=null&&I.base_!==S.base_)return null;let F=S.parent_.type_===3,k;if(F){let T=S.parent_;k=Array.from(T.drafts_.keys()).indexOf(S.key_)}else k=S.key_;if(!(F&&w.size>k||ac(w,k)))return null;b.push(k)}if(S.parent_)return t(S.parent_,b);b.reverse();try{r(S.copy_,b)}catch{return null}return b}function r(S,b){let w=S;for(let I=0;I<b.length-1;I++){let E=b[I];if(w=Rn(w,E),!Xa(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(S,b,w){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);let{patches_:I,inversePatches_:E}=w;switch(S.type_){case 0:case 2:return f(S,b,I,E);case 1:return p(S,b,I,E);case 3:return m(S,b,I,E)}}function p(S,b,w,I){let{base_:E,assigned_:F}=S,k=S.copy_;k.length<E.length&&([E,k]=[k,E],[w,I]=[I,w]);let T=S.allIndicesReassigned_===!0;for(let q=0;q<E.length;q++){let G=k[q],Q=E[q];if((T||F?.get(q.toString()))&&G!==Q){let B=G?.[Ct];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=E.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;E.length<=q;--q){let G=b.concat([q]);I.push({op:a,path:G})}}function f(S,b,w,I){let{base_:E,copy_:F,type_:k}=S;pc(S.assigned_,(T,q)=>{let G=Rn(E,T,k),Q=Rn(F,T,k),j=q?ac(E,T)?n:o:a;if(G===Q&&j===n)return;let B=b.concat(T);w.push(j===a?{op:j,path:B}:{op:j,path:B,value:h(Q)}),I.push(j===o?{op:a,path:B}:j===a?{op:o,path:B,value:h(G)}:{op:n,path:B,value:h(G)})})}function m(S,b,w,I){let{base_:E,copy_:F}=S,k=0;E.forEach(T=>{if(!F.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,F.forEach(T=>{if(!E.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(S,b,w){let{patches_:I,inversePatches_:E}=w;I.push({op:n,path:[],value:b===Ah?void 0:b}),E.push({op:n,path:[],value:S})}function C(S,b){return b.forEach(w=>{let{path:I,op:E}=w,F=S;for(let G=0;G<I.length-1;G++){let Q=Mo(F),j=I[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(Q===0||Q===1)&&(j==="__proto__"||j===ic)&&Ft(19),Do(F)&&j===dc&&Ft(19),F=Rn(F,j),Xa(F)||Ft(18,I.join("/"))}let k=Mo(F),T=x(w.value),q=I[I.length-1];switch(E){case n:switch(k){case 2:return F.set(q,T);case 3:Ft(16);default:return F[q]=T}case o:switch(k){case 1:return q==="-"?F.push(T):F.splice(q,0,T);case 2:return F.set(q,T);case 3:return F.add(T);default:return F[q]=T}case a:switch(k){case 1:return F.splice(q,1);case 2:return F.delete(q);case 3:return F.delete(w.value);default:return delete F[q]}default:Ft(17,E)}}),S}function x(S){if(!$t(S))return S;if(fc(S))return S.map(x);if(mc(S))return new Map(Array.from(S.entries()).map(([w,I])=>[w,x(I)]));if(gc(S))return new Set(Array.from(S).map(x));let b=Object.create(qo(S));for(let w in S)b[w]=x(S[w]);return ac(S,oc)&&(b[oc]=S[oc]),b}function h(S){return Gt(S)?x(S):S}e_(el,{applyPatches_:C,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var lc=new u_,jo=lc.produce,xh=lc.produceWithPatches.bind(lc);var wh=lc.applyPatches.bind(lc);d();c();l();u();function l_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function d_(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function p_(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 dC=e=>Array.isArray(e)?e:[e];function f_(e){let t=Array.isArray(e[0])?e[0]:e;return p_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function m_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var Yz=Object.getPrototypeOf({});var g_=class{constructor(e){this.value=e}deref(){return this.value}},h_=typeof WeakRef<"u"?WeakRef:g_,y_=0,pC=1;function sl(){return{s:y_,v:void 0,o:null,p:null}}function hc(e,t={}){let r=sl(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let C=0,x=f;C<x;C++){let h=arguments[C];if(typeof h=="function"||typeof h=="object"&&h!==null){let S=p.o;S===null&&(p.o=S=new WeakMap);let b=S.get(h);b===void 0?(p=sl(),S.set(h,p)):p=b}else{let S=p.p;S===null&&(p.p=S=new Map);let b=S.get(h);b===void 0?(p=sl(),S.set(h,p)):p=b}}let m=p,g;if(p.s===pC)g=p.v;else if(g=e.apply(null,arguments),a++,n){let C=o?.deref?.()??o;C!=null&&n(C,g)&&(g=C,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new h_(g):g}return m.s=pC,m.v=g,g}return i.clearCache=()=>{r=sl(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function S_(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()),l_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:C,memoizeOptions:x=[],argsMemoize:h=hc,argsMemoizeOptions:S=[],devModeChecks:b={}}=g,w=dC(x),I=dC(S),E=f_(o),F=C(function(){return a++,m.apply(null,arguments)},...w),k=!0,T=h(function(){i++;let G=m_(E,arguments);return p=F.apply(null,G),p},...I);return Object.assign(T,{resultFunc:m,memoizedResultFunc:F,dependencies:E,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:C,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var at=S_(hc),v_=Object.assign((e,t=at)=>{d_(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((i,p,f)=>(i[r[f]]=p,i),{}))},{withTypes:()=>v_});d();c();l();u();function fC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var mC=fC(),gC=fC;var A_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?rc:rc.apply(null,arguments)},fW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},C_=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Ht(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=>nc(n)&&n.type===e,r}var xC=class yc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,yc.prototype)}static get[Symbol.species](){return yc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new yc(...t[0].concat(this)):new yc(...t.concat(this))}};function hC(e){return $t(e)?jo(e,()=>{}):e}function cl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function b_(e){return typeof e=="boolean"}var x_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new xC;return r&&(b_(r)?i.push(mC):i.push(gC(r.extraArgument))),i},Sc="RTK_autoBatch",ei=()=>e=>({payload:e,meta:{[Sc]:!0}}),yC=e=>t=>{setTimeout(t,e)},w_=(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?window.requestAnimationFrame:yC(10):e.type==="callback"?e.queueNotification:yC(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let C=()=>o&&g(),x=n.subscribe(C);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Sc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},R_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new xC(e);return n&&o.push(w_(typeof n=="object"?n:void 0)),o};function wC(e){let t=x_(),{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(Lr(r))f=Ka(r);else throw new Error(Ht(1));let m;typeof n=="function"?m=n(t):m=t();let g=rc;o&&(g=A_({trace:!1,...(typeof o=="object"&&o)}));let C=WA(...m),x=R_(C),h=typeof p=="function"?p(x):x(),S=g(...h);return dh(f,i,S)}function RC(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Ht(28));if(p in t)throw new Error(Ht(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 I_(e){return typeof e=="function"}function de(e,t){let[r,n,o]=RC(t),a;if(I_(e))a=()=>hC(e());else{let p=hC(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,C)=>{if(C)if(Gt(g)){let h=C(g,f);return h===void 0?g:h}else{if($t(g))return jo(g,x=>C(x,f));{let x=C(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 IC=(e,t)=>C_(e)?e.match(t):e(t);function Ur(...e){return t=>e.some(r=>IC(r,t))}function Ja(...e){return t=>e.every(r=>IC(r,t))}function pl(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 vc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function fl(...e){return e.length===0?t=>pl(t,["pending"]):vc(e)?Ur(...e.map(t=>t.pending)):fl()(e[0])}function Uo(...e){return e.length===0?t=>pl(t,["rejected"]):vc(e)?Ur(...e.map(t=>t.rejected)):Uo()(e[0])}function Ac(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ja(Uo(...e),t):vc(e)?Ja(Uo(...e),t):Ac()(e[0])}function En(...e){return e.length===0?t=>pl(t,["fulfilled"]):vc(e)?Ur(...e.map(t=>t.fulfilled)):En()(e[0])}function ml(...e){return e.length===0?t=>pl(t,["pending","fulfilled","rejected"]):vc(e)?Ur(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ml()(e[0])}var E_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Cc=(e=21)=>{let t="",r=e;for(;r--;)t+=E_[Math.random()*64|0];return t},F_=["name","message","stack","code"],Rh=class{constructor(e,t){he(this,"_type");this.payload=e,this.meta=t}},SC=class{constructor(e,t){he(this,"_type");this.payload=e,this.meta=t}},T_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of F_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},vC="External signal was aborted",fe=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(f,m,g,C)=>({payload:f,meta:{...(C||{}),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,C,x)=>({payload:C,error:(n&&n.serializeError||T_)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!C,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,C,x)=>{let h=n?.idGenerator?n.idGenerator(f):Cc(),S=new s.AbortController,b,w;function I(F){w=F,S.abort()}m&&(m.aborted?I(vC):m.addEventListener("abort",()=>I(vC),{once:!0}));let E=_asyncToGenerator(function*(){let F;try{let T=n?.condition?.(f,{getState:C,extra:x});if(k_(T)&&(T=yield T),T===!1||S.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"})},S.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:C,extra:x}))),F=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:C,extra:x,requestId:h,signal:S.signal,abort:I,rejectWithValue:(G,Q)=>new Rh(G,Q),fulfillWithValue:(G,Q)=>new SC(G,Q)})).then(G=>{if(G instanceof Rh)throw G;return G instanceof SC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(T){F=T instanceof Rh?i(null,h,f,T.payload,T.meta):i(T,h,f)}finally{b&&S.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(F)&&F.meta.condition||g(F),F})();return Object.assign(E,{abort:I,requestId:h,arg:f,unwrap(){return E.then(P_)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Ur(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function P_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function k_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var EC=Symbol.for("rtk-slice-createasyncthunk"),gW={[EC]:fe};function O_(e,t){return`${e}/${t}`}function __({creators:e}={}){let t=e?.asyncThunk?.[EC];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Ht(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(D_()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(F,k){let T=typeof F=="string"?F:F.type;if(!T)throw new Error(Ht(12));if(T in f.sliceCaseReducersByType)throw new Error(Ht(13));return f.sliceCaseReducersByType[T]=k,m},addMatcher(F,k){return f.sliceMatchers.push({matcher:F,reducer:k}),m},exposeAction(F,k){return f.actionCreators[F]=k,m},exposeCaseReducer(F,k){return f.sliceCaseReducersByName[F]=k,m}};p.forEach(F=>{let k=i[F],T={reducerName:F,type:O_(o,F),createNotation:typeof n.reducers=="function"};M_(k)?j_(T,k,m,t):q_(T,k,m)});function g(){let[F={},k=[],T=void 0]=typeof n.extraReducers=="function"?RC(n.extraReducers):[n.extraReducers],q={...F,...f.sliceCaseReducersByType};return de(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 C=F=>F,x=new Map,h=new WeakMap,S;function b(F,k){return S||(S=g()),S(F,k)}function w(){return S||(S=g()),S.getInitialState()}function I(F,k=!1){function T(G){let Q=G[F];return typeof Q>"u"&&k&&(Q=cl(h,T,w)),Q}function q(G=C){let Q=cl(x,k,()=>new WeakMap);return cl(Q,G,()=>{let j={};for(let[B,L]of Object.entries(n.selectors??{}))j[B]=N_(L,G,()=>cl(h,G,w),k);return j})}return{reducerPath:F,getSelectors:q,get selectors(){return q(T)},selectSlice:T}}let E={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(a),injectInto(F,{reducerPath:k,...T}={}){let q=k??a;return F.inject({reducerPath:q,reducer:b},T),{...E,...I(q,!0)}}};return E}}function N_(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 Qo=__();function D_(){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 q_({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!V_(n))throw new Error(Ht(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 M_(e){return e._reducerDefinitionType==="asyncThunk"}function V_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function j_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Ht(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,C=o(e,a,g);n.exposeAction(t,C),i&&n.addCase(C.fulfilled,i),p&&n.addCase(C.pending,p),f&&n.addCase(C.rejected,f),m&&n.addMatcher(C.settled,m),n.exposeCaseReducer(t,{fulfilled:i||ul,pending:p||ul,rejected:f||ul,settled:m||ul})}function ul(){}var L_="task",FC="listener",TC="completed",Fh="cancelled",U_=`task-${Fh}`,Q_=`task-${TC}`,Ih=`${FC}-${Fh}`,B_=`${FC}-${TC}`,gl=class{constructor(e){he(this,"name","TaskAbortError");he(this,"message");this.code=e,this.message=`${L_} ${Fh} (reason: ${e})`}},Th=(e,t)=>{if(typeof e!="function")throw new TypeError(Ht(32))},ll=()=>{},PC=(e,t=ll)=>(e.catch(t),e),kC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Lo=e=>{if(e.aborted)throw new gl(e.reason)};function OC(e,t){let r=ll;return new Promise((n,o)=>{let a=()=>o(new gl(e.reason));if(e.aborted){a();return}r=kC(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=ll})}var G_=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof gl?"cancelled":"rejected",error:r}}finally{t?.()}});return function G_(_x7,_x8){return _ref5.apply(this,arguments)}}(),dl=e=>t=>PC(OC(e,t).then(r=>(Lo(e),r))),_C=e=>{let t=dl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Za}=Object,AC={},hl="listenerMiddleware",$_=(e,t)=>{let r=n=>kC(e,()=>n.abort(e.reason));return(n,o)=>{Th(n,"taskExecutor");let a=new s.AbortController;r(a);let i=G_(/*#__PURE__*/_asyncToGenerator(function*(){Lo(e),Lo(a.signal);let p=yield n({pause:dl(a.signal),delay:_C(a.signal),signal:a.signal});return Lo(a.signal),p}),()=>a.abort(Q_));return o?.autoJoin&&t.push(i.catch(ll)),{result:dl(e)(i),cancel(){a.abort(U_)}}}},H_=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Lo(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(C,x)=>{x.unsubscribe(),f([C,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield OC(t,Promise.race(p));return Lo(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>PC(r(n,o))},NC=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(Ht(21));return Th(a,"options.listener"),{predicate:o,type:t,effect:a}},DC=Za(e=>{let{type:t,predicate:r,effect:n}=NC(e);return{id:Cc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Ht(22))}}},{withTypes:()=>DC}),CC=(e,t)=>{let{type:r,effect:n,predicate:o}=NC(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},Eh=e=>{e.pending.forEach(t=>{t.abort(Ih)})},z_=(e,t)=>()=>{for(let r of t.keys())Eh(r);e.clear()},bC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},qC=Za(P(`${hl}/add`),{withTypes:()=>qC}),W_=P(`${hl}/removeAll`),MC=Za(P(`${hl}/remove`),{withTypes:()=>MC}),Y_=(...e)=>{console.error(`${hl}/error`,...e)},VC=(e={})=>{let t=new Map,r=new Map,n=h=>{let S=r.get(h)??0;r.set(h,S+1)},o=h=>{let S=r.get(h)??1;S===1?r.delete(h):r.set(h,S-1)},{extra:a,onError:i=Y_}=e;Th(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),S=>{h.unsubscribe(),S?.cancelActive&&Eh(h)}),f=h=>{let S=CC(t,h)??DC(h);return p(S)};Za(f,{withTypes:()=>f});let m=h=>{let S=CC(t,h);return S&&(S.unsubscribe(),h.cancelActive&&Eh(S)),!!S};Za(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,S,b,w){let I=new s.AbortController,E=H_(f,I.signal),F=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(S,Za({},b,{getOriginalState:w,condition:(k,T)=>E(k,T).then(Boolean),take:E,delay:_C(I.signal),pause:dl(I.signal),extra:a,signal:I.signal,fork:$_(I.signal,F),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,T,q)=>{k!==I&&(k.abort(Ih),q.delete(k))})},cancel:()=>{I.abort(Ih),h.pending.delete(I)},throwIfCancelled:()=>{Lo(I.signal)}})))}catch(k){k instanceof gl||bC(i,k,{raisedBy:"effect"})}finally{yield Promise.all(F),I.abort(B_),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),C=z_(t,r);return{middleware:h=>S=>b=>{if(!nc(b))return S(b);if(qC.match(b))return f(b.payload);if(W_.match(b)){C();return}if(MC.match(b))return m(b.payload);let w=h.getState(),I=()=>{if(w===AC)throw new Error(Ht(23));return w},E;try{if(E=S(b),t.size>0){let F=h.getState(),k=Array.from(t.values());for(let T of k){let q=!1;try{q=T.predicate(b,F,w)}catch(G){q=!1,bC(i,G,{raisedBy:"predicate"})}q&&g(T,b,h,I)}}}finally{w=AC}return E},startListening:f,stopListening:m,clearListeners:C}};function Ht(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 jC(){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 LC=/^(?:[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 K_(e){return typeof e=="string"&&LC.test(e)}var Ph=K_;d();c();l();u();var Tt=[];for(let e=0;e<256;++e)Tt.push((e+256).toString(16).slice(1));function UC(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 kh,X_=new Uint8Array(16);function Oh(){if(!kh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");kh=crypto.getRandomValues.bind(crypto)}return kh(X_)}d();c();l();u();d();c();l();u();var Z_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_h={randomUUID:Z_};function J_(e,t,r){e=e||{};let n=e.random??e.rng?.()??Oh();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 UC(n)}function e0(e,t,r){return _h.randomUUID&&!t&&!e?_h.randomUUID():J_(e,t,r)}var Nh=e0;function t0(_x13){return _t2.apply(this,arguments)}function _t2(){_t2=_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 _t2.apply(this,arguments)}var zC="2.1.1",Dh=128,WC=192,QC=224,BC=240,r0=248;function n0(e){return(e&r0)===BC?4:(e&BC)===QC?3:(e&QC)===WC?2:1}function o0(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&Dh)!=Dh)break;if(r-=3,(n&WC)!=Dh){t-r>=n0(n)*3&&(r=t);break}}return e.substring(0,r)}function a0(e){let{trackingId:t}=e;return{trackingId:t}}function i0(e){return(e.source||[]).concat([`relay@${zC}`])}function YC(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=a0(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:i0(t),clientId:p,userAgent:a(),referrer:GC(n()),location:GC(o())})}function GC(e){return e!==null?o0(e,1024):null}function s0(e,t,r,n){return{...t,meta:YC(e,r,n)}}var c0="*";function u0(){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 $C({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 l0(e){let t=$C(e);return{get:()=>t,update:r=>{t=$C({...t,...r})}}}var qh=d0();function d0(){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 p0(){return{getItem(e){return qh.getItem(e)||localStorage.getItem(e)},removeItem(e){qh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),qh.setItem(e,t,31556952e3)}}}var HC="visitorId";function f0(){let e=document.referrer;return e===""?null:e}function Mh(){let e=p0();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}`}});jC().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:()=>f0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(HC);if(t&&Ph(t))return t;let r=Nh();return e.setItem(HC,r),r}}}function m0(){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 g0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function h0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=g0();return t&&r?{...r,runtime:"custom"}:t&&y0()&&m0()?Mh():n}function y0(){try{return typeof window=="object"}catch{return!1}}function S0(e){return{get:()=>Object.freeze(h0(e))}}function KC(e){let t=l0(e),r=u0(),n=S0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=s0(o,a,i,p);return t0({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>YC(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:zC}}d();c();l();u();function XC(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var $n="3.49.4",ZC=["@coveo/atomic","@coveo/quantic"];var ti=at(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${$n}`));var bc=at(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ti(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=A0(p);return KC({mode:a?"emit":"disabled",url:o??Mu(e,t),token:r,trackingId:n??null,source:i,environment:f})}),v0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},A0=e=>{if(!e)return;let t=e();return{...(XC()?Mh():v0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Qr(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(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var De;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(De||(De={}));function Lh(){return typeof window<"u"}function ey(){return typeof navigator<"u"}function ri(){return typeof document<"u"}function Uh(){try{return typeof localStorage<"u"}catch{return!1}}function C0(){try{return typeof sessionStorage<"u"}catch{return!1}}function db(){return ey()&&navigator.cookieEnabled}var b0=[De.click,De.custom,De.search,De.view],x0=(e,t)=>b0.indexOf(e)!==-1?Object.assign({language:ri()?document.documentElement.lang:"unknown",userAgent:ey()?navigator.userAgent:"unknown"},t):t,wc=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?JC(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],JC(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 JC(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function w0(){return Uh()?localStorage:db()?new Rc:C0()?sessionStorage:new oi}var Rc=class e{getItem(t){return wc.get(`${e.prefix}${t}`)}removeItem(t){wc.erase(`${e.prefix}${t}`)}setItem(t,r,n){wc.set(`${e.prefix}${t}`,r,n)}};Rc.prefix="coveo_";var Qh=class{constructor(){this.cookieStorage=new Rc}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)}},oi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},yl="__coveo.analytics.history",R0=20,I0=1e3*60,E0=75,Al=class{constructor(t){this.store=t||w0()}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(yl);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(yl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(yl,JSON.stringify(t.slice(0,R0)))}catch{}}clear(){try{this.store.removeItem(yl)}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,E0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>I0:!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 F0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===De.view?(yield T0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),T0=e=>U(void 0,void 0,void 0,function*(){let t=new Al,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Sl,P0=new Uint8Array(16);function k0(){if(!Sl&&(Sl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Sl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Sl(P0)}var O0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Cl(e){return typeof e=="string"&&O0.test(e)}var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function pb(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]]}function _0(e){if(!Cl(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function N0(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var D0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",q0="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function M0(e,t,r){function n(o,a,i,p){var f;if(typeof o=="string"&&(o=N0(o)),typeof a=="string"&&(a=_0(a)),((f=a)===null||f===void 0?void 0:f.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+o.length);if(m.set(a),m.set(o,a.length),m=r(m),m[6]=m[6]&15|t,m[8]=m[8]&63|128,i){p=p||0;for(let g=0;g<16;++g)i[p+g]=m[g];return i}return pb(m)}try{n.name=e}catch{}return n.DNS=D0,n.URL=q0,n}var V0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eb={randomUUID:V0};function Bo(e,t,r){if(eb.randomUUID&&!t&&!e)return eb.randomUUID();e=e||{};let n=e.random||(e.rng||k0)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return pb(n)}function j0(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 Vh(e,t){return e<<t|e>>>32-t}function L0(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let i=unescape(encodeURIComponent(e));e=[];for(let p=0;p<i.length;++p)e.push(i.charCodeAt(p))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),a=new Array(o);for(let i=0;i<o;++i){let p=new Uint32Array(16);for(let f=0;f<16;++f)p[f]=e[i*64+f*4]<<24|e[i*64+f*4+1]<<16|e[i*64+f*4+2]<<8|e[i*64+f*4+3];a[i]=p}a[o-1][14]=(e.length-1)*8/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=(e.length-1)*8&4294967295;for(let i=0;i<o;++i){let p=new Uint32Array(80);for(let h=0;h<16;++h)p[h]=a[i][h];for(let h=16;h<80;++h)p[h]=Vh(p[h-3]^p[h-8]^p[h-14]^p[h-16],1);let f=r[0],m=r[1],g=r[2],C=r[3],x=r[4];for(let h=0;h<80;++h){let S=Math.floor(h/20),b=Vh(f,5)+j0(S,m,g,C)+x+t[S]+p[h]>>>0;x=C,C=g,g=Vh(m,30)>>>0,m=f,f=b}r[0]=r[0]+f>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+x>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var U0=M0("v5",80,L0),tb=U0,fb="2.30.54",rb=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,xc={pageview:"pageview",event:"event"},bl=class{constructor({client:t,uuidGenerator:r=Bo}){this.client=t,this.uuidGenerator=r}},Bh=class extends bl{constructor({client:t,uuidGenerator:r=Bo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=rb(window.location),this.lastReferrer=ri()?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:ri()?document.title:"",encoding:ri()?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===xc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===xc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===xc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===xc.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 rb(window.location)}},Hn=class e{constructor(t,r){if(!Cl(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 Cl(a)?new e(a,Number.parseInt(o)*1e3):null}};Hn.cvo_cid="cvo_cid";Hn.expirationTime=120;var Gh=class extends bl{constructor({client:t,uuidGenerator:r=Bo}){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(Hn.cvo_cid,new Hn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Gh.Id="link";var yr=Object.keys;function vl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var jh=128,mb=192,nb=224,ob=240;function Q0(e){return(e&248)===ob?4:(e&ob)===nb?3:(e&nb)===mb?2:1}function B0(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&jh)!=jh)break;if(r-=3,(n&mb)!=jh){t-r>=Q0(n)*3&&(r=t);break}}return e.substring(0,r)}var $h={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"},G0=yr($h).map(e=>$h[e]),$0=[...G0].join("|"),H0=new RegExp(`^(${$0}$)`),z0={svcAction:"svc_action",svcActionData:"svc_action_data"},W0=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$h[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),Y0=e=>H0.test(e),K0=[Y0],ab={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},ib={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Mt={action:"pa",list:"pal",listSource:"pls"},xl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},X0=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Hh={id:"quoteId",affiliation:"quoteAffiliation"},zh={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},Z0={add:Mt,bookmark_add:Mt,bookmark_remove:Mt,click:Mt,checkout:Mt,checkout_option:Mt,detail:Mt,impression:Mt,remove:Mt,refund:Object.assign(Object.assign({},Mt),xl),purchase:Object.assign(Object.assign({},Mt),xl),quickview:Mt,quote:Object.assign(Object.assign({},Mt),Hh),review:Object.assign(Object.assign({},Mt),zh)},J0=yr(ab).map(e=>ab[e]),eN=yr(ib).map(e=>ib[e]),tN=yr(Mt).map(e=>Mt[e]),rN=yr(xl).map(e=>xl[e]),nN=yr(zh).map(e=>zh[e]),oN=yr(Hh).map(e=>Hh[e]),aN=[...J0,"custom"].join("|"),iN=[...eN,"custom"].join("|"),gb="(pr[0-9]+)",hb="(il[0-9]+pi[0-9]+)",sN=new RegExp(`^${gb}(${aN})$`),cN=new RegExp(`^(${hb}(${iN}))|(il[0-9]+nm)$`),uN=new RegExp(`^(${tN.join("|")})$`),lN=new RegExp(`^(${rN.join("|")})$`),dN=new RegExp(`^${gb}custom$`),pN=new RegExp(`^${hb}custom$`),fN=new RegExp(`^(${[...X0,...nN,...oN].join("|")})$`),mN=e=>sN.test(e),gN=e=>cN.test(e),hN=e=>uN.test(e),yN=e=>lN.test(e),SN=e=>fN.test(e),vN=[gN,mN,hN,yN,SN],AN=[dN,pN],CN={anonymizeIp:"aip"},bN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},xN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},wN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],RN=Object.assign(Object.assign(Object.assign(Object.assign({},CN),bN),xN),wN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Wh=Object.assign(Object.assign({},RN),z0),IN=e=>{let t=!!e.action&&Z0[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||Wh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},EN=yr(Wh).map(e=>Wh[e]),FN=e=>EN.indexOf(e)!==-1,TN=e=>e==="custom",PN=e=>[...vN,...K0,FN,TN].some(t=>t(e)),kN=e=>yr(e).reduce((t,r)=>{let n=ON(r);return n?Object.assign(Object.assign({},t),_N(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),ON=e=>{let t;return[...AN].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]}),{}),Yh=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[De.click,De.custom,De.search,De.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}},Kh=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()})}},sb=y.fetch,wl=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=Qr(f,["url"]),C;try{C=yield sb(m,g)}catch(x){console.error("An error has occured when sending the event.",x);return}if(C.ok){let x=yield C.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{C.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,C,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 sb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[De.click,De.custom,De.search,De.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"})}},Xh=class{constructor(t,r){Uh()&&db()?this.storage=new Qh:Uh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new oi),this.client=new wl(t),this.beaconClient=new Yh(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}},Zh=class{constructor(t,r){this.storage=r||new oi,this.client=new wl(t)}getClientDependingOnEventType(t){return this.client}},Rl=class{constructor(){this.storage=new oi,this.client=new Kh}getClientDependingOnEventType(t){return this.client}},NN="xx",DN=e=>e?.startsWith(NN)||!1,qN=`
28
29
  We've detected you're using React Native but have not provided the corresponding runtime,
29
30
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
30
31
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
31
- `;function c0(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var u0=["1",1,"yes",!0];function Rc(){let e=[];return Ih()&&e.push(window.doNotTrack),Lh()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>u0.indexOf(t)!==-1)}var ZC="v15",eb={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function l0(e=eb.default,t=ZC,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 d0="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:eb.default,isCustomEndpoint:!1,token:"",version:ZC,beforeSendHooks:[],afterSendHooks:[]}}get version(){return YC}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=[Z_,W_].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};Rc()?this.runtime=new xl:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Oe.view,{newEventType:Oe.view,addClientIdParameter:!0}),this.addEventTypeMapping(Oe.click,{newEventType:Oe.click,addClientIdParameter:!0}),this.addEventTypeMapping(Oe.custom,{newEventType:Oe.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Oe.search,{newEventType:Oe.search,addClientIdParameter:!0})}initRuntime(t){return Ih()&&ta()?new Mh(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(c0()&&console.warn(s0),new Vh(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Ih()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Qo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Qo()}})}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(vl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(MC(t,MC(r,d0)))}})}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(Qo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Rc())return null;try{let r=new URL(t).searchParams.get($n.cvo_cid);if(r==null)return null;let n=$n.fromString(r);return!n||!ta()||!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[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>U(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>i?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((S,x)=>U(this,void 0,void 0,function*(){let w=yield S;return yield x(t,w)}),g)].reduce((g,S)=>U(this,void 0,void 0,function*(){let x=yield g;return yield S(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[C=>this.setTrackingIdIfTrackingIdNotPresent(C),C=>this.removeEmptyPayloadValues(C,t),C=>this.validateParams(C,t),C=>n?XN(C):C,C=>n?this.removeUnknownParameters(C):C,C=>n?this.processCustomParameters(C):this.mapCustomParametersToCustomData(C)].reduce((C,b)=>U(this,void 0,void 0,function*(){let g=yield C;return yield b(g)}),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 Sl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Oe.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Ur(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Oe.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Ur(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Oe.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Ur(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Oe.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({[Oe.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(t0(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=Ur(t,["custom"]),o={};r&&yl(r)&&(o=this.lowercaseKeys(r));let i=r0(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Ur(t,["custom"]);if(r&&yl(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=Ur(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Oe.view||r==Oe.click||r==Oe.search||r==Oe.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Oe.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=Ur(t,["userId"]);return a0(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Ur(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&yl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&yl(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"?mN(t,r):t}get baseUrl(){return l0(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 k;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(k||(k={}));var jh={[k.triggerNotify]:"queryPipelineTriggers",[k.triggerExecute]:"queryPipelineTriggers",[k.triggerQuery]:"queryPipelineTriggers",[k.triggerRedirect]:"queryPipelineTriggers",[k.queryErrorBack]:"errors",[k.queryErrorClear]:"errors",[k.queryErrorRetry]:"errors",[k.pagerNext]:"getMoreResults",[k.pagerPrevious]:"getMoreResults",[k.pagerNumber]:"getMoreResults",[k.pagerResize]:"getMoreResults",[k.pagerScrolling]:"getMoreResults",[k.facetSearch]:"facet",[k.facetShowLess]:"facet",[k.facetShowMore]:"facet",[k.recommendation]:"recommendation",[k.likeSmartSnippet]:"smartSnippet",[k.dislikeSmartSnippet]:"smartSnippet",[k.expandSmartSnippet]:"smartSnippet",[k.collapseSmartSnippet]:"smartSnippet",[k.openSmartSnippetFeedbackModal]:"smartSnippet",[k.closeSmartSnippetFeedbackModal]:"smartSnippet",[k.sendSmartSnippetReason]:"smartSnippet",[k.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[k.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[k.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[k.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[k.clearRecentQueries]:"recentQueries",[k.recentResultClick]:"recentlyClickedDocuments",[k.clearRecentResults]:"recentlyClickedDocuments",[k.showLessFoldedResults]:"folding",[k.caseDetach]:"case",[k.likeGeneratedAnswer]:"generatedAnswer",[k.dislikeGeneratedAnswer]:"generatedAnswer",[k.openGeneratedAnswerSource]:"generatedAnswer",[k.generatedAnswerStreamEnd]:"generatedAnswer",[k.generatedAnswerSourceHover]:"generatedAnswer",[k.generatedAnswerCopyToClipboard]:"generatedAnswer",[k.generatedAnswerHideAnswers]:"generatedAnswer",[k.generatedAnswerShowAnswers]:"generatedAnswer",[k.generatedAnswerExpand]:"generatedAnswer",[k.generatedAnswerCollapse]:"generatedAnswer",[k.generatedAnswerFeedbackSubmit]:"generatedAnswer",[k.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"},Hn=class{constructor(){this.runtime=new xl,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(Oe.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Oe.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Oe.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Oe.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return YC}};function p0(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function f0(e){return e.map(t=>t.replace(/;/g,""))}function tb(e){let r=e.join(";");return r.length<=256?r:tb(e.slice(1))}var GC=e=>{let t=f0(e),r=p0(t);return tb(r)};function $C(e){let t=typeof e.partialQueries=="string"?e.partialQueries:GC(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:GC(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var wl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Rc();this.coveoAnalyticsClient=n?new Hn:new cr(t)}disable(){this.coveoAnalyticsClient=new Hn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(k.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(k.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(k.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(k.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(k.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(k.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(k.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(k.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(k.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(k.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(k.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(k.omniboxAnalytics,$C(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(k.omniboxFromLink,$C(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(k.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.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(k.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.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(k.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(k.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(k.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(k.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(k.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(k.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(k.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(k.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(k.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(k.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(k.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(k.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(k.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(k.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(k.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=jh[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=jh[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(k.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(k.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(k.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(k.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()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.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(k.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(k.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Rl=Object.assign({},bc),HC=Object.keys(Rl).map(e=>Rl[e]),ra=class extends Th{constructor({client:t,uuidGenerator:r=Qo}){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])=>HC.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(HC.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Rl.pageview,{newEventType:Oe.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Rl.event,{newEventType:Oe.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 vN(this.ticket)}};ra.Id="svc";var Il;(function(e){e.click="click",e.flowStart="flowStart"})(Il||(Il={}));var gr;(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"})(gr||(gr={}));var El;(function(e){e.quit="Quit",e.solved="Solved"})(El||(El={}));var Fl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Rc();this.coveoAnalyticsClient=o?new cr(t):new Hn,this.svc=new ra({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Hn,this.svc=new ra({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new ra({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(gr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(gr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(gr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(gr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(gr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(gr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(gr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(gr.caseCancelled,{reason:El.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(gr.caseSolved,{reason:El.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(gr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Il.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Il.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)})}},m0=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},ue=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,i=Ur(e,["caseContext","caseId","caseNumber"]),a=m0(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},i),!!a.context_Case_Subject&&{CaseSubject:a.context_Case_Subject}),t&&a)},Tl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Rc();this.coveoAnalyticsClient=n?new Hn:new cr(t)}disable(){this.coveoAnalyticsClient=new Hn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}logInterfaceLoad(t){if(t){let r=ue(t);return this.logSearchEvent(k.interfaceLoad,r)}return this.logSearchEvent(k.interfaceLoad)}logRecentQueryClick(t){if(t){let r=ue(t);return this.logSearchEvent(k.recentQueryClick,r)}return this.logSearchEvent(k.recentQueryClick)}logClearRecentQueries(t){if(t){let r=ue(t);return this.logCustomEvent(k.clearRecentQueries,r)}return this.logCustomEvent(k.clearRecentQueries)}logInterfaceChange(t){let r=ue(t);return this.logSearchEvent(k.interfaceChange,r)}logStaticFilterDeselect(t){let r=ue(t);return this.logSearchEvent(k.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=ue(t);return this.logCustomEvent(k.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(k.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=ue(t);return this.logSearchEvent(k.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=ue(t);return this.logSearchEvent(k.breadcrumbResetAll,r)}return this.logSearchEvent(k.breadcrumbResetAll)}logFacetSelect(t){let r=ue(t);return this.logSearchEvent(k.facetSelect,r)}logFacetExclude(t){let r=ue(t);return this.logSearchEvent(k.facetExclude,r)}logFacetDeselect(t){let r=ue(t);return this.logSearchEvent(k.facetDeselect,r)}logFacetUpdateSort(t){let r=ue(t);return this.logSearchEvent(k.facetUpdateSort,r)}logFacetClearAll(t){let r=ue(t);return this.logSearchEvent(k.facetClearAll,r)}logFacetShowMore(t){let r=ue(t,!1);return this.logCustomEvent(k.facetShowMore,r)}logFacetShowLess(t){let r=ue(t,!1);return this.logCustomEvent(k.facetShowLess,r)}logQueryError(t){let r=ue(t,!1);return this.logCustomEvent(k.queryError,r)}logPagerNumber(t){let r=ue(t,!1);return this.logCustomEvent(k.pagerNumber,r)}logPagerNext(t){let r=ue(t,!1);return this.logCustomEvent(k.pagerNext,r)}logPagerPrevious(t){let r=ue(t,!1);return this.logCustomEvent(k.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=ue(t);return this.logSearchEvent(k.didyoumeanAutomatic,r)}return this.logSearchEvent(k.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=ue(t);return this.logSearchEvent(k.didyoumeanClick,r)}return this.logSearchEvent(k.didyoumeanClick)}logResultsSort(t){let r=ue(t);return this.logSearchEvent(k.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=ue(t);return this.logSearchEvent(k.searchboxSubmit,r)}return this.logSearchEvent(k.searchboxSubmit)}logContextChanged(t){let r=ue(t);return this.logSearchEvent(kt.contextChanged,r)}logExpandToFullUI(t){let r=ue(t);return this.logCustomEvent(kt.expandToFullUI,r)}logOpenUserActions(t){let r=ue(t,!1);return this.logCustomEvent(kt.openUserActions,r)}logShowPrecedingSessions(t){let r=ue(t,!1);return this.logCustomEvent(kt.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=ue(t,!1);return this.logCustomEvent(kt.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(kt.clickViewedDocument,Object.assign(Object.assign({},ue(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(kt.clickPageView,Object.assign(Object.assign({},ue(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(kt.createArticle,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(k.documentOpen,t,r,n?ue(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(k.copyToClipboard,t,r,n?ue(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(k.caseSendEmail,t,r,n?ue(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(k.feedItemTextPost,t,r,n?ue(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(k.documentQuickview,t,r,n?Object.assign(Object.assign({},ue(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(k.caseAttach,t,r,n?Object.assign(Object.assign({},ue(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&ue(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(k.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(k.likeSmartSnippet,t?ue(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(k.dislikeSmartSnippet,t?ue(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(k.expandSmartSnippet,t?ue(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(k.collapseSmartSnippet,t?ue(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.openSmartSnippetFeedbackModal,t?ue(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.closeSmartSnippetFeedbackModal,t?ue(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(k.sendSmartSnippetReason,n?Object.assign(Object.assign({},ue(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(k.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},ue(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(k.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},ue(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(k.openSmartSnippetSource,t,r,n?ue(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(k.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(k.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(k.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(k.likeGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(k.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(k.openGeneratedAnswerSource,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(k.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(k.generatedAnswerSourceHover,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(k.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(k.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(k.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(k.generatedAnswerExpand,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(k.generatedAnswerCollapse,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(k.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(k.retryGeneratedAnswer,t?Object.assign({},ue(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(k.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(k.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(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:jh[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(k.showMoreFoldedResults,t,r,n?ue(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(k.showLessFoldedResults,t?ue(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(k.triggerNotify,r?Object.assign(Object.assign({},ue(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 oa=()=>"default";var g0=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},zn=class{constructor(t){this.getState=t;De(this,"state");this.state=t()}getLanguage(){return g0(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=Gn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||oa()}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 rb=e=>new cr(e).getCurrentVisitorId(),ia=(e,t)=>typeof t=="function"?(...r)=>{let n=zs(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,aa=(e,t)=>(...r)=>{let n=zs(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Ic=class extends zn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},nb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new Ic(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??Ye(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new Fl({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ia(e,n),beforeSendHooks:[aa(e,r),(C,b)=>(e.info({...b,type:C,endpoint:p,token:a},"Analytics request"),b)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Pl(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function h0(e,t){return!!t&&t.facetId in e.facetSet}var En=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),ob=(e,t)=>e.facetSet[t]?.request,Bh=(e,t)=>{let r=En(e,t);return h0(e,r)?r:void 0};var ib=(e,t)=>Bh(e,t)?.values.filter(r=>r.state!=="idle")||[],Qr=e=>e.search.isLoading;d();c();l();u();function ab(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 Br(e){let{activeValue:t,ancestryMap:r}=y0(e);return t?S0(t,r):[]}function y0(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 S0(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function v0(e,t){return!!t&&t.facetId in e.categoryFacetSet}var Gh=(e,t)=>{let r=En(e,t);if(v0(e,r))return r},$h=(e,t)=>e.categoryFacetSet[t]?.request,sb=(e,t)=>{let r=Gh(e,t);return Br(r?.values??[])},Hh=(e,t)=>{let r=$h(e,t);return Br(r?.currentValues??[])};d();c();l();u();function sa(){return{}}d();c();l();u();function cb(e,t){return{request:e,tabs:t}}function ca(){return{}}d();c();l();u();function ub(e,t){return{request:e,tabs:t}}function ua(){return{}}d();c();l();u();function lb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function la(){return{}}var Bo=(e,t)=>{let r=mb(t,e),n=r?r.field:"",o=zh(n,e);return{facetId:e,facetField:n,facetTitle:o}};function da(e,t){let{facetId:r,facetValue:n}=e,o=Bo(r,t),i=gb(t,r);return{...o,facetValue:i==="hierarchical"?fb(t,r):n}}function Xt(e){return{facetSet:e.facetSet??la(),categoryFacetSet:e.categoryFacetSet??sa(),dateFacetSet:e.dateFacetSet??ca(),numericFacetSet:e.numericFacetSet??ua(),automaticFacetSet:e.automaticFacetSet??Pl()}}var kl=e=>{let t=[];return b0(e).forEach((r,n)=>{let o=gb(e,r.facetId),i=E0(r,n+1);if(C0(r)){if(!!!Hh(e,r.facetId).length)return;t.push({...i,...R0(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,p)=>{if(a.state==="idle")return;let f=db(a,p+1,o),m=A0(r)?pb(a):w0(a);t.push({...i,...f,...m})})}),x0(e).forEach((r,n)=>{let o=I0(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let p=db(i,a+1,"specific"),f=pb(i);t.push({...o,...p,...f})})}),t},A0=e=>e.type==="specific",C0=e=>e.type==="hierarchical",b0=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),x0=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),db=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),w0=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),pb=e=>({displayValue:e.value,value:e.value}),fb=(e,t)=>Hh(e,t).map(n=>n.value).join(";"),R0=(e,t)=>{let n=fb(e,t);return{value:n,valuePosition:1,displayValue:n}},I0=(e,t)=>({title:zh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),E0=(e,t)=>({title:zh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),zh=(e,t)=>`${e}_${t}`,mb=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,gb=(e,t)=>{let r=mb(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var Wh=e=>e.configuration.search.locale,hb=e=>e.configuration.search.timezone,yb=e=>e.configuration.accessToken,Sb=e=>e.configuration.organizationId,vb=e=>e.configuration.environment,Ol=e=>e.configuration?.knowledge?.agentId,Ab=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(F0(e)||Yh(e))return e.generatedAnswer?.answerId;if(T0(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},F0=e=>"answer"in e&&"generatedAnswer"in e&&!ee(e.generatedAnswer?.answerConfigurationId),Yh=e=>{let t=Ol(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},T0=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Kh=e=>e.generatedAnswer?.fieldsToIncludeInCitations,P0=e=>e.generatedAnswer?.citations,k0=e=>e.followUpAnswers?.followUpAnswers,O0=it(k0,e=>e?.flatMap(t=>t.citations)),_0=(e,t)=>t,pa=it(P0,O0,_0,(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 Ec=class extends zn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||At().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 kl(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=je(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||At().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||At().response.results.length}},Cb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new Ec(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??Ye(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new Tl({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ia(e,n),beforeSendHooks:[aa(e,r),(C,b)=>(e.info({...b,type:C,endpoint:p,token:a},"Analytics request"),b)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();var _l=(r=>(r.Ascending="ascending",r.Descending="descending",r))(_l||{}),Nl=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Nl||{}),Gr=e=>{if(Qi(e))return e.map(t=>Gr(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""}},Dl=()=>({by:"relevancy"}),bb=e=>({by:"date",order:e});var xb=new Y({values:{by:new Hs({enum:Nl,required:!0}),order:new Hs({enum:_l}),field:new $}});function ur(){return Gr(Dl())}d();c();l();u();d();c();l();u();d();c();l();u();var fa=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.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?Xh(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],Xh(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let 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 Xh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}d();c();l();u();function N0(){return typeof navigator<"u"}function wb(){try{return typeof localStorage<"u"}catch{return!1}}function Rb(){try{return typeof sessionStorage<"u"}catch{return!1}}function Ib(){return!!(N0()&&navigator.cookieEnabled)}var Eb=null;function Fb(){return Eb||(wb()?localStorage:Ib()?new Jh:Rb()?sessionStorage:new Zh)}var ma=class ma{getItem(t){return fa.get(`${ma.prefix}${t}`)}removeItem(t){fa.erase(`${ma.prefix}${t}`)}setItem(t,r,n){fa.set(`${ma.prefix}${t}`,r,n)}};De(ma,"prefix","coveo_");var Jh=ma;var Zh=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ql="__coveo.analytics.history",D0=20,q0=1e3*60,M0=75,Go=class Go{constructor(t){De(this,"store");this.store=t||Fb()}static getInstance(t){return Go.instance||(Go.instance=new Go(t)),Go.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(ql);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(ql);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ql,JSON.stringify(t.slice(0,D0)))}catch{}}clear(){try{this.store.removeItem(ql)}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,M0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>q0:!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))}};De(Go,"instance",null);var ey=Go,Vt=ey;var Fc=class Fc extends zn{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 kl(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Fc.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||At().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Fc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=je(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||At().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||At().response.totalCountFiltered}};De(Fc,"fallbackPipelineName","default");var Wn=Fc,Tb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??Ye(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new wl({token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ia(e,n),beforeSendHooks:[aa(e,r),(C,b)=>(e.info({...b,type:C,endpoint:p,token:a},"Analytics request"),b)]},o);return m||h.disable(),h},ty=()=>{let t=Vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Ml(e){let t=Pb(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return Nv([e,...t,...r],o=>o.uniqueId)}function Pb(e){return e.childResults?e.childResults.flatMap(t=>[t,...Pb(t)]):[]}d();c();l();u();var Tc=()=>"";function kb(e,t){return{...new Wn(t).getBaseMetadata(),actionCause:e,type:e}}function V0(e){return Object.assign(e,{instantlyCallable:!0})}function j0(e,t){let r=i=>{let a=pe(e,i);return V0(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:h}=p;return yield(yield t({getState:a,analyticsClientMiddleware:f,preprocessRequest:m,logger:h})).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}){let{description:m,log:h}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:p,logger:f});return{description:m,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:b,extra:g}){return yield h({state:b(),extra:g})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var ry=(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 Q0(i)}return n},L0=e=>e.configuration.analytics.analyticsMode==="legacy",U0=e=>e.configuration.analytics.analyticsMode==="next",Q0=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=p=>new a(p)),j0(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:h}){let C=[],b={log:function(){var _ref14=_asyncToGenerator(function*({state:R}){for(let P of C)yield P(R)});return function log(_x25){return _ref14.apply(this,arguments)}}()},g=p(),S=i({getState:p,logger:h,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),x=yield t(S,p());b.description=x?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(R){L0(R)&&(yield B0(x,r,R,h,S.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:w}=Cc(g);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(R){if(U0(R)&&o&&n){let P=n(R);yield X0(w,o,P)}});return function(_x27){return _ref16.apply(this,arguments)}}()),b});return function(_x24){return _ref13.apply(this,arguments)}}()));function B0(_x28,_x29,_x30,_x31,_x32){return _B2.apply(this,arguments)}function _B2(){_B2=_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 _B2.apply(this,arguments)}var Ob=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)}}()}),He=ry(e=>Tb({...e,provider:e.provider||new Wn(e.getState)}),e=>e,Wn),q6=ry(nb,Ob("caseAssist"),Ic),te=e=>ry(Cb,Ob(e),Ec),Xe=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Nb(e,o),n<0&&(n=K0(e,o)),n<0&&(n=0),$0(e,r(n),t)};var Vl=(e,t)=>({sourceName:G0(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tc()});function G0(e){let t=e.source;return ee(t)?"unknown":t}var jl=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function $0(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:W0(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:Y0(e),queryPipeline:r.pipeline||Tc()}}var Je=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||""}),_b={urihash:new $,sourcetype:new $,permanentid:new $},Ll={uniqueId:z,raw:new Y({values:_b}),title:z,uri:z,clickUri:z,rankingModifier:new $({required:!1,emptyAllowed:!0})};function H0(e){return Object.assign({},...Object.keys(_b).map(t=>({[t]:e[t]})))}function z0(e){return Object.assign({},...Object.keys(Ll).map(t=>({[t]:e[t]})),{raw:H0(e.raw)})}function W0(e){let t=e.raw.author;return ee(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function Y0(e){let t=e.raw.source;return ee(t)?"unknown":t}var Ot=e=>new Fe(Ll).validate(z0(e));function K0(e,t){for(let[r,n]of t.entries()){let o=Ml(n);if(Nb(e,o)!==-1)return r}return-1}function Nb(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function X0(_x34,_x35,_x36){return _X.apply(this,arguments)}function _X(){_X=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _X.apply(this,arguments)}var Tr=(e,t)=>{let r=Je(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 ny=e=>O(e,{evt:z,type:ze}),Db=e=>He("analytics/generic/search",t=>{ny(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),qb=e=>He("analytics/generic/click",(t,r)=>(Ot(e.result),ny(e),t.makeClickEvent(e.evt,Xe(e.result,r),Je(e.result),e.meta))),Mb=e=>He("analytics/generic/custom",t=>(ny(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var Vb=()=>({actionCause:"interfaceLoad"}),ga=()=>({actionCause:"interfaceChange"});d();c();l();u();var oy=()=>ze,jb=()=>z,ha=T("configuration/updateBasicConfiguration",e=>O(e,{accessToken:ze,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:ze})),ya=T("configuration/updateSearchConfiguration",e=>O(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:ze,timezone:ze,locale:ze,authenticationProviders:new ne({required:!1,each:z})})),J0={enabled:new de({default:!0}),originContext:oy(),originLevel2:oy(),originLevel3:oy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new Ge,anonymous:new de({default:!1}),deviceId:ze,userDisplayName:ze,documentLocation:ze,trackingId:EA,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:NC.reduce((e,t)=>(e[t]=IA,e),{})})},Ul=T("configuration/updateAnalyticsConfiguration",e=>O(e,J0)),Ql=T("configuration/analytics/disable"),Bl=T("configuration/analytics/enable"),Lb=T("configuration/analytics/originlevel2",e=>O(e,{originLevel2:jb()})),Ub=T("configuration/analytics/originlevel3",e=>O(e,{originLevel3:jb()})),Qb=T("knowledge/setAgentId",e=>O(e,new $({required:!0})));d();c();l();u();var Gl=T("insightConfiguration/set",e=>O(e,{insightId:z}));d();c();l();u();d();c();l();u();var Bb=()=>({insightId:""});var $l=le(Bb(),e=>{e.addCase(Gl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Hl=T("searchHub/set",e=>O(e,new $({required:!0,emptyAllowed:!0})));var $r=pe("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(Z0(i));return $e(a)?n(a.error):(r(Hl(a.success.searchHub)),{response:a.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),Z0=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ye(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var Gb=()=>({loading:!1,config:void 0});var Yn=le(Gb(),e=>{e.addCase($r.pending,t=>{t.loading=!0,t.error=void 0}).addCase($r.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase($r.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 $b(e){return e.type==="dateRange"}function Hb(e){return`start${e}`}function zb(e){return`end${e}`}var iy=()=>({dateFacetValueMap:{}});function eD(e,t,r){let n=e.start,o=e.end;return Un(n)&&(n=Xs(n),r.dateFacetValueMap[t][Hb(n)]=e.start),Un(o)&&(o=Xs(o),r.dateFacetValueMap[t][zb(o)]=e.end),{...e,start:n,end:o}}function ay(e,t){if($b(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>eD(o,r,t))}}return e}function Hr(e){let t=iy();return{request:{...e,facets:e.facets?.map(n=>ay(n,t))},mappings:t}}function tD(e,t,r){return{...e,start:r.dateFacetValueMap[t][Hb(e.start)]||e.start,end:r.dateFacetValueMap[t][zb(e.end)]||e.end}}function rD(e,t){return e.facetId in t.dateFacetValueMap}function nD(e,t){return rD(e,t)?{...e,values:e.values.map(r=>tD(r,e.facetId,t))}:e}function Pr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>nD(n,t))}}:e}d();c();l();u();d();c();l();u();var Kn=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield rb(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}),...(ty()&&{pageId:ty()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ea(e)})}}});return function Kn(_x39,_x40){return _ref19.apply(this,arguments)}}();var Wb=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:Ye(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 Kn(t.configuration.analytics)))})}});return function Wb(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var zl=T("didYouMean/enable"),Yb=T("didYouMean/disable"),Wl=T("didYouMean/automaticCorrections/disable"),Kb=T("didYouMean/automaticCorrections/enable"),Jt=T("didYouMean/correction",e=>O(e,z)),Pc=T("didYouMean/automaticCorrections/mode",e=>O(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var oD=T("history/undo"),iD=T("history/redo"),bt=T("history/snapshot"),B9=pe("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(oD()),yield t(rt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),G9=pe("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(iD()),yield t(rt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),rt=pe("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 Fn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function Yl(){return{contextValues:{}}}d();c();l();u();var Kl=()=>!1;d();c();l();u();function Xb(){return{contextValues:{}}}d();c();l();u();function sy(){return{enabled:!0,tabs:{}}}function Xl(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Jb(){return[]}d();c();l();u();function zr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function Jl(){return{}}d();c();l();u();function Zb(){return{}}d();c();l();u();function Zl(){return{}}function xt(e){return{context:e.context||Yl(),dictionaryFieldContext:e.dictionaryFieldContext||Xb(),facetSet:e.facetSet||la(),numericFacetSet:e.numericFacetSet||ua(),dateFacetSet:e.dateFacetSet||ca(),categoryFacetSet:e.categoryFacetSet||sa(),automaticFacetSet:e.automaticFacetSet??Pl(),pagination:e.pagination||zr(),query:e.query||ut(),tabSet:e.tabSet||Zl(),advancedSearchQueries:e.advancedSearchQueries||Fn(),staticFilterSet:e.staticFilterSet||Zb(),querySet:e.querySet||Jl(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||Tc(),searchHub:e.searchHub||oa(),facetOptions:e.facetOptions||Xl(),facetOrder:e.facetOrder??Jb(),debug:e.debug??Kl()}}d();c();l();u();var zt=T("query/updateQuery",e=>O(e,{q:new $,enableQuerySyntax:new de}));d();c();l();u();d();c();l();u();var ex=()=>({caseContext:{},caseId:"",caseNumber:""}),Z=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var cy=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(Z(t.insightCaseContext))),Sa=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...Z(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),tx=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),ed=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(Z(t.insightCaseContext))),Xn=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...Z(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Wr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var rx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=sD(e),n=aD(e);return Hr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Ye(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Kn(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 rx(_x49,_x50){return _ref24.apply(this,arguments)}}(),yr=/*#__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 rx(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function yr(_x51,_x52){return _ref25.apply(this,arguments)}}(),nx=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield rx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function nx(_x53,_x54){return _ref26.apply(this,arguments)}}(),td=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield yr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function td(_x55,_x56){return _ref27.apply(this,arguments)}}(),rd=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield yr(e,t);return r.request={...r.request,numberOfResults:0},r});return function rd(_x57,_x58){return _ref28.apply(this,arguments)}}();function aD(e){return Wr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function sD(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var $o=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Pr(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 $e(t.response)?(this.dispatch(Sa(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||!i)return null;let m=a.length===0&&p&&p.length!==0,h=!ee(f)&&!ee(f.correctedQuery);if(!m&&!h)return null;let b=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(bt(xt(_this1.getState()))),b})()}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 $e(i.response)?(_this10.dispatch(Sa(i.response.error)),_this10.rejectWithValue(i.response.error)):(_this10.dispatch(bt(xt(_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 yr(r));return _this11.dispatch(Jt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Bn(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 ox=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(Z(t.insightCaseContext))),uy=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(Z(t.insightCaseContext)));var Ho=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Pr(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 $e(t.response)?(this.dispatch(Sa(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 h=p.length===0&&f&&f.length!==0,C=!ee(m)&&!ee(m.correctedQuery);if(!h&&!C)return null;let g=h?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(bt(xt(_this14.getState()))),g})()}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 $e(i.response)?(_this15.dispatch(Sa(i.response.error)),_this15.rejectWithValue(i.response.error)):(_this15.dispatch(bt(xt(_this15.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:uy()})})()}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:uy()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(zt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield yr(r));return _this16.dispatch(Jt(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 Bn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Pr(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 ly(_x63,_x64,_x65){return _ly.apply(this,arguments)}function _ly(){_ly=_asyncToGenerator(function*(e,t,r){kc(e);let n=new Ho({...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 yr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _ly.apply(this,arguments)}function dy(_x66,_x67,_x68){return _dy.apply(this,arguments)}function _dy(){_dy=_asyncToGenerator(function*(e,t,r){kc(e);let n=new Ho({...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 yr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _dy.apply(this,arguments)}function py(_x69,_x70){return _py.apply(this,arguments)}function _py(){_py=_asyncToGenerator(function*(e,t){let r=new Ho({...t,analyticsAction:cy}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield cy().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield td(e,a),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _py.apply(this,arguments)}function fy(_x71,_x72,_x73){return _fy.apply(this,arguments)}function _fy(){_fy=_asyncToGenerator(function*(e,t,r){let n=new Ho({...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 rd(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _fy.apply(this,arguments)}var ix=pe("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ly(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),ax=pe("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)}}()),sx=pe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield py(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),cx=pe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield fy(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var ux=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let i=Date.now(),a=Pr(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 ux(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),Ae=pe("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ly(r,t,e.legacy);kc(r);let n=new $o({...t}),o=e.next?my(e.next):void 0,i=yield yr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),nd=pe("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);kc(r);let n=new $o({...t}),o=e.next?my(e.next):void 0,i=yield yr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),od=pe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return py(r,t);let n=new $o({...t}),o=my({actionCause:"browseResults"}),i=yield td(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),va=pe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return fy(r,t,e.legacy);let n=new $o({...t}),o=yield rd(r),i=yield n.fetchFromAPI(o);return yield n.process(i)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),id=pe("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:z});let i=e.id,a=yield Wb(i,t()),p=yield n.querySuggest(a);return $e(p)?r(p.error):{id:i,q:a.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),kc=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},my=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Zt=T("breadcrumb/deselectAll"),ad=T("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Aa=T("facet/updateFacetAutoSelection",e=>O(e,{allow:new de({required:!0})}));d();c();l();u();d();c();l();u();var sd=class extends Wn{constructor(r){super(r);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??At().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??At().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var lx=()=>He("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new sd(e)),dx=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var gy={id:z},cD={...gy,q:Ke},HJ=T("instantResults/register",e=>O(e,gy)),cd=T("instantResults/updateQuery",e=>O(e,cD)),zJ=T("instantResults/clearExpired",e=>O(e,gy));d();c();l();u();var ud=new oe({required:!0,min:0}),ld=T("pagination/registerNumberOfResults",e=>O(e,ud)),dd=T("pagination/updateNumberOfResults",e=>O(e,ud)),pd=T("pagination/registerPage",e=>O(e,ud)),Jn=T("pagination/updatePage",e=>O(e,ud)),fd=T("pagination/nextPage"),md=T("pagination/previousPage");d();c();l();u();d();c();l();u();var zo=(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:ea(e)}});var Ca=(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&&zo(e.configuration.analytics,t,r)),...(e.excerptLength&&!ee(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 Zn=/*#__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 Kn(e.configuration.analytics,t))),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Zn(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var hy=()=>He("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),eo=e=>He("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||Fn().aq,cq:r.advancedSearchQueries?.cq||Fn().cq,dq:r.advancedSearchQueries?.dq||Fn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var yy=()=>He("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),px=()=>({actionCause:"didYouMeanClick"}),fx=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var WZ=new Y({values:{undoneQuery:Ke},options:{required:!0}}),mx=()=>He("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var ba=T("trigger/query/ignore",e=>O(e,new $({emptyAllowed:!0,required:!0}))),xa=T("trigger/query/modification",e=>O(e,new Y({values:{originalQuery:ze,modification:ze}})));d();c();l();u();d();c();l();u();function Oc(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 Wr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Sy={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function uD(e){return Wr(e).map(t=>{let r=Sy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function lD(e){return[...uD(e.facetSet??{}),...gx(e.numericFacetSet??{}),...gx(e.dateFacetSet??{}),...Wr(e.categoryFacetSet??{})]}function dD(e){return lD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function gd(e){return Oc(dD(e),e.facetOrder??[])}var to=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=mD(e),n=gd(e),o=pD(e),i=yield Zn(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Hr({...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 to(_x98,_x99){return _ref40.apply(this,arguments)}}();function pD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(fD).filter(r=>r.currentValues.length>0):void 0}function fD(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function mD(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=gD(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function gD(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 ro=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Pr(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 $e(t.response)?(this.dispatch(eo(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,h=!ee(f)&&!ee(f.correctedQuery);if(!m&&!h)return null;let b=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(bt(xt(_this19.getState()))),b})()}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 $e(i.response)?(_this20.dispatch(eo(i.response.error)),_this20.rejectWithValue(i.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(bt(xt(_this20.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:yy()})})()}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:yy()}}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(ba("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let i=_this21.getCurrentQuery(),a=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return $e(a.response)?(_this21.dispatch(eo(a.response.error)),_this21.rejectWithValue(a.response.error)):(_this21.dispatch(bt(xt(_this21.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:mx()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),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 Bn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield to(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Jt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(xa({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield to(_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 Zee=pe("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield hd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),ete=pe("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ay(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),tte=pe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Cy(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),rte=pe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield vD(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),nte=pe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return vy(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),hD=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield to(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function hD(_x112,_x113){return _ref46.apply(this,arguments)}}(),yD=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield Zn(e);return Hr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function yD(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),SD=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield to(e,t);return r.request.numberOfResults=0,r});return function SD(_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 vy(_x119,_x120){return _vy.apply(this,arguments)}function _vy(){_vy=_asyncToGenerator(function*(e,t){O(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new ro({...t,analyticsAction:lx()},m=>{t.dispatch(cd({q:m,id:e.id}))}),a=yield yD(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 _vy.apply(this,arguments)}function Ay(_x121,_x122,_x123){return _Ay.apply(this,arguments)}function _Ay(){_Ay=_asyncToGenerator(function*(e,t,r){hx(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 ro({...t,analyticsAction:r}),f=yield to(e,a),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _Ay.apply(this,arguments)}function Cy(_x124,_x125){return _Cy.apply(this,arguments)}function _Cy(){_Cy=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield hy().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new ro({...e,analyticsAction:hy()}),p=yield hD(t,i),f=yield a.fetchFromAPI(p,{origin:"mainSearch"});return yield a.process(f)});return _Cy.apply(this,arguments)}function vD(_x126,_x127,_x128){return _vD.apply(this,arguments)}function _vD(){_vD=_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 ro({...e,analyticsAction:t}),f=yield SD(r,a),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _vD.apply(this,arguments)}function hd(_x129,_x130,_x131){return _hd.apply(this,arguments)}function _hd(){_hd=_asyncToGenerator(function*(e,t,r){hx(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 to(e,a),f=new ro({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _hd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var yx=it(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 Sr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=xy(e),o=AD(e),i=CD(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Zn(e,r):Ca(e,t,r);return Hr({...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:by(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 Sr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function by(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function AD(e){return Oc(xD(e),e.facetOrder??[])}function CD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(bD).filter(r=>r.currentValues.length>0):void 0}function bD(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function xD(e){return wD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function wD(e){return[...RD(e.facetSet??{}),...Sx(e.numericFacetSet??{}),...Sx(e.dateFacetSet??{}),...Wr(e.categoryFacetSet??{})]}function RD(e){return Wr(e).map(t=>{let r=Sy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Sx(e){return Wr(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 xy(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=yx(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}var no=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Pr(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 $e(t.response)?(this.dispatch(eo(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||!i)return null;let m=a.length===0&&p&&p.length!==0,h=!ee(f)&&!ee(f.correctedQuery);if(!m&&!h)return null;let b=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(bt(xt(_this26.getState()))),b})()}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 $e(i.response)?(_this27.dispatch(eo(i.response.error)),_this27.rejectWithValue(i.response.error)):(_this27.dispatch(bt(xt(_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(ba("")),null;let i=_this28.getCurrentQuery(),a=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return $e(a.response)?(_this28.dispatch(eo(a.response.error)),_this28.rejectWithValue(a.response.error)):(_this28.dispatch(bt(xt(_this28.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Bn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=fx(),o=yield _this29.fetchFromAPI(yield Sr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Jt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(xa({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield Sr(_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 wa=pe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;O(e,{q:new $,enableQuerySyntax:new de,clearFilters:new de}),e.clearFilters&&(r(Zt()),r(ad())),r(Aa({allow:!0})),r(zt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Jn(1))}),vx=T("search/updateSearchAction"),Te=pe("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return hd(r,t,e.legacy);Ax(r);let n=e.next?Cx(e.next):void 0,o=yield Sr(r,t.extra.navigatorContext,n),i=new no({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Kr=pe("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Ax(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Ay(r,t,e.legacy);let n=new no({...t,analyticsAction:e.next}),o=yield Sr(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)}}()),oo=pe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Cy(t,r);let n=kb("browseResults",t.getState),o=new no({...t,analyticsAction:n}),i=yield ID(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)}}()),Ra=pe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return hd(r,t,e.legacy);let n=new no({...t,analyticsAction:{}}),o=yield FD(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)}}()),are=pe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return vy(e,t);O(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=Cx(dx()),a=yield ED(r,t.extra.navigatorContext,n,o,i),p=new no({...t,analyticsAction:i},h=>{t.dispatch(cd({q:h,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)}}()),ID=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield Sr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function ID(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),ED=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let i=Ca(e,t,o);return Hr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function ED(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),FD=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield Sr(e,t,r);return n.request.numberOfResults=0,n});return function FD(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Ax=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Cx=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function bx(_x158,_x159){return _bx.apply(this,arguments)}function _bx(){_bx=_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 _bx.apply(this,arguments)}var _c=pe("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield bx(o,e),a=yield t.apiClient.html(i);return $e(a)?n(a.error):{content:a.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),yd=T("resultPreview/next"),Sd=T("resultPreview/previous"),wx=T("resultPreview/prepare",e=>O(e,{results:new ne({required:!0})})),xx=2048,vd=pe("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=yA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>xx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${xx} 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 Ry=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=wy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Iy=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Ia=le(wy(),e=>{e.addCase(_c.pending,t=>{t.isLoading=!0}).addCase(_c.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(Te.fulfilled,(t,r)=>{Ry(t),t.resultsWithPreview=Iy(r.payload.response.results)}).addCase(oo.fulfilled,(t,r)=>{Ry(t),t.resultsWithPreview=t.resultsWithPreview.concat(Iy(r.payload.response.results))}).addCase(Kr.fulfilled,Ry).addCase(wx,(t,r)=>{t.resultsWithPreview=Iy(r.payload.results)}).addCase(yd,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Sd,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(vd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var io=(e,t)=>{let r=e;return ee(r[t])?ee(e.raw[t])?null:e.raw[t]:r[t]},TD=e=>t=>e.every(r=>!ee(io(t,r))),PD=e=>t=>e.every(r=>ee(io(t,r))),kD=(e,t)=>r=>{let n=Rx(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},OD=(e,t)=>r=>{let n=Rx(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Rx=(e,t)=>{let r=io(t,e);return Pu(r)?r:[r]},Ix={getResultProperty:io,fieldsMustBeDefined:TD,fieldsMustNotBeDefined:PD,fieldMustMatch:kD,fieldMustNotMatch:OD};function Ad(e){return e.search.response.searchUid!==""}function Ex(e,t,r){return e.search.results.find(n=>io(n,t)===r)}var Ey=it(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Ea=T("app/setError");function Fy(e,t){let r=t.payload??null;r&&(e.response=At().response,e.results=[],e.questionAnswer=zi()),e.error=r,e.isLoading=!1}function Ty(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function _D(e,t){Ty(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 Fx(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function ND(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var we=le(At(),e=>{e.addCase(Te.rejected,(t,r)=>Fy(t,r)),e.addCase(oo.rejected,(t,r)=>Fy(t,r)),e.addCase(Kr.rejected,(t,r)=>Fy(t,r)),e.addCase(Te.fulfilled,(t,r)=>{_D(t,r)}),e.addCase(oo.fulfilled,(t,r)=>{Ty(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Kr.fulfilled,(t,r)=>{Ty(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ra.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(Te.pending,Fx),e.addCase(oo.pending,ND),e.addCase(Kr.pending,Fx),e.addCase(vx,(t,r)=>{t.searchAction=r.payload}),e.addCase(Ea,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Cd=le(oa(),e=>{e.addCase(Hl,(t,r)=>r.payload).addCase(rt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(ya,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Tx=class extends Error{constructor(t){super(t[0].message);De(this,"issues");this.name="SchemaError",this.issues=t}};var Pn="uninitialized",ky="pending",Dc="fulfilled",qc="rejected";function Px(e){return{status:e,isUninitialized:e===Pn,isLoading:e===ky,isSuccess:e===Dc,isError:e===qc}}var kx=jr;function $x(e,t){if(e===t||!(kx(e)&&kx(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]=$x(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function Oy(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function DD(e){return new RegExp("(^|:)//").test(e)}function qD(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function qy(e){return e!=null}function Ox(e){return[...(e?.values()??[])].filter(qy)}function MD(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var VD=e=>e.replace(/\/$/,""),jD=e=>e.replace(/^\//,"");function LD(e,t){if(!e)return t;if(!t)return e;if(DD(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=VD(e),t=jD(t),`${e}${r}${t}`}function wd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var _y=()=>new Map,UD=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},QD=(...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},_x=(...e)=>v(...e),BD=e=>e.status>=200&&e.status<=299,GD=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Nx(e){if(!jr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var $D=e=>typeof e=="object"&&(jr(e)||Array.isArray(e)||typeof e.toJSON=="function");function Hx({baseUrl:e,prepareHeaders:t=C=>C,fetchFn:r=_x,paramsSerializer:n,isJsonContentType:o=GD,jsonContentType:i="application/json",jsonReplacer:a,timeout:p,responseHandler:f,validateStatus:m,...h}={}){return typeof v>"u"&&r===_x&&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*(b,g,S){let{getState:x,extra:w,endpoint:R,forced:P,type:E}=g,_,{url:F,headers:q=new A(h.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:j=m??BD,timeout:B=p,...L}=typeof b=="string"?{url:b}:b,N={...h,signal:B?QD(g.signal,UD(B)):g.signal,...L};q=new A(Nx(q)),N.headers=(yield t(q,{getState:x,arg:b,extra:w,endpoint:R,forced:P,type:E,extraOptions:S}))||q;let D=$D(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 se=~F.indexOf("?")?"&":"?",ye=n?n(G):new URLSearchParams(Nx(G));F+=se+ye}F=LD(e,F);let M=new Request(F,N);_={request:new Request(F,N)};let H;try{H=yield r(M)}catch(se){return{error:{status:(se instanceof Error||typeof DOMException<"u"&&se instanceof DOMException)&&se.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(se)},meta:_}}let re=H.clone();_.response=re;let J,K="";try{let se;if(yield Promise.all([C(H,Q).then(ye=>J=ye,ye=>se=ye),re.text().then(ye=>K=ye,()=>{})]),se)throw se}catch(se){return{error:{status:"PARSING_ERROR",originalStatus:H.status,data:K,error:String(se)},meta:_}}return j(H,J)?{data:J,meta:_}:{error:{status:H.status,data:J},meta:_}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function C(_x167,_x168){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*(b,g){if(typeof g=="function")return g(b);if(g==="content-type"&&(g=o(b.headers)?"json":"text"),g==="json"){let S=yield b.text();return S.length?JSON.parse(S):null}return b.text()});return _C2.apply(this,arguments)}}var Fa=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function HD(){return _HD.apply(this,arguments)}function _HD(){_HD=_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 _HD.apply(this,arguments)}function zx(e,t){throw Object.assign(new Fa({error:e,meta:t}),{throwImmediately:!0})}function Py(e){e.aborted&&zx({status:"CUSTOM_ERROR",error:"Aborted"})}var Dx={},zD=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Dx).maxRetries,(o||Dx).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),f={maxRetries:a,backoff:HD,retryCondition:(h,C,{attempt:b})=>b<=a,...t,...o},m=0;for(;;){Py(n.signal);try{let h=yield e(r,n,o);if(h.error)throw new Fa(h);return h}catch(h){if(m++,h.throwImmediately){if(h instanceof Fa)return h.value;throw h}if(h instanceof Fa){if(!f.retryCondition(h.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return h.value}else if(m>f.maxRetries)return{error:h};Py(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(C){throw Py(n.signal),C}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),Wx=Object.assign(zD,{fail:zx}),Id="__rtkq/",WD="online",YD="offline";var Yx="focused";var My=T(`${Id}${Yx}`),Kx=T(`${Id}un${Yx}`),Vy=T(`${Id}${WD}`),Xx=T(`${Id}${YD}`);var jc="query",Jx="mutation",Zx="infinitequery";function Ed(e){return e.type===jc}function KD(e){return e.type===Jx}function Fd(e){return e.type===Zx}function Rd(e){return Ed(e)||Fd(e)}function jy(e,t,r,n,o,i){let a=XD(e)?e(t,r,n,o):e;return a?Oy(a,qy,p=>i(ew(p))):[]}function XD(e){return typeof e=="function"}function ew(e){return typeof e=="string"?{type:e}:e}function JD(e,t){return e.catch(t)}var Ta=(e,t)=>e.endpointDefinitions[t],Mc=Symbol("forceQueryFn"),Ny=e=>typeof e[Mc]=="function";function ZD({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let p=F=>a(F)?.runningQueries,f=F=>a(F)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:h,updateSubscriptionOptions:C}=o.internalActions;return{buildInitiateQuery:P,buildInitiateInfiniteQuery:E,buildInitiateMutation:_,getRunningQueryThunk:b,getRunningMutationThunk:g,getRunningQueriesThunk:S,getRunningMutationsThunk:x};function b(F,q){return G=>{let Q=Ta(i,F),j=e({queryArgs:q,endpointDefinition:Q,endpointName:F});return p(G)?.get(j)}}function g(F,q){return G=>f(G)?.get(q)}function S(){return F=>Ox(p(F))}function x(){return F=>Ox(f(F))}function w(F){}function R(F,q){let G=(Q,{subscribe:j=!0,forceRefetch:B,subscriptionOptions:L,[Mc]:N,...D}={})=>(M,W)=>{let H=e({queryArgs:Q,endpointDefinition:q,endpointName:F}),re,J={...D,type:jc,subscribe:j,forceRefetch:B,subscriptionOptions:L,endpointName:F,originalArgs:Q,queryCacheKey:H,[Mc]:N};if(Ed(q))re=t(J);else{let{direction:xe,initialPageParam:Pe,refetchCachedPages:Ie}=D;re=r({...J,direction:xe,initialPageParam:Pe,refetchCachedPages:Ie})}let K=o.endpoints[F].select(Q),se=M(re),ye=K(W());let{requestId:qe,abort:ot}=se,Be=ye.requestId!==qe,et=p(M)?.get(H),tt=()=>K(W()),Re=Object.assign(N?se.then(tt):Be&&!et?Promise.resolve(ye):Promise.all([et,se]).then(tt),{arg:Q,requestId:qe,subscriptionOptions:L,queryCacheKey:H,abort:ot,unwrap(){return _asyncToGenerator(function*(){let xe=yield Re;if(xe.isError)throw xe.error;return xe.data})()},refetch:xe=>M(G(Q,{subscribe:!1,forceRefetch:!0,...xe})),unsubscribe(){j&&M(m({queryCacheKey:H,requestId:qe}))},updateSubscriptionOptions(xe){Re.subscriptionOptions=xe,M(C({endpointName:F,requestId:qe,queryCacheKey:H,options:xe}))}});if(!et&&!Be&&!N){let xe=p(M);xe.set(H,Re),Re.then(()=>{xe.delete(H)})}return Re};return G}function P(F,q){return R(F,q)}function E(F,q){return R(F,q)}function _(F){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(j,B)=>{let L=n({type:"mutation",endpointName:F,originalArgs:q,track:G,fixedCacheKey:Q}),N=j(L);let{requestId:D,abort:M,unwrap:W}=N,H=JD(N.unwrap().then(se=>({data:se})),se=>({error:se})),re=()=>{j(h({requestId:D,fixedCacheKey:Q}))},J=Object.assign(H,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(j);return K.set(D,J),J.then(()=>{K.delete(D)}),Q&&(K.set(Q,J),J.then(()=>{K.get(Q)===J&&K.delete(Q)})),J}}}var tw=class extends Tx{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}},Wo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Yo(_x172,_x173,_x174,_x175){return _Yo.apply(this,arguments)}function _Yo(){_Yo=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new tw(o.issues,t,r,n);return o.value});return _Yo.apply(this,arguments)}function qx(e){return e}var Nc=(e={})=>({...e,[yc]:!0});function eq({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let h=(L,N,D,M)=>(W,H)=>{let re=r[L],J=n({queryArgs:N,endpointDefinition:re,endpointName:L});if(W(o.internalActions.queryResultPatched({queryCacheKey:J,patches:D})),!M)return;let K=o.endpoints[L].select(N)(H()),se=jy(re.providesTags,K.data,void 0,N,{},i);W(o.internalActions.updateProvidedBy([{queryCacheKey:J,providedTags:se}]))};function C(L,N,D=0){let M=[N,...L];return D&&M.length>D?M.slice(0,-1):M}function b(L,N,D=0){let M=[...L,N];return D&&M.length>D?M.slice(1):M}let g=(L,N,D,M=!0)=>(W,H)=>{let J=o.endpoints[L].select(N)(H()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(J.status===Pn)return K;let se;if("data"in J)if($t(J.data)){let[ye,qe,ot]=uh(J.data,D);K.patches.push(...qe),K.inversePatches.push(...ot),se=ye}else se=D(J.data),K.patches.push({op:"replace",path:[],value:se}),K.inversePatches.push({op:"replace",path:[],value:J.data});return K.patches.length===0||W(o.util.patchQueryData(L,N,K.patches,M)),K},S=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[Mc]:()=>({data:D})})),x=(L,N)=>L.query&&L[N]?L[N]:qx,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:H,getState:re,extra:J}){let K=r[L.endpointName],{metaSchema:se,skipSchemaValidation:ye=m}=K,qe=L.type===jc;try{let ot=qx,Be={signal:N,abort:D,dispatch:H,getState:re,extra:J,endpoint:L.endpointName,type:L.type,forced:qe?R(L,re()):void 0,queryCacheKey:qe?L.queryCacheKey:void 0},et=qe?L[Mc]:void 0,tt,Re=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(Pe,Ie,gt,vt){if(Ie==null&&Pe.pages.length)return Promise.resolve({data:Pe});let Rr={queryArg:L.originalArgs,pageParam:Ie},ar=yield xe(Rr),Mr=vt?C:b;return{data:{pages:Mr(Pe.pages,ar.data,gt),pageParams:Mr(Pe.pageParams,Ie,gt)},meta:ar.meta}});return function Re(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function xe(_x182){return _xe.apply(this,arguments)}function _xe(){_xe=_asyncToGenerator(function*(Pe){let Ie,{extraOptions:gt,argSchema:vt,rawResponseSchema:Rr,responseSchema:ar}=K;if(vt&&!Wo(ye,"arg")&&(Pe=yield Yo(vt,Pe,"argSchema",{})),et?Ie=et():K.query?(ot=x(K,"transformResponse"),Ie=yield t(K.query(Pe),Be,gt)):Ie=yield K.queryFn(Pe,Be,gt,Ir=>t(Ir,Be,gt)),typeof process<"u",Ie.error)throw new Fa(Ie.error,Ie.meta);let{data:Mr}=Ie;Rr&&!Wo(ye,"rawResponse")&&(Mr=yield Yo(Rr,Ie.data,"rawResponseSchema",Ie.meta));let pr=yield ot(Mr,Ie.meta,Pe);return ar&&!Wo(ye,"response")&&(pr=yield Yo(ar,pr,"responseSchema",Ie.meta)),{...Ie,data:pr}});return _xe.apply(this,arguments)}if(qe&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:Pe}=K,{maxPages:Ie=1/0}=Pe,gt=L.refetchCachedPages??Pe.refetchCachedPages??!0,vt,Rr={pages:[],pageParams:[]},ar=a.selectQueryEntry(re(),L.queryCacheKey)?.data,pr=R(L,re())&&!L.direction||!ar?Rr:ar;if("direction"in L&&L.direction&&pr.pages.length){let Ir=L.direction==="backward",xu=(Ir?rw:Dy)(Pe,pr,L.originalArgs);vt=yield Re(pr,xu,Ie,Ir)}else{let{initialPageParam:Ir=Pe.initialPageParam}=L,Ls=ar?.pageParams??[],xu=Ls[0]??Ir,jP=Ls.length;if(vt=yield Re(pr,xu,Ie),et&&(vt={data:vt.data.pages[0]}),gt)for(let hv=1;hv<jP;hv++){let LP=Dy(Pe,vt.data,L.originalArgs);vt=yield Re(vt.data,LP,Ie)}}tt=vt}else tt=yield xe(L.originalArgs);return se&&!Wo(ye,"meta")&&tt.meta&&(tt.meta=yield Yo(se,tt.meta,"metaSchema",tt.meta)),W(tt.data,Nc({fulfilledTimeStamp:Date.now(),baseQueryMeta:tt.meta}))}catch(ot){let Be=ot;if(Be instanceof Fa){let et=x(K,"transformErrorResponse"),{rawErrorResponseSchema:tt,errorResponseSchema:Re}=K,{value:xe,meta:Pe}=Be;try{tt&&!Wo(ye,"rawErrorResponse")&&(xe=yield Yo(tt,xe,"rawErrorResponseSchema",Pe)),se&&!Wo(ye,"meta")&&(Pe=yield Yo(se,Pe,"metaSchema",Pe));let Ie=yield et(xe,Pe,L.originalArgs);return Re&&!Wo(ye,"errorResponse")&&(Ie=yield Yo(Re,Ie,"errorResponseSchema",Pe)),M(Ie,Nc({baseQueryMeta:Pe}))}catch(Ie){Be=Ie}}try{if(Be instanceof tw){let et={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:qe?L.queryCacheKey:void 0};K.onSchemaFailure?.(Be,et),p?.(Be,et);let{catchSchemaFailure:tt=f}=K;if(tt)return M(tt(Be,et),Nc({baseQueryMeta:Be._bqMeta}))}}catch(et){Be=et}throw typeof process<"u",console.error(Be),Be}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function R(L,N){let D=a.selectQueryEntry(N,L.queryCacheKey),M=a.selectConfig(N).refetchOnMountOrArgChange,W=D?.fulfilledTimeStamp,H=L.forceRefetch??(L.subscribe&&M);return H?H===!0||(Number(new Date)-Number(W))/1e3>=H:!1}let P=()=>pe(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return Nc({startedTimeStamp:Date.now(),...(Fd(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=a.selectQueryEntry(M,N.queryCacheKey),H=W?.fulfilledTimeStamp,re=N.originalArgs,J=W?.originalArgs,K=r[N.endpointName],se=N.direction;return Ny(N)?!0:W?.status==="pending"?!1:R(N,M)||Ed(K)&&K?.forceRefetch?.({currentArg:re,previousArg:J,endpointState:W,state:M})?!0:!(H&&!se)},dispatchConditionRejection:!0}),E=P(),_=P(),F=pe(`${e}/executeMutation`,w,{getPendingMeta(){return Nc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let H=q(D)&&D.force,re=G(D)&&D.ifOlderThan,J=(se=!0)=>{let ye={forceRefetch:se,subscribe:!1};return o.endpoints[L].initiate(N,ye)},K=o.endpoints[L].select(N)(W());if(H)M(J());else if(re){let se=K?.fulfilledTimeStamp;if(!se){M(J());return}(Number(new Date)-Number(new Date(se)))/1e3>=re&&M(J())}else M(J(!1))};function j(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:Ji(dl(L),j(N)),matchFulfilled:Ji(In(L),j(N)),matchRejected:Ji(Lo(L),j(N))}}return{queryThunk:E,mutationThunk:F,infiniteQueryThunk:_,prefetch:Q,updateQueryData:g,upsertQueryData:S,patchQueryData:h,buildMatchThunkActions:B}}function Dy(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function rw(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function nw(e,t,r,n){return jy(r[e.meta.arg.endpointName][t],In(e)?e.payload:void 0,vc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Mx(e){return Gt(e)?ol(e):e}function bd(e,t,r){let n=e[t];n&&r(n)}function Vc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Vx(e,t,r){let n=e[Vc(t)];n&&r(n)}var xd={};function tq({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:p},assertTagType:f,config:m}){let h=T(`${e}/resetApiState`);function C(j,B,L,N){var D;j[D=B.queryCacheKey]??(j[D]={status:Pn,endpointName:B.endpointName}),bd(j,B.queryCacheKey,M=>{M.status=ky,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];Fd(W)&&"direction"in B&&(M.direction=B.direction)})}function b(j,B,L,N){bd(j,B.arg.queryCacheKey,D=>{if(D.requestId!==B.requestId&&!N)return;let{merge:M}=o[B.arg.endpointName];if(D.status=Dc,M){if(D.data!==void 0){let{fulfilledTimeStamp:W,arg:H,baseQueryMeta:re,requestId:J}=B,K=Vo(D.data,se=>M(se,L,{arg:H.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:J}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?$x(Gt(D.data)?jA(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let g=Uo({name:`${e}/queries`,initialState:xd,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:B}}){delete j[B]},prepare:Zi()},cacheEntriesUpserted:{reducer(j,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;C(j,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),b(j,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:j=>({payload:j.map(N=>{let{endpointName:D,arg:M,value:W}=N,H=o[D];return{queryDescription:{type:jc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:H,endpointName:D})},value:W}}),meta:{[yc]:!0,requestId:Ac(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:B,patches:L}}){bd(j,B,N=>{N.data=lh(N.data,L.concat())})},prepare:Zi()}},extraReducers(j){j.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=Ny(N);C(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=Ny(L.arg);b(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{bd(B,N.queryCacheKey,H=>{if(!L){if(H.requestId!==D)return;H.status=qc,H.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=a(L);for(let[D,M]of Object.entries(N))(M?.status===Dc||M?.status===qc)&&(B[D]=M)})}}),S=Uo({name:`${e}/mutations`,initialState:xd,reducers:{removeMutationResult:{reducer(j,{payload:B}){let L=Vc(B);L in j&&delete j[L]},prepare:Zi()}},extraReducers(j){j.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[Vc(L)]={requestId:N,status:ky,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&Vx(B,N,D=>{D.requestId===N.requestId&&(D.status=Dc,D.data=L,D.fulfilledTimeStamp=N.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:N,meta:D})=>{D.arg.track&&Vx(B,D,M=>{M.requestId===D.requestId&&(M.status=qc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=a(L);for(let[D,M]of Object.entries(N))(M?.status===Dc||M?.status===qc)&&D!==M?.requestId&&(B[D]=M)})}}),x={tags:{},keys:{}},w=Uo({name:`${e}/invalidation`,initialState:x,reducers:{updateProvidedBy:{reducer(j,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){R(j,M);for(let{type:H,id:re}of W){let J=(N=(L=j.tags)[H]??(L[H]={}))[D=re||"__internal_without_id"]??(N[D]=[]);J.includes(M)||J.push(M)}j.keys[M]=W}},prepare:Zi()}},extraReducers(j){j.addCase(g.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{R(B,L)}).addMatcher(p,(B,L)=>{var D,M,W;let{provided:N}=a(L);for(let[H,re]of Object.entries(N.tags??{}))for(let[J,K]of Object.entries(re)){let se=(M=(D=B.tags)[H]??(D[H]={}))[W=J||"__internal_without_id"]??(M[W]=[]);for(let ye of K)se.includes(ye)||se.push(ye),B.keys[ye]=N.keys[ye]}}).addMatcher(Lr(In(t),vc(t)),(B,L)=>{P(B,[L])}).addMatcher(g.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}}));P(B,N)})}});function R(j,B){let L=Mx(j.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=j.tags[D]?.[M];W&&(j.tags[D][M]=Mx(W).filter(H=>H!==B))}delete j.keys[B]}function P(j,B){let L=B.map(N=>{let D=nw(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(j,w.actions.updateProvidedBy(L))}let E=Uo({name:`${e}/subscriptions`,initialState:xd,reducers:{updateSubscriptionOptions(j,B){},unsubscribeQueryResult(j,B){},internal_getRTKQSubscriptions(){}}}),_=Uo({name:`${e}/internalSubscriptions`,initialState:xd,reducers:{subscriptionsUpdated:{reducer(j,B){return lh(j,B.payload)},prepare:Zi()}}}),F=Uo({name:`${e}/config`,initialState:{online:MD(),focused:qD(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(j,{payload:B}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||i!==B?"conflict":!0}},extraReducers:j=>{j.addCase(Vy,B=>{B.online=!0}).addCase(Xx,B=>{B.online=!1}).addCase(My,B=>{B.focused=!0}).addCase(Kx,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Yi({queries:g.reducer,mutations:S.reducer,provided:w.reducer,subscriptions:_.reducer,config:F.reducer}),G=(j,B)=>q(h.match(B)?void 0:j,B),Q={...F.actions,...g.actions,...E.actions,..._.actions,...S.actions,...w.actions,resetApiState:h};return{reducer:G,actions:Q}}var Ko=Symbol.for("RTKQ/skipToken"),ow={status:Pn},jx=Vo(ow,()=>{}),Lx=Vo(ow,()=>{});function rq({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>jx,o=E=>Lx;return{buildQuerySelector:b,buildInfiniteQuerySelector:g,buildMutationSelector:S,selectInvalidatedBy:x,selectCachedArgsForQuery:w,selectApiState:a,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:h};function i(E){return{...E,...Px(E.status)}}function a(E){return E[t]}function p(E){return a(E)?.queries}function f(E,_){return p(E)?.[_]}function m(E){return a(E)?.mutations}function h(E){return a(E)?.config}function C(E,_,F){return q=>{if(q===Ko)return r(n,F);let G=e({queryArgs:q,endpointDefinition:_,endpointName:E});return r(j=>f(j,G)??jx,F)}}function b(E,_){return C(E,_,i)}function g(E,_){let{infiniteQueryOptions:F}=_;function q(G){let Q={...G,...Px(G.status)},{isLoading:j,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:R(F,Q.data,Q.originalArgs),hasPreviousPage:P(F,Q.data,Q.originalArgs),isFetchingNextPage:j&&N,isFetchingPreviousPage:j&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return C(E,_,q)}function S(){return E=>{let _;return typeof E=="object"?_=Vc(E)??Ko:_=E,r(_===Ko?o:G=>a(G)?.mutations?.[_]??Lx,i)}}function x(E,_){let F=E[t],q=new Set,G=Oy(_,qy,ew);for(let Q of G){let j=F.provided.tags[Q.type];if(!j)continue;let B=(Q.id!==void 0?j[Q.id]:Object.values(j).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let j=F.queries[Q];return j?{queryCacheKey:Q,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function w(E,_){return Oy(Object.values(p(E)),F=>F?.endpointName===_&&F.status!==Pn,F=>F.originalArgs)}function R(E,_,F){return _?Dy(E,_,F)!=null:!1}function P(E,_,F){return!_||!E.getPreviousPageParam?!1:rw(E,_,F)!=null}}var Ux=WeakMap?new WeakMap:void 0,Qx=({endpointName:e,queryArgs:t})=>{let r="",n=Ux?.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=jr(a)?Object.keys(a).sort().reduce((p,f)=>(p[f]=a[f],p),{}):a,a));jr(t)&&Ux?.set(t,o),r=o}return`${e}(${r})`};function nq(...e){return function(r){let n=gc(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 h=Qx;if("serializeQueryArgs"in m.endpointDefinition){let C=m.endpointDefinition.serializeQueryArgs;h=b=>{let g=C(b);return typeof g=="string"?g:Qx({...b,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(m)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(m){m()},apiUid:Ac(),extractRehydrationInfo:n,hasRehydrationInfo:gc(m=>n(m)!=null)},a={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:h}){if(m)for(let C of m)o.tagTypes.includes(C)||o.tagTypes.push(C);if(h)for(let[C,b]of Object.entries(h))typeof b=="function"?b(Ta(i,C)):Object.assign(Ta(i,C)||{},b);return a}},p=e.map(m=>m.init(a,o,i));function f(m){let h=m.endpoints({query:C=>({...C,type:jc}),mutation:C=>({...C,type:Jx}),infiniteQuery:C=>({...C,type:Zx})});for(let[C,b]of Object.entries(h)){if(m.overrideExisting!==!0&&C in i.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Ht(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[C]=b;for(let g of p)g.injectEndpoint(C,b)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function Tn(e,...t){return Object.assign(e,...t)}var oq=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(x,w)=>{if(p.match(w)){let{queryCacheKey:P,requestId:E,options:_}=w.payload,F=x.get(P);return F?.has(E)&&F.set(E,_),!0}if(f.match(w)){let{queryCacheKey:P,requestId:E}=w.payload,_=x.get(P);return _&&_.delete(E),!0}if(e.internalActions.removeQueryResult.match(w))return x.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:P,requestId:E}}=w,_=wd(x,P.queryCacheKey,_y);return P.subscribe&&_.set(E,P.subscriptionOptions??_.get(E)??{}),!0}let R=!1;if(t.rejected.match(w)){let{meta:{condition:P,arg:E,requestId:_}}=w;if(P&&E.subscribe){let F=wd(x,E.queryCacheKey,_y);F.set(_,E.subscriptionOptions??F.get(_)??{}),R=!0}}return R},h=()=>r.currentSubscriptions,g={getSubscriptions:h,getSubscriptionCount:x=>h().get(x)?.size??0,isRequestSubscribed:(x,w)=>!!h()?.get(x)?.get(w)};function S(x){return JSON.parse(JSON.stringify(Object.fromEntries([...x].map(([w,R])=>[w,Object.fromEntries(R)]))))}return(x,w)=>{if(i||(i=S(r.currentSubscriptions)),e.util.resetApiState.match(x))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(x))return[!1,g];let R=m(r.currentSubscriptions,x),P=!0;if(R){a||(a=setTimeout(()=>{let F=S(r.currentSubscriptions),[,q]=uh(i,()=>F);w.next(e.internalActions.subscriptionsUpdated(q)),i=F,a=null},500));let E=typeof x.type=="string"&&!!x.type.startsWith(o),_=t.rejected.match(x)&&x.meta.condition&&!!x.meta.arg.subscribe;P=!E&&!_}return[P,!1]}},iq=2147483647/1e3-1,aq=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:p,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:h,cacheEntriesUpserted:C}=t.internalActions,b=Lr(h.match,r.fulfilled,r.rejected,C.match);function g(E){let _=o.currentSubscriptions.get(E);return _?_.size>0:!1}let S={};function x(E){for(let _ of E.values())_?.abort?.()}let w=(E,_)=>{let F=_.getState(),q=a(F);if(b(E)){let G;if(C.match(E))G=E.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=h.match(E)?E.payload:E.meta.arg;G=[Q]}R(G,_,q)}if(t.util.resetApiState.match(E)){for(let[G,Q]of Object.entries(S))Q&&clearTimeout(Q),delete S[G];x(o.runningQueries),x(o.runningMutations)}if(n.hasRehydrationInfo(E)){let{queries:G}=n.extractRehydrationInfo(E);R(Object.keys(G),_,q)}};function R(E,_,F){let q=_.getState();for(let G of E){let Q=i(q,G);Q?.endpointName&&P(G,Q.endpointName,_,F)}}function P(E,_,F,q){let Q=Ta(n,_)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let j=Math.max(0,Math.min(Q,iq));if(!g(E)){let B=S[E];B&&clearTimeout(B),S[E]=setTimeout(()=>{if(!g(E)){let L=i(F.getState(),E);L?.endpointName&&F.dispatch(p(L.endpointName,L.originalArgs))?.abort(),F.dispatch(m({queryCacheKey:E}))}delete S[E]},j*1e3)}}return w},Bx=new Error("Promise never resolved before cacheEntryRemoved."),sq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:p}})=>{let f=pl(n),m=pl(o),h=In(n,o),C={},{removeQueryResult:b,removeMutationResult:g,cacheEntriesUpserted:S}=e.internalActions;function x(F,q,G){let Q=C[F];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(F){let q=C[F];q&&(delete C[F],q.cacheEntryRemoved())}function R(F){let{arg:q,requestId:G}=F.meta,{endpointName:Q,originalArgs:j}=q;return[Q,j,G]}let P=(F,q,G)=>{let Q=E(F);function j(B,L,N,D){let M=a(G,L),W=a(q.getState(),L);!M&&W&&_(B,D,L,q,N)}if(n.pending.match(F)){let[B,L,N]=R(F);j(B,Q,N,L)}else if(S.match(F))for(let{queryDescription:B,value:L}of F.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;j(N,M,F.meta.requestId,D),x(M,L,{})}else if(o.pending.match(F)){if(q.getState()[t].mutations[Q]){let[L,N,D]=R(F);_(L,N,Q,q,D)}}else if(h(F))x(Q,F.payload,F.meta.baseQueryMeta);else if(b.match(F)||g.match(F))w(Q);else if(e.util.resetApiState.match(F))for(let B of Object.keys(C))w(B)};function E(F){return f(F)?F.meta.arg.queryCacheKey:m(F)?F.meta.arg.fixedCacheKey??F.meta.requestId:b.match(F)?F.payload.queryCacheKey:g.match(F)?Vc(F.payload):""}function _(F,q,G,Q,j){let B=Ta(r,F),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 Bx})]);M.catch(()=>{}),C[G]=N;let W=e.endpoints[F].select(Rd(B)?q:G),H=Q.dispatch((K,se,ye)=>ye),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:j,extra:H,updateCachedData:Rd(B)?K=>Q.dispatch(e.util.updateQueryData(F,q,K)):void 0,cacheDataLoaded:M,cacheEntryRemoved:D},J=L(q,re);Promise.resolve(J).catch(K=>{if(K!==Bx)throw K})}return P},cq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},uq=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:p,internalState:f})=>{let{removeQueryResult:m}=i.internalActions,h=Lr(In(n),vc(n)),C=Lr(In(o,n),Lo(o,n)),b=[],g=0,S=(R,P)=>{(o.pending.match(R)||n.pending.match(R))&&g++,C(R)&&(g=Math.max(0,g-1)),h(R)?w(nw(R,"invalidatesTags",r,a),P):C(R)?w([],P):i.util.invalidateTags.match(R)&&w(jy(R.payload,void 0,void 0,void 0,void 0,a),P)};function x(){return g>0}function w(R,P){let E=P.getState(),_=E[e];if(b.push(...R),_.config.invalidationBehavior==="delayed"&&x())return;let F=b;if(b=[],F.length===0)return;let q=i.util.selectInvalidatedBy(E,F);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let j=_.queries[Q],B=wd(f.currentSubscriptions,Q,_y);j&&(B.size===0?P.dispatch(m({queryCacheKey:Q})):j.status!==Pn&&P.dispatch(p(j)))}})}return S},lq=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,p=new Set,f=null,m=(w,R)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&h(w.payload.queryCacheKey,R),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&h(w.meta.arg.queryCacheKey,R),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&C(w.meta.arg,R),r.util.resetApiState.match(w)&&(S(),f&&(clearTimeout(f),f=null),p.clear())};function h(w,R){p.add(w),f||(f=setTimeout(()=>{for(let P of p)b({queryCacheKey:P},R);p.clear(),f=null},0))}function C({queryCacheKey:w},R){let P=R.getState()[e],E=P.queries[w],_=a.get(w);if(!E||E.status===Pn)return;let{lowestPollingInterval:F,skipPollingIfUnfocused:q}=x(_);if(!Number.isFinite(F))return;let G=i.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+F;i.set(w,{nextPollTimestamp:Q,pollingInterval:F,timeout:setTimeout(()=>{(P.config.focused||!q)&&R.dispatch(n(E)),C({queryCacheKey:w},R)},F)})}function b({queryCacheKey:w},R){let E=R.getState()[e].queries[w],_=a.get(w);if(!E||E.status===Pn)return;let{lowestPollingInterval:F}=x(_);if(!Number.isFinite(F)){g(w);return}let q=i.get(w),G=Date.now()+F;(!q||G<q.nextPollTimestamp)&&C({queryCacheKey:w},R)}function g(w){let R=i.get(w);R?.timeout&&clearTimeout(R.timeout),i.delete(w)}function S(){for(let w of i.keys())g(w)}function x(w=new Map){let R=!1,P=Number.POSITIVE_INFINITY;for(let E of w.values())E.pollingInterval&&(P=Math.min(E.pollingInterval,P),R=E.skipPollingIfUnfocused||R);return{lowestPollingInterval:P,skipPollingIfUnfocused:R}}return m},dq=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=dl(r,n),i=Lo(r,n),a=In(r,n),p={};return(m,h)=>{if(o(m)){let{requestId:C,arg:{endpointName:b,originalArgs:g}}=m.meta,S=Ta(t,b),x=S?.onQueryStarted;if(x){let w={},R=new Promise((F,q)=>{w.resolve=F,w.reject=q});R.catch(()=>{}),p[C]=w;let P=e.endpoints[b].select(Rd(S)?g:C),E=h.dispatch((F,q,G)=>G),_={...h,getCacheEntry:()=>P(h.getState()),requestId:C,extra:E,updateCachedData:Rd(S)?F=>h.dispatch(e.util.updateQueryData(b,g,F)):void 0,queryFulfilled:R};x(g,_)}}else if(a(m)){let{requestId:C,baseQueryMeta:b}=m.meta;p[C]?.resolve({data:m.payload,meta:b}),delete p[C]}else if(i(m)){let{requestId:C,rejectedWithValue:b,baseQueryMeta:g}=m.meta;p[C]?.reject({error:m.payload??m.error,isUnhandledError:!b,meta:g}),delete p[C]}}},pq=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(f,m)=>{My.match(f)&&p(m,"refetchOnFocus"),Vy.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let h=f.getState()[e],C=h.queries,b=o.currentSubscriptions;t.batch(()=>{for(let g of b.keys()){let S=C[g],x=b.get(g);if(!x||!S)continue;let w=[...x.values()];(w.some(P=>P[m]===!0)||w.every(P=>P[m]===void 0)&&h.config[m])&&(x.size===0?f.dispatch(i({queryCacheKey:g})):S.status!==Pn&&f.dispatch(n(S)))}})}return a};function fq(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,p={invalidateTags:T(`${t}/invalidateTags`)},f=b=>b.type.startsWith(`${t}/`),m=[cq,aq,uq,lq,sq,dq];return{middleware:b=>{let g=!1,S=i(b.dispatch),x={...e,internalState:S,refetchQuery:C,isThisApiSliceAction:f,mwApi:b},w=m.map(E=>E(x)),R=oq(x),P=pq(x);return E=>_=>{if(!rc(_))return E(_);g||(g=!0,b.dispatch(n.internalActions.middlewareRegistered(a)));let F={...b,next:E},q=b.getState(),[G,Q]=R(_,F,q),j;if(G?j=E(_):j=Q,b.getState()[t]&&(P(_,F,q),f(_)||o.hasRehydrationInfo(_)))for(let B of w)B(_,F,q);return j}},actions:p};function C(b){return e.api.endpoints[b.endpointName].initiate(b.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Gx=Symbol(),mq=({createSelector:e=it}={})=>({name:Gx,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:h,onSchemaFailure:C,catchSchemaFailure:b,skipSchemaValidation:g},S){HA();let x=Re=>(typeof process<"u",Re);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Vy,onOffline:Xx,onFocus:My,onFocusLost:Kx},util:{}});let w=rq({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:P,buildQuerySelector:E,buildInfiniteQuerySelector:_,buildMutationSelector:F}=w;Tn(t.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:P});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=eq({baseQuery:r,reducerPath:o,context:S,api:t,serializeQueryArgs:i,assertTagType:x,selectors:w,onSchemaFailure:C,catchSchemaFailure:b,skipSchemaValidation:g}),{reducer:M,actions:W}=tq({context:S,queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:i,reducerPath:o,assertTagType:x,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});Tn(t.util,{patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),Tn(t.internalActions,W);let H=new WeakMap,re=Re=>wd(H,Re,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:J,buildInitiateInfiniteQuery:K,buildInitiateMutation:se,getRunningMutationThunk:ye,getRunningMutationsThunk:qe,getRunningQueriesThunk:ot,getRunningQueryThunk:Be}=ZD({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:i,context:S,getInternalState:re});Tn(t.util,{getRunningMutationThunk:ye,getRunningMutationsThunk:qe,getRunningQueryThunk:Be,getRunningQueriesThunk:ot});let{middleware:et,actions:tt}=fq({reducerPath:o,context:S,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:x,selectors:w,getRunningQueryThunk:Be,getInternalState:re});return Tn(t.util,tt),Tn(t,{reducer:M,middleware:et}),{name:Gx,injectEndpoint(Re,xe){var gt;let Ie=(gt=t.endpoints)[Re]??(gt[Re]={});Ed(xe)&&Tn(Ie,{name:Re,select:E(Re,xe),initiate:J(Re,xe)},D(q,Re)),KD(xe)&&Tn(Ie,{name:Re,select:F(),initiate:se(Re)},D(Q,Re)),Fd(xe)&&Tn(Ie,{name:Re,select:_(Re,xe),initiate:K(Re,xe)},D(q,Re))}}}}),iw=nq(mq());d();c();l();u();d();c();l();u();var Xo=e=>e.query,aw=e=>e.query?.enableQuerySyntax;var sw=it(e=>Xo(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})),Td=it(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Lc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var Pa=(e,t,r,n)=>He({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(o,i)=>{let a=t??je(i),p=e?r??(!i.generatedAnswer?.answer||!i.generatedAnswer?.answer.length):void 0;return a?o.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:p,...(n&&{conversationId:n})}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:o=>({answerId:t??je(o)??"",answerGenerated:e??!1})}),ka=e=>He({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});var cw=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var uw=it(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 lw=e=>e.context;d();c();l();u();var Ly=e=>e.pipeline;d();c();l();u();var Uy=e=>e.searchHub;d();c();l();u();var Wt=it(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Voe=it(e=>e,e=>{let t=Wt(e);return t&&e?e[t].expression:""});d();c();l();u();var dw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var pw=e=>e.excerptLength?.length;d();c();l();u();var Xr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,fw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var mw=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 gw=e=>e.sortCriteria;var hw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ye(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function hw(_x183){return _ref64.apply(this,arguments)}}(),yw=(e,t)=>{let r=Xo(e)?.q,{aq:n,cq:o,dq:i,lq:a}=hq(e),p=lw(e),f=zo(e.configuration.analytics,t,{actionCause:Ey(e)}),m=Uy(e),h=Ly(e),C=Kh(e)??[],b=vw(e),g=Wt(e.tabSet)||"default",S=Wh(e),x=hb(e),w=t.referrer||"",R=fw(e),P=gw(e),E=gq(e),_=pw(e),F=mw(e),q=dw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:aw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:C}},...(m?.length&&{searchHub:m}),...(h?.length&&{pipeline:h}),...(b.length&&{facets:b}),...(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:by(e),firstResult:e.pagination.firstResult}),tab:g,locale:S,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(F??{}),...(_&&{excerptLength:_}),...(q&&{dictionaryFieldContext:q}),sortCriteria:P,...(R&&{facetOptions:R}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Sw=(e,t)=>{let r=Xo(e)?.q,n=vw(e),o=zo(e.configuration.analytics,t,{actionCause:Ey(e)}),i=Wh(e),a=Uy(e),p=Ly(e),f=Kh(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:f,...(a?.length&&{searchHub:a}),...(p?.length&&{pipeline:p}),...o,locale:i}},vw=e=>gd(e)?.map(t=>ay(t,iy())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),gq=e=>({actionsHistory:e.configuration.analytics.enabled?Vt.getInstance().getHistory():[]}),hq=e=>{let t=uw(e),r=xy(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Pd=["searching","thinking","answering"];function kd(e){return e.toLowerCase()}function Qy(){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 Aw=["text/plain","text/markdown"];var Oa=new $({required:!0}),Cw=new $,_a=new de({required:!0}),By={id:Oa,title:Oa,uri:Oa,permanentid:Oa,clickUri:Cw},Od=new $({required:!0,constrainTo:Aw}),bw=new $({required:!0,constrainTo:Pd}),xw=e=>({...e,name:kd(e.name)}),Na=T("generatedAnswer/setIsVisible",e=>O(e,_a)),Da=T("generatedAnswer/setAnswerId",e=>O(e,z)),_d=T("generatedAnswer/setAnswerGenerationMode",e=>O(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Uc=T("generatedAnswer/setIsEnabled",e=>O(e,_a)),Zo=T("generatedAnswer/updateMessage",e=>O(e,{textDelta:Oa})),ei=T("generatedAnswer/updateCitations",e=>O(e,{citations:new ne({required:!0,each:new Y({values:By})})})),ti=T("generatedAnswer/updateError",e=>O(e,{message:Cw,code:new oe({min:0})})),lr=T("generatedAnswer/resetAnswer"),Nd=T("generatedAnswer/like"),Dd=T("generatedAnswer/dislike"),qd=T("generatedAnswer/feedbackModal/open"),Qc=T("generatedAnswer/expand"),Md=T("generatedAnswer/collapse"),Vd=T("generatedAnswer/setId",e=>O(e,{id:new $({required:!0})})),jd=T("generatedAnswer/feedbackModal/close"),qa=T("generatedAnswer/sendFeedback"),Jr=T("generatedAnswer/setIsLoading",e=>O(e,_a)),Jo=T("generatedAnswer/setIsStreaming",e=>O(e,_a)),ri=T("generatedAnswer/setAnswerContentFormat",e=>O(e,Od)),Ld=T("generatedAnswer/updateResponseFormat",e=>O(e,{contentFormat:new ne({each:Od,default:["text/plain"]})})),Ud=T("knowledge/updateAnswerConfigurationId",e=>O(e,Oa)),Qd=T("generatedAnswer/registerFieldsToIncludeInCitations",e=>O(e,Gu)),Bc=T("generatedAnswer/setIsAnswerGenerated",e=>O(e,_a)),ni=T("generatedAnswer/setCannotAnswer",e=>O(e,_a)),Gy=T("generatedAnswer/setAnswerApiQueryParams",e=>O(e,new Y({}))),Bd=T("generatedAnswer/startStep",e=>O(xw(e),{name:bw,startedAt:new oe({min:0,required:!0})})),Gd=T("generatedAnswer/finishStep",e=>O(xw(e),{name:bw,finishedAt:new oe({min:0,required:!0})})),ww=pe("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:a}=i(),{queryExecuted:p}=a,{setAbortControllerRef:f}=e,m=yield hw(r),h=(g,S)=>{switch(g){case"genqa.headerMessageType":{let x=JSON.parse(S);n(ri(x.contentFormat));break}case"genqa.messageType":n(Zo(JSON.parse(S)));break;case"genqa.citationsType":n(ei(JSON.parse(S)));break;case"genqa.endOfStreamType":{let x=JSON.parse(S).answerGenerated,w=i().generatedAnswer.answerId,R=p.length!==0&&!x,P=x?!i().generatedAnswer.answer?.length:void 0;n(ni(R)),n(Jo(!1)),n(Bc(x)),n(Pa(x,w,P)),n(ka());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${g}"`)}};n(Jr(!0));let C=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,b=o.streamingClient?.streamGeneratedAnswer(m,{write:g=>{C(m)&&(n(Jr(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{C(m)&&n(ti(g))},close:()=>{C(m)&&n(Jo(!1))},resetAnswer:()=>{C(m)&&n(lr())}});b?f(b):n(Jr(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),$d=pe("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.answerConfigurationId){let a=yw(i,n);r(Gy(a)),yield r(Hd(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 yq=/*#__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=Ye(a,i);return{data:Hx({baseUrl:`${m}/rest/organizations/${a}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(C){if(C instanceof String)throw new Error("The provided 'request' must be a Request object.");let b=C.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(S=>{g[S]=C[S]}),g.duplex="half",g.body=yield C.text(),v(b,g)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}}catch(m){return{error:m}}});return function yq(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),zd=iw({reducerPath:"answer",baseQuery:Wx(yq,{maxRetries:3}),endpoints:()=>({})});var Sq=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},vq=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},Aq=(e,t)=>{e.citations=t.citations},Cq=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},bq=(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})`)},xq=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&bq(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(Sq(t,o),r(ri(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(vq(t,o),r(Zo({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(Aq(t,o),r(ei({citations:o.citations})));break;case"genqa.endOfStreamType":{Cq(t,o);let i=t.answerId,a=o.answerGenerated??!1,p=a?!t.answer?.length:void 0;r(Pa(a,i,p)),r(ka());break}}},wq=(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`},oi=zd.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}){yield n;let{configuration:a,generatedAnswer:p,insightConfiguration:f}=r(),{organizationId:m,environment:h,accessToken:C}=a,b=Ye(m,h),g=wq(b,m,p.answerConfigurationId,f?.insightId);yield Lu(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${C}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(S){let x=S.headers.get("x-answer-id");x&&o(w=>{w.answerId=x,i(Da(x))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:S=>{o(x=>{xq(S,x,i)})},onerror:S=>{throw S},onclose:()=>{o(S=>{i(ni(!S.generated))})}})}).apply(this,arguments)}})})}),Hd=e=>oi.endpoints.getAnswer.initiate(e),$y=e=>{let t=Td(e);return oi.endpoints.getAnswer.select(t??Ko)(e)};d();c();l();u();var Rw=le(Gn,e=>e);d();c();l();u();function Rq(e){let t=e.payload?.analyticsAction;return Iw(e)&&!ee(t)}function Iw(e){return"type"in e}var Ew=e=>t=>r=>{let n;Rq(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Iw(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 Wd={q:new $,enableQuerySyntax:new de,aq:new $,cq:new $,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new de,sf:new Y,tab:new $,af:new Y};var at=T("searchParameters/restore",e=>O(e,Wd)),Yd=T("searchParameters/restoreTab",e=>O(e,z));d();c();l();u();var Kd=T("tab/register",e=>{let t=new Y({values:{id:z,expression:Ke}});return O(e,t)}),_t=T("tab/updateActiveTab",e=>O(e,z));d();c();l();u();var Xd=Er(qu(),1),Pw=Er(Fw(),1),kw=Er(Tw(),1);Xd.default.extend(kw.default);Xd.default.extend(Pw.default);var Jd=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Xd.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 Iq=/(^|; )Coveo-Pendragon=([^;]*)/,Eq=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Ow(){return typeof window>"u"?!1:Iq.exec(document.cookie)?.pop()||null}function _w(){return typeof window>"u"?!1:Eq.test(document.cookie)}var Zd=le(Jd(),e=>e.addCase(ha,(t,r)=>{Fq(t,r.payload)}).addCase(ya,(t,r)=>{Tq(t,r.payload)}).addCase(Ul,(t,r)=>{Pq(t,r.payload)}).addCase(Ql,t=>{t.analytics.enabled=!1}).addCase(Bl,t=>{t.analytics.enabled=!0}).addCase(Lb,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Ub,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(_t,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Yd,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(at,(t,r)=>{ee(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Qb,(t,{payload:r})=>{kq(t,r)}));function Fq(e,t){ee(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ee(t.organizationId)||(e.organizationId=t.organizationId)}function Tq(e,t){ee(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ee(t.locale)||(e.search.locale=t.locale),ee(t.timezone)||(e.search.timezone=t.timezone),ee(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function Pq(e,t){ee(t.enabled)||(e.analytics.enabled=t.enabled),ee(t.originContext)||(e.analytics.originContext=t.originContext),ee(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ee(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ee(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ee(t.trackingId)||(e.analytics.trackingId=t.trackingId),ee(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ee(t.source)||(e.analytics.source=t.source);try{let r=Ow();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ee(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ee(t.anonymous)||(e.analytics.anonymous=t.anonymous),ee(t.deviceId)||(e.analytics.deviceId=t.deviceId),ee(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ee(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function kq(e,t){e.knowledge.agentId=t;try{let r=_w();ee(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var Ce=Zd;d();c();l();u();function Oq(e){return e.instantlyCallable}var Nw=()=>e=>t=>e(Oq(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 Dw(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 Ky,_q=new Uint8Array(16);function Xy(){if(!Ky){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ky=crypto.getRandomValues.bind(crypto)}return Ky(_q)}d();c();l();u();d();c();l();u();var Nq=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jy={randomUUID:Nq};function Dq(e,t,r){if(Jy.randomUUID&&!t&&!e)return Jy.randomUUID();e=e||{};let n=e.random??e.rng?.()??Xy();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 Dw(n)}var ao=Dq;d();c();l();u();d();c();l();u();var I={};Qs(I,{BRAND:()=>sM,DIRTY:()=>ii,EMPTY_PATH:()=>jq,INVALID:()=>ve,NEVER:()=>$M,OK:()=>jt,ParseStatus:()=>Dt,Schema:()=>ke,ZodAny:()=>uo,ZodArray:()=>Nn,ZodBigInt:()=>si,ZodBoolean:()=>ci,ZodBranded:()=>$c,ZodCatch:()=>vi,ZodDate:()=>ui,ZodDefault:()=>Si,ZodDiscriminatedUnion:()=>rp,ZodEffects:()=>Cr,ZodEnum:()=>hi,ZodError:()=>er,ZodFirstPartyTypeKind:()=>be,ZodFunction:()=>op,ZodIntersection:()=>fi,ZodIssueCode:()=>X,ZodLazy:()=>mi,ZodLiteral:()=>gi,ZodMap:()=>Qa,ZodNaN:()=>Ga,ZodNativeEnum:()=>yi,ZodNever:()=>kr,ZodNull:()=>di,ZodNullable:()=>tn,ZodNumber:()=>ai,ZodObject:()=>tr,ZodOptional:()=>vr,ZodParsedType:()=>ce,ZodPipeline:()=>Hc,ZodPromise:()=>lo,ZodReadonly:()=>Ai,ZodRecord:()=>np,ZodSchema:()=>ke,ZodSet:()=>Ba,ZodString:()=>co,ZodSymbol:()=>La,ZodTransformer:()=>Cr,ZodTuple:()=>en,ZodType:()=>ke,ZodUndefined:()=>li,ZodUnion:()=>pi,ZodUnknown:()=>_n,ZodVoid:()=>Ua,addIssueToContext:()=>ae,any:()=>hM,array:()=>AM,bigint:()=>dM,boolean:()=>Hw,coerce:()=>GM,custom:()=>Bw,date:()=>pM,datetimeRegex:()=>Uw,defaultErrorMap:()=>kn,discriminatedUnion:()=>wM,effect:()=>qM,enum:()=>_M,function:()=>PM,getErrorMap:()=>Ma,getParsedType:()=>Zr,instanceof:()=>uM,intersection:()=>RM,isAborted:()=>ep,isAsync:()=>Va,isDirty:()=>tp,isValid:()=>so,late:()=>cM,lazy:()=>kM,literal:()=>OM,makeIssue:()=>Gc,map:()=>FM,nan:()=>lM,nativeEnum:()=>NM,never:()=>SM,null:()=>gM,nullable:()=>VM,number:()=>$w,object:()=>CM,objectUtil:()=>Zy,oboolean:()=>BM,onumber:()=>QM,optional:()=>MM,ostring:()=>UM,pipeline:()=>LM,preprocess:()=>jM,promise:()=>DM,quotelessJson:()=>qq,record:()=>EM,set:()=>TM,setErrorMap:()=>Vq,strictObject:()=>bM,string:()=>Gw,symbol:()=>fM,transformer:()=>qM,tuple:()=>IM,undefined:()=>mM,union:()=>xM,unknown:()=>yM,util:()=>Ne,void:()=>vM});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ne;(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})(Ne||(Ne={}));var Zy;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zy||(Zy={}));var ce=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zr=e=>{switch(typeof e){case"undefined":return ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(e)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(e)?ce.array:e===null?ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ce.promise:typeof Map<"u"&&e instanceof Map?ce.map:typeof Set<"u"&&e instanceof Set?ce.set:typeof Date<"u"&&e instanceof Date?ce.date:ce.object;default:return ce.unknown}};var X=Ne.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"]),qq=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,Ne.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 Mq=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ce.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.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}"`:Ne.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,Ne.assertNever(e)}return{message:r}},kn=Mq;var qw=kn;function Vq(e){qw=e}function Ma(){return qw}d();c();l();u();var Gc=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}},jq=[];function ae(e,t){let r=Ma(),n=Gc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===kn?void 0:kn].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 ve;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 ve;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}}},ve=Object.freeze({status:"aborted"}),ii=e=>({status:"dirty",value:e}),jt=e=>({status:"valid",value:e}),ep=e=>e.status==="aborted",tp=e=>e.status==="dirty",so=e=>e.status==="valid",Va=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(fe||(fe={}));var Ar=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}},Mw=(e,t)=>{if(so(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 Ee(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 ke=class{get description(){return this._def.description}_getType(t){return Zr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zr(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:Zr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Va(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:Zr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Mw(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return so(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=>so(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:Zr(t)},o=_this32._parse({data:t,path:n.path,parent:n}),i=yield Va(o)?o:Promise.resolve(o);return Mw(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 Cr({schema:this,typeName:be.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 vr.create(this,this._def)}nullable(){return tn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nn.create(this)}promise(){return lo.create(this,this._def)}or(t){return pi.create([this,t],this._def)}and(t){return fi.create(this,t,this._def)}transform(t){return new Cr({...Ee(this._def),schema:this,typeName:be.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Si({...Ee(this._def),innerType:this,defaultValue:r,typeName:be.ZodDefault})}brand(){return new $c({typeName:be.ZodBranded,type:this,...Ee(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new vi({...Ee(this._def),innerType:this,catchValue:r,typeName:be.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Hc.create(this,t)}readonly(){return Ai.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lq=/^c[^\s-]{8,}$/i,Uq=/^[0-9a-z]+$/,Qq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bq=/^[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,Gq=/^[a-z0-9_-]{21}$/i,$q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hq=/^[-+]?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)?)??$/,zq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",eS,Yq=/^(?:(?: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])$/,Kq=/^(?:(?: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])$/,Xq=/^(([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]))$/,Jq=/^(([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])$/,Zq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jw="((\\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])))",tM=new RegExp(`^${jw}$`);function Lw(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 rM(e){return new RegExp(`^${Lw(e)}$`)}function Uw(e){let t=`${jw}T${Lw(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 nM(e,t){return!!((t==="v4"||!t)&&Yq.test(e)||(t==="v6"||!t)&&Xq.test(e))}function oM(e,t){if(!$q.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 iM(e,t){return!!((t==="v4"||!t)&&Kq.test(e)||(t==="v6"||!t)&&Jq.test(e))}var co=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ce.string){let i=this._getOrReturnCtx(t);return ae(i,{code:X.invalid_type,expected:ce.string,received:i.parsedType}),ve}let n=new Dt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ae(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),ae(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?ae(o,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):p&&ae(o,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")zq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"email",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")eS||(eS=new RegExp(Wq,"u")),eS.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"emoji",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Bq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"uuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Gq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"nanoid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Lq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Uq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid2",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Qq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(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),ae(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),ae(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),ae(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),ae(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),ae(o,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Uw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:X.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?tM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:X.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?rM(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:X.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Hq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"duration",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?nM(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ip",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?oM(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"jwt",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?iM(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cidr",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Zq.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?eM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64url",code:X.invalid_string,message:i.message}),n.dirty()):Ne.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,...fe.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...fe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...fe.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,...fe.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,...fe.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...fe.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...fe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...fe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...fe.errToObj(r)})}nonempty(t){return this.min(1,fe.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}};co.create=e=>new co({checks:[],typeName:be.ZodString,coerce:e?.coerce??!1,...Ee(e)});function aM(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 ai=class e extends ke{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)!==ce.number){let i=this._getOrReturnCtx(t);return ae(i,{code:X.invalid_type,expected:ce.number,received:i.parsedType}),ve}let n,o=new Dt;for(let i of this._def.checks)i.kind==="int"?Ne.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ae(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),ae(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),ae(n,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?aM(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ae(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),ae(n,{code:X.not_finite,message:i.message}),o.dirty()):Ne.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.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"&&Ne.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)}};ai.create=e=>new ai({checks:[],typeName:be.ZodNumber,coerce:e?.coerce||!1,...Ee(e)});var si=class e extends ke{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)!==ce.bigint)return this._getInvalidInput(t);let n,o=new Dt;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),ae(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),ae(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),ae(n,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ne.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ae(r,{code:X.invalid_type,expected:ce.bigint,received:r.parsedType}),ve}gte(t,r){return this.setLimit("min",t,!0,fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,fe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:fe.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:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:fe.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}};si.create=e=>new si({checks:[],typeName:be.ZodBigInt,coerce:e?.coerce??!1,...Ee(e)});var ci=class extends ke{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ce.boolean){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.boolean,received:n.parsedType}),ve}return jt(t.data)}};ci.create=e=>new ci({typeName:be.ZodBoolean,coerce:e?.coerce||!1,...Ee(e)});var ui=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ce.date){let i=this._getOrReturnCtx(t);return ae(i,{code:X.invalid_type,expected:ce.date,received:i.parsedType}),ve}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ae(i,{code:X.invalid_date}),ve}let n=new Dt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ae(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),ae(o,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ne.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:fe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:fe.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}};ui.create=e=>new ui({checks:[],coerce:e?.coerce||!1,typeName:be.ZodDate,...Ee(e)});var La=class extends ke{_parse(t){if(this._getType(t)!==ce.symbol){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.symbol,received:n.parsedType}),ve}return jt(t.data)}};La.create=e=>new La({typeName:be.ZodSymbol,...Ee(e)});var li=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.undefined,received:n.parsedType}),ve}return jt(t.data)}};li.create=e=>new li({typeName:be.ZodUndefined,...Ee(e)});var di=class extends ke{_parse(t){if(this._getType(t)!==ce.null){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.null,received:n.parsedType}),ve}return jt(t.data)}};di.create=e=>new di({typeName:be.ZodNull,...Ee(e)});var uo=class extends ke{constructor(){super(...arguments),this._any=!0}_parse(t){return jt(t.data)}};uo.create=e=>new uo({typeName:be.ZodAny,...Ee(e)});var _n=class extends ke{constructor(){super(...arguments),this._unknown=!0}_parse(t){return jt(t.data)}};_n.create=e=>new _n({typeName:be.ZodUnknown,...Ee(e)});var kr=class extends ke{_parse(t){let r=this._getOrReturnCtx(t);return ae(r,{code:X.invalid_type,expected:ce.never,received:r.parsedType}),ve}};kr.create=e=>new kr({typeName:be.ZodNever,...Ee(e)});var Ua=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.void,received:n.parsedType}),ve}return jt(t.data)}};Ua.create=e=>new Ua({typeName:be.ZodVoid,...Ee(e)});var Nn=class e extends ke{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ce.array)return ae(r,{code:X.invalid_type,expected:ce.array,received:r.parsedType}),ve;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(a||p)&&(ae(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&&(ae(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&&(ae(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 Ar(r,a,r.path,p)))).then(a=>Dt.mergeArray(n,a));let i=[...r.data].map((a,p)=>o.type._parseSync(new Ar(r,a,r.path,p)));return Dt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:fe.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:fe.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:fe.toString(r)}})}nonempty(t){return this.min(1,t)}};Nn.create=(e,t)=>new Nn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:be.ZodArray,...Ee(t)});function ja(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=vr.create(ja(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Nn?new Nn({...e._def,type:ja(e.element)}):e instanceof vr?vr.create(ja(e.unwrap())):e instanceof tn?tn.create(ja(e.unwrap())):e instanceof en?en.create(e.items.map(t=>ja(t))):e}var tr=class e extends ke{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=Ne.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ce.object){let m=this._getOrReturnCtx(t);return ae(m,{code:X.invalid_type,expected:ce.object,received:m.parsedType}),ve}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),p=[];if(!(this._def.catchall instanceof kr&&this._def.unknownKeys==="strip"))for(let m in o.data)a.includes(m)||p.push(m);let f=[];for(let m of a){let h=i[m],C=o.data[m];f.push({key:{status:"valid",value:m},value:h._parse(new Ar(o,C,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof kr){let m=this._def.unknownKeys;if(m==="passthrough")for(let h of p)f.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(m==="strict")p.length>0&&(ae(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 h of p){let C=o.data[h];f.push({key:{status:"valid",value:h},value:m._parse(new Ar(o,C,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let m=[];for(let h of f){let C=yield h.key,b=yield h.value;m.push({key:C,value:b,alwaysSet:h.alwaysSet})}return m})).then(m=>Dt.mergeObjectSync(n,m)):Dt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return fe.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:fe.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:be.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 Ne.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 Ne.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ja(this)}partial(t){let r={};for(let n of Ne.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 Ne.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof vr;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Qw(Ne.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:kr.create(),typeName:be.ZodObject,...Ee(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:kr.create(),typeName:be.ZodObject,...Ee(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:kr.create(),typeName:be.ZodObject,...Ee(t)});var pi=class extends ke{_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 ae(r,{code:X.invalid_union,unionErrors:a}),ve}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},h=f._parseSync({data:r.data,path:r.path,parent:m});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,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 ae(r,{code:X.invalid_union,unionErrors:p}),ve}}get options(){return this._def.options}};pi.create=(e,t)=>new pi({options:e,typeName:be.ZodUnion,...Ee(t)});var On=e=>e instanceof mi?On(e.schema):e instanceof Cr?On(e.innerType()):e instanceof gi?[e.value]:e instanceof hi?e.options:e instanceof yi?Ne.objectValues(e.enum):e instanceof Si?On(e._def.innerType):e instanceof li?[void 0]:e instanceof di?[null]:e instanceof vr?[void 0,...On(e.unwrap())]:e instanceof tn?[null,...On(e.unwrap())]:e instanceof $c||e instanceof Ai?On(e.unwrap()):e instanceof vi?On(e._def.innerType):[],rp=class e extends ke{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.object)return ae(r,{code:X.invalid_type,expected:ce.object,received:r.parsedType}),ve;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}):(ae(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ve)}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=On(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:be.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ee(n)})}};function tS(e,t){let r=Zr(e),n=Zr(t);if(e===t)return{valid:!0,data:e};if(r===ce.object&&n===ce.object){let o=Ne.objectKeys(t),i=Ne.objectKeys(e).filter(p=>o.indexOf(p)!==-1),a={...e,...t};for(let p of i){let f=tS(e[p],t[p]);if(!f.valid)return{valid:!1};a[p]=f.data}return{valid:!0,data:a}}else if(r===ce.array&&n===ce.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=tS(a,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ce.date&&n===ce.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var fi=class extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(ep(i)||ep(a))return ve;let p=tS(i.value,a.value);return p.valid?((tp(i)||tp(a))&&r.dirty(),{status:r.value,value:p.data}):(ae(n,{code:X.invalid_intersection_types}),ve)};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}))}};fi.create=(e,t,r)=>new fi({left:e,right:t,typeName:be.ZodIntersection,...Ee(r)});var en=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.array)return ae(n,{code:X.invalid_type,expected:ce.array,received:n.parsedType}),ve;if(n.data.length<this._def.items.length)return ae(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ve;!this._def.rest&&n.data.length>this._def.items.length&&(ae(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 Ar(n,a,n.path,p)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Dt.mergeArray(r,a)):Dt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};en.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new en({items:e,typeName:be.ZodTuple,rest:null,...Ee(t)})};var np=class e extends ke{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!==ce.object)return ae(n,{code:X.invalid_type,expected:ce.object,received:n.parsedType}),ve;let o=[],i=this._def.keyType,a=this._def.valueType;for(let p in n.data)o.push({key:i._parse(new Ar(n,p,n.path,p)),value:a._parse(new Ar(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 ke?new e({keyType:t,valueType:r,typeName:be.ZodRecord,...Ee(n)}):new e({keyType:co.create(),valueType:t,typeName:be.ZodRecord,...Ee(r)})}},Qa=class extends ke{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!==ce.map)return ae(n,{code:X.invalid_type,expected:ce.map,received:n.parsedType}),ve;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Ar(n,p,n.path,[m,"key"])),value:i._parse(new Ar(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,h=yield f.value;if(m.status==="aborted"||h.status==="aborted")return ve;(m.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(m.value,h.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let f of a){let m=f.key,h=f.value;if(m.status==="aborted"||h.status==="aborted")return ve;(m.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(m.value,h.value)}return{status:r.value,value:p}}}};Qa.create=(e,t,r)=>new Qa({valueType:t,keyType:e,typeName:be.ZodMap,...Ee(r)});var Ba=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.set)return ae(n,{code:X.invalid_type,expected:ce.set,received:n.parsedType}),ve;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ae(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&&(ae(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 h of f){if(h.status==="aborted")return ve;h.status==="dirty"&&r.dirty(),m.add(h.value)}return{status:r.value,value:m}}let p=[...n.data.values()].map((f,m)=>i._parse(new Ar(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:fe.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:fe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ba.create=(e,t)=>new Ba({valueType:e,minSize:null,maxSize:null,typeName:be.ZodSet,...Ee(t)});var op=class e extends ke{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.function)return ae(r,{code:X.invalid_type,expected:ce.function,received:r.parsedType}),ve;function n(p,f){return Gc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ma(),kn].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return Gc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ma(),kn].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 lo){let p=this;return jt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new er([]),h=yield p._def.args.parseAsync(f,i).catch(g=>{throw m.addIssue(n(f,g)),m}),C=yield Reflect.apply(a,this,h);return yield p._def.returns._def.type.parseAsync(C,i).catch(g=>{throw m.addIssue(o(C,g)),m})}))}else{let p=this;return jt(function(...f){let m=p._def.args.safeParse(f,i);if(!m.success)throw new er([n(f,m.error)]);let h=Reflect.apply(a,this,m.data),C=p._def.returns.safeParse(h,i);if(!C.success)throw new er([o(h,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:en.create(t).rest(_n.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||en.create([]).rest(_n.create()),returns:r||_n.create(),typeName:be.ZodFunction,...Ee(n)})}},mi=class extends ke{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})}};mi.create=(e,t)=>new mi({getter:e,typeName:be.ZodLazy,...Ee(t)});var gi=class extends ke{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ae(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),ve}return{status:"valid",value:t.data}}get value(){return this._def.value}};gi.create=(e,t)=>new gi({value:e,typeName:be.ZodLiteral,...Ee(t)});function Qw(e,t){return new hi({values:e,typeName:be.ZodEnum,...Ee(t)})}var hi=class e extends ke{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ae(r,{expected:Ne.joinValues(n),received:r.parsedType,code:X.invalid_type}),ve}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 ae(r,{received:r.data,code:X.invalid_enum_value,options:n}),ve}return jt(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})}};hi.create=Qw;var yi=class extends ke{_parse(t){let r=Ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ce.string&&n.parsedType!==ce.number){let o=Ne.objectValues(r);return ae(n,{expected:Ne.joinValues(o),received:n.parsedType,code:X.invalid_type}),ve}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ne.objectValues(r);return ae(n,{received:n.data,code:X.invalid_enum_value,options:o}),ve}return jt(t.data)}get enum(){return this._def.values}};yi.create=(e,t)=>new yi({values:e,typeName:be.ZodNativeEnum,...Ee(t)});var lo=class extends ke{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.promise&&r.common.async===!1)return ae(r,{code:X.invalid_type,expected:ce.promise,received:r.parsedType}),ve;let n=r.parsedType===ce.promise?r.data:Promise.resolve(r.data);return jt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};lo.create=(e,t)=>new lo({type:e,typeName:be.ZodPromise,...Ee(t)});var Cr=class extends ke{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===be.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=>{ae(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 ve;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?ve:f.status==="dirty"?ii(f.value):r.value==="dirty"?ii(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return ve;let p=this._def.schema._parseSync({data:a,path:n.path,parent:n});return p.status==="aborted"?ve:p.status==="dirty"?ii(p.value):r.value==="dirty"?ii(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"?ve:(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"?ve:(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(!so(a))return ve;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=>so(a)?Promise.resolve(o.transform(a.value,i)).then(p=>({status:r.value,value:p})):ve);Ne.assertNever(o)}};Cr.create=(e,t,r)=>new Cr({schema:e,typeName:be.ZodEffects,effect:t,...Ee(r)});Cr.createWithPreprocess=(e,t,r)=>new Cr({schema:t,effect:{type:"preprocess",transform:e},typeName:be.ZodEffects,...Ee(r)});var vr=class extends ke{_parse(t){return this._getType(t)===ce.undefined?jt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};vr.create=(e,t)=>new vr({innerType:e,typeName:be.ZodOptional,...Ee(t)});var tn=class extends ke{_parse(t){return this._getType(t)===ce.null?jt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};tn.create=(e,t)=>new tn({innerType:e,typeName:be.ZodNullable,...Ee(t)});var Si=class extends ke{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Si.create=(e,t)=>new Si({innerType:e,typeName:be.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ee(t)});var vi=class extends ke{_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 Va(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}};vi.create=(e,t)=>new vi({innerType:e,typeName:be.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ee(t)});var Ga=class extends ke{_parse(t){if(this._getType(t)!==ce.nan){let n=this._getOrReturnCtx(t);return ae(n,{code:X.invalid_type,expected:ce.nan,received:n.parsedType}),ve}return{status:"valid",value:t.data}}};Ga.create=e=>new Ga({typeName:be.ZodNaN,...Ee(e)});var sM=Symbol("zod_brand"),$c=class extends ke{_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}},Hc=class e extends ke{_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"?ve:i.status==="dirty"?(r.dirty(),ii(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"?ve: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:be.ZodPipeline})}},Ai=class extends ke{_parse(t){let r=this._def.innerType._parse(t),n=o=>(so(o)&&(o.value=Object.freeze(o.value)),o);return Va(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ai.create=(e,t)=>new Ai({innerType:e,typeName:be.ZodReadonly,...Ee(t)});function Vw(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Bw(e,t={},r){return e?uo.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let p=Vw(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!i){let a=Vw(t,n),p=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:p})}}):uo.create()}var cM={object:tr.lazycreate},be;(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"})(be||(be={}));var uM=(e,t={message:`Input not instance of ${e.name}`})=>Bw(r=>r instanceof e,t),Gw=co.create,$w=ai.create,lM=Ga.create,dM=si.create,Hw=ci.create,pM=ui.create,fM=La.create,mM=li.create,gM=di.create,hM=uo.create,yM=_n.create,SM=kr.create,vM=Ua.create,AM=Nn.create,CM=tr.create,bM=tr.strictCreate,xM=pi.create,wM=rp.create,RM=fi.create,IM=en.create,EM=np.create,FM=Qa.create,TM=Ba.create,PM=op.create,kM=mi.create,OM=gi.create,_M=hi.create,NM=yi.create,DM=lo.create,qM=Cr.create,MM=vr.create,VM=tn.create,jM=Cr.createWithPreprocess,LM=Hc.create,UM=()=>Gw().optional(),QM=()=>$w().optional(),BM=()=>Hw().optional(),GM={string:e=>co.create({...e,coerce:!0}),number:e=>ai.create({...e,coerce:!0}),boolean:e=>ci.create({...e,coerce:!0}),bigint:e=>si.create({...e,coerce:!0}),date:e=>ui.create({...e,coerce:!0})};var $M=ve;var HM=I.object({name:I.string(),arguments:I.string()}),zM=I.object({id:I.string(),type:I.literal("function"),function:HM,encryptedValue:I.string().optional()}),ip=I.object({id:I.string(),role:I.string(),content:I.string().optional(),name:I.string().optional(),encryptedValue:I.string().optional()}),WM=I.object({type:I.literal("text"),text:I.string()}),zw=I.object({type:I.literal("binary"),mimeType:I.string(),id:I.string().optional(),url:I.string().optional(),data:I.string().optional(),filename:I.string().optional()}),Ww=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:I.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},Nue=zw.superRefine((e,t)=>{Ww(e,t)}),YM=I.discriminatedUnion("type",[WM,zw]),KM=YM.superRefine((e,t)=>{e.type==="binary"&&Ww(e,t)}),XM=ip.extend({role:I.literal("developer"),content:I.string()}),JM=ip.extend({role:I.literal("system"),content:I.string()}),ZM=ip.extend({role:I.literal("assistant"),content:I.string().optional(),toolCalls:I.array(zM).optional()}),eV=ip.extend({role:I.literal("user"),content:I.union([I.string(),I.array(KM)])}),tV=I.object({id:I.string(),content:I.string(),role:I.literal("tool"),toolCallId:I.string(),error:I.string().optional(),encryptedValue:I.string().optional()}),rV=I.object({id:I.string(),role:I.literal("activity"),activityType:I.string(),content:I.record(I.any())}),nV=I.object({id:I.string(),role:I.literal("reasoning"),content:I.string(),encryptedValue:I.string().optional()}),Yw=I.discriminatedUnion("role",[XM,JM,ZM,eV,tV,rV,nV]),Due=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user"),I.literal("tool"),I.literal("activity"),I.literal("reasoning")]),oV=I.object({description:I.string(),value:I.string()}),iV=I.object({name:I.string(),description:I.string(),parameters:I.any()}),aV=I.object({threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),state:I.any(),messages:I.array(Yw),tools:I.array(iV),context:I.array(oV),forwardedProps:I.any()}),sV=I.any(),lt=class extends Error{constructor(e){super(e)}},rS=class extends lt{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Kw=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user")]),V=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}({}),Le=I.object({type:I.nativeEnum(V),timestamp:I.number().optional(),rawEvent:I.any().optional()}).passthrough(),cV=Le.extend({type:I.literal(V.TEXT_MESSAGE_START),messageId:I.string(),role:Kw.default("assistant")}),Xw=Le.extend({type:I.literal(V.TEXT_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),uV=Le.extend({type:I.literal(V.TEXT_MESSAGE_END),messageId:I.string()}),lV=Le.extend({type:I.literal(V.TEXT_MESSAGE_CHUNK),messageId:I.string().optional(),role:Kw.optional(),delta:I.string().optional()}),dV=Le.extend({type:I.literal(V.THINKING_TEXT_MESSAGE_START)}),pV=Xw.omit({messageId:!0,type:!0}).extend({type:I.literal(V.THINKING_TEXT_MESSAGE_CONTENT)}),fV=Le.extend({type:I.literal(V.THINKING_TEXT_MESSAGE_END)}),mV=Le.extend({type:I.literal(V.TOOL_CALL_START),toolCallId:I.string(),toolCallName:I.string(),parentMessageId:I.string().optional()}),gV=Le.extend({type:I.literal(V.TOOL_CALL_ARGS),toolCallId:I.string(),delta:I.string()}),hV=Le.extend({type:I.literal(V.TOOL_CALL_END),toolCallId:I.string()}),yV=Le.extend({messageId:I.string(),type:I.literal(V.TOOL_CALL_RESULT),toolCallId:I.string(),content:I.string(),role:I.literal("tool").optional()}),SV=Le.extend({type:I.literal(V.TOOL_CALL_CHUNK),toolCallId:I.string().optional(),toolCallName:I.string().optional(),parentMessageId:I.string().optional(),delta:I.string().optional()}),vV=Le.extend({type:I.literal(V.THINKING_START),title:I.string().optional()}),AV=Le.extend({type:I.literal(V.THINKING_END)}),CV=Le.extend({type:I.literal(V.STATE_SNAPSHOT),snapshot:sV}),bV=Le.extend({type:I.literal(V.STATE_DELTA),delta:I.array(I.any())}),xV=Le.extend({type:I.literal(V.MESSAGES_SNAPSHOT),messages:I.array(Yw)}),wV=Le.extend({type:I.literal(V.ACTIVITY_SNAPSHOT),messageId:I.string(),activityType:I.string(),content:I.record(I.any()),replace:I.boolean().optional().default(!0)}),RV=Le.extend({type:I.literal(V.ACTIVITY_DELTA),messageId:I.string(),activityType:I.string(),patch:I.array(I.any())}),IV=Le.extend({type:I.literal(V.RAW),event:I.any(),source:I.string().optional()}),EV=Le.extend({type:I.literal(V.CUSTOM),name:I.string(),value:I.any()}),FV=Le.extend({type:I.literal(V.RUN_STARTED),threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),input:aV.optional()}),TV=Le.extend({type:I.literal(V.RUN_FINISHED),threadId:I.string(),runId:I.string(),result:I.any().optional()}),PV=Le.extend({type:I.literal(V.RUN_ERROR),message:I.string(),code:I.string().optional()}),kV=Le.extend({type:I.literal(V.STEP_STARTED),stepName:I.string()}),OV=Le.extend({type:I.literal(V.STEP_FINISHED),stepName:I.string()}),_V=I.union([I.literal("tool-call"),I.literal("message")]),NV=Le.extend({type:I.literal(V.REASONING_START),messageId:I.string()}),DV=Le.extend({type:I.literal(V.REASONING_MESSAGE_START),messageId:I.string(),role:I.literal("reasoning")}),qV=Le.extend({type:I.literal(V.REASONING_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),MV=Le.extend({type:I.literal(V.REASONING_MESSAGE_END),messageId:I.string()}),VV=Le.extend({type:I.literal(V.REASONING_MESSAGE_CHUNK),messageId:I.string().optional(),delta:I.string().optional()}),jV=Le.extend({type:I.literal(V.REASONING_END),messageId:I.string()}),LV=Le.extend({type:I.literal(V.REASONING_ENCRYPTED_VALUE),subtype:_V,entityId:I.string(),encryptedValue:I.string()}),ap=I.discriminatedUnion("type",[cV,Xw,uV,lV,vV,AV,dV,pV,fV,mV,gV,hV,SV,yV,CV,bV,xV,wV,RV,IV,EV,FV,TV,PV,kV,OV,NV,DV,qV,MV,VV,jV,LV]);d();c();l();u();var nS={};Qs(nS,{JsonPatchError:()=>pt,_areEquals:()=>Yc,applyOperation:()=>Ci,applyPatch:()=>po,applyReducer:()=>$V,deepClone:()=>BV,getValueByPointer:()=>dp,validate:()=>Zw,validator:()=>pp});d();c();l();u();d();c();l();u();var UV=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)}}(),QV=Object.prototype.hasOwnProperty;function cp(e,t){return QV.call(e,t)}function up(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)cp(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 lp(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 rn(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 sp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(sp(e[t]))return!0}else if(typeof e=="object"){for(var n=up(e),o=n.length,i=0;i<o;i++)if(sp(e[n[i]]))return!0}}return!1}function Jw(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(`
32
- `)}var Wc=function(e){UV(t,e);function t(r,n,o,i,a){var p=this.constructor,f=e.call(this,Jw(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=Jw(r,{name:n,index:o,operation:i,tree:a}),f}return t}(Error);var pt=Wc,BV=qt,$a={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=dp(r,this.path);n&&(n=qt(n));var o=Ci(r,{op:"remove",path:this.from}).removed;return Ci(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=dp(r,this.from);return Ci(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Yc(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},GV={add:function(e,t,r){return lp(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:$a.move,copy:$a.copy,test:$a.test,_get:$a._get};function dp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Ci(e,r),r.value}function Ci(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):pp(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=dp(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=Yc(e,t.value),a.test===!1)throw new pt("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 pt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=qt(e));var p=t.path||"",f=p.split("/"),m=e,h=1,C=f.length,b=void 0,g=void 0,S=void 0;for(typeof r=="function"?S=r:S=pp;;){if(g=f[h],g&&g.indexOf("~")!=-1&&(g=zc(g)),o&&(g=="__proto__"||g=="prototype"&&h>0&&f[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&b===void 0&&(m[g]===void 0?b=f.slice(0,h).join("/"):h==C-1&&(b=t.path),b!==void 0&&S(t,0,e,b)),h++,Array.isArray(m)){if(g==="-")g=m.length;else{if(r&&!lp(g))throw new pt("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);lp(g)&&(g=~~g)}if(h>=C){if(r&&t.op==="add"&&g>m.length)throw new pt("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=GV[t.op].call(t,m,g,e);if(a.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=C){var a=$a[t.op].call(t,m,g,e);if(a.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(m=m[g],r&&h<C&&(!m||typeof m!="object"))throw new pt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function po(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new pt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=qt(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=Ci(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function $V(e,t,r){var n=Ci(e,t);if(n.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function pp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new pt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if($a[e.op]){if(typeof e.path!="string")throw new pt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new pt("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 pt("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 pt("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")&&sp(e.value))throw new pt("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 pt("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 pt("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=Zw([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new pt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new pt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Zw(e,t,r){try{if(!Array.isArray(e))throw new pt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)po(qt(t),qt(e),r||!0);else{r=r||pp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof pt)return o;throw o}}function Yc(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(!Yc(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],!Yc(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var sS={};Qs(sS,{compare:()=>ZV,generate:()=>oS,observe:()=>JV,unobserve:()=>XV});d();c();l();u();var iS=new WeakMap,HV=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),zV=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function WV(e){return iS.get(e)}function YV(e,t){return e.observers.get(t)}function KV(e,t){e.observers.delete(t.callback)}function XV(e,t){t.unobserve()}function JV(e,t){var r=[],n,o=WV(e);if(!o)o=new HV(e),iS.set(e,o);else{var i=YV(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=qt(e),t){n.callback=t,n.next=null;var a=function(){oS(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(){oS(n),clearTimeout(n.next),KV(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 zV(t,n)),n}function oS(e,t){t===void 0&&(t=!1);var r=iS.get(e.object);aS(r.value,e.object,e.patches,"",t),e.patches.length&&po(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function aS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=up(t),a=up(e),p=!1,f=!1,m=a.length-1;m>=0;m--){var h=a[m],C=e[h];if(cp(t,h)&&!(t[h]===void 0&&C!==void 0&&Array.isArray(t)===!1)){var b=t[h];typeof C=="object"&&C!=null&&typeof b=="object"&&b!=null&&Array.isArray(C)===Array.isArray(b)?aS(C,b,r,n+"/"+rn(h),o):C!==b&&(p=!0,o&&r.push({op:"test",path:n+"/"+rn(h),value:qt(C)}),r.push({op:"replace",path:n+"/"+rn(h),value:qt(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+rn(h),value:qt(C)}),r.push({op:"remove",path:n+"/"+rn(h)}),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 h=i[m];!cp(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+rn(h),value:qt(t[h])})}}}function ZV(e,t,r){r===void 0&&(r=!1);var n=[];return aS(e,t,n,"",r),n}var ale=Object.assign({},nS,sS,{JsonPatchError:Wc,deepClone:qt,escapePathComponent:rn,unescapePathComponent:zc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var cS=function(e,t){return cS=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])},cS(e,t)};function nn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");cS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function eR(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(h){try{m(n.next(h))}catch(C){a(C)}}function f(h){try{m(n.throw(h))}catch(C){a(C)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function fp(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(h){return f([m,h])}}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(h){m=[6,h],o=0}finally{n=i=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function Dn(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 Ha(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 za(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 bi(e){return this instanceof bi?(this.v=e,this):new bi(e)}function tR(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(g){return function(S){return Promise.resolve(S).then(g,C)}}function p(g,S){n[g]&&(o[g]=function(x){return new Promise(function(w,R){i.push([g,x,w,R])>1||f(g,x)})},S&&(o[g]=S(o[g])))}function f(g,S){try{m(n[g](S))}catch(x){b(i[0][3],x)}}function m(g){g.value instanceof bi?Promise.resolve(g.value.v).then(h,C):b(i[0][2],g)}function h(g){f("next",g)}function C(g){f("throw",g)}function b(g,S){g(S),i.shift(),i.length&&f(i[0][0],i[0][1])}}function rR(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 Dn=="function"?Dn(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 _e(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Wa(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 mp=Wa(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function MN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var VN=["1",1,"yes",!0];function Ic(){let e=[];return Lh()&&e.push(window.doNotTrack),ey()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>VN.indexOf(t)!==-1)}var yb="v15",Sb={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function jN(e=Sb.default,t=yb,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 LN="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:Sb.default,isCustomEndpoint:!1,token:"",version:yb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return fb}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=[F0,x0].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};Ic()?this.runtime=new Rl:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(De.view,{newEventType:De.view,addClientIdParameter:!0}),this.addEventTypeMapping(De.click,{newEventType:De.click,addClientIdParameter:!0}),this.addEventTypeMapping(De.custom,{newEventType:De.custom,addClientIdParameter:!0}),this.addEventTypeMapping(De.search,{newEventType:De.search,addClientIdParameter:!0})}initRuntime(t){return Lh()&&ri()?new Xh(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(MN()&&console.warn(qN),new Zh(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Lh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Bo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Bo()}})}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(Cl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(tb(t,tb(r,LN)))}})}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(Bo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ic())return null;try{let r=new URL(t).searchParams.get(Hn.cvo_cid);if(r==null)return null;let n=Hn.fromString(r);return!n||!ri()||!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((S,b)=>U(this,void 0,void 0,function*(){let w=yield S;return yield b(t,w)}),h)].reduce((h,S)=>U(this,void 0,void 0,function*(){let b=yield h;return yield S(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[C=>this.setTrackingIdIfTrackingIdNotPresent(C),C=>this.removeEmptyPayloadValues(C,t),C=>this.validateParams(C,t),C=>n?IN(C):C,C=>n?this.removeUnknownParameters(C):C,C=>n?this.processCustomParameters(C):this.mapCustomParametersToCustomData(C)].reduce((C,x)=>U(this,void 0,void 0,function*(){let h=yield C;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 Al().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Qr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.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({[De.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(PN(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=Qr(t,["custom"]),o={};r&&vl(r)&&(o=this.lowercaseKeys(r));let a=kN(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Qr(t,["custom"]);if(r&&vl(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=Qr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==De.view||r==De.click||r==De.search||r==De.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==De.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=Qr(t,["userId"]);return DN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Qr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&vl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&vl(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"?B0(t,r):t}get baseUrl(){return jN(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.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(O||(O={}));var Jh={[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.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"},zn=class{constructor(){this.runtime=new Rl,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(De.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(De.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(De.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(De.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return fb}};function UN(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function QN(e){return e.map(t=>t.replace(/;/g,""))}function vb(e){let r=e.join(";");return r.length<=256?r:vb(e.slice(1))}var cb=e=>{let t=QN(e),r=UN(t);return vb(r)};function ub(e){let t=typeof e.partialQueries=="string"?e.partialQueries:cb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:cb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Il=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ic();this.coveoAnalyticsClient=n?new zn:new cr(t)}disable(){this.coveoAnalyticsClient=new zn}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,ub(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,ub(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=Jh[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=Jh[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()})})}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()})})}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()})})}},El=Object.assign({},xc),lb=Object.keys(El).map(e=>El[e]),ni=class extends Bh{constructor({client:t,uuidGenerator:r=Bo}){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])=>lb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(lb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(El.pageview,{newEventType:De.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(El.event,{newEventType:De.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 W0(this.ticket)}};ni.Id="svc";var Fl;(function(e){e.click="click",e.flowStart="flowStart"})(Fl||(Fl={}));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 Tl;(function(e){e.quit="Quit",e.solved="Solved"})(Tl||(Tl={}));var Pl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ic();this.coveoAnalyticsClient=o?new cr(t):new zn,this.svc=new ni({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new zn,this.svc=new ni({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new ni({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:Tl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(hr.caseSolved,{reason:Tl.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",Fl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Fl.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)})}},BN=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},le=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,a=Qr(e,["caseContext","caseId","caseNumber"]),i=BN(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},a),!!i.context_Case_Subject&&{CaseSubject:i.context_Case_Subject}),t&&i)},kl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ic();this.coveoAnalyticsClient=n?new zn:new cr(t)}disable(){this.coveoAnalyticsClient=new zn}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(kt.contextChanged,r)}logExpandToFullUI(t){let r=le(t);return this.logCustomEvent(kt.expandToFullUI,r)}logOpenUserActions(t){let r=le(t,!1);return this.logCustomEvent(kt.openUserActions,r)}logShowPrecedingSessions(t){let r=le(t,!1);return this.logCustomEvent(kt.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=le(t,!1);return this.logCustomEvent(kt.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(kt.clickViewedDocument,Object.assign(Object.assign({},le(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(kt.clickPageView,Object.assign(Object.assign({},le(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(kt.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:Jh[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?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 ai=()=>"default";var GN=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Wn=class{constructor(t){he(this,"getState",t);he(this,"state");this.state=t()}getLanguage(){return GN(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=$n),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ai()}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 Ab=e=>new cr(e).getCurrentVisitorId(),ii=(e,t)=>typeof t=="function"?(...r)=>{let n=Ws(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,si=(e,t)=>(...r)=>{let n=Ws(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Ec=class extends Wn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Cb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Ec(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??Ke(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new Pl({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Ol(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function $N(e,t){return!!t&&t.facetId in e.facetSet}var Fn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),bb=(e,t)=>e.facetSet[t]?.request,ny=(e,t)=>{let r=Fn(e,t);return $N(e,r)?r:void 0};var xb=(e,t)=>ny(e,t)?.values.filter(r=>r.state!=="idle")||[],Br=e=>e.search.isLoading;d();c();l();u();function wb(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 Gr(e){let{activeValue:t,ancestryMap:r}=HN(e);return t?zN(t,r):[]}function HN(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 zN(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function WN(e,t){return!!t&&t.facetId in e.categoryFacetSet}var oy=(e,t)=>{let r=Fn(e,t);if(WN(e,r))return r},ay=(e,t)=>e.categoryFacetSet[t]?.request,Rb=(e,t)=>{let r=oy(e,t);return Gr(r?.values??[])},iy=(e,t)=>{let r=ay(e,t);return Gr(r?.currentValues??[])};d();c();l();u();function ci(){return{}}d();c();l();u();function Ib(e,t){return{request:e,tabs:t}}function ui(){return{}}d();c();l();u();function Eb(e,t){return{request:e,tabs:t}}function li(){return{}}d();c();l();u();function Fb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function di(){return{}}var Go=(e,t)=>{let r=Ob(t,e),n=r?r.field:"",o=sy(n,e);return{facetId:e,facetField:n,facetTitle:o}};function pi(e,t){let{facetId:r,facetValue:n}=e,o=Go(r,t),a=_b(t,r);return{...o,facetValue:a==="hierarchical"?kb(t,r):n}}function Xt(e){return{facetSet:e.facetSet??di(),categoryFacetSet:e.categoryFacetSet??ci(),dateFacetSet:e.dateFacetSet??ui(),numericFacetSet:e.numericFacetSet??li(),automaticFacetSet:e.automaticFacetSet??Ol()}}var _l=e=>{let t=[];return XN(e).forEach((r,n)=>{let o=_b(e,r.facetId),a=rD(r,n+1);if(KN(r)){if(!!!iy(e,r.facetId).length)return;t.push({...a,...eD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=Tb(i,p+1,o),m=YN(r)?Pb(i):JN(i);t.push({...a,...f,...m})})}),ZN(e).forEach((r,n)=>{let o=tD(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=Tb(a,i+1,"specific"),f=Pb(a);t.push({...o,...p,...f})})}),t},YN=e=>e.type==="specific",KN=e=>e.type==="hierarchical",XN=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),ZN=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Tb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),JN=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Pb=e=>({displayValue:e.value,value:e.value}),kb=(e,t)=>iy(e,t).map(n=>n.value).join(";"),eD=(e,t)=>{let n=kb(e,t);return{value:n,valuePosition:1,displayValue:n}},tD=(e,t)=>({title:sy(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),rD=(e,t)=>({title:sy(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),sy=(e,t)=>`${e}_${t}`,Ob=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,_b=(e,t)=>{let r=Ob(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var cy=e=>e.configuration.search.locale,Nb=e=>e.configuration.search.timezone,Db=e=>e.configuration.accessToken,qb=e=>e.configuration.organizationId,Mb=e=>e.configuration.environment,Nl=e=>e.configuration?.knowledge?.agentId,Vb=e=>e.configuration.knowledge.debugAgentSession;var Le=e=>{if(nD(e)||uy(e))return e.generatedAnswer?.answerId;if(oD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},nD=e=>"answer"in e&&"generatedAnswer"in e&&!ee(e.generatedAnswer?.answerConfigurationId),uy=e=>{let t=Nl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},oD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",ly=e=>e.generatedAnswer?.fieldsToIncludeInCitations,aD=e=>e.generatedAnswer?.citations,iD=e=>e.followUpAnswers?.followUpAnswers,sD=at(iD,e=>e?.flatMap(t=>t.citations)),cD=(e,t)=>t,fi=at(aD,sD,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 Fc=class extends Wn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||At().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 _l(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Le(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||At().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||At().response.results.length}},jb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Fc(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??Ke(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new kl({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();var Dl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Dl||{}),ql=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(ql||{}),$r=e=>{if(Ba(e))return e.map(t=>$r(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""}},Ml=()=>({by:"relevancy"}),Lb=e=>({by:"date",order:e});var Ub=new Y({values:{by:new zs({enum:ql,required:!0}),order:new zs({enum:Dl}),field:new $}});function ur(){return $r(Ml())}d();c();l();u();d();c();l();u();d();c();l();u();var mi=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?dy(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],dy(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 dy(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 uD(){return typeof navigator<"u"}function Qb(){try{return typeof localStorage<"u"}catch{return!1}}function Bb(){try{return typeof sessionStorage<"u"}catch{return!1}}function Gb(){return!!(uD()&&navigator.cookieEnabled)}var $b=null;function Hb(){return $b||(Qb()?localStorage:Gb()?new py:Bb()?sessionStorage:new fy)}var gi=class gi{getItem(t){return mi.get(`${gi.prefix}${t}`)}removeItem(t){mi.erase(`${gi.prefix}${t}`)}setItem(t,r,n){mi.set(`${gi.prefix}${t}`,r,n)}};he(gi,"prefix","coveo_");var py=gi;var fy=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Vl="__coveo.analytics.history",lD=20,dD=1e3*60,pD=75,$o=class $o{constructor(t){he(this,"store");this.store=t||Hb()}static getInstance(t){return $o.instance||($o.instance=new $o(t)),$o.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(Vl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(Vl);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Vl,JSON.stringify(t.slice(0,lD)))}catch{}}clear(){try{this.store.removeItem(Vl)}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,pD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>dD:!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))}};he($o,"instance",null);var my=$o,Vt=my;var Tc=class Tc extends Wn{constructor(){super(...arguments);he(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return _l(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Tc.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||At().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Tc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Le(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||At().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||At().response.totalCountFiltered}};he(Tc,"fallbackPipelineName","default");var Yn=Tc,zb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??Ke(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new Il({token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g},gy=()=>{let t=Vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function jl(e){let t=Wb(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return Zv([e,...t,...r],o=>o.uniqueId)}function Wb(e){return e.childResults?e.childResults.flatMap(t=>[t,...Wb(t)]):[]}d();c();l();u();var Pc=()=>"";function Kb(e,t){return{...new Yn(t).getBaseMetadata(),actionCause:e,type:e}}function fD(e){return Object.assign(e,{instantlyCallable:!0})}function mD(e,t){let r=a=>{let i=fe(e,a);return fD(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}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g})).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}){let{description:m,log:g}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f});return{description:m,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:x,extra:h}){return yield g({state:x(),extra:h})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var hy=(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 yD(a)}return n},gD=e=>e.configuration.analytics.analyticsMode==="legacy",hD=e=>e.configuration.analytics.analyticsMode==="next",yD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),mD(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g}){let C=[],x={log:function(){var _ref14=_asyncToGenerator(function*({state:I}){for(let E of C)yield E(I)});return function log(_x25){return _ref14.apply(this,arguments)}}()},h=p(),S=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),b=yield t(S,p());x.description=b?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(I){gD(I)&&(yield SD(b,r,I,g,S.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:w}=bc(h);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(I){if(hD(I)&&o&&n){let E=n(I);yield ID(w,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),x});return function(_x24){return _ref13.apply(this,arguments)}}()));function SD(_x28,_x29,_x30,_x31,_x32){return _SD.apply(this,arguments)}function _SD(){_SD=_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 _SD.apply(this,arguments)}var Xb=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)}}()}),ze=hy(e=>zb({...e,provider:e.provider||new Yn(e.getState)}),e=>e,Yn),_8=hy(Cb,Xb("caseAssist"),Ec),te=e=>hy(jb,Xb(e),Fc),Ze=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Jb(e,o),n<0&&(n=RD(e,o)),n<0&&(n=0),AD(e,r(n),t)};var Ll=(e,t)=>({sourceName:vD(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Pc()});function vD(e){let t=e.source;return ee(t)?"unknown":t}var Ul=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function AD(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:xD(e),...(Yb(e)?{documentCategory:Yb(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:wD(e),queryPipeline:r.pipeline||Pc()}}function Yb(e){return e.raw?.objecttype||void 0}var Je=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||""}),Zb={urihash:new $,sourcetype:new $,permanentid:new $},Ql={uniqueId:z,raw:new Y({values:Zb}),title:z,uri:z,clickUri:z,rankingModifier:new $({required:!1,emptyAllowed:!0})};function CD(e){return Object.assign({},...Object.keys(Zb).map(t=>({[t]:e[t]})))}function bD(e){return Object.assign({},...Object.keys(Ql).map(t=>({[t]:e[t]})),{raw:CD(e.raw)})}function xD(e){let t=e.raw.author;return ee(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function wD(e){let t=e.raw.source;return ee(t)?"unknown":t}var Ot=e=>new Pe(Ql).validate(bD(e));function RD(e,t){for(let[r,n]of t.entries()){let o=jl(n);if(Jb(e,o)!==-1)return r}return-1}function Jb(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function ID(_x34,_x35,_x36){return _ID.apply(this,arguments)}function _ID(){_ID=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _ID.apply(this,arguments)}var Pr=(e,t)=>{let r=Je(e),n=Ze(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var yy=e=>_(e,{evt:z,type:We}),ex=e=>ze("analytics/generic/search",t=>{yy(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),tx=e=>ze("analytics/generic/click",(t,r)=>(Ot(e.result),yy(e),t.makeClickEvent(e.evt,Ze(e.result,r),Je(e.result),e.meta))),rx=e=>ze("analytics/generic/custom",t=>(yy(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var nx=()=>({actionCause:"interfaceLoad"}),hi=()=>({actionCause:"interfaceChange"});d();c();l();u();var Sy=()=>We,ox=()=>z,yi=P("configuration/updateBasicConfiguration",e=>_(e,{accessToken:We,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:We})),Si=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 ne({required:!1,each:z})})),ED={enabled:new pe({default:!0}),originContext:Sy(),originLevel2:Sy(),originLevel3:Sy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new $e,anonymous:new pe({default:!1}),deviceId:We,userDisplayName:We,documentLocation:We,trackingId:$A,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:ZC.reduce((e,t)=>(e[t]=GA,e),{})})},Bl=P("configuration/updateAnalyticsConfiguration",e=>_(e,ED)),Gl=P("configuration/analytics/disable"),$l=P("configuration/analytics/enable"),ax=P("configuration/analytics/originlevel2",e=>_(e,{originLevel2:ox()})),ix=P("configuration/analytics/originlevel3",e=>_(e,{originLevel3:ox()})),sx=P("knowledge/setAgentId",e=>_(e,new $({required:!0})));d();c();l();u();var Hl=P("insightConfiguration/set",e=>_(e,{insightId:z}));d();c();l();u();d();c();l();u();var cx=()=>({insightId:""});var zl=de(cx(),e=>{e.addCase(Hl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Wl=P("searchHub/set",e=>_(e,new $({required:!0,emptyAllowed:!0})));var Hr=fe("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(FD(a));return He(i)?n(i.error):(r(Wl(i.success.searchHub)),{response:i.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),FD=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ke(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var ux=()=>({loading:!1,config:void 0});var Kn=de(ux(),e=>{e.addCase(Hr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Hr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Hr.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 lx(e){return e.type==="dateRange"}function dx(e){return`start${e}`}function px(e){return`end${e}`}var vy=()=>({dateFacetValueMap:{}});function TD(e,t,r){let n=e.start,o=e.end;return Qn(n)&&(n=Zs(n),r.dateFacetValueMap[t][dx(n)]=e.start),Qn(o)&&(o=Zs(o),r.dateFacetValueMap[t][px(o)]=e.end),{...e,start:n,end:o}}function Ay(e,t){if(lx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>TD(o,r,t))}}return e}function zr(e){let t=vy();return{request:{...e,facets:e.facets?.map(n=>Ay(n,t))},mappings:t}}function PD(e,t,r){return{...e,start:r.dateFacetValueMap[t][dx(e.start)]||e.start,end:r.dateFacetValueMap[t][px(e.end)]||e.end}}function kD(e,t){return e.facetId in t.dateFacetValueMap}function OD(e,t){return kD(e,t)?{...e,values:e.values.map(r=>PD(r,e.facetId,t))}:e}function kr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>OD(n,t))}}:e}d();c();l();u();d();c();l();u();var Xn=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Ab(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}),...(gy()&&{pageId:gy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ti(e)})}}});return function Xn(_x39,_x40){return _ref19.apply(this,arguments)}}();var fx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:Ke(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 Xn(t.configuration.analytics)))})}});return function fx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var Yl=P("didYouMean/enable"),mx=P("didYouMean/disable"),Kl=P("didYouMean/automaticCorrections/disable"),gx=P("didYouMean/automaticCorrections/enable"),Zt=P("didYouMean/correction",e=>_(e,z)),kc=P("didYouMean/automaticCorrections/mode",e=>_(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var _D=P("history/undo"),ND=P("history/redo"),bt=P("history/snapshot"),L7=fe("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(_D()),yield t(rt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),U7=fe("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(ND()),yield t(rt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),rt=fe("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 Tn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function Xl(){return{contextValues:{}}}d();c();l();u();var Zl=()=>!1;d();c();l();u();function hx(){return{contextValues:{}}}d();c();l();u();function Cy(){return{enabled:!0,tabs:{}}}function Jl(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function yx(){return[]}d();c();l();u();function Wr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function ed(){return{}}d();c();l();u();function Sx(){return{}}d();c();l();u();function td(){return{}}function xt(e){return{context:e.context||Xl(),dictionaryFieldContext:e.dictionaryFieldContext||hx(),facetSet:e.facetSet||di(),numericFacetSet:e.numericFacetSet||li(),dateFacetSet:e.dateFacetSet||ui(),categoryFacetSet:e.categoryFacetSet||ci(),automaticFacetSet:e.automaticFacetSet??Ol(),pagination:e.pagination||Wr(),query:e.query||ut(),tabSet:e.tabSet||td(),advancedSearchQueries:e.advancedSearchQueries||Tn(),staticFilterSet:e.staticFilterSet||Sx(),querySet:e.querySet||ed(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||Pc(),searchHub:e.searchHub||ai(),facetOptions:e.facetOptions||Jl(),facetOrder:e.facetOrder??yx(),debug:e.debug??Zl()}}d();c();l();u();var zt=P("query/updateQuery",e=>_(e,{q:new $,enableQuerySyntax:new pe}));d();c();l();u();d();c();l();u();var vx=()=>({caseContext:{},caseId:"",caseNumber:""}),J=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var by=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(J(t.insightCaseContext))),vi=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...J(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Ax=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),rd=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(J(t.insightCaseContext))),Zn=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...J(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Yr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var Cx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=qD(e),n=DD(e);return zr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Ke(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Xn(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 Cx(_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 Cx(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)}}(),bx=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield Cx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function bx(_x53,_x54){return _ref26.apply(this,arguments)}}(),nd=/*#__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 nd(_x55,_x56){return _ref27.apply(this,arguments)}}(),od=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,numberOfResults:0},r});return function od(_x57,_x58){return _ref28.apply(this,arguments)}}();function DD(e){return Yr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function qD(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Ho=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){he(this,"config",t);he(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(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 He(t.response)?(this.dispatch(vi(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||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!ee(f)&&!ee(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 He(a.response)?(_this10.dispatch(vi(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 Gn(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 xx=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(J(t.insightCaseContext))),xy=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(J(t.insightCaseContext)));var zo=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){he(this,"config",t);he(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(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 He(t.response)?(this.dispatch(vi(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,C=!ee(m)&&!ee(m.correctedQuery);if(!g&&!C)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 He(a.response)?(_this15.dispatch(vi(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:xy()})})()}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:xy()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(zt({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 Gn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=kr(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 wy(_x63,_x64,_x65){return _wy.apply(this,arguments)}function _wy(){_wy=_asyncToGenerator(function*(e,t,r){Oc(e);let n=new zo({...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 _wy.apply(this,arguments)}function Ry(_x66,_x67,_x68){return _Ry.apply(this,arguments)}function _Ry(){_Ry=_asyncToGenerator(function*(e,t,r){Oc(e);let n=new zo({...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 _Ry.apply(this,arguments)}function Iy(_x69,_x70){return _Iy.apply(this,arguments)}function _Iy(){_Iy=_asyncToGenerator(function*(e,t){let r=new zo({...t,analyticsAction:by}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield by().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield nd(e,i),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Iy.apply(this,arguments)}function Ey(_x71,_x72,_x73){return _Ey.apply(this,arguments)}function _Ey(){_Ey=_asyncToGenerator(function*(e,t,r){let n=new zo({...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 od(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Ey.apply(this,arguments)}var wx=fe("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield wy(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Rx=fe("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ry(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),Ix=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Iy(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Ex=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ey(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var Fx=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let a=Date.now(),i=kr(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 Fx(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),Ce=fe("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return wy(r,t,e.legacy);Oc(r);let n=new Ho({...t}),o=e.next?Fy(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)}}()),ad=fe("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ry(r,t,e.legacy);Oc(r);let n=new Ho({...t}),o=e.next?Fy(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)}}()),id=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Iy(r,t);let n=new Ho({...t}),o=Fy({actionCause:"browseResults"}),a=yield nd(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),Ai=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ey(r,t,e.legacy);let n=new Ho({...t}),o=yield od(r),a=yield n.fetchFromAPI(o);return yield n.process(a)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),sd=fe("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:z});let a=e.id,i=yield fx(a,t()),p=yield n.querySuggest(i);return He(p)?r(p.error):{id:a,q:i.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),Oc=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Fy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Jt=P("breadcrumb/deselectAll"),cd=P("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Ci=P("facet/updateFacetAutoSelection",e=>_(e,{allow:new pe({required:!0})}));d();c();l();u();d();c();l();u();var ud=class extends Yn{constructor(r){super(r);he(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??At().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??At().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Tx=()=>ze("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new ud(e)),Px=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Ty={id:z},MD={...Ty,q:Xe},HJ=P("instantResults/register",e=>_(e,Ty)),ld=P("instantResults/updateQuery",e=>_(e,MD)),zJ=P("instantResults/clearExpired",e=>_(e,Ty));d();c();l();u();var dd=new oe({required:!0,min:0}),pd=P("pagination/registerNumberOfResults",e=>_(e,dd)),fd=P("pagination/updateNumberOfResults",e=>_(e,dd)),md=P("pagination/registerPage",e=>_(e,dd)),Jn=P("pagination/updatePage",e=>_(e,dd)),gd=P("pagination/nextPage"),hd=P("pagination/previousPage");d();c();l();u();d();c();l();u();var Wo=(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:ti(e)}});var bi=(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&&Wo(e.configuration.analytics,t,r)),...(e.excerptLength&&!ee(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 eo=/*#__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 Xn(e.configuration.analytics,t))),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function eo(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var Py=()=>ze("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),to=e=>ze("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||Tn().aq,cq:r.advancedSearchQueries?.cq||Tn().cq,dq:r.advancedSearchQueries?.dq||Tn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var ky=()=>ze("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),kx=()=>({actionCause:"didYouMeanClick"}),Ox=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var Wee=new Y({values:{undoneQuery:Xe},options:{required:!0}}),_x=()=>ze("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var xi=P("trigger/query/ignore",e=>_(e,new $({emptyAllowed:!0,required:!0}))),wi=P("trigger/query/modification",e=>_(e,new Y({values:{originalQuery:We,modification:We}})));d();c();l();u();d();c();l();u();function _c(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 Nx(e){return Yr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Oy={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function VD(e){return Yr(e).map(t=>{let r=Oy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function jD(e){return[...VD(e.facetSet??{}),...Nx(e.numericFacetSet??{}),...Nx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function LD(e){return jD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function yd(e){return _c(LD(e),e.facetOrder??[])}var ro=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=BD(e),n=yd(e),o=UD(e),a=yield eo(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return zr({...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 ro(_x98,_x99){return _ref40.apply(this,arguments)}}();function UD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(QD).filter(r=>r.currentValues.length>0):void 0}function QD(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function BD(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=GD(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function GD(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 no=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){he(this,"config",t);he(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(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 He(t.response)?(this.dispatch(to(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=!ee(f)&&!ee(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 He(a.response)?(_this20.dispatch(to(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:ky()})})()}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:ky()}}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(xi("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this21.dispatch(to(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(bt(xt(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:_x()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),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 Gn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield ro(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Zt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(wi({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield ro(_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 ere=fe("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Sd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),tre=fe("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ny(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),rre=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dy(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),nre=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield WD(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),ore=fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return _y(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),$D=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield ro(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function $D(_x112,_x113){return _ref46.apply(this,arguments)}}(),HD=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield eo(e);return zr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function HD(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),zD=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield ro(e,t);return r.request.numberOfResults=0,r});return function zD(_x117,_x118){return _ref48.apply(this,arguments)}}(),Dx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function _y(_x119,_x120){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(e,t){_(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new no({...t,analyticsAction:Tx()},m=>{t.dispatch(ld({q:m,id:e.id}))}),i=yield HD(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 _y2.apply(this,arguments)}function Ny(_x121,_x122,_x123){return _Ny.apply(this,arguments)}function _Ny(){_Ny=_asyncToGenerator(function*(e,t,r){Dx(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 no({...t,analyticsAction:r}),f=yield ro(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _Ny.apply(this,arguments)}function Dy(_x124,_x125){return _Dy.apply(this,arguments)}function _Dy(){_Dy=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Py().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new no({...e,analyticsAction:Py()}),p=yield $D(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _Dy.apply(this,arguments)}function WD(_x126,_x127,_x128){return _WD.apply(this,arguments)}function _WD(){_WD=_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 no({...e,analyticsAction:t}),f=yield zD(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _WD.apply(this,arguments)}function Sd(_x129,_x130,_x131){return _Sd.apply(this,arguments)}function _Sd(){_Sd=_asyncToGenerator(function*(e,t,r){Dx(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 ro(e,i),f=new no({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _Sd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var qx=at(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=My(e),o=YD(e),a=KD(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield eo(e,r):bi(e,t,r);return zr({...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:qy(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 qy(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function YD(e){return _c(ZD(e),e.facetOrder??[])}function KD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(XD).filter(r=>r.currentValues.length>0):void 0}function XD(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function ZD(e){return JD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function JD(e){return[...eq(e.facetSet??{}),...Mx(e.numericFacetSet??{}),...Mx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function eq(e){return Yr(e).map(t=>{let r=Oy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Mx(e){return Yr(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 My(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=qx(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var oo=class{constructor(t,r=n=>{this.dispatch(zt({q:n}))}){he(this,"config",t);he(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(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 He(t.response)?(this.dispatch(to(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||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!ee(f)&&!ee(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 He(a.response)?(_this27.dispatch(to(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(xi("")),null;let a=_this28.getCurrentQuery(),i=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this28.dispatch(to(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 Gn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Ox(),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(wi({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 Ri=fe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new $,enableQuerySyntax:new pe,clearFilters:new pe}),e.clearFilters&&(r(Jt()),r(cd())),r(Ci({allow:!0})),r(zt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Jn(1))}),Vx=P("search/updateSearchAction"),ke=fe("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Sd(r,t,e.legacy);jx(r);let n=e.next?Lx(e.next):void 0,o=yield vr(r,t.extra.navigatorContext,n),a=new oo({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Xr=fe("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(jx(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Ny(r,t,e.legacy);let n=new oo({...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)}}()),ao=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dy(t,r);let n=Kb("browseResults",t.getState),o=new oo({...t,analyticsAction:n}),a=yield tq(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)}}()),Ii=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Sd(r,t,e.legacy);let n=new oo({...t,analyticsAction:{}}),o=yield nq(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)}}()),cne=fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return _y(e,t);_(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,a=Lx(Px()),i=yield rq(r,t.extra.navigatorContext,n,o,a),p=new oo({...t,analyticsAction:a},g=>{t.dispatch(ld({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)}}()),tq=/*#__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 tq(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),rq=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let a=bi(e,t,o);return zr({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function rq(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),nq=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request.numberOfResults=0,n});return function nq(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),jx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Lx=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Ux(_x158,_x159){return _Ux.apply(this,arguments)}function _Ux(){_Ux=_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 _Ux.apply(this,arguments)}var Nc=fe("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield Ux(o,e),i=yield t.apiClient.html(a);return He(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),vd=P("resultPreview/next"),Ad=P("resultPreview/previous"),Bx=P("resultPreview/prepare",e=>_(e,{results:new ne({required:!0})})),Qx=2048,Cd=fe("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=DA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Qx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Qx} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Vy(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var jy=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Vy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Ly=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Ei=de(Vy(),e=>{e.addCase(Nc.pending,t=>{t.isLoading=!0}).addCase(Nc.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(ke.fulfilled,(t,r)=>{jy(t),t.resultsWithPreview=Ly(r.payload.response.results)}).addCase(ao.fulfilled,(t,r)=>{jy(t),t.resultsWithPreview=t.resultsWithPreview.concat(Ly(r.payload.response.results))}).addCase(Xr.fulfilled,jy).addCase(Bx,(t,r)=>{t.resultsWithPreview=Ly(r.payload.results)}).addCase(vd,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Ad,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Cd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var io=(e,t)=>{let r=e;return ee(r[t])?ee(e.raw[t])?null:e.raw[t]:r[t]},oq=e=>t=>e.every(r=>!ee(io(t,r))),aq=e=>t=>e.every(r=>ee(io(t,r))),iq=(e,t)=>r=>{let n=Gx(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},sq=(e,t)=>r=>{let n=Gx(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},Gx=(e,t)=>{let r=io(t,e);return Ou(r)?r:[r]},$x={getResultProperty:io,fieldsMustBeDefined:oq,fieldsMustNotBeDefined:aq,fieldMustMatch:iq,fieldMustNotMatch:sq};function bd(e){return e.search.response.searchUid!==""}function Hx(e,t,r){return e.search.results.find(n=>io(n,t)===r)}var Uy=at(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Fi=P("app/setError");function Qy(e,t){let r=t.payload??null;r&&(e.response=At().response,e.results=[],e.questionAnswer=Wa()),e.error=r,e.isLoading=!1}function By(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function cq(e,t){By(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 zx(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function uq(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Ie=de(At(),e=>{e.addCase(ke.rejected,(t,r)=>Qy(t,r)),e.addCase(ao.rejected,(t,r)=>Qy(t,r)),e.addCase(Xr.rejected,(t,r)=>Qy(t,r)),e.addCase(ke.fulfilled,(t,r)=>{cq(t,r)}),e.addCase(ao.fulfilled,(t,r)=>{By(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Xr.fulfilled,(t,r)=>{By(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ii.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(ke.pending,zx),e.addCase(ao.pending,uq),e.addCase(Xr.pending,zx),e.addCase(Vx,(t,r)=>{t.searchAction=r.payload}),e.addCase(Fi,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var xd=de(ai(),e=>{e.addCase(Wl,(t,r)=>r.payload).addCase(rt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Si,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Wx=class extends Error{constructor(t){super(t[0].message);he(this,"issues");this.name="SchemaError",this.issues=t}};var kn="uninitialized",$y="pending",qc="fulfilled",Mc="rejected";function Yx(e){return{status:e,isUninitialized:e===kn,isLoading:e===$y,isSuccess:e===qc,isError:e===Mc}}var Kx=Lr;function lw(e,t){if(e===t||!(Kx(e)&&Kx(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]=lw(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function Hy(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function lq(e){return new RegExp("(^|:)//").test(e)}function dq(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Ky(e){return e!=null}function Xx(e){return[...(e?.values()??[])].filter(Ky)}function pq(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var fq=e=>e.replace(/\/$/,""),mq=e=>e.replace(/^\//,"");function gq(e,t){if(!e)return t;if(!t)return e;if(lq(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=fq(e),t=mq(t),`${e}${r}${t}`}function Id(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var zy=()=>new Map,hq=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},yq=(...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},Zx=(...e)=>v(...e),Sq=e=>e.status>=200&&e.status<=299,vq=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Jx(e){if(!Lr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Aq=e=>typeof e=="object"&&(Lr(e)||Array.isArray(e)||typeof e.toJSON=="function");function dw({baseUrl:e,prepareHeaders:t=C=>C,fetchFn:r=Zx,paramsSerializer:n,isJsonContentType:o=vq,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===Zx&&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,S){let{getState:b,extra:w,endpoint:I,forced:E,type:F}=h,k,{url:T,headers:q=new A(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:j=m??Sq,timeout:B=p,...L}=typeof x=="string"?{url:x}:x,N={...g,signal:B?yq(h.signal,hq(B)):h.signal,...L};q=new A(Jx(q)),N.headers=(yield t(q,{getState:b,arg:x,extra:w,endpoint:I,forced:E,type:F,extraOptions:S}))||q;let D=Aq(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("?")?"&":"?",Se=n?n(G):new URLSearchParams(Jx(G));T+=ce+Se}T=gq(e,T);let M=new Request(T,N);k={request:new Request(T,N)};let H;try{H=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=H.clone();k.response=re;let Z,K="";try{let ce;if(yield Promise.all([C(H,Q).then(Se=>Z=Se,Se=>ce=Se),re.text().then(Se=>K=Se,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:H.status,data:K,error:String(ce)},meta:k}}return j(H,Z)?{data:Z,meta:k}:{error:{status:H.status,data:Z},meta:k}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function C(_x167,_x168){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let S=yield x.text();return S.length?JSON.parse(S):null}return x.text()});return _C2.apply(this,arguments)}}var Ti=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function Cq(){return _Cq.apply(this,arguments)}function _Cq(){_Cq=_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 _Cq.apply(this,arguments)}function pw(e,t){throw Object.assign(new Ti({error:e,meta:t}),{throwImmediately:!0})}function Gy(e){e.aborted&&pw({status:"CUSTOM_ERROR",error:"Aborted"})}var ew={},bq=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let a=[5,(t||ew).maxRetries,(o||ew).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:Cq,retryCondition:(g,C,{attempt:x})=>x<=i,...t,...o},m=0;for(;;){Gy(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ti(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Ti)return g.value;throw g}if(g instanceof Ti){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Gy(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(C){throw Gy(n.signal),C}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),fw=Object.assign(bq,{fail:pw}),Fd="__rtkq/",xq="online",wq="offline";var mw="focused";var Xy=P(`${Fd}${mw}`),gw=P(`${Fd}un${mw}`),Zy=P(`${Fd}${xq}`),hw=P(`${Fd}${wq}`);var Lc="query",yw="mutation",Sw="infinitequery";function Td(e){return e.type===Lc}function Rq(e){return e.type===yw}function Pd(e){return e.type===Sw}function Ed(e){return Td(e)||Pd(e)}function Jy(e,t,r,n,o,a){let i=Iq(e)?e(t,r,n,o):e;return i?Hy(i,Ky,p=>a(vw(p))):[]}function Iq(e){return typeof e=="function"}function vw(e){return typeof e=="string"?{type:e}:e}function Eq(e,t){return e.catch(t)}var Pi=(e,t)=>e.endpointDefinitions[t],Vc=Symbol("forceQueryFn"),Wy=e=>typeof e[Vc]=="function";function Fq({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:C}=o.internalActions;return{buildInitiateQuery:E,buildInitiateInfiniteQuery:F,buildInitiateMutation:k,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:S,getRunningMutationsThunk:b};function x(T,q){return G=>{let Q=Pi(a,T),j=e({queryArgs:q,endpointDefinition:Q,endpointName:T});return p(G)?.get(j)}}function h(T,q){return G=>f(G)?.get(q)}function S(){return T=>Xx(p(T))}function b(){return T=>Xx(f(T))}function w(T){}function I(T,q){let G=(Q,{subscribe:j=!0,forceRefetch:B,subscriptionOptions:L,[Vc]:N,...D}={})=>(M,W)=>{let H=e({queryArgs:Q,endpointDefinition:q,endpointName:T}),re,Z={...D,type:Lc,subscribe:j,forceRefetch:B,subscriptionOptions:L,endpointName:T,originalArgs:Q,queryCacheKey:H,[Vc]:N};if(Td(q))re=t(Z);else{let{direction:Re,initialPageParam:Oe,refetchCachedPages:Fe}=D;re=r({...Z,direction:Re,initialPageParam:Oe,refetchCachedPages:Fe})}let K=o.endpoints[T].select(Q),ce=M(re),Se=K(W());let{requestId:Ve,abort:ot}=ce,Ge=Se.requestId!==Ve,et=p(M)?.get(H),tt=()=>K(W()),Ee=Object.assign(N?ce.then(tt):Ge&&!et?Promise.resolve(Se):Promise.all([et,ce]).then(tt),{arg:Q,requestId:Ve,subscriptionOptions:L,queryCacheKey:H,abort:ot,unwrap(){return _asyncToGenerator(function*(){let Re=yield Ee;if(Re.isError)throw Re.error;return Re.data})()},refetch:Re=>M(G(Q,{subscribe:!1,forceRefetch:!0,...Re})),unsubscribe(){j&&M(m({queryCacheKey:H,requestId:Ve}))},updateSubscriptionOptions(Re){Ee.subscriptionOptions=Re,M(C({endpointName:T,requestId:Ve,queryCacheKey:H,options:Re}))}});if(!et&&!Ge&&!N){let Re=p(M);Re.set(H,Ee),Ee.then(()=>{Re.delete(H)})}return Ee};return G}function E(T,q){return I(T,q)}function F(T,q){return I(T,q)}function k(T){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(j,B)=>{let L=n({type:"mutation",endpointName:T,originalArgs:q,track:G,fixedCacheKey:Q}),N=j(L);let{requestId:D,abort:M,unwrap:W}=N,H=Eq(N.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),re=()=>{j(g({requestId:D,fixedCacheKey:Q}))},Z=Object.assign(H,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(j);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 Aw=class extends Wx{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}},Yo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Ko(_x172,_x173,_x174,_x175){return _Ko.apply(this,arguments)}function _Ko(){_Ko=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Aw(o.issues,t,r,n);return o.value});return _Ko.apply(this,arguments)}function tw(e){return e}var Dc=(e={})=>({...e,[Sc]:!0});function Tq({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,H)=>{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)(H()),ce=Jy(re.providesTags,K.data,void 0,N,{},a);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function C(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,H)=>{let Z=o.endpoints[L].select(N)(H()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(Z.status===kn)return K;let ce;if("data"in Z)if($t(Z.data)){let[Se,Ve,ot]=xh(Z.data,D);K.patches.push(...Ve),K.inversePatches.push(...ot),ce=Se}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},S=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[Vc]:()=>({data:D})})),b=(L,N)=>L.query&&L[N]?L[N]:tw,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:H,getState:re,extra:Z}){let K=r[L.endpointName],{metaSchema:ce,skipSchemaValidation:Se=m}=K,Ve=L.type===Lc;try{let ot=tw,Ge={signal:N,abort:D,dispatch:H,getState:re,extra:Z,endpoint:L.endpointName,type:L.type,forced:Ve?I(L,re()):void 0,queryCacheKey:Ve?L.queryCacheKey:void 0},et=Ve?L[Vc]:void 0,tt,Ee=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(Oe,Fe,gt,vt){if(Fe==null&&Oe.pages.length)return Promise.resolve({data:Oe});let Ir={queryArg:L.originalArgs,pageParam:Fe},ir=yield Re(Ir),Vr=vt?C:x;return{data:{pages:Vr(Oe.pages,ir.data,gt),pageParams:Vr(Oe.pageParams,Fe,gt)},meta:ir.meta}});return function Ee(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Re(_x182){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(Oe){let Fe,{extraOptions:gt,argSchema:vt,rawResponseSchema:Ir,responseSchema:ir}=K;if(vt&&!Yo(Se,"arg")&&(Oe=yield Ko(vt,Oe,"argSchema",{})),et?Fe=et():K.query?(ot=b(K,"transformResponse"),Fe=yield t(K.query(Oe),Ge,gt)):Fe=yield K.queryFn(Oe,Ge,gt,Er=>t(Er,Ge,gt)),typeof process<"u",Fe.error)throw new Ti(Fe.error,Fe.meta);let{data:Vr}=Fe;Ir&&!Yo(Se,"rawResponse")&&(Vr=yield Ko(Ir,Fe.data,"rawResponseSchema",Fe.meta));let fr=yield ot(Vr,Fe.meta,Oe);return ir&&!Yo(Se,"response")&&(fr=yield Ko(ir,fr,"responseSchema",Fe.meta)),{...Fe,data:fr}});return _Re.apply(this,arguments)}if(Ve&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:Oe}=K,{maxPages:Fe=1/0}=Oe,gt=L.refetchCachedPages??Oe.refetchCachedPages??!0,vt,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",Ru=(Er?Cw:Yy)(Oe,fr,L.originalArgs);vt=yield Ee(fr,Ru,Fe,Er)}else{let{initialPageParam:Er=Oe.initialPageParam}=L,Us=ir?.pageParams??[],Ru=Us[0]??Er,mk=Us.length;if(vt=yield Ee(fr,Ru,Fe),et&&(vt={data:vt.data.pages[0]}),gt)for(let Nv=1;Nv<mk;Nv++){let gk=Yy(Oe,vt.data,L.originalArgs);vt=yield Ee(vt.data,gk,Fe)}}tt=vt}else tt=yield Re(L.originalArgs);return ce&&!Yo(Se,"meta")&&tt.meta&&(tt.meta=yield Ko(ce,tt.meta,"metaSchema",tt.meta)),W(tt.data,Dc({fulfilledTimeStamp:Date.now(),baseQueryMeta:tt.meta}))}catch(ot){let Ge=ot;if(Ge instanceof Ti){let et=b(K,"transformErrorResponse"),{rawErrorResponseSchema:tt,errorResponseSchema:Ee}=K,{value:Re,meta:Oe}=Ge;try{tt&&!Yo(Se,"rawErrorResponse")&&(Re=yield Ko(tt,Re,"rawErrorResponseSchema",Oe)),ce&&!Yo(Se,"meta")&&(Oe=yield Ko(ce,Oe,"metaSchema",Oe));let Fe=yield et(Re,Oe,L.originalArgs);return Ee&&!Yo(Se,"errorResponse")&&(Fe=yield Ko(Ee,Fe,"errorResponseSchema",Oe)),M(Fe,Dc({baseQueryMeta:Oe}))}catch(Fe){Ge=Fe}}try{if(Ge instanceof Aw){let et={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Ve?L.queryCacheKey:void 0};K.onSchemaFailure?.(Ge,et),p?.(Ge,et);let{catchSchemaFailure:tt=f}=K;if(tt)return M(tt(Ge,et),Dc({baseQueryMeta:Ge._bqMeta}))}}catch(et){Ge=et}throw typeof process<"u",console.error(Ge),Ge}});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,H=L.forceRefetch??(L.subscribe&&M);return H?H===!0||(Number(new Date)-Number(W))/1e3>=H:!1}let E=()=>fe(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return Dc({startedTimeStamp:Date.now(),...(Pd(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=i.selectQueryEntry(M,N.queryCacheKey),H=W?.fulfilledTimeStamp,re=N.originalArgs,Z=W?.originalArgs,K=r[N.endpointName],ce=N.direction;return Wy(N)?!0:W?.status==="pending"?!1:I(N,M)||Td(K)&&K?.forceRefetch?.({currentArg:re,previousArg:Z,endpointState:W,state:M})?!0:!(H&&!ce)},dispatchConditionRejection:!0}),F=E(),k=E(),T=fe(`${e}/executeMutation`,w,{getPendingMeta(){return Dc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let H=q(D)&&D.force,re=G(D)&&D.ifOlderThan,Z=(ce=!0)=>{let Se={forceRefetch:ce,subscribe:!1};return o.endpoints[L].initiate(N,Se)},K=o.endpoints[L].select(N)(W());if(H)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 j(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:Ja(fl(L),j(N)),matchFulfilled:Ja(En(L),j(N)),matchRejected:Ja(Uo(L),j(N))}}return{queryThunk:F,mutationThunk:T,infiniteQueryThunk:k,prefetch:Q,updateQueryData:h,upsertQueryData:S,patchQueryData:g,buildMatchThunkActions:B}}function Yy(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Cw(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function bw(e,t,r,n){return Jy(r[e.meta.arg.endpointName][t],En(e)?e.payload:void 0,Ac(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function rw(e){return Gt(e)?il(e):e}function wd(e,t,r){let n=e[t];n&&r(n)}function jc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function nw(e,t,r){let n=e[jc(t)];n&&r(n)}var Rd={};function Pq({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 C(j,B,L,N){var D;j[D=B.queryCacheKey]??(j[D]={status:kn,endpointName:B.endpointName}),wd(j,B.queryCacheKey,M=>{M.status=$y,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];Pd(W)&&"direction"in B&&(M.direction=B.direction)})}function x(j,B,L,N){wd(j,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:H,baseQueryMeta:re,requestId:Z}=B,K=jo(D.data,ce=>M(ce,L,{arg:H.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:Z}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?lw(Gt(D.data)?nC(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Qo({name:`${e}/queries`,initialState:Rd,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:B}}){delete j[B]},prepare:ei()},cacheEntriesUpserted:{reducer(j,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;C(j,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),x(j,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:j=>({payload:j.map(N=>{let{endpointName:D,arg:M,value:W}=N,H=o[D];return{queryDescription:{type:Lc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:H,endpointName:D})},value:W}}),meta:{[Sc]:!0,requestId:Cc(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:B,patches:L}}){wd(j,B,N=>{N.data=wh(N.data,L.concat())})},prepare:ei()}},extraReducers(j){j.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=Wy(N);C(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=Wy(L.arg);x(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{wd(B,N.queryCacheKey,H=>{if(!L){if(H.requestId!==D)return;H.status=Mc,H.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===qc||M?.status===Mc)&&(B[D]=M)})}}),S=Qo({name:`${e}/mutations`,initialState:Rd,reducers:{removeMutationResult:{reducer(j,{payload:B}){let L=jc(B);L in j&&delete j[L]},prepare:ei()}},extraReducers(j){j.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[jc(L)]={requestId:N,status:$y,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&nw(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&&nw(B,D,M=>{M.requestId===D.requestId&&(M.status=Mc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===qc||M?.status===Mc)&&D!==M?.requestId&&(B[D]=M)})}}),b={tags:{},keys:{}},w=Qo({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(j,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){I(j,M);for(let{type:H,id:re}of W){let Z=(N=(L=j.tags)[H]??(L[H]={}))[D=re||"__internal_without_id"]??(N[D]=[]);Z.includes(M)||Z.push(M)}j.keys[M]=W}},prepare:ei()}},extraReducers(j){j.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[H,re]of Object.entries(N.tags??{}))for(let[Z,K]of Object.entries(re)){let ce=(M=(D=B.tags)[H]??(D[H]={}))[W=Z||"__internal_without_id"]??(M[W]=[]);for(let Se of K)ce.includes(Se)||ce.push(Se),B.keys[Se]=N.keys[Se]}}).addMatcher(Ur(En(t),Ac(t)),(B,L)=>{E(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}}));E(B,N)})}});function I(j,B){let L=rw(j.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=j.tags[D]?.[M];W&&(j.tags[D][M]=rw(W).filter(H=>H!==B))}delete j.keys[B]}function E(j,B){let L=B.map(N=>{let D=bw(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(j,w.actions.updateProvidedBy(L))}let F=Qo({name:`${e}/subscriptions`,initialState:Rd,reducers:{updateSubscriptionOptions(j,B){},unsubscribeQueryResult(j,B){},internal_getRTKQSubscriptions(){}}}),k=Qo({name:`${e}/internalSubscriptions`,initialState:Rd,reducers:{subscriptionsUpdated:{reducer(j,B){return wh(j,B.payload)},prepare:ei()}}}),T=Qo({name:`${e}/config`,initialState:{online:pq(),focused:dq(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(j,{payload:B}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:j=>{j.addCase(Zy,B=>{B.online=!0}).addCase(hw,B=>{B.online=!1}).addCase(Xy,B=>{B.focused=!0}).addCase(gw,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Ka({queries:h.reducer,mutations:S.reducer,provided:w.reducer,subscriptions:k.reducer,config:T.reducer}),G=(j,B)=>q(g.match(B)?void 0:j,B),Q={...T.actions,...h.actions,...F.actions,...k.actions,...S.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var Xo=Symbol.for("RTKQ/skipToken"),xw={status:kn},ow=jo(xw,()=>{}),aw=jo(xw,()=>{});function kq({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=F=>ow,o=F=>aw;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:S,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(F){return{...F,...Yx(F.status)}}function i(F){return F[t]}function p(F){return i(F)?.queries}function f(F,k){return p(F)?.[k]}function m(F){return i(F)?.mutations}function g(F){return i(F)?.config}function C(F,k,T){return q=>{if(q===Xo)return r(n,T);let G=e({queryArgs:q,endpointDefinition:k,endpointName:F});return r(j=>f(j,G)??ow,T)}}function x(F,k){return C(F,k,a)}function h(F,k){let{infiniteQueryOptions:T}=k;function q(G){let Q={...G,...Yx(G.status)},{isLoading:j,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:I(T,Q.data,Q.originalArgs),hasPreviousPage:E(T,Q.data,Q.originalArgs),isFetchingNextPage:j&&N,isFetchingPreviousPage:j&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return C(F,k,q)}function S(){return F=>{let k;return typeof F=="object"?k=jc(F)??Xo:k=F,r(k===Xo?o:G=>i(G)?.mutations?.[k]??aw,a)}}function b(F,k){let T=F[t],q=new Set,G=Hy(k,Ky,vw);for(let Q of G){let j=T.provided.tags[Q.type];if(!j)continue;let B=(Q.id!==void 0?j[Q.id]:Object.values(j).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let j=T.queries[Q];return j?{queryCacheKey:Q,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function w(F,k){return Hy(Object.values(p(F)),T=>T?.endpointName===k&&T.status!==kn,T=>T.originalArgs)}function I(F,k,T){return k?Yy(F,k,T)!=null:!1}function E(F,k,T){return!k||!F.getPreviousPageParam?!1:Cw(F,k,T)!=null}}var iw=WeakMap?new WeakMap:void 0,sw=({endpointName:e,queryArgs:t})=>{let r="",n=iw?.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=Lr(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));Lr(t)&&iw?.set(t,o),r=o}return`${e}(${r})`};function Oq(...e){return function(r){let n=hc(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 C=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=C(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:Cc(),extractRehydrationInfo:n,hasRehydrationInfo:hc(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let C of m)o.tagTypes.includes(C)||o.tagTypes.push(C);if(g)for(let[C,x]of Object.entries(g))typeof x=="function"?x(Pi(a,C)):Object.assign(Pi(a,C)||{},x);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:C=>({...C,type:Lc}),mutation:C=>({...C,type:yw}),infiniteQuery:C=>({...C,type:Sw})});for(let[C,x]of Object.entries(g)){if(m.overrideExisting!==!0&&C in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Ht(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[C]=x;for(let h of p)h.injectEndpoint(C,x)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Pn(e,...t){return Object.assign(e,...t)}var _q=({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:E,requestId:F,options:k}=w.payload,T=b.get(E);return T?.has(F)&&T.set(F,k),!0}if(f.match(w)){let{queryCacheKey:E,requestId:F}=w.payload,k=b.get(E);return k&&k.delete(F),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:E,requestId:F}}=w,k=Id(b,E.queryCacheKey,zy);return E.subscribe&&k.set(F,E.subscriptionOptions??k.get(F)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:E,arg:F,requestId:k}}=w;if(E&&F.subscribe){let T=Id(b,F.queryCacheKey,zy);T.set(k,F.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 S(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(b,w)=>{if(a||(a=S(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),E=!0;if(I){i||(i=setTimeout(()=>{let T=S(r.currentSubscriptions),[,q]=xh(a,()=>T);w.next(e.internalActions.subscriptionsUpdated(q)),a=T,i=null},500));let F=typeof b.type=="string"&&!!b.type.startsWith(o),k=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;E=!F&&!k}return[E,!1]}},Nq=2147483647/1e3-1,Dq=({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:C}=t.internalActions,x=Ur(g.match,r.fulfilled,r.rejected,C.match);function h(F){let k=o.currentSubscriptions.get(F);return k?k.size>0:!1}let S={};function b(F){for(let k of F.values())k?.abort?.()}let w=(F,k)=>{let T=k.getState(),q=i(T);if(x(F)){let G;if(C.match(F))G=F.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(F)?F.payload:F.meta.arg;G=[Q]}I(G,k,q)}if(t.util.resetApiState.match(F)){for(let[G,Q]of Object.entries(S))Q&&clearTimeout(Q),delete S[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(F)){let{queries:G}=n.extractRehydrationInfo(F);I(Object.keys(G),k,q)}};function I(F,k,T){let q=k.getState();for(let G of F){let Q=a(q,G);Q?.endpointName&&E(G,Q.endpointName,k,T)}}function E(F,k,T,q){let Q=Pi(n,k)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let j=Math.max(0,Math.min(Q,Nq));if(!h(F)){let B=S[F];B&&clearTimeout(B),S[F]=setTimeout(()=>{if(!h(F)){let L=a(T.getState(),F);L?.endpointName&&T.dispatch(p(L.endpointName,L.originalArgs))?.abort(),T.dispatch(m({queryCacheKey:F}))}delete S[F]},j*1e3)}}return w},cw=new Error("Promise never resolved before cacheEntryRemoved."),qq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=ml(n),m=ml(o),g=En(n,o),C={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:S}=e.internalActions;function b(T,q,G){let Q=C[T];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(T){let q=C[T];q&&(delete C[T],q.cacheEntryRemoved())}function I(T){let{arg:q,requestId:G}=T.meta,{endpointName:Q,originalArgs:j}=q;return[Q,j,G]}let E=(T,q,G)=>{let Q=F(T);function j(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);j(B,Q,N,L)}else if(S.match(T))for(let{queryDescription:B,value:L}of T.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;j(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(C))w(B)};function F(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)?jc(T.payload):""}function k(T,q,G,Q,j){let B=Pi(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 cw})]);M.catch(()=>{}),C[G]=N;let W=e.endpoints[T].select(Ed(B)?q:G),H=Q.dispatch((K,ce,Se)=>Se),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:j,extra:H,updateCachedData:Ed(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!==cw)throw K})}return E},Mq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Vq=({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=Ur(En(n),Ac(n)),C=Ur(En(o,n),Uo(o,n)),x=[],h=0,S=(I,E)=>{(o.pending.match(I)||n.pending.match(I))&&h++,C(I)&&(h=Math.max(0,h-1)),g(I)?w(bw(I,"invalidatesTags",r,i),E):C(I)?w([],E):a.util.invalidateTags.match(I)&&w(Jy(I.payload,void 0,void 0,void 0,void 0,i),E)};function b(){return h>0}function w(I,E){let F=E.getState(),k=F[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(F,T);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let j=k.queries[Q],B=Id(f.currentSubscriptions,Q,zy);j&&(B.size===0?E.dispatch(m({queryCacheKey:Q})):j.status!==kn&&E.dispatch(p(j)))}})}return S},jq=({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)&&C(w.meta.arg,I),r.util.resetApiState.match(w)&&(S(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,I){p.add(w),f||(f=setTimeout(()=>{for(let E of p)x({queryCacheKey:E},I);p.clear(),f=null},0))}function C({queryCacheKey:w},I){let E=I.getState()[e],F=E.queries[w],k=i.get(w);if(!F||F.status===kn)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(()=>{(E.config.focused||!q)&&I.dispatch(n(F)),C({queryCacheKey:w},I)},T)})}function x({queryCacheKey:w},I){let F=I.getState()[e].queries[w],k=i.get(w);if(!F||F.status===kn)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)&&C({queryCacheKey:w},I)}function h(w){let I=a.get(w);I?.timeout&&clearTimeout(I.timeout),a.delete(w)}function S(){for(let w of a.keys())h(w)}function b(w=new Map){let I=!1,E=Number.POSITIVE_INFINITY;for(let F of w.values())F.pollingInterval&&(E=Math.min(F.pollingInterval,E),I=F.skipPollingIfUnfocused||I);return{lowestPollingInterval:E,skipPollingIfUnfocused:I}}return m},Lq=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=fl(r,n),a=Uo(r,n),i=En(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:C,arg:{endpointName:x,originalArgs:h}}=m.meta,S=Pi(t,x),b=S?.onQueryStarted;if(b){let w={},I=new Promise((T,q)=>{w.resolve=T,w.reject=q});I.catch(()=>{}),p[C]=w;let E=e.endpoints[x].select(Ed(S)?h:C),F=g.dispatch((T,q,G)=>G),k={...g,getCacheEntry:()=>E(g.getState()),requestId:C,extra:F,updateCachedData:Ed(S)?T=>g.dispatch(e.util.updateQueryData(x,h,T)):void 0,queryFulfilled:I};b(h,k)}}else if(i(m)){let{requestId:C,baseQueryMeta:x}=m.meta;p[C]?.resolve({data:m.payload,meta:x}),delete p[C]}else if(a(m)){let{requestId:C,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[C]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[C]}}},Uq=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{Xy.match(f)&&p(m,"refetchOnFocus"),Zy.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],C=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let S=C[h],b=x.get(h);if(!b||!S)continue;let w=[...b.values()];(w.some(E=>E[m]===!0)||w.every(E=>E[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(a({queryCacheKey:h})):S.status!==kn&&f.dispatch(n(S)))}})}return i};function Qq(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=[Mq,Dq,Vq,jq,qq,Lq];return{middleware:x=>{let h=!1,S=a(x.dispatch),b={...e,internalState:S,refetchQuery:C,isThisApiSliceAction:f,mwApi:x},w=m.map(F=>F(b)),I=_q(b),E=Uq(b);return F=>k=>{if(!nc(k))return F(k);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(i)));let T={...x,next:F},q=x.getState(),[G,Q]=I(k,T,q),j;if(G?j=F(k):j=Q,x.getState()[t]&&(E(k,T,q),f(k)||o.hasRehydrationInfo(k)))for(let B of w)B(k,T,q);return j}},actions:p};function C(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var uw=Symbol(),Bq=({createSelector:e=at}={})=>({name:uw,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h},S){lC();let b=Ee=>(typeof process<"u",Ee);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Zy,onOffline:hw,onFocus:Xy,onFocusLost:gw},util:{}});let w=kq({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:E,buildQuerySelector:F,buildInfiniteQuerySelector:k,buildMutationSelector:T}=w;Pn(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:E});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=Tq({baseQuery:r,reducerPath:o,context:S,api:t,serializeQueryArgs:a,assertTagType:b,selectors:w,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:M,actions:W}=Pq({context:S,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}});Pn(t.util,{patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),Pn(t.internalActions,W);let H=new WeakMap,re=Ee=>Id(H,Ee,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueriesThunk:ot,getRunningQueryThunk:Ge}=Fq({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:a,context:S,getInternalState:re});Pn(t.util,{getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueryThunk:Ge,getRunningQueriesThunk:ot});let{middleware:et,actions:tt}=Qq({reducerPath:o,context:S,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:Ge,getInternalState:re});return Pn(t.util,tt),Pn(t,{reducer:M,middleware:et}),{name:uw,injectEndpoint(Ee,Re){var gt;let Fe=(gt=t.endpoints)[Ee]??(gt[Ee]={});Td(Re)&&Pn(Fe,{name:Ee,select:F(Ee,Re),initiate:Z(Ee,Re)},D(q,Ee)),Rq(Re)&&Pn(Fe,{name:Ee,select:T(),initiate:ce(Ee)},D(Q,Ee)),Pd(Re)&&Pn(Fe,{name:Ee,select:k(Ee,Re),initiate:K(Ee,Re)},D(q,Ee))}}}}),ww=Oq(Bq());d();c();l();u();d();c();l();u();var Zo=e=>e.query,Rw=e=>e.query?.enableQuerySyntax;var Iw=at(e=>Zo(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})),kd=at(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Uc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var ki=(e,t,r,n)=>ze({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(o,a)=>{let i=t??Le(a),p=e?r??(!a.generatedAnswer?.answer||!a.generatedAnswer?.answer.length):void 0;return i?o.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:p,...(n&&{conversationId:n})}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:o=>({answerId:t??Le(o)??"",answerGenerated:e??!1})}),Oi=e=>ze({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Le(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});var Ew=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var Fw=at(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 Tw=e=>e.context;d();c();l();u();var eS=e=>e.pipeline;d();c();l();u();var tS=e=>e.searchHub;d();c();l();u();var Wt=at(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Lae=at(e=>e,e=>{let t=Wt(e);return t&&e?e[t].expression:""});d();c();l();u();var Pw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var kw=e=>e.excerptLength?.length;d();c();l();u();var Zr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,Ow=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var _w=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 Nw=e=>e.sortCriteria;var Dw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ke(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Dw(_x183){return _ref64.apply(this,arguments)}}(),qw=(e,t)=>{let r=Zo(e)?.q,{aq:n,cq:o,dq:a,lq:i}=$q(e),p=Tw(e),f=Wo(e.configuration.analytics,t,{actionCause:Uy(e)}),m=tS(e),g=eS(e),C=ly(e)??[],x=Vw(e),h=Wt(e.tabSet)||"default",S=cy(e),b=Nb(e),w=t.referrer||"",I=Ow(e),E=Nw(e),F=Gq(e),k=kw(e),T=_w(e),q=Pw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:Rw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:C}},...(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:qy(e),firstResult:e.pagination.firstResult}),tab:h,locale:S,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...F,...(T??{}),...(k&&{excerptLength:k}),...(q&&{dictionaryFieldContext:q}),sortCriteria:E,...(I&&{facetOptions:I}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Mw=(e,t)=>{let r=Zo(e)?.q,n=Vw(e),o=Wo(e.configuration.analytics,t,{actionCause:Uy(e)}),a=cy(e),i=tS(e),p=eS(e),f=ly(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:f,...(i?.length&&{searchHub:i}),...(p?.length&&{pipeline:p}),...o,locale:a}},Vw=e=>yd(e)?.map(t=>Ay(t,vy())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),Gq=e=>({actionsHistory:e.configuration.analytics.enabled?Vt.getInstance().getHistory():[]}),$q=e=>{let t=Fw(e),r=My(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Od=["searching","thinking","answering"];function _d(e){return e.toLowerCase()}function rS(){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 jw=["text/plain","text/markdown"];var _i=new $({required:!0}),Lw=new $,Ni=new pe({required:!0}),nS={id:_i,title:_i,uri:_i,permanentid:_i,clickUri:Lw},Nd=new $({required:!0,constrainTo:jw}),Uw=new $({required:!0,constrainTo:Od}),Qw=e=>({...e,name:_d(e.name)}),Di=P("generatedAnswer/setIsVisible",e=>_(e,Ni)),qi=P("generatedAnswer/setAnswerId",e=>_(e,z)),Dd=P("generatedAnswer/setAnswerGenerationMode",e=>_(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Qc=P("generatedAnswer/setIsEnabled",e=>_(e,Ni)),ea=P("generatedAnswer/updateMessage",e=>_(e,{textDelta:_i})),ta=P("generatedAnswer/updateCitations",e=>_(e,{citations:new ne({required:!0,each:new Y({values:nS})})})),ra=P("generatedAnswer/updateError",e=>_(e,{message:Lw,code:new oe({min:0})})),lr=P("generatedAnswer/resetAnswer"),qd=P("generatedAnswer/like"),Md=P("generatedAnswer/dislike"),Vd=P("generatedAnswer/feedbackModal/open"),Bc=P("generatedAnswer/expand"),jd=P("generatedAnswer/collapse"),Ld=P("generatedAnswer/setId",e=>_(e,{id:new $({required:!0})})),Ud=P("generatedAnswer/feedbackModal/close"),Mi=P("generatedAnswer/sendFeedback"),Jr=P("generatedAnswer/setIsLoading",e=>_(e,Ni)),Jo=P("generatedAnswer/setIsStreaming",e=>_(e,Ni)),na=P("generatedAnswer/setAnswerContentFormat",e=>_(e,Nd)),Qd=P("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new ne({each:Nd,default:["text/plain"]})})),Bd=P("knowledge/updateAnswerConfigurationId",e=>_(e,_i)),Gd=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Hu)),Gc=P("generatedAnswer/setIsAnswerGenerated",e=>_(e,Ni)),oa=P("generatedAnswer/setCannotAnswer",e=>_(e,Ni)),oS=P("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new Y({}))),$d=P("generatedAnswer/startStep",e=>_(Qw(e),{name:Uw,startedAt:new oe({min:0,required:!0})})),Hd=P("generatedAnswer/finishStep",e=>_(Qw(e),{name:Uw,finishedAt:new oe({min:0,required:!0})})),Bw=fe("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{search:i}=a(),{queryExecuted:p}=i,{setAbortControllerRef:f}=e,m=yield Dw(r),g=(h,S)=>{switch(h){case"genqa.headerMessageType":{let b=JSON.parse(S);n(na(b.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(S)));break;case"genqa.citationsType":n(ta(JSON.parse(S)));break;case"genqa.endOfStreamType":{let b=JSON.parse(S).answerGenerated,w=a().generatedAnswer.answerId,I=p.length!==0&&!b,E=b?!a().generatedAnswer.answer?.length:void 0;n(oa(I)),n(Jo(!1)),n(Gc(b)),n(ki(b,w,E)),n(Oi());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Jr(!0));let C=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,x=o.streamingClient?.streamGeneratedAnswer(m,{write:h=>{C(m)&&(n(Jr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{C(m)&&n(ra(h))},close:()=>{C(m)&&n(Jo(!1))},resetAnswer:()=>{C(m)&&n(lr())}});x?f(x):n(Jr(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),zd=fe("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.answerConfigurationId){let i=qw(a,n);r(oS(i)),yield r(Wd(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 Hq=/*#__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=Ke(i,a);return{data:dw({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(C){if(C instanceof String)throw new Error("The provided 'request' must be a Request object.");let x=C.url,h={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(S=>{h[S]=C[S]}),h.duplex="half",h.body=yield C.text(),v(x,h)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}}catch(m){return{error:m}}});return function Hq(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),Yd=ww({reducerPath:"answer",baseQuery:fw(Hq,{maxRetries:3}),endpoints:()=>({})});var zq=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},Wq=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},Yq=(e,t)=>{e.citations=t.citations},Kq=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},Xq=(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})`)},Zq=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&Xq(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(zq(t,o),r(na(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(Wq(t,o),r(ea({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(Yq(t,o),r(ta({citations:o.citations})));break;case"genqa.endOfStreamType":{Kq(t,o);let a=t.answerId,i=o.answerGenerated??!1,p=i?!t.answer?.length:void 0;r(ki(i,a,p)),r(Oi());break}}},Jq=(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`},aa=Yd.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}){yield n;let{configuration:i,generatedAnswer:p,insightConfiguration:f}=r(),{organizationId:m,environment:g,accessToken:C}=i,x=Ke(m,g),h=Jq(x,m,p.answerConfigurationId,f?.insightId);yield Qu(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${C}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(S){let b=S.headers.get("x-answer-id");b&&o(w=>{w.answerId=b,a(qi(b))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:S=>{o(b=>{Zq(S,b,a)})},onerror:S=>{throw S},onclose:()=>{o(S=>{a(oa(!S.generated))})}})}).apply(this,arguments)}})})}),Wd=e=>aa.endpoints.getAnswer.initiate(e),aS=e=>{let t=kd(e);return aa.endpoints.getAnswer.select(t??Xo)(e)};d();c();l();u();var Gw=de($n,e=>e);d();c();l();u();function eM(e){let t=e.payload?.analyticsAction;return $w(e)&&!ee(t)}function $w(e){return"type"in e}var Hw=e=>t=>r=>{let n;eM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return $w(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 Kd={q:new $,enableQuerySyntax:new pe,aq:new $,cq:new $,firstResult:new oe({min:0}),numberOfResults:new oe({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 it=P("searchParameters/restore",e=>_(e,Kd)),Xd=P("searchParameters/restoreTab",e=>_(e,z));d();c();l();u();var Zd=P("tab/register",e=>{let t=new Y({values:{id:z,expression:Xe}});return _(e,t)}),_t=P("tab/updateActiveTab",e=>_(e,z));d();c();l();u();var Jd=Fr(Vu(),1),Yw=Fr(zw(),1),Kw=Fr(Ww(),1);Jd.default.extend(Kw.default);Jd.default.extend(Yw.default);var ep=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Jd.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 tM=/(^|; )Coveo-Pendragon=([^;]*)/,rM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Xw(){return typeof window>"u"?!1:tM.exec(document.cookie)?.pop()||null}function Zw(){return typeof window>"u"?!1:rM.test(document.cookie)}var tp=de(ep(),e=>e.addCase(yi,(t,r)=>{nM(t,r.payload)}).addCase(Si,(t,r)=>{oM(t,r.payload)}).addCase(Bl,(t,r)=>{aM(t,r.payload)}).addCase(Gl,t=>{t.analytics.enabled=!1}).addCase($l,t=>{t.analytics.enabled=!0}).addCase(ax,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ix,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(_t,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Xd,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(it,(t,r)=>{ee(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(sx,(t,{payload:r})=>{iM(t,r)}));function nM(e,t){ee(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ee(t.organizationId)||(e.organizationId=t.organizationId)}function oM(e,t){ee(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ee(t.locale)||(e.search.locale=t.locale),ee(t.timezone)||(e.search.timezone=t.timezone),ee(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function aM(e,t){ee(t.enabled)||(e.analytics.enabled=t.enabled),ee(t.originContext)||(e.analytics.originContext=t.originContext),ee(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ee(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ee(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ee(t.trackingId)||(e.analytics.trackingId=t.trackingId),ee(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ee(t.source)||(e.analytics.source=t.source);try{let r=Xw();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ee(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ee(t.anonymous)||(e.analytics.anonymous=t.anonymous),ee(t.deviceId)||(e.analytics.deviceId=t.deviceId),ee(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ee(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function iM(e,t){e.knowledge.agentId=t;try{let r=Zw();ee(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var be=tp;d();c();l();u();function sM(e){return e.instantlyCallable}var Jw=()=>e=>t=>e(sM(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 eR(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 lS,cM=new Uint8Array(16);function dS(){if(!lS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");lS=crypto.getRandomValues.bind(crypto)}return lS(cM)}d();c();l();u();d();c();l();u();var uM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pS={randomUUID:uM};function lM(e,t,r){if(pS.randomUUID&&!t&&!e)return pS.randomUUID();e=e||{};let n=e.random??e.rng?.()??dS();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 eR(n)}var so=lM;d();c();l();u();d();c();l();u();var R={};Bs(R,{BRAND:()=>qM,DIRTY:()=>ia,EMPTY_PATH:()=>mM,INVALID:()=>Ae,NEVER:()=>AV,OK:()=>jt,ParseStatus:()=>Dt,Schema:()=>_e,ZodAny:()=>lo,ZodArray:()=>Dn,ZodBigInt:()=>ca,ZodBoolean:()=>ua,ZodBranded:()=>Hc,ZodCatch:()=>Aa,ZodDate:()=>la,ZodDefault:()=>va,ZodDiscriminatedUnion:()=>op,ZodEffects:()=>br,ZodEnum:()=>ya,ZodError:()=>er,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>ip,ZodIntersection:()=>ma,ZodIssueCode:()=>X,ZodLazy:()=>ga,ZodLiteral:()=>ha,ZodMap:()=>Bi,ZodNaN:()=>$i,ZodNativeEnum:()=>Sa,ZodNever:()=>Or,ZodNull:()=>pa,ZodNullable:()=>rn,ZodNumber:()=>sa,ZodObject:()=>tr,ZodOptional:()=>Ar,ZodParsedType:()=>ue,ZodPipeline:()=>zc,ZodPromise:()=>po,ZodReadonly:()=>Ca,ZodRecord:()=>ap,ZodSchema:()=>_e,ZodSet:()=>Gi,ZodString:()=>uo,ZodSymbol:()=>Ui,ZodTransformer:()=>br,ZodTuple:()=>tn,ZodType:()=>_e,ZodUndefined:()=>da,ZodUnion:()=>fa,ZodUnknown:()=>Nn,ZodVoid:()=>Qi,addIssueToContext:()=>se,any:()=>$M,array:()=>YM,bigint:()=>LM,boolean:()=>dR,coerce:()=>vV,custom:()=>cR,date:()=>UM,datetimeRegex:()=>iR,defaultErrorMap:()=>On,discriminatedUnion:()=>JM,effect:()=>dV,enum:()=>cV,function:()=>aV,getErrorMap:()=>Vi,getParsedType:()=>en,instanceof:()=>VM,intersection:()=>eV,isAborted:()=>rp,isAsync:()=>ji,isDirty:()=>np,isValid:()=>co,late:()=>MM,lazy:()=>iV,literal:()=>sV,makeIssue:()=>$c,map:()=>nV,nan:()=>jM,nativeEnum:()=>uV,never:()=>zM,null:()=>GM,nullable:()=>fV,number:()=>lR,object:()=>KM,objectUtil:()=>fS,oboolean:()=>SV,onumber:()=>yV,optional:()=>pV,ostring:()=>hV,pipeline:()=>gV,preprocess:()=>mV,promise:()=>lV,quotelessJson:()=>dM,record:()=>rV,set:()=>oV,setErrorMap:()=>fM,strictObject:()=>XM,string:()=>uR,symbol:()=>QM,transformer:()=>dV,tuple:()=>tV,undefined:()=>BM,union:()=>ZM,unknown:()=>HM,util:()=>Me,void:()=>WM});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Me;(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})(Me||(Me={}));var fS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(fS||(fS={}));var ue=Me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),en=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=Me.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"]),dM=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,Me.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 pM=(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,Me.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Me.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Me.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Me.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}"`:Me.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,Me.assertNever(e)}return{message:r}},On=pM;var tR=On;function fM(e){tR=e}function Vi(){return tR}d();c();l();u();var $c=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}},mM=[];function se(e,t){let r=Vi(),n=$c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===On?void 0:On].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 Ae;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 Ae;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}}},Ae=Object.freeze({status:"aborted"}),ia=e=>({status:"dirty",value:e}),jt=e=>({status:"valid",value:e}),rp=e=>e.status==="aborted",np=e=>e.status==="dirty",co=e=>e.status==="valid",ji=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(me||(me={}));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}},rR=(e,t)=>{if(co(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 Te(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 _e=class{get description(){return this._def.description}_getType(t){return en(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:en(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:en(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ji(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:en(t)},o=this._parseSync({data:t,path:n.path,parent:n});return rR(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:en(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return co(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=>co(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:en(t)},o=_this32._parse({data:t,path:n.path,parent:n}),a=yield ji(o)?o:Promise.resolve(o);return rR(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:xe.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 rn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dn.create(this)}promise(){return po.create(this,this._def)}or(t){return fa.create([this,t],this._def)}and(t){return ma.create(this,t,this._def)}transform(t){return new br({...Te(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new va({...Te(this._def),innerType:this,defaultValue:r,typeName:xe.ZodDefault})}brand(){return new Hc({typeName:xe.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Aa({...Te(this._def),innerType:this,catchValue:r,typeName:xe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return Ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gM=/^c[^\s-]{8,}$/i,hM=/^[0-9a-z]+$/,yM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SM=/^[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,vM=/^[a-z0-9_-]{21}$/i,AM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CM=/^[-+]?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)?)??$/,bM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",mS,wM=/^(?:(?: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])$/,RM=/^(?:(?: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])$/,IM=/^(([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]))$/,EM=/^(([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])$/,FM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oR="((\\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])))",PM=new RegExp(`^${oR}$`);function aR(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 kM(e){return new RegExp(`^${aR(e)}$`)}function iR(e){let t=`${oR}T${aR(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 OM(e,t){return!!((t==="v4"||!t)&&wM.test(e)||(t==="v6"||!t)&&IM.test(e))}function _M(e,t){if(!AM.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 NM(e,t){return!!((t==="v4"||!t)&&RM.test(e)||(t==="v6"||!t)&&EM.test(e))}var uo=class e extends _e{_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}),Ae}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")bM.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")mS||(mS=new RegExp(xM,"u")),mS.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")SM.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")vM.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")gM.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")hM.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")yM.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"?iR(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"?PM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?kM(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"?CM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?OM(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"?_M(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"?NM(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"?FM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?TM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:a.message}),n.dirty()):Me.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,...me.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.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,...me.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,...me.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...me.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...me.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...me.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...me.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...me.errToObj(r)})}nonempty(t){return this.min(1,me.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}};uo.create=e=>new uo({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Te(e)});function DM(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 sa=class e extends _e{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}),Ae}let n,o=new Dt;for(let a of this._def.checks)a.kind==="int"?Me.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"?DM(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()):Me.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,me.toString(r))}gt(t,r){return this.setLimit("min",t,!1,me.toString(r))}lte(t,r){return this.setLimit("max",t,!0,me.toString(r))}lt(t,r){return this.setLimit("max",t,!1,me.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:me.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.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"&&Me.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)}};sa.create=e=>new sa({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var ca=class e extends _e{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()):Me.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}),Ae}gte(t,r){return this.setLimit("min",t,!0,me.toString(r))}gt(t,r){return this.setLimit("min",t,!1,me.toString(r))}lte(t,r){return this.setLimit("max",t,!0,me.toString(r))}lt(t,r){return this.setLimit("max",t,!1,me.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:me.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:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:me.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}};ca.create=e=>new ca({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var ua=class extends _e{_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}),Ae}return jt(t.data)}};ua.create=e=>new ua({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var la=class e extends _e{_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}),Ae}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_date}),Ae}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()):Me.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:me.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:me.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}};la.create=e=>new la({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Te(e)});var Ui=class extends _e{_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}),Ae}return jt(t.data)}};Ui.create=e=>new Ui({typeName:xe.ZodSymbol,...Te(e)});var da=class extends _e{_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}),Ae}return jt(t.data)}};da.create=e=>new da({typeName:xe.ZodUndefined,...Te(e)});var pa=class extends _e{_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}),Ae}return jt(t.data)}};pa.create=e=>new pa({typeName:xe.ZodNull,...Te(e)});var lo=class extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return jt(t.data)}};lo.create=e=>new lo({typeName:xe.ZodAny,...Te(e)});var Nn=class extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return jt(t.data)}};Nn.create=e=>new Nn({typeName:xe.ZodUnknown,...Te(e)});var Or=class extends _e{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),Ae}};Or.create=e=>new Or({typeName:xe.ZodNever,...Te(e)});var Qi=class extends _e{_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}),Ae}return jt(t.data)}};Qi.create=e=>new Qi({typeName:xe.ZodVoid,...Te(e)});var Dn=class e extends _e{_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}),Ae;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:me.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:me.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:me.toString(r)}})}nonempty(t){return this.min(1,t)}};Dn.create=(e,t)=>new Dn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Te(t)});function Li(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(Li(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Dn?new Dn({...e._def,type:Li(e.element)}):e instanceof Ar?Ar.create(Li(e.unwrap())):e instanceof rn?rn.create(Li(e.unwrap())):e instanceof tn?tn.create(e.items.map(t=>Li(t))):e}var tr=class e extends _e{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=Me.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}),Ae}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof Or&&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],C=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Cr(o,C,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof Or){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 C=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Cr(o,C,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 C=yield g.key,x=yield g.value;m.push({key:C,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 me.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:me.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:xe.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 Me.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 Me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Li(this)}partial(t){let r={};for(let n of Me.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 Me.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 sR(Me.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});var fa=class extends _e{_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}),Ae}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}),Ae}}get options(){return this._def.options}};fa.create=(e,t)=>new fa({options:e,typeName:xe.ZodUnion,...Te(t)});var _n=e=>e instanceof ga?_n(e.schema):e instanceof br?_n(e.innerType()):e instanceof ha?[e.value]:e instanceof ya?e.options:e instanceof Sa?Me.objectValues(e.enum):e instanceof va?_n(e._def.innerType):e instanceof da?[void 0]:e instanceof pa?[null]:e instanceof Ar?[void 0,..._n(e.unwrap())]:e instanceof rn?[null,..._n(e.unwrap())]:e instanceof Hc||e instanceof Ca?_n(e.unwrap()):e instanceof Aa?_n(e._def.innerType):[],op=class e extends _e{_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}),Ae;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]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let a of r){let i=_n(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:xe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function gS(e,t){let r=en(e),n=en(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Me.objectKeys(t),a=Me.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=gS(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=gS(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 ma=class extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(rp(a)||rp(i))return Ae;let p=gS(a.value,i.value);return p.valid?((np(a)||np(i))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),Ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([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}))}};ma.create=(e,t,r)=>new ma({left:e,right:t,typeName:xe.ZodIntersection,...Te(r)});var tn=class e extends _e{_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}),Ae;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"}),Ae;!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})}};tn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tn({items:e,typeName:xe.ZodTuple,rest:null,...Te(t)})};var ap=class e extends _e{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}),Ae;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 _e?new e({keyType:t,valueType:r,typeName:xe.ZodRecord,...Te(n)}):new e({keyType:uo.create(),valueType:t,typeName:xe.ZodRecord,...Te(r)})}},Bi=class extends _e{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}),Ae;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 Ae;(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 Ae;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Bi.create=(e,t,r)=>new Bi({valueType:t,keyType:e,typeName:xe.ZodMap,...Te(r)});var Gi=class e extends _e{_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}),Ae;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 Ae;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:me.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:me.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Gi.create=(e,t)=>new Gi({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Te(t)});var ip=class e extends _e{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}),Ae;function n(p,f){return $c({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),On].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return $c({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),On].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 po){let p=this;return jt(/*#__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}),C=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(C,a).catch(h=>{throw m.addIssue(o(C,h)),m})}))}else{let p=this;return jt(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),C=p._def.returns.safeParse(g,a);if(!C.success)throw new er([o(g,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tn.create(t).rest(Nn.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||tn.create([]).rest(Nn.create()),returns:r||Nn.create(),typeName:xe.ZodFunction,...Te(n)})}},ga=class extends _e{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})}};ga.create=(e,t)=>new ga({getter:e,typeName:xe.ZodLazy,...Te(t)});var ha=class extends _e{_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}),Ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};ha.create=(e,t)=>new ha({value:e,typeName:xe.ZodLiteral,...Te(t)});function sR(e,t){return new ya({values:e,typeName:xe.ZodEnum,...Te(t)})}var ya=class e extends _e{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Me.joinValues(n),received:r.parsedType,code:X.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{received:r.data,code:X.invalid_enum_value,options:n}),Ae}return jt(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})}};ya.create=sR;var Sa=class extends _e{_parse(t){let r=Me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Me.objectValues(r);return se(n,{expected:Me.joinValues(o),received:n.parsedType,code:X.invalid_type}),Ae}if(this._cache||(this._cache=new Set(Me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Me.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),Ae}return jt(t.data)}get enum(){return this._def.values}};Sa.create=(e,t)=>new Sa({values:e,typeName:xe.ZodNativeEnum,...Te(t)});var po=class extends _e{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}),Ae;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return jt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};po.create=(e,t)=>new po({type:e,typeName:xe.ZodPromise,...Te(t)});var br=class extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.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 Ae;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?Ae:f.status==="dirty"?ia(f.value):r.value==="dirty"?ia(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return Ae;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?Ae:p.status==="dirty"?ia(p.value):r.value==="dirty"?ia(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"?Ae:(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"?Ae:(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(!co(i))return Ae;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=>co(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):Ae);Me.assertNever(o)}};br.create=(e,t,r)=>new br({schema:e,typeName:xe.ZodEffects,effect:t,...Te(r)});br.createWithPreprocess=(e,t,r)=>new br({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Te(r)});var Ar=class extends _e{_parse(t){return this._getType(t)===ue.undefined?jt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:xe.ZodOptional,...Te(t)});var rn=class extends _e{_parse(t){return this._getType(t)===ue.null?jt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};rn.create=(e,t)=>new rn({innerType:e,typeName:xe.ZodNullable,...Te(t)});var va=class extends _e{_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}};va.create=(e,t)=>new va({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Aa=class extends _e{_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 ji(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}};Aa.create=(e,t)=>new Aa({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var $i=class extends _e{_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}),Ae}return{status:"valid",value:t.data}}};$i.create=e=>new $i({typeName:xe.ZodNaN,...Te(e)});var qM=Symbol("zod_brand"),Hc=class extends _e{_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 _e{_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"?Ae:a.status==="dirty"?(r.dirty(),ia(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"?Ae: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:xe.ZodPipeline})}},Ca=class extends _e{_parse(t){let r=this._def.innerType._parse(t),n=o=>(co(o)&&(o.value=Object.freeze(o.value)),o);return ji(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ca.create=(e,t)=>new Ca({innerType:e,typeName:xe.ZodReadonly,...Te(t)});function nR(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function cR(e,t={},r){return e?lo.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=nR(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=nR(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):lo.create()}var MM={object:tr.lazycreate},xe;(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"})(xe||(xe={}));var VM=(e,t={message:`Input not instance of ${e.name}`})=>cR(r=>r instanceof e,t),uR=uo.create,lR=sa.create,jM=$i.create,LM=ca.create,dR=ua.create,UM=la.create,QM=Ui.create,BM=da.create,GM=pa.create,$M=lo.create,HM=Nn.create,zM=Or.create,WM=Qi.create,YM=Dn.create,KM=tr.create,XM=tr.strictCreate,ZM=fa.create,JM=op.create,eV=ma.create,tV=tn.create,rV=ap.create,nV=Bi.create,oV=Gi.create,aV=ip.create,iV=ga.create,sV=ha.create,cV=ya.create,uV=Sa.create,lV=po.create,dV=br.create,pV=Ar.create,fV=rn.create,mV=br.createWithPreprocess,gV=zc.create,hV=()=>uR().optional(),yV=()=>lR().optional(),SV=()=>dR().optional(),vV={string:e=>uo.create({...e,coerce:!0}),number:e=>sa.create({...e,coerce:!0}),boolean:e=>ua.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>la.create({...e,coerce:!0})};var AV=Ae;var CV=R.object({name:R.string(),arguments:R.string()}),bV=R.object({id:R.string(),type:R.literal("function"),function:CV,encryptedValue:R.string().optional()}),sp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),xV=R.object({type:R.literal("text"),text:R.string()}),wV=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),RV=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),cp=R.discriminatedUnion("type",[wV,RV]),IV=R.object({type:R.literal("image"),source:cp,metadata:R.unknown().optional()}),EV=R.object({type:R.literal("audio"),source:cp,metadata:R.unknown().optional()}),FV=R.object({type:R.literal("video"),source:cp,metadata:R.unknown().optional()}),TV=R.object({type:R.literal("document"),source:cp,metadata:R.unknown().optional()});var pR=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()}),fR=(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"]})},qle=pR.superRefine((e,t)=>{fR(e,t)}),PV=R.discriminatedUnion("type",[xV,IV,EV,FV,TV,pR]),kV=PV.superRefine((e,t)=>{e.type==="binary"&&fR(e,t)}),OV=sp.extend({role:R.literal("developer"),content:R.string()}),_V=sp.extend({role:R.literal("system"),content:R.string()}),NV=sp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(bV).optional()}),DV=sp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(kV)])}),qV=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),MV=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()}),mR=R.discriminatedUnion("role",[OV,_V,NV,DV,qV,MV,VV]),Mle=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),jV=R.object({description:R.string(),value:R.string()}),gR=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),LV=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(mR),tools:R.array(gR),context:R.array(jV),forwardedProps:R.any()}),UV=R.any(),lt=class extends Error{constructor(e){super(e)}},hS=class extends lt{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},QV=R.object({name:R.string(),description:R.string().optional()}),BV=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()}),GV=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),$V=R.object({supported:R.boolean().optional(),items:R.array(gR).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),HV=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),zV=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),WV=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(QV).optional()}),YV=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),KV=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),XV=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),ZV=R.object({input:KV.optional(),output:XV.optional()}),JV=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),ej=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional()}),Vle=R.object({identity:BV.optional(),transport:GV.optional(),tools:$V.optional(),output:HV.optional(),state:zV.optional(),multiAgent:WV.optional(),reasoning:YV.optional(),multimodal:ZV.optional(),execution:JV.optional(),humanInTheLoop:ej.optional(),custom:R.record(R.unknown()).optional()}),hR=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),V=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}({}),Ue=R.object({type:R.nativeEnum(V),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),tj=Ue.extend({type:R.literal(V.TEXT_MESSAGE_START),messageId:R.string(),role:hR.default("assistant"),name:R.string().optional()}),yR=Ue.extend({type:R.literal(V.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),rj=Ue.extend({type:R.literal(V.TEXT_MESSAGE_END),messageId:R.string()}),nj=Ue.extend({type:R.literal(V.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:hR.optional(),delta:R.string().optional(),name:R.string().optional()}),oj=Ue.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_START)}),aj=yR.omit({messageId:!0,type:!0}).extend({type:R.literal(V.THINKING_TEXT_MESSAGE_CONTENT)}),ij=Ue.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_END)}),sj=Ue.extend({type:R.literal(V.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),cj=Ue.extend({type:R.literal(V.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),uj=Ue.extend({type:R.literal(V.TOOL_CALL_END),toolCallId:R.string()}),lj=Ue.extend({messageId:R.string(),type:R.literal(V.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),dj=Ue.extend({type:R.literal(V.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),pj=Ue.extend({type:R.literal(V.THINKING_START),title:R.string().optional()}),fj=Ue.extend({type:R.literal(V.THINKING_END)}),mj=Ue.extend({type:R.literal(V.STATE_SNAPSHOT),snapshot:UV}),gj=Ue.extend({type:R.literal(V.STATE_DELTA),delta:R.array(R.any())}),hj=Ue.extend({type:R.literal(V.MESSAGES_SNAPSHOT),messages:R.array(mR)}),yj=Ue.extend({type:R.literal(V.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),Sj=Ue.extend({type:R.literal(V.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),vj=Ue.extend({type:R.literal(V.RAW),event:R.any(),source:R.string().optional()}),Aj=Ue.extend({type:R.literal(V.CUSTOM),name:R.string(),value:R.any()}),Cj=Ue.extend({type:R.literal(V.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:LV.optional()}),bj=Ue.extend({type:R.literal(V.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),xj=Ue.extend({type:R.literal(V.RUN_ERROR),message:R.string(),code:R.string().optional()}),wj=Ue.extend({type:R.literal(V.STEP_STARTED),stepName:R.string()}),Rj=Ue.extend({type:R.literal(V.STEP_FINISHED),stepName:R.string()}),Ij=R.union([R.literal("tool-call"),R.literal("message")]),Ej=Ue.extend({type:R.literal(V.REASONING_START),messageId:R.string()}),Fj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),Tj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),Pj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_END),messageId:R.string()}),kj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),Oj=Ue.extend({type:R.literal(V.REASONING_END),messageId:R.string()}),_j=Ue.extend({type:R.literal(V.REASONING_ENCRYPTED_VALUE),subtype:Ij,entityId:R.string(),encryptedValue:R.string()}),up=R.discriminatedUnion("type",[tj,yR,rj,nj,pj,fj,oj,aj,ij,sj,cj,uj,dj,lj,mj,gj,hj,yj,Sj,vj,Aj,Cj,bj,xj,wj,Rj,Ej,Fj,Tj,Pj,kj,Oj,_j]);d();c();l();u();var yS={};Bs(yS,{JsonPatchError:()=>pt,_areEquals:()=>Kc,applyOperation:()=>ba,applyPatch:()=>fo,applyReducer:()=>Vj,deepClone:()=>qj,getValueByPointer:()=>mp,validate:()=>vR,validator:()=>gp});d();c();l();u();d();c();l();u();var Nj=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)}}(),Dj=Object.prototype.hasOwnProperty;function dp(e,t){return Dj.call(e,t)}function pp(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)dp(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 fp(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 nn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function lp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(lp(e[t]))return!0}else if(typeof e=="object"){for(var n=pp(e),o=n.length,a=0;a<o;a++)if(lp(e[n[a]]))return!0}}return!1}function SR(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 Yc=function(e){Nj(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,SR(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=SR(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var pt=Yc,qj=qt,Hi={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=mp(r,this.path);n&&(n=qt(n));var o=ba(r,{op:"remove",path:this.from}).removed;return ba(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=mp(r,this.from);return ba(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Kc(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Mj={add:function(e,t,r){return fp(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:Hi.move,copy:Hi.copy,test:Hi.test,_get:Hi._get};function mp(e,t){if(t=="")return e;var r={op:"_get",path:t};return ba(e,r),r.value}function ba(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):gp(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=mp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Kc(e,t.value),i.test===!1)throw new pt("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 pt("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,C=f.length,x=void 0,h=void 0,S=void 0;for(typeof r=="function"?S=r:S=gp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Wc(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==C-1&&(x=t.path),x!==void 0&&S(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!fp(h))throw new pt("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);fp(h)&&(h=~~h)}if(g>=C){if(r&&t.op==="add"&&h>m.length)throw new pt("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=Mj[t.op].call(t,m,h,e);if(i.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=C){var i=Hi[t.op].call(t,m,h,e);if(i.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<C&&(!m||typeof m!="object"))throw new pt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function fo(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new pt("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]=ba(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function Vj(e,t,r){var n=ba(e,t);if(n.test===!1)throw new pt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function gp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new pt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Hi[e.op]){if(typeof e.path!="string")throw new pt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new pt("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 pt("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 pt("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")&&lp(e.value))throw new pt("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 pt("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 pt("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=vR([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new pt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new pt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function vR(e,t,r){try{if(!Array.isArray(e))throw new pt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)fo(qt(t),qt(e),r||!0);else{r=r||gp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof pt)return o;throw o}}function Kc(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(!Kc(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],!Kc(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var CS={};Bs(CS,{compare:()=>Hj,generate:()=>SS,observe:()=>$j,unobserve:()=>Gj});d();c();l();u();var vS=new WeakMap,jj=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),Lj=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function Uj(e){return vS.get(e)}function Qj(e,t){return e.observers.get(t)}function Bj(e,t){e.observers.delete(t.callback)}function Gj(e,t){t.unobserve()}function $j(e,t){var r=[],n,o=Uj(e);if(!o)o=new jj(e),vS.set(e,o);else{var a=Qj(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(){SS(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(){SS(n),clearTimeout(n.next),Bj(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 Lj(t,n)),n}function SS(e,t){t===void 0&&(t=!1);var r=vS.get(e.object);AS(r.value,e.object,e.patches,"",t),e.patches.length&&fo(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function AS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=pp(t),i=pp(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],C=e[g];if(dp(t,g)&&!(t[g]===void 0&&C!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof C=="object"&&C!=null&&typeof x=="object"&&x!=null&&Array.isArray(C)===Array.isArray(x)?AS(C,x,r,n+"/"+nn(g),o):C!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"replace",path:n+"/"+nn(g),value:qt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"remove",path:n+"/"+nn(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];!dp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+nn(g),value:qt(t[g])})}}}function Hj(e,t,r){r===void 0&&(r=!1);var n=[];return AS(e,t,n,"",r),n}var ude=Object.assign({},yS,CS,{JsonPatchError:Yc,deepClone:qt,escapePathComponent:nn,unescapePathComponent:Wc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var bS=function(e,t){return bS=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])},bS(e,t)};function on(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");bS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function AR(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(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function hp(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 qn(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 zi(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 Wi(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 xa(e){return this instanceof xa?(this.v=e,this):new xa(e)}function CR(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(S){return Promise.resolve(S).then(h,C)}}function p(h,S){n[h]&&(o[h]=function(b){return new Promise(function(w,I){a.push([h,b,w,I])>1||f(h,b)})},S&&(o[h]=S(o[h])))}function f(h,S){try{m(n[h](S))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof xa?Promise.resolve(h.value.v).then(g,C):x(a[0][2],h)}function g(h){f("next",h)}function C(h){f("throw",h)}function x(h,S){h(S),a.shift(),a.length&&f(a[0][0],a[0][1])}}function bR(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 qn=="function"?qn(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 qe(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Yi(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 yp=Yi(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
33
34
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
34
- `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Kc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ya=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=Dn(a),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(x){t={error:x}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(_e(h))try{h()}catch(x){i=x instanceof mp?x.errors:[x]}var C=this._finalizers;if(C){this._finalizers=null;try{for(var b=Dn(C),g=b.next();!g.done;g=b.next()){var S=g.value;try{nR(S)}catch(x){i=i??[],x instanceof mp?i=za(za([],Ha(i)),Ha(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{g&&!g.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new mp(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nR(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)&&Kc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Kc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var uS=Ya.EMPTY;function gp(e){return e instanceof Ya||e&&"closed"in e&&_e(e.remove)&&_e(e.add)&&_e(e.unsubscribe)}function nR(e){_e(e)?e():e.unsubscribe()}d();c();l();u();var Or={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var Ka={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ka.delegate;return o?.setTimeout?o.setTimeout.apply(o,za([e,t],Ha(r))):setTimeout.apply(void 0,za([e,t],Ha(r)))},clearTimeout:function(e){var t=Ka.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function hp(e){Ka.setTimeout(function(){var t=Or.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function Xc(){}d();c();l();u();var oR=function(){return lS("C",void 0,void 0)}();function iR(e){return lS("E",void 0,e)}function aR(e){return lS("N",e,void 0)}function lS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var xi=null;function Xa(e){if(Or.useDeprecatedSynchronousErrorHandling){var t=!xi;if(t&&(xi={errorThrown:!1,error:null}),e(),t){var r=xi,n=r.errorThrown,o=r.error;if(xi=null,n)throw o}}else e()}function sR(e){Or.useDeprecatedSynchronousErrorHandling&&xi&&(xi.errorThrown=!0,xi.error=e)}var Jc=function(e){nn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,gp(r)&&r.add(n)):n.destination=oj,n}return t.create=function(r,n,o){return new Sp(r,n,o)},t.prototype.next=function(r){this.isStopped?pS(aR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?pS(iR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?pS(oR,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}(Ya);var tj=Function.prototype.bind;function dS(e,t){return tj.call(e,t)}var rj=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){yp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){yp(n)}else yp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){yp(r)}},e}(),Sp=function(e){nn(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(_e(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&Or.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&dS(r.next,p),error:r.error&&dS(r.error,p),complete:r.complete&&dS(r.complete,p)}):a=r}return i.destination=new rj(a),i}return t}(Jc);function yp(e){Or.useDeprecatedSynchronousErrorHandling?sR(e):hp(e)}function nj(e){throw e}function pS(e,t){var r=Or.onStoppedNotification;r&&Ka.setTimeout(function(){return r(e,t)})}var oj={closed:!0,next:Xc,error:nj,complete:Xc};d();c();l();u();var Ja=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function Za(e){return e}function vp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return fS(e)}function fS(e){return e.length===0?Za:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var st=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=aj(t)?t:new Sp(t,r,n);return Xa(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=cR(r),new r(function(o,i){var a=new Sp({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[Ja]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return fS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cR(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 cR(e){var t;return(t=e??Or.Promise)!==null&&t!==void 0?t:Promise}function ij(e){return e&&_e(e.next)&&_e(e.error)&&_e(e.complete)}function aj(e){return e&&e instanceof Jc||ij(e)&&gp(e)}d();c();l();u();function sj(e){return _e(e?.lift)}function yt(e){return function(t){if(sj(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 cj(e,t,r,n,o)}var cj=function(e){nn(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(h){r.error(h)}}:e.prototype._next,f._error=i?function(m){try{i(m)}catch(h){r.error(h)}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}(Jc);d();c();l();u();d();c();l();u();var uR=Wa(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var on=function(e){nn(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 uR},t.prototype.next=function(r){var n=this;Xa(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Dn(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;Xa(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;Xa(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?uS:(this.currentObservers=null,p.push(r),new Ya(function(){n.currentObservers=null,Kc(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 st;return r.source=this,r},t.create=function(r,n){return new lR(r,n)},t}(st);var lR=function(e){nn(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:uS},t}(on);d();c();l();u();d();c();l();u();var mS={now:function(){return(mS.delegate||Date).now()},delegate:void 0};var Ap=function(e){nn(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,h=1;h<i.length&&i[h]<=f;h+=2)m=h;m&&i.splice(0,m+1)}},t}(on);d();c();l();u();var Cp=new st(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function dR(e){return e&&_e(e.schedule)}function uj(e){return e[e.length-1]}function pR(e){return dR(uj(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 bp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function xp(e){return _e(e?.then)}d();c();l();u();function wp(e){return _e(e[Ja])}d();c();l();u();function Rp(e){return Symbol.asyncIterator&&_e(e?.[Symbol.asyncIterator])}d();c();l();u();function Ip(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 lj(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ep=lj();function Fp(e){return _e(e?.[Ep])}d();c();l();u();function Tp(e){return tR(this,arguments,function(){var r,n,o,i;return fp(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,bi(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,bi(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,bi(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 Pp(e){return _e(e?.getReader)}function Rt(e){if(e instanceof st)return e;if(e!=null){if(wp(e))return dj(e);if(bp(e))return pj(e);if(xp(e))return fj(e);if(Rp(e))return fR(e);if(Fp(e))return mj(e);if(Pp(e))return gj(e)}throw Ip(e)}function dj(e){return new st(function(t){var r=e[Ja]();if(_e(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function pj(e){return new st(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function fj(e){return new st(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,hp)})}function mj(e){return new st(function(t){var r,n;try{for(var o=Dn(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 fR(e){return new st(function(t){hj(e,t).catch(function(r){return t.error(r)})})}function gj(e){return fR(Tp(e))}function hj(e,t){var r,n,o,i;return eR(this,void 0,void 0,function(){var a,p;return fp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=rR(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 br(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 kp(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(wt(n,function(o){return br(n,e,function(){return n.next(o)},t)},function(){return br(n,e,function(){return n.complete()},t)},function(o){return br(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Op(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mR(e,t){return Rt(e).pipe(Op(t),kp(t))}d();c();l();u();function gR(e,t){return Rt(e).pipe(Op(t),kp(t))}d();c();l();u();function hR(e,t){return new st(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 yR(e,t){return new st(function(r){var n;return br(r,t,function(){n=e[Ep](),br(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 _e(n?.return)&&n.return()}})}d();c();l();u();function _p(e,t){if(!e)throw new Error("Iterable cannot be null");return new st(function(r){br(r,t,function(){var n=e[Symbol.asyncIterator]();br(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function SR(e,t){return _p(Tp(e),t)}function vR(e,t){if(e!=null){if(wp(e))return mR(e,t);if(bp(e))return hR(e,t);if(xp(e))return gR(e,t);if(Rp(e))return _p(e,t);if(Fp(e))return yR(e,t);if(Pp(e))return SR(e,t)}throw Ip(e)}function wi(e,t){return t?vR(e,t):Rt(e)}function dt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pR(e);return wi(e,r)}d();c();l();u();function ct(e,t){var r=_e(e)?e:function(){return e},n=function(o){return o.error(r())};return new st(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var AR=Wa(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Np(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 AR)}})})}d();c();l();u();function Ri(e,t){return yt(function(r,n){var o=0;r.subscribe(wt(n,function(i){n.next(e.call(t,i,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function CR(e,t,r,n,o,i,a,p){var f=[],m=0,h=0,C=!1,b=function(){C&&!f.length&&!m&&t.complete()},g=function(x){return m<n?S(x):f.push(x)},S=function(x){i&&t.next(x),m++;var w=!1;Rt(r(x,h++)).subscribe(wt(t,function(R){o?.(R),i?g(R):t.next(R)},function(){w=!0},void 0,function(){if(w)try{m--;for(var R=function(){var P=f.shift();a?br(t,a,function(){return S(P)}):S(P)};f.length&&m<n;)R();b()}catch(P){t.error(P)}}))};return e.subscribe(wt(t,g,function(){C=!0,b()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),_e(t)?rr(function(n,o){return Ri(function(i,a){return t(n,i,o,a)})(Rt(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return CR(n,o,e,r)}))}function gS(e){return e===void 0&&(e=1/0),rr(Za,e)}d();c();l();u();function hS(e){return new st(function(t){Rt(e()).subscribe(t)})}d();c();l();u();function Zc(e){return yt(function(t,r){var n=null,o=!1,i;n=t.subscribe(wt(r,void 0,void 0,function(a){i=Rt(e(a,Zc(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 Dp(e,t){return _e(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function yS(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 Ii(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function SS(e,t){return yt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(wt(n,function(f){o?.unsubscribe();var m=0,h=i++;Rt(e(f,h)).subscribe(o=wt(n,function(C){return n.next(t?t(f,C,h,m++):C)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function qp(e){return yt(function(t,r){Rt(e).subscribe(wt(r,function(){return r.complete()},Xc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function vS(e,t,r){var n=_e(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(wt(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)}))}):Za}d();c();l();u();d();c();l();u();function bR(e){return` \r
35
- `.indexOf(e)>=0}function Mp(e){for(var t=["topLevel"],r=0,n,o,i,a=function(P){return t.push(P)},p=function(P){return t[t.length-1]=P},f=function(P){n==null&&(n=r,o=t.length,i=P)},m=function(P){P===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},C=function(){return r--},b=function(P){if("0"<=P&&P<="9"){a("number");return}switch(P){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}},g=e.length;r<g;r++){var S=e[r];switch(t[t.length-1]){case"topLevel":b(S);break;case"string":switch(S){case"\"":h();break;case"\\":f("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":S==="u"?a("stringUnicode"):(m("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),h());break;case"number":S==="."?p("numberNeedsDigit"):S==="e"||S==="E"?p("numberNeedsExponent"):(S<"0"||S>"9")&&(C(),h());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(S==="+"||S==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(S<"a"||S>"z")&&(C(),h());break;case"arrayNeedsValue":S==="]"?h():bR(S)||(m("collectionItem"),p("arrayNeedsComma"),b(S));break;case"arrayNeedsComma":S==="]"?h():S===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":S==="}"?h():S==="\""&&(f("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":S===":"&&p("objectNeedsValue");break;case"objectNeedsValue":bR(S)||(m("collectionItem"),p("objectNeedsComma"),b(S));break;case"objectNeedsComma":S==="}"?h():S===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(P){return x.push(P.slice(e.length-e.lastIndexOf(P[0])))},R=t.length-1;R>=0;R--)switch(t[R]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function wR(){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 jp(e,t,r){for(let i=0;i<28;i=i+7){let a=e>>>i,p=!(!(a>>>7)&&t==0),f=(p?a|128:a)&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 i=3;i<31;i=i+7){let a=t>>>i,p=!!(a>>>7),f=(p?a|128:a)&255;if(r.push(f),!p)return}r.push(t>>>31&1)}}var Vp=4294967296;function AS(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>=Vp&&(o=o+(n/Vp|0),n=n%Vp)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?IR(n,o):bS(n,o)}function RR(e,t){let r=bS(e,t),n=r.hi&2147483648;n&&(r=IR(r.lo,r.hi));let o=CS(r.lo,r.hi);return n?"-"+o:o}function CS(e,t){if({lo:e,hi:t}=yj(e,t),t<=2097151)return String(Vp*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()+xR(a)+xR(i)}function yj(e,t){return{lo:e>>>0,hi:t>>>0}}function bS(e,t){return{lo:e|0,hi:t|0}}function IR(e,t){return t=~t,e?e=~e+1:t+=1,bS(e,t)}var xR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function xS(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 ER(){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 _r=Sj();function Sj(){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"&&(!!y.Deno||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()),FR(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),TR(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),FR(r),AS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),TR(r),AS(r)},dec(r,n){return RR(r,n)},uDec(r,n){return CS(r,n)}}}function FR(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function TR(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 RS(){if(y[wS]==null){let e=new y.TextEncoder,t=new y.TextDecoder;y[wS]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return y[wS]}var fo;(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"})(fo||(fo={}));var vj=34028234663852886e22,Aj=-34028234663852886e22,Cj=4294967295,bj=2147483647,xj=-2147483648,Ue=class{constructor(t=RS().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(PR(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return IS(t),xS(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){wj(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){PR(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){IS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return IS(t),t=(t<<1^t>>31)>>>0,xS(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=_r.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=_r.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=_r.enc(t);return jp(r.lo,r.hi,this.buf),this}sint64(t){let r=_r.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return jp(o,i,this.buf),this}uint64(t){let r=_r.uEnc(t);return jp(r.lo,r.hi,this.buf),this}},ge=class{constructor(t,r=RS().decodeUtf8){this.decodeUtf8=r,this.varint64=wR,this.uint32=ER,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case fo.Varint:for(;this.buf[this.pos++]&128;);break;case fo.Bit64:this.pos+=4;case fo.Bit32:this.pos+=4;break;case fo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case fo.StartGroup:for(;;){let[i,a]=this.tag();if(a===fo.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(a,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return _r.dec(...this.varint64())}uint64(){return _r.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,_r.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 _r.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return _r.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function IS(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>bj||e<xj)throw new Error("invalid int32: "+e)}function PR(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>Cj||e<0)throw new Error("invalid uint32: "+e)}function wj(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>vj||e<Aj))throw new Error("invalid float32: "+e)}var Rj=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function ES(){return{fields:{}}}var eu={encode(e,t=new Ue){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&PS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=ES();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=PS.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 eu.fromPartial(e??{})},fromPartial(e){let t=ES();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=ES();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 kR(){return{key:"",value:void 0}}var PS={encode(e,t=new Ue){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Ve.encode(Ve.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=kR();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=Ve.unwrap(Ve.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return PS.fromPartial(e??{})},fromPartial(e){let t=kR();return t.key=e.key??"",t.value=e.value??void 0,t}};function FS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Ve={encode(e,t=new Ue){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&&eu.encode(eu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&tu.encode(tu.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=FS();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=eu.unwrap(eu.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=tu.unwrap(tu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let t=FS();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=FS();if(e===null)t.nullValue=Rj.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(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.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 TS(){return{values:[]}}var tu={encode(e,t=new Ue){for(let r of e.values)Ve.encode(Ve.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=TS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(Ve.unwrap(Ve.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=TS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=TS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},Ij=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 OR(){return{op:0,path:"",from:void 0,value:void 0}}var Lp={encode(e,t=new Ue){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&&Ve.encode(Ve.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=OR();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=Ve.unwrap(Ve.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lp.fromPartial(e??{})},fromPartial(e){let t=OR();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function _R(){return{id:"",type:"",function:void 0}}var Up={encode(e,t=new Ue){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Qp.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=_R();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=Qp.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Up.fromPartial(e??{})},fromPartial(e){let t=_R();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Qp.fromPartial(e.function):void 0,t}};function NR(){return{name:"",arguments:""}}var Qp={encode(e,t=new Ue){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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=NR();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 Qp.fromPartial(e??{})},fromPartial(e){let t=NR();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function DR(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var Bp={encode(e,t=new Ue){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)Up.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=DR();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(Up.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}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bp.fromPartial(e??{})},fromPartial(e){let t=DR();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=>Up.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},Ej=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 qR(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Se={encode(e,t=new Ue){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Ve.encode(Ve.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=qR();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=Fj(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Ve.unwrap(Ve.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=qR();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function MR(){return{baseEvent:void 0,messageId:"",role:void 0}}var Gp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=MR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Gp.fromPartial(e??{})},fromPartial(e){let t=MR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function VR(){return{baseEvent:void 0,messageId:"",delta:""}}var $p={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=VR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 $p.fromPartial(e??{})},fromPartial(e){let t=VR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function jR(){return{baseEvent:void 0,messageId:""}}var Hp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=jR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 Hp.fromPartial(e??{})},fromPartial(e){let t=jR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function LR(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var zp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=LR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 zp.fromPartial(e??{})},fromPartial(e){let t=LR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function UR(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Wp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=UR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 Wp.fromPartial(e??{})},fromPartial(e){let t=UR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function QR(){return{baseEvent:void 0,toolCallId:""}}var Yp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=QR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 Yp.fromPartial(e??{})},fromPartial(e){let t=QR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function BR(){return{baseEvent:void 0,snapshot:void 0}}var Kp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Ve.encode(Ve.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=BR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Ve.unwrap(Ve.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Kp.fromPartial(e??{})},fromPartial(e){let t=BR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function GR(){return{baseEvent:void 0,delta:[]}}var Xp={encode(e,t=new Ue){e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Lp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=GR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(Lp.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=GR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Lp.fromPartial(r))||[],t}};function $R(){return{baseEvent:void 0,messages:[]}}var Jp={encode(e,t=new Ue){e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Bp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=$R();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Bp.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=$R();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Bp.fromPartial(r))||[],t}};function HR(){return{baseEvent:void 0,event:void 0,source:void 0}}var Zp={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Ve.encode(Ve.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=HR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Ve.unwrap(Ve.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 Zp.fromPartial(e??{})},fromPartial(e){let t=HR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function zR(){return{baseEvent:void 0,name:"",value:void 0}}var ef={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Ve.encode(Ve.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=zR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Ve.unwrap(Ve.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=zR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function WR(){return{baseEvent:void 0,threadId:"",runId:""}}var tf={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=WR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 tf.fromPartial(e??{})},fromPartial(e){let t=WR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function YR(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var rf={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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&&Ve.encode(Ve.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=YR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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=Ve.unwrap(Ve.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=YR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function KR(){return{baseEvent:void 0,code:void 0,message:""}}var nf={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=KR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 nf.fromPartial(e??{})},fromPartial(e){let t=KR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function XR(){return{baseEvent:void 0,stepName:""}}var of={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=XR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 of.fromPartial(e??{})},fromPartial(e){let t=XR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function JR(){return{baseEvent:void 0,stepName:""}}var af={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=JR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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 af.fromPartial(e??{})},fromPartial(e){let t=JR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function ZR(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var sf={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let r=e instanceof ge?e:new ge(e),n=t===void 0?r.len:r.pos+t,o=ZR();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=Se.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}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=ZR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function eI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var cf={encode(e,t=new Ue){return e.baseEvent!==void 0&&Se.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 ge?e:new ge(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=Se.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 cf.fromPartial(e??{})},fromPartial(e){let t=eI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Se.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 tI(){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 rI={encode(e,t=new Ue){return e.textMessageStart!==void 0&&Gp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&$p.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Hp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&zp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Wp.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Yp.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Kp.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Xp.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Jp.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Zp.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&ef.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&tf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&rf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&nf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&of.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&af.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&sf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&cf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ge?e:new ge(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.textMessageStart=Gp.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=$p.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Hp.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=zp.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Wp.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Yp.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Kp.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Xp.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Jp.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Zp.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=ef.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=tf.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=rf.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=nf.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=of.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=af.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=sf.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=cf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return rI.fromPartial(e??{})},fromPartial(e){let t=tI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Gp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?$p.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Hp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?zp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Wp.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Yp.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Kp.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Xp.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Jp.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Zp.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?ef.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?tf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?rf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?nf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?of.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?af.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?sf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?cf.fromPartial(e.toolCallChunk):void 0,t}};function Fj(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function nI(e){let t=rI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=Ej[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===V.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===V.STATE_DELTA)for(let n of r.delta)n.op=Ij[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]}),ap.parse(r)}var oI="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var Pj=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,kS=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(Pj);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},iI=e=>e==="*"||e==="x"||e==="X",aI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},kj=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Oj=(e,t)=>{if(iI(e)||iI(t))return 0;let[r,n]=kj(aI(e),aI(t));return r>n?1:r<n?-1:0},OS=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=Oj(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var uf=(e,t)=>{let r=kS(e),n=kS(t),o=r.pop(),i=n.pop(),a=OS(r,n);return a!==0?a:o&&i?OS(o.split("."),i.split(".")):o||i?o?-1:1:0};var Ze=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function ru(){return ao()}function We(_x197,_x198,_x199,_x200){return _We.apply(this,arguments)}function _We(){_We=_asyncToGenerator(function*(e,t,r,n){let o=t,i=r,a;for(let p of e)try{let f=yield n(p,Ze(o),Ze(i));if(f===void 0)continue;if(f.messages!==void 0&&(o=f.messages),f.state!==void 0&&(i=f.state),a=f.stopPropagation,a===!0)break}catch(f){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",f);continue}return{...(JSON.stringify(o)===JSON.stringify(t)?{}:{messages:o}),...(JSON.stringify(i)===JSON.stringify(r)?{}:{state:i}),...(a===void 0?{}:{stopPropagation:a})}});return _We.apply(this,arguments)}var pI=(e,t,r,n)=>{let o=Ze(r.messages),i=Ze(e.state),a={},p=m=>{m.messages!==void 0&&(o=m.messages,a.messages=m.messages),m.state!==void 0&&(i=m.state,a.state=m.state)},f=()=>{let m=Ze(a);return a={},m.messages!==void 0||m.state!==void 0?dt(m):Cp};return t.pipe(Dp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(m){let h=yield We(n,o,i,(C,b,g)=>C.onEvent?.({event:m,agent:r,input:e,messages:b,state:g}));if(p(h),h.stopPropagation===!0)return f();switch(m.type){case V.TEXT_MESSAGE_START:{let C=yield We(n,o,i,(b,g,S)=>b.onTextMessageStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{messageId:b,role:g="assistant"}=m;if(!o.find(S=>S.id===b)){let S={id:b,role:g,content:""};o.push(S),p({messages:o})}}return f()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:C,delta:b}=m,g=o.find(x=>x.id===C);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${C}'`),f();let S=yield We(n,o,i,(x,w,R)=>x.onTextMessageContentEvent?.({event:m,messages:w,state:R,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return p(S),S.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${b}`,p({messages:o})),f()}case V.TEXT_MESSAGE_END:{let{messageId:C}=m,b=o.find(g=>g.id===C);return b?(p(yield We(n,o,i,(g,S,x)=>g.onTextMessageEndEvent?.({event:m,messages:S,state:x,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:b,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${C}'`),f())}case V.TOOL_CALL_START:{let C=yield We(n,o,i,(b,g,S)=>b.onToolCallStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{toolCallId:b,toolCallName:g,parentMessageId:S}=m,x;S&&o.length>0&&o[o.length-1].id===S?x=o[o.length-1]:(x={id:S||b,role:"assistant",toolCalls:[]},o.push(x)),x.toolCalls??(x.toolCalls=[]),x.toolCalls.push({id:b,type:"function",function:{name:g,arguments:""}}),p({messages:o})}return f()}case V.TOOL_CALL_ARGS:{let{toolCallId:C,delta:b}=m,g=o.find(w=>w.toolCalls?.some(R=>R.id===C));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${C}'`),f();let S=g.toolCalls?.find(w=>w.id===C);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${C}'`),f();let x=yield We(n,o,i,(w,R,P)=>{let E=S.function.arguments,_=S.function.name,F={};try{F=Mp(E)}catch{}return w.onToolCallArgsEvent?.({event:m,messages:R,state:P,agent:r,input:e,toolCallBuffer:E,toolCallName:_,partialToolCallArgs:F})});return p(x),x.stopPropagation!==!0&&(S.function.arguments+=b,p({messages:o})),f()}case V.TOOL_CALL_END:{let{toolCallId:C}=m,b=o.find(S=>S.toolCalls?.some(x=>x.id===C));if(!b)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${C}'`),f();let g=b.toolCalls?.find(S=>S.id===C);return g?(p(yield We(n,o,i,(S,x,w)=>{let R=g.function.arguments,P=g.function.name,E={};try{E=JSON.parse(R)}catch{}return S.onToolCallEndEvent?.({event:m,messages:x,state:w,agent:r,input:e,toolCallName:P,toolCallArgs:E})})),yield Promise.all(n.map(S=>{S.onNewToolCall?.({toolCall:g,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${C}'`),f())}case V.TOOL_CALL_RESULT:{let C=yield We(n,o,i,(b,g,S)=>b.onToolCallResultEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{messageId:b,toolCallId:g,content:S,role:x}=m,w={id:b,toolCallId:g,role:x||"tool",content:S};o.push(w),yield Promise.all(n.map(R=>{R.onNewMessage?.({message:w,messages:o,state:i,agent:r,input:e})})),p({messages:o})}return f()}case V.STATE_SNAPSHOT:{let C=yield We(n,o,i,(b,g,S)=>b.onStateSnapshotEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{snapshot:b}=m;i=b,p({state:i})}return f()}case V.STATE_DELTA:{let C=yield We(n,o,i,(b,g,S)=>b.onStateDeltaEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{delta:b}=m;try{i=po(i,b,!0,!1).newDocument,p({state:i})}catch(g){let S=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
36
- Current state: ${JSON.stringify(i,null,2)}
37
- Patch operations: ${JSON.stringify(b,null,2)}
38
- Error: ${S}`)}}return f()}case V.MESSAGES_SNAPSHOT:{let C=yield We(n,o,i,(b,g,S)=>b.onMessagesSnapshotEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{messages:b}=m;o=b,p({messages:o})}return f()}case V.ACTIVITY_SNAPSHOT:{let C=m,b=o.findIndex(R=>R.id===C.messageId),g=b>=0?o[b]:void 0,S=g?.role==="activity"?g:void 0,x=C.replace??!0,w=yield We(n,o,i,(R,P,E)=>R.onActivitySnapshotEvent?.({event:C,messages:P,state:E,agent:r,input:e,activityMessage:S,existingMessage:g}));if(p(w),w.stopPropagation!==!0){let R={id:C.messageId,role:"activity",activityType:C.activityType,content:Ze(C.content)},P;b===-1?(o.push(R),P=R):S?x&&(o[b]={...S,activityType:C.activityType,content:Ze(C.content)}):x&&(o[b]=R,P=R),p({messages:o}),P&&(yield Promise.all(n.map(E=>E.onNewMessage?.({message:P,messages:o,state:i,agent:r,input:e}))))}return f()}case V.ACTIVITY_DELTA:{let C=m,b=o.findIndex(w=>w.id===C.messageId);if(b===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${C.messageId}' to apply patch`),f();let g=o[b];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${C.messageId}' is not an activity message`),f();let S=g,x=yield We(n,o,i,(w,R,P)=>w.onActivityDeltaEvent?.({event:C,messages:R,state:P,agent:r,input:e,activityMessage:S}));if(p(x),x.stopPropagation!==!0)try{let w=Ze(S.content??{}),R=po(w,C.patch??[],!0,!1).newDocument;o[b]={...S,content:Ze(R),activityType:C.activityType},p({messages:o})}catch(w){let R=w instanceof Error?w.message:String(w);console.warn(`Failed to apply activity patch for '${C.messageId}': ${R}`)}return f()}case V.RAW:return p(yield We(n,o,i,(C,b,g)=>C.onRawEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.CUSTOM:return p(yield We(n,o,i,(C,b,g)=>C.onCustomEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.RUN_STARTED:{let C=yield We(n,o,i,(b,g,S)=>b.onRunStartedEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let b=m;if(b.input?.messages){for(let g of b.input.messages)o.find(S=>S.id===g.id)||o.push(g);p({messages:o})}}return f()}case V.RUN_FINISHED:return p(yield We(n,o,i,(C,b,g)=>C.onRunFinishedEvent?.({event:m,messages:b,state:g,agent:r,input:e,result:m.result}))),f();case V.RUN_ERROR:return p(yield We(n,o,i,(C,b,g)=>C.onRunErrorEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.STEP_STARTED:return p(yield We(n,o,i,(C,b,g)=>C.onStepStartedEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.STEP_FINISHED:return p(yield We(n,o,i,(C,b,g)=>C.onStepFinishedEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case V.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case V.THINKING_START:return f();case V.THINKING_END:return f();case V.THINKING_TEXT_MESSAGE_START:return f();case V.THINKING_TEXT_MESSAGE_CONTENT:return f();case V.THINKING_TEXT_MESSAGE_END:return f();case V.REASONING_START:return p(yield We(n,o,i,(C,b,g)=>C.onReasoningStartEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.REASONING_MESSAGE_START:{let C=yield We(n,o,i,(b,g,S)=>b.onReasoningMessageStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let{messageId:b}=m;if(!o.find(g=>g.id===b)){let g={id:b,role:"reasoning",content:""};o.push(g),p({messages:o})}}return f()}case V.REASONING_MESSAGE_CONTENT:{let{messageId:C,delta:b}=m,g=o.find(x=>x.id===C);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${C}'`),f();let S=yield We(n,o,i,(x,w,R)=>x.onReasoningMessageContentEvent?.({event:m,messages:w,state:R,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return p(S),S.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${b}`,p({messages:o})),f()}case V.REASONING_MESSAGE_END:{let{messageId:C}=m,b=o.find(g=>g.id===C);return b?(p(yield We(n,o,i,(g,S,x)=>g.onReasoningMessageEndEvent?.({event:m,messages:S,state:x,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:b,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${C}'`),f())}case V.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case V.REASONING_END:return p(yield We(n,o,i,(C,b,g)=>C.onReasoningEndEvent?.({event:m,messages:b,state:g,agent:r,input:e}))),f();case V.REASONING_ENCRYPTED_VALUE:{let{subtype:C,entityId:b,encryptedValue:g}=m,S=yield We(n,o,i,(x,w,R)=>x.onReasoningEncryptedValueEvent?.({event:m,messages:w,state:R,agent:r,input:e}));if(p(S),S.stopPropagation!==!0){let x=!1;if(C==="tool-call"){for(let w of o)if(w.role==="assistant"&&w.toolCalls){let R=w.toolCalls.find(P=>P.id===b);if(R){R.encryptedValue=g,x=!0;break}}}else{let w=o.find(R=>R.id===b);w?.role!=="activity"&&w&&(w.encryptedValue=g,x=!0)}x&&(a.messages=o)}return f()}}return m.type,f()});return function(_x201){return _ref76.apply(this,arguments)}}()),gS(),n.length>0?yS({}):m=>m)},_S=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,p=new Map,f=!1,m=!1,h=!1,C=()=>{r.clear(),n.clear(),p.clear(),f=!1,m=!1,o=!1,i=!1,h=!0};return t.pipe(rr(b=>{let g=b.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(b)),i)return ct(()=>new lt(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==V.RUN_ERROR&&g!==V.RUN_STARTED)return ct(()=>new lt(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===V.RUN_STARTED){if(h&&!o)return ct(()=>new lt("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));o&&C()}}else if(a=!0,g!==V.RUN_STARTED&&g!==V.RUN_ERROR)return ct(()=>new lt("First event must be 'RUN_STARTED'"));switch(g){case V.TEXT_MESSAGE_START:{let S=b.messageId;return r.has(S)?ct(()=>new lt(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${S}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(S,!0),dt(b))}case V.TEXT_MESSAGE_CONTENT:{let S=b.messageId;return r.has(S)?dt(b):ct(()=>new lt(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case V.TEXT_MESSAGE_END:{let S=b.messageId;return r.has(S)?(r.delete(S),dt(b)):ct(()=>new lt(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case V.TOOL_CALL_START:{let S=b.toolCallId;return n.has(S)?ct(()=>new lt(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${S}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(S,!0),dt(b))}case V.TOOL_CALL_ARGS:{let S=b.toolCallId;return n.has(S)?dt(b):ct(()=>new lt(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case V.TOOL_CALL_END:{let S=b.toolCallId;return n.has(S)?(n.delete(S),dt(b)):ct(()=>new lt(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case V.STEP_STARTED:{let S=b.stepName;return p.has(S)?ct(()=>new lt(`Step "${S}" is already active for 'STEP_STARTED'`)):(p.set(S,!0),dt(b))}case V.STEP_FINISHED:{let S=b.stepName;return p.has(S)?(p.delete(S),dt(b)):ct(()=>new lt(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case V.RUN_STARTED:return h=!0,dt(b);case V.RUN_FINISHED:if(p.size>0){let S=Array.from(p.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(r.size>0){let S=Array.from(r.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return o=!0,dt(b);case V.RUN_ERROR:return i=!0,dt(b);case V.CUSTOM:return dt(b);case V.THINKING_TEXT_MESSAGE_START:return f?m?ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(m=!0,dt(b)):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case V.THINKING_TEXT_MESSAGE_CONTENT:return m?dt(b):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case V.THINKING_TEXT_MESSAGE_END:return m?(m=!1,dt(b)):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case V.THINKING_START:return f?ct(()=>new lt("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(f=!0,dt(b));case V.THINKING_END:return f?(f=!1,dt(b)):ct(()=>new lt("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return dt(b)}}))},Ei=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),_j=(e,t)=>hS(()=>wi(v(e,t))).pipe(SS(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return wi(r.text()).pipe(rr(a=>{let p=a;if(i.includes("application/json"))try{p=JSON.parse(a)}catch{}let f=Error(`HTTP ${r.status}: ${typeof p=="string"?p:JSON.stringify(p)}`);return f.status=r.status,f.payload=p,ct(()=>f)}))}let n={type:Ei.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new st(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:p}=yield o.read();if(a)break;let f={type:Ei.DATA,data:p};i.next(f)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):ct(()=>Error("Failed to getReader() from response"))})),Nj=e=>{let t=new on,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==Ei.HEADERS&&i.type===Ei.DATA&&i.data){let a=r.decode(i.data,{stream:!0});n+=a;let p=n.split(/\n\n/);n=p.pop()||"";for(let f of p)o(f)}},error:i=>t.error(i),complete:()=>{n&&(n+=r.decode(),o(n)),t.complete()}});function o(i){let a=i.split(`
39
- `),p=[];for(let f of a)f.startsWith("data:")&&p.push(f.slice(5).replace(/^ /,""));if(p.length>0)try{let f=p.join(`
40
- `),m=JSON.parse(f);t.next(m)}catch(f){t.error(f)}}return t.asObservable()},Dj=e=>{let t=new on,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Ei.HEADERS&&o.type===Ei.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=nI(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()},qj=e=>{let t=new on,r=new Ap,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===Ei.HEADERS&&!n?(n=!0,o.headers.get("content-type")===oI?Dj(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):Nj(r).subscribe({next:i=>{try{let a=ap.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:V.RUN_ERROR,message:i.message||"Request aborted",code:"abort",rawEvent:i}),t.complete();return}return t.error(i)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:o=>{r.error(o),t.error(o)},complete:()=>{r.complete()}}),t.asObservable()},nt=I.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Mj=I.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Vj=I.object({type:I.literal(nt.enum.TextMessageStart),messageId:I.string(),parentMessageId:I.string().optional(),role:I.string().optional()}),jj=I.object({type:I.literal(nt.enum.TextMessageContent),messageId:I.string(),content:I.string()}),Lj=I.object({type:I.literal(nt.enum.TextMessageEnd),messageId:I.string()}),Uj=I.object({type:I.literal(nt.enum.ActionExecutionStart),actionExecutionId:I.string(),actionName:I.string(),parentMessageId:I.string().optional()}),Qj=I.object({type:I.literal(nt.enum.ActionExecutionArgs),actionExecutionId:I.string(),args:I.string()}),Bj=I.object({type:I.literal(nt.enum.ActionExecutionEnd),actionExecutionId:I.string()}),Gj=I.object({type:I.literal(nt.enum.ActionExecutionResult),actionName:I.string(),actionExecutionId:I.string(),result:I.string()}),$j=I.object({type:I.literal(nt.enum.AgentStateMessage),threadId:I.string(),agentName:I.string(),nodeName:I.string(),runId:I.string(),active:I.boolean(),role:I.string(),state:I.string(),running:I.boolean()}),Hj=I.object({type:I.literal(nt.enum.MetaEvent),name:Mj,value:I.any()}),zj=I.object({type:I.literal(nt.enum.RunError),message:I.string(),code:I.string().optional()});I.discriminatedUnion("type",[Vj,jj,Lj,Uj,Qj,Bj,Gj,$j,Hj,zj]),I.object({id:I.string(),role:I.string(),content:I.string(),parentMessageId:I.string().optional()}),I.object({id:I.string(),name:I.string(),arguments:I.any(),parentMessageId:I.string().optional()}),I.object({id:I.string(),result:I.any(),actionExecutionId:I.string(),actionName:I.string()});var Wj=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
- `)},Yj=(e,t,r)=>n=>{let o={},i=!0,a=!0,p="",f=null,m=null,h=[],C={},b=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(rr(g=>{switch(g.type){case V.TEXT_MESSAGE_START:{let S=g;return[{type:nt.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case V.TEXT_MESSAGE_CONTENT:{let S=g;return[{type:nt.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case V.TEXT_MESSAGE_END:{let S=g;return[{type:nt.enum.TextMessageEnd,messageId:S.messageId}]}case V.TOOL_CALL_START:{let S=g;return h.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),a=!0,C[S.toolCallId]=S.toolCallName,[{type:nt.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case V.TOOL_CALL_ARGS:{let S=g,x=h.find(R=>R.id===S.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${S.toolCallId}'`),[];x.function.arguments+=S.delta;let w=!1;if(m){let R=m.find(P=>P.tool==x.function.name);if(R)try{let P=JSON.parse(Mp(x.function.arguments));R.tool_argument&&R.tool_argument in P?(b({...o,[R.state_key]:P[R.tool_argument]}),w=!0):R.tool_argument||(b({...o,[R.state_key]:P}),w=!0)}catch{}}return[{type:nt.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...(w?[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case V.TOOL_CALL_END:{let S=g;return[{type:nt.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case V.TOOL_CALL_RESULT:{let S=g;return[{type:nt.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:C[S.toolCallId]||"unknown"}]}case V.RAW:return[];case V.CUSTOM:{let S=g;switch(S.name){case"Exit":i=!1;break;case"PredictState":m=S.value;break}return[{type:nt.enum.MetaEvent,name:S.name,value:S.value}]}case V.STATE_SNAPSHOT:return b(g.snapshot),[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case V.STATE_DELTA:{let S=g,x=po(o,S.delta,!0,!1);return x?(b(x.newDocument),[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case V.MESSAGES_SNAPSHOT:return f=g.messages,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case V.RUN_STARTED:return[];case V.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:Kj(f)}:{})}),active:!1}];case V.RUN_ERROR:{let S=g;return[{type:nt.enum.RunError,message:S.message,code:S.code}]}case V.STEP_STARTED:return p=g.stepName,h=[],m=null,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case V.STEP_FINISHED:return h=[],m=null,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Kj(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Wj(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 lf=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:V.TEXT_MESSAGE_END,messageId:r.messageId};return i=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},p=()=>{if(!n||i!=="tool")throw Error("No tool call to close");let h={type:V.TOOL_CALL_END,toolCallId:n.toolCallId};return i=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},f=()=>{if(!o||i!=="reasoning")throw Error("No reasoning message to close");let h={type:V.REASONING_MESSAGE_END,messageId:o.messageId};return i=void 0,o=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},m=()=>i==="text"?[a()]:i==="tool"?[p()]:i==="reasoning"?[f()]:[];return t.pipe(rr(h=>{switch(h.type){case V.TEXT_MESSAGE_START:case V.TEXT_MESSAGE_CONTENT:case V.TEXT_MESSAGE_END:case V.TOOL_CALL_START:case V.TOOL_CALL_ARGS:case V.TOOL_CALL_END:case V.TOOL_CALL_RESULT:case V.STATE_SNAPSHOT:case V.STATE_DELTA:case V.MESSAGES_SNAPSHOT:case V.CUSTOM:case V.RUN_STARTED:case V.RUN_FINISHED:case V.RUN_ERROR:case V.STEP_STARTED:case V.STEP_FINISHED:case V.THINKING_START:case V.THINKING_END:case V.THINKING_TEXT_MESSAGE_START:case V.THINKING_TEXT_MESSAGE_CONTENT:case V.THINKING_TEXT_MESSAGE_END:case V.REASONING_START:case V.REASONING_MESSAGE_START:case V.REASONING_MESSAGE_CONTENT:case V.REASONING_MESSAGE_END:case V.REASONING_END:return[...m(),h];case V.RAW:case V.ACTIVITY_SNAPSHOT:case V.ACTIVITY_DELTA:case V.REASONING_ENCRYPTED_VALUE:return[h];case V.TEXT_MESSAGE_CHUNK:let C=h,b=[];if((i!=="text"||C.messageId!==void 0&&C.messageId!==r?.messageId)&&b.push(...m()),i!=="text"){if(C.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:C.messageId},i="text";let R={type:V.TEXT_MESSAGE_START,messageId:C.messageId,role:C.role||"assistant"};b.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(R))}if(C.delta!==void 0){let R={type:V.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:C.delta};b.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(R))}return b;case V.TOOL_CALL_CHUNK:let g=h,S=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&S.push(...m()),i!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},i="tool";let R={type:V.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};S.push(R),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(R))}if(g.delta!==void 0){let R={type:V.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};S.push(R),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(R))}return S;case V.REASONING_MESSAGE_CHUNK:let x=h,w=[];if((i!=="reasoning"||x.messageId&&x.messageId!==o?.messageId)&&w.push(...m()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");o={messageId:x.messageId},i="reasoning";let R={type:V.REASONING_MESSAGE_START,messageId:x.messageId};w.push(R),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(R))}if(x.delta!==void 0){let R={type:V.REASONING_MESSAGE_CONTENT,messageId:o.messageId,delta:x.delta};w.push(R),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(R))}return w}return h.type,[]}),Ii(()=>{m()}))},NS=class{runNext(e,t){return t.run(e).pipe(lf(!1))}runNextWithState(e,t){let r=Ze(e.messages||[]),n=Ze(e.state||{}),o=new Ap;return pI(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(Dp(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Ze(r),state:Ze(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},Xj=class extends NS{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Jj(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 Zj=class extends NS{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Jj)};return this.runNext(o,t)}},sI="THINKING_START",cI="THINKING_END",uI="THINKING_TEXT_MESSAGE_START",lI="THINKING_TEXT_MESSAGE_CONTENT",dI="THINKING_TEXT_MESSAGE_END",eL=class extends NS{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Ri(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case sI:{this.currentReasoningId=ru();let{title:t,...r}=e;return this.warnAboutTransformation(sI,V.REASONING_START),{...r,type:V.REASONING_START,messageId:this.currentReasoningId}}case uI:return this.currentMessageId=ru(),this.warnAboutTransformation(uI,V.REASONING_MESSAGE_START),{...e,type:V.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case lI:{let{delta:t,...r}=e;return this.warnAboutTransformation(lI,V.REASONING_MESSAGE_CONTENT),{...r,type:V.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ru(),delta:t}}case dI:{let t=this.currentMessageId??ru();return this.warnAboutTransformation(dI,V.REASONING_MESSAGE_END),{...e,type:V.REASONING_MESSAGE_END,messageId:t}}case cI:{let t=this.currentReasoningId??ru();return this.warnAboutTransformation(cI,V.REASONING_END),{...e,type:V.REASONING_END,messageId:t}}default:return e}}},tL="0.0.45",rL=class{get maxVersion(){return tL}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??ao(),this.messages=Ze(n??[]),this.state=Ze(o??{}),this.debug=i??!1,uf(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Zj),uf(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new eL)}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 Xj(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??ao();let r=_this35.prepareRunAgentInput(e),n,o=new Set(_this35.messages.map(f=>f.id)),i=[{onRunFinishedEvent:f=>{n=f.result}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,i),_this35.activeRunDetach$=new on;let a;_this35.activeRunCompletionPromise=new Promise(f=>{a=f}),yield Np(vp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:h=>m.run(h,f)}),_this35).run(r),lf(_this35.debug),_S(_this35.debug),f=>f.pipe(qp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,i),f=>_this35.processApplyEvents(r,f,i),Zc(f=>(_this35.isRunning=!1,_this35.onError(r,f,i))),Ii(()=>{_this35.isRunning=!1,_this35.onFinalize(r,i),a?.(),a=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(dt(null)));let p=Ze(_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??ao();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),i=[{onRunFinishedEvent:f=>{n=f.result}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,i),_this36.activeRunDetach$=new on;let a;_this36.activeRunCompletionPromise=new Promise(f=>{a=f}),yield Np(vp(()=>_this36.connect(r),lf(_this36.debug),_S(_this36.debug),f=>f.pipe(qp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,i),f=>_this36.processApplyEvents(r,f,i),Zc(f=>(_this36.isRunning=!1,f instanceof rS?Cp:_this36.onError(r,f,i))),Ii(()=>{_this36.isRunning=!1,_this36.onFinalize(r,i),a?.(),a=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(dt(null)));let p=Ze(_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 pI(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(vS(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=Ze(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||ao(),tools:Ze(e?.tools??[]),context:Ze(e?.context??[]),forwardedProps:Ze(e?.forwardedProps??{}),state:Ze(this.state),messages:t}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){let r=yield We(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 wi(We(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Ri(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)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield We(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=Ze(this.messages),e.state=Ze(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],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=Ze(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=Ze(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??ao();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r)}),this).run(t)).pipe(lf(this.debug),_S(this.debug),Yj(this.threadId,t.runId,this.agentId),r=>r.pipe(Ri(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},fI=class extends rL{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=Ze(e.headers??{})}run(e){return qj(_j(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Ze(this.headers??{});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 mI=(e,t,r)=>{let n=Ye(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var DS=class extends fI{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}}},gI=(e,t,r)=>new DS({url:`${mI(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var nL=new $({required:!0}),hI=new $({required:!0,constrainTo:Pd}),yI=e=>({...e,name:kd(e.name)}),SI=T("followUpAnswers/setIsEnabled",e=>O(e,new de({required:!0}))),vI=T("followUpAnswers/setFollowUpAnswersConversationId",e=>O(e,z)),AI=T("followUpAnswers/setFollowUpAnswersConversationToken",e=>O(e,z)),CI=T("followUpAnswers/clearFollowUpAnswersConversationToken"),QAe=T("followUpAnswers/createFollowUpAnswer",e=>O(e,{question:z})),BAe=T("followUpAnswers/setActiveFollowUpAnswerId",e=>O(e,z)),GAe=T("followUpAnswers/setFollowUpAnswerContentFormat",e=>O(e,{contentFormat:Od,answerId:z})),$Ae=T("followUpAnswers/setFollowUpIsLoading",e=>O(e,{isLoading:new de({required:!0}),answerId:z})),HAe=T("followUpAnswers/setFollowUpIsStreaming",e=>O(e,{isStreaming:new de({required:!0}),answerId:z})),zAe=T("followUpAnswers/followUpMessageChunkReceived",e=>O(e,{textDelta:nL,answerId:z})),WAe=T("followUpAnswers/followUpCitationsReceived",e=>O(e,{citations:new ne({required:!0,each:new Y({values:By})}),answerId:z})),YAe=T("followUpAnswers/followUpCompleted",e=>O(e,{answerId:z,cannotAnswer:new de({required:!1})})),KAe=T("followUpAnswers/followUpFailed",e=>O(e,{message:new $,code:new oe({min:0}),answerId:z})),XAe=T("followUpAnswers/activeFollowUpStartFailed",e=>O(e,{message:new $})),JAe=T("followUpAnswers/likeFollowUp",e=>O(e,{answerId:z})),ZAe=T("followUpAnswers/dislikeFollowUp",e=>O(e,{answerId:z})),eCe=T("followUpAnswers/submitFollowUpFeedback",e=>O(e,{answerId:z})),bI=T("followUpAnswers/resetFollowUpAnswers"),tCe=T("followUpAnswers/stepStarted",e=>O(yI(e),{answerId:z,name:hI,startedAt:new oe({min:0,required:!0})})),rCe=T("followUpAnswers/stepFinished",e=>O(yI(e),{answerId:z,name:hI,finishedAt:new oe({min:0,required:!0})}));d();c();l();u();var oL={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:TURN_LIMIT_REACHED":1005};function xI(e){return e?oL[e]??1004:1004}function iL(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 iL({...e})}var wI=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Da(n.runId)),e(Jr(!1)),e(Jo(!0)),e(vI(n.threadId)),e(CI())},onStepStartedEvent:({event:n})=>{e(Bd({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Gd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Zo({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:i}=n;switch(o){case"header":{i?.contentFormat&&e(ri(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(SI(i.followUpEnabled)),i?.conversationToken&&e(AI(i.conversationToken));return}case"citations":{e(ei({citations:i.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=xI(n.code);e(ti({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",i=o?!r:void 0;e(Bc(o)),e(ni(!o)),e(Jo(!1)),e(Pa(o,t,i,n.threadId)),e(ka())}}};var RI=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,i){t();let a=Ol(n),p=Sb(n),f=vb(n),m=yb(n),h=Ab(n),C=gI(a,p,f);e=C;let b=wI(o),g=Sw(n,i());try{o(Jr(!0)),yield C.runAgent({forwardedProps:{params:g,accessToken:m,recordDebugSession:h}},b)}catch(S){o(Jr(!1)),o(ti({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",S)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var II=e=>{let t=AC({extra:e}),r=RI();return t.startListening({actionCreator:Te.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Yh(i))return;r.abortRun(),o.dispatch(lr()),o.dispatch(bI());let a=Xo(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 EI=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)},FI=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var qS=(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 TI(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=qv(Object.entries(t).filter(([a])=>!(a in r)).map(([a,p])=>[a,()=>p]));return o(Yi({...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 aL(e){if(!e||!sL(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 PI(e,t=60){if(!e)return!1;let r=aL(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function sL(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function OI(e,t){let r=0,n=null,o=_u(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(f,m=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!m)throw b;return null}})().finally(()=>{n=null}));let C=yield n;return h&&C&&f.dispatch(ha({accessToken:C})),C});return function i(_x208){return _ref85.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),h=uL(m);if(!(!h||!PI(h))){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(C){e.warn(C,"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,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),kI(f,m.error),m;!n&&(r++,o());try{yield i(f,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}f.dispatch(h)});return function p(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(h){let C=typeof h=="function",b=typeof t=="function";if(!C)return m(h);b&&(yield a(f));let g=yield m(h);return cL(g)?b?yield p(f,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),kI(f,g.error),g):g});return function(_x213){return _ref89.apply(this,arguments)}}())}function cL(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new $i().name}function kI(e,t){e.dispatch(Ea({status:401,statusCode:401,message:t.message,type:t.name}))}function uL(e){return e.configuration.accessToken}d();c();l();u();function _I({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return aC({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(FI(n.logger))})}function lL(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&Dv()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function NI(e,t){let r={...e.reducers,configuration:Ce,version:Rw},n=dL({...e,reducers:r},t,Ce),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(ha({accessToken:o,environment:i,organizationId:a}));let p=lL(e.configuration,n.logger);return p&&n.dispatch(Ul(p)),n}function dL(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=TI({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,p={...t,get relay(){return Cc(m.state,o)},get navigatorContext(){return qS(this.relay,o)}},f=pL(e,p,i),m={addReducers(h){i.containsAll(h)||(i.add(h),f.replaceReducer(i.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(Bl())},disableAnalytics(){f.dispatch(Ql())},get state(){return f.getState()},get relay(){return Cc(this.state,o)},get navigatorContext(){return qS(this.relay,o)},logger:a,store:f};return m}function pL(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=fL(e,t.logger,()=>t.navigatorContext);return _I({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function fL(e,t,r){let{renewAccessToken:n}=e.configuration,o=OI(t,n),i=II({getNavigatorContext:r});return[Nw,o,EI(t),Ew].concat(oi.middleware,i.middleware,e.middlewares||[])}var mL=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Xc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ki=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=qn(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(qe(g))try{g()}catch(b){a=b instanceof yp?b.errors:[b]}var C=this._finalizers;if(C){this._finalizers=null;try{for(var x=qn(C),h=x.next();!h.done;h=x.next()){var S=h.value;try{xR(S)}catch(b){a=a??[],b instanceof yp?a=Wi(Wi([],zi(a)),zi(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 yp(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)xR(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)&&Xc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Xc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var xS=Ki.EMPTY;function Sp(e){return e instanceof Ki||e&&"closed"in e&&qe(e.remove)&&qe(e.add)&&qe(e.unsubscribe)}function xR(e){qe(e)?e():e.unsubscribe()}d();c();l();u();var _r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var Xi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Xi.delegate;return o?.setTimeout?o.setTimeout.apply(o,Wi([e,t],zi(r))):setTimeout.apply(void 0,Wi([e,t],zi(r)))},clearTimeout:function(e){var t=Xi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function vp(e){Xi.setTimeout(function(){var t=_r.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function Zc(){}d();c();l();u();var wR=function(){return wS("C",void 0,void 0)}();function RR(e){return wS("E",void 0,e)}function IR(e){return wS("N",e,void 0)}function wS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var wa=null;function Zi(e){if(_r.useDeprecatedSynchronousErrorHandling){var t=!wa;if(t&&(wa={errorThrown:!1,error:null}),e(),t){var r=wa,n=r.errorThrown,o=r.error;if(wa=null,n)throw o}}else e()}function ER(e){_r.useDeprecatedSynchronousErrorHandling&&wa&&(wa.errorThrown=!0,wa.error=e)}var Jc=function(e){on(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Sp(r)&&r.add(n)):n.destination=Xj,n}return t.create=function(r,n,o){return new Cp(r,n,o)},t.prototype.next=function(r){this.isStopped?IS(IR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?IS(RR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?IS(wR,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}(Ki);var Wj=Function.prototype.bind;function RS(e,t){return Wj.call(e,t)}var Yj=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){Ap(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ap(n)}else Ap(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ap(r)}},e}(),Cp=function(e){on(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(qe(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&_r.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&RS(r.next,p),error:r.error&&RS(r.error,p),complete:r.complete&&RS(r.complete,p)}):i=r}return a.destination=new Yj(i),a}return t}(Jc);function Ap(e){_r.useDeprecatedSynchronousErrorHandling?ER(e):vp(e)}function Kj(e){throw e}function IS(e,t){var r=_r.onStoppedNotification;r&&Xi.setTimeout(function(){return r(e,t)})}var Xj={closed:!0,next:Zc,error:Kj,complete:Zc};d();c();l();u();var Ji=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function es(e){return e}function bp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ES(e)}function ES(e){return e.length===0?es:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var st=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=Jj(t)?t:new Cp(t,r,n);return Zi(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=FR(r),new r(function(o,a){var i=new Cp({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[Ji]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ES(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=FR(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 FR(e){var t;return(t=e??_r.Promise)!==null&&t!==void 0?t:Promise}function Zj(e){return e&&qe(e.next)&&qe(e.error)&&qe(e.complete)}function Jj(e){return e&&e instanceof Jc||Zj(e)&&Sp(e)}d();c();l();u();function eL(e){return qe(e?.lift)}function yt(e){return function(t){if(eL(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 tL(e,t,r,n,o)}var tL=function(e){on(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}(Jc);d();c();l();u();d();c();l();u();var TR=Yi(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var an=function(e){on(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 PR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new TR},t.prototype.next=function(r){var n=this;Zi(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=qn(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;Zi(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;Zi(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?xS:(this.currentObservers=null,p.push(r),new Ki(function(){n.currentObservers=null,Xc(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 st;return r.source=this,r},t.create=function(r,n){return new PR(r,n)},t}(st);var PR=function(e){on(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:xS},t}(an);d();c();l();u();d();c();l();u();var FS={now:function(){return(FS.delegate||Date).now()},delegate:void 0};var xp=function(e){on(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=FS);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}(an);d();c();l();u();var wp=new st(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function kR(e){return e&&qe(e.schedule)}function rL(e){return e[e.length-1]}function OR(e){return kR(rL(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 Rp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Ip(e){return qe(e?.then)}d();c();l();u();function Ep(e){return qe(e[Ji])}d();c();l();u();function Fp(e){return Symbol.asyncIterator&&qe(e?.[Symbol.asyncIterator])}d();c();l();u();function Tp(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 nL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Pp=nL();function kp(e){return qe(e?.[Pp])}d();c();l();u();function Op(e){return CR(this,arguments,function(){var r,n,o,a;return hp(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,xa(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,xa(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,xa(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 _p(e){return qe(e?.getReader)}function Rt(e){if(e instanceof st)return e;if(e!=null){if(Ep(e))return oL(e);if(Rp(e))return aL(e);if(Ip(e))return iL(e);if(Fp(e))return _R(e);if(kp(e))return sL(e);if(_p(e))return cL(e)}throw Tp(e)}function oL(e){return new st(function(t){var r=e[Ji]();if(qe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function aL(e){return new st(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function iL(e){return new st(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,vp)})}function sL(e){return new st(function(t){var r,n;try{for(var o=qn(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 _R(e){return new st(function(t){uL(e,t).catch(function(r){return t.error(r)})})}function cL(e){return _R(Op(e))}function uL(e,t){var r,n,o,a;return AR(this,void 0,void 0,function(){var i,p;return hp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=bR(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 Np(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 Dp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function NR(e,t){return Rt(e).pipe(Dp(t),Np(t))}d();c();l();u();function DR(e,t){return Rt(e).pipe(Dp(t),Np(t))}d();c();l();u();function qR(e,t){return new st(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 MR(e,t){return new st(function(r){var n;return xr(r,t,function(){n=e[Pp](),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 qe(n?.return)&&n.return()}})}d();c();l();u();function qp(e,t){if(!e)throw new Error("Iterable cannot be null");return new st(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 VR(e,t){return qp(Op(e),t)}function jR(e,t){if(e!=null){if(Ep(e))return NR(e,t);if(Rp(e))return qR(e,t);if(Ip(e))return DR(e,t);if(Fp(e))return qp(e,t);if(kp(e))return MR(e,t);if(_p(e))return VR(e,t)}throw Tp(e)}function Ra(e,t){return t?jR(e,t):Rt(e)}function dt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=OR(e);return Ra(e,r)}d();c();l();u();function ct(e,t){var r=qe(e)?e:function(){return e},n=function(o){return o.error(r())};return new st(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var LR=Yi(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Mp(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 LR)}})})}d();c();l();u();function Ia(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 UR(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,C=!1,x=function(){C&&!f.length&&!m&&t.complete()},h=function(b){return m<n?S(b):f.push(b)},S=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 E=f.shift();i?xr(t,i,function(){return S(E)}):S(E)};f.length&&m<n;)I();x()}catch(E){t.error(E)}}))};return e.subscribe(wt(t,h,function(){C=!0,x()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),qe(t)?rr(function(n,o){return Ia(function(a,i){return t(n,a,o,i)})(Rt(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return UR(n,o,e,r)}))}function TS(e){return e===void 0&&(e=1/0),rr(es,e)}d();c();l();u();function Vp(e){return new st(function(t){Rt(e()).subscribe(t)})}d();c();l();u();function eu(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,eu(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 jp(e,t){return qe(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function PS(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 Ea(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function kS(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(C){return n.next(t?t(f,C,g,m++):C)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Lp(e){return yt(function(t,r){Rt(e).subscribe(wt(r,function(){return r.complete()},Zc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function OS(e,t,r){var n=qe(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)}))}):es}d();c();l();u();d();c();l();u();function QR(e){return` \r
36
+ `.indexOf(e)>=0}function Up(e){for(var t=["topLevel"],r=0,n,o,a,i=function(E){return t.push(E)},p=function(E){return t[t.length-1]=E},f=function(E){n==null&&(n=r,o=t.length,a=E)},m=function(E){E===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},C=function(){return r--},x=function(E){if("0"<=E&&E<="9"){i("number");return}switch(E){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 S=e[r];switch(t[t.length-1]){case"topLevel":x(S);break;case"string":switch(S){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":S==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":S==="."?p("numberNeedsDigit"):S==="e"||S==="E"?p("numberNeedsExponent"):(S<"0"||S>"9")&&(C(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(S==="+"||S==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(S<"a"||S>"z")&&(C(),g());break;case"arrayNeedsValue":S==="]"?g():QR(S)||(m("collectionItem"),p("arrayNeedsComma"),x(S));break;case"arrayNeedsComma":S==="]"?g():S===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":S==="}"?g():S==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":S===":"&&p("objectNeedsValue");break;case"objectNeedsValue":QR(S)||(m("collectionItem"),p("objectNeedsComma"),x(S));break;case"objectNeedsComma":S==="}"?g():S===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(E){return b.push(E.slice(e.length-e.lastIndexOf(E[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 GR(){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 Bp(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 Qp=4294967296;function _S(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>=Qp&&(o=o+(n/Qp|0),n=n%Qp)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?HR(n,o):DS(n,o)}function $R(e,t){let r=DS(e,t),n=r.hi&2147483648;n&&(r=HR(r.lo,r.hi));let o=NS(r.lo,r.hi);return n?"-"+o:o}function NS(e,t){if({lo:e,hi:t}=lL(e,t),t<=2097151)return String(Qp*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()+BR(i)+BR(a)}function lL(e,t){return{lo:e>>>0,hi:t>>>0}}function DS(e,t){return{lo:e|0,hi:t|0}}function HR(e,t){return t=~t,e?e=~e+1:t+=1,DS(e,t)}var BR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function qS(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 zR(){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 Nr=dL();function dL(){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"&&(!!y.Deno||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()),WR(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),YR(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),WR(r),_S(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),YR(r),_S(r)},dec(r,n){return $R(r,n)},uDec(r,n){return NS(r,n)}}}function WR(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function YR(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var MS=Symbol.for("@bufbuild/protobuf/text-encoding");function VS(){if(y[MS]==null){let e=new y.TextEncoder,t=new y.TextDecoder;y[MS]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return y[MS]}var mo;(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"})(mo||(mo={}));var pL=34028234663852886e22,fL=-34028234663852886e22,mL=4294967295,gL=2147483647,hL=-2147483648,Ne=class{constructor(t=VS().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(KR(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return jS(t),qS(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){yL(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){KR(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){jS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return jS(t),t=(t<<1^t>>31)>>>0,qS(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Nr.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=Nr.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Nr.enc(t);return Bp(r.lo,r.hi,this.buf),this}sint64(t){let r=Nr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return Bp(o,a,this.buf),this}uint64(t){let r=Nr.uEnc(t);return Bp(r.lo,r.hi,this.buf),this}},ie=class{constructor(t,r=VS().decodeUtf8){this.decodeUtf8=r,this.varint64=GR,this.uint32=zR,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case mo.Varint:for(;this.buf[this.pos++]&128;);break;case mo.Bit64:this.pos+=4;case mo.Bit32:this.pos+=4;break;case mo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case mo.StartGroup:for(;;){let[a,i]=this.tag();if(i===mo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(i,a)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Nr.dec(...this.varint64())}uint64(){return Nr.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Nr.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 Nr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Nr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function jS(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>gL||e<hL)throw new Error("invalid int32: "+e)}function KR(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>mL||e<0)throw new Error("invalid uint32: "+e)}function yL(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>pL||e<fL))throw new Error("invalid float32: "+e)}var SL=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function LS(){return{fields:{}}}var tu={encode(e,t=new Ne){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&BS.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=LS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=BS.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 tu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=LS();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 XR(){return{key:"",value:void 0}}var BS={encode(e,t=new Ne){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&we.encode(we.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=XR();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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return BS.fromPartial(e??{})},fromPartial(e){let t=XR();return t.key=e.key??"",t.value=e.value??void 0,t}};function US(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var we={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&&tu.encode(tu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ru.encode(ru.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=US();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=tu.unwrap(tu.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=ru.unwrap(ru.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=US();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=US();if(e===null)t.nullValue=SL.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(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.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 QS(){return{values:[]}}var ru={encode(e,t=new Ne){for(let r of e.values)we.encode(we.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=QS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(we.unwrap(we.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=QS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=QS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},vL=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 ZR(){return{op:0,path:"",from:void 0,value:void 0}}var $p={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&&we.encode(we.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=ZR();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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $p.fromPartial(e??{})},fromPartial(e){let t=ZR();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function JR(){return{id:"",type:"",function:void 0}}var Hp={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&&zp.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=JR();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=zp.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hp.fromPartial(e??{})},fromPartial(e){let t=JR();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?zp.fromPartial(e.function):void 0,t}};function eI(){return{name:"",arguments:""}}var zp={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=eI();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 zp.fromPartial(e??{})},fromPartial(e){let t=eI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function tI(){return{value:"",mimeType:""}}var Wp={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=tI();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 Wp.fromPartial(e??{})},fromPartial(e){let t=tI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function rI(){return{value:"",mimeType:void 0}}var Yp={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=rI();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 Yp.fromPartial(e??{})},fromPartial(e){let t=rI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function nI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Ne){return e.data!==void 0&&Wp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Yp.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=nI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=Wp.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Yp.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=nI();return t.data=e.data!==void 0&&e.data!==null?Wp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Yp.fromPartial(e.url):void 0,t}};function oI(){return{text:""}}var Kp={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=oI();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 Kp.fromPartial(e??{})},fromPartial(e){let t=oI();return t.text=e.text??"",t}};function aI(){return{source:void 0,metadata:void 0}}var Xp={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.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=aI();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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=aI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function iI(){return{source:void 0,metadata:void 0}}var Zp={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.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=iI();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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zp.fromPartial(e??{})},fromPartial(e){let t=iI();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 Jp={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jp.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 cI(){return{source:void 0,metadata:void 0}}var ef={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.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=cI();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=we.unwrap(we.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.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function uI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var tf={encode(e,t=new Ne){return e.text!==void 0&&Kp.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Xp.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Zp.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Jp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&ef.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=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=Kp.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Xp.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Zp.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=Jp.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=ef.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.text=e.text!==void 0&&e.text!==null?Kp.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Xp.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Zp.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Jp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?ef.fromPartial(e.document):void 0,t}};function lI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var rf={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)Hp.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)tf.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=lI();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(Hp.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(tf.decode(r,r.uint32()));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.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=>Hp.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>tf.fromPartial(r))||[],t}},AL=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 dI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ve={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&&we.encode(we.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=dI();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=CL(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=dI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function pI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var nf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 nf.fromPartial(e??{})},fromPartial(e){let t=pI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function fI(){return{baseEvent:void 0,messageId:"",delta:""}}var of={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 of.fromPartial(e??{})},fromPartial(e){let t=fI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function mI(){return{baseEvent:void 0,messageId:""}}var af={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 af.fromPartial(e??{})},fromPartial(e){let t=mI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function gI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 sf.fromPartial(e??{})},fromPartial(e){let t=gI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function hI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var cf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 cf.fromPartial(e??{})},fromPartial(e){let t=hI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function yI(){return{baseEvent:void 0,toolCallId:""}}var uf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 uf.fromPartial(e??{})},fromPartial(e){let t=yI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function SI(){return{baseEvent:void 0,snapshot:void 0}}var lf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&we.encode(we.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=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=we.unwrap(we.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.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function vI(){return{baseEvent:void 0,delta:[]}}var df={encode(e,t=new Ne){e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)$p.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=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push($p.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.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>$p.fromPartial(r))||[],t}};function AI(){return{baseEvent:void 0,messages:[]}}var pf={encode(e,t=new Ne){e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)rf.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=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(rf.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.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>rf.fromPartial(r))||[],t}};function CI(){return{baseEvent:void 0,event:void 0,source:void 0}}var ff={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&we.encode(we.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=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=we.unwrap(we.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 ff.fromPartial(e??{})},fromPartial(e){let t=CI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function bI(){return{baseEvent:void 0,name:"",value:void 0}}var mf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&we.encode(we.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=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=bI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function xI(){return{baseEvent:void 0,threadId:"",runId:""}}var gf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 gf.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function wI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var hf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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&&we.encode(we.wrap(e.result),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=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function RI(){return{baseEvent:void 0,code:void 0,message:""}}var yf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 yf.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function II(){return{baseEvent:void 0,stepName:""}}var Sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 Sf.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function EI(){return{baseEvent:void 0,stepName:""}}var vf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 vf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function FI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Af={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 Af.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.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 TI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Cf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.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=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.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 Cf.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.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 PI(){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 kI={encode(e,t=new Ne){return e.textMessageStart!==void 0&&nf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&of.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&af.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&&cf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&uf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&lf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&df.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&pf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&ff.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&mf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&gf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&hf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&yf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Sf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&vf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Af.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Cf.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=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=nf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=of.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=af.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=sf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=cf.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=uf.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=lf.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=df.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=pf.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=ff.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=mf.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=gf.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=hf.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=yf.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Sf.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=vf.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Af.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=Cf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return kI.fromPartial(e??{})},fromPartial(e){let t=PI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?nf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?of.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?af.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?cf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?uf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?lf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?df.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?pf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?ff.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?mf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?gf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?hf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?yf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Sf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?vf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Af.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Cf.fromPartial(e.toolCallChunk):void 0,t}};function CL(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Gp=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}}},bL=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Gp(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Gp(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Gp(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Gp(e.document.source),metadata:e.document.metadata}}};function OI(e){let t=kI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=AL[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===V.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=>bL(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===V.STATE_DELTA)for(let n of r.delta)n.op=vL[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]}),up.parse(r)}var GS="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var wL=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,$S=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(wL);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},_I=e=>e==="*"||e==="x"||e==="X",NI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},RL=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],IL=(e,t)=>{if(_I(e)||_I(t))return 0;let[r,n]=RL(NI(e),NI(t));return r>n?1:r<n?-1:0},HS=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=IL(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var bf=(e,t)=>{let r=$S(e),n=$S(t),o=r.pop(),a=n.pop(),i=HS(r,n);return i!==0?i:o&&a?HS(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 nu(){return so()}function YS(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&YS(t);return e}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=Qe(t),f=Qe(r),m=p,g=f,C;for(let x of e)try{i&&(YS(m),YS(g));let h=yield n(x,m,g);if(h===void 0)continue;if(h.messages!==void 0&&h.messages!==m&&(m=Qe(h.messages)),h.state!==void 0&&h.state!==g&&(g=Qe(h.state)),C=h.stopPropagation,C===!0)break}catch(h){if(i&&h instanceof TypeError){if(a)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else a||console.error("Subscriber error:",h);continue}return{...(m===p?{}:{messages:i&&Object.isFrozen(m)?Qe(m):m}),...(g===f?{}:{state:i&&Object.isFrozen(g)?Qe(g):g}),...(C===void 0?{}:{stopPropagation:C})}});return _Ye.apply(this,arguments)}function xf(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 ou(e){if(e instanceof KS)return e;if(e===!0)return new KS(xf(!0))}var KS=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 zS(e){return e.enabled?new KS(e):void 0}function EL(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 LI=(e,t,r,n,o)=>{let a=ou(o),i=Qe(r.messages),p=Qe(e.state),f={},m=C=>{C.messages!==void 0&&(i=C.messages,f.messages=C.messages),C.state!==void 0&&(p=C.state,f.state=C.state)},g=()=>{let C=Qe(f);return f={},C.messages!==void 0||C.state!==void 0?dt(C):wp};return t.pipe(jp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(C){let x=yield Ye(n,i,p,(h,S,b)=>h.onEvent?.({event:C,agent:r,input:e,messages:S,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",C,{type:C.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",C,{type:C.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(C.type){case V.TEXT_MESSAGE_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onTextMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,role:b="assistant",name:w}=C;if(!i.find(I=>I.id===S)){let I={id:S,role:b,content:"",...(w!==void 0&&{name:w})};i.push(I),m({messages:i})}}return g()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:S}=C,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,E,F)=>I.onTextMessageContentEvent?.({event:C,messages:E,state:F,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:""}${S}`,m({messages:i})),g()}case V.TEXT_MESSAGE_END:{let{messageId:h}=C,S=i.find(b=>b.id===h);return S?(m(yield Ye(n,i,p,(b,w,I)=>b.onTextMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:S,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case V.TOOL_CALL_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onToolCallStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:S,toolCallName:b,parentMessageId:w}=C,I=EL(i,w,S);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:S,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case V.TOOL_CALL_ARGS:{let{toolCallId:h,delta:S}=C,b=i.find(E=>E.toolCalls?.some(F=>F.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(E=>E.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,(E,F,k)=>{let T=w.function.arguments,q=w.function.name,G={};try{G=Up(T)}catch{}return E.onToolCallArgsEvent?.({event:C,messages:F,state:k,agent:r,input:e,toolCallBuffer:T,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=S,m({messages:i})),g()}case V.TOOL_CALL_END:{let{toolCallId:h}=C,S=i.find(w=>w.toolCalls?.some(I=>I.id===h));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=S.toolCalls?.find(w=>w.id===h);return b?(m(yield Ye(n,i,p,(w,I,E)=>{let F=b.function.arguments,k=b.function.name,T={};try{T=JSON.parse(F)}catch{}return w.onToolCallEndEvent?.({event:C,messages:I,state:E,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 V.TOOL_CALL_RESULT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onToolCallResultEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,toolCallId:b,content:w,role:I}=C,E={id:S,toolCallId:b,role:I||"tool",content:w};i.push(E),yield Promise.all(n.map(F=>{F.onNewMessage?.({message:E,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case V.STATE_SNAPSHOT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onStateSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:S}=C;p=S,m({state:p})}return g()}case V.STATE_DELTA:{let h=yield Ye(n,i,p,(S,b,w)=>S.onStateDeltaEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:S}=C;try{p=fo(p,S,!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
+ Current state: ${JSON.stringify(p,null,2)}
38
+ Patch operations: ${JSON.stringify(S,null,2)}
39
+ Error: ${w}`)}}return g()}case V.MESSAGES_SNAPSHOT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onMessagesSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:S}=C,b=new Map(S.map(E=>[E.id,E])),w=E=>E==="activity"||E==="reasoning";i=i.filter(E=>w(E.role)||b.has(E.id)).map(E=>w(E.role)?E:b.get(E.id));let I=new Set(i.map(E=>E.id));for(let E of S)I.has(E.id)||i.push(E);m({messages:i})}return g()}case V.ACTIVITY_SNAPSHOT:{let h=C,S=i.findIndex(F=>F.id===h.messageId),b=S>=0?i[S]:void 0,w=b?.role==="activity"?b:void 0,I=h.replace??!0,E=yield Ye(n,i,p,(F,k,T)=>F.onActivitySnapshotEvent?.({event:h,messages:k,state:T,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(E),E.stopPropagation!==!0){let F={id:h.messageId,role:"activity",activityType:h.activityType,content:Qe(h.content)},k;S===-1?(i.push(F),k=F):w?I&&(i[S]={...w,activityType:h.activityType,content:Qe(h.content)}):I&&(i[S]=F,k=F),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 V.ACTIVITY_DELTA:{let h=C,S=i.findIndex(E=>E.id===h.messageId);if(S===-1)return g();let b=i[S];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,(E,F,k)=>E.onActivityDeltaEvent?.({event:h,messages:F,state:k,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let E=Qe(w.content??{}),F=fo(E,h.patch??[],!0,!1).newDocument;i[S]={...w,content:Qe(F),activityType:h.activityType},m({messages:i})}catch(E){let F=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${h.messageId}': ${F}`)}return g()}case V.RAW:return m(yield Ye(n,i,p,(h,S,b)=>h.onRawEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.CUSTOM:return m(yield Ye(n,i,p,(h,S,b)=>h.onCustomEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.RUN_STARTED:{let h=yield Ye(n,i,p,(S,b,w)=>S.onRunStartedEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let S=C;if(S.input?.messages){for(let b of S.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case V.RUN_FINISHED:return m(yield Ye(n,i,p,(h,S,b)=>h.onRunFinishedEvent?.({event:C,messages:S,state:b,agent:r,input:e,result:C.result}))),g();case V.RUN_ERROR:return m(yield Ye(n,i,p,(h,S,b)=>h.onRunErrorEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.STEP_STARTED:return m(yield Ye(n,i,p,(h,S,b)=>h.onStepStartedEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.STEP_FINISHED:return m(yield Ye(n,i,p,(h,S,b)=>h.onStepFinishedEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case V.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case V.THINKING_START:return g();case V.THINKING_END:return g();case V.THINKING_TEXT_MESSAGE_START:return g();case V.THINKING_TEXT_MESSAGE_CONTENT:return g();case V.THINKING_TEXT_MESSAGE_END:return g();case V.REASONING_START:return m(yield Ye(n,i,p,(h,S,b)=>h.onReasoningStartEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.REASONING_MESSAGE_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onReasoningMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S}=C;if(!i.find(b=>b.id===S)){let b={id:S,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case V.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:S}=C,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,E,F)=>I.onReasoningMessageContentEvent?.({event:C,messages:E,state:F,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:""}${S}`,m({messages:i})),g()}case V.REASONING_MESSAGE_END:{let{messageId:h}=C,S=i.find(b=>b.id===h);return S?(m(yield Ye(n,i,p,(b,w,I)=>b.onReasoningMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:S,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case V.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case V.REASONING_END:return m(yield Ye(n,i,p,(h,S,b)=>h.onReasoningEndEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:S,encryptedValue:b}=C,w=yield Ye(n,i,p,(I,E,F)=>I.onReasoningEncryptedValueEvent?.({event:C,messages:E,state:F,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let E of i)if(E.role==="assistant"&&E.toolCalls){let F=E.toolCalls.find(k=>k.id===S);if(F){F.encryptedValue=b,I=!0;break}}}else{let E=i.find(F=>F.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=b,I=!0)}I&&(f.messages=i)}return g()}}return C.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),TS(),n.length>0?PS({}):C=>C)},WS=e=>t=>{let r=ou(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,C=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,C=!0};return t.pipe(rr(h=>{let S=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return ct(()=>new lt(`Cannot send event type '${S}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&S!==V.RUN_ERROR&&S!==V.RUN_STARTED)return ct(()=>new lt(`Cannot send event type '${S}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(S===V.RUN_STARTED){if(C&&!a)return ct(()=>new lt("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,S!==V.RUN_STARTED&&S!==V.RUN_ERROR)return ct(()=>new lt("First event must be 'RUN_STARTED'"));switch(S){case V.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?ct(()=>new lt(`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),dt(h))}case V.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?dt(h):ct(()=>new lt(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case V.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),dt(h)):ct(()=>new lt(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case V.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?ct(()=>new lt(`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),dt(h))}case V.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?dt(h):ct(()=>new lt(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case V.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),dt(h)):ct(()=>new lt(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case V.STEP_STARTED:{let b=h.stepName;return f.has(b)?ct(()=>new lt(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),dt(h))}case V.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),dt(h)):ct(()=>new lt(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case V.RUN_STARTED:return C=!0,dt(h);case V.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return ct(()=>new lt(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,dt(h);case V.RUN_ERROR:return i=!0,dt(h);case V.CUSTOM:return dt(h);case V.THINKING_TEXT_MESSAGE_START:return m?g?ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,dt(h)):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case V.THINKING_TEXT_MESSAGE_CONTENT:return g?dt(h):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case V.THINKING_TEXT_MESSAGE_END:return g?(g=!1,dt(h)):ct(()=>new lt("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case V.THINKING_START:return m?ct(()=>new lt("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,dt(h));case V.THINKING_END:return m?(m=!1,dt(h)):ct(()=>new lt("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return dt(h)}}))},Fa=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),FL=(e,t)=>Vp(()=>Ra(v(e,t))).pipe(kS(r=>{if(!r.ok){let a=r.headers.get("content-type")||"";return Ra(r.text()).pipe(rr(i=>{let p=i;if(a.includes("application/json"))try{p=JSON.parse(i)}catch{}let f=Error(`HTTP ${r.status}: ${typeof p=="string"?p:JSON.stringify(p)}`);return f.status=r.status,f.payload=p,ct(()=>f)}))}let n={type:Fa.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new st(a=>(a.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:p}=yield o.read();if(i)break;let f={type:Fa.DATA,data:p};a.next(f)}a.complete()}catch(i){a.error(i)}})(),()=>{o.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):ct(()=>Error("Failed to getReader() from response"))})),TL=(e,t)=>{let r=ou(t),n=new an,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==Fa.HEADERS&&p.type===Fa.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(`
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
+ `),C=JSON.parse(g);r?.event("SSE","Event received:",C,{type:C.type}),n.next(C)}catch(g){n.error(g)}}return n.asObservable()},PL=e=>{let t=new an,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Fa.HEADERS&&o.type===Fa.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=OI(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()},kL=(e,t)=>{let r=ou(t),n=new an,o=new xp,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===Fa.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===GS?"protobuf":"sse"}),p===GS?PL(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):TL(o,r).subscribe({next:f=>{try{let m=up.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:V.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()},nt=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),OL=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),_L=R.object({type:R.literal(nt.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),NL=R.object({type:R.literal(nt.enum.TextMessageContent),messageId:R.string(),content:R.string()}),DL=R.object({type:R.literal(nt.enum.TextMessageEnd),messageId:R.string()}),qL=R.object({type:R.literal(nt.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),ML=R.object({type:R.literal(nt.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),VL=R.object({type:R.literal(nt.enum.ActionExecutionEnd),actionExecutionId:R.string()}),jL=R.object({type:R.literal(nt.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),LL=R.object({type:R.literal(nt.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()}),UL=R.object({type:R.literal(nt.enum.MetaEvent),name:OL,value:R.any()}),QL=R.object({type:R.literal(nt.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[_L,NL,DL,qL,ML,VL,jL,LL,UL,QL]),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 BL=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
+ `)},GL=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],C={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(rr(h=>{switch(h.type){case V.TEXT_MESSAGE_START:{let S=h;return[{type:nt.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case V.TEXT_MESSAGE_CONTENT:{let S=h;return[{type:nt.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case V.TEXT_MESSAGE_END:{let S=h;return[{type:nt.enum.TextMessageEnd,messageId:S.messageId}]}case V.TOOL_CALL_START:{let S=h;return g.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),i=!0,C[S.toolCallId]=S.toolCallName,[{type:nt.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case V.TOOL_CALL_ARGS:{let S=h,b=g.find(I=>I.id===S.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${S.toolCallId}'`),[];b.function.arguments+=S.delta;let w=!1;if(m){let I=m.find(E=>E.tool==b.function.name);if(I)try{let E=JSON.parse(Up(b.function.arguments));I.tool_argument&&I.tool_argument in E?(x({...o,[I.state_key]:E[I.tool_argument]}),w=!0):I.tool_argument||(x({...o,[I.state_key]:E}),w=!0)}catch{}}return[{type:nt.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...(w?[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case V.TOOL_CALL_END:{let S=h;return[{type:nt.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case V.TOOL_CALL_RESULT:{let S=h;return[{type:nt.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:C[S.toolCallId]||"unknown"}]}case V.RAW:return[];case V.CUSTOM:{let S=h;switch(S.name){case"Exit":a=!1;break;case"PredictState":m=S.value;break}return[{type:nt.enum.MetaEvent,name:S.name,value:S.value}]}case V.STATE_SNAPSHOT:return x(h.snapshot),[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case V.STATE_DELTA:{let S=h,b=fo(o,S.delta,!0,!1);return b?(x(b.newDocument),[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case V.MESSAGES_SNAPSHOT:return f=h.messages,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case V.RUN_STARTED:return[];case V.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:$L(f)}:{})}),active:!1}];case V.RUN_ERROR:{let S=h;return[{type:nt.enum.RunError,message:S.message,code:S.code}]}case V.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case V.STEP_FINISHED:return g=[],m=null,[{type:nt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function $L(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=BL(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 wf=e=>t=>{let r=ou(e),n,o,a,i,p=()=>{if(!n||i!=="text")throw Error("No text message to close");let C={type:V.TEXT_MESSAGE_END,messageId:n.messageId};return i=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",C,{messageId:C.messageId}),C},f=()=>{if(!o||i!=="tool")throw Error("No tool call to close");let C={type:V.TOOL_CALL_END,toolCallId:o.toolCallId};return i=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",C,{toolCallId:C.toolCallId}),C},m=()=>{if(!a||i!=="reasoning")throw Error("No reasoning message to close");let C={type:V.REASONING_MESSAGE_END,messageId:a.messageId};return i=void 0,a=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",C,{messageId:C.messageId}),C},g=()=>i==="text"?[p()]:i==="tool"?[f()]:i==="reasoning"?[m()]:[];return t.pipe(rr(C=>{switch(C.type){case V.TEXT_MESSAGE_START:case V.TEXT_MESSAGE_CONTENT:case V.TEXT_MESSAGE_END:case V.TOOL_CALL_START:case V.TOOL_CALL_ARGS:case V.TOOL_CALL_END:case V.TOOL_CALL_RESULT:case V.STATE_SNAPSHOT:case V.STATE_DELTA:case V.MESSAGES_SNAPSHOT:case V.CUSTOM:case V.RUN_STARTED:case V.RUN_FINISHED:case V.RUN_ERROR:case V.STEP_STARTED:case V.STEP_FINISHED:case V.THINKING_START:case V.THINKING_END:case V.THINKING_TEXT_MESSAGE_START:case V.THINKING_TEXT_MESSAGE_CONTENT:case V.THINKING_TEXT_MESSAGE_END:case V.REASONING_START:case V.REASONING_MESSAGE_START:case V.REASONING_MESSAGE_CONTENT:case V.REASONING_MESSAGE_END:case V.REASONING_END:return[...g(),C];case V.RAW:case V.ACTIVITY_SNAPSHOT:case V.ACTIVITY_DELTA:case V.REASONING_ENCRYPTED_VALUE:return[C];case V.TEXT_MESSAGE_CHUNK:let x=C,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 E={type:V.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(E),r?.event("TRANSFORM","TEXT_MESSAGE_START",E,{messageId:x.messageId})}if(x.delta!==void 0){let E={type:V.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(E),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",E,{messageId:n.messageId})}return h;case V.TOOL_CALL_CHUNK:let S=C,b=[];if((i!=="tool"||S.toolCallId!==void 0&&S.toolCallId!==o?.toolCallId)&&b.push(...g()),i!=="tool"){if(S.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(S.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:S.toolCallId,toolCallName:S.toolCallName,parentMessageId:S.parentMessageId},i="tool";let E={type:V.TOOL_CALL_START,toolCallId:S.toolCallId,toolCallName:S.toolCallName,parentMessageId:S.parentMessageId};b.push(E),r?.event("TRANSFORM","TOOL_CALL_START",E,{toolCallId:S.toolCallId,toolCallName:S.toolCallName})}if(S.delta!==void 0){let E={type:V.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:S.delta};b.push(E),r?.event("TRANSFORM","TOOL_CALL_ARGS",E,{toolCallId:o.toolCallId})}return b;case V.REASONING_MESSAGE_CHUNK:let w=C,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 E={type:V.REASONING_MESSAGE_START,messageId:w.messageId};I.push(E),r?.event("TRANSFORM","REASONING_MESSAGE_START",E,{messageId:w.messageId})}if(w.delta!==void 0){let E={type:V.REASONING_MESSAGE_CONTENT,messageId:a.messageId,delta:w.delta};I.push(E),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",E,{messageId:a.messageId})}return I}return C.type,[]}),Ea(()=>{g()}))},XS=class{runNext(e,t){return t.run(e).pipe(wf(!1))}runNextWithState(e,t){let r=Qe(e.messages||[]),n=Qe(e.state||{}),o=new xp;return LI(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(jp(/*#__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)}}()))}},HL=class extends XS{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function zL(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 WL=class extends XS{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(zL)};return this.runNext(o,t)}},DI="THINKING_START",qI="THINKING_END",MI="THINKING_TEXT_MESSAGE_START",VI="THINKING_TEXT_MESSAGE_CONTENT",jI="THINKING_TEXT_MESSAGE_END",YL=class extends XS{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(Ia(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case DI:{this.currentReasoningId=nu();let{title:t,...r}=e;return this.warnAboutTransformation(DI,V.REASONING_START),{...r,type:V.REASONING_START,messageId:this.currentReasoningId}}case MI:return this.currentMessageId=nu(),this.warnAboutTransformation(MI,V.REASONING_MESSAGE_START),{...e,type:V.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case VI:{let{delta:t,...r}=e;return this.warnAboutTransformation(VI,V.REASONING_MESSAGE_CONTENT),{...r,type:V.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??nu(),delta:t}}case jI:{let t=this.currentMessageId??nu();return this.warnAboutTransformation(jI,V.REASONING_MESSAGE_END),{...e,type:V.REASONING_MESSAGE_END,messageId:t}}case qI:{let t=this.currentReasoningId??nu();return this.warnAboutTransformation(qI,V.REASONING_END),{...e,type:V.REASONING_END,messageId:t}}default:return e}}},KL="0.0.52",XL=class{get maxVersion(){return KL}get debug(){return this._debug}set debug(e){this._debug=xf(e),this._debugLogger=zS(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?zS(xf(!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.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??so(),this.messages=Qe(n??[]),this.state=Qe(o??{}),this._debug=xf(a),this._debugLogger=zS(this._debug),bf(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new WL),bf(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new YL)}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 HL(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??so();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=>{n=f.result}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,a),_this35.activeRunDetach$=new an;let i;_this35.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Mp(bp(()=>_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),wf(_this35.debugLogger),WS(_this35.debugLogger),f=>f.pipe(Lp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,a),f=>_this35.processApplyEvents(r,f,a),eu(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))),Ea(()=>{_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}))(dt(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 hS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??so();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{n=f.result}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,a),_this36.activeRunDetach$=new an;let i;_this36.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Mp(bp(()=>Vp(()=>_this36.connect(r)),wf(_this36.debugLogger),WS(_this36.debugLogger),f=>f.pipe(Lp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,a),f=>_this36.processApplyEvents(r,f,a),eu(f=>(_this36.isRunning=!1,f instanceof hS?wp:_this36.onError(r,f,a))),Ea(()=>{_this36.isRunning=!1,_this36.onFinalize(r,a),i?.(),i=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(dt(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 LI(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(OS(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||so(),tools:Qe(e?.tools??[]),context:Qe(e?.context??[]),forwardedProps:Qe(e?.forwardedProps??{}),state:Qe(this.state),messages:t}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){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 Ra(Ye(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ia(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}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??so();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(wf(this.debugLogger),WS(this.debugLogger),GL(this.threadId,t.runId,this.agentId),r=>r.pipe(Ia(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},UI=class extends XL{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??{})}run(e){return kL(FL(this.url,this.requestInit(e)),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Qe(this.headers??{});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 QI=(e,t,r)=>{let n=Ke(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let a=`/api/preview/organizations/${t}/agents`;return`${n}${a}/${o}`};var ZS=class extends UI{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}}},BI=(e,t,r)=>new ZS({url:`${QI(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var ZL=new $({required:!0}),GI=new $({required:!0,constrainTo:Od}),$I=e=>({...e,name:_d(e.name)}),HI=P("followUpAnswers/setIsEnabled",e=>_(e,new pe({required:!0}))),zI=P("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,z)),WI=P("followUpAnswers/setFollowUpAnswersConversationToken",e=>_(e,z)),YI=P("followUpAnswers/clearFollowUpAnswersConversationToken"),HCe=P("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:z})),zCe=P("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,z)),WCe=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Nd,answerId:z})),YCe=P("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new pe({required:!0}),answerId:z})),KCe=P("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new pe({required:!0}),answerId:z})),XCe=P("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:ZL,answerId:z})),ZCe=P("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new ne({required:!0,each:new Y({values:nS})}),answerId:z})),JCe=P("followUpAnswers/followUpCompleted",e=>_(e,{answerId:z,cannotAnswer:new pe({required:!1})})),ebe=P("followUpAnswers/followUpFailed",e=>_(e,{message:new $,code:new oe({min:0}),answerId:z})),tbe=P("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new $})),rbe=P("followUpAnswers/likeFollowUp",e=>_(e,{answerId:z})),nbe=P("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:z})),obe=P("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:z})),KI=P("followUpAnswers/resetFollowUpAnswers"),abe=P("followUpAnswers/stepStarted",e=>_($I(e),{answerId:z,name:GI,startedAt:new oe({min:0,required:!0})})),ibe=P("followUpAnswers/stepFinished",e=>_($I(e),{answerId:z,name:GI,finishedAt:new oe({min:0,required:!0})}));d();c();l();u();var JL={"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 XI(e){return e?JL[e]??1004:1004}function eU(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 Rf(e){if(e)return eU({...e})}var ZI=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(qi(n.runId)),e(Jr(!1)),e(Jo(!0)),e(zI(n.threadId)),e(YI())},onStepStartedEvent:({event:n})=>{e($d({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Hd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(ea({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:a}=n;switch(o){case"header":{a?.contentFormat&&e(na(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(HI(a.followUpEnabled)),a?.conversationToken&&e(WI(a.conversationToken));return}case"citations":{e(ta({citations:a.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=XI(n.code);e(ra({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",a=o?!r:void 0;e(Gc(o)),e(oa(!o)),e(Jo(!1)),e(ki(o,t,a,n.threadId)),e(Oi())}}};var JI=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,a){t();let i=Nl(n),p=qb(n),f=Mb(n),m=Db(n),g=Vb(n),C=BI(i,p,f);e=C;let x=ZI(o),h=Mw(n,a());try{o(Jr(!0)),yield C.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(S){o(Jr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",S)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var eE=e=>{let t=VC({extra:e}),r=JI();return t.startListening({actionCreator:ke.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let a=o.getState();if(!uy(a))return;r.abortRun(),o.dispatch(lr()),o.dispatch(KI());let i=Zo(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 tE=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)},rE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var JS=(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 nE(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=eA(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Ka({...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 tU(e){if(!e||!rU(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 oE(e,t=60){if(!e)return!1;let r=tU(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function rU(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function iE(e,t){let r=0,n=null,o=Du(()=>{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 C=yield n;return g&&C&&f.dispatch(yi({accessToken:C})),C});return function a(_x208){return _ref85.apply(this,arguments)}}(),i=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),g=oU(m);if(!(!g||!oE(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(C){e.warn(C,"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."),aE(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 C=typeof g=="function",x=typeof t=="function";if(!C)return m(g);x&&(yield i(f));let h=yield m(g);return nU(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."),aE(f,h.error),h):h});return function(_x213){return _ref89.apply(this,arguments)}}())}function nU(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ha().name}function aE(e,t){e.dispatch(Fi({status:401,statusCode:401,message:t.message,type:t.name}))}function oU(e){return e.configuration.accessToken}d();c();l();u();function sE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return wC({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(rE(n.logger))})}function aU(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},a={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return a.analyticsMode!=="next"&&Jv()?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):a}function cE(e,t){let r={...e.reducers,configuration:be,version:Gw},n=iU({...e,reducers:r},t,be),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(yi({accessToken:o,environment:a,organizationId:i}));let p=aU(e.configuration,n.logger);return p&&n.dispatch(Bl(p)),n}function iU(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=nE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return bc(m.state,o)},get navigatorContext(){return JS(this.relay,o)}},f=sU(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($l())},disableAnalytics(){f.dispatch(Gl())},get state(){return f.getState()},get relay(){return bc(this.state,o)},get navigatorContext(){return JS(this.relay,o)},logger:i,store:f};return m}function sU(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=cU(e,t.logger,()=>t.navigatorContext);return sE({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function cU(e,t,r){let{renewAccessToken:n}=e.configuration,o=iE(t,n),a=eE({getNavigatorContext:r});return[Jw,o,tE(t),Hw].concat(aa.middleware,a.middleware,e.middlewares||[])}var uU=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
42
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
43
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
44
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function pf(e){e==="next"&&console.warn(mL)}d();c();l();u();var BI=Er(QI(),1);function GI(e){return(0,BI.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function $I(e,t){let r=OL(e),n=fr,o=_L(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function OL(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function _L(e){return e.preprocessRequest||Qu}d();c();l();u();d();c();l();u();var HI={organizationId:z,accessToken:z,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new de({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}$/})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function zI(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var WI=new Fe({...HI,insightId:z,search:new Y({options:{required:!1},values:{locale:ze}})}),NL="2729db39-d7fd-4504-a06e-668c64968c95";function QS(){return{...zI(),insightId:NL}}var DL={insightConfiguration:$l,search:we,insightInterface:Yn,searchHub:Cd,resultPreview:Ia};function YI(e){let t=GI(e.loggerOptions);qL(e.configuration,t);let r=ML(e.configuration,t),n=VL(t),o={...$I(e.configuration,t),apiClient:r,streamingClient:n},i={...e,reducers:DL},a=NI(i,o);pf(a.state.configuration.analytics.analyticsMode);let{insightId:p,search:f}=e.configuration;return a.dispatch(Gl({insightId:p})),a.dispatch($r()),f&&a.dispatch(ya(f)),{...a,get state(){return a.state},executeFirstSearch(m=ed()){Ad(a.state)||a.dispatch(Ae({legacy:m,next:Vb()}))}}}function qL(e,t){try{WI.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function ML(e,t){return new Bu({logger:t,preprocessRequest:e.preprocessRequest||Qu})}function VL(e){return new Uu({logger:e})}d();c();l();u();function me(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 KI={articleLanguage:ze,articlePublishStatus:ze,articleVersionNumber:ze,caseId:z,knowledgeArticleId:ze,name:ze,permanentId:ze,resultUrl:ze,source:ze,title:z,uriHash:ze,isAttachedFromCitation:new de({required:!1,default:!1})},jL=new Y({options:{required:!0},values:KI}),gf=T("insight/attachToCase/setAttachedResults",e=>O(e,{results:new ne({each:jL}),loading:new de({required:!1,default:!1})})),go=T("insight/attachToCase/attach",e=>XI(e)),ho=T("insight/attachToCase/detach",e=>XI(e)),XI=e=>ee(e.permanentId)&&ee(e.uriHash)?{payload:e,error:Fr(new ko("Either permanentId or uriHash is required"))}:O(e,KI);d();c();l();u();d();c();l();u();var Nr=e=>{let t=Z(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var ts=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Z(r.insightCaseContext);return t.logCaseAttach(Xe(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Tr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Nr(t)}}}),rs=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,Z(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:Tr(e,t),context:Nr(t)})});d();c();l();u();d();c();l();u();function JI(){return{results:[],loading:!1}}var yo=le(JI(),e=>{e.addCase(gf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(go,(t,r)=>{(!ee(r.payload.permanentId)||!ee(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(ho,(t,r)=>{t.results=t.results.filter(n=>LL(n,r.payload))})}),LL=(e,t)=>{let r=!ee(e.permanentId)&&e?.permanentId===t?.permanentId,n=!ee(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var hf=(e,t)=>Ui(e.raw[t])?String(e.raw[t]):void 0,ns=(e,t)=>({articleLanguage:hf(e,"sflanguage"),articleVersionNumber:hf(e,"sflanguage"),articlePublishStatus:hf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:hf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function ZI(e,t){if(!UL(e))throw ie;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=me(e),{result:i,caseId:a}=t.options,p=()=>ee(a)||ee(i.raw.permanentid)&&ee(i.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=a===f.caseId,h=!ee(f.permanentId)&&f.permanentId===i.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===i.raw.urihash;return m&&(h||C)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(go(ns(i,a))),r(ts(i))},detach(){r(ho(ns(i,a))),r(rs(i))}}}function UL(e){return e.addReducers({configuration:Ce,attachedResults:yo}),!0}d();c();l();u();function eE(e,t){if(!QL(e))throw ie;let{dispatch:r}=e,n=me(e),{caseId:o}=t.options,i=p=>ee(o)||ee(p.raw.permanentid)&&ee(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,h=!ee(f.permanentId)&&f.permanentId===p.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(h||C)}),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(go(ns(p,o))),r(ts(p))},detach(p){r(ho(ns(p,o))),r(rs(p))}}}function QL(e){return e.addReducers({configuration:Ce,attachedResults:yo}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var he=z;d();c();l();u();var BL={state:new Ge({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new ne({required:!0,each:z}),moreValuesAvailable:new de({required:!1})};function BS(e){e.children.forEach(t=>{BS(t)}),fr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},BL)}var os={facetId:he,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ge({required:!1}),basePath:new ne({required:!1,each:z}),filterByBasePath:new de({required:!1})};var is=T("categoryFacet/register",e=>O(e,os)),as=T("categoryFacet/toggleSelectValue",e=>{try{return fr(e.facetId,z),BS(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Fr(t)}}}),So=T("categoryFacet/deselectAll",e=>O(e,os.facetId)),ou=T("categoryFacet/updateNumberOfValues",e=>O(e,{facetId:os.facetId,numberOfValues:os.numberOfValues})),yf=T("categoryFacet/updateSortCriterion",e=>O(e,{facetId:os.facetId,criterion:new Ge})),tE=T("categoryFacet/updateBasePath",e=>O(e,{facetId:os.facetId,basePath:new ne({each:z})}));d();c();l();u();var XRe={categoryFacetId:he,categoryFacetPath:new ne({required:!0,each:z})};var rE=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var GL={categoryFacetId:he,categoryFacetPath:new ne({required:!0,each:z})},$L=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,i=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:i}},Sf=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{O(e,GL);let n={...$L(r,e),...Z(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Qe=T("facetOptions/update",(e={freezeFacetOrder:!0})=>O(e,{freezeFacetOrder:new de({required:!1})})),nr=T("facetOptions/facet/enable",e=>O(e,he)),ft=T("facetOptions/facet/disable",e=>O(e,he));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 iu={facetId:he,captions:new Y({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var HL={path:new ne({required:!0,each:z}),displayValue:Ke,rawValue:Ke,count:new oe({required:!0,min:0})},vf=T("categoryFacet/selectSearchResult",e=>O(e,{facetId:he,value:new Y({values:HL})})),nE=T("categoryFacetSearch/register",e=>O(e,iu));d();c();l();u();function ss(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function cs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Af(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function au(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Cf(e,t,r){e.currentValues=zL(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function zL(e,t){if(!e.length)return[];let r=oE(e[0],t),n=r;for(let o of e.splice(1)){let i=oE(o,t);n.children.push(i),n=i}return n.state="selected",n.retrieveChildren=!0,[r]}function oE(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var bf=le(sa(),e=>{e.addCase(is,(t,r)=>{let n=r.payload,{facetId:o,tabs:i}=n;if(o in t)return;let a=YL(n),p=a.numberOfValues;t[o]={request:a,initialNumberOfValues:p,tabs:i}}).addCase(rt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(at,(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&&Cf(p,[],a.initialNumberOfValues);return}let m=n[i]||[];(m.length||p.currentValues.length)&&Cf(p,m,a.initialNumberOfValues)})}).addCase(yf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,i=t[n]?.request;i&&(i.sortCriteria=o)}).addCase(tE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,i=t[n]?.request;i&&(i.basePath=[...o])}).addCase(as,(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=WL(a,f,i);if(m.length){let C=m[0];C.retrieveChildren=!0,C.state="selected",C.previousState="idle",C.children=[];return}let h=aE(o.value,i);h.state="selected",h.previousState="idle",m.push(h),a.numberOfValues=1}).addCase(So,(t,r)=>{let n=r.payload;au(t,n)}).addCase(Zt,t=>{Object.keys(t).forEach(r=>au(t,r))}).addCase(Aa,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(ou,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,i=t[n]?.request;if(i){if(!i.currentValues.length)return Af(i,o);KL(t,r.payload)}}).addCase(vf,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n];if(!i)return;let a=[...o.path,o.rawValue];Cf(i.request,a,i.initialNumberOfValues)}).addCase(Ra.fulfilled,(t,r)=>{iE(t,r.payload.response.facets)}).addCase(Te.fulfilled,(t,r)=>{iE(t,r.payload.response.facets)}).addCase(ft,(t,r)=>{au(t,r.payload)}).addCase(_t,(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)&&au(t,o)})})}),GS={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function WL(e,t,r){let n=e.currentValues;for(let o of t){let i=n[0];(!i||o!==i.value)&&(i=aE(o,r),n.length=0,n.push(i)),i.retrieveChildren=!1,i.previousState=void 0,i.state="idle",n=i.children}return n}function YL(e){return{...GS,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function aE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function iE(e,t){t.forEach(r=>{if(!XL(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let i=JL(o,r);o.currentValues=i?[]:o.currentValues,o.preventAutoSelect=!1})}function KL(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 XL(e,t){return t.facetId in e}function JL(e,t){let r=Br(e.currentValues),n=Br(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var an=new $({regex:/^[a-zA-Z0-9-_]+$/}),sn=new $({required:!0}),sE=new ne({each:new $}),cE=new $,uE=new de,cn=new de,un=new oe({min:0}),Dr=new oe({min:1}),xf=new de({required:!0}),ZL=new Y,eU=new $,tU={captions:ZL,numberOfValues:Dr,query:eU},us=new Y({values:tU}),wf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ne({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),bEe=new de,Rf=new ne({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var Ti={value:z,numberOfResults:new oe({min:0}),state:z};var rU={facetId:he,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ge({required:!1}),resultsMustMatch:new Ge({required:!1}),allowedValues:wf,customSort:Rf},ls=T("facet/register",e=>O(e,rU)),vo=T("facet/toggleSelectValue",e=>O(e,{facetId:he,selection:new Y({values:Ti})})),Ao=T("facet/toggleExcludeValue",e=>O(e,{facetId:he,selection:new Y({values:Ti})})),St=T("facet/deselectAll",e=>O(e,he)),If=T("facet/updateSortCriterion",e=>O(e,{facetId:he,criterion:new Ge({required:!0})})),su=T("facet/updateNumberOfValues",e=>O(e,{facetId:he,numberOfValues:new oe({required:!0,min:1})})),cu=T("facet/updateIsFieldExpanded",e=>O(e,{facetId:he,isFieldExpanded:new de({required:!0})})),Pi=T("facet/updateFreezeCurrentValues",e=>O(e,{facetId:he,freezeCurrentValues:new de({required:!0})}));d();c();l();u();var ds=e=>He("analytics/facet/unexclude",(t,r)=>{O(e,{facetId:he,facetValue:z});let n=Xt(r),o=da(e,n);return t.makeFacetUnexclude(o)});var ir=()=>({actionCause:"facetClearAll"}),dr=()=>({actionCause:"facetSelect"}),Ef=()=>({actionCause:"facetExclude"}),Mn=()=>({actionCause:"facetDeselect"});var $S=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var ps=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{O(e,he);let n={...Bo(e,Xt(r)),...Z(r.insightCaseContext)};return t.logFacetShowMore(n)}),fs=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{O(e,he);let n={...Bo(e,Xt(r)),...Z(r.insightCaseContext)};return t.logFacetShowLess(n)}),ln=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{O(e,{facetId:he,sortCriterion:new Ge({required:!0})});let{facetId:n,sortCriterion:o}=e,i=Xt(r),p={...Bo(n,i),criteria:o,...Z(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Lt=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{O(e,he);let n=Xt(r),o={...Bo(e,n),...Z(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{O(e,{facetId:he,facetValue:z});let n=Xt(r),o={...da(e,n),...Z(r.insightCaseContext)};return t.logFacetSelect(o)}),qr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{O(e,{facetId:he,facetValue:z});let n=Xt(r),o={...da(e,n),...Z(r.insightCaseContext)};return t.logFacetDeselect(o)}),uu=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{O(e,{facetId:he,facetValue:z});let n={...da(e,Xt(r)),...Z(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var lE={facetId:he,value:new Y({values:{displayValue:Ke,rawValue:Ke,count:new oe({required:!0,min:0})}})},dE=T("facetSearch/register",e=>O(e,iu)),Ff=T("facetSearch/update",e=>O(e,iu)),Tf=T("facetSearch/toggleSelectValue",e=>O(e,lE)),Pf=T("facetSearch/toggleExcludeValue",e=>O(e,lE));var ms=le(la(),e=>{e.addCase(ls,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=lb(nU(r.payload),o))}).addCase(rt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(at,(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]||[],h=f.length+m.length,C=p.currentValues.filter(b=>!f.includes(b.value)&&!m.includes(b.value));p.currentValues=[...f.map(fE),...m.map(mE),...C.map(iU)],p.preventAutoSelect=h>0,p.numberOfValues=Math.max(h,p.numberOfValues)})}).addCase(vo,(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){kf(i,o);return}let p=a.state==="selected";a.previousState=a.state,a.state=p?"idle":"selected",i.freezeCurrentValues=!0}).addCase(Ao,(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){kf(i,o);return}let p=a.state==="excluded";a.previousState=a.state,a.state=p?"idle":"excluded",i.freezeCurrentValues=!0}).addCase(Pi,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,i=t[n]?.request;i&&(i.freezeCurrentValues=o)}).addCase(St,(t,r)=>{cs(t[r.payload]?.request)}).addCase(Zt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>cs(r))}).addCase(ad,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>cs(r))}).addCase(Aa,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(If,(t,r)=>{ss(t,r.payload)}).addCase(su,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Af(t[n]?.request,o)}).addCase(cu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,i=t[n]?.request;i&&(i.isFieldExpanded=o)}).addCase(Te.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>pE(t[o.facetId]?.request,o))}).addCase(Ra.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>pE(t[o.facetId]?.request,o))}).addCase(Tf,(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(h=>h.value===a);if(f){f.state="selected";return}let m=fE(a);kf(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(Pf,(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(h=>h.value===a);if(f){f.state="excluded";return}let m=mE(a);kf(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(ft,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];cs(n)}).addCase(_t,(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)&&cs(i.request)})})});function kf(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 pE(e,t){e&&(e.currentValues=t.values.map(oU),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var HS={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function nU(e){return{...HS,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function oU(e){let{value:t,state:r}=e;return{value:t,state:r}}function fE(e){return{value:e,state:"selected"}}function mE(e){return{value:e,state:"excluded"}}function iU(e){return{...e,state:"idle"}}d();c();l();u();var Of=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(Z(t.insightCaseContext)));d();c();l();u();d();c();l();u();function gs(e){let t=gE(e.start,e),r=gE(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function gE(e,t){let{dateFormat:r}=t;return sA(e)?(ju(e),oA(e)):typeof e=="string"&&Un(e)?(ju(e),e):(eA(e,r),Vu(Hi(e,r)))}d();c();l();u();var hs=T("rangeFacet/updateSortCriterion",e=>O(e,{facetId:he,criterion:new Ge({required:!0})}));d();c();l();u();var ki={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new de({required:!0}),numberOfResults:new oe({required:!0,min:0})},Oi={start:z,end:z,endInclusive:new de({required:!0}),state:z,numberOfResults:new oe({required:!0,min:0})},Vn=e=>({facetId:he,selection:typeof e.start=="string"?new Y({values:Oi}):new Y({values:ki})});var aU={start:z,end:z,endInclusive:new de({required:!0}),state:z},sU={facetId:he,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:aU})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function hE(e){return Un(e)?Xs(e):e}function _f(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=gs(t);if(Hi(hE(r)).isAfter(Hi(hE(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var dn=T("dateFacet/register",e=>{try{return fr(e,sU),_f(e),{payload:e,error:null}}catch(t){return{payload:e,error:Fr(t)}}}),pn=T("dateFacet/toggleSelectValue",e=>O(e,{facetId:he,selection:new Y({values:Oi})})),fn=T("dateFacet/toggleExcludeValue",e=>O(e,{facetId:he,selection:new Y({values:Oi})})),jn=T("dateFacet/updateFacetValues",e=>{try{return fr(e,{facetId:he,values:new ne({each:new Y({values:Oi})})}),_f({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Fr(t)}}}),Nf=hs,Df=St;d();c();l();u();d();c();l();u();var qf=(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}`}},Mf=()=>({actionCause:"breadcrumbFacet"});var zS=Mf;d();c();l();u();var lu=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{O(e,Vn(e.selection));let n={...qf(r,e),...Z(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function cU(e,t){return!!t&&t.facetId in e.dateFacetSet}var yE=(e,t)=>{let r=En(e,t);if(cU(e,r))return r},SE=(e,t)=>(yE(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),vE=(e,t)=>(yE(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var jf={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function Lf(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=AE(r);r.numberOfValues=o,e[n]=t}function Uf(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=AE(n))}function Qf(e,t,r){let n=e[t]?.request;if(!n)return;let o=Vf(n.currentValues,r);if(!o)return;let i=o.state==="selected";o.previousState=o.state,o.state=i?"idle":"selected",n.preventAutoSelect=!0}function Bf(e,t,r){let n=e[t]?.request;if(!n)return;let o=Vf(n.currentValues,r);if(!o)return;let i=o.state==="excluded";o.previousState=o.state,o.state=i?"idle":"excluded",n.preventAutoSelect=!0}function mn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function Gf(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(Vf(o,p)&&(p.state="selected"),p));let i=o.filter(p=>!Vf(n.currentValues,p)),a=n.currentValues;a.push(...i),n.numberOfValues=Math.max(n.numberOfValues,a.length)})}function $f(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 Vf(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function AE(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var gn=le(ca(),e=>{e.addCase(dn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=uU(n);Lf(t,cb(i,o))}).addCase(rt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(at,(t,r)=>{let n=r.payload.df||{};Gf(t,n)}).addCase(pn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Qf(t,n,o)}).addCase(fn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Bf(t,n,o)}).addCase(jn,(t,r)=>{let{facetId:n,values:o}=r.payload;Uf(t,n,o)}).addCase(Df,(t,r)=>{mn(t,r.payload)}).addCase(Zt,t=>{Object.keys(t).forEach(r=>{mn(t,r)})}).addCase(Nf,(t,r)=>{ss(t,r.payload)}).addCase(Te.fulfilled,(t,r)=>{let n=r.payload.response.facets;$f(t,n,lU)}).addCase(ft,(t,r)=>{mn(t,r.payload)}).addCase(_t,(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)&&mn(t,o)})})});function uU(e){return{...jf,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function lU(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var dU={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new de({required:!0})},pU={facetId:he,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:dU})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function Hf(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 hn=T("numericFacet/register",e=>{try{return O(e,pU),Hf(e),{payload:e,error:null}}catch(t){return{payload:e,error:Fr(t)}}}),yn=T("numericFacet/toggleSelectValue",e=>O(e,{facetId:he,selection:new Y({values:ki})})),Sn=T("numericFacet/toggleExcludeValue",e=>O(e,{facetId:he,selection:new Y({values:ki})})),Ln=T("numericFacet/updateFacetValues",e=>{try{return fr(e,{facetId:he,values:new ne({each:new Y({values:ki})})}),Hf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Fr(t)}}}),zf=hs,Wf=St;d();c();l();u();var WS=Mf;d();c();l();u();d();c();l();u();var CE=(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 du=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{O(e,Vn(e.selection));let n={...CE(r,e),...Z(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function fU(e,t){return!!t&&t.facetId in e.numericFacetSet}var bE=(e,t)=>{let r=En(e,t);if(fU(e,r))return r},xE=(e,t)=>(bE(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),wE=(e,t)=>(bE(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Co=le(ua(),e=>{e.addCase(hn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=mU(n);Lf(t,ub(i,o))}).addCase(rt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(at,(t,r)=>{let n=r.payload.nf||{};Gf(t,n)}).addCase(yn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Qf(t,n,o)}).addCase(Sn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Bf(t,n,o)}).addCase(Ln,(t,r)=>{let{facetId:n,values:o}=r.payload;Uf(t,n,o)}).addCase(Wf,(t,r)=>{mn(t,r.payload)}).addCase(Zt,t=>{Object.keys(t).forEach(r=>{mn(t,r)})}).addCase(zf,(t,r)=>{ss(t,r.payload)}).addCase(Te.fulfilled,(t,r)=>{let n=r.payload.response.facets;$f(t,n,gU)}).addCase(ft,(t,r)=>{mn(t,r.payload)}).addCase(_t,(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)&&mn(t,o)})})});function mU(e){return{...jf,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function gU(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var pu=z,Yf=new Y({options:{required:!0},values:{caption:Ke,expression:Ke,state:new $({constrainTo:["idle","selected","excluded"]})}}),RE=new ne({required:!0,each:Yf});var Zke=T("staticFilter/register",e=>O(e,{id:pu,values:RE})),IE=T("staticFilter/toggleSelect",e=>O(e,{id:pu,value:Yf})),EE=T("staticFilter/toggleExclude",e=>O(e,{id:pu,value:Yf})),eOe=T("staticFilter/deselectAllFilterValues",e=>O(e,pu));d();c();l();u();var Kf=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...Z(r.insightCaseContext)}));d();c();l();u();var Xf=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 FE(e){let t=me(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Zt())},deselectBreadcrumb(n){n.deselect()}}}function TE(e){if(!hU(e))throw ie;let t=FE(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let g={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:S,selection:x})=>{let w=uu({facetId:S,facetValue:x.value});r(vo({facetId:S,selection:x})),r(Pi({facetId:S,freezeCurrentValues:!1})),r(Ae({legacy:w,next:$S()}))},executeToggleExclude:({facetId:S,selection:x})=>{let w=uu({facetId:S,facetValue:x.value});r(Ao({facetId:S,selection:x})),r(Pi({facetId:S,freezeCurrentValues:!1})),r(Ae({legacy:w,next:$S()}))},facetValuesSelector:ib};return Xf(g)},i=()=>{let g={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:S=>{r(yn(S)),r(Ae({legacy:du(S),next:WS()}))},executeToggleExclude:S=>{r(Sn(S)),r(Ae({legacy:du(S),next:WS()}))},facetValuesSelector:xE};return Xf(g)},a=()=>{let g={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:S=>{r(pn(S)),r(Ae({legacy:lu(S),next:zS()}))},executeToggleExclude:S=>{r(fn(S)),r(Ae({legacy:lu(S),next:zS()}))},facetValuesSelector:vE};return Xf(g)},p=g=>{let S=sb(n(),g);return{facetId:g,field:n().categoryFacetSet[g].request.field,path:S,deselect:()=>{r(So(g)),r(Ae({legacy:Sf({categoryFacetPath:S.map(x=>x.value),categoryFacetId:g}),next:rE()}))}}},f=()=>Object.keys(n().categoryFacetSet).map(p).filter(g=>g.path.length),m=()=>{let g=n().staticFilterSet||{};return Object.values(g).map(h)},h=g=>{let{id:S,values:x}=g,w=x.filter(R=>R.state!=="idle").map(R=>C(S,R));return{id:S,values:w}},C=(g,S)=>({value:S,deselect:()=>{let{caption:x,expression:w}=S,R=Kf({staticFilterId:g,staticFilterValue:{caption:x,expression:w}});S.state==="selected"?r(IE({id:g,value:S})):S.state==="excluded"&&r(EE({id:g,value:S})),r(Ae({legacy:R}))}});function b(){return!![...o(),...i(),...a(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:i(),dateFacetBreadcrumbs:a(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:b()}},deselectAll:()=>{t.deselectAll(),r(Ae({legacy:Of(),next:{actionCause:"breadcrumbResetAll"}}))}}}function hU(e){return e.addReducers({configuration:Ce,search:we,facetSet:ms,numericFacetSet:Co,dateFacetSet:gn,categoryFacetSet:bf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var PE=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Jf=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),kE=()=>({correctedQuery:"",corrections:[],originalQuery:""});function OE(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Jf(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var _E=(e,t)=>{let r={...kE(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var NE=le(OE(),e=>{e.addCase(zl,t=>{t.enableDidYouMean=!0}).addCase(Yb,t=>{t.enableDidYouMean=!1}).addCase(Kb,t=>{t.automaticallyCorrectQuery=!0}).addCase(Wl,t=>{t.automaticallyCorrectQuery=!1}).addCase(Te.pending,t=>{t.queryCorrection=Jf(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(Te.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let i=o?.[0]?o[0]:Jf();t.queryCorrection=i}t.queryCorrectionMode==="next"&&_E(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Jt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Pc,(t,r)=>{t.queryCorrectionMode=r.payload})});function DE(e,t={}){if(!yU(e))throw ie;let r=me(e),{dispatch:n}=e;n(zl()),t.options?.automaticallyCorrectQuery===!1&&n(Wl()),n(Pc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,i=()=>PE(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(Jt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(a){n(Pc(a))}}}function yU(e){return e.addReducers({configuration:Ce,didYouMean:NE}),!0}var qE={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function ME(e,t={options:qE}){let r={...qE,...t.options},n=DE(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Ae({legacy:ox(),next:px()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Ut=le(Xl(),e=>{e.addCase(Qe,(t,r)=>({...t,...r.payload})).addCase(Te.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(Te.rejected,t=>{t.freezeFacetOrder=!1}).addCase(rt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Zf(o,t,n)}).addCase(ls,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Zf(o,t,n)}).addCase(dn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Zf(o,t,n)}).addCase(hn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Zf(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(ft,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(at,(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]=sy()),t.facets[n].enabled=!0})})});function Zf(e,t,r){let n={...sy(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var em=le(Zl(),e=>{e.addCase(Kd,(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;VE(t,n)}).addCase(Yd,(t,r)=>{let n=r.payload;VE(t,n)}).addCase(rt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(at,(t,r)=>{let n=r.payload.tab;ee(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function VE(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function jE(e){if(!SU(e))throw ie;let t=me(e),r=it(n=>n.tabSet,n=>Object.values(n).find(i=>i.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function SU(e){return e.addReducers({tabSet:em}),!0}function LE(e,t){if(!vU(e))throw ie;let r=jE(e),n=S=>e.state.facetOptions.facets[S]?.enabled??!1,o=S=>e.state.facetSet?.[S]?.request?.currentValues??e.state.categoryFacetSet?.[S]?.request?.currentValues??e.state.numericFacetSet?.[S]?.request?.currentValues??e.state.dateFacetSet?.[S]?.request?.currentValues??null,i=S=>S in e.state.facetOptions.facets,a=S=>e.state.facetOptions.facets[S]?.tabs,p=()=>Bi({isFacetRegistered:i(t.facetId),parentFacets:t.conditions.map(({parentFacetId:S})=>i(S)?{enabled:n(S),values:o(S)}:null),isTabEnabled:or(a(t.facetId),r.state.activeTab)}),f=()=>{let S=p();return S===b?!1:(b=S,!0)},m=()=>t.conditions.length>0?t.conditions.some(S=>{if(!n(S.parentFacetId))return!1;let x=o(S.parentFacetId);return x===null?!1:S.condition(x)}):!0,h=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([S,x])=>x.request.freezeCurrentValues&&e.dispatch(Pi({facetId:S,freezeCurrentValues:!1})))},C=()=>{if(!i(t.facetId))return;let S=n(t.facetId),x=m(),w=or(a(t.facetId),r.state.activeTab),R=x&&w;S!==R&&(e.dispatch(R?nr(t.facetId):ft(t.facetId)),h())},b=p(),g=e.subscribe(()=>{f()&&C()});return C(),{stopWatching(){g()}}}function vU(e){return e.addReducers({facetOptions:Ut}),!0}function UE(e,t){return LE(e,t)}d();c();l();u();d();c();l();u();function QE(e){if(!AU(e))throw ie;let t=me(e),r=()=>e.state;return{...t,sort(n){return Oc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(i=>i.facetId)}}}}function AU(e){return e.addReducers({search:we,facetOptions:Ut}),!0}function BE(e){return QE(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function tm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,i={...ys,...t},a=r();e[n]={options:i,isLoading:o,response:a,initialNumberOfValues:i.numberOfValues,requestId:""}}function rm(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function nm(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function om(e,t){let r=e[t];r&&(r.isLoading=!1)}function im(e,t,r){let{facetId:n,response:o}=t,i=e[n];i&&i.requestId===r&&(i.isLoading=!1,i.response=o)}function fu(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=ys.query)}function am(e,t){Object.keys(e).forEach(r=>fu(e,{facetId:r},t))}var ys={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var GE=/*#__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:h,basePath:C,filterFacetCount:b}=i,g=CU(i),S=g.length?[g]:[],x=`*${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:C,captions:a,numberOfValues:f,query:x,field:m,delimitingCharacter:h,ignorePaths:S,filterFacetCount:b,type:"hierarchical",...(n?{}:{searchContext:(yield Sr(t,r)).request})}});return function GE(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),CU=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var $E=/*#__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,h=f.filter(b=>b.state!=="idle").map(b=>b.value),C=`*${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:C,field:p,ignoreValues:h,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield Sr(t,r)).request})}});return function $E(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var HE=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){let a=r(),p;o(t,z),bU(a,t)?p=yield $E(t,a,i,e):p=yield GE(t,a,i,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),bo=pe("facetSearch/executeSearch",HE(!1)),O0e=pe("facetSearch/executeSearch",HE(!0)),sm=T("facetSearch/clearResults",e=>O(e,{facetId:he})),bU=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function zE(){return{}}var WE=le(zE(),e=>{e.addCase(nE,(t,r)=>{let n=r.payload;tm(t,n,YS)}).addCase(Ff,(t,r)=>{rm(t,r.payload)}).addCase(bo.pending,(t,r)=>{let n=r.meta.arg;nm(t,n,r.meta.requestId)}).addCase(bo.rejected,(t,r)=>{let n=r.meta.arg;om(t,n)}).addCase(bo.fulfilled,(t,r)=>{im(t,r.payload,r.meta.requestId)}).addCase(sm,(t,{payload:{facetId:r}})=>{fu(t,{facetId:r},YS)}).addCase(Te.fulfilled,t=>{am(t,YS)})});function YS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function YE(e,t){let{field:r,state:n}=e;if(!xU(e))return r;let o=`${r}_`,i=wU(o,n);return IU(r,t),`${o}${i}`}function xU(e){let{field:t,state:r}=e;return KE(r).some(o=>o&&t in o)}function wU(e,t){let n=KE(t).map(o=>Object.keys(o||{})).reduce((o,i)=>o.concat(i),[]);return RU(n,e)+1}function KE(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function RU(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 IU(e,t){let r=`A facet with field "${e}" already exists.
45
- To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function xr(e,t){let{state:r,logger:n}=e,{field:o,facetId:i}=t;return i||YE({field:o,state:r},n)}d();c();l();u();d();c();l();u();var XE=["alphanumeric","occurrences"];var JE=new Fe({field:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),basePath:sE,delimitingCharacter:cE,facetId:an,facetSearch:us,filterByBasePath:uE,filterFacetCount:cn,injectionDepth:un,numberOfValues:Dr,sortCriteria:new $({constrainTo:XE})});function ZE(e,t){if(!EU(e))throw ie;let r=me(e),{dispatch:n}=e,o=xr(e,t.options),i=t.options.tabs??{},a=Wt(e.state.tabSet),p={...GS,...Ou("facetSearch",t.options),field:t.options.field,facetId:o,tabs:i,activeTab:a},f={facetSearch:{...ys,...t.options.facetSearch},...p};ht(e,JE,f,"buildCategoryFacet");let m=()=>$h(e.state,o),h=()=>Gh(e.state,o),C=()=>Qr(e.state),b=()=>Xr(e.state,o);return n(is(p)),{...r,toggleSelect(g){let S=f.numberOfValues;n(as({facetId:o,selection:g,retrieveCount:S})),n(Qe())},deselectAll(){n(So(o)),n(Qe())},sortBy(g){n(yf({facetId:o,criterion:g})),n(Qe())},isSortedBy(g){return m().sortCriteria===g},showMoreValues(){let{numberOfValues:g}=f,{activeValue:S,valuesAsTrees:x}=this.state,w=(S?.children.length??x.length)+g;n(ou({facetId:o,numberOfValues:w})),n(Qe())},showLessValues(){let{numberOfValues:g}=f;n(ou({facetId:o,numberOfValues:g})),n(Qe())},enable(){n(nr(o))},disable(){n(ft(o))},get state(){let g=m(),S=h(),x=C(),w=b(),R=S?.values??[],P=R.some(B=>B.children.length>0)??!1,{parents:E,values:_}=ab(S?.values),F=Br(R),q=F.length?F[F.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??S?.moreValuesAvailable??!1,j=q?q.children.length>f.numberOfValues:R.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:F,values:_,isHierarchical:P,valuesAsTrees:R,activeValue:q,isLoading:x,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:j,sortCriteria:g.sortCriteria,enabled:w}}}}function EU(e){return e.addReducers({categoryFacetSet:bf,categoryFacetSearchSet:WE,facetOptions:Ut,configuration:Ce,search:we}),!0}function eF(e,t){let r=ZE(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 h=FU(o(),m);n(Ae({legacy:h,next:TU(m)}))},deselectAll(){r.deselectAll(),n(Ae({legacy:Lt(o()),next:ir()}))},sortBy(m){r.sortBy(m),n(Ae({legacy:ln({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(va({legacy:ps(o())}))},showLessValues(){r.showLessValues(),n(va({legacy:fs(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function FU(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?qr(r):Yt(r)}function TU(e){return e.state==="selected"?Mn():dr()}d();c();l();u();d();c();l();u();d();c();l();u();function tF(){return{}}var cm=le(tF(),e=>{e.addCase(dE,(t,r)=>{let n=r.payload;tm(t,n,KS)}).addCase(Ff,(t,r)=>{rm(t,r.payload)}).addCase(bo.pending,(t,r)=>{let n=r.meta.arg;nm(t,n,r.meta.requestId)}).addCase(bo.rejected,(t,r)=>{let n=r.meta.arg;om(t,n)}).addCase(bo.fulfilled,(t,r)=>{im(t,r.payload,r.meta.requestId)}).addCase(sm,(t,{payload:r})=>{fu(t,r,KS)}).addCase(Te.fulfilled,t=>{am(t,KS)})});function KS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var PU=e=>e.state==="selected",rF=(e,t)=>{let r={facetId:e,facetValue:t.value};return PU(t)?qr(r):Yt(r)};d();c();l();u();var XS=e=>e.state==="selected",aF=e=>e.state==="excluded";var sF=e=>XS(e)?Mn():dr();d();c();l();u();d();c();l();u();var cF={facetId:he,selection:new Y({values:Ti})},uF=pe("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},cF),n(vo({facetId:e,selection:t})),n(Qe())}),lF=pe("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},cF),n(Ao({facetId:e,selection:t})),n(Qe())});d();c();l();u();d();c();l();u();var Ss=["allValues","atLeastOneValue"];d();c();l();u();var um=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var dF=new Fe({facetId:an,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:sn,filterFacetCount:cn,injectionDepth:un,numberOfValues:Dr,sortCriteria:new $({constrainTo:um}),resultsMustMatch:new $({constrainTo:Ss}),facetSearch:us});function pF(e,t,r=dF){if(!kU(e))throw ie;let{dispatch:n}=e,o=me(e),i=xr(e,t.options),a=t.options.tabs??{},p=Wt(e.state.tabSet),f={...HS,...Ou("facetSearch",t.options),field:t.options.field,facetId:i,tabs:a,activeTab:p},m={facetSearch:{...ys,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let h=()=>ob(e.state,i),C=()=>Bh(e.state,i),b=()=>Qr(e.state),g=()=>Xr(e.state,i),S=()=>{let{currentValues:w}=h();return w.filter(R=>R.state!=="idle").length},x=()=>{let{currentValues:w}=h(),R=m.numberOfValues,P=!!w.find(E=>E.state==="idle");return R<w.length&&P};return n(ls(f)),{...o,toggleSelect:w=>n(uF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(lF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(St(i)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(St(i)),this.toggleExclude(w)},isValueSelected:XS,isValueExcluded:aF,deselectAll(){n(St(i)),n(Qe())},sortBy(w){n(If({facetId:i,criterion:w})),n(Qe())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=h().numberOfValues,R=m.numberOfValues,P=R-w%R,E=w+P;n(su({facetId:i,numberOfValues:E})),n(cu({facetId:i,isFieldExpanded:!0})),n(Qe())},showLessValues(){let w=m.numberOfValues,R=Math.max(w,S());n(su({facetId:i,numberOfValues:R})),n(cu({facetId:i,isFieldExpanded:!1})),n(Qe())},enable(){n(nr(i))},disable(){n(ft(i))},get state(){let w=h(),R=C(),P=b(),E=g(),_;typeof w.sortCriteria=="object"?_=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":_=w.sortCriteria;let F=R?R.values:[],q=F.some(j=>j.state!=="idle"),G=R?R.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:R?.label,facetId:i,tabs:a,values:F,sortCriterion:_,resultsMustMatch:Q,isLoading:P,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:x(),enabled:E}}}}function kU(e){return e.addReducers({facetSet:ms,facetOptions:Ut,configuration:Ce,facetSearchSet:cm}),!0}d();c();l();u();var fF=new Fe({facetId:an,field:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),filterFacetCount:cn,injectionDepth:un,numberOfValues:Dr,sortCriteria:new $({constrainTo:um}),resultsMustMatch:new $({constrainTo:Ss}),facetSearch:us,allowedValues:wf,customSort:Rf});function mF(e,t){if(!OU(e))throw ie;let{dispatch:r}=e,n=pF(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},fF),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(Ae({legacy:rF(o(),m),next:sF(m)}))},deselectAll(){n.deselectAll(),r(Ae({legacy:Lt(o()),next:ir()}))},sortBy(m){n.sortBy(m),r(Ae({legacy:ln({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(va({legacy:ps(o())}))},showLessValues(){n.showLessValues(),r(va({legacy:fs(o())}))},get state(){return{...n.state,facetSearch:a.state}}}}function OU(e){return e.addReducers({facetSet:ms,configuration:Ce,facetSearchSet:cm,search:we}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var mu=e=>e.state==="selected",gF=e=>e.state==="excluded";var lm=e=>mu(e)?Mn():dr();var dm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return mu(t)?qr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var pm=T("rangeFacet/executeToggleSelect",e=>O(e,Vn(e.selection))),fm=T("rangeFacet/executeToggleExclude",e=>O(e,Vn(e.selection)));var hF={facetId:he,selection:new Y({values:Oi})},yF=pe("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,hF),t(pn(e)),t(pm(e)),t(Qe())}),SF=pe("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,hF),t(fn(e)),t(fm(e)),t(Qe())});d();c();l();u();function mm(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 gm(e,t){let{facetId:r,getRequest:n}=t,o=me(e),i=e.dispatch,a=()=>Xr(e.state,r);return{...o,isValueSelected:mu,isValueExcluded:gF,deselectAll(){i(St(r)),i(Qe())},sortBy(p){i(hs({facetId:r,criterion:p})),i(Qe())},isSortedBy(p){return this.state.sortCriterion===p},enable(){i(nr(r))},disable(){i(ft(r))},get state(){let p=n(),f=En(e.state,r),m=p.sortCriteria,h=p.resultsMustMatch,C=f?f.values:[],b=Qr(e.state),g=a(),S=C.some(w=>w.state!=="idle"),x=f?.domain;return{facetId:r,values:C,sortCriterion:m,resultsMustMatch:h,hasActiveValues:S,isLoading:b,enabled:g,domain:x}}}}d();c();l();u();d();c();l();u();var hm=["idle","selected","excluded"];d();c();l();u();var ym=["ascending","descending"],Sm=["even","equiprobable"];var _U={start:new $,end:new $,endInclusive:new de,state:new $({constrainTo:hm})},NU=new Fe({facetId:an,field:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),generateAutomaticRanges:xf,filterFacetCount:cn,injectionDepth:un,numberOfValues:Dr,currentValues:new ne({each:new Y({values:_U})}),sortCriteria:new $({constrainTo:ym}),rangeAlgorithm:new $({constrainTo:Sm})});function vm(e,t){ht(e,NU,t,"buildDateFacet"),_f(t)}function vF(e,t){if(!DU(e))throw ie;mm(t.options,"buildDateFacet");let r=e.dispatch,n=xr(e,t.options),o=t.options.tabs??{},i=Wt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};vm(e,a),r(dn(a));let p=gm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(yF({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},toggleExclude:f=>r(SF({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(St(n)),this.toggleExclude(f)},get state(){return p.state}}}function DU(e){return e.addReducers({configuration:Ce,search:we,dateFacetSet:gn,facetOptions:Ut}),!0}function AF(e,t){let r=vF(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ae({legacy:Lt(o()),next:ir()}))},sortBy(i){r.sortBy(i),n(Ae({legacy:ln({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Ae({legacy:dm(o(),i),next:lm(i)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function CF(e,t){if(!qU(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state,i=xr(e,t.options),a=t.options.tabs??{},p=Wt(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};vm(e,f),n(dn(f));let m=()=>Xr(e.state,i);return{...r,clear:()=>{n(jn({facetId:i,values:[]})),n(Qe())},setRange:h=>{let C={...h,state:"selected",numberOfResults:0,endInclusive:!0},b=jn({facetId:i,values:[C]});return b.error?!1:(n(b),n(Qe()),!0)},enable(){n(nr(i))},disable(){n(ft(i))},get state(){let h=Qr(o()),C=m(),b=SE(o(),i),g=b.length?b[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:C}}}}function qU(e){return e.addReducers({dateFacetSet:gn,facetOptions:Ut,configuration:Ce,search:we}),!0}function bF(e,t){if(!MU(e))throw ie;let r=CF(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ae({legacy:Lt(o()),next:ir()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Ae({legacy:Yt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:dr()})),a},get state(){return{...r.state}}}}function MU(e){return e.addReducers({dateFacetSet:gn,configuration:Ce,search:we}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var xF={facetId:he,selection:new Y({values:ki})},wF=pe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,xF),t(yn(e)),t(pm(e)),t(Qe())}),qLe=pe("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,xF),t(Sn(e)),t(fm(e)),t(Qe())});d();c();l();u();var VU={start:new oe,end:new oe,endInclusive:new de,state:new $({constrainTo:hm})},jU=new Fe({facetId:an,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:sn,generateAutomaticRanges:xf,filterFacetCount:cn,injectionDepth:un,numberOfValues:Dr,currentValues:new ne({each:new Y({values:VU})}),sortCriteria:new $({constrainTo:ym}),resultsMustMatch:new $({constrainTo:Ss}),rangeAlgorithm:new $({constrainTo:Sm})});function Am(e,t){ht(e,jU,t,"buildNumericFacet"),Hf(t)}d();c();l();u();function Cm(e){return{endInclusive:!1,state:"idle",...e}}function RF(e,t){if(!LU(e))throw ie;mm(t.options,"buildNumericFacet");let r=e.dispatch,n=xr(e,t.options),o=t.options.tabs??{},i=Wt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};Am(e,a),r(hn(a));let p=gm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(wF({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},get state(){return p.state}}}function LU(e){return e.addReducers({numericFacetSet:Co,facetOptions:Ut,configuration:Ce,search:we}),!0}function IF(e,t){let r=RF(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ae({legacy:Lt(o()),next:ir()}))},sortBy(i){r.sortBy(i),n(Ae({legacy:ln({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Ae({legacy:dm(o(),i),next:lm(i)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function EF(e,t){if(!UU(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state,i=xr(e,t.options),a=t.options.tabs??{},p=Wt(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};Am(e,f),n(hn(f));let m=()=>Xr(e.state,i);return{...r,clear:()=>{n(Ln({facetId:i,values:[]})),n(Qe())},setRange:h=>{let C={...h,state:"selected",numberOfResults:0,endInclusive:!0},b=Ln({facetId:i,values:[C]});return b.error?!1:(n(b),n(Qe()),!0)},enable(){n(nr(i))},disable(){n(ft(i))},get state(){let h=Qr(o()),C=m(),b=wE(o(),i),g=b.length?b[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:C}}}}function UU(e){return e.addReducers({numericFacetSet:Co,facetOptions:Ut,configuration:Ce,search:we}),!0}function FF(e,t){let r=EF(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ae({legacy:Lt(o()),next:ir()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Ae({legacy:Yt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:dr()})),a},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var QU=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ot(e),t.logShowMoreFoldedResults(Xe(e,r),Je(e),Z(r.insightCaseContext)))),BU=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(Z(t.insightCaseContext))),TF={logShowMoreFoldedResults:QU,logShowLessFoldedResults:BU};d();c();l();u();d();c();l();u();var gu={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},vs=T("folding/register",e=>O(e,gu)),bm=pe("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 Zn(i):Ca(i,o),p=yield n.search({...a,q:GU(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 $e(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 GU(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var PF=T("folding/register",e=>O(e,gu)),xm=pe("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield nx(o,e),p=(yield ux(n,o,i,{origin:"foldingCollection"})).response;return $e(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 $U(e,t){return e.raw[t.collection]}function JS(e,t){return e.raw[t.parent]}function hu(e,t){let r=e.raw[t.child];return Pu(r)?r[0]:r}function HU(e,t){return(e||t)!==void 0&&e===t}function OF(e,t,r,n=[]){let o=hu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(i=>{let a=hu(i,r)===hu(e,r);return JS(i,r)===o&&!a}).map(i=>{let a={...i,searchUid:e.searchUid};return{result:a,children:OF(a,t,r,[...n,o])}}):[]}function zU(e,t){return e.find(r=>{let n=JS(r,t)===void 0,o=HU(JS(r,t),hu(r,t));return n||o})}function _F(e){return e.parentResult?_F(e.parentResult):e}function WU(e,t,r,n){let o=Ml(e),a={...(n??zU(o,t)??_F(e)),searchUid:r},p=OF(a,o,t);return{result:a,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Rm(e,t,r,n){let o={};return e.forEach(i=>{let a=$U(i,t);a&&(!hu(i,t)&&!i.parentResult||(o[a]=WU(i,t,r,n)))}),o}function kF(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 Im=le(wm(),e=>e.addCase(Te.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Rm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Kr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Rm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(oo.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Rm(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(vs,(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(bm.pending,(t,{meta:r})=>{let n=r.arg;kF(t,n).isLoadingMoreResults=!0}).addCase(bm.rejected,(t,{meta:r})=>{let n=r.arg;kF(t,n).isLoadingMoreResults=!1}).addCase(bm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:i}})=>{let a=Rm(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 yu={id:z},xo=T("querySuggest/register",e=>O(e,{...yu,count:new oe({min:0})})),NF=T("querySuggest/unregister",e=>O(e,yu)),wo=T("querySuggest/selectSuggestion",e=>O(e,{...yu,expression:Ke})),Ro=T("querySuggest/clear",e=>O(e,yu)),As=pe("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){o(e,yu);let a=e.id,p=yield YU(a,t(),i),f=yield n.querySuggest(p);return $e(f)?r(f.error):{id:a,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),YU=/*#__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 Kn(t.configuration.analytics):zo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function YU(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Io=le(ut(),e=>e.addCase(zt,(t,r)=>({...t,...r.payload})).addCase(Jt,(t,r)=>{t.q=r.payload}).addCase(wo,(t,r)=>{t.q=r.payload.expression}).addCase(rt.fulfilled,(t,r)=>r.payload?.query??t).addCase(at,(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 Eo=T("fields/registerFieldsToInclude",e=>O(e,Gu)),Em=T("fields/fetchall/enable"),Fm=T("fields/fetchall/disable"),Tm=pe("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 $e(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 DF=["author","language","urihash","objecttype","collection","source","permanentid"],KU=[...DF,"date","filetype","parents"],DBe=[...KU,"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"],qF=()=>({fieldsToInclude:DF,fetchAllFields:!1,fieldsDescription:[]});var Cs=le(qF(),e=>e.addCase(Eo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Em,t=>{t.fetchAllFields=!0}).addCase(Fm,t=>{t.fetchAllFields=!1}).addCase(Tm.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(vs,(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 bs(e){if(!XU(e))throw ie;let t=me(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:Ad(n)}}}}function XU(e){return e.addReducers({search:we}),!0}var JU=new Fe({fieldsToInclude:new ne({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function Pm(e,t){if(!ZU(e))throw ie;let r=me(e),n=bs(e),{dispatch:o}=e,i=()=>e.state,a=ht(e,JU,t?.options,"buildCoreResultList");a.fieldsToInclude&&o(Eo(a.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,h=5,C=200,b=!1;return{...r,get state(){let S=i();return{...n.state,results:S.search.results,moreResultsAvailable:p(),searchResponseId:S.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<C){if(m++,m>=h){f=Date.now(),!b&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${h} times, with little delay. Please verify the conditions under which the function is called.`),b=!0;return}}else m=0;b=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function ZU(e){return e.addReducers({search:we,configuration:Ce,fields:Cs}),!0}var eQ=new Fe(gu);function MF(e,t,r){if(!tQ(e))throw ie;let n=Pm(e,t),{dispatch:o}=e,i=()=>e.state,a=t.options?.folding?ht(e,eQ,t.options.folding,"buildFoldedResultList"):{};return o(vs({...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 ZS(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return ZS(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 tQ(e){return e.addReducers({search:we,configuration:Zd,folding:Im,query:Io}),!0}function ZS(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=ZS(n.children,t);if(o)return o}}return null}function VF(e,t={}){let r=MF(e,{...t,loadCollectionActionCreator:xm,fetchMoreResultsActionCreator:od},TF);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var rQ=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(Z(t.insightCaseContext))),ev=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=je(r),o=pa(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Vl(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:jl(o)},Z(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=pa(t,e);return{answerId:je(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),nQ=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=je(n),i=pa(n,e);return!o||!i?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t},Z(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=pa(r,e);return{answerId:je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),oQ=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"like"})}),iQ=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"dislike"})}),aQ=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=je(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},Z(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=je(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Lc(o),documented:Lc(i),correctTopic:Lc(p),hallucinationFree:Lc(a)},additionalNotes:m,correctAnswerUrl:f}}}),sQ=e=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=je(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o},Z(r.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:je(t)??"",answerGenerated:e})});var cQ=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"show"})}),uQ=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"hide"})}),lQ=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"expand"})}),dQ=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"collapse"})}),pQ=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},Z(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"copyToClipboard"})}),km={logCopyGeneratedAnswer:pQ,logGeneratedAnswerHideAnswers:uQ,logGeneratedAnswerShowAnswers:cQ,logGeneratedAnswerStreamEnd:sQ,logGeneratedAnswerFeedback:aQ,logDislikeGeneratedAnswer:iQ,logLikeGeneratedAnswer:oQ,logHoverCitation:nQ,logOpenGeneratedAnswerSource:ev,logRetryGeneratedAnswer:rQ,logGeneratedAnswerExpand:lQ,logGeneratedAnswerCollapse:dQ};d();c();l();u();d();c();l();u();d();c();l();u();function Om(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var xs=le(Qy(),e=>e.addCase(Na,(t,{payload:r})=>{t.isVisible=r}).addCase(Uc,(t,{payload:r})=>{t.isEnabled=r}).addCase(Vd,(t,{payload:r})=>{t.id=r.id}).addCase(Zo,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.answer||(t.answer=""),t.answer+=r.textDelta,delete t.error}).addCase(ei,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Om([...t.citations,...r.citations]),delete t.error}).addCase(ti,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===Gg},t.citations=[],delete t.answer}).addCase(Nd,t=>{t.liked=!0,t.disliked=!1}).addCase(Dd,t=>{t.liked=!1,t.disliked=!0}).addCase(qd,t=>{t.feedbackModalOpen=!0}).addCase(jd,t=>{t.feedbackModalOpen=!1}).addCase(qa,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...Qy(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase(Jr,(t,{payload:r})=>{t.isLoading=r}).addCase(Jo,(t,{payload:r})=>{t.isStreaming=r}).addCase(ri,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(Ld,(t,{payload:r})=>{t.responseFormat=r}).addCase(Qd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Bc,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Qc,t=>{t.expanded=!0}).addCase(Md,t=>{t.expanded=!1}).addCase(Ud,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(ni,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(Gy,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Da,(t,{payload:r})=>{t.answerId=r}).addCase(_d,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(Bd,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Gd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}));d();c();l();u();function _m(e,t,r={}){if(!fQ(e))throw ie;let{dispatch:n}=e,o=me(e),i=()=>e.state,a=r.initialState?.isVisible;a!==void 0&&n(Na(a));let p=r.initialState?.responseFormat;p&&n(Ld(p));let f=r.fieldsToIncludeInCitations;return f&&n(Qd(f)),r.initialState?.expanded&&n(Qc()),{...o,get state(){let h=i().generatedAnswer;return{...h,error:df(h.error)}},like(){this.state.liked||(n(Nd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Dd()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(qd())},closeFeedbackModal(){n(jd())},sendFeedback(h){n(t.logGeneratedAnswerFeedback(h)),n(qa())},logCitationClick(h,C){n(t.logOpenGeneratedAnswerSource(h,C))},logCitationHover(h,C,b){n(t.logHoverCitation(h,C,b))},show(){this.state.isVisible||(n(Na(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Na(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Qc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Md()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Uc(!0))},disable(){this.state.isEnabled&&n(Uc(!1))},logCopyToClipboard(h){n(t.logCopyGeneratedAnswer(h))},retry(){}}}function fQ(e){return e.addReducers({generatedAnswer:xs}),!0}var Qt={engines:{},setAbortControllerRef:(e,t)=>{Qt.engines[t].abortController=e},getIsStreamInProgress:e=>!Qt.engines[e].abortController||Qt.engines[e].abortController?.signal.aborted?(Qt.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(Qt.engines[i].lastRequestId!==n){if(Qt.engines[i].lastRequestId=n,Qt.engines[i].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Qt.getIsStreamInProgress(i)&&o&&o!==Qt.engines[i].lastStreamId){if(Qt.engines[i].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(ww({setAbortControllerRef:p=>Qt.setAbortControllerRef(p,i)}))}};return e.subscribe(t)}};function jF(e,t,r={}){if(!mQ(e))throw ie;let n=_m(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Qt.engines[e.state.generatedAnswer.id]&&(Qt.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=Tu("genQA-",12);e.dispatch(Vd({id:a}))}Qt.engines[e.state.generatedAnswer.id]||(Qt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Qt.subscribeToSearchRequests(e);let i=a=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in a;return{...n,get state(){return o().generatedAnswer},retry(){i(e)&&e.dispatch(Te({legacy:t.logRetryGeneratedAnswer()}))}}}function mQ(e){return e.addReducers({generatedAnswer:xs}),!0}d();c();l();u();d();c();l();u();var LF=zd.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var Nm=e=>e==="yes"?!0:e==="no"?!1:null,gQ=({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:Nm(t.correctTopic),documented:Nm(t.documented),hallucinationFree:Nm(t.hallucinationFree),readable:Nm(t.readable)},helpful:t.helpful,question:r}),hQ=e=>{let t="",r=()=>{let n=e.state,o=sw(n),i=o.requestId;i!==t&&(t=i,e.dispatch(lr()),o.q?.length>0&&e.dispatch($d()))};e.subscribe(r)};function UF(e,t,r={}){if(!yQ(e))throw ie;pf(e.state.configuration.analytics.analyticsMode);let{...n}=_m(e,t,r),o=()=>e.state;return e.dispatch(Ud(r.answerConfigurationId)),hQ(e),{...n,get state(){let i=$y(e.state).data,a=o().generatedAnswer;return{...a,answer:i?.answer,citations:Om(i?.citations??[]),error:df({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=Td(o());e.dispatch(Hd(i??Ko))},reset(){e.dispatch(lr())},sendFeedback(i){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(i));let a=gQ({query:o().query.q,feedback:i,answerApiState:$y(e.state).data});e.dispatch(LF.endpoints.post.initiate(a)),e.dispatch(qa())})()}}}function yQ(e){return e.addReducers({[oi.reducerPath]:oi.reducer,query:Io}),!0}function QF(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?UF(e,km,t):jF(e,km,t);return{...n,get state(){return n.state},retry(){r(Ae({legacy:km.logRetryGeneratedAnswer(),next:cw()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function vn(e,t,r){if(!SQ(e))throw ie;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:_u(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function SQ(e){return e.addReducers({configuration:Ce}),!0}function BF(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logOpenGeneratedAnswerSource(r.options.citation.id,r.options.answerId)))};return vn(e,r,()=>{o()})}function GF(e,t){return BF(e,{logOpenGeneratedAnswerSource:ev},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var bQ=new oe({min:1,default:8,required:!1}),xQ=new oe({min:1,max:20,default:5,required:!1}),wQ={desiredCount:xQ,numberOfValues:bQ},L2e=T("automaticFacet/setOptions",e=>O(e,wQ)),U2e=T("automaticFacet/deselectAll",e=>O(e,he)),RQ=z,$F=T("automaticFacet/toggleSelectValue",e=>O(e,{field:RQ,selection:new Y({values:Ti})}));var Rs=le(zr(),e=>{e.addCase(ld,(t,r)=>{let n=tv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Su(n,o)}).addCase(dd,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(_t,t=>{t.firstResult=0}).addCase(pd,(t,r)=>{let n=r.payload;t.firstResult=Su(n,t.numberOfResults)}).addCase(Jn,(t,r)=>{let n=r.payload;t.firstResult=Su(n,t.numberOfResults)}).addCase(md,t=>{let r=tv(t),n=Math.max(r-1,1);t.firstResult=Su(n,t.numberOfResults)}).addCase(fd,t=>{let r=tv(t),n=IQ(t),o=Math.min(r+1,n);t.firstResult=Su(o,t.numberOfResults)}).addCase(rt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(at,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Te.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Kr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(St,t=>{Bt(t)}).addCase(fn,t=>{Bt(t)}).addCase(Ao,t=>{Bt(t)}).addCase(Sn,t=>{Bt(t)}).addCase(Pf,t=>{Bt(t)}).addCase(vo,t=>{Bt(t)}).addCase(So,t=>{Bt(t)}).addCase(as,t=>{Bt(t)}).addCase(vf,t=>{Bt(t)}).addCase(pn,t=>{Bt(t)}).addCase(yn,t=>{Bt(t)}).addCase(Zt,t=>{Bt(t)}).addCase(jn,t=>{Bt(t)}).addCase(Ln,t=>{Bt(t)}).addCase(Tf,t=>{Bt(t)}).addCase($F,t=>{Bt(t)})});function Bt(e){e.firstResult=zr().firstResult}function tv(e){let{firstResult:t,numberOfResults:r}=e;return rv(t,r)}function IQ(e){let{totalCountFiltered:t,numberOfResults:r}=e;return nv(t,r)}function Su(e,t){return(e-1)*t}function rv(e,t){return Math.round(e/t)+1}function nv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function EQ(e){return e.pagination.firstResult}function HF(e){return e.pagination.numberOfResults}function FQ(e){return e.pagination.totalCountFiltered}var Fo=e=>{let t=EQ(e),r=HF(e);return rv(t,r)},ov=e=>{let t=FQ(e),r=HF(e);return nv(t,r)},zF=(e,t)=>{let r=Fo(e),n=ov(e),o=TQ(r,t);return o=PQ(o),o=kQ(o,n),OQ(o)};function TQ(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 PQ(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function kQ(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 OQ(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var iv=()=>He("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||zr().numberOfResults}));var Is=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var Dm=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Fo(t),...Z(t.insightCaseContext)})),qm=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Fo(t),...Z(t.insightCaseContext)})),Mm=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Fo(t),...Z(t.insightCaseContext)}));d();c();l();u();var _Q=new Fe({numberOfPages:new oe({default:5,min:0})}),NQ=new Fe({page:new oe({min:1})});function WF(e,t={}){if(!DQ(e))throw ie;let r=me(e),{dispatch:n}=e,o=ht(e,_Q,t.options,"buildPager"),a=mr(e,NQ,t.initialState,"buildPager").page;a&&n(pd(a));let p=()=>Fo(e.state),f=()=>{let{numberOfPages:h}=o;return zF(e.state,h)},m=()=>ov(e.state);return{...r,get state(){let h=p(),C=m(),b=h>1&&C>0,g=h<C;return{currentPage:h,currentPages:f(),maxPage:C,hasPreviousPage:b,hasNextPage:g}},selectPage(h){n(Jn(h))},nextPage(){n(fd())},previousPage(){n(md())},isCurrentPage(h){return h===this.state.currentPage}}}function DQ(e){return e.addReducers({configuration:Ce,pagination:Rs}),!0}function YF(e,t={}){let{dispatch:r}=e,n=WF(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(nd({legacy:Dm(),next:Is()}))},nextPage(){n.nextPage(),r(nd({legacy:qm(),next:Is()}))},previousPage(){n.previousPage(),r(nd({legacy:Mm(),next:Is()}))}}}d();c();l();u();d();c();l();u();function KF(e){if(!qQ(e))throw ie;let t=me(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function qQ(e){return e.addReducers({search:we}),!0}function XF(e){return KF(e)}d();c();l();u();d();c();l();u();function JF(e){if(!MQ(e))throw ie;let t=me(e),r=bs(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 MQ(e){return e.addReducers({search:we,pagination:Rs}),!0}function ZF(e){return JF(e)}d();c();l();u();d();c();l();u();function eT(_x235,_x236){return _eT.apply(this,arguments)}function _eT(){_eT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:i}=e.insightConfiguration,a=e.query?.q||"";return{url:Wg({url:Ye(n,o),accessToken:r,organizationId:n,insightId:i}),accessToken:r,organizationId:n,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0}});return _eT.apply(this,arguments)}d();c();l();u();var tT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Xe(e,r),o=Je(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{action:"preview",itemMetadata:Tr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Nr(t)}}});d();c();l();u();function rT(e,t,r,n,o){if(!VQ(e))throw ie;let{dispatch:i}=e,a=()=>e.state,p=me(e),{result:f,maximumPreviewSize:m}=t.options,h=()=>{let{resultsWithPreview:b,position:g}=a().resultPreview;return b[g]},C=b=>{i(vd({uniqueId:b,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(_c({uniqueId:b,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){C(f.uniqueId)},next(){i(yd()),C(h())},previous(){i(Sd()),C(h())},get state(){let b=a(),g=f.hasHtmlVersion,S=b.resultPreview,x=f.uniqueId===S.uniqueId?S.content:"",w=S.isLoading,R=S.contentURL,P=h();return{content:x,resultHasPreview:g,isLoading:w,contentURL:R,currentResultUniqueId:P}}}}function VQ(e){return e.addReducers({configuration:Ce,resultPreview:Ia}),!0}function nT(e,t){if(!jQ(e))throw ie;let r=()=>{e.dispatch(tT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return rT(e,o,(i,a)=>eT(i,a),n,r)}function jQ(e){return e.addReducers({configuration:Ce,resultPreview:Ia,insightInterface:Yn}),!0}d();c();l();u();d();c();l();u();var oT=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(Z(t.insightCaseContext))),iT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(Z(t.insightCaseContext)));d();c();l();u();d();c();l();u();var LQ={queries:new ne({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new oe({required:!0,min:1,default:10})},vu=T("recentQueries/registerRecentQueries",e=>O(e,LQ)),Vm=T("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function aT(){return{queries:[],maxLength:10}}var sT=le(aT(),e=>{e.addCase(vu,UQ).addCase(Vm,QQ).addCase(Te.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||BQ(n,t)})});function UQ(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 QQ(e){e.queries=[]}function BQ(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 GQ={queries:[]},$Q={maxLength:10,clearFilters:!0},HQ=new Fe({queries:new ne({required:!0})}),zQ=new Fe({maxLength:new oe({required:!0,min:1}),clearFilters:new de});function WQ(e,t){ht(e,zQ,t?.options,"buildRecentQueriesList"),mr(e,HQ,t?.initialState,"buildRecentQueriesList")}function cT(e,t){if(!YQ(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state,i={...$Q,...t?.options},a={...GQ,...t?.initialState};WQ(e,{options:i,initialState:a});let p={queries:a.queries,maxLength:i.maxLength};return n(vu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(Vm())},updateRecentQueries(f){let m=new ne({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(vu({queries:f,maxLength:i.maxLength}))},executeRecentQuery(f){let m=new oe({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let h={q:this.state.queries[f],clearFilters:i.clearFilters};Fu(e.state.query?.enableQuerySyntax)&&(h.enableQuerySyntax=e.state.query.enableQuerySyntax),n(wa(h))}}}function YQ(e){return e.addReducers({search:we,recentQueries:sT,query:Io}),!0}function uT(e,t){let r=cT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(oT()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Ae({legacy:iT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var KQ={results:new ne({required:!0,each:new Y({values:Ll})}),maxLength:new oe({required:!0,min:1,default:10})},jm=T("recentResults/registerRecentResults",e=>O(e,KQ)),An=T("recentResults/pushRecentResult",e=>(Ot(e),{payload:e})),Lm=T("recentResults/clearRecentResults");d();c();l();u();var lT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Z(r.insightCaseContext);return t.logDocumentOpen(Xe(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Tr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Nr(t)}}});function dT(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(lT(t.options.result)))};return vn(e,t,()=>{n(),e.dispatch(An(t.options.result))})}d();c();l();u();function pT(e,t){return Pm(e,{...t,fetchMoreResultsActionCreator:od})}d();c();l();u();d();c();l();u();var XQ=new Fe({numberOfResults:new oe({min:0})});function fT(e,t={}){if(!JQ(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state,a=mr(e,XQ,t.initialState,"buildResultsPerPage").numberOfResults;return a!==void 0&&n(ld(a)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(dd(p))},isSetTo(p){return p===this.state.numberOfResults}}}function JQ(e){return e.addReducers({pagination:Rs,configuration:Ce}),!0}function mT(e,t={}){let r=fT(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Ae({legacy:iv(),next:Is()}))}}}d();c();l();u();d();c();l();u();var av=()=>He("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),Um=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var Qm=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(Z(t.insightCaseContext)));d();c();l();u();d();c();l();u();var gT={id:z,query:Ke},Es=T("querySet/register",e=>O(e,gT)),_i=T("querySet/update",e=>O(e,gT));d();c();l();u();var Fs=le(Jl(),e=>{e.addCase(Es,(t,r)=>eB(t,r.payload)).addCase(_i,(t,r)=>{let{id:n,query:o}=r.payload;sv(t,n,o)}).addCase(wo,(t,r)=>{let{id:n,expression:o}=r.payload;sv(t,n,o)}).addCase(Te.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;hT(t,n)}).addCase(at,ZQ).addCase(rt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))sv(t,n,o)})});function ZQ(e,t){ee(t.payload.q)||hT(e,t.payload.q)}function hT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var sv=(e,t,r)=>{t in e&&(e[t]=r)},eB=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var yT=e=>He("analytics/querySuggest",(t,r)=>{let n=tB(r,e);return t.makeOmniboxAnalytics(n)}),ST=()=>({actionCause:"omniboxAnalytics"});function tB(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 vT(e,t){let r=t.id;r in e||(e[r]=rB(t))}function AT(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function CT(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function bT(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function rB(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var xT=()=>({});var Bm=le(xT(),e=>e.addCase(xo,(t,r)=>{vT(t,r.payload)}).addCase(NF,(t,r)=>{delete t[r.payload.id]}).addCase(As.pending,AT).addCase(As.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(As.rejected,CT).addCase(Ro,(t,r)=>{bT(t,r.payload)}).addCase(Ea,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var wT={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},cv={open:new $,close:new $},nB={id:z,numberOfSuggestions:new oe({min:0}),enableQuerySyntax:new de,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:cv}),exactMatchDelimiters:new Y({values:cv}),correctionDelimiters:new Y({values:cv})}}),clearFilters:new de},RT=new Fe(nB);function IT(e,t){if(!iB(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state,i=t.options?.id||Tu("search_box"),a={id:i,highlightOptions:{...t.options?.highlightOptions},...wT,...t.options};ht(e,RT,a,"buildSearchBox"),n(Es({id:i,query:e.state.query.q})),a.numberOfSuggestions&&n(xo({id:i,count:a.numberOfSuggestions})),a.enableQuerySyntax&&n(zt({enableQuerySyntax:a.enableQuerySyntax}));let p=()=>e.state.querySet[a.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:h,clearFilters:C}=a;n(wa({q:p(),enableQuerySyntax:h,clearFilters:C})),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(_i({id:i,query:m})),this.showSuggestions()},clear(){n(_i({id:i,query:""})),n(Ro({id:i}))},showSuggestions(){a.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:i}))},selectSuggestion(m){n(wo({id:i,expression:m})),f({legacy:yT({id:i,suggestion:m}),next:ST()}).then(()=>{n(Ro({id:i}))})},submit(m=av(),h){f({legacy:m,next:h}),n(Ro({id:i}))},get state(){let m=o(),h=m.querySuggest[a.id],C=oB(h,a.highlightOptions),b=h?h.isLoading:!1;return{searchBoxId:i,value:p(),suggestions:C,isLoading:m.search.isLoading,isLoadingSuggestions:b}}}}function oB(e,t){return e?e.completions.map(r=>({highlightedValue:xg(r.highlighted,t),rawValue:r.expression})):[]}function iB(e){return e.addReducers({query:Io,querySuggest:Bm,configuration:Ce,querySet:Fs,search:we}),!0}function ET(e,t={}){let r=IT(e,{...t,executeSearchActionCreator:Ae,fetchQuerySuggestionsActionCreator:id,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(Qm(),Um())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var Gm=()=>({actionCause:"resultsSort"});function FT(e,t){return e.q!==t.q?Um():e.sortCriteria!==t.sortCriteria?Gm():Ts(e.f,t.f)?Ps(e.f,t.f):Ts(e.fExcluded,t.fExcluded)?Ps(e.fExcluded,t.fExcluded,!0):Ts(e.cf,t.cf)?Ps(e.cf,t.cf):Ts(e.af,t.af)?Ps(e.af,t.af):Ts(e.nf,t.nf)?Ps($m(e.nf),$m(t.nf)):Ts(e.df,t.df)?Ps($m(e.df),$m(t.df)):ga()}function Ts(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Ps(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(b=>!o.includes(b));if(i.length){let b=i[0];return e[b].length>1?ir():Mn()}if(o.filter(b=>!n.includes(b)).length)return r?Ef():dr();let p=o.find(b=>t[b].filter(g=>e[b].includes(g)));if(!p)return ga();let f=e[p],m=t[p];return m.filter(b=>!f.includes(b)).length?r?Ef():dr():f.filter(b=>!m.includes(b)).length?Mn():ga()}function $m(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 ks=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...Z(t.insightCaseContext)}));function kT(e,t){return e.q!==t.q?Qm():e.sortCriteria!==t.sortCriteria?ks():Au(e.f,t.f)?Au(e.cf,t.cf)?Au(e.nf,t.nf)?Au(e.df,t.df)?Au(e.fExcluded,t.fExcluded)?Xn():aB(e.fExcluded,t.fExcluded):PT(e.df,t.df):PT(e.nf,t.nf):Hm(e.cf,t.cf):Hm(e.f,t.f)}function Au(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function TT(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function Hm(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(b=>!o.includes(b));if(i.length){let b=i[0];return e[b].length>1?Lt(b):(r?ds:qr)({facetId:b,facetValue:e[b][0]})}let a=o.filter(b=>!n.includes(b));if(a.length){let b=a[0];return Yt({facetId:b,facetValue:t[b][0]})}let p=o.find(b=>t[b].filter(g=>e[b].includes(g)));if(!p)return Xn();let f=e[p],m=t[p],h=m.filter(b=>!f.includes(b));if(h.length)return Yt({facetId:p,facetValue:h[0]});let C=f.filter(b=>!m.includes(b));return C.length?(r?ds:qr)({facetId:p,facetValue:C[0]}):Xn()}function PT(e={},t={}){return Hm(TT(e),TT(t))}function aB(e={},t={}){return Hm(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:sB,getOwnPropertySymbols:cB}=Object,{hasOwnProperty:uB}=Object.prototype;function uv(e,t){return function(n,o,i){return e(n,o,i)&&t(n,o,i)}}function zm(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 OT(e){return sB(e).concat(cB(e))}var lB=Object.hasOwn||((e,t)=>uB.call(e,t)),dB="__v",pB="__o",fB="_owner",{getOwnPropertyDescriptor:_T,keys:NT}=Object,Ni=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function mB(e,t){return e===t}function gB(e,t){return e.byteLength===t.byteLength&&Wm(new Uint8Array(e),new Uint8Array(t))}function hB(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 yB(e,t){return e.byteLength===t.byteLength&&Wm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function SB(e,t){return Ni(e.getTime(),t.getTime())}function vB(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function DT(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(),h=!1,C=0;for(;(p=m.next())&&!p.done;){if(o[C]){C++;continue}let b=a.value,g=p.value;if(r.equals(b[0],g[0],f,C,e,t,r)&&r.equals(b[1],g[1],b[0],g[0],e,t,r)){h=o[C]=!0;break}C++}if(!h)return!1;f++}return!0}function AB(e,t,r){let n=NT(e),o=n.length;if(NT(t).length!==o)return!1;for(;o-->0;)if(!MT(e,t,r,n[o]))return!1;return!0}function Cu(e,t,r){let n=OT(e),o=n.length;if(OT(t).length!==o)return!1;let i,a,p;for(;o-->0;)if(i=n[o],!MT(e,t,r,i)||(a=_T(e,i),p=_T(t,i),(a||p)&&(!a||!p||a.configurable!==p.configurable||a.enumerable!==p.enumerable||a.writable!==p.writable)))return!1;return!0}function CB(e,t){return Ni(e.valueOf(),t.valueOf())}function bB(e,t){return e.source===t.source&&e.flags===t.flags}function qT(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,h=0;for(;(p=f.next())&&!p.done;){if(!o[h]&&r.equals(a.value,p.value,a.value,p.value,e,t,r)){m=o[h]=!0;break}h++}if(!m)return!1}return!0}function Wm(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 xB(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 MT(e,t,r,n){return(n===fB||n===pB||n===dB)&&(e.$$typeof||t.$$typeof)?!0:lB(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var wB=Object.prototype.toString;function RB(e){let t=TB(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:h}=e;return function(b,g,S){if(b===g)return!0;if(b==null||g==null)return!1;let x=typeof b;if(x!==typeof g)return!1;if(x!=="object")return x==="number"||x==="bigint"?a(b,g,S):x==="function"?o(b,g,S):!1;let w=b.constructor;if(w!==g.constructor)return!1;if(w===Object)return p(b,g,S);if(w===Array)return r(b,g,S);if(w===Date)return n(b,g,S);if(w===RegExp)return f(b,g,S);if(w===Map)return i(b,g,S);if(w===Set)return m(b,g,S);if(w===Promise)return!1;if(Array.isArray(b))return r(b,g,S);let R=wB.call(b),P=t[R];if(P)return P(b,g,S);let E=h&&h(b,g,S,R);return E?E(b,g,S):!1}}function IB({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:gB,areArraysEqual:r?Cu:hB,areDataViewsEqual:yB,areDatesEqual:SB,areErrorsEqual:vB,areFunctionsEqual:mB,areMapsEqual:r?uv(DT,Cu):DT,areNumbersEqual:Ni,areObjectsEqual:r?Cu:AB,arePrimitiveWrappersEqual:CB,areRegExpsEqual:bB,areSetsEqual:r?uv(qT,Cu):qT,areTypedArraysEqual:r?uv(Wm,Cu):Wm,areUrlsEqual:xB,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=zm(n.areArraysEqual),i=zm(n.areMapsEqual),a=zm(n.areObjectsEqual),p=zm(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:i,areObjectsEqual:a,areSetsEqual:p})}return n}function EB(e){return function(t,r,n,o,i,a,p){return e(t,r,p)}}function FB({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:h}=r();return t(p,f,{cache:m,equals:n,meta:h,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 TB({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:h,areSetsEqual:C,areTypedArraysEqual:b,areUrlsEqual:g}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":i,"[object BigInt]":p,"[object BigInt64Array]":b,"[object BigUint64Array]":b,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":b,"[object Float32Array]":b,"[object Float64Array]":b,"[object Function]":i,"[object GeneratorFunction]":i,"[object Int8Array]":b,"[object Int16Array]":b,"[object Int32Array]":b,"[object Map]":a,"[object Number]":m,"[object Object]":(S,x,w)=>typeof S.then!="function"&&typeof x.then!="function"&&f(S,x,w),"[object RegExp]":h,"[object Set]":C,"[object String]":m,"[object URL]":g,"[object Uint8Array]":b,"[object Uint8ClampedArray]":b,"[object Uint16Array]":b,"[object Uint32Array]":b}}var nKe=Cn(),oKe=Cn({strict:!0}),iKe=Cn({circular:!0}),aKe=Cn({circular:!0,strict:!0}),sKe=Cn({createInternalComparator:()=>Ni}),cKe=Cn({strict:!0,createInternalComparator:()=>Ni}),uKe=Cn({circular:!0,createInternalComparator:()=>Ni}),lKe=Cn({circular:!0,createInternalComparator:()=>Ni,strict:!0});function Cn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,i=IB(e),a=RB(i),p=r?r(a):EB(a);return FB({circular:t,comparator:a,createState:n,equals:p,strict:o})}function VT(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function PB(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>lv(r,n))!==-1)}var lv=Cn({createCustomConfig:e=>({...e,areArraysEqual:PB})});d();c();l();u();d();c();l();u();function jT(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function LT(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{sortCriteria:n}:{}}function Ym(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 UT(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function QT(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??Fn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??Fn().defaultFilters.cq,firstResult:zr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??zr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:Kl(),sf:{},tab:"",af:{},mnf:{}}}var kB=new Fe({parameters:new Y({options:{required:!0},values:Wd})});function $T(e,t){let{dispatch:r}=e,n=me(e);mr(e,kB,t.initialState,"buildSearchParameterManager");let o=BT(e.state.tabSet,t.initialState.parameters);return r(at(o)),{...n,synchronize(i){let a=BT(e.state.tabSet,Km(e,i));r(at(a))},get state(){return{parameters:dv(e)}}}}function Km(e,t){return{...QT(e.state),...t}}function BT(e,t){if(ee(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:GT(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??GT(e)}}return t}function GT(e){return Object.keys(e)[0]??""}function dv(e){let t=e.state;return{...jT(t.query,r=>r.q,ut().q),...UT(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]:""),...LT(t.sortCriteria,r=>r,ur()),..._B(t),...NB(t),...DB(t),...qB(t),...MB(t)}}function OB(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function Xm(e){let t=OB(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,i=or(n?.tabs,t);return o&&i}}function HT(e){return e.currentValues.filter(t=>t.state==="selected")}function _B(e){let t=e.facetSet;if(t===void 0)return{};let r=Xm(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 NB(e){return Ym(e.categoryFacetSet,Xm(e),t=>Br(t.currentValues).map(r=>r.value),"cf")}function DB(e){return Ym(e.numericFacetSet,Xm(e),HT,"nf")}function qB(e){return Ym(e.dateFacetSet,Xm(e),HT,"df")}function MB(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let i=VB(o);return i.length?{[n]:i}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function VB(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function zT(e,t){let{dispatch:r}=e,n=$T(e,t);return{...n,synchronize(o){let i=dv(e),a=Km(e,i),p=Km(e,o);lv(a,p)||(n.synchronize(o),r(Ae({legacy:kT(a,p),next:FT(a,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var bu=()=>new Y({values:{questionAnswerId:z},options:{required:!0}}),Jm=()=>new Y({values:{linkText:Ke,linkURL:Ke},options:{required:!0}});function Di(e){return O(e,bu())}d();c();l();u();function mt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Ex(e,r.contentIdKey,r.contentIdValue)}function wr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var WT={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var jB=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(Z(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),LB=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(Z(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),UB=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(Z(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),QB=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(Z(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),BB=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=mt(t);return e.logOpenSmartSnippetSource(Xe(r,t),Je(r),Z(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),pv=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{O(e,Jm());let n=mt(r);return t.logOpenSmartSnippetInlineLink(Xe(n,r),{...Je(n),...e},Z(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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}}}}),GB=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(Z(t.insightCaseContext))),$B=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(Z(t.insightCaseContext))),HB=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,Z(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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:WT[e]}}}),zB=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,Z(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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}}}),WB=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Di(e);let n=wr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},Z(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=wr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(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}}}}}),YB=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Di(e);let n=wr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},Z(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=wr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(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}}}}}),fv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{O(e,bu());let n=wr(r,e.questionAnswerId);if(!n)return null;let o=mt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Xe(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},Z(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=wr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),YT=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{O(e,bu()),O(t,Jm());let o=wr(n,e.questionAnswerId);if(!o)return null;let i=mt(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},Z(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=wr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let i=mt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:i?.title,url:i?.clickUri}}}}}),Zm={logExpandSmartSnippet:jB,logCollapseSmartSnippet:LB,logLikeSmartSnippet:UB,logDislikeSmartSnippet:QB,logOpenSmartSnippetSource:BB,logOpenSmartSnippetInlineLink:pv,logOpenSmartSnippetFeedbackModal:GB,logCloseSmartSnippetFeedbackModal:$B,logSmartSnippetFeedback:HB,logSmartSnippetDetailedFeedback:zB,logExpandSmartSnippetSuggestion:WB,logCollapseSmartSnippetSuggestion:YB,logOpenSmartSnippetSuggestionSource:fv};d();c();l();u();d();c();l();u();var Os=T("smartSnippet/expand"),_s=T("smartSnippet/collapse"),Ns=T("smartSnippet/like"),Ds=T("smartSnippet/dislike"),qs=T("smartSnippet/feedbackModal/open"),To=T("smartSnippet/feedbackModal/close"),Ms=T("smartSnippet/related/expand",e=>Di(e)),Vs=T("smartSnippet/related/collapse",e=>Di(e));d();c();l();u();d();c();l();u();var mv=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var KT=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function XT({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Bi({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function KB(e,t){let r=XT(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var bn=le(mv(),e=>e.addCase(Os,t=>{t.expanded=!0}).addCase(_s,t=>{t.expanded=!1}).addCase(Ns,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Ds,t=>{t.liked=!1,t.disliked=!0}).addCase(qs,t=>{t.feedbackModalOpen=!0}).addCase(To,t=>{t.feedbackModalOpen=!1}).addCase(Te.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((i,a)=>KB(i,t.relatedQuestions[a])),o=XT(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...mv(),relatedQuestions:n,questionAnswerId:o}}).addCase(Ms,(t,r)=>{let n=KT(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Vs,(t,r)=>{let n=KT(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function JT(e,t,r){if(!XB(e))throw ie;let n=me(e),o=()=>e.state,i=()=>mt(o()),a=null,p=vn(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(An(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(Os())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(_s())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Ns())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Ds())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(qs())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(To())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(To())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(To())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function XB(e){return e.addReducers({search:we,questionAnswering:bn}),!0}d();c();l();u();function eg(e,t){if(!JB(e))throw ie;let r=()=>e.state,n=new Set,o=h=>n.has(h)?!0:(n.add(h),!1),i=null,a=h=>{i!==h&&(i=h,f={},n.clear())},p=(h,C,b)=>vn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(C)||e.dispatch(b?YT({questionAnswerId:b},h):pv(h))}),f={},m=(h,C)=>{let{searchResponseId:b}=r().search;a(b);let g=Bi({...h,questionAnswerId:C});return g in f||(f[g]=p(h,g,C)),f[g]};return{selectInlineLink(h,C){m(h,C)?.select()},beginDelayedSelectInlineLink(h,C){m(h,C)?.beginDelayedSelect()},cancelPendingSelectInlineLink(h,C){m(h,C)?.cancelPendingSelect()}}}function JB(e){return e.addReducers({search:we,questionAnswering:bn}),!0}function ZT(e,t){let r=JT(e,Zm,t),n=eg(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 eP(e,t){if(!ZB(e))throw ie;let r=me(e),n=()=>e.state,o=i=>{let{contentIdKey:a,contentIdValue:p}=i;return e.state.search.results.find(f=>io(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(Ms(a))},collapse(i){let a={questionAnswerId:i};e.dispatch(t.logCollapseSmartSnippetSuggestion(a)),e.dispatch(Vs(a))}}}function ZB(e){return e.addReducers({search:we,questionAnswering:bn}),!0}d();c();l();u();function tP(e,t){if(!e1(e))throw ie;let r=()=>e.state,n=C=>{let b=r(),g=wr(b,C);return g?mt(b,g.documentId):null},o=new Set,i=C=>o.has(C)?!0:(o.add(C),!1),a=null,p=C=>{a!==C&&(a=C,m={},o.clear())},f=(C,b)=>vn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{i(b)||(e.dispatch(fv({questionAnswerId:b})),e.dispatch(An(C)))}),m={},h=C=>{let{searchResponseId:b}=r().search;p(b);let g=n(C);return g?(C in m||(m[C]=f(g,C)),m[C]):null};return{selectSource(C){h(C)?.select()},beginDelayedSelectSource(C){h(C)?.beginDelayedSelect()},cancelPendingSelectSource(C){h(C)?.cancelPendingSelect()}}}function e1(e){return e.addReducers({search:we,questionAnswering:bn}),!0}function rP(e,t){let r=eP(e,Zm),n=eg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=tP(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 nP={by:new Hs({enum:Nl,required:!0})},tg=T("sortCriteria/register",e=>oP(e)),rg=T("sortCriteria/update",e=>oP(e)),oP=e=>Qi(e)?(e.forEach(t=>O(t,nP)),{payload:e}):O(e,nP);d();c();l();u();var iP=le(ur(),e=>{e.addCase(tg,(t,r)=>Gr(r.payload)).addCase(rg,(t,r)=>Gr(r.payload)).addCase(rt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(at,(t,r)=>r.payload.sortCriteria??t)});function t1(e,t){if(!t)return;let r=new Fe({criterion:new ne({each:xb})}),n=r1(t),o={...t,criterion:n};mr(e,r,o,"buildSort")}function r1(e){return e.criterion?Qi(e.criterion)?e.criterion:[e.criterion]:[]}function aP(e,t){if(!n1(e))throw ie;let r=me(e),{dispatch:n}=e,o=()=>e.state;t1(e,t.initialState);let i=t.initialState?.criterion;return i&&n(tg(i)),{...r,sortBy(a){n(rg(a)),n(Jn(1))},isSortedBy(a){return this.state.sortCriteria===Gr(a)},get state(){return{sortCriteria:o().sortCriteria}}}}function n1(e){return e.addReducers({configuration:Ce,sortCriteria:iP}),!0}function sP(e,t={}){let{dispatch:r}=e,n=aP(e,t),o=()=>r(Ae({legacy:ks(),next:Gm()}));return{...n,get state(){return n.state},sortBy(i){n.sortBy(i),o()}}}d();c();l();u();function cP(e){return bs(e)}d();c();l();u();d();c();l();u();var o1=new Fe({expression:Ke,id:z,clearFiltersOnTabChange:new de}),i1=new Fe({isActive:new de});function uP(e,t){if(s1(t.options.id),!a1(e))throw ie;let r=me(e),{dispatch:n}=e;ht(e,o1,t.options,"buildTab");let o=mr(e,i1,t.initialState,"buildTab"),{id:i,expression:a}=t.options;return n(Kd({id:i,expression:a})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(_t(i)),{...r,select(){t.options.clearFiltersOnTabChange&&n(wa({q:"",clearFilters:!0})),n(_t(i))},get state(){return{isActive:e.state.tabSet[i]?.isActive}}}}function a1(e){return e.addReducers({configuration:Ce,tabSet:em}),!0}function s1(e){let t=Jd().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 lP(e,t){let{dispatch:r}=e,n=uP(e,t),o=()=>r(Ae({legacy:Xn(),next:ga()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var dP=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},Z(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function pP(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function fP(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 mP(e,t){return e.queryModification={...t,queryToIgnore:""},e}function gP(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var hP=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var yP=le(hP(),e=>e.addCase(Te.pending,pP).addCase(Te.fulfilled,(t,r)=>fP(t,r.payload.response.triggers)).addCase(xa,(t,r)=>mP(t,r.payload)).addCase(ba,(t,r)=>gP(t,r.payload)));function SP(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!c1(e))throw ie;let n=me(e),{dispatch:o}=e,i=()=>e.state,a=i().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!VT(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 c1(e){return e.addReducers({triggers:yP}),!0}function vP(e){return SP(e,{options:{logNotifyTriggerActionCreator:dP}})}d();c();l();u();d();c();l();u();var AP=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=Z(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=Z(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),CP=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(O(e,{articleType:z}),t.logCreateArticle(e,Z(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=Z(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),ng=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(Z(t.insightCaseContext))});d();c();l();u();d();c();l();u();var bP=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ye(e.configuration.organizationId,e.configuration.environment),userId:t}});return function bP(_x238,_x239){return _ref100.apply(this,arguments)}}();var u1={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new ne({required:!1,each:ze})},js=T("insight/userActions/registerUserActions",e=>O(e,u1)),Po=pe("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 bP(o,e));return $e(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 xP(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var l1=1e3,d1=l1*60,gv=30*d1,p1=2,f1=2,IP=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,i=g1(t);return y1(i,n,o)},m1=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}},g1=e=>{let t=!1,r=e.reduce((n,o)=>{try{let i=m1(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},h1=(e,t)=>Math.abs(e.timestamp-t)<gv,wP=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-gv&&t<=e.end+gv){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)},RP=(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},y1=(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(h1(i,o.start)){o.actions.push(i),o.start=i.timestamp;return}o.actions=o.actions.filter(a=>!RP(a,r)),wP(o,t,n),o={start:i.timestamp,end:i.timestamp,actions:[i]}}),o.actions=o.actions.filter(i=>!RP(i,r)),wP(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,p1),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-f1)}};var og=le(xP(),e=>{e.addCase(js,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(Po.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Po.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Po.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=IP(t,r.payload.response.value)})});function EP(e,t){if(!S1(e))throw ie;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=me(e),{ticketCreationDate:i,excludedCustomActions:a}=t.options;return r(js({ticketCreationDate:i,excludedCustomActions:a})),{...o,get state(){return n()},fetchUserActions(p){r(Po(p))},logOpenUserActions(){r(ng())}}}function S1(e){return e.addReducers({configuration:Ce,insightUserActions:og}),!0}d();c();l();u();function FP(e){if(!v1(e))throw ie;let t=me(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r($r())}}}function v1(e){return e.addReducers({configuration:Ce,insightConfiguration:$l,insightInterface:Yn,searchHub:Cd}),!0}d();c();l();u();function A1(e){return e.addReducers({}),{logSearchEvent:Db,logClickEvent:qb,logCustomEvent:Mb}}d();c();l();u();d();c();l();u();var TP=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Z(r.insightCaseContext);return t.logCopyToClipboard(Xe(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Tr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Nr(t)}}}),PP=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Z(r.insightCaseContext);return t.logCaseSendEmail(Xe(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Tr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Nr(t)}}}),kP=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Z(r.insightCaseContext);return t.logFeedItemTextPost(Xe(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Tr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Nr(t)}}});function C1(e){return e.addReducers({}),{logClearBreadcrumbs:Of,logInterfaceLoad:ed,logInterfaceChange:Xn,logCreateArticle:CP,logCategoryFacetBreadcrumb:Sf,logFacetBreadcrumb:uu,logFacetClearAll:Lt,logFacetDeselect:qr,logFacetSelect:Yt,logFacetShowLess:fs,logFacetShowMore:ps,logFacetUpdateSort:ln,logDateFacetBreadcrumb:lu,logNumericFacetBreadcrumb:du,logPageNext:qm,logPageNumber:Dm,logPagePrevious:Mm,logResultsSort:ks,logStaticFilterDeselect:Kf,logCopyToClipboard:TP,logCaseSendEmail:PP,logFeedItemTextPost:kP,logOpenUserActions:ng}}d();c();l();u();function b1(e){return e.addReducers({attachedResults:yo}),{setAttachedResults:gf,detachResult:ho,attachResult:go}}d();c();l();u();function x1(e){return e.addReducers({attachedResults:yo}),{logCaseDetach:rs,logCaseAttach:ts}}d();c();l();u();d();c();l();u();d();c();l();u();var ig=T("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=O(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ne({each:Ke}),i=O(n,o).error;return i?{payload:e,error:i}:{payload:e}}),ag=T("insight/caseId/set",e=>{let r=O(e,Ke).error;return r?{payload:e,error:r}:{payload:e}}),sg=T("insight/caseNumber/set",e=>{let r=O(e,Ke).error;return r?{payload:e,error:r}:{payload:e}});var OP=le(ex(),e=>{e.addCase(ig,(t,r)=>{t.caseContext=r.payload}).addCase(ag,(t,r)=>{t.caseId=r.payload}).addCase(sg,(t,r)=>{t.caseNumber=r.payload})});function w1(e){return e.addReducers({insightCaseContext:OP}),{setCaseContext:ig,setCaseId:ag,setCaseNumber:sg}}d();c();l();u();d();c();l();u();d();c();l();u();var R1=new ne({each:z,required:!0}),_P=(e,t)=>(O(e,z),Ui(t)?O(t,z):O(t,R1),{payload:{contextKey:e,contextValue:t}}),cg=T("context/set",e=>{for(let[t,r]of Object.entries(e))_P(t,r);return{payload:e}}),ug=T("context/add",e=>_P(e.contextKey,e.contextValue)),lg=T("context/remove",e=>O(e,z));var NP=le(Yl(),e=>{e.addCase(cg,(t,r)=>{t.contextValues=r.payload}).addCase(ug,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(lg,(t,r)=>{delete t.contextValues[r.payload]}).addCase(rt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function I1(e){return e.addReducers({context:NP}),{addContext:ug,removeContext:lg,setContext:cg}}d();c();l();u();function E1(e){return e.addReducers({dateFacetSet:gn}),{deselectAllDateFacetValues:Df,registerDateFacet:dn,toggleSelectDateFacetValue:pn,toggleExcludeDateFacetValue:fn,updateDateFacetSortCriterion:Nf,updateDateFacetValues:jn}}d();c();l();u();function F1(e){return e.addReducers({numericFacetSet:Co}),{deselectAllNumericFacetValues:Wf,registerNumericFacet:hn,toggleSelectNumericFacetValue:yn,toggleExcludeNumericFacetValue:Sn,updateNumericFacetSortCriterion:zf,updateNumericFacetValues:Ln}}d();c();l();u();function T1(e){return e.addReducers({fields:Cs}),{registerFieldsToInclude:Eo,enableFetchAllFields:Em,disableFetchAllFields:Fm,fetchFieldsDescription:Tm}}d();c();l();u();function P1(e){return e.addReducers({folding:Im}),{registerFolding:PF,loadCollection:xm}}d();c();l();u();function k1(e){return e.addReducers({generatedAnswer:xs}),{generateAnswer:$d,resetAnswer:lr,setAnswerGenerationMode:_d}}d();c();l();u();function O1(e){return e.addReducers({insightInterface:Yn}),{fetch:$r}}d();c();l();u();function _1(e){return e.addReducers({querySet:Fs}),{registerQuerySetQuery:Es,updateQuerySetQuery:_i}}d();c();l();u();function N1(e){return e.addReducers({search:we}),{executeSearch:ix,fetchFacetValues:cx,fetchMoreResults:sx,fetchPage:ax,fetchQuerySuggestions:id,registerQuerySuggest:xo}}d();c();l();u();function D1(e){return e.addReducers({}),{logContextChanged:tx,logExpandToFullUI:AP}}d();c();l();u();function q1(e){return e.addReducers({insightUserActions:og}),{registerUserActions:js,fetchUserActions:Po}}d();c();l();u();function M1(e){return e.addReducers({querySuggest:Bm,querySet:Fs}),{clearQuerySuggest:Ro,fetchQuerySuggestions:As,registerQuerySuggest:xo,selectQuerySuggestion:wo}}d();c();l();u();function V1(e){return e.addReducers({questionAnswering:bn}),{collapseSmartSnippet:_s,expandSmartSnippet:Os,dislikeSmartSnippet:Ds,likeSmartSnippet:Ns,openFeedbackModal:qs,closeFeedbackModal:To,expandSmartSnippetRelatedQuestion:Ms,collapseSmartSnippetRelatedQuestion:Vs}}d();c();l();u();d();c();l();u();d();c();l();u();function DP(){return{results:[],maxLength:10}}var qP=le(DP(),e=>{e.addCase(jm,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(Lm,t=>{t.results=[]}).addCase(An,(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 j1(e){return e.addReducers({recentResults:qP}),{registerRecentResults:jm,clearRecentResults:Lm,pushRecentResult:An}}d();c();l();u();d();c();l();u();var L1=new Fe({content:new Ge({required:!0}),conditions:new Ge({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ne({required:!1,each:z})});function MP(){let e=[],t=r=>{let n=L1.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new ko("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 VP(e){if(!U1(e))throw ie;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=MP();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Eo(i))},selectTemplate:r,selectLinkTemplate:n}}function U1(e){return e.addReducers({fields:Cs}),!0}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function If(e){e==="next"&&console.warn(uU)}d();c();l();u();var SE=Fr(yE(),1);function vE(e){return(0,SE.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function AE(e,t){let r=EU(e),n=mr,o=FU(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function EU(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function FU(e){return e.preprocessRequest||Gu}d();c();l();u();d();c();l();u();var CE={organizationId:z,accessToken:z,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}$/})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function bE(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var xE=new Pe({...CE,insightId:z,search:new Y({options:{required:!1},values:{locale:We}})}),TU="2729db39-d7fd-4504-a06e-668c64968c95";function av(){return{...bE(),insightId:TU}}var PU={insightConfiguration:zl,search:Ie,insightInterface:Kn,searchHub:xd,resultPreview:Ei};function kU(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function wE(e){let t=vE(e.loggerOptions);OU(e.configuration,t);let r=_U(e.configuration,t),n=NU(t),o={...AE(e.configuration,t),apiClient:r,streamingClient:n},a={...e,reducers:PU},i=cE(a,o);If(i.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,f=kU(e.configuration);return i.dispatch(Hl({insightId:p})),i.dispatch(Hr()),f&&i.dispatch(Si(f)),{...i,get state(){return i.state},executeFirstSearch(m=rd()){bd(i.state)||i.dispatch(Ce({legacy:m,next:nx()}))}}}function OU(e,t){try{xE.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function _U(e,t){return new $u({logger:t,preprocessRequest:e.preprocessRequest||Gu})}function NU(e){return new Bu({logger:e})}d();c();l();u();function ge(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 RE={articleLanguage:We,articlePublishStatus:We,articleVersionNumber:We,caseId:z,knowledgeArticleId:We,name:We,permanentId:We,resultUrl:We,source:We,title:z,uriHash:We,isAttachedFromCitation:new pe({required:!1,default:!1})},DU=new Y({options:{required:!0},values:RE}),Tf=P("insight/attachToCase/setAttachedResults",e=>_(e,{results:new ne({each:DU}),loading:new pe({required:!1,default:!1})})),ho=P("insight/attachToCase/attach",e=>IE(e)),yo=P("insight/attachToCase/detach",e=>IE(e)),IE=e=>ee(e.permanentId)&&ee(e.uriHash)?{payload:e,error:Tr(new Oo("Either permanentId or uriHash is required"))}:_(e,RE);d();c();l();u();d();c();l();u();var Dr=e=>{let t=J(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var rs=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCaseAttach(Ze(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Dr(t)}}}),ns=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,J(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:Pr(e,t),context:Dr(t)})});d();c();l();u();d();c();l();u();function EE(){return{results:[],loading:!1}}var So=de(EE(),e=>{e.addCase(Tf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(ho,(t,r)=>{(!ee(r.payload.permanentId)||!ee(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(yo,(t,r)=>{t.results=t.results.filter(n=>qU(n,r.payload))})}),qU=(e,t)=>{let r=!ee(e.permanentId)&&e?.permanentId===t?.permanentId,n=!ee(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Pf=(e,t)=>Qa(e.raw[t])?String(e.raw[t]):void 0,os=(e,t)=>({articleLanguage:Pf(e,"sflanguage"),articleVersionNumber:Pf(e,"sflanguage"),articlePublishStatus:Pf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Pf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function FE(e,t){if(!MU(e))throw ae;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=ge(e),{result:a,caseId:i}=t.options,p=()=>ee(i)||ee(a.raw.permanentid)&&ee(a.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=i===f.caseId,g=!ee(f.permanentId)&&f.permanentId===a.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===a.raw.urihash;return m&&(g||C)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(ho(os(a,i))),r(rs(a))},detach(){r(yo(os(a,i))),r(ns(a))}}}function MU(e){return e.addReducers({configuration:be,attachedResults:So}),!0}d();c();l();u();function TE(e,t){if(!VU(e))throw ae;let{dispatch:r}=e,n=ge(e),{caseId:o}=t.options,a=p=>ee(o)||ee(p.raw.permanentid)&&ee(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,g=!ee(f.permanentId)&&f.permanentId===p.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(g||C)}),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(ho(os(p,o))),r(rs(p))},detach(p){r(yo(os(p,o))),r(ns(p))}}}function VU(e){return e.addReducers({configuration:be,attachedResults:So}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ye=z;d();c();l();u();var jU={state:new $e({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new ne({required:!0,each:z}),moreValuesAvailable:new pe({required:!1})};function iv(e){e.children.forEach(t=>{iv(t)}),mr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},jU)}var as={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),basePath:new ne({required:!1,each:z}),filterByBasePath:new pe({required:!1})};var is=P("categoryFacet/register",e=>_(e,as)),ss=P("categoryFacet/toggleSelectValue",e=>{try{return mr(e.facetId,z),iv(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),vo=P("categoryFacet/deselectAll",e=>_(e,as.facetId)),iu=P("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:as.facetId,numberOfValues:as.numberOfValues})),kf=P("categoryFacet/updateSortCriterion",e=>_(e,{facetId:as.facetId,criterion:new $e})),PE=P("categoryFacet/updateBasePath",e=>_(e,{facetId:as.facetId,basePath:new ne({each:z})}));d();c();l();u();var tEe={categoryFacetId:ye,categoryFacetPath:new ne({required:!0,each:z})};var kE=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var LU={categoryFacetId:ye,categoryFacetPath:new ne({required:!0,each:z})},UU=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Of=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,LU);let n={...UU(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Be=P("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new pe({required:!1})})),nr=P("facetOptions/facet/enable",e=>_(e,ye)),ft=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 su={facetId:ye,captions:new Y({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var QU={path:new ne({required:!0,each:z}),displayValue:Xe,rawValue:Xe,count:new oe({required:!0,min:0})},_f=P("categoryFacet/selectSearchResult",e=>_(e,{facetId:ye,value:new Y({values:QU})})),OE=P("categoryFacetSearch/register",e=>_(e,su));d();c();l();u();function cs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function us(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Nf(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function cu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Df(e,t,r){e.currentValues=BU(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function BU(e,t){if(!e.length)return[];let r=_E(e[0],t),n=r;for(let o of e.splice(1)){let a=_E(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function _E(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var qf=de(ci(),e=>{e.addCase(is,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=$U(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(rt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(it,(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&&Df(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&Df(p,m,i.initialNumberOfValues)})}).addCase(kf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(PE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(ss,(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=GU(i,f,a);if(m.length){let C=m[0];C.retrieveChildren=!0,C.state="selected",C.previousState="idle",C.children=[];return}let g=DE(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(vo,(t,r)=>{let n=r.payload;cu(t,n)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>cu(t,r))}).addCase(Ci,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(iu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Nf(a,o);HU(t,r.payload)}}).addCase(_f,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];Df(a.request,i,a.initialNumberOfValues)}).addCase(Ii.fulfilled,(t,r)=>{NE(t,r.payload.response.facets)}).addCase(ke.fulfilled,(t,r)=>{NE(t,r.payload.response.facets)}).addCase(ft,(t,r)=>{cu(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)&&cu(t,o)})})}),sv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function GU(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=DE(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function $U(e){return{...sv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function DE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function NE(e,t){t.forEach(r=>{if(!zU(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=WU(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function HU(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 zU(e,t){return t.facetId in e}function WU(e,t){let r=Gr(e.currentValues),n=Gr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var sn=new $({regex:/^[a-zA-Z0-9-_]+$/}),cn=new $({required:!0}),qE=new ne({each:new $}),ME=new $,VE=new pe,un=new pe,ln=new oe({min:0}),qr=new oe({min:1}),Mf=new pe({required:!0}),YU=new Y,KU=new $,XU={captions:YU,numberOfValues:qr,query:KU},ls=new Y({values:XU}),Vf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ne({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),IFe=new pe,jf=new ne({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var Pa={value:z,numberOfResults:new oe({min:0}),state:z};var ZU={facetId:ye,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),resultsMustMatch:new $e({required:!1}),allowedValues:Vf,customSort:jf},ds=P("facet/register",e=>_(e,ZU)),Ao=P("facet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),Co=P("facet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),St=P("facet/deselectAll",e=>_(e,ye)),Lf=P("facet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})})),uu=P("facet/updateNumberOfValues",e=>_(e,{facetId:ye,numberOfValues:new oe({required:!0,min:1})})),lu=P("facet/updateIsFieldExpanded",e=>_(e,{facetId:ye,isFieldExpanded:new pe({required:!0})})),ka=P("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ye,freezeCurrentValues:new pe({required:!0})}));d();c();l();u();var ps=e=>ze("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o=pi(e,n);return t.makeFacetUnexclude(o)});var ar=()=>({actionCause:"facetClearAll"}),pr=()=>({actionCause:"facetSelect"}),Uf=()=>({actionCause:"facetExclude"}),Vn=()=>({actionCause:"facetDeselect"});var cv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var fs=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...J(r.insightCaseContext)};return t.logFacetShowMore(n)}),ms=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...J(r.insightCaseContext)};return t.logFacetShowLess(n)}),dn=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ye,sortCriterion:new $e({required:!0})});let{facetId:n,sortCriterion:o}=e,a=Xt(r),p={...Go(n,a),criteria:o,...J(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Lt=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ye);let n=Xt(r),o={...Go(e,n),...J(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o={...pi(e,n),...J(r.insightCaseContext)};return t.logFacetSelect(o)}),Mr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o={...pi(e,n),...J(r.insightCaseContext)};return t.logFacetDeselect(o)}),du=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n={...pi(e,Xt(r)),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var jE={facetId:ye,value:new Y({values:{displayValue:Xe,rawValue:Xe,count:new oe({required:!0,min:0})}})},LE=P("facetSearch/register",e=>_(e,su)),Qf=P("facetSearch/update",e=>_(e,su)),Bf=P("facetSearch/toggleSelectValue",e=>_(e,jE)),Gf=P("facetSearch/toggleExcludeValue",e=>_(e,jE));var gs=de(di(),e=>{e.addCase(ds,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Fb(JU(r.payload),o))}).addCase(rt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(it,(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,C=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(QE),...m.map(BE),...C.map(tQ)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(Ao,(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){$f(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Co,(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){$f(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(ka,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(St,(t,r)=>{us(t[r.payload]?.request)}).addCase(Jt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>us(r))}).addCase(cd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>us(r))}).addCase(Ci,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Lf,(t,r)=>{cs(t,r.payload)}).addCase(uu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Nf(t[n]?.request,o)}).addCase(lu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(ke.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>UE(t[o.facetId]?.request,o))}).addCase(Ii.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>UE(t[o.facetId]?.request,o))}).addCase(Bf,(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=QE(i);$f(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(Gf,(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=BE(i);$f(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(ft,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];us(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)&&us(a.request)})})});function $f(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 UE(e,t){e&&(e.currentValues=t.values.map(eQ),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var uv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function JU(e){return{...uv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function eQ(e){let{value:t,state:r}=e;return{value:t,state:r}}function QE(e){return{value:e,state:"selected"}}function BE(e){return{value:e,state:"excluded"}}function tQ(e){return{...e,state:"idle"}}d();c();l();u();var Hf=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();function hs(e){let t=GE(e.start,e),r=GE(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function GE(e,t){let{dateFormat:r}=t;return RA(e)?(Uu(e),bA(e)):typeof e=="string"&&Qn(e)?(Uu(e),e):(SA(e,r),Lu(za(e,r)))}d();c();l();u();var ys=P("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})}));d();c();l();u();var Oa={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new pe({required:!0}),numberOfResults:new oe({required:!0,min:0})},_a={start:z,end:z,endInclusive:new pe({required:!0}),state:z,numberOfResults:new oe({required:!0,min:0})},jn=e=>({facetId:ye,selection:typeof e.start=="string"?new Y({values:_a}):new Y({values:Oa})});var rQ={start:z,end:z,endInclusive:new pe({required:!0}),state:z},nQ={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:rQ})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function $E(e){return Qn(e)?Zs(e):e}function zf(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=hs(t);if(za($E(r)).isAfter(za($E(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var pn=P("dateFacet/register",e=>{try{return mr(e,nQ),zf(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),fn=P("dateFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),mn=P("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),Ln=P("dateFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new ne({each:new Y({values:_a})})}),zf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Wf=ys,Yf=St;d();c();l();u();d();c();l();u();var Kf=(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}`}},Xf=()=>({actionCause:"breadcrumbFacet"});var lv=Xf;d();c();l();u();var pu=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...Kf(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function oQ(e,t){return!!t&&t.facetId in e.dateFacetSet}var HE=(e,t)=>{let r=Fn(e,t);if(oQ(e,r))return r},zE=(e,t)=>(HE(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),WE=(e,t)=>(HE(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var Jf={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function em(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=YE(r);r.numberOfValues=o,e[n]=t}function tm(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=YE(n))}function rm(e,t,r){let n=e[t]?.request;if(!n)return;let o=Zf(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function nm(e,t,r){let n=e[t]?.request;if(!n)return;let o=Zf(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function gn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function om(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(Zf(o,p)&&(p.state="selected"),p));let a=o.filter(p=>!Zf(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function am(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 Zf(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function YE(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var hn=de(ui(),e=>{e.addCase(pn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=aQ(n);em(t,Ib(a,o))}).addCase(rt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(it,(t,r)=>{let n=r.payload.df||{};om(t,n)}).addCase(fn,(t,r)=>{let{facetId:n,selection:o}=r.payload;rm(t,n,o)}).addCase(mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;nm(t,n,o)}).addCase(Ln,(t,r)=>{let{facetId:n,values:o}=r.payload;tm(t,n,o)}).addCase(Yf,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(Wf,(t,r)=>{cs(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;am(t,n,iQ)}).addCase(ft,(t,r)=>{gn(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)&&gn(t,o)})})});function aQ(e){return{...Jf,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function iQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var sQ={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new pe({required:!0})},cQ={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:sQ})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function im(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 yn=P("numericFacet/register",e=>{try{return _(e,cQ),im(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Sn=P("numericFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),vn=P("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),Un=P("numericFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new ne({each:new Y({values:Oa})})}),im({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),sm=ys,cm=St;d();c();l();u();var dv=Xf;d();c();l();u();d();c();l();u();var KE=(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 fu=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...KE(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function uQ(e,t){return!!t&&t.facetId in e.numericFacetSet}var XE=(e,t)=>{let r=Fn(e,t);if(uQ(e,r))return r},ZE=(e,t)=>(XE(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),JE=(e,t)=>(XE(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var bo=de(li(),e=>{e.addCase(yn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=lQ(n);em(t,Eb(a,o))}).addCase(rt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(it,(t,r)=>{let n=r.payload.nf||{};om(t,n)}).addCase(Sn,(t,r)=>{let{facetId:n,selection:o}=r.payload;rm(t,n,o)}).addCase(vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;nm(t,n,o)}).addCase(Un,(t,r)=>{let{facetId:n,values:o}=r.payload;tm(t,n,o)}).addCase(cm,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(sm,(t,r)=>{cs(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;am(t,n,dQ)}).addCase(ft,(t,r)=>{gn(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)&&gn(t,o)})})});function lQ(e){return{...Jf,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function dQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var mu=z,um=new Y({options:{required:!0},values:{caption:Xe,expression:Xe,state:new $({constrainTo:["idle","selected","excluded"]})}}),eF=new ne({required:!0,each:um});var n_e=P("staticFilter/register",e=>_(e,{id:mu,values:eF})),tF=P("staticFilter/toggleSelect",e=>_(e,{id:mu,value:um})),rF=P("staticFilter/toggleExclude",e=>_(e,{id:mu,value:um})),o_e=P("staticFilter/deselectAllFilterValues",e=>_(e,mu));d();c();l();u();var lm=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...J(r.insightCaseContext)}));d();c();l();u();var dm=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 nF(e){let t=ge(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Jt())},deselectBreadcrumb(n){n.deselect()}}}function oF(e){if(!pQ(e))throw ae;let t=nF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:S,selection:b})=>{let w=du({facetId:S,facetValue:b.value});r(Ao({facetId:S,selection:b})),r(ka({facetId:S,freezeCurrentValues:!1})),r(Ce({legacy:w,next:cv()}))},executeToggleExclude:({facetId:S,selection:b})=>{let w=du({facetId:S,facetValue:b.value});r(Co({facetId:S,selection:b})),r(ka({facetId:S,freezeCurrentValues:!1})),r(Ce({legacy:w,next:cv()}))},facetValuesSelector:xb};return dm(h)},a=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:S=>{r(Sn(S)),r(Ce({legacy:fu(S),next:dv()}))},executeToggleExclude:S=>{r(vn(S)),r(Ce({legacy:fu(S),next:dv()}))},facetValuesSelector:ZE};return dm(h)},i=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:S=>{r(fn(S)),r(Ce({legacy:pu(S),next:lv()}))},executeToggleExclude:S=>{r(mn(S)),r(Ce({legacy:pu(S),next:lv()}))},facetValuesSelector:WE};return dm(h)},p=h=>{let S=Rb(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:S,deselect:()=>{r(vo(h)),r(Ce({legacy:Of({categoryFacetPath:S.map(b=>b.value),categoryFacetId:h}),next:kE()}))}}},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:S,values:b}=h,w=b.filter(I=>I.state!=="idle").map(I=>C(S,I));return{id:S,values:w}},C=(h,S)=>({value:S,deselect:()=>{let{caption:b,expression:w}=S,I=lm({staticFilterId:h,staticFilterValue:{caption:b,expression:w}});S.state==="selected"?r(tF({id:h,value:S})):S.state==="excluded"&&r(rF({id:h,value:S})),r(Ce({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(Ce({legacy:Hf(),next:{actionCause:"breadcrumbResetAll"}}))}}}function pQ(e){return e.addReducers({configuration:be,search:Ie,facetSet:gs,numericFacetSet:bo,dateFacetSet:hn,categoryFacetSet:qf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var aF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var pm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),iF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function sF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:pm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var cF=(e,t)=>{let r={...iF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var uF=de(sF(),e=>{e.addCase(Yl,t=>{t.enableDidYouMean=!0}).addCase(mx,t=>{t.enableDidYouMean=!1}).addCase(gx,t=>{t.automaticallyCorrectQuery=!0}).addCase(Kl,t=>{t.automaticallyCorrectQuery=!1}).addCase(ke.pending,t=>{t.queryCorrection=pm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(ke.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:pm();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(kc,(t,r)=>{t.queryCorrectionMode=r.payload})});function lF(e,t={}){if(!fQ(e))throw ae;let r=ge(e),{dispatch:n}=e;n(Yl()),t.options?.automaticallyCorrectQuery===!1&&n(Kl()),n(kc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>aF(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(kc(i))}}}function fQ(e){return e.addReducers({configuration:be,didYouMean:uF}),!0}var dF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function pF(e,t={options:dF}){let r={...dF,...t.options},n=lF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Ce({legacy:xx(),next:kx()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Ut=de(Jl(),e=>{e.addCase(Be,(t,r)=>({...t,...r.payload})).addCase(ke.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(ke.rejected,t=>{t.freezeFacetOrder=!1}).addCase(rt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;fm(o,t,n)}).addCase(ds,(t,r)=>{let{facetId:n,tabs:o}=r.payload;fm(o,t,n)}).addCase(pn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;fm(o,t,n)}).addCase(yn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;fm(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(ft,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(it,(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]=Cy()),t.facets[n].enabled=!0})})});function fm(e,t,r){let n={...Cy(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var mm=de(td(),e=>{e.addCase(Zd,(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;fF(t,n)}).addCase(Xd,(t,r)=>{let n=r.payload;fF(t,n)}).addCase(rt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(it,(t,r)=>{let n=r.payload.tab;ee(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function fF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function mF(e){if(!mQ(e))throw ae;let t=ge(e),r=at(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function mQ(e){return e.addReducers({tabSet:mm}),!0}function gF(e,t){if(!gQ(e))throw ae;let r=mF(e),n=S=>e.state.facetOptions.facets[S]?.enabled??!1,o=S=>e.state.facetSet?.[S]?.request?.currentValues??e.state.categoryFacetSet?.[S]?.request?.currentValues??e.state.numericFacetSet?.[S]?.request?.currentValues??e.state.dateFacetSet?.[S]?.request?.currentValues??null,a=S=>S in e.state.facetOptions.facets,i=S=>e.state.facetOptions.facets[S]?.tabs,p=()=>Ga({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:S})=>a(S)?{enabled:n(S),values:o(S)}:null),isTabEnabled:or(i(t.facetId),r.state.activeTab)}),f=()=>{let S=p();return S===x?!1:(x=S,!0)},m=()=>t.conditions.length>0?t.conditions.some(S=>{if(!n(S.parentFacetId))return!1;let b=o(S.parentFacetId);return b===null?!1:S.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([S,b])=>b.request.freezeCurrentValues&&e.dispatch(ka({facetId:S,freezeCurrentValues:!1})))},C=()=>{if(!a(t.facetId))return;let S=n(t.facetId),b=m(),w=or(i(t.facetId),r.state.activeTab),I=b&&w;S!==I&&(e.dispatch(I?nr(t.facetId):ft(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&C()});return C(),{stopWatching(){h()}}}function gQ(e){return e.addReducers({facetOptions:Ut}),!0}function hF(e,t){return gF(e,t)}d();c();l();u();d();c();l();u();function yF(e){if(!hQ(e))throw ae;let t=ge(e),r=()=>e.state;return{...t,sort(n){return _c(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function hQ(e){return e.addReducers({search:Ie,facetOptions:Ut}),!0}function SF(e){return yF(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function gm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...Ss,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function hm(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function ym(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Sm(e,t){let r=e[t];r&&(r.isLoading=!1)}function vm(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function gu(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=Ss.query)}function Am(e,t){Object.keys(e).forEach(r=>gu(e,{facetId:r},t))}var Ss={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var vF=/*#__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:C,filterFacetCount:x}=a,h=yQ(a),S=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:C,captions:i,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:S,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function vF(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),yQ=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var AF=/*#__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),C=`*${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:C,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function AF(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var CF=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,z),SQ(i,t)?p=yield AF(t,i,a,e):p=yield vF(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),xo=fe("facetSearch/executeSearch",CF(!1)),qDe=fe("facetSearch/executeSearch",CF(!0)),Cm=P("facetSearch/clearResults",e=>_(e,{facetId:ye})),SQ=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function bF(){return{}}var xF=de(bF(),e=>{e.addCase(OE,(t,r)=>{let n=r.payload;gm(t,n,pv)}).addCase(Qf,(t,r)=>{hm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;ym(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Sm(t,n)}).addCase(xo.fulfilled,(t,r)=>{vm(t,r.payload,r.meta.requestId)}).addCase(Cm,(t,{payload:{facetId:r}})=>{gu(t,{facetId:r},pv)}).addCase(ke.fulfilled,t=>{Am(t,pv)})});function pv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function wF(e,t){let{field:r,state:n}=e;if(!vQ(e))return r;let o=`${r}_`,a=AQ(o,n);return bQ(r,t),`${o}${a}`}function vQ(e){let{field:t,state:r}=e;return RF(r).some(o=>o&&t in o)}function AQ(e,t){let n=RF(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return CQ(n,e)+1}function RF(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function CQ(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 bQ(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||wF({field:o,state:r},n)}d();c();l();u();d();c();l();u();var IF=["alphanumeric","occurrences"];var EF=new Pe({field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),basePath:qE,delimitingCharacter:ME,facetId:sn,facetSearch:ls,filterByBasePath:VE,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:IF})});function FF(e,t){if(!xQ(e))throw ae;let r=ge(e),{dispatch:n}=e,o=wr(e,t.options),a=t.options.tabs??{},i=Wt(e.state.tabSet),p={...sv,...Nu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...Ss,...t.options.facetSearch},...p};ht(e,EF,f,"buildCategoryFacet");let m=()=>ay(e.state,o),g=()=>oy(e.state,o),C=()=>Br(e.state),x=()=>Zr(e.state,o);return n(is(p)),{...r,toggleSelect(h){let S=f.numberOfValues;n(ss({facetId:o,selection:h,retrieveCount:S})),n(Be())},deselectAll(){n(vo(o)),n(Be())},sortBy(h){n(kf({facetId:o,criterion:h})),n(Be())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:S,valuesAsTrees:b}=this.state,w=(S?.children.length??b.length)+h;n(iu({facetId:o,numberOfValues:w})),n(Be())},showLessValues(){let{numberOfValues:h}=f;n(iu({facetId:o,numberOfValues:h})),n(Be())},enable(){n(nr(o))},disable(){n(ft(o))},get state(){let h=m(),S=g(),b=C(),w=x(),I=S?.values??[],E=I.some(B=>B.children.length>0)??!1,{parents:F,values:k}=wb(S?.values),T=Gr(I),q=T.length?T[T.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??S?.moreValuesAvailable??!1,j=q?q.children.length>f.numberOfValues:I.length>f.numberOfValues;return{facetId:o,parents:F,selectedValueAncestry:T,values:k,isHierarchical:E,valuesAsTrees:I,activeValue:q,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:j,sortCriteria:h.sortCriteria,enabled:w}}}}function xQ(e){return e.addReducers({categoryFacetSet:qf,categoryFacetSearchSet:xF,facetOptions:Ut,configuration:be,search:Ie}),!0}function TF(e,t){let r=FF(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=wQ(o(),m);n(Ce({legacy:g,next:RQ(m)}))},deselectAll(){r.deselectAll(),n(Ce({legacy:Lt(o()),next:ar()}))},sortBy(m){r.sortBy(m),n(Ce({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(Ai({legacy:fs(o())}))},showLessValues(){r.showLessValues(),n(Ai({legacy:ms(o())}))},get state(){return{...r.state,facetSearch:i.state}}}}function wQ(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Mr(r):Yt(r)}function RQ(e){return e.state==="selected"?Vn():pr()}d();c();l();u();d();c();l();u();d();c();l();u();function PF(){return{}}var bm=de(PF(),e=>{e.addCase(LE,(t,r)=>{let n=r.payload;gm(t,n,fv)}).addCase(Qf,(t,r)=>{hm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;ym(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Sm(t,n)}).addCase(xo.fulfilled,(t,r)=>{vm(t,r.payload,r.meta.requestId)}).addCase(Cm,(t,{payload:r})=>{gu(t,r,fv)}).addCase(ke.fulfilled,t=>{Am(t,fv)})});function fv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var IQ=e=>e.state==="selected",kF=(e,t)=>{let r={facetId:e,facetValue:t.value};return IQ(t)?Mr(r):Yt(r)};d();c();l();u();var mv=e=>e.state==="selected",DF=e=>e.state==="excluded";var qF=e=>mv(e)?Vn():pr();d();c();l();u();d();c();l();u();var MF={facetId:ye,selection:new Y({values:Pa})},VF=fe("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},MF),n(Ao({facetId:e,selection:t})),n(Be())}),jF=fe("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},MF),n(Co({facetId:e,selection:t})),n(Be())});d();c();l();u();d();c();l();u();var vs=["allValues","atLeastOneValue"];d();c();l();u();var xm=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var LF=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:cn,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:xm}),resultsMustMatch:new $({constrainTo:vs}),facetSearch:ls});function UF(e,t,r=LF){if(!EQ(e))throw ae;let{dispatch:n}=e,o=ge(e),a=wr(e,t.options),i=t.options.tabs??{},p=Wt(e.state.tabSet),f={...uv,...Nu("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...Ss,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let g=()=>bb(e.state,a),C=()=>ny(e.state,a),x=()=>Br(e.state),h=()=>Zr(e.state,a),S=()=>{let{currentValues:w}=g();return w.filter(I=>I.state!=="idle").length},b=()=>{let{currentValues:w}=g(),I=m.numberOfValues,E=!!w.find(F=>F.state==="idle");return I<w.length&&E};return n(ds(f)),{...o,toggleSelect:w=>n(VF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(jF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(St(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(St(a)),this.toggleExclude(w)},isValueSelected:mv,isValueExcluded:DF,deselectAll(){n(St(a)),n(Be())},sortBy(w){n(Lf({facetId:a,criterion:w})),n(Be())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,I=m.numberOfValues,E=I-w%I,F=w+E;n(uu({facetId:a,numberOfValues:F})),n(lu({facetId:a,isFieldExpanded:!0})),n(Be())},showLessValues(){let w=m.numberOfValues,I=Math.max(w,S());n(uu({facetId:a,numberOfValues:I})),n(lu({facetId:a,isFieldExpanded:!1})),n(Be())},enable(){n(nr(a))},disable(){n(ft(a))},get state(){let w=g(),I=C(),E=x(),F=h(),k;typeof w.sortCriteria=="object"?k=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":k=w.sortCriteria;let T=I?I.values:[],q=T.some(j=>j.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:E,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:b(),enabled:F}}}}function EQ(e){return e.addReducers({facetSet:gs,facetOptions:Ut,configuration:be,facetSearchSet:bm}),!0}d();c();l();u();var QF=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:xm}),resultsMustMatch:new $({constrainTo:vs}),facetSearch:ls,allowedValues:Vf,customSort:jf});function BF(e,t){if(!FQ(e))throw ae;let{dispatch:r}=e,n=UF(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},QF),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(Ce({legacy:kF(o(),m),next:qF(m)}))},deselectAll(){n.deselectAll(),r(Ce({legacy:Lt(o()),next:ar()}))},sortBy(m){n.sortBy(m),r(Ce({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ai({legacy:fs(o())}))},showLessValues(){n.showLessValues(),r(Ai({legacy:ms(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function FQ(e){return e.addReducers({facetSet:gs,configuration:be,facetSearchSet:bm,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var hu=e=>e.state==="selected",GF=e=>e.state==="excluded";var wm=e=>hu(e)?Vn():pr();var Rm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return hu(t)?Mr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Im=P("rangeFacet/executeToggleSelect",e=>_(e,jn(e.selection))),Em=P("rangeFacet/executeToggleExclude",e=>_(e,jn(e.selection)));var $F={facetId:ye,selection:new Y({values:_a})},HF=fe("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,$F),t(fn(e)),t(Im(e)),t(Be())}),zF=fe("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,$F),t(mn(e)),t(Em(e)),t(Be())});d();c();l();u();function Fm(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 Tm(e,t){let{facetId:r,getRequest:n}=t,o=ge(e),a=e.dispatch,i=()=>Zr(e.state,r);return{...o,isValueSelected:hu,isValueExcluded:GF,deselectAll(){a(St(r)),a(Be())},sortBy(p){a(ys({facetId:r,criterion:p})),a(Be())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(nr(r))},disable(){a(ft(r))},get state(){let p=n(),f=Fn(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,C=f?f.values:[],x=Br(e.state),h=i(),S=C.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:C,sortCriterion:m,resultsMustMatch:g,hasActiveValues:S,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var Pm=["idle","selected","excluded"];d();c();l();u();var km=["ascending","descending"],Om=["even","equiprobable"];var TQ={start:new $,end:new $,endInclusive:new pe,state:new $({constrainTo:Pm})},PQ=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),generateAutomaticRanges:Mf,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new ne({each:new Y({values:TQ})}),sortCriteria:new $({constrainTo:km}),rangeAlgorithm:new $({constrainTo:Om})});function _m(e,t){ht(e,PQ,t,"buildDateFacet"),zf(t)}function WF(e,t){if(!kQ(e))throw ae;Fm(t.options,"buildDateFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=Wt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};_m(e,i),r(pn(i));let p=Tm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(HF({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},toggleExclude:f=>r(zF({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(St(n)),this.toggleExclude(f)},get state(){return p.state}}}function kQ(e){return e.addReducers({configuration:be,search:Ie,dateFacetSet:hn,facetOptions:Ut}),!0}function YF(e,t){let r=WF(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ce({legacy:Lt(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(Ce({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Ce({legacy:Rm(o(),a),next:wm(a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function KF(e,t){if(!OQ(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=Wt(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};_m(e,f),n(pn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Ln({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Ln({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(ft(a))},get state(){let g=Br(o()),C=m(),x=zE(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function OQ(e){return e.addReducers({dateFacetSet:hn,facetOptions:Ut,configuration:be,search:Ie}),!0}function XF(e,t){if(!_Q(e))throw ae;let r=KF(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ce({legacy:Lt(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Ce({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}function _Q(e){return e.addReducers({dateFacetSet:hn,configuration:be,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ZF={facetId:ye,selection:new Y({values:Oa})},JF=fe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ZF),t(Sn(e)),t(Im(e)),t(Be())}),LUe=fe("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ZF),t(vn(e)),t(Em(e)),t(Be())});d();c();l();u();var NQ={start:new oe,end:new oe,endInclusive:new pe,state:new $({constrainTo:Pm})},DQ=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:cn,generateAutomaticRanges:Mf,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new ne({each:new Y({values:NQ})}),sortCriteria:new $({constrainTo:km}),resultsMustMatch:new $({constrainTo:vs}),rangeAlgorithm:new $({constrainTo:Om})});function Nm(e,t){ht(e,DQ,t,"buildNumericFacet"),im(t)}d();c();l();u();function Dm(e){return{endInclusive:!1,state:"idle",...e}}function eT(e,t){if(!qQ(e))throw ae;Fm(t.options,"buildNumericFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=Wt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Nm(e,i),r(yn(i));let p=Tm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(JF({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},get state(){return p.state}}}function qQ(e){return e.addReducers({numericFacetSet:bo,facetOptions:Ut,configuration:be,search:Ie}),!0}function tT(e,t){let r=eT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ce({legacy:Lt(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(Ce({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Ce({legacy:Rm(o(),a),next:wm(a)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function rT(e,t){if(!MQ(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=Wt(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};Nm(e,f),n(yn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Un({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Un({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(ft(a))},get state(){let g=Br(o()),C=m(),x=JE(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function MQ(e){return e.addReducers({numericFacetSet:bo,facetOptions:Ut,configuration:be,search:Ie}),!0}function nT(e,t){let r=rT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ce({legacy:Lt(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Ce({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 VQ=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ot(e),t.logShowMoreFoldedResults(Ze(e,r),Je(e),J(r.insightCaseContext)))),jQ=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(J(t.insightCaseContext))),oT={logShowMoreFoldedResults:VQ,logShowLessFoldedResults:jQ};d();c();l();u();d();c();l();u();var yu={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},As=P("folding/register",e=>_(e,yu)),qm=fe("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 eo(a):bi(a,o),p=yield n.search({...i,q:LQ(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 He(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 LQ(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var aT=P("folding/register",e=>_(e,yu)),Mm=fe("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield bx(o,e),p=(yield Fx(n,o,a,{origin:"foldingCollection"})).response;return He(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 Vm=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function UQ(e,t){return e.raw[t.collection]}function gv(e,t){return e.raw[t.parent]}function Su(e,t){let r=e.raw[t.child];return Ou(r)?r[0]:r}function QQ(e,t){return(e||t)!==void 0&&e===t}function sT(e,t,r,n=[]){let o=Su(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=Su(a,r)===Su(e,r);return gv(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:sT(i,t,r,[...n,o])}}):[]}function BQ(e,t){return e.find(r=>{let n=gv(r,t)===void 0,o=QQ(gv(r,t),Su(r,t));return n||o})}function cT(e){return e.parentResult?cT(e.parentResult):e}function GQ(e,t,r,n){let o=jl(e),i={...(n??BQ(o,t)??cT(e)),searchUid:r},p=sT(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function jm(e,t,r,n){let o={};return e.forEach(a=>{let i=UQ(a,t);i&&(!Su(a,t)&&!a.parentResult||(o[i]=GQ(a,t,r,n)))}),o}function iT(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 Lm=de(Vm(),e=>e.addCase(ke.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?jm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Xr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?jm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(ao.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...jm(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(As,(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(qm.pending,(t,{meta:r})=>{let n=r.arg;iT(t,n).isLoadingMoreResults=!0}).addCase(qm.rejected,(t,{meta:r})=>{let n=r.arg;iT(t,n).isLoadingMoreResults=!1}).addCase(qm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=jm(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 vu={id:z},wo=P("querySuggest/register",e=>_(e,{...vu,count:new oe({min:0})})),uT=P("querySuggest/unregister",e=>_(e,vu)),Ro=P("querySuggest/selectSuggestion",e=>_(e,{...vu,expression:Xe})),Io=P("querySuggest/clear",e=>_(e,vu)),Cs=fe("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,vu);let i=e.id,p=yield $Q(i,t(),a),f=yield n.querySuggest(p);return He(f)?r(f.error):{id:i,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),$Q=/*#__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 Xn(t.configuration.analytics):Wo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function $Q(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Eo=de(ut(),e=>e.addCase(zt,(t,r)=>({...t,...r.payload})).addCase(Zt,(t,r)=>{t.q=r.payload}).addCase(Ro,(t,r)=>{t.q=r.payload.expression}).addCase(rt.fulfilled,(t,r)=>r.payload?.query??t).addCase(it,(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 Fo=P("fields/registerFieldsToInclude",e=>_(e,Hu)),Um=P("fields/fetchall/enable"),Qm=P("fields/fetchall/disable"),Bm=fe("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 He(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 lT=["author","language","urihash","objecttype","collection","source","permanentid"],HQ=[...lT,"date","filetype","parents"],j1e=[...HQ,"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"],dT=()=>({fieldsToInclude:lT,fetchAllFields:!1,fieldsDescription:[]});var bs=de(dT(),e=>e.addCase(Fo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Um,t=>{t.fetchAllFields=!0}).addCase(Qm,t=>{t.fetchAllFields=!1}).addCase(Bm.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(As,(t,{payload:r})=>{let n=Vm().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function xs(e){if(!zQ(e))throw ae;let t=ge(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:bd(n)}}}}function zQ(e){return e.addReducers({search:Ie}),!0}var WQ=new Pe({fieldsToInclude:new ne({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function Gm(e,t){if(!YQ(e))throw ae;let r=ge(e),n=xs(e),{dispatch:o}=e,a=()=>e.state,i=ht(e,WQ,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(Fo(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,C=200,x=!1;return{...r,get state(){let S=a();return{...n.state,results:S.search.results,moreResultsAvailable:p(),searchResponseId:S.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<C){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 YQ(e){return e.addReducers({search:Ie,configuration:be,fields:bs}),!0}var KQ=new Pe(yu);function pT(e,t,r){if(!XQ(e))throw ae;let n=Gm(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?ht(e,KQ,t.options.folding,"buildFoldedResultList"):{};return o(As({...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 hv(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return hv(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 XQ(e){return e.addReducers({search:Ie,configuration:tp,folding:Lm,query:Eo}),!0}function hv(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=hv(n.children,t);if(o)return o}}return null}function fT(e,t={}){let r=pT(e,{...t,loadCollectionActionCreator:Mm,fetchMoreResultsActionCreator:id},oT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var ZQ=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(J(t.insightCaseContext))),yv=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Le(r),o=fi(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Ll(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:Ul(o)},J(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=fi(t,e);return{answerId:Le(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),JQ=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Le(n),a=fi(n,e);return!o||!a?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t},J(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=fi(r,e);return{answerId:Le(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),eB=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"like"})}),tB=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"dislike"})}),rB=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Le(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},J(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Le(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Uc(o),documented:Uc(a),correctTopic:Uc(p),hallucinationFree:Uc(i)},additionalNotes:m,correctAnswerUrl:f}}}),nB=e=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Le(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o},J(r.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Le(t)??"",answerGenerated:e})});var oB=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"show"})}),aB=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"hide"})}),iB=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"expand"})}),sB=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"collapse"})}),cB=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"copyToClipboard"})}),$m={logCopyGeneratedAnswer:cB,logGeneratedAnswerHideAnswers:aB,logGeneratedAnswerShowAnswers:oB,logGeneratedAnswerStreamEnd:nB,logGeneratedAnswerFeedback:rB,logDislikeGeneratedAnswer:tB,logLikeGeneratedAnswer:eB,logHoverCitation:JQ,logOpenGeneratedAnswerSource:yv,logRetryGeneratedAnswer:ZQ,logGeneratedAnswerExpand:iB,logGeneratedAnswerCollapse:sB};d();c();l();u();d();c();l();u();d();c();l();u();function Hm(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var ws=de(rS(),e=>e.addCase(Di,(t,{payload:r})=>{t.isVisible=r}).addCase(Qc,(t,{payload:r})=>{t.isEnabled=r}).addCase(Ld,(t,{payload:r})=>{t.id=r.id}).addCase(ea,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.answer||(t.answer=""),t.answer+=r.textDelta,delete t.error}).addCase(ta,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Hm([...t.citations,...r.citations]),delete t.error}).addCase(ra,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===oh},t.citations=[],delete t.answer}).addCase(qd,t=>{t.liked=!0,t.disliked=!1}).addCase(Md,t=>{t.liked=!1,t.disliked=!0}).addCase(Vd,t=>{t.feedbackModalOpen=!0}).addCase(Ud,t=>{t.feedbackModalOpen=!1}).addCase(Mi,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...rS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase(Jr,(t,{payload:r})=>{t.isLoading=r}).addCase(Jo,(t,{payload:r})=>{t.isStreaming=r}).addCase(na,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(Qd,(t,{payload:r})=>{t.responseFormat=r}).addCase(Gd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Gc,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Bc,t=>{t.expanded=!0}).addCase(jd,t=>{t.expanded=!1}).addCase(Bd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(oa,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(oS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(qi,(t,{payload:r})=>{t.answerId=r}).addCase(Dd,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase($d,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Hd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}));d();c();l();u();function zm(e,t,r={}){if(!uB(e))throw ae;let{dispatch:n}=e,o=ge(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Di(i));let p=r.initialState?.responseFormat;p&&n(Qd(p));let f=r.fieldsToIncludeInCitations;return f&&n(Gd(f)),r.initialState?.expanded&&n(Bc()),{...o,get state(){let g=a().generatedAnswer;return{...g,error:Rf(g.error)}},like(){this.state.liked||(n(qd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Md()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Vd())},closeFeedbackModal(){n(Ud())},sendFeedback(g){n(t.logGeneratedAnswerFeedback(g)),n(Mi())},logCitationClick(g,C){n(t.logOpenGeneratedAnswerSource(g,C))},logCitationHover(g,C,x){n(t.logHoverCitation(g,C,x))},show(){this.state.isVisible||(n(Di(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Di(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Bc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(jd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Qc(!0))},disable(){this.state.isEnabled&&n(Qc(!1))},logCopyToClipboard(g){n(t.logCopyGeneratedAnswer(g))},retry(){}}}function uB(e){return e.addReducers({generatedAnswer:ws}),!0}var Qt={engines:{},setAbortControllerRef:(e,t)=>{Qt.engines[t].abortController=e},getIsStreamInProgress:e=>!Qt.engines[e].abortController||Qt.engines[e].abortController?.signal.aborted?(Qt.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(Qt.engines[a].lastRequestId!==n){if(Qt.engines[a].lastRequestId=n,Qt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Qt.getIsStreamInProgress(a)&&o&&o!==Qt.engines[a].lastStreamId){if(Qt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Bw({setAbortControllerRef:p=>Qt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function mT(e,t,r={}){if(!lB(e))throw ae;let n=zm(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Qt.engines[e.state.generatedAnswer.id]&&(Qt.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=ku("genQA-",12);e.dispatch(Ld({id:i}))}Qt.engines[e.state.generatedAnswer.id]||(Qt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Qt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(ke({legacy:t.logRetryGeneratedAnswer()}))}}}function lB(e){return e.addReducers({generatedAnswer:ws}),!0}d();c();l();u();d();c();l();u();var gT=Yd.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var Wm=e=>e==="yes"?!0:e==="no"?!1:null,dB=({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:Wm(t.correctTopic),documented:Wm(t.documented),hallucinationFree:Wm(t.hallucinationFree),readable:Wm(t.readable)},helpful:t.helpful,question:r}),pB=e=>{let t="",r=()=>{let n=e.state,o=Iw(n),a=o.requestId;a!==t&&(t=a,e.dispatch(lr()),o.q?.length>0&&e.dispatch(zd()))};e.subscribe(r)};function hT(e,t,r={}){if(!fB(e))throw ae;If(e.state.configuration.analytics.analyticsMode);let{...n}=zm(e,t,r),o=()=>e.state;return e.dispatch(Bd(r.answerConfigurationId)),pB(e),{...n,get state(){let a=aS(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Hm(a?.citations??[]),error:Rf({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=kd(o());e.dispatch(Wd(a??Xo))},reset(){e.dispatch(lr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=dB({query:o().query.q,feedback:a,answerApiState:aS(e.state).data});e.dispatch(gT.endpoints.post.initiate(i)),e.dispatch(Mi())})()}}}function fB(e){return e.addReducers({[aa.reducerPath]:aa.reducer,query:Eo}),!0}function yT(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?hT(e,$m,t):mT(e,$m,t);return{...n,get state(){return n.state},retry(){r(Ce({legacy:$m.logRetryGeneratedAnswer(),next:Ew()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function An(e,t,r){if(!mB(e))throw ae;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Du(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function mB(e){return e.addReducers({configuration:be}),!0}function ST(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logOpenGeneratedAnswerSource(r.options.citation.id,r.options.answerId)))};return An(e,r,()=>{o()})}function vT(e,t){return ST(e,{logOpenGeneratedAnswerSource:yv},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var SB=new oe({min:1,default:8,required:!1}),vB=new oe({min:1,max:20,default:5,required:!1}),AB={desiredCount:vB,numberOfValues:SB},G$e=P("automaticFacet/setOptions",e=>_(e,AB)),$$e=P("automaticFacet/deselectAll",e=>_(e,ye)),CB=z,AT=P("automaticFacet/toggleSelectValue",e=>_(e,{field:CB,selection:new Y({values:Pa})}));var Is=de(Wr(),e=>{e.addCase(pd,(t,r)=>{let n=Sv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Au(n,o)}).addCase(fd,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(_t,t=>{t.firstResult=0}).addCase(md,(t,r)=>{let n=r.payload;t.firstResult=Au(n,t.numberOfResults)}).addCase(Jn,(t,r)=>{let n=r.payload;t.firstResult=Au(n,t.numberOfResults)}).addCase(hd,t=>{let r=Sv(t),n=Math.max(r-1,1);t.firstResult=Au(n,t.numberOfResults)}).addCase(gd,t=>{let r=Sv(t),n=bB(t),o=Math.min(r+1,n);t.firstResult=Au(o,t.numberOfResults)}).addCase(rt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(it,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(ke.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Xr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(St,t=>{Bt(t)}).addCase(mn,t=>{Bt(t)}).addCase(Co,t=>{Bt(t)}).addCase(vn,t=>{Bt(t)}).addCase(Gf,t=>{Bt(t)}).addCase(Ao,t=>{Bt(t)}).addCase(vo,t=>{Bt(t)}).addCase(ss,t=>{Bt(t)}).addCase(_f,t=>{Bt(t)}).addCase(fn,t=>{Bt(t)}).addCase(Sn,t=>{Bt(t)}).addCase(Jt,t=>{Bt(t)}).addCase(Ln,t=>{Bt(t)}).addCase(Un,t=>{Bt(t)}).addCase(Bf,t=>{Bt(t)}).addCase(AT,t=>{Bt(t)})});function Bt(e){e.firstResult=Wr().firstResult}function Sv(e){let{firstResult:t,numberOfResults:r}=e;return vv(t,r)}function bB(e){let{totalCountFiltered:t,numberOfResults:r}=e;return Av(t,r)}function Au(e,t){return(e-1)*t}function vv(e,t){return Math.round(e/t)+1}function Av(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function xB(e){return e.pagination.firstResult}function CT(e){return e.pagination.numberOfResults}function wB(e){return e.pagination.totalCountFiltered}var To=e=>{let t=xB(e),r=CT(e);return vv(t,r)},Cv=e=>{let t=wB(e),r=CT(e);return Av(t,r)},bT=(e,t)=>{let r=To(e),n=Cv(e),o=RB(r,t);return o=IB(o),o=EB(o,n),FB(o)};function RB(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 IB(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function EB(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 FB(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var bv=()=>ze("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Wr().numberOfResults}));var Es=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var Ym=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:To(t),...J(t.insightCaseContext)})),Km=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:To(t),...J(t.insightCaseContext)})),Xm=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:To(t),...J(t.insightCaseContext)}));d();c();l();u();var TB=new Pe({numberOfPages:new oe({default:5,min:0})}),PB=new Pe({page:new oe({min:1})});function xT(e,t={}){if(!kB(e))throw ae;let r=ge(e),{dispatch:n}=e,o=ht(e,TB,t.options,"buildPager"),i=gr(e,PB,t.initialState,"buildPager").page;i&&n(md(i));let p=()=>To(e.state),f=()=>{let{numberOfPages:g}=o;return bT(e.state,g)},m=()=>Cv(e.state);return{...r,get state(){let g=p(),C=m(),x=g>1&&C>0,h=g<C;return{currentPage:g,currentPages:f(),maxPage:C,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(Jn(g))},nextPage(){n(gd())},previousPage(){n(hd())},isCurrentPage(g){return g===this.state.currentPage}}}function kB(e){return e.addReducers({configuration:be,pagination:Is}),!0}function wT(e,t={}){let{dispatch:r}=e,n=xT(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(ad({legacy:Ym(),next:Es()}))},nextPage(){n.nextPage(),r(ad({legacy:Km(),next:Es()}))},previousPage(){n.previousPage(),r(ad({legacy:Xm(),next:Es()}))}}}d();c();l();u();d();c();l();u();function RT(e){if(!OB(e))throw ae;let t=ge(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function OB(e){return e.addReducers({search:Ie}),!0}function IT(e){return RT(e)}d();c();l();u();d();c();l();u();function ET(e){if(!_B(e))throw ae;let t=ge(e),r=xs(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 _B(e){return e.addReducers({search:Ie,pagination:Is}),!0}function FT(e){return ET(e)}d();c();l();u();d();c();l();u();function TT(_x235,_x236){return _TT.apply(this,arguments)}function _TT(){_TT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:a}=e.insightConfiguration,i=e.query?.q||"";return{url:ch({url:Ke(n,o),accessToken:r,organizationId:n,insightId:a}),accessToken:r,organizationId:n,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0}});return _TT.apply(this,arguments)}d();c();l();u();var PT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Ze(e,r),o=Je(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{action:"preview",itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Dr(t)}}});d();c();l();u();function kT(e,t,r,n,o){if(!NB(e))throw ae;let{dispatch:a}=e,i=()=>e.state,p=ge(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=i().resultPreview;return x[h]},C=x=>{a(Cd({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Nc({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){C(f.uniqueId)},next(){a(vd()),C(g())},previous(){a(Ad()),C(g())},get state(){let x=i(),h=f.hasHtmlVersion,S=x.resultPreview,b=f.uniqueId===S.uniqueId?S.content:"",w=S.isLoading,I=S.contentURL,E=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:I,currentResultUniqueId:E}}}}function NB(e){return e.addReducers({configuration:be,resultPreview:Ei}),!0}function OT(e,t){if(!DB(e))throw ae;let r=()=>{e.dispatch(PT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return kT(e,o,(a,i)=>TT(a,i),n,r)}function DB(e){return e.addReducers({configuration:be,resultPreview:Ei,insightInterface:Kn}),!0}d();c();l();u();d();c();l();u();var _T=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(J(t.insightCaseContext))),NT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var qB={queries:new ne({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new oe({required:!0,min:1,default:10})},Cu=P("recentQueries/registerRecentQueries",e=>_(e,qB)),Zm=P("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function DT(){return{queries:[],maxLength:10}}var qT=de(DT(),e=>{e.addCase(Cu,MB).addCase(Zm,VB).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||jB(n,t)})});function MB(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 VB(e){e.queries=[]}function jB(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 LB={queries:[]},UB={maxLength:10,clearFilters:!0},QB=new Pe({queries:new ne({required:!0})}),BB=new Pe({maxLength:new oe({required:!0,min:1}),clearFilters:new pe});function GB(e,t){ht(e,BB,t?.options,"buildRecentQueriesList"),gr(e,QB,t?.initialState,"buildRecentQueriesList")}function MT(e,t){if(!$B(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state,a={...UB,...t?.options},i={...LB,...t?.initialState};GB(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(Cu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(Zm())},updateRecentQueries(f){let m=new ne({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Cu({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new oe({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};Pu(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Ri(g))}}}function $B(e){return e.addReducers({search:Ie,recentQueries:qT,query:Eo}),!0}function VT(e,t){let r=MT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(_T()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Ce({legacy:NT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var HB={results:new ne({required:!0,each:new Y({values:Ql})}),maxLength:new oe({required:!0,min:1,default:10})},Jm=P("recentResults/registerRecentResults",e=>_(e,HB)),Cn=P("recentResults/pushRecentResult",e=>(Ot(e),{payload:e})),eg=P("recentResults/clearRecentResults");d();c();l();u();var jT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logDocumentOpen(Ze(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Dr(t)}}});function LT(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(jT(t.options.result)))};return An(e,t,()=>{n(),e.dispatch(Cn(t.options.result))})}d();c();l();u();function UT(e,t){return Gm(e,{...t,fetchMoreResultsActionCreator:id})}d();c();l();u();d();c();l();u();var zB=new Pe({numberOfResults:new oe({min:0})});function QT(e,t={}){if(!WB(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state,i=gr(e,zB,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(pd(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(fd(p))},isSetTo(p){return p===this.state.numberOfResults}}}function WB(e){return e.addReducers({pagination:Is,configuration:be}),!0}function BT(e,t={}){let r=QT(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Ce({legacy:bv(),next:Es()}))}}}d();c();l();u();d();c();l();u();var xv=()=>ze("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),tg=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var rg=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var GT={id:z,query:Xe},Fs=P("querySet/register",e=>_(e,GT)),Na=P("querySet/update",e=>_(e,GT));d();c();l();u();var Ts=de(ed(),e=>{e.addCase(Fs,(t,r)=>KB(t,r.payload)).addCase(Na,(t,r)=>{let{id:n,query:o}=r.payload;wv(t,n,o)}).addCase(Ro,(t,r)=>{let{id:n,expression:o}=r.payload;wv(t,n,o)}).addCase(ke.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;$T(t,n)}).addCase(it,YB).addCase(rt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))wv(t,n,o)})});function YB(e,t){ee(t.payload.q)||$T(e,t.payload.q)}function $T(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var wv=(e,t,r)=>{t in e&&(e[t]=r)},KB=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var HT=e=>ze("analytics/querySuggest",(t,r)=>{let n=XB(r,e);return t.makeOmniboxAnalytics(n)}),zT=()=>({actionCause:"omniboxAnalytics"});function XB(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 WT(e,t){let r=t.id;r in e||(e[r]=ZB(t))}function YT(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function KT(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function XT(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function ZB(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var ZT=()=>({});var ng=de(ZT(),e=>e.addCase(wo,(t,r)=>{WT(t,r.payload)}).addCase(uT,(t,r)=>{delete t[r.payload.id]}).addCase(Cs.pending,YT).addCase(Cs.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(Cs.rejected,KT).addCase(Io,(t,r)=>{XT(t,r.payload)}).addCase(Fi,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var JT={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},Rv={open:new $,close:new $},JB={id:z,numberOfSuggestions:new oe({min:0}),enableQuerySyntax:new pe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:Rv}),exactMatchDelimiters:new Y({values:Rv}),correctionDelimiters:new Y({values:Rv})}}),clearFilters:new pe},eP=new Pe(JB);function tP(e,t){if(!t1(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||ku("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...JT,...t.options};ht(e,eP,i,"buildSearchBox"),n(Fs({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(wo({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(zt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:C}=i;n(Ri({q:p(),enableQuerySyntax:g,clearFilters:C})),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(Na({id:a,query:m})),this.showSuggestions()},clear(){n(Na({id:a,query:""})),n(Io({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Ro({id:a,expression:m})),f({legacy:HT({id:a,suggestion:m}),next:zT()}).then(()=>{n(Io({id:a}))})},submit(m=xv(),g){f({legacy:m,next:g}),n(Io({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],C=e1(g,i.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:C,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function e1(e,t){return e?e.completions.map(r=>({highlightedValue:Mg(r.highlighted,t),rawValue:r.expression})):[]}function t1(e){return e.addReducers({query:Eo,querySuggest:ng,configuration:be,querySet:Ts,search:Ie}),!0}function rP(e,t={}){let r=tP(e,{...t,executeSearchActionCreator:Ce,fetchQuerySuggestionsActionCreator:sd,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(rg(),tg())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var og=()=>({actionCause:"resultsSort"});function nP(e,t){return e.q!==t.q?tg():e.sortCriteria!==t.sortCriteria?og():Ps(e.f,t.f)?ks(e.f,t.f):Ps(e.fExcluded,t.fExcluded)?ks(e.fExcluded,t.fExcluded,!0):Ps(e.cf,t.cf)?ks(e.cf,t.cf):Ps(e.af,t.af)?ks(e.af,t.af):Ps(e.nf,t.nf)?ks(ag(e.nf),ag(t.nf)):Ps(e.df,t.df)?ks(ag(e.df),ag(t.df)):hi()}function Ps(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function ks(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():Vn()}if(o.filter(x=>!n.includes(x)).length)return r?Uf():pr();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return hi();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?Uf():pr():f.filter(x=>!m.includes(x)).length?Vn():hi()}function ag(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 Os=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...J(t.insightCaseContext)}));function iP(e,t){return e.q!==t.q?rg():e.sortCriteria!==t.sortCriteria?Os():bu(e.f,t.f)?bu(e.cf,t.cf)?bu(e.nf,t.nf)?bu(e.df,t.df)?bu(e.fExcluded,t.fExcluded)?Zn():r1(e.fExcluded,t.fExcluded):aP(e.df,t.df):aP(e.nf,t.nf):ig(e.cf,t.cf):ig(e.f,t.f)}function bu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function oP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function ig(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?Lt(x):(r?ps:Mr)({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 Zn();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 C=f.filter(x=>!m.includes(x));return C.length?(r?ps:Mr)({facetId:p,facetValue:C[0]}):Zn()}function aP(e={},t={}){return ig(oP(e),oP(t))}function r1(e={},t={}){return ig(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:n1,getOwnPropertySymbols:o1}=Object,{hasOwnProperty:a1}=Object.prototype;function Iv(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function sg(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 sP(e){return n1(e).concat(o1(e))}var i1=Object.hasOwn||((e,t)=>a1.call(e,t)),s1="__v",c1="__o",u1="_owner",{getOwnPropertyDescriptor:cP,keys:uP}=Object,Da=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function l1(e,t){return e===t}function d1(e,t){return e.byteLength===t.byteLength&&cg(new Uint8Array(e),new Uint8Array(t))}function p1(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 f1(e,t){return e.byteLength===t.byteLength&&cg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function m1(e,t){return Da(e.getTime(),t.getTime())}function g1(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function lP(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,C=0;for(;(p=m.next())&&!p.done;){if(o[C]){C++;continue}let x=i.value,h=p.value;if(r.equals(x[0],h[0],f,C,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[C]=!0;break}C++}if(!g)return!1;f++}return!0}function h1(e,t,r){let n=uP(e),o=n.length;if(uP(t).length!==o)return!1;for(;o-->0;)if(!pP(e,t,r,n[o]))return!1;return!0}function xu(e,t,r){let n=sP(e),o=n.length;if(sP(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!pP(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 y1(e,t){return Da(e.valueOf(),t.valueOf())}function S1(e,t){return e.source===t.source&&e.flags===t.flags}function dP(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 cg(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 v1(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 pP(e,t,r,n){return(n===u1||n===c1||n===s1)&&(e.$$typeof||t.$$typeof)?!0:i1(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var A1=Object.prototype.toString;function C1(e){let t=R1(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,S){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,S):b==="function"?o(x,h,S):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,S);if(w===Array)return r(x,h,S);if(w===Date)return n(x,h,S);if(w===RegExp)return f(x,h,S);if(w===Map)return a(x,h,S);if(w===Set)return m(x,h,S);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,S);let I=A1.call(x),E=t[I];if(E)return E(x,h,S);let F=g&&g(x,h,S,I);return F?F(x,h,S):!1}}function b1({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:d1,areArraysEqual:r?xu:p1,areDataViewsEqual:f1,areDatesEqual:m1,areErrorsEqual:g1,areFunctionsEqual:l1,areMapsEqual:r?Iv(lP,xu):lP,areNumbersEqual:Da,areObjectsEqual:r?xu:h1,arePrimitiveWrappersEqual:y1,areRegExpsEqual:S1,areSetsEqual:r?Iv(dP,xu):dP,areTypedArraysEqual:r?Iv(cg,xu):cg,areUrlsEqual:v1,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=sg(n.areArraysEqual),a=sg(n.areMapsEqual),i=sg(n.areObjectsEqual),p=sg(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:i,areSetsEqual:p})}return n}function x1(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function w1({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 R1({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:C,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]":(S,b,w)=>typeof S.then!="function"&&typeof b.then!="function"&&f(S,b,w),"[object RegExp]":g,"[object Set]":C,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var Ev=bn(),s6e=bn({strict:!0}),c6e=bn({circular:!0}),u6e=bn({circular:!0,strict:!0}),l6e=bn({createInternalComparator:()=>Da}),d6e=bn({strict:!0,createInternalComparator:()=>Da}),p6e=bn({circular:!0,createInternalComparator:()=>Da}),f6e=bn({circular:!0,createInternalComparator:()=>Da,strict:!0});function bn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=b1(e),i=C1(a),p=r?r(i):x1(i);return w1({circular:t,comparator:i,createState:n,equals:p,strict:o})}function fP(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function I1(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Fv(r,n))!==-1)}var Fv=bn({createCustomConfig:e=>({...e,areArraysEqual:I1})});d();c();l();u();d();c();l();u();function mP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function gP(e,t,r){if(e===void 0)return{};let n=t(e);return!Ev(n,r)?{sortCriteria:n}:{}}function ug(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 hP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function yP(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??Tn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??Tn().defaultFilters.cq,firstResult:Wr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Wr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:Zl(),sf:{},tab:"",af:{},mnf:{}}}var E1=new Pe({parameters:new Y({options:{required:!0},values:Kd})});function AP(e,t){let{dispatch:r}=e,n=ge(e);gr(e,E1,t.initialState,"buildSearchParameterManager");let o=SP(e.state.tabSet,t.initialState.parameters);return r(it(o)),{...n,synchronize(a){let i=SP(e.state.tabSet,lg(e,a));r(it(i))},get state(){return{parameters:Tv(e)}}}}function lg(e,t){return{...yP(e.state),...t}}function SP(e,t){if(ee(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:vP(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??vP(e)}}return t}function vP(e){return Object.keys(e)[0]??""}function Tv(e){let t=e.state;return{...mP(t.query,r=>r.q,ut().q),...hP(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]:""),...gP(t.sortCriteria,r=>r,ur()),...T1(t),...P1(t),...k1(t),...O1(t),..._1(t)}}function F1(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function dg(e){let t=F1(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=or(n?.tabs,t);return o&&a}}function CP(e){return e.currentValues.filter(t=>t.state==="selected")}function T1(e){let t=e.facetSet;if(t===void 0)return{};let r=dg(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 P1(e){return ug(e.categoryFacetSet,dg(e),t=>Gr(t.currentValues).map(r=>r.value),"cf")}function k1(e){return ug(e.numericFacetSet,dg(e),CP,"nf")}function O1(e){return ug(e.dateFacetSet,dg(e),CP,"df")}function _1(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=N1(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function N1(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function bP(e,t){let{dispatch:r}=e,n=AP(e,t);return{...n,synchronize(o){let a=Tv(e),i=lg(e,a),p=lg(e,o);Fv(i,p)||(n.synchronize(o),r(Ce({legacy:iP(i,p),next:nP(i,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var wu=()=>new Y({values:{questionAnswerId:z},options:{required:!0}}),pg=()=>new Y({values:{linkText:Xe,linkURL:Xe},options:{required:!0}});function qa(e){return _(e,wu())}d();c();l();u();function mt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Hx(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 xP={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var D1=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),q1=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),M1=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),V1=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),j1=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=mt(t);return e.logOpenSmartSnippetSource(Ze(r,t),Je(r),J(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=mt(e),r=Je(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}}}}),Pv=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,pg());let n=mt(r);return t.logOpenSmartSnippetInlineLink(Ze(n,r),{...Je(n),...e},J(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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}}}}),L1=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(J(t.insightCaseContext))),U1=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(J(t.insightCaseContext))),Q1=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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:xP[e]}}}),B1=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=Je(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}}}),G1=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(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}}}}}),$1=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(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}}}}}),kv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,wu());let n=Rr(r,e.questionAnswerId);if(!n)return null;let o=mt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Ze(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),wP=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,wu()),_(t,pg());let o=Rr(n,e.questionAnswerId);if(!o)return null;let a=mt(n,o.documentId);return a?r.logOpenSmartSnippetSuggestionInlineLink(Ze(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},J(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Rr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=mt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),fg={logExpandSmartSnippet:D1,logCollapseSmartSnippet:q1,logLikeSmartSnippet:M1,logDislikeSmartSnippet:V1,logOpenSmartSnippetSource:j1,logOpenSmartSnippetInlineLink:Pv,logOpenSmartSnippetFeedbackModal:L1,logCloseSmartSnippetFeedbackModal:U1,logSmartSnippetFeedback:Q1,logSmartSnippetDetailedFeedback:B1,logExpandSmartSnippetSuggestion:G1,logCollapseSmartSnippetSuggestion:$1,logOpenSmartSnippetSuggestionSource:kv};d();c();l();u();d();c();l();u();var _s=P("smartSnippet/expand"),Ns=P("smartSnippet/collapse"),Ds=P("smartSnippet/like"),qs=P("smartSnippet/dislike"),Ms=P("smartSnippet/feedbackModal/open"),Po=P("smartSnippet/feedbackModal/close"),Vs=P("smartSnippet/related/expand",e=>qa(e)),js=P("smartSnippet/related/collapse",e=>qa(e));d();c();l();u();d();c();l();u();var Ov=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var RP=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function IP({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Ga({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function H1(e,t){let r=IP(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var xn=de(Ov(),e=>e.addCase(_s,t=>{t.expanded=!0}).addCase(Ns,t=>{t.expanded=!1}).addCase(Ds,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(qs,t=>{t.liked=!1,t.disliked=!0}).addCase(Ms,t=>{t.feedbackModalOpen=!0}).addCase(Po,t=>{t.feedbackModalOpen=!1}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>H1(a,t.relatedQuestions[i])),o=IP(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...Ov(),relatedQuestions:n,questionAnswerId:o}}).addCase(Vs,(t,r)=>{let n=RP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(js,(t,r)=>{let n=RP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function EP(e,t,r){if(!z1(e))throw ae;let n=ge(e),o=()=>e.state,a=()=>mt(o()),i=null,p=An(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(Cn(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(_s())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ns())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Ds())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(qs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Ms())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Po())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(Po())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(Po())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function z1(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function mg(e,t){if(!W1(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,C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(C)||e.dispatch(x?wP({questionAnswerId:x},g):Pv(g))}),f={},m=(g,C)=>{let{searchResponseId:x}=r().search;i(x);let h=Ga({...g,questionAnswerId:C});return h in f||(f[h]=p(g,h,C)),f[h]};return{selectInlineLink(g,C){m(g,C)?.select()},beginDelayedSelectInlineLink(g,C){m(g,C)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,C){m(g,C)?.cancelPendingSelect()}}}function W1(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function FP(e,t){let r=EP(e,fg,t),n=mg(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 TP(e,t){if(!Y1(e))throw ae;let r=ge(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>io(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(Vs(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(js(i))}}}function Y1(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function PP(e,t){if(!K1(e))throw ae;let r=()=>e.state,n=C=>{let x=r(),h=Rr(x,C);return h?mt(x,h.documentId):null},o=new Set,a=C=>o.has(C)?!0:(o.add(C),!1),i=null,p=C=>{i!==C&&(i=C,m={},o.clear())},f=(C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(x)||(e.dispatch(kv({questionAnswerId:x})),e.dispatch(Cn(C)))}),m={},g=C=>{let{searchResponseId:x}=r().search;p(x);let h=n(C);return h?(C in m||(m[C]=f(h,C)),m[C]):null};return{selectSource(C){g(C)?.select()},beginDelayedSelectSource(C){g(C)?.beginDelayedSelect()},cancelPendingSelectSource(C){g(C)?.cancelPendingSelect()}}}function K1(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function kP(e,t){let r=TP(e,fg),n=mg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=PP(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 OP={by:new zs({enum:ql,required:!0})},gg=P("sortCriteria/register",e=>_P(e)),hg=P("sortCriteria/update",e=>_P(e)),_P=e=>Ba(e)?(e.forEach(t=>_(t,OP)),{payload:e}):_(e,OP);d();c();l();u();var NP=de(ur(),e=>{e.addCase(gg,(t,r)=>$r(r.payload)).addCase(hg,(t,r)=>$r(r.payload)).addCase(rt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(it,(t,r)=>r.payload.sortCriteria??t)});function X1(e,t){if(!t)return;let r=new Pe({criterion:new ne({each:Ub})}),n=Z1(t),o={...t,criterion:n};gr(e,r,o,"buildSort")}function Z1(e){return e.criterion?Ba(e.criterion)?e.criterion:[e.criterion]:[]}function DP(e,t){if(!J1(e))throw ae;let r=ge(e),{dispatch:n}=e,o=()=>e.state;X1(e,t.initialState);let a=t.initialState?.criterion;return a&&n(gg(a)),{...r,sortBy(i){n(hg(i)),n(Jn(1))},isSortedBy(i){return this.state.sortCriteria===$r(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function J1(e){return e.addReducers({configuration:be,sortCriteria:NP}),!0}function qP(e,t={}){let{dispatch:r}=e,n=DP(e,t),o=()=>r(Ce({legacy:Os(),next:og()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();function MP(e){return xs(e)}d();c();l();u();d();c();l();u();var eG=new Pe({expression:Xe,id:z,clearFiltersOnTabChange:new pe}),tG=new Pe({isActive:new pe});function VP(e,t){if(nG(t.options.id),!rG(e))throw ae;let r=ge(e),{dispatch:n}=e;ht(e,eG,t.options,"buildTab");let o=gr(e,tG,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Zd({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(Ri({q:"",clearFilters:!0})),n(_t(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function rG(e){return e.addReducers({configuration:be,tabSet:mm}),!0}function nG(e){let t=ep().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=VP(e,t),o=()=>r(Ce({legacy:Zn(),next:hi()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var LP=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},J(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function UP(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function QP(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 BP(e,t){return e.queryModification={...t,queryToIgnore:""},e}function GP(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var $P=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var HP=de($P(),e=>e.addCase(ke.pending,UP).addCase(ke.fulfilled,(t,r)=>QP(t,r.payload.response.triggers)).addCase(wi,(t,r)=>BP(t,r.payload)).addCase(xi,(t,r)=>GP(t,r.payload)));function zP(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!oG(e))throw ae;let n=ge(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!fP(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 oG(e){return e.addReducers({triggers:HP}),!0}function WP(e){return zP(e,{options:{logNotifyTriggerActionCreator:LP}})}d();c();l();u();d();c();l();u();var YP=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=J(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=J(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),KP=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:z}),t.logCreateArticle(e,J(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=J(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),yg=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(J(t.insightCaseContext))});d();c();l();u();d();c();l();u();var XP=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ke(e.configuration.organizationId,e.configuration.environment),userId:t}});return function XP(_x238,_x239){return _ref100.apply(this,arguments)}}();var aG={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new ne({required:!1,each:We})},Ls=P("insight/userActions/registerUserActions",e=>_(e,aG)),ko=fe("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 XP(o,e));return He(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 ZP(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var iG=1e3,sG=iG*60,_v=30*sG,cG=2,uG=2,tk=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,a=dG(t);return fG(a,n,o)},lG=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}},dG=e=>{let t=!1,r=e.reduce((n,o)=>{try{let a=lG(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},pG=(e,t)=>Math.abs(e.timestamp-t)<_v,JP=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-_v&&t<=e.end+_v){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)},ek=(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},fG=(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(pG(a,o.start)){o.actions.push(a),o.start=a.timestamp;return}o.actions=o.actions.filter(i=>!ek(i,r)),JP(o,t,n),o={start:a.timestamp,end:a.timestamp,actions:[a]}}),o.actions=o.actions.filter(a=>!ek(a,r)),JP(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,cG),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-uG)}};var Sg=de(ZP(),e=>{e.addCase(Ls,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(ko.pending,t=>{t.loading=!0,t.error=void 0}).addCase(ko.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(ko.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=tk(t,r.payload.response.value)})});function rk(e,t){if(!mG(e))throw ae;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=ge(e),{ticketCreationDate:a,excludedCustomActions:i}=t.options;return r(Ls({ticketCreationDate:a,excludedCustomActions:i})),{...o,get state(){return n()},fetchUserActions(p){r(ko(p))},logOpenUserActions(){r(yg())}}}function mG(e){return e.addReducers({configuration:be,insightUserActions:Sg}),!0}d();c();l();u();function nk(e){if(!gG(e))throw ae;let t=ge(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(Hr())}}}function gG(e){return e.addReducers({configuration:be,insightConfiguration:zl,insightInterface:Kn,searchHub:xd}),!0}d();c();l();u();function hG(e){return e.addReducers({}),{logSearchEvent:ex,logClickEvent:tx,logCustomEvent:rx}}d();c();l();u();d();c();l();u();var ok=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCopyToClipboard(Ze(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Dr(t)}}}),ak=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCaseSendEmail(Ze(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Dr(t)}}}),ik=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logFeedItemTextPost(Ze(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ze(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Dr(t)}}});function yG(e){return e.addReducers({}),{logClearBreadcrumbs:Hf,logInterfaceLoad:rd,logInterfaceChange:Zn,logCreateArticle:KP,logCategoryFacetBreadcrumb:Of,logFacetBreadcrumb:du,logFacetClearAll:Lt,logFacetDeselect:Mr,logFacetSelect:Yt,logFacetShowLess:ms,logFacetShowMore:fs,logFacetUpdateSort:dn,logDateFacetBreadcrumb:pu,logNumericFacetBreadcrumb:fu,logPageNext:Km,logPageNumber:Ym,logPagePrevious:Xm,logResultsSort:Os,logStaticFilterDeselect:lm,logCopyToClipboard:ok,logCaseSendEmail:ak,logFeedItemTextPost:ik,logOpenUserActions:yg}}d();c();l();u();function SG(e){return e.addReducers({attachedResults:So}),{setAttachedResults:Tf,detachResult:yo,attachResult:ho}}d();c();l();u();function vG(e){return e.addReducers({attachedResults:So}),{logCaseDetach:ns,logCaseAttach:rs}}d();c();l();u();d();c();l();u();d();c();l();u();var vg=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 ne({each:Xe}),a=_(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Ag=P("insight/caseId/set",e=>{let r=_(e,Xe).error;return r?{payload:e,error:r}:{payload:e}}),Cg=P("insight/caseNumber/set",e=>{let r=_(e,Xe).error;return r?{payload:e,error:r}:{payload:e}});var sk=de(vx(),e=>{e.addCase(vg,(t,r)=>{t.caseContext=r.payload}).addCase(Ag,(t,r)=>{t.caseId=r.payload}).addCase(Cg,(t,r)=>{t.caseNumber=r.payload})});function AG(e){return e.addReducers({insightCaseContext:sk}),{setCaseContext:vg,setCaseId:Ag,setCaseNumber:Cg}}d();c();l();u();d();c();l();u();d();c();l();u();var CG=new ne({each:z,required:!0}),ck=(e,t)=>(_(e,z),Qa(t)?_(t,z):_(t,CG),{payload:{contextKey:e,contextValue:t}}),bg=P("context/set",e=>{for(let[t,r]of Object.entries(e))ck(t,r);return{payload:e}}),xg=P("context/add",e=>ck(e.contextKey,e.contextValue)),wg=P("context/remove",e=>_(e,z));var uk=de(Xl(),e=>{e.addCase(bg,(t,r)=>{t.contextValues=r.payload}).addCase(xg,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(wg,(t,r)=>{delete t.contextValues[r.payload]}).addCase(rt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function bG(e){return e.addReducers({context:uk}),{addContext:xg,removeContext:wg,setContext:bg}}d();c();l();u();function xG(e){return e.addReducers({dateFacetSet:hn}),{deselectAllDateFacetValues:Yf,registerDateFacet:pn,toggleSelectDateFacetValue:fn,toggleExcludeDateFacetValue:mn,updateDateFacetSortCriterion:Wf,updateDateFacetValues:Ln}}d();c();l();u();function wG(e){return e.addReducers({numericFacetSet:bo}),{deselectAllNumericFacetValues:cm,registerNumericFacet:yn,toggleSelectNumericFacetValue:Sn,toggleExcludeNumericFacetValue:vn,updateNumericFacetSortCriterion:sm,updateNumericFacetValues:Un}}d();c();l();u();function RG(e){return e.addReducers({fields:bs}),{registerFieldsToInclude:Fo,enableFetchAllFields:Um,disableFetchAllFields:Qm,fetchFieldsDescription:Bm}}d();c();l();u();function IG(e){return e.addReducers({folding:Lm}),{registerFolding:aT,loadCollection:Mm}}d();c();l();u();function EG(e){return e.addReducers({generatedAnswer:ws}),{generateAnswer:zd,resetAnswer:lr,setAnswerGenerationMode:Dd}}d();c();l();u();function FG(e){return e.addReducers({insightInterface:Kn}),{fetch:Hr}}d();c();l();u();function TG(e){return e.addReducers({querySet:Ts}),{registerQuerySetQuery:Fs,updateQuerySetQuery:Na}}d();c();l();u();function PG(e){return e.addReducers({search:Ie}),{executeSearch:wx,fetchFacetValues:Ex,fetchMoreResults:Ix,fetchPage:Rx,fetchQuerySuggestions:sd,registerQuerySuggest:wo}}d();c();l();u();function kG(e){return e.addReducers({}),{logContextChanged:Ax,logExpandToFullUI:YP}}d();c();l();u();function OG(e){return e.addReducers({insightUserActions:Sg}),{registerUserActions:Ls,fetchUserActions:ko}}d();c();l();u();function _G(e){return e.addReducers({querySuggest:ng,querySet:Ts}),{clearQuerySuggest:Io,fetchQuerySuggestions:Cs,registerQuerySuggest:wo,selectQuerySuggestion:Ro}}d();c();l();u();function NG(e){return e.addReducers({questionAnswering:xn}),{collapseSmartSnippet:Ns,expandSmartSnippet:_s,dislikeSmartSnippet:qs,likeSmartSnippet:Ds,openFeedbackModal:Ms,closeFeedbackModal:Po,expandSmartSnippetRelatedQuestion:Vs,collapseSmartSnippetRelatedQuestion:js}}d();c();l();u();d();c();l();u();d();c();l();u();function lk(){return{results:[],maxLength:10}}var dk=de(lk(),e=>{e.addCase(Jm,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(eg,t=>{t.results=[]}).addCase(Cn,(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 DG(e){return e.addReducers({recentResults:dk}),{registerRecentResults:Jm,clearRecentResults:eg,pushRecentResult:Cn}}d();c();l();u();d();c();l();u();var qG=new Pe({content:new $e({required:!0}),conditions:new $e({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ne({required:!1,each:z})});function pk(){let e=[],t=r=>{let n=qG.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Oo("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 fk(e){if(!MG(e))throw ae;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=pk();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(Fo(a))},selectTemplate:r,selectLinkTemplate:n}}function MG(e){return e.addReducers({fields:bs}),!0}/**
46
47
  * @license
47
48
  *
48
49
  * Copyright 2026 Coveo Solutions Inc.
@@ -75,4 +76,4 @@ fast-json-patch/module/duplex.mjs:
75
76
  *)
76
77
  */if(__exports!=exports)module.exports=exports;return module.exports});
77
78
 
78
- window.coveoQuanticVersion = '3.37.5';
79
+ window.coveoQuanticVersion = '3.37.7';