@coveo/quantic 3.36.8 → 3.36.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +14 -14
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +1 -1
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +35 -36
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/breadcrumb-manager/headless-breadcrumb-manager.d.ts +1 -1
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/sort/headless-core-commerce-sort.d.ts +2 -2
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/url-manager/headless-core-url-manager.d.ts +1 -1
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +1 -1
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/did-you-mean/headless-did-you-mean.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search-box/headless-search-box.d.ts +1 -1
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/context/headless-context.d.ts +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/category-facet/headless-core-category-facet.d.ts +1 -1
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-core-numeric-facet.d.ts +1 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/search-box/headless-core-search-box.d.ts +1 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/did-you-mean/headless-did-you-mean.d.ts +1 -1
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facet-manager/headless-facet-manager.d.ts +1 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/category-facet/headless-category-facet.d.ts +1 -1
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/facet/headless-facet.d.ts +1 -1
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/date-facet/headless-date-facet.d.ts +1 -1
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/date-facet/headless-date-filter.d.ts +1 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/numeric-facet/headless-numeric-facet.d.ts +1 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/numeric-facet/headless-numeric-filter.d.ts +1 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/folded-result-list/headless-folded-result-list.d.ts +1 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/headless-generated-answer.d.ts +1 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/headless-interactive-citation.d.ts +1 -1
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/breadcrumb-manager/headless-insight-breadcrumb-manager.d.ts +1 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/did-you-mean/headless-insight-did-you-mean.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facet-conditions-manager/headless-facet-conditions-manager.d.ts +1 -1
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facet-manager/headless-insight-facet-manager.d.ts +1 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/category-facet/headless-insight-category-facet.d.ts +1 -1
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/facet/headless-insight-facet-options.d.ts +1 -1
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/facet/headless-insight-facet.d.ts +1 -1
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/date-facet/headless-insight-date-facet.d.ts +1 -1
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/date-facet/headless-insight-date-filter.d.ts +1 -1
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/numeric-facet/headless-insight-numeric-facet.d.ts +1 -1
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/numeric-facet/headless-insight-numeric-filter.d.ts +1 -1
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/folded-result-list/headless-insight-folded-result-list.d.ts +1 -1
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/generated-answer/headless-insight-generated-answer.d.ts +1 -1
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/generated-answer/headless-insight-interactive-citation.d.ts +1 -1
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/pager/headless-insight-pager.d.ts +1 -1
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/recent-queries-list/headless-insight-recent-queries-list.d.ts +1 -1
  42. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/result-list/headless-insight-interactive-result.d.ts +1 -1
  43. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/result-list/headless-insight-result-list.d.ts +1 -1
  44. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/results-per-page/headless-insight-results-per-page.d.ts +1 -1
  45. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/search-box/headless-insight-search-box.d.ts +1 -1
  46. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/search-parameter-manager/headless-insight-search-parameter-manager.d.ts +1 -1
  47. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/sort/headless-insight-sort.d.ts +1 -1
  48. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/tab/headless-insight-tab.d.ts +1 -1
  49. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/pager/headless-pager.d.ts +1 -1
  50. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/quickview/headless-quickview.d.ts +1 -1
  51. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +1 -1
  52. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recommendation/result-list/headless-recommendation-interactive-result.d.ts +1 -1
  53. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/relevance-inspector/headless-relevance-inspector.d.ts +1 -1
  54. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/result-list/headless-result-list.d.ts +1 -1
  55. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/results-per-page/headless-results-per-page.d.ts +1 -1
  56. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-box/headless-search-box.d.ts +1 -1
  57. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-parameter-manager/headless-search-parameter-manager.d.ts +1 -1
  58. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-status/headless-search-status.d.ts +1 -1
  59. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/smart-snippet/headless-smart-snippet.d.ts +1 -1
  60. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/sort/headless-sort.d.ts +1 -1
  61. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/standalone-search-box/headless-standalone-search-box.d.ts +1 -1
  62. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/static-filter/headless-static-filter.d.ts +1 -1
  63. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/tab/headless-tab.d.ts +1 -1
  64. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/generic-analytics-actions-loader.d.ts +1 -1
  65. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/insight-analytics-actions-loader.d.ts +1 -1
  66. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-analytics-actions-loader.d.ts +1 -1
  67. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/date-facet/date-facet-actions-loader.d.ts +1 -1
  68. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/numeric-facet-actions-loader.d.ts +1 -1
  69. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-actions-loader.d.ts +1 -1
  70. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions-loader.d.ts +1 -1
  71. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions-loader.d.ts +1 -1
  72. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions-loader.d.ts +1 -1
  73. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort.d.ts +1 -1
  74. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-actions-loader.d.ts +1 -1
  75. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-actions-loader.d.ts +1 -1
  76. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-actions-loader.d.ts +1 -1
  77. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions-loader.d.ts +1 -1
  78. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions-loader.d.ts +1 -1
  79. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
  80. package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answers-actions.d.ts +10 -6
  81. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +10 -6
  82. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-state.d.ts +7 -0
  83. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/sse-generated-answer-errors.d.ts +22 -1
  84. package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-actions-loader.d.ts +1 -1
  85. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-parameters/search-parameter-actions.d.ts +0 -1
  86. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions-loader.d.ts +1 -1
  87. package/force-app/main/default/staticresources/coveoheadless/definitions/index.d.ts +25 -25
  88. package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +5 -5
  89. package/force-app/main/default/staticresources/coveoheadless/definitions/recommendation.index.d.ts +1 -1
  90. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +1 -1
  91. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +1 -1
  92. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/instant-products/headless-instant-products.ssr.d.ts +1 -1
  93. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +1 -1
  94. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +1 -1
  95. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +1 -1
  96. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-list/headless-product-list.ssr.d.ts +1 -1
  97. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/recent-queries-list/headless-recent-queries-list.ssr.d.ts +1 -1
  98. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/search-box/headless-search-box.ssr.d.ts +1 -1
  99. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/standalone-search-box/headless-standalone-search-box.ssr.d.ts +1 -1
  100. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/summary/headless-core-summary.ssr.d.ts +1 -1
  101. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-definitions.d.ts +1 -1
  102. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/engine.d.ts +1 -1
  103. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +1 -1
  104. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +1 -1
  105. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/instant-products/headless-instant-products.ssr.d.ts +1 -1
  106. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +1 -1
  107. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +1 -1
  108. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +1 -1
  109. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-list/headless-product-list.ssr.d.ts +1 -1
  110. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/recent-queries-list/headless-recent-queries-list.ssr.d.ts +1 -1
  111. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/search-box/headless-search-box.ssr.d.ts +1 -1
  112. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/standalone-search-box/headless-standalone-search-box.ssr.d.ts +1 -1
  113. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/summary/headless-core-summary.ssr.d.ts +1 -1
  114. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-inference.d.ts +1 -1
  115. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +1 -1
  116. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/controller-definition.d.ts +1 -1
  117. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/query-expression/query-expression.d.ts +1 -1
  118. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  119. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  120. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +13 -13
  121. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  122. package/package.json +18 -19
@@ -14,35 +14,35 @@ 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 MT=Object.create;var qs=Object.defineProperty;var jT=Object.getOwnPropertyDescriptor;var VT=Object.getOwnPropertyNames;var LT=Object.getPrototypeOf,UT=Object.prototype.hasOwnProperty;var QT=(e,t,r)=>t in e?qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ds=(e,t)=>()=>(e&&(t=e(e=0)),t);var bt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ms=(e,t)=>{for(var r in t)qs(e,r,{get:t[r],enumerable:!0})},OS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of VT(t))!UT.call(e,o)&&o!==r&&qs(e,o,{get:()=>t[o],enumerable:!(n=jT(t,o))||n.enumerable});return e};var Cr=(e,t,r)=>(r=e!=null?MT(LT(e)):{},OS(t||!e||!e.__esModule?qs(r,"default",{value:e,enumerable:!0}):r,e)),BT=e=>OS(qs({},"__esModule",{value:!0}),e);var qe=(e,t,r)=>QT(e,typeof t!="symbol"?t+"":t,r);var y,c=Ds(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function su(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?su=function(t){return typeof t}:su=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function HT(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=zT.bind(this))}function zT(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","*/*"),GT(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):$T(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var GT,$T,u=Ds(()=>{"use strict";GT=function(t){return typeof t=="string"},$T=function(t){return t instanceof Blob};HT.call((typeof window>"u"?"undefined":su(window))==="object"?window:{})});var Mm=bt(js=>{"use strict";d();c();l();u();Object.defineProperty(js,"__esModule",{value:!0});function _S(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 WT(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function YT(e,t,r){return t=Ei(t),JT(e,MS()?Reflect.construct(t,r||[],Ei(e).constructor):t.apply(e,r))}function Nm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NS(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,tP(n.key),n)}}function qm(e,t,r){return t&&NS(e.prototype,t),r&&NS(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qS(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=rP(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 Om(){return Om=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=XT(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Om.apply(null,arguments)}function Ei(e){return Ei=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ei(e)}function KT(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&&_m(e,t)}function MS(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MS=function(){return!!e})()}function JT(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 WT(e)}function _m(e,t){return _m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_m(e,t)}function XT(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ei(e))!==null;);return e}function ZT(e,t,r,n){var o=Om(Ei(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function eP(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 tP(e){var t=eP(e,"string");return typeof t=="symbol"?t:t+""}function rP(e,t){if(e){if(typeof e=="string")return _S(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)?_S(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function nP(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 oP(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 DS=function(){function e(){Nm(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return qm(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(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},p=0,f=i.length;p<f;p++)a();return!r.defaultPrevented}}}])}(),Dm=function(e){function t(){var r;return Nm(this,t),r=YT(this,t),r.listeners||DS.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 KT(t,e),qm(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)),ZT(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 cu;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 cu;function i(){o.abort(this.reason),a()}function a(){var h=qS(n),v;try{for(h.s();!(v=h.n()).done;){var C=v.value;C.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var p=qS(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}}])}(DS),cu=function(){function e(){Nm(this,e),Object.defineProperty(this,"signal",{value:new Dm,writable:!0,configurable:!0})}return qm(e,[{key:"abort",value:function(r){var n=oP(r),o=nP(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(cu.prototype[Symbol.toStringTag]="AbortController",Dm.prototype[Symbol.toStringTag]="AbortSignal");function iP(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 aP(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(!iP({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(C,g){var S;g&&g.signal&&(S=g.signal,delete g.signal);var x=new o(C,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(C,g){var S=f&&f.prototype.isPrototypeOf(C)?C.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,I){S.addEventListener("abort",function(){return I(x)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([w,m(C,g)])}return m(C,g)};return{fetch:h,Request:f}}js.AbortController=cu;js.AbortSignal=Dm;js.abortableFetch=aP});var jS,s,A,l=Ds(()=>{"use strict";jS=Cr(Mm(),1),s=Cr(Mm(),1),{fetch:A}=(0,jS.abortableFetch)({fetch})});function Vs(e){if(hP.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function jm(e){return e.replace(yP,"")}function Ls(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||!SP(r))return!1}return!0}function SP(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function LS(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 sP,$S,cP,HS,uP,lP,dP,pP,fP,mP,gP,hP,VS,yP,Fi,Vm,US,QS,BS,GS,b,WS=Ds(()=>{"use strict";d();c();l();u();sP=Object.create,$S=Object.defineProperty,cP=Object.getOwnPropertyDescriptor,HS=Object.getOwnPropertyNames,uP=Object.getPrototypeOf,lP=Object.prototype.hasOwnProperty,dP=(e,t)=>function(){return t||(0,e[HS(e)[0]])((t={exports:{}}).exports,t),t.exports},pP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of HS(t))!lP.call(e,o)&&o!==r&&$S(e,o,{get:()=>t[o],enumerable:!(n=cP(t,o))||n.enumerable});return e},fP=(e,t,r)=>(r=e!=null?sP(uP(e)):{},pP(t||!e||!e.__esModule?$S(r,"default",{value:e,enumerable:!0}):r,e)),mP=dP({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){"use strict";var r={decodeValues:!0,map:!1,silent:!1};function n(f){return typeof f=="string"&&!!f.trim()}function o(f,m){var h=f.split(";").filter(n),v=h.shift(),C=i(v),g=C.name,S=C.value;m=m?Object.assign({},r,m):r;try{S=m.decodeValues?decodeURIComponent(S):S}catch(w){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+S+"'. Set options.decodeValues to false to disable this feature.",w)}var x={name:g,value:S};return h.forEach(function(w){var R=w.split("="),I=R.shift().trimLeft().toLowerCase(),E=R.join("=");I==="expires"?x.expires=new Date(E):I==="max-age"?x.maxAge=parseInt(E,10):I==="secure"?x.secure=!0:I==="httponly"?x.httpOnly=!0:I==="samesite"?x.sameSite=E:x[I]=E}),x}function i(f){var m="",h="",v=f.split("=");return v.length>1?(m=v.shift(),h=v.join("=")):h=f,{name:m,value:h}}function a(f,m){if(m=m?Object.assign({},r,m):r,!f)return m.map?{}:[];if(f.headers)if(typeof f.headers.getSetCookie=="function")f=f.headers.getSetCookie();else if(f.headers["set-cookie"])f=f.headers["set-cookie"];else{var h=f.headers[Object.keys(f.headers).find(function(C){return C.toLowerCase()==="set-cookie"})];!h&&f.headers.cookie&&!m.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."),f=h}if(Array.isArray(f)||(f=[f]),m=m?Object.assign({},r,m):r,m.map){var v={};return f.filter(n).reduce(function(C,g){var S=o(g,m);return C[S.name]=S,C},v)}else return f.filter(n).map(function(C){return o(C,m)})}function p(f){if(Array.isArray(f))return f;if(typeof f!="string")return[];var m=[],h=0,v,C,g,S,x;function w(){for(;h<f.length&&/\s/.test(f.charAt(h));)h+=1;return h<f.length}function R(){return C=f.charAt(h),C!=="="&&C!==";"&&C!==","}for(;h<f.length;){for(v=h,x=!1;w();)if(C=f.charAt(h),C===","){for(g=h,h+=1,w(),S=h;h<f.length&&R();)h+=1;h<f.length&&f.charAt(h)==="="?(x=!0,h=S,m.push(f.substring(v,g)),v=h):h=g+1}else h+=1;(!x||h>=f.length)&&m.push(f.substring(v,f.length))}return m}t.exports=a,t.exports.parse=a,t.exports.parseString=o,t.exports.splitCookiesString=p}}),gP=fP(mP()),hP=/[^a-z0-9\-#$%&'*+.^_`|~]/i;VS=[`
19
- `,"\r","\t"," "],yP=new RegExp(`(^[${VS.join("")}]|$[${VS.join("")}])`,"g");Fi=Symbol("normalizedHeaders"),Vm=Symbol("rawHeaderNames"),US=", ",b=class zS{constructor(t){this[QS]={},this[BS]=new Map,this[GS]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor.name)||t instanceof zS||typeof y.Headers<"u"&&t instanceof y.Headers?t.forEach((n,o)=>{this.append(o,n)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(US):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(US):n)})}[(QS=Fi,BS=Vm,GS=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[Fi]).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(!Ls(t))throw new TypeError(`Invalid header name "${t}"`);return this[Fi].hasOwnProperty(Vs(t))}get(t){if(!Ls(t))throw TypeError(`Invalid header name "${t}"`);return this[Fi][Vs(t)]??null}set(t,r){if(!Ls(t)||!LS(r))return;let n=Vs(t),o=jm(r);this[Fi][n]=jm(o),this[Vm].set(n,t)}append(t,r){if(!Ls(t)||!LS(r))return;let n=Vs(t),o=jm(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Ls(t)||!this.has(t))return;let r=Vs(t);delete this[Fi][r],this[Vm].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===""?[""]:(0,gP.splitCookiesString)(t)}}});var d=Ds(()=>{"use strict";WS()});var cv=bt(Gs=>{"use strict";d();c();l();u();var Su=Gs&&Gs.__assign||function(){return Su=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},Su.apply(this,arguments)};Object.defineProperty(Gs,"__esModule",{value:!0});var NP={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function qP(e){var t=Su(Su({},NP),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Gs.getSanitizedOptions=qP});var uv=bt(zm=>{"use strict";d();c();l();u();Object.defineProperty(zm,"__esModule",{value:!0});function DP(e){var t=Math.random()*e;return Math.round(t)}zm.fullJitter=DP});var lv=bt(Wm=>{"use strict";d();c();l();u();Object.defineProperty(Wm,"__esModule",{value:!0});function MP(e){return e}Wm.noJitter=MP});var dv=bt(Ym=>{"use strict";d();c();l();u();Object.defineProperty(Ym,"__esModule",{value:!0});var jP=uv(),VP=lv();function LP(e){switch(e.jitter){case"full":return jP.fullJitter;case"none":default:return VP.noJitter}}Ym.JitterFactory=LP});var Jm=bt(Km=>{"use strict";d();c();l();u();Object.defineProperty(Km,"__esModule",{value:!0});var UP=dv(),QP=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=UP.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}();Km.Delay=QP});var pv=bt(hn=>{"use strict";d();c();l();u();var BP=hn&&hn.__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)}}(),GP=hn&&hn.__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(v){a(v)}}function f(h){try{m(n.throw(h))}catch(v){a(v)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},$P=hn&&hn.__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(hn,"__esModule",{value:!0});var HP=Jm(),zP=function(e){BP(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return GP(this,void 0,void 0,function(){return $P(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}(HP.Delay);hn.SkipFirstDelay=zP});var fv=bt($s=>{"use strict";d();c();l();u();var WP=$s&&$s.__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($s,"__esModule",{value:!0});var YP=Jm(),KP=function(e){WP(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(YP.Delay);$s.AlwaysDelay=KP});var mv=bt(Xm=>{"use strict";d();c();l();u();Object.defineProperty(Xm,"__esModule",{value:!0});var JP=pv(),XP=fv();function ZP(e,t){var r=ek(e);return r.setAttemptNumber(t),r}Xm.DelayFactory=ZP;function ek(e){return e.delayFirstAttempt?new XP.AlwaysDelay(e):new JP.SkipFirstDelay(e)}});var gv=bt(Ro=>{"use strict";d();c();l();u();var Zm=Ro&&Ro.__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(v){a(v)}}function f(h){try{m(n.throw(h))}catch(v){a(v)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},eg=Ro&&Ro.__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(Ro,"__esModule",{value:!0});var tk=cv(),rk=mv();function nk(e,t){return t===void 0&&(t={}),Zm(this,void 0,void 0,function(){var r,n;return eg(this,function(o){switch(o.label){case 0:return r=tk.getSanitizedOptions(t),n=new ok(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Ro.backOff=nk;var ok=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Zm(this,void 0,void 0,function(){var t,r;return eg(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 Zm(this,void 0,void 0,function(){var t;return eg(this,function(r){switch(r.label){case 0:return t=rk.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var hl=bt((gh,hh)=>{"use strict";d();c();l();u();(function(e,t){typeof gh=="object"&&typeof hh<"u"?hh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(gh,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",v="year",C="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(H){var B=["th","st","nd","rd"],Q=H%100;return"["+H+(B[(Q-20)%10]||B[Q]||B[0])+"]"}},R=function(H,B,Q){var z=String(H);return!z||z.length>=B?H:""+Array(B+1-z.length).join(Q)+H},I={s:R,z:function(H){var B=-H.utcOffset(),Q=Math.abs(B),z=Math.floor(Q/60),$=Q%60;return(B<=0?"+":"-")+R(z,2,"0")+":"+R($,2,"0")},m:function H(B,Q){if(B.date()<Q.date())return-H(Q,B);var z=12*(Q.year()-B.year())+(Q.month()-B.month()),$=B.clone().add(z,m),X=Q-$<0,ee=B.clone().add(z+(X?-1:1),m);return+(-(z+(Q-$)/(X?$-ee:ee-$))||0)},a:function(H){return H<0?Math.ceil(H)||0:Math.floor(H)},p:function(H){return{M:m,y:v,w:f,d:p,D:C,h:a,m:i,s:o,ms:n,Q:h}[H]||String(H||"").toLowerCase().replace(/s$/,"")},u:function(H){return H===void 0}},E="en",P={};P[E]=w;var V="$isDayjsObject",q=function(H){return H instanceof U||!(!H||!H[V])},O=function H(B,Q,z){var $;if(!B)return E;if(typeof B=="string"){var X=B.toLowerCase();P[X]&&($=X),Q&&(P[X]=Q,$=X);var ee=B.split("-");if(!$&&ee.length>1)return H(ee[0])}else{var pe=B.name;P[pe]=B,$=pe}return!z&&$&&(E=$),$||!z&&E},N=function(H,B){if(q(H))return H.clone();var Q=typeof B=="object"?B:{};return Q.date=H,Q.args=arguments,new U(Q)},M=I;M.l=O,M.i=q,M.w=function(H,B){return N(H,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var U=function(){function H(Q){this.$L=O(Q.locale,null,!0),this.parse(Q),this.$x=this.$x||Q.x||{},this[V]=!0}var B=H.prototype;return B.parse=function(Q){this.$d=function(z){var $=z.date,X=z.utc;if($===null)return new Date(NaN);if(M.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var ee=$.match(S);if(ee){var pe=ee[2]-1||0,Re=(ee[7]||"0").substring(0,3);return X?new Date(Date.UTC(ee[1],pe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Re)):new Date(ee[1],pe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Re)}}return new Date($)}(Q),this.init()},B.init=function(){var Q=this.$d;this.$y=Q.getFullYear(),this.$M=Q.getMonth(),this.$D=Q.getDate(),this.$W=Q.getDay(),this.$H=Q.getHours(),this.$m=Q.getMinutes(),this.$s=Q.getSeconds(),this.$ms=Q.getMilliseconds()},B.$utils=function(){return M},B.isValid=function(){return this.$d.toString()!==g},B.isSame=function(Q,z){var $=N(Q);return this.startOf(z)<=$&&$<=this.endOf(z)},B.isAfter=function(Q,z){return N(Q)<this.startOf(z)},B.isBefore=function(Q,z){return this.endOf(z)<N(Q)},B.$g=function(Q,z,$){return M.u(Q)?this[z]:this.set($,Q)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(Q,z){var $=this,X=!!M.u(z)||z,ee=M.p(Q),pe=function(je,it){var ft=M.w($.$u?Date.UTC($.$y,it,je):new Date($.$y,it,je),$);return X?ft:ft.endOf(p)},Re=function(je,it){return M.w($.toDate()[je].apply($.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(it)),$)},_e=this.$W,be=this.$M,we=this.$D,Ce="set"+(this.$u?"UTC":"");switch(ee){case v:return X?pe(1,0):pe(31,11);case m:return X?pe(1,be):pe(0,be+1);case f:var Te=this.$locale().weekStart||0,ut=(_e<Te?_e+7:_e)-Te;return pe(X?we-ut:we+(6-ut),be);case p:case C:return Re(Ce+"Hours",0);case a:return Re(Ce+"Minutes",1);case i:return Re(Ce+"Seconds",2);case o:return Re(Ce+"Milliseconds",3);default:return this.clone()}},B.endOf=function(Q){return this.startOf(Q,!1)},B.$set=function(Q,z){var $,X=M.p(Q),ee="set"+(this.$u?"UTC":""),pe=($={},$[p]=ee+"Date",$[C]=ee+"Date",$[m]=ee+"Month",$[v]=ee+"FullYear",$[a]=ee+"Hours",$[i]=ee+"Minutes",$[o]=ee+"Seconds",$[n]=ee+"Milliseconds",$)[X],Re=X===p?this.$D+(z-this.$W):z;if(X===m||X===v){var _e=this.clone().set(C,1);_e.$d[pe](Re),_e.init(),this.$d=_e.set(C,Math.min(this.$D,_e.daysInMonth())).$d}else pe&&this.$d[pe](Re);return this.init(),this},B.set=function(Q,z){return this.clone().$set(Q,z)},B.get=function(Q){return this[M.p(Q)]()},B.add=function(Q,z){var $,X=this;Q=Number(Q);var ee=M.p(z),pe=function(be){var we=N(X);return M.w(we.date(we.date()+Math.round(be*Q)),X)};if(ee===m)return this.set(m,this.$M+Q);if(ee===v)return this.set(v,this.$y+Q);if(ee===p)return pe(1);if(ee===f)return pe(7);var Re=($={},$[i]=t,$[a]=r,$[o]=e,$)[ee]||1,_e=this.$d.getTime()+Q*Re;return M.w(_e,this)},B.subtract=function(Q,z){return this.add(-1*Q,z)},B.format=function(Q){var z=this,$=this.$locale();if(!this.isValid())return $.invalidDate||g;var X=Q||"YYYY-MM-DDTHH:mm:ssZ",ee=M.z(this),pe=this.$H,Re=this.$m,_e=this.$M,be=$.weekdays,we=$.months,Ce=$.meridiem,Te=function(it,ft,Gt,cr){return it&&(it[ft]||it(z,X))||Gt[ft].slice(0,cr)},ut=function(it){return M.s(pe%12||12,it,"0")},je=Ce||function(it,ft,Gt){var cr=it<12?"AM":"PM";return Gt?cr.toLowerCase():cr};return X.replace(x,function(it,ft){return ft||function(Gt){switch(Gt){case"YY":return String(z.$y).slice(-2);case"YYYY":return M.s(z.$y,4,"0");case"M":return _e+1;case"MM":return M.s(_e+1,2,"0");case"MMM":return Te($.monthsShort,_e,we,3);case"MMMM":return Te(we,_e);case"D":return z.$D;case"DD":return M.s(z.$D,2,"0");case"d":return String(z.$W);case"dd":return Te($.weekdaysMin,z.$W,be,2);case"ddd":return Te($.weekdaysShort,z.$W,be,3);case"dddd":return be[z.$W];case"H":return String(pe);case"HH":return M.s(pe,2,"0");case"h":return ut(1);case"hh":return ut(2);case"a":return je(pe,Re,!0);case"A":return je(pe,Re,!1);case"m":return String(Re);case"mm":return M.s(Re,2,"0");case"s":return String(z.$s);case"ss":return M.s(z.$s,2,"0");case"SSS":return M.s(z.$ms,3,"0");case"Z":return ee}return null}(it)||ee.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(Q,z,$){var X,ee=this,pe=M.p(z),Re=N(Q),_e=(Re.utcOffset()-this.utcOffset())*t,be=this-Re,we=function(){return M.m(ee,Re)};switch(pe){case v:X=we()/12;break;case m:X=we();break;case h:X=we()/3;break;case f:X=(be-_e)/6048e5;break;case p:X=(be-_e)/864e5;break;case a:X=be/r;break;case i:X=be/t;break;case o:X=be/e;break;default:X=be}return $?X:M.a(X)},B.daysInMonth=function(){return this.endOf(m).$D},B.$locale=function(){return P[this.$L]},B.locale=function(Q,z){if(!Q)return this.$L;var $=this.clone(),X=O(Q,z,!0);return X&&($.$L=X),$},B.clone=function(){return M.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},H}(),Y=U.prototype;return N.prototype=Y,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",p],["$M",m],["$y",v],["$D",C]].forEach(function(H){Y[H[1]]=function(B){return this.$g(B,H[0],H[1])}}),N.extend=function(H,B){return H.$i||(H(B,U,N),H.$i=!0),N},N.locale=O,N.isDayjs=q,N.unix=function(H){return N(1e3*H)},N.en=P[E],N.Ls=P,N.p={},N})});var $C=bt((yh,Sh)=>{"use strict";d();c();l();u();(function(e,t){typeof yh=="object"&&typeof Sh<"u"?Sh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(yh,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 v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(p,f)}}})});var HC=bt((vh,Ah)=>{"use strict";d();c();l();u();(function(e,t){typeof vh=="object"&&typeof Ah<"u"?Ah.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(vh,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))},v=function(S,x){var w,R=a.meridiem;if(R){for(var I=1;I<=24;I+=1)if(S.indexOf(R(I,0,x))>-1){w=I>12;break}}else w=S===(x?"pm":"PM");return w},C={A:[i,function(S){this.afternoon=v(S,!1)}],a:[i,function(S){this.afternoon=v(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(N,M,U){var Y=U&&U.toUpperCase();return M||w[U]||e[U]||w[Y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(H,B,Q){return B||Q.slice(1)})})).match(t),I=R.length,E=0;E<I;E+=1){var P=R[E],V=C[P],q=V&&V[0],O=V&&V[1];R[E]=O?{regex:q,parser:O}:P.replace(/^\[|\]$/g,"")}return function(N){for(var M={},U=0,Y=0;U<I;U+=1){var H=R[U];if(typeof H=="string")Y+=H.length;else{var B=H.regex,Q=H.parser,z=N.slice(Y),$=B.exec(z)[0];Q.call(M,$),N=N.replace($,"")}}return function(X){var ee=X.afternoon;if(ee!==void 0){var pe=X.hours;ee?pe<12&&(X.hours+=12):pe===12&&(X.hours=0),delete X.afternoon}}(M),M}}return function(S,x,w){w.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(p=S.parseTwoDigitYear);var R=x.prototype,I=R.parse;R.parse=function(E){var P=E.date,V=E.utc,q=E.args;this.$u=V;var O=q[1];if(typeof O=="string"){var N=q[2]===!0,M=q[3]===!0,U=N||M,Y=q[2];M&&(Y=q[2]),a=this.$locale(),!N&&Y&&(a=w.Ls[Y]),this.$d=function(z,$,X,ee){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*z);var pe=g($)(z),Re=pe.year,_e=pe.month,be=pe.day,we=pe.hours,Ce=pe.minutes,Te=pe.seconds,ut=pe.milliseconds,je=pe.zone,it=pe.week,ft=new Date,Gt=be||(Re||_e?1:ft.getDate()),cr=Re||ft.getFullYear(),On=0;Re&&!_e||(On=_e>0?_e-1:ft.getMonth());var wi,Ii=we||0,Ns=Ce||0,Pm=Te||0,km=ut||0;return je?new Date(Date.UTC(cr,On,Gt,Ii,Ns,Pm,km+60*je.offset*1e3)):X?new Date(Date.UTC(cr,On,Gt,Ii,Ns,Pm,km)):(wi=new Date(cr,On,Gt,Ii,Ns,Pm,km),it&&(wi=ee(wi).week(it).toDate()),wi)}catch{return new Date("")}}(P,O,V,w),this.init(),Y&&Y!==!0&&(this.$L=this.locale(Y).$L),U&&P!=this.format(O)&&(this.$d=new Date("")),a={}}else if(O instanceof Array)for(var H=O.length,B=1;B<=H;B+=1){q[1]=O[B-1];var Q=w.apply(this,q);if(Q.isValid()){this.$d=Q.$d,this.$L=Q.$L,this.init();break}B===H&&(this.$d=new Date(""))}else I.call(this,E)}}})});var Px=bt((cy,uy)=>{"use strict";d();c();l();u();(function(e,t){typeof cy=="object"&&typeof uy<"u"?uy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(cy,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,v,C){C===void 0&&(C={});var g=new Date(h),S=function(x,w){w===void 0&&(w={});var R=w.timeZoneName||"short",I=x+"|"+R,E=t[I];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[I]=E),E}(v,C);return S.formatToParts(g)},p=function(h,v){for(var C=a(h,v),g=[],S=0;S<C.length;S+=1){var x=C[S],w=x.type,R=x.value,I=e[w];I>=0&&(g[I]=parseInt(R,10))}var E=g[3],P=E===24?0:E,V=g[0]+"-"+g[1]+"-"+g[2]+" "+P+":"+g[4]+":"+g[5]+":000",q=+h;return(o.utc(V).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(h,v){h===void 0&&(h=i);var C,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))C=this.utcOffset(0,v);else if(C=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(R,!0),v){var I=C.utcOffset();C=C.add(g-I,"minute")}return C.$x.$timezone=h,C},f.offsetName=function(h){var v=this.$x.$timezone||o.tz.guess(),C=a(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return C&&C.value};var m=f.startOf;f.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return m.call(this,h,v);var C=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(C,h,v).tz(this.$x.$timezone,!0)},o.tz=function(h,v,C){var g=C&&v,S=C||v||i,x=p(+o(),S);if(typeof h!="string")return o(h).tz(S);var w=function(P,V,q){var O=P-60*V*1e3,N=p(O,q);if(V===N)return[O,V];var M=p(O-=60*(N-V)*1e3,q);return N===M?[O,N]:[P-60*Math.min(N,M)*1e3,Math.max(N,M)]}(o.utc(h,g).valueOf(),x,S),R=w[0],I=w[1],E=o(R).utcOffset(I);return E.$x.$timezone=S,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var kx=bt((ly,dy)=>{"use strict";d();c();l();u();(function(e,t){typeof ly=="object"&&typeof dy<"u"?dy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(ly,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 P=E.match(t);if(!P)return null;var V=(""+P[0]).match(r)||["-",0,0],q=V[0],O=60*+V[1]+ +V[2];return O===0?0:q==="+"?O:-O}(g),g===null))return this;var w=Math.abs(g)<=16?60*g:g,R=this;if(S)return R.$offset=w,R.$u=g===0,R;if(g!==0){var I=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(R=this.local().add(w+I,e)).$offset=w,R.$x.$localOffset=I}else R=this.utc();return 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 v=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var C=a.diff;a.diff=function(g,S,x){if(g&&this.$u===g.$u)return C.call(this,g,S,x);var w=this.local(),R=i(g).local();return C.call(w,R,S,x)}}})});var Ow=bt((HCe,kw)=>{"use strict";d();c();l();u();function aV(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}kw.exports=sV;function sV(e,t,r){var n=r&&r.stringify||aV,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,v=-1,C=e&&e.length||0,g=0;g<C;){if(e.charCodeAt(g)===37&&g+1<C){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=f||t[h]==null)break;v<g&&(m+=e.slice(v,g)),m+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=f||t[h]==null)break;v<g&&(m+=e.slice(v,g)),m+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=f||t[h]===void 0)break;v<g&&(m+=e.slice(v,g));var S=typeof t[h];if(S==="string"){m+="'"+t[h]+"'",v=g+2,g++;break}if(S==="function"){m+=t[h].name||"<anonymous>",v=g+2,g++;break}m+=n(t[h]),v=g+2,g++;break;case 115:if(h>=f)break;v<g&&(m+=e.slice(v,g)),m+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(m+=e.slice(v,g)),m+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<C&&(m+=e.slice(v)),m)}});var jw=bt((JCe,_p)=>{"use strict";d();c();l();u();var _w=Ow();_p.exports=En;var Uc=bV().console||{},cV={mapHttpRequest:Op,mapHttpResponse:Op,wrapRequestSerializer:eS,wrapResponseSerializer:eS,wrapErrorSerializer:eS,req:Op,res:Op,err:qw,errWithCause:qw};function io(e,t){return e==="silent"?1/0:t.levels.values[e]}var nS=Symbol("pino.logFuncs"),tS=Symbol("pino.hierarchy"),uV={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Nw(e,t){let r={logger:t,parent:e[tS]};t[tS]=r}function lV(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Uc[o]||Uc[uV[o]||"log"]||Wa}),e[nS]=n}function dV(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function En(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||Uc;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=dV(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=Wa),lV(m,p,r),Nw({},m),Object.defineProperty(m,"levelVal",{get:v}),Object.defineProperty(m,"level",{get:C,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:p,timestamp:vV(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Wa};m.levels=pV(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=Wa,m.serializers=n,m._serialize=o,m._stdErrSerialize=i,m.child=function(...x){return S.call(this,h,...x)},t&&(m._logEvent=rS());function v(){return io(this.level,this)}function C(){return this._level}function g(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,yi(this,h,m,"error"),yi(this,h,m,"fatal"),yi(this,h,m,"warn"),yi(this,h,m,"info"),yi(this,h,m,"debug"),yi(this,h,m,"trace"),a.forEach(w=>{yi(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 I=R.serializers;if(o&&I){var E=Object.assign({},n,I),P=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,oS([w],P,E,this._stdErrSerialize)}function V(O){this._childLevel=(O._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=P),t&&(this._logEvent=rS([].concat(O._logEvent.bindings,w)))}V.prototype=this;let q=new V(this);return Nw(this,q),q.child=function(...O){return S.call(this,x,...O)},q.level=R.level||this.level,x.onChild(q),q}return m}function pV(e){let t=e.customLevels||{},r=Object.assign({},En.levels.values,t),n=Object.assign({},En.levels.labels,fV(t));return{values:r,labels:n}}function fV(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}En.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"}};En.stdSerializers=cV;En.stdTimeFunctions=Object.assign({},{nullTime:Dw,epochTime:Mw,unixTime:AV,isoTime:CV});function mV(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[tS];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function yi(e,t,r,n){if(Object.defineProperty(e,n,{value:io(e.level,r)>io(n,r)?Wa:r[nS][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Wa){if(!t.transmit)return;let i=t.transmit.level||e.level,a=io(i,r);if(io(n,r)<a)return}e[n]=hV(e,t,r,n);let o=mV(e);o.length!==0&&(e[n]=gV(o,e[n]))}function gV(e,t){return function(){return t.apply(this,[...e,...arguments])}}function hV(e,t,r,n){return function(o){return function(){let a=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Uc?Uc:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var h=!1;if(t.serialize&&(oS(p,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?o.call(f,...yV(this,n,p,a,t)):o.apply(f,p),t.transmit){let v=t.transmit.level||e._level,C=io(v,r),g=io(n,r);if(g<C)return;SV(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:io(e._level,r)},p,h)}}}(e[nS][n])}function yV(e,t,r,n,o){let{level:i,log:a=v=>v}=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 v=i(t,e.levels.values[t]);Object.assign(m,v)}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?_w(p.shift(),p):void 0}else typeof f=="string"&&(f=_w(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[a(m)]}}function oS(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=En.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 SV(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||oS(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=rS(m)}function rS(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function qw(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 vV(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Dw:Mw}function Op(){return{}}function eS(e){return e}function Wa(){}function Dw(){return!1}function Mw(){return Date.now()}function AV(){return Math.round(Date.now()/1e3)}function CV(){return new Date(Date.now()).toISOString()}function bV(){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)||{}}}_p.exports.default=En;_p.exports.pino=En});var GB={};Ms(GB,{HighlightUtils:()=>Qm,ResultTemplatesHelpers:()=>Vb,SortOrder:()=>rl,VERSION:()=>qn,buildAttachToCase:()=>Yw,buildAttachedResults:()=>Kw,buildBreadcrumbManager:()=>wI,buildCategoryFacet:()=>KI,buildController:()=>fe,buildCriterionExpression:()=>Mr,buildDateFacet:()=>hE,buildDateFilter:()=>SE,buildDateRange:()=>us,buildDateSortCriterion:()=>bC,buildDidYouMean:()=>_I,buildFacet:()=>lE,buildFacetConditionsManager:()=>MI,buildFacetManager:()=>VI,buildFoldedResultList:()=>NE,buildGeneratedAnswer:()=>jE,buildInsightEngine:()=>$w,buildInsightInterface:()=>IT,buildInteractiveCitation:()=>LE,buildInteractiveResult:()=>sF,buildNotifyTrigger:()=>yT,buildNumericFacet:()=>bE,buildNumericFilter:()=>RE,buildNumericRange:()=>Uf,buildPager:()=>$E,buildQueryError:()=>zE,buildQuerySummary:()=>YE,buildQuickview:()=>ZE,buildRecentQueriesList:()=>iF,buildRelevanceSortCriterion:()=>ol,buildResultList:()=>cF,buildResultTemplatesManager:()=>DT,buildResultsPerPage:()=>lF,buildSearchBox:()=>xF,buildSearchParameterManager:()=>$F,buildSearchStatus:()=>aT,buildSmartSnippet:()=>JF,buildSmartSnippetQuestionsList:()=>eT,buildSort:()=>iT,buildTab:()=>cT,buildUserActions:()=>wT,deserializeRelativeDate:()=>nb,getAnalyticsNextApiBaseUrl:()=>vu,getOrganizationEndpoint:()=>We,getSampleInsightEngineConfiguration:()=>iS,loadAttachedResultsActions:()=>RB,loadAttachedResultsAnalyticsActions:()=>wB,loadCaseContextActions:()=>IB,loadContextActions:()=>FB,loadDateFacetSetActions:()=>TB,loadFieldActions:()=>kB,loadFoldingActions:()=>OB,loadGeneratedAnswerActions:()=>_B,loadGenericAnalyticsActions:()=>bB,loadInsightAnalyticsActions:()=>xB,loadInsightInterfaceActions:()=>NB,loadInsightSearchActions:()=>DB,loadInsightSearchAnalyticsActions:()=>MB,loadInsightUserActionsActions:()=>jB,loadNumericFacetSetActions:()=>PB,loadQuerySetActions:()=>qB,loadQuerySuggestActions:()=>VB,loadQuestionAnsweringActions:()=>LB,loadRecentResultsActions:()=>UB});module.exports=BT(GB);d();c();l();u();var Qm={};Ms(Qm,{escapeHtml:()=>_i,getHighlightedSuggestion:()=>Um,highlightString:()=>IP});d();c();l();u();d();c();l();u();function vP(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 zT=Object.create;var Ds=Object.defineProperty;var WT=Object.getOwnPropertyDescriptor;var YT=Object.getOwnPropertyNames;var KT=Object.getPrototypeOf,XT=Object.prototype.hasOwnProperty;var JT=(e,t,r)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ei=(e,t)=>()=>(e&&(t=e(e=0)),t);var bt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ms=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},QS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of YT(t))!XT.call(e,o)&&o!==r&&Ds(e,o,{get:()=>t[o],enumerable:!(n=WT(t,o))||n.enumerable});return e};var Cr=(e,t,r)=>(r=e!=null?zT(KT(e)):{},QS(t||!e||!e.__esModule?Ds(r,"default",{value:e,enumerable:!0}):r,e)),ZT=e=>QS(Ds({},"__esModule",{value:!0}),e);var qe=(e,t,r)=>JT(e,typeof t!="symbol"?t+"":t,r);var y,c=Ei(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function su(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?su=function(t){return typeof t}:su=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function rP(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=nP.bind(this))}function nP(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","*/*"),eP(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):tP(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var eP,tP,u=Ei(()=>{"use strict";eP=function(t){return typeof t=="string"},tP=function(t){return t instanceof Blob};rP.call((typeof window>"u"?"undefined":su(window))==="object"?window:{})});var Bm=bt(js=>{"use strict";d();c();l();u();Object.defineProperty(js,"__esModule",{value:!0});function BS(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 oP(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iP(e,t,r){return t=Fi(t),sP(e,zS()?Reflect.construct(t,r||[],Fi(e).constructor):t.apply(e,r))}function Lm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GS(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,dP(n.key),n)}}function Um(e,t,r){return t&&GS(e.prototype,t),r&&GS(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $S(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=pP(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 jm(){return jm=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=cP(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},jm.apply(null,arguments)}function Fi(e){return Fi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fi(e)}function aP(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&&Vm(e,t)}function zS(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zS=function(){return!!e})()}function sP(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 oP(e)}function Vm(e,t){return Vm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Vm(e,t)}function cP(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Fi(e))!==null;);return e}function uP(e,t,r,n){var o=jm(Fi(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function lP(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 dP(e){var t=lP(e,"string");return typeof t=="symbol"?t:t+""}function pP(e,t){if(e){if(typeof e=="string")return BS(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)?BS(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function fP(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 mP(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 HS=function(){function e(){Lm(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Um(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(A){Promise.resolve().then(function(){throw A})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},p=0,f=i.length;p<f;p++)a();return!r.defaultPrevented}}}])}(),Qm=function(e){function t(){var r;return Lm(this,t),r=iP(this,t),r.listeners||HS.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 aP(t,e),Um(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)),uP(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 cu;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 cu;function i(){o.abort(this.reason),a()}function a(){var h=$S(n),A;try{for(h.s();!(A=h.n()).done;){var S=A.value;S.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var p=$S(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}}])}(HS),cu=function(){function e(){Lm(this,e),Object.defineProperty(this,"signal",{value:new Qm,writable:!0,configurable:!0})}return Um(e,[{key:"abort",value:function(r){var n=mP(r),o=fP(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(cu.prototype[Symbol.toStringTag]="AbortController",Qm.prototype[Symbol.toStringTag]="AbortSignal");function gP(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 hP(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(!gP({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(S,g){var C;g&&g.signal&&(C=g.signal,delete g.signal);var x=new o(S,g);return C&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:C}),x},f.prototype=o.prototype);var m=r,h=function(S,g){var C=f&&f.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(C){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(C.aborted)return Promise.reject(x);var w=new Promise(function(R,E){C.addEventListener("abort",function(){return E(x)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([w,m(S,g)])}return m(S,g)};return{fetch:h,Request:f}}js.AbortController=cu;js.AbortSignal=Qm;js.abortableFetch=hP});var WS,s,v,l=Ei(()=>{"use strict";WS=Cr(Bm(),1),s=Cr(Bm(),1),{fetch:v}=(0,WS.abortableFetch)({fetch})});function Gm(e){return typeof e!="string"||e in{}}function $m(){return Object.create(null)}function YS(e){return typeof e=="string"&&!!e.trim()}function Hm(e,t){var r=e.split(";").filter(YS),n=r.shift(),o=yP(n),i=o.name,a=o.value;if(t=t?Object.assign({},uu,t):uu,Gm(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=$m();return p.name=i,p.value=a,r.forEach(function(f){var m=f.split("="),h=m.shift().trimLeft().toLowerCase();if(!Gm(h)){var A=m.join("=");if(h==="expires")p.expires=new Date(A);else if(h==="max-age"){var S=parseInt(A,10);Number.isNaN(S)||(p.maxAge=S)}else h==="secure"?p.secure=!0:h==="httponly"?p.httpOnly=!0:h==="samesite"?p.sameSite=A:h==="partitioned"?p.partitioned=!0:h&&(p[h]=A)}}),p}function yP(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Ti(e,t){if(t=t?Object.assign({},uu,t):uu,!e)return t.map?$m():[];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(YS),n&&(e=e.map(lu).flat()),t.map){var i=$m();return e.reduce(function(a,p){var f=Hm(p,t);return f&&!Gm(f.name)&&(a[f.name]=f),a},i)}else return e.map(function(a){return Hm(a,t)}).filter(Boolean)}function lu(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 uu,KS=Ei(()=>{"use strict";d();c();l();u();uu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Ti.parseSetCookie=Ti;Ti.parse=Ti;Ti.parseString=Hm;Ti.splitCookiesString=lu});function Vs(e){if(SP.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function zm(e){return e.replace(vP,"")}function Ls(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||!AP(r))return!1}return!0}function AP(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function JS(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 SP,XS,vP,ZS,Pi,Wm,ev,b,rv=Ei(()=>{"use strict";d();c();l();u();KS();SP=/[^a-z0-9\-#$%&'*+.^_`|~]/i;XS=[`
19
+ `,"\r","\t"," "],vP=new RegExp(`(^[${XS.join("")}]|$[${XS.join("")}])`,"g");Pi=Symbol("normalizedHeaders"),Wm=Symbol("rawHeaderNames"),ev=", ",b=class tv{constructor(t){this[Pi]={},this[Wm]=new Map,this[ZS]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof tv||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(ev):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(ev):n)})}[(ZS=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[Pi]).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(!Ls(t))throw new TypeError(`Invalid header name "${t}"`);return this[Pi].hasOwnProperty(Vs(t))}get(t){if(!Ls(t))throw TypeError(`Invalid header name "${t}"`);return this[Pi][Vs(t)]??null}set(t,r){if(!Ls(t)||!JS(r))return;let n=Vs(t),o=zm(r);this[Pi][n]=zm(o),this[Wm].set(n,t)}append(t,r){if(!Ls(t)||!JS(r))return;let n=Vs(t),o=zm(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Ls(t)||!this.has(t))return;let r=Vs(t);delete this[Pi][r],this[Wm].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===""?[""]:lu(t)}}});var d=Ei(()=>{"use strict";rv()});var uv=bt(Bs=>{"use strict";d();c();l();u();var yu=Bs&&Bs.__assign||function(){return yu=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},yu.apply(this,arguments)};Object.defineProperty(Bs,"__esModule",{value:!0});var TP={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function PP(e){var t=yu(yu({},TP),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Bs.getSanitizedOptions=PP});var lv=bt(Jm=>{"use strict";d();c();l();u();Object.defineProperty(Jm,"__esModule",{value:!0});function kP(e){var t=Math.random()*e;return Math.round(t)}Jm.fullJitter=kP});var dv=bt(Zm=>{"use strict";d();c();l();u();Object.defineProperty(Zm,"__esModule",{value:!0});function OP(e){return e}Zm.noJitter=OP});var pv=bt(eg=>{"use strict";d();c();l();u();Object.defineProperty(eg,"__esModule",{value:!0});var _P=lv(),NP=dv();function qP(e){return e.jitter==="full"?_P.fullJitter:NP.noJitter}eg.JitterFactory=qP});var rg=bt(tg=>{"use strict";d();c();l();u();Object.defineProperty(tg,"__esModule",{value:!0});var DP=pv(),MP=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=DP.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}();tg.Delay=MP});var fv=bt(hn=>{"use strict";d();c();l();u();var jP=hn&&hn.__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)}}(),VP=hn&&hn.__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(A){a(A)}}function f(h){try{m(n.throw(h))}catch(A){a(A)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},LP=hn&&hn.__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(hn,"__esModule",{value:!0});var UP=rg(),QP=function(e){jP(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return VP(this,void 0,void 0,function(){return LP(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}(UP.Delay);hn.SkipFirstDelay=QP});var mv=bt(Gs=>{"use strict";d();c();l();u();var BP=Gs&&Gs.__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(Gs,"__esModule",{value:!0});var GP=rg(),$P=function(e){BP(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(GP.Delay);Gs.AlwaysDelay=$P});var gv=bt(ng=>{"use strict";d();c();l();u();Object.defineProperty(ng,"__esModule",{value:!0});var HP=fv(),zP=mv();function WP(e,t){var r=YP(e);return r.setAttemptNumber(t),r}ng.DelayFactory=WP;function YP(e){return e.delayFirstAttempt?new zP.AlwaysDelay(e):new HP.SkipFirstDelay(e)}});var hv=bt(Ro=>{"use strict";d();c();l();u();var og=Ro&&Ro.__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(A){a(A)}}function f(h){try{m(n.throw(h))}catch(A){a(A)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},ig=Ro&&Ro.__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(Ro,"__esModule",{value:!0});var KP=uv(),XP=gv();function JP(e,t){return t===void 0&&(t={}),og(this,void 0,void 0,function(){var r,n;return ig(this,function(o){switch(o.label){case 0:return r=KP.getSanitizedOptions(t),n=new ZP(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Ro.backOff=JP;var ZP=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return og(this,void 0,void 0,function(){var t,r;return ig(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 og(this,void 0,void 0,function(){var t;return ig(this,function(r){switch(r.label){case 0:return t=XP.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var vu=bt((ag,sg)=>{"use strict";d();c();l();u();(function(e,t){typeof ag=="object"&&typeof sg<"u"?sg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(ag,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",A="year",S="date",g="Invalid Date",C=/^(\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(H){var B=["th","st","nd","rd"],Q=H%100;return"["+H+(B[(Q-20)%10]||B[Q]||B[0])+"]"}},R=function(H,B,Q){var z=String(H);return!z||z.length>=B?H:""+Array(B+1-z.length).join(Q)+H},E={s:R,z:function(H){var B=-H.utcOffset(),Q=Math.abs(B),z=Math.floor(Q/60),$=Q%60;return(B<=0?"+":"-")+R(z,2,"0")+":"+R($,2,"0")},m:function H(B,Q){if(B.date()<Q.date())return-H(Q,B);var z=12*(Q.year()-B.year())+(Q.month()-B.month()),$=B.clone().add(z,m),J=Q-$<0,ee=B.clone().add(z+(J?-1:1),m);return+(-(z+(Q-$)/(J?$-ee:ee-$))||0)},a:function(H){return H<0?Math.ceil(H)||0:Math.floor(H)},p:function(H){return{M:m,y:A,w:f,d:p,D:S,h:a,m:i,s:o,ms:n,Q:h}[H]||String(H||"").toLowerCase().replace(/s$/,"")},u:function(H){return H===void 0}},F="en",P={};P[F]=w;var V="$isDayjsObject",q=function(H){return H instanceof U||!(!H||!H[V])},O=function H(B,Q,z){var $;if(!B)return F;if(typeof B=="string"){var J=B.toLowerCase();P[J]&&($=J),Q&&(P[J]=Q,$=J);var ee=B.split("-");if(!$&&ee.length>1)return H(ee[0])}else{var pe=B.name;P[pe]=B,$=pe}return!z&&$&&(F=$),$||!z&&F},N=function(H,B){if(q(H))return H.clone();var Q=typeof B=="object"?B:{};return Q.date=H,Q.args=arguments,new U(Q)},M=E;M.l=O,M.i=q,M.w=function(H,B){return N(H,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var U=function(){function H(Q){this.$L=O(Q.locale,null,!0),this.parse(Q),this.$x=this.$x||Q.x||{},this[V]=!0}var B=H.prototype;return B.parse=function(Q){this.$d=function(z){var $=z.date,J=z.utc;if($===null)return new Date(NaN);if(M.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var ee=$.match(C);if(ee){var pe=ee[2]-1||0,Re=(ee[7]||"0").substring(0,3);return J?new Date(Date.UTC(ee[1],pe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Re)):new Date(ee[1],pe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Re)}}return new Date($)}(Q),this.init()},B.init=function(){var Q=this.$d;this.$y=Q.getFullYear(),this.$M=Q.getMonth(),this.$D=Q.getDate(),this.$W=Q.getDay(),this.$H=Q.getHours(),this.$m=Q.getMinutes(),this.$s=Q.getSeconds(),this.$ms=Q.getMilliseconds()},B.$utils=function(){return M},B.isValid=function(){return this.$d.toString()!==g},B.isSame=function(Q,z){var $=N(Q);return this.startOf(z)<=$&&$<=this.endOf(z)},B.isAfter=function(Q,z){return N(Q)<this.startOf(z)},B.isBefore=function(Q,z){return this.endOf(z)<N(Q)},B.$g=function(Q,z,$){return M.u(Q)?this[z]:this.set($,Q)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(Q,z){var $=this,J=!!M.u(z)||z,ee=M.p(Q),pe=function(je,it){var ft=M.w($.$u?Date.UTC($.$y,it,je):new Date($.$y,it,je),$);return J?ft:ft.endOf(p)},Re=function(je,it){return M.w($.toDate()[je].apply($.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(it)),$)},_e=this.$W,be=this.$M,we=this.$D,Ce="set"+(this.$u?"UTC":"");switch(ee){case A:return J?pe(1,0):pe(31,11);case m:return J?pe(1,be):pe(0,be+1);case f:var Te=this.$locale().weekStart||0,ut=(_e<Te?_e+7:_e)-Te;return pe(J?we-ut:we+(6-ut),be);case p:case S:return Re(Ce+"Hours",0);case a:return Re(Ce+"Minutes",1);case i:return Re(Ce+"Seconds",2);case o:return Re(Ce+"Milliseconds",3);default:return this.clone()}},B.endOf=function(Q){return this.startOf(Q,!1)},B.$set=function(Q,z){var $,J=M.p(Q),ee="set"+(this.$u?"UTC":""),pe=($={},$[p]=ee+"Date",$[S]=ee+"Date",$[m]=ee+"Month",$[A]=ee+"FullYear",$[a]=ee+"Hours",$[i]=ee+"Minutes",$[o]=ee+"Seconds",$[n]=ee+"Milliseconds",$)[J],Re=J===p?this.$D+(z-this.$W):z;if(J===m||J===A){var _e=this.clone().set(S,1);_e.$d[pe](Re),_e.init(),this.$d=_e.set(S,Math.min(this.$D,_e.daysInMonth())).$d}else pe&&this.$d[pe](Re);return this.init(),this},B.set=function(Q,z){return this.clone().$set(Q,z)},B.get=function(Q){return this[M.p(Q)]()},B.add=function(Q,z){var $,J=this;Q=Number(Q);var ee=M.p(z),pe=function(be){var we=N(J);return M.w(we.date(we.date()+Math.round(be*Q)),J)};if(ee===m)return this.set(m,this.$M+Q);if(ee===A)return this.set(A,this.$y+Q);if(ee===p)return pe(1);if(ee===f)return pe(7);var Re=($={},$[i]=t,$[a]=r,$[o]=e,$)[ee]||1,_e=this.$d.getTime()+Q*Re;return M.w(_e,this)},B.subtract=function(Q,z){return this.add(-1*Q,z)},B.format=function(Q){var z=this,$=this.$locale();if(!this.isValid())return $.invalidDate||g;var J=Q||"YYYY-MM-DDTHH:mm:ssZ",ee=M.z(this),pe=this.$H,Re=this.$m,_e=this.$M,be=$.weekdays,we=$.months,Ce=$.meridiem,Te=function(it,ft,Gt,cr){return it&&(it[ft]||it(z,J))||Gt[ft].slice(0,cr)},ut=function(it){return M.s(pe%12||12,it,"0")},je=Ce||function(it,ft,Gt){var cr=it<12?"AM":"PM";return Gt?cr.toLowerCase():cr};return J.replace(x,function(it,ft){return ft||function(Gt){switch(Gt){case"YY":return String(z.$y).slice(-2);case"YYYY":return M.s(z.$y,4,"0");case"M":return _e+1;case"MM":return M.s(_e+1,2,"0");case"MMM":return Te($.monthsShort,_e,we,3);case"MMMM":return Te(we,_e);case"D":return z.$D;case"DD":return M.s(z.$D,2,"0");case"d":return String(z.$W);case"dd":return Te($.weekdaysMin,z.$W,be,2);case"ddd":return Te($.weekdaysShort,z.$W,be,3);case"dddd":return be[z.$W];case"H":return String(pe);case"HH":return M.s(pe,2,"0");case"h":return ut(1);case"hh":return ut(2);case"a":return je(pe,Re,!0);case"A":return je(pe,Re,!1);case"m":return String(Re);case"mm":return M.s(Re,2,"0");case"s":return String(z.$s);case"ss":return M.s(z.$s,2,"0");case"SSS":return M.s(z.$ms,3,"0");case"Z":return ee}return null}(it)||ee.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(Q,z,$){var J,ee=this,pe=M.p(z),Re=N(Q),_e=(Re.utcOffset()-this.utcOffset())*t,be=this-Re,we=function(){return M.m(ee,Re)};switch(pe){case A:J=we()/12;break;case m:J=we();break;case h:J=we()/3;break;case f:J=(be-_e)/6048e5;break;case p:J=(be-_e)/864e5;break;case a:J=be/r;break;case i:J=be/t;break;case o:J=be/e;break;default:J=be}return $?J:M.a(J)},B.daysInMonth=function(){return this.endOf(m).$D},B.$locale=function(){return P[this.$L]},B.locale=function(Q,z){if(!Q)return this.$L;var $=this.clone(),J=O(Q,z,!0);return J&&($.$L=J),$},B.clone=function(){return M.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},H}(),Y=U.prototype;return N.prototype=Y,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",p],["$M",m],["$y",A],["$D",S]].forEach(function(H){Y[H[1]]=function(B){return this.$g(B,H[0],H[1])}}),N.extend=function(H,B){return H.$i||(H(B,U,N),H.$i=!0),N},N.locale=O,N.isDayjs=q,N.unix=function(H){return N(1e3*H)},N.en=P[F],N.Ls=P,N.p={},N})});var Cv=bt((cg,ug)=>{"use strict";d();c();l();u();(function(e,t){typeof cg=="object"&&typeof ug<"u"?ug.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(cg,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 A=this.quarter()-1;return h?this.month(3*A).startOf(e).startOf("day"):this.month(3*A+2).endOf(e).endOf("day")}return a.bind(this)(p,f)}}})});var bv=bt((lg,dg)=>{"use strict";d();c();l();u();(function(e,t){typeof lg=="object"&&typeof dg<"u"?dg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(lg,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(C){return(C=+C)+(C>68?1900:2e3)},f=function(C){return function(x){this[C]=+x}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(C){(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}(C)}],h=function(C){var x=a[C];return x&&(x.indexOf?x:x.s.concat(x.f))},A=function(C,x){var w,R=a.meridiem;if(R){for(var E=1;E<=24;E+=1)if(C.indexOf(R(E,0,x))>-1){w=E>12;break}}else w=C===(x?"pm":"PM");return w},S={A:[i,function(C){this.afternoon=A(C,!1)}],a:[i,function(C){this.afternoon=A(C,!0)}],Q:[r,function(C){this.month=3*(C-1)+1}],S:[r,function(C){this.milliseconds=100*+C}],SS:[n,function(C){this.milliseconds=10*+C}],SSS:[/\d{3}/,function(C){this.milliseconds=+C}],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(C){var x=a.ordinal,w=C.match(/\d+/);if(this.day=w[0],x)for(var R=1;R<=31;R+=1)x(R).replace(/\[|\]/g,"")===C&&(this.day=R)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[i,function(C){var x=h("months"),w=(h("monthsShort")||x.map(function(R){return R.slice(0,3)})).indexOf(C)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(C){var x=h("months").indexOf(C)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(C){this.year=p(C)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function g(C){var x,w;x=C,w=a&&a.formats;for(var R=(C=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(N,M,U){var Y=U&&U.toUpperCase();return M||w[U]||e[U]||w[Y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(H,B,Q){return B||Q.slice(1)})})).match(t),E=R.length,F=0;F<E;F+=1){var P=R[F],V=S[P],q=V&&V[0],O=V&&V[1];R[F]=O?{regex:q,parser:O}:P.replace(/^\[|\]$/g,"")}return function(N){for(var M={},U=0,Y=0;U<E;U+=1){var H=R[U];if(typeof H=="string")Y+=H.length;else{var B=H.regex,Q=H.parser,z=N.slice(Y),$=B.exec(z)[0];Q.call(M,$),N=N.replace($,"")}}return function(J){var ee=J.afternoon;if(ee!==void 0){var pe=J.hours;ee?pe<12&&(J.hours+=12):pe===12&&(J.hours=0),delete J.afternoon}}(M),M}}return function(C,x,w){w.p.customParseFormat=!0,C&&C.parseTwoDigitYear&&(p=C.parseTwoDigitYear);var R=x.prototype,E=R.parse;R.parse=function(F){var P=F.date,V=F.utc,q=F.args;this.$u=V;var O=q[1];if(typeof O=="string"){var N=q[2]===!0,M=q[3]===!0,U=N||M,Y=q[2];M&&(Y=q[2]),a=this.$locale(),!N&&Y&&(a=w.Ls[Y]),this.$d=function(z,$,J,ee){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*z);var pe=g($)(z),Re=pe.year,_e=pe.month,be=pe.day,we=pe.hours,Ce=pe.minutes,Te=pe.seconds,ut=pe.milliseconds,je=pe.zone,it=pe.week,ft=new Date,Gt=be||(Re||_e?1:ft.getDate()),cr=Re||ft.getFullYear(),On=0;Re&&!_e||(On=_e>0?_e-1:ft.getMonth());var wi,Ii=we||0,qs=Ce||0,Dm=Te||0,Mm=ut||0;return je?new Date(Date.UTC(cr,On,Gt,Ii,qs,Dm,Mm+60*je.offset*1e3)):J?new Date(Date.UTC(cr,On,Gt,Ii,qs,Dm,Mm)):(wi=new Date(cr,On,Gt,Ii,qs,Dm,Mm),it&&(wi=ee(wi).week(it).toDate()),wi)}catch{return new Date("")}}(P,O,V,w),this.init(),Y&&Y!==!0&&(this.$L=this.locale(Y).$L),U&&P!=this.format(O)&&(this.$d=new Date("")),a={}}else if(O instanceof Array)for(var H=O.length,B=1;B<=H;B+=1){q[1]=O[B-1];var Q=w.apply(this,q);if(Q.isValid()){this.$d=Q.$d,this.$L=Q.$L,this.init();break}B===H&&(this.$d=new Date(""))}else E.call(this,F)}}})});var Lx=bt((yy,Sy)=>{"use strict";d();c();l();u();(function(e,t){typeof yy=="object"&&typeof Sy<"u"?Sy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(yy,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,A,S){S===void 0&&(S={});var g=new Date(h),C=function(x,w){w===void 0&&(w={});var R=w.timeZoneName||"short",E=x+"|"+R,F=t[E];return F||(F=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[E]=F),F}(A,S);return C.formatToParts(g)},p=function(h,A){for(var S=a(h,A),g=[],C=0;C<S.length;C+=1){var x=S[C],w=x.type,R=x.value,E=e[w];E>=0&&(g[E]=parseInt(R,10))}var F=g[3],P=F===24?0:F,V=g[0]+"-"+g[1]+"-"+g[2]+" "+P+":"+g[4]+":"+g[5]+":000",q=+h;return(o.utc(V).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(h,A){h===void 0&&(h=i);var S,g=this.utcOffset(),C=this.toDate(),x=C.toLocaleString("en-US",{timeZone:h}),w=Math.round((C-new Date(x))/1e3/60),R=15*-Math.round(C.getTimezoneOffset()/15)-w;if(!Number(R))S=this.utcOffset(0,A);else if(S=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(R,!0),A){var E=S.utcOffset();S=S.add(g-E,"minute")}return S.$x.$timezone=h,S},f.offsetName=function(h){var A=this.$x.$timezone||o.tz.guess(),S=a(this.valueOf(),A,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var m=f.startOf;f.startOf=function(h,A){if(!this.$x||!this.$x.$timezone)return m.call(this,h,A);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(S,h,A).tz(this.$x.$timezone,!0)},o.tz=function(h,A,S){var g=S&&A,C=S||A||i,x=p(+o(),C);if(typeof h!="string")return o(h).tz(C);var w=function(P,V,q){var O=P-60*V*1e3,N=p(O,q);if(V===N)return[O,V];var M=p(O-=60*(N-V)*1e3,q);return N===M?[O,N]:[P-60*Math.min(N,M)*1e3,Math.max(N,M)]}(o.utc(h,g).valueOf(),x,C),R=w[0],E=w[1],F=o(R).utcOffset(E);return F.$x.$timezone=C,F},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var Ux=bt((vy,Ay)=>{"use strict";d();c();l();u();(function(e,t){typeof vy=="object"&&typeof Ay<"u"?Ay.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(vy,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 C={date:g,utc:!0,args:arguments};return new o(C)},a.utc=function(g){var C=i(this.toDate(),{locale:this.$L,utc:!0});return g?C.add(this.utcOffset(),e):C},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,C){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(F){F===void 0&&(F="");var P=F.match(t);if(!P)return null;var V=(""+P[0]).match(r)||["-",0,0],q=V[0],O=60*+V[1]+ +V[2];return O===0?0:q==="+"?O:-O}(g),g===null))return this;var w=Math.abs(g)<=16?60*g:g;if(w===0)return this.utc(C);var R=this.clone();if(C)return R.$offset=w,R.$u=!1,R;var E=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(w+E,e)).$offset=w,R.$x.$localOffset=E,R};var h=a.format;a.format=function(g){var C=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,C)},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 A=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():A.call(this)};var S=a.diff;a.diff=function(g,C,x){if(g&&this.$u===g.$u)return S.call(this,g,C,x);var w=this.local(),R=i(g).local();return S.call(w,R,C,x)}}})});var Gw=bt((LCe,Bw)=>{"use strict";d();c();l();u();function sV(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Bw.exports=cV;function cV(e,t,r){var n=r&&r.stringify||sV,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,A=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(A=A>-1?A:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=f||t[h]==null)break;A<g&&(m+=e.slice(A,g)),m+=Number(t[h]),A=g+2,g++;break;case 105:if(h>=f||t[h]==null)break;A<g&&(m+=e.slice(A,g)),m+=Math.floor(Number(t[h])),A=g+2,g++;break;case 79:case 111:case 106:if(h>=f||t[h]===void 0)break;A<g&&(m+=e.slice(A,g));var C=typeof t[h];if(C==="string"){m+="'"+t[h]+"'",A=g+2,g++;break}if(C==="function"){m+=t[h].name||"<anonymous>",A=g+2,g++;break}m+=n(t[h]),A=g+2,g++;break;case 115:if(h>=f)break;A<g&&(m+=e.slice(A,g)),m+=String(t[h]),A=g+2,g++;break;case 37:A<g&&(m+=e.slice(A,g)),m+="%",A=g+2,g++,h--;break}++h}++g}return A===-1?e:(A<S&&(m+=e.slice(A)),m)}});var Kw=bt(($Ce,jp)=>{"use strict";d();c();l();u();var $w=Gw();jp.exports=En;var Uc=xV().console||{},uV={mapHttpRequest:Mp,mapHttpResponse:Mp,wrapRequestSerializer:uS,wrapResponseSerializer:uS,wrapErrorSerializer:uS,req:Mp,res:Mp,err:zw,errWithCause:zw};function io(e,t){return e==="silent"?1/0:t.levels.values[e]}var pS=Symbol("pino.logFuncs"),lS=Symbol("pino.hierarchy"),lV={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Hw(e,t){let r={logger:t,parent:e[lS]};t[lS]=r}function dV(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Uc[o]||Uc[lV[o]||"log"]||Ya}),e[pS]=n}function pV(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function En(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||Uc;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=pV(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=Ya),dV(m,p,r),Hw({},m),Object.defineProperty(m,"levelVal",{get:A}),Object.defineProperty(m,"level",{get:S,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:p,timestamp:AV(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ya};m.levels=fV(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=Ya,m.serializers=n,m._serialize=o,m._stdErrSerialize=i,m.child=function(...x){return C.call(this,h,...x)},t&&(m._logEvent=dS());function A(){return io(this.level,this)}function S(){return this._level}function g(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,yi(this,h,m,"error"),yi(this,h,m,"fatal"),yi(this,h,m,"warn"),yi(this,h,m,"info"),yi(this,h,m,"debug"),yi(this,h,m,"trace"),a.forEach(w=>{yi(this,h,m,w)})}function C(x,w,R){if(!w)throw new Error("missing bindings for child Pino");R=R||{},o&&w.serializers&&(R.serializers=w.serializers);let E=R.serializers;if(o&&E){var F=Object.assign({},n,E),P=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,fS([w],P,F,this._stdErrSerialize)}function V(O){this._childLevel=(O._childLevel|0)+1,this.bindings=w,F&&(this.serializers=F,this._serialize=P),t&&(this._logEvent=dS([].concat(O._logEvent.bindings,w)))}V.prototype=this;let q=new V(this);return Hw(this,q),q.child=function(...O){return C.call(this,x,...O)},q.level=R.level||this.level,x.onChild(q),q}return m}function fV(e){let t=e.customLevels||{},r=Object.assign({},En.levels.values,t),n=Object.assign({},En.levels.labels,mV(t));return{values:r,labels:n}}function mV(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}En.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"}};En.stdSerializers=uV;En.stdTimeFunctions=Object.assign({},{nullTime:Ww,epochTime:Yw,unixTime:CV,isoTime:bV});function gV(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[lS];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function yi(e,t,r,n){if(Object.defineProperty(e,n,{value:io(e.level,r)>io(n,r)?Ya:r[pS][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ya){if(!t.transmit)return;let i=t.transmit.level||e.level,a=io(i,r);if(io(n,r)<a)return}e[n]=yV(e,t,r,n);let o=gV(e);o.length!==0&&(e[n]=hV(o,e[n]))}function hV(e,t){return function(){return t.apply(this,[...e,...arguments])}}function yV(e,t,r,n){return function(o){return function(){let a=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Uc?Uc:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var h=!1;if(t.serialize&&(fS(p,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?o.call(f,...SV(this,n,p,a,t)):o.apply(f,p),t.transmit){let A=t.transmit.level||e._level,S=io(A,r),g=io(n,r);if(g<S)return;vV(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:A,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:io(e._level,r)},p,h)}}}(e[pS][n])}function SV(e,t,r,n,o){let{level:i,log:a=A=>A}=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 A=i(t,e.levels.values[t]);Object.assign(m,A)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;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?$w(p.shift(),p):void 0}else typeof f=="string"&&(f=$w(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[a(m)]}}function fS(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=En.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 vV(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||fS(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=dS(m)}function dS(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function zw(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 AV(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Ww:Yw}function Mp(){return{}}function uS(e){return e}function Ya(){}function Ww(){return!1}function Yw(){return Date.now()}function CV(){return Math.round(Date.now()/1e3)}function bV(){return new Date(Date.now()).toISOString()}function xV(){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)||{}}}jp.exports.default=En;jp.exports.pino=En});var NB={};Ms(NB,{HighlightUtils:()=>Xm,ResultTemplatesHelpers:()=>zb,SortOrder:()=>cl,VERSION:()=>Dn,buildAttachToCase:()=>sI,buildAttachedResults:()=>cI,buildBreadcrumbManager:()=>MI,buildCategoryFacet:()=>cE,buildController:()=>fe,buildCriterionExpression:()=>Mr,buildDateFacet:()=>FE,buildDateFilter:()=>PE,buildDateRange:()=>ls,buildDateSortCriterion:()=>BC,buildDidYouMean:()=>$I,buildFacet:()=>bE,buildFacetConditionsManager:()=>YI,buildFacetManager:()=>XI,buildFoldedResultList:()=>HE,buildGeneratedAnswer:()=>KE,buildInsightEngine:()=>nI,buildInsightInterface:()=>DT,buildInteractiveCitation:()=>JE,buildInteractiveResult:()=>vF,buildNotifyTrigger:()=>ET,buildNumericFacet:()=>NE,buildNumericFilter:()=>DE,buildNumericRange:()=>Hf,buildPager:()=>nF,buildQueryError:()=>iF,buildQuerySummary:()=>sF,buildQuickview:()=>dF,buildRecentQueriesList:()=>yF,buildRelevanceSortCriterion:()=>ll,buildResultList:()=>AF,buildResultTemplatesManager:()=>HT,buildResultsPerPage:()=>bF,buildSearchBox:()=>qF,buildSearchParameterManager:()=>tT,buildSearchStatus:()=>hT,buildSmartSnippet:()=>sT,buildSmartSnippetQuestionsList:()=>lT,buildSort:()=>gT,buildTab:()=>ST,buildUserActions:()=>qT,deserializeRelativeDate:()=>_v,getAnalyticsNextApiBaseUrl:()=>Su,getOrganizationEndpoint:()=>We,getSampleInsightEngineConfiguration:()=>mS,loadAttachedResultsActions:()=>mB,loadAttachedResultsAnalyticsActions:()=>gB,loadCaseContextActions:()=>hB,loadContextActions:()=>SB,loadDateFacetSetActions:()=>vB,loadFieldActions:()=>CB,loadFoldingActions:()=>bB,loadGeneratedAnswerActions:()=>xB,loadGenericAnalyticsActions:()=>pB,loadInsightAnalyticsActions:()=>fB,loadInsightInterfaceActions:()=>RB,loadInsightSearchActions:()=>IB,loadInsightSearchAnalyticsActions:()=>EB,loadInsightUserActionsActions:()=>FB,loadNumericFacetSetActions:()=>AB,loadQuerySetActions:()=>wB,loadQuerySuggestActions:()=>TB,loadQuestionAnsweringActions:()=>PB,loadRecentResultsActions:()=>kB});module.exports=ZT(NB);d();c();l();u();var Xm={};Ms(Xm,{escapeHtml:()=>qi,getHighlightedSuggestion:()=>Km,highlightString:()=>FP});d();c();l();u();d();c();l();u();function CP(e,t){let r=`
20
20
  The following properties are invalid:
21
21
 
22
22
  ${e.join(`
23
23
  `)}
24
24
 
25
25
  ${t}
26
- `;return new xo(r)}var xo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Ee=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 vP(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}},Be=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&te(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 Ti(e){return e===void 0}function AP(e){return e===null}function te(e){return Ti(e)||AP(e)}var ue=class{constructor(e={}){qe(this,"value");this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(CP(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function CP(e){return Ti(e)||uu(e)}function uu(e){return typeof e=="boolean"}var ne=class{constructor(e={}){qe(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(bP(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 bP(e){return Ti(e)||YS(e)}function YS(e){return typeof e=="number"&&!Number.isNaN(e)}var xP=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,L=class{constructor(e={}){qe(this,"value");qe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Be(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(Ti(e))return null;if(!Pi(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&&!(xP.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 Pi(e){return Object.prototype.toString.call(e)==="[object String]"}var W=class{constructor(e={}){qe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ti(e))return this.config.options.required?"value is required and is currently undefined":null;if(!KS(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&te(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 KS(e){return e!==void 0&&typeof e=="object"}var re=class{constructor(e={}){qe(this,"value");this.config=e,this.value=new Be(this.config)}validate(e){if(!te(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(te(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&&te(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 uu(e)||Pi(e)||YS(e)||KS(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function ki(e){return Array.isArray(e)}var Us=class{constructor(e){qe(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ti(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 lu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function du(e){return Array.isArray(e)}function pu(e){return e.trim()===""}function JS(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function RP(e){return btoa(encodeURI(e))}function fu(e,t){let{[e]:r,...n}=t;return n}function Oi(e){return RP(JSON.stringify(e))}var wP=new Set(["1",1,"yes",!0]);function XS(){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=>wP.has(r))}function ZS(e){let t={};for(let[r,n]of e)t[r]=n;return t}function ev(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Qs(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function mu(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 IP(e){if(pu(e.openingDelimiter)||pu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(te(e.content)||pu(e.content))return e.content;if(e.highlights.length===0)return _i(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+=_i(e.content.slice(n,a)),r+=e.openingDelimiter,r+=_i(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=_i(e.content.slice(n))),r}function Um(e,t){return e=_i(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Lm(n,t.notMatchDelimiters):o?Lm(o,t.exactMatchDelimiters):i?Lm(i,t.correctionDelimiters):r)}function Lm(e,t){return t?t.open+e+t.close:e}function _i(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();d();c();l();u();d();c();l();u();d();c();l();u();function rv(_x2,_x3){return _rv.apply(this,arguments)}function _rv(){_rv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _rv.apply(this,arguments)}function nv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=FP(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 ov(e,t,r){let n=tv(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=tv();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":EP(h,n,t);break}}}}function EP(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function FP(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function tv(){return{data:"",event:"",id:"",retry:void 0}}var Bm="text/event-stream",TP=1e3,iv="last-event-id";function av(){return typeof window<"u"}function gu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((h,v)=>{let C={...r};C.accept||(C.accept=Bm);let g;function S(){g?.abort(),document.hidden||P()}!p&&av()&&document.addEventListener("visibilitychange",S);let x=TP,w;function R(){av()&&document.removeEventListener("visibilitychange",S),clearTimeout(w),g?.abort()}t?.addEventListener("abort",()=>{R(),h()});let I=f??A,E=n??PP;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){g=s.AbortController?new s.AbortController:null;try{let V=yield I(e,{...m,headers:C,signal:g?.signal});yield E(V),yield rv(V.body,nv(ov(q=>{q?C[iv]=q:delete C[iv]},q=>{x=q},o))),i?.(),R(),h()}catch(V){if(!g?.signal?.aborted)try{let q=a?.(V)??x;clearTimeout(w),w=setTimeout(P,q)}catch(q){R(),v(q)}}});return _P2.apply(this,arguments)}P()})}function PP(e){let t=e.headers.get("content-type");if(!t?.startsWith(Bm))throw new Error(`Expected content-type to be ${Bm}, Actual: ${t}`)}d();c();l();u();var _n=class{constructor(t){qe(this,"_basePath");qe(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 kP=(e,t,r)=>new _n(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,sv=3,OP=5e3,_P="text/event-stream",Hm=1,Gm=class extends Error{},Bs=class extends Error{constructor(r){super(r.message);this.payload=r}},$m=class{constructor(){qe(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)}},hu=class{constructor(t){qe(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,v=new $m;if(!i){this.logger.error("No stream ID found");return}let C=0,g,S=()=>{g&&!v.isActive(g)&&(w?.abort(),h(),R())},x=()=>{v.remove(g),g=ev(S,g,OP),v.add(g)},w=new s.AbortController,R=()=>gu(kP(n,o,i),{method:"GET",fetch:A,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(I){return _asyncToGenerator(function*(){if(I.ok&&I.headers.get("content-type")===_P)return;throw I.status>=400&&I.status<500&&I.status!==429?new Bs({message:"Error opening stream",code:I.status}):new Gm})()},onmessage:I=>{if(w?.signal.aborted)return;let E=JSON.parse(I.data);if(E.finishReason==="ERROR"){v.remove(g),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),C=0,E.finishReason==="COMPLETED"?(v.remove(g),m()):x()},onerror:I=>{if(!w?.signal.aborted){if(v.remove(g),I instanceof Bs)throw w?.abort(),f(I),I;if(++C>sv){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:Hm};throw w?.abort(),f(E),new Bs(E)}this.logger.info(`Retrying...(${C}/${sv})`),h()}}});return R(),w}};d();c();l();u();var yu=e=>e;d();c();l();u();d();c();l();u();var vv=Cr(gv(),1);d();c();l();u();var oe=new Error("Failed to load reducers."),Ni=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."}},wo=class extends Error{constructor(r,n){super();qe(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 yv(e){return typeof e!="object"||!e?!1:Object.values(e).every(ik)}function ik(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Sv(e){return e===429}var kr=class e{static call(t){return _asyncToGenerator(function*(){let r=ak(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 A(i,a);if(Sv(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,vv.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let h=m&&Sv(m.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x4){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Ni;case 404:throw new wo(i,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new wo(i):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...f}=t,m=Qs(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 We(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function $t(e,t="prod"){return`${We(e,t)}/rest/search/v2`}function vu(e,t="prod"){return`${We(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function ak(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",f=sk(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:f}),signal:a}}function sk(e,t){return t==="application/x-www-form-urlencoded"?yv(e)?hv(e):"":JSON.stringify(e)}d();c();l();u();d();c();l();u();function Hs(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var tg=e=>{let{response:t}=e;return t.body?ck(e):uk(t)},ck=e=>dk(e)?pk(e):lk(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},uk=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function lk(e){return e.body.statusCode!==void 0}function dk(e){return e.body.exception!==void 0}var pk=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function Av(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var rg=(e,t,r,n)=>{let o=new _n(`${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 Cv=(e,t)=>{let r=new _n(`${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},ng=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield kr.call({...rg(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Hs(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Av(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return fk(a)?{success:a}:{error:tg({response:r,body:a})}});return function ng(_x5,_x6){return _ref3.apply(this,arguments)}}();function fk(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function qi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function yt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:qi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:qi(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function mk(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function gk(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Di(e,t){if(t&&e.name==="AbortError")return{error:gk(e)};if(e instanceof wo)return{error:mk(e)};throw e}var Nn=e=>e.success!==void 0,Ge=e=>e.error!==void 0;function bv(e){return e.results!==void 0}function xv(e){let t=qi();return te(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var og=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,hk=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,zs=(e,t,r,n)=>{yk(e);let o=og(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},Rv=(e,t,r)=>{Sk(e);let n=hk(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},ig=e=>{let{insightId:t,...r}=Hs(e);return r},wv=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.")},yk=e=>{if(wv(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},Sk=e=>{if(wv(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var Iv=e=>({...zs(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var Ev=e=>({...zs(e,"POST","application/json","/search"),requestParams:ig(e)}),Fv=e=>({...zs(e,"POST","application/json","/querysuggest"),requestParams:ig(e)});d();c();l();u();var Tv=e=>({...Rv(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Au=class{constructor(t){this.options=t}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield kr.call({...Iv(t),..._this.options});if(r instanceof Error)return Di(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 kr.call({...Ev(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Di(n);let o=yield n.json();return bv(o)&&(o=xv(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield kr.call({...Fv(t),..._this3.options});if(r instanceof Error)return Di(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield kr.call({...Tv(t),..._this4.options});if(r instanceof Error)return Di(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return ng(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var G=new L({required:!0,emptyAllowed:!1}),He=new L({required:!1,emptyAllowed:!1}),Ye=new L({required:!0,emptyAllowed:!0}),sH=new L({required:!1,emptyAllowed:!0}),Cu=new re({each:G,required:!0}),Pv=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),kv=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),cH=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),br=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),ur=(e,t)=>{if("required"in t)return{payload:new Ee({value:t}).validate({value:e}).value};let o=new W({options:{required:!0},values:t}).validate(e);if(o)throw new xo(o);return{payload:e}},_=(e,t)=>{try{return ur(e,t)}catch(r){return{payload:e,error:br(r)}}},lr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ov(e,t,r,o,"Controller initialization error")},mt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ov(e,t,r,o,"Controller initialization error")},Ov=(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 xt(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 vk=typeof Symbol=="function"&&Symbol.observable||"@@observable",_v=vk,ag=()=>Math.random().toString(36).substring(7).split("").join("."),Ak={INIT:`@@redux/INIT${ag()}`,REPLACE:`@@redux/REPLACE${ag()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ag()}`},bu=Ak;function Or(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 sg(e,t,r){if(typeof e!="function")throw new Error(xt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(xt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(xt(1));return r(sg)(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(xt(3));return o}function v(w){if(typeof w!="function")throw new Error(xt(4));if(f)throw new Error(xt(5));let R=!0;m();let I=p++;return a.set(I,w),function(){if(R){if(f)throw new Error(xt(6));R=!1,m(),a.delete(I),i=null}}}function C(w){if(!Or(w))throw new Error(xt(7));if(typeof w.type>"u")throw new Error(xt(8));if(typeof w.type!="string")throw new Error(xt(17));if(f)throw new Error(xt(9));try{f=!0,o=n(o,w)}finally{f=!1}return(i=a).forEach(I=>{I()}),w}function g(w){if(typeof w!="function")throw new Error(xt(10));n=w,C({type:bu.REPLACE})}function S(){let w=v;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(xt(11));function I(){let P=R;P.next&&P.next(h())}return I(),{unsubscribe:w(I)}},[_v](){return this}}}return C({type:bu.INIT}),{dispatch:C,subscribe:v,getState:h,replaceReducer:g,[_v]:S}}function Ck(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:bu.INIT})>"u")throw new Error(xt(12));if(typeof r(void 0,{type:bu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(xt(13))})}function Mi(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{Ck(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,h={};for(let v=0;v<n.length;v++){let C=n[v],g=r[C],S=p[C],x=g(S,f);if(typeof x>"u"){let w=f&&f.type;throw new Error(xt(14))}h[C]=x,m=m||x!==S}return m=m||n.length!==Object.keys(p).length,m?h:p}}function ji(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Nv(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(xt(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=ji(...p)(o.dispatch),{...o,dispatch:i}}}function Vi(e){return Or(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var yg=Symbol.for("immer-nothing"),Ws=Symbol.for("immer-draftable"),Ht=Symbol.for("immer-state");function Rt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Li=Object.getPrototypeOf;function nr(e){return!!e&&!!e[Ht]}function zt(e){return e?Lv(e)||Array.isArray(e)||!!e[Ws]||!!e.constructor?.[Ws]||Ui(e)||ec(e):!1}var bk=Object.prototype.constructor.toString(),qv=new WeakMap;function Lv(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=qv.get(r);return n===void 0&&(n=Function.toString.call(r),qv.set(r,n)),n===bk}function Sg(e){return nr(e)||Rt(15,e),e[Ht].base_}function Ys(e,t,r=!0){Eo(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Eo(e){let t=e[Ht];return t?t.type_:Array.isArray(e)?1:Ui(e)?2:ec(e)?3:0}function Ks(e,t){return Eo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function cg(e,t){return Eo(e)===2?e.get(t):e[t]}function Uv(e,t,r){let n=Eo(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function xk(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ui(e){return e instanceof Map}function ec(e){return e instanceof Set}function Io(e){return e.copy_||e.base_}function dg(e,t){if(Ui(e))return new Map(e);if(ec(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Lv(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[Ht];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(n[a]={configurable:!0,writable:!0,enumerable:p.enumerable,value:e[a]})}return Object.create(Li(e),n)}else{let n=Li(e);if(n!==null&&r)return{...e};let o=Object.create(n);return Object.assign(o,e)}}function Iu(e,t=!1){return Eu(e)||nr(e)||!zt(e)||(Eo(e)>1&&Object.defineProperties(e,{set:xu,add:xu,clear:xu,delete:xu}),Object.freeze(e),t&&Object.values(e).forEach(r=>Iu(r,!0))),e}function Rk(){Rt(2)}var xu={value:Rk};function Eu(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var pg={};function Fo(e){let t=pg[e];return t||Rt(0,e),t}function wk(e,t){pg[e]||(pg[e]=t)}var Js;function Qv(){return Js}function Ik(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Dv(e,t){t&&(Fo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fg(e){mg(e),e.drafts_.forEach(Ek),e.drafts_=null}function mg(e){e===Js&&(Js=e.parent_)}function Mv(e){return Js=Ik(Js,e)}function Ek(e){let t=e[Ht];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jv(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[Ht].modified_&&(fg(t),Rt(4)),zt(e)&&(e=Ru(t,e),t.parent_||wu(t,e)),t.patches_&&Fo("Patches").generateReplacementPatches_(r[Ht].base_,e,t.patches_,t.inversePatches_)):e=Ru(t,r,[]),fg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==yg?e:void 0}function Ru(e,t,r){if(Eu(t))return t;let n=e.immer_.shouldUseStrictIteration(),o=t[Ht];if(!o)return Ys(t,(i,a)=>Vv(e,o,t,i,a,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return wu(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;let i=o.copy_,a=i,p=!1;o.type_===3&&(a=new Set(i),i.clear(),p=!0),Ys(a,(f,m)=>Vv(e,o,i,f,m,r,p),n),wu(e,i,!1),r&&e.patches_&&Fo("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function Vv(e,t,r,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;let p=Eu(o);if(!(p&&!a)){if(nr(o)){let f=i&&t&&t.type_!==3&&!Ks(t.assigned_,n)?i.concat(n):void 0,m=Ru(e,o,f);if(Uv(r,n,m),nr(m))e.canAutoFreeze_=!1;else return}else a&&r.add(o);if(zt(o)&&!p){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&p)return;Ru(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Ui(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&wu(e,o)}}}function wu(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Iu(t,r)}function Fk(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Qv(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=vg;r&&(o=[n],i=Xs);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,p}var vg={get(e,t){if(t===Ht)return e;let r=Io(e);if(!Ks(r,t))return Tk(e,r,t);let n=r[t];return e.finalized_||!zt(n)?n:n===ug(e.base_,t)?(lg(e),e.copy_[t]=hg(n,e)):n},has(e,t){return t in Io(e)},ownKeys(e){return Reflect.ownKeys(Io(e))},set(e,t,r){let n=Bv(Io(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ug(Io(e),t),i=o?.[Ht];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(xk(r,o)&&(r!==void 0||Ks(e.base_,t)))return!0;lg(e),gg(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_[t]=!0),!0},deleteProperty(e,t){return ug(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,lg(e),gg(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Io(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Rt(11)},getPrototypeOf(e){return Li(e.base_)},setPrototypeOf(){Rt(12)}},Xs={};Ys(vg,(e,t)=>{Xs[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Xs.deleteProperty=function(e,t){return Xs.set.call(this,e,t,void 0)};Xs.set=function(e,t,r){return vg.set.call(this,e[0],t,r,e[0])};function ug(e,t){let r=e[Ht];return(r?Io(r):e)[t]}function Tk(e,t,r){let n=Bv(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Bv(e,t){if(!(t in e))return;let r=Li(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Li(r)}}function gg(e){e.modified_||(e.modified_=!0,e.parent_&&gg(e.parent_))}function lg(e){e.copy_||(e.copy_=dg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Pk=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,h=>r.call(this,h,...m))}}typeof r!="function"&&Rt(6),n!==void 0&&typeof n!="function"&&Rt(7);let o;if(zt(t)){let i=Mv(this),a=hg(t,void 0),p=!0;try{o=r(a),p=!1}finally{p?fg(i):mg(i)}return Dv(i,n),jv(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===yg&&(o=void 0),this.autoFreeze_&&Iu(o,!0),n){let i=[],a=[];Fo("Patches").generateReplacementPatches_(t,o,i,a),n(i,a)}return o}else Rt(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")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]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){zt(e)||Rt(8),nr(e)&&(e=Gv(e));let t=Mv(this),r=hg(e,void 0);return r[Ht].isManual_=!0,mg(t),r}finishDraft(e,t){let r=e&&e[Ht];(!r||!r.isManual_)&&Rt(9);let{scope_:n}=r;return Dv(n,t),jv(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=Fo("Patches").applyPatches_;return nr(e)?n(e,t):this.produce(e,o=>n(o,t))}};function hg(e,t){let r=Ui(e)?Fo("MapSet").proxyMap_(e,t):ec(e)?Fo("MapSet").proxySet_(e,t):Fk(e,t);return(t?t.scope_:Qv()).drafts_.push(r),r}function Gv(e){return nr(e)||Rt(10,e),$v(e)}function $v(e){if(!zt(e)||Eu(e))return e;let t=e[Ht],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=dg(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=dg(e,!0);return Ys(r,(o,i)=>{Uv(r,o,$v(i))},n),t&&(t.finalized_=!1),r}function Hv(){let t="replace",r="add",n="remove";function o(C,g,S,x){switch(C.type_){case 0:case 2:return a(C,g,S,x);case 1:return i(C,g,S,x);case 3:return p(C,g,S,x)}}function i(C,g,S,x){let{base_:w,assigned_:R}=C,I=C.copy_;I.length<w.length&&([w,I]=[I,w],[S,x]=[x,S]);for(let E=0;E<w.length;E++)if(R[E]&&I[E]!==w[E]){let P=g.concat([E]);S.push({op:t,path:P,value:v(I[E])}),x.push({op:t,path:P,value:v(w[E])})}for(let E=w.length;E<I.length;E++){let P=g.concat([E]);S.push({op:r,path:P,value:v(I[E])})}for(let E=I.length-1;w.length<=E;--E){let P=g.concat([E]);x.push({op:n,path:P})}}function a(C,g,S,x){let{base_:w,copy_:R}=C;Ys(C.assigned_,(I,E)=>{let P=cg(w,I),V=cg(R,I),q=E?Ks(w,I)?t:r:n;if(P===V&&q===t)return;let O=g.concat(I);S.push(q===n?{op:q,path:O}:{op:q,path:O,value:V}),x.push(q===r?{op:n,path:O}:q===n?{op:r,path:O,value:v(P)}:{op:t,path:O,value:v(P)})})}function p(C,g,S,x){let{base_:w,copy_:R}=C,I=0;w.forEach(E=>{if(!R.has(E)){let P=g.concat([I]);S.push({op:n,path:P,value:E}),x.unshift({op:r,path:P,value:E})}I++}),I=0,R.forEach(E=>{if(!w.has(E)){let P=g.concat([I]);S.push({op:r,path:P,value:E}),x.unshift({op:n,path:P,value:E})}I++})}function f(C,g,S,x){S.push({op:t,path:[],value:g===yg?void 0:g}),x.push({op:t,path:[],value:C})}function m(C,g){return g.forEach(S=>{let{path:x,op:w}=S,R=C;for(let V=0;V<x.length-1;V++){let q=Eo(R),O=x[V];typeof O!="string"&&typeof O!="number"&&(O=""+O),(q===0||q===1)&&(O==="__proto__"||O==="constructor")&&Rt(19),typeof R=="function"&&O==="prototype"&&Rt(19),R=cg(R,O),typeof R!="object"&&Rt(18,x.join("/"))}let I=Eo(R),E=h(S.value),P=x[x.length-1];switch(w){case t:switch(I){case 2:return R.set(P,E);case 3:Rt(16);default:return R[P]=E}case r:switch(I){case 1:return P==="-"?R.push(E):R.splice(P,0,E);case 2:return R.set(P,E);case 3:return R.add(E);default:return R[P]=E}case n:switch(I){case 1:return R.splice(P,1);case 2:return R.delete(P);case 3:return R.delete(S.value);default:return delete R[P]}default:Rt(17,w)}}),C}function h(C){if(!zt(C))return C;if(Array.isArray(C))return C.map(h);if(Ui(C))return new Map(Array.from(C.entries()).map(([S,x])=>[S,h(x)]));if(ec(C))return new Set(Array.from(C).map(h));let g=Object.create(Li(C));for(let S in C)g[S]=h(C[S]);return Ks(C,Ws)&&(g[Ws]=C[Ws]),g}function v(C){return nr(C)?h(C):C}wk("Patches",{applyPatches_:m,generatePatches_:o,generateReplacementPatches_:f})}var Zs=new Pk,yn=Zs.produce,Fu=Zs.produceWithPatches.bind(Zs);var Ag=Zs.applyPatches.bind(Zs);d();c();l();u();function kk(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ok(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function _k(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 zv=e=>Array.isArray(e)?e:[e];function Nk(e){let t=Array.isArray(e[0])?e[0]:e;return _k(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function qk(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var wH=Symbol();var IH=Object.getPrototypeOf({});var Dk=class{constructor(e){this.value=e}deref(){return this.value}},Mk=typeof WeakRef<"u"?WeakRef:Dk,jk=0,Wv=1;function Tu(){return{s:jk,v:void 0,o:null,p:null}}function Qi(e,t={}){let r=Tu(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let v=0,C=f;v<C;v++){let g=arguments[v];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=Tu(),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=Tu(),S.set(g,p)):p=x}}let m=p,h;if(p.s===Wv)h=p.v;else if(h=e.apply(null,arguments),i++,n){let v=o?.deref?.()??o;v!=null&&n(v,h)&&(h=v,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new Mk(h):h}return m.s=Wv,m.v=h,h}return a.clearCache=()=>{r=Tu(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function Yv(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()),kk(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let h={...r,...f},{memoize:v,memoizeOptions:C=[],argsMemoize:g=Qi,argsMemoizeOptions:S=[],devModeChecks:x={}}=h,w=zv(C),R=zv(S),I=Nk(o),E=v(function(){return i++,m.apply(null,arguments)},...w),P=!0,V=g(function(){a++;let O=qk(I,arguments);return p=E.apply(null,O),p},...R);return Object.assign(V,{resultFunc:m,memoizedResultFunc:E,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var ot=Yv(Qi),Vk=Object.assign((e,t=ot)=>{Ok(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:()=>Vk});d();c();l();u();function Kv(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Jv=Kv(),Xv=Kv;var Lk=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ji:ji.apply(null,arguments)},GH=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},Uk=e=>e&&typeof e.match=="function";function T(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(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=>Vi(n)&&n.type===e,r}var aA=class tc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,tc.prototype)}static get[Symbol.species](){return tc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new tc(...t[0].concat(this)):new tc(...t.concat(this))}};function Zv(e){return zt(e)?yn(e,()=>{}):e}function eA(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Qk(e){return typeof e=="boolean"}var Bk=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new aA;return r&&(Qk(r)?a.push(Jv):a.push(Xv(r.extraArgument))),a},rc="RTK_autoBatch",$i=()=>e=>({payload:e,meta:{[rc]:!0}}),tA=e=>t=>{setTimeout(t,e)},Gk=(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:tA(10):e.type==="callback"?e.queueNotification:tA(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>o&&h(),C=n.subscribe(v);return p.add(h),()=>{C(),p.delete(h)}},dispatch(h){try{return o=!h?.meta?.[rc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(h)}finally{o=!0}}})},$k=e=>function(r){let{autoBatch:n=!0}=r??{},o=new aA(e);return n&&o.push(Gk(typeof n=="object"?n:void 0)),o};function sA(e){let t=Bk(),{reducer:r=void 0,middleware:n,devTools:o=!0,preloadedState:i=void 0,enhancers:a=void 0}=e||{},p;if(typeof r=="function")p=r;else if(Or(r))p=Mi(r);else throw new Error(Lt(1));let f;typeof n=="function"?f=n(t):f=t();let m=ji;o&&(m=Lk({trace:!1,...(typeof o=="object"&&o)}));let h=Nv(...f),v=$k(h),C=typeof a=="function"?a(v):v(),g=m(...C);return sg(p,i,g)}function cA(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(Lt(28));if(p in t)throw new Error(Lt(29));return t[p]=a,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 Hk(e){return typeof e=="function"}function ce(e,t){let[r,n,o]=cA(t),i;if(Hk(e))i=()=>Zv(e());else{let p=Zv(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,v)=>{if(v)if(nr(h)){let g=v(h,f);return g===void 0?h:g}else{if(zt(h))return yn(h,C=>v(C,f));{let C=v(h,f);if(C===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return h},p)}return a.getInitialState=i,a}var uA=(e,t)=>Uk(e)?e.match(t):e(t);function _r(...e){return t=>e.some(r=>uA(r,t))}function Gi(...e){return t=>e.every(r=>uA(r,t))}function _u(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 nc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Nu(...e){return e.length===0?t=>_u(t,["pending"]):nc(e)?_r(...e.map(t=>t.pending)):Nu()(e[0])}function ko(...e){return e.length===0?t=>_u(t,["rejected"]):nc(e)?_r(...e.map(t=>t.rejected)):ko()(e[0])}function oc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Gi(ko(...e),t):nc(e)?Gi(ko(...e),t):oc()(e[0])}function Sn(...e){return e.length===0?t=>_u(t,["fulfilled"]):nc(e)?_r(...e.map(t=>t.fulfilled)):Sn()(e[0])}function qu(...e){return e.length===0?t=>_u(t,["pending","fulfilled","rejected"]):nc(e)?_r(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):qu()(e[0])}var zk="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ic=(e=21)=>{let t="",r=e;for(;r--;)t+=zk[Math.random()*64|0];return t},Wk=["name","message","stack","code"],Cg=class{constructor(e,t){qe(this,"_type");this.payload=e,this.meta=t}},rA=class{constructor(e,t){qe(this,"_type");this.payload=e,this.meta=t}},Yk=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Wk)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},le=(()=>{function e(t,r,n){let o=T(t+"/fulfilled",(f,m,h,v)=>({payload:f,meta:{...(v||{}),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,v,C)=>({payload:v,error:(n&&n.serializeError||Yk)(f||"Rejected"),meta:{...(C||{}),arg:h,requestId:m,rejectedWithValue:!!v,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f){return(m,h,v)=>{let C=n?.idGenerator?n.idGenerator(f):ic(),g=new s.AbortController,S,x;function w(I){x=I,g.abort()}let R=_asyncToGenerator(function*(){let I;try{let P=n?.condition?.(f,{getState:h,extra:v});if(Jk(P)&&(P=yield P),P===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let V=new Promise((q,O)=>{S=()=>{O({name:"AbortError",message:x||"Aborted"})},g.signal.addEventListener("abort",S)});m(i(C,f,n?.getPendingMeta?.({requestId:C,arg:f},{getState:h,extra:v}))),I=yield Promise.race([V,Promise.resolve(r(f,{dispatch:m,getState:h,extra:v,requestId:C,signal:g.signal,abort:w,rejectWithValue:(q,O)=>new Cg(q,O),fulfillWithValue:(q,O)=>new rA(q,O)})).then(q=>{if(q instanceof Cg)throw q;return q instanceof rA?o(q.payload,C,f,q.meta):o(q,C,f)})])}catch(P){I=P instanceof Cg?a(null,C,f,P.payload,P.meta):a(P,C,f)}finally{S&&g.signal.removeEventListener("abort",S)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||m(I),I})();return Object.assign(R,{abort:w,requestId:C,arg:f,unwrap(){return R.then(Kk)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:_r(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Kk(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Jk(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var lA=Symbol.for("rtk-slice-createasyncthunk"),YH={[lA]:le};function Xk(e,t){return`${e}/${t}`}function Zk({creators:e}={}){let t=e?.asyncThunk?.[lA];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(tO()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(I,E){let P=typeof I=="string"?I:I.type;if(!P)throw new Error(Lt(12));if(P in f.sliceCaseReducersByType)throw new Error(Lt(13));return f.sliceCaseReducersByType[P]=E,m},addMatcher(I,E){return f.sliceMatchers.push({matcher:I,reducer:E}),m},exposeAction(I,E){return f.actionCreators[I]=E,m},exposeCaseReducer(I,E){return f.sliceCaseReducersByName[I]=E,m}};p.forEach(I=>{let E=a[I],P={reducerName:I,type:Xk(o,I),createNotation:typeof n.reducers=="function"};nO(E)?iO(P,E,m,t):rO(P,E,m)});function h(){let[I={},E=[],P=void 0]=typeof n.extraReducers=="function"?cA(n.extraReducers):[n.extraReducers],V={...I,...f.sliceCaseReducersByType};return ce(n.initialState,q=>{for(let O in V)q.addCase(O,V[O]);for(let O of f.sliceMatchers)q.addMatcher(O.matcher,O.reducer);for(let O of E)q.addMatcher(O.matcher,O.reducer);P&&q.addDefaultCase(P)})}let v=I=>I,C=new Map,g;function S(I,E){return g||(g=h()),g(I,E)}function x(){return g||(g=h()),g.getInitialState()}function w(I,E=!1){function P(q){let O=q[I];return typeof O>"u"&&E&&(O=x()),O}function V(q=v){let O=eA(C,E,()=>new WeakMap);return eA(O,q,()=>{let N={};for(let[M,U]of Object.entries(n.selectors??{}))N[M]=eO(U,q,x,E);return N})}return{reducerPath:I,getSelectors:V,get selectors(){return V(P)},selectSlice:P}}let R={name:o,reducer:S,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:x,...w(i),injectInto(I,{reducerPath:E,...P}={}){let V=E??i;return I.inject({reducerPath:V,reducer:S},P),{...R,...w(V,!0)}}};return R}}function eO(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 Oo=Zk();function tO(){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 rO({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!oO(n))throw new Error(Lt(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 nO(e){return e._reducerDefinitionType==="asyncThunk"}function oO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iO({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:h}=r,v=o(e,i,h);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),p&&n.addCase(v.pending,p),f&&n.addCase(v.rejected,f),m&&n.addMatcher(v.settled,m),n.exposeCaseReducer(t,{fulfilled:a||Pu,pending:p||Pu,rejected:f||Pu,settled:m||Pu})}function Pu(){}var aO="task",dA="listener",pA="completed",Rg="cancelled",sO=`task-${Rg}`,cO=`task-${pA}`,bg=`${dA}-${Rg}`,uO=`${dA}-${pA}`,Du=class{constructor(e){qe(this,"name","TaskAbortError");qe(this,"message");this.code=e,this.message=`${aO} ${Rg} (reason: ${e})`}},wg=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},ku=()=>{},fA=(e,t=ku)=>(e.catch(t),e),mA=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),To=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},Po=e=>{if(e.aborted){let{reason:t}=e;throw new Du(t)}};function gA(e,t){let r=ku;return new Promise((n,o)=>{let i=()=>o(new Du(e.reason));if(e.aborted){i();return}r=mA(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=ku})}var lO=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Du?"cancelled":"rejected",error:r}}finally{t?.()}});return function lO(_x7,_x8){return _ref5.apply(this,arguments)}}(),Ou=e=>t=>fA(gA(e,t).then(r=>(Po(e),r))),hA=e=>{let t=Ou(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Bi}=Object,nA={},Mu="listenerMiddleware",dO=(e,t)=>{let r=n=>mA(e,()=>To(n,e.reason));return(n,o)=>{wg(n,"taskExecutor");let i=new s.AbortController;r(i);let a=lO(/*#__PURE__*/_asyncToGenerator(function*(){Po(e),Po(i.signal);let p=yield n({pause:Ou(i.signal),delay:hA(i.signal),signal:i.signal});return Po(i.signal),p}),()=>To(i,cO));return o?.autoJoin&&t.push(a.catch(ku)),{result:Ou(e)(a),cancel(){To(i,sO)}}}},pO=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Po(t);let i=()=>{},p=[new Promise((f,m)=>{let h=e({predicate:n,effect:(v,C)=>{C.unsubscribe(),f([v,C.getState(),C.getOriginalState()])}});i=()=>{h(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield gA(t,Promise.race(p));return Po(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>fA(r(n,o))},yA=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(Lt(21));return wg(i,"options.listener"),{predicate:o,type:t,effect:i}},SA=Bi(e=>{let{type:t,predicate:r,effect:n}=yA(e);return{id:ic(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>SA}),oA=(e,t)=>{let{type:r,effect:n,predicate:o}=yA(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},xg=e=>{e.pending.forEach(t=>{To(t,bg)})},fO=e=>()=>{e.forEach(xg),e.clear()},iA=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},vA=Bi(T(`${Mu}/add`),{withTypes:()=>vA}),mO=T(`${Mu}/removeAll`),AA=Bi(T(`${Mu}/remove`),{withTypes:()=>AA}),gO=(...e)=>{console.error(`${Mu}/error`,...e)},CA=(e={})=>{let t=new Map,{extra:r,onError:n=gO}=e;wg(n,"onError");let o=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),v=>{h.unsubscribe(),v?.cancelActive&&xg(h)}),i=h=>{let v=oA(t,h)??SA(h);return o(v)};Bi(i,{withTypes:()=>i});let a=h=>{let v=oA(t,h);return v&&(v.unsubscribe(),h.cancelActive&&xg(v)),!!v};Bi(a,{withTypes:()=>a});let p=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,v,C,g){let S=new s.AbortController,x=pO(i,S.signal),w=[];try{h.pending.add(S),yield Promise.resolve(h.effect(v,Bi({},C,{getOriginalState:g,condition:(R,I)=>x(R,I).then(Boolean),take:x,delay:hA(S.signal),pause:Ou(S.signal),extra:r,signal:S.signal,fork:dO(S.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((R,I,E)=>{R!==S&&(To(R,bg),E.delete(R))})},cancel:()=>{To(S,bg),h.pending.delete(S)},throwIfCancelled:()=>{Po(S.signal)}})))}catch(R){R instanceof Du||iA(n,R,{raisedBy:"effect"})}finally{yield Promise.all(w),To(S,uO),h.pending.delete(S)}});return function p(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),f=fO(t);return{middleware:h=>v=>C=>{if(!Vi(C))return v(C);if(vA.match(C))return i(C.payload);if(mO.match(C)){f();return}if(AA.match(C))return a(C.payload);let g=h.getState(),S=()=>{if(g===nA)throw new Error(Lt(23));return g},x;try{if(x=v(C),t.size>0){let w=h.getState(),R=Array.from(t.values());for(let I of R){let E=!1;try{E=I.predicate(C,w,g)}catch(P){E=!1,iA(n,P,{raisedBy:"predicate"})}E&&p(I,C,h,S)}}}finally{g=nA}return x},startListening:i,stopListening:a,clearListeners:f}};var JH=Symbol.for("rtk-state-proxy-original");function Lt(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();d();c();l();u();d();c();l();u();var bA=/^(?:[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 hO(e){return typeof e=="string"&&bA.test(e)}var Ig=hO;d();c();l();u();var wt=[];for(let e=0;e<256;++e)wt.push((e+256).toString(16).slice(1));function xA(e,t=0){return(wt[e[t+0]]+wt[e[t+1]]+wt[e[t+2]]+wt[e[t+3]]+"-"+wt[e[t+4]]+wt[e[t+5]]+"-"+wt[e[t+6]]+wt[e[t+7]]+"-"+wt[e[t+8]]+wt[e[t+9]]+"-"+wt[e[t+10]]+wt[e[t+11]]+wt[e[t+12]]+wt[e[t+13]]+wt[e[t+14]]+wt[e[t+15]]).toLowerCase()}d();c();l();u();var Eg,yO=new Uint8Array(16);function Fg(){if(!Eg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Eg=crypto.getRandomValues.bind(crypto)}return Eg(yO)}d();c();l();u();d();c();l();u();var SO=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Tg={randomUUID:SO};function vO(e,t,r){e=e||{};let n=e.random??e.rng?.()??Fg();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 xA(n)}function AO(e,t,r){return Tg.randomUUID&&!t&&!e?Tg.randomUUID():vO(e,t,r)}var Pg=AO;d();c();l();u();function RA(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}function CO({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;a!=="disabled"&&(n.call(r),t.send(o,i,r))}var wA="visitorId";function bO(e){return{getClientId:()=>{let t=e.get(),r=t.storage,n=r.getItem(wA),o=n&&Ig(n)?n:t.generateUUID();return r.setItem(wA,o),o}}}var PA="1.2.15",kg=128,kA=192,IA=224,EA=240,xO=248;function RO(e){return(e&xO)===EA?4:(e&EA)===IA?3:(e&IA)===kA?2:1}function wO(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&kg)!=kg)break;if(r-=3,(n&kA)!=kg){t-r>=RO(n)*3&&(r=t);break}}return e.substring(0,r)}function IO(e){let{trackingId:t}=e;return{trackingId:t}}function EO(e){return(e.source||[]).concat([`relay@${PA}`])}function OA(e,t,r,n){let{getReferrer:o,getLocation:i,getUserAgent:a}=r,p=IO(t),f=n.getClientId();return Object.freeze({type:e,config:p,ts:Date.now(),source:EO(t),clientId:f,userAgent:a(),referrer:FA(o()),location:FA(i())})}function FA(e){return e!==null?wO(e,1024):null}function FO(e,t,r,n,o){return{...t,meta:OA(e,r,n,o)}}var TO="*";function PO(){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===TO)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 TA({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 kO(e){let t=TA(e);return{get:()=>t,update:r=>{t=TA({...t,...r})}}}var Og=OO();function OO(){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 _O(){return{getItem(e){return Og.getItem(e)||localStorage.getItem(e)},removeItem(e){Og.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Og.setItem(e,t,31556952e3)}}}function NO(){let e=document.referrer;return e===""?null:e}function _g(){return{runtime:"browser",send:(e,t,r)=>{let n=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([r])],{type:"application/json"}));if(RA().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:e,token:t}),!n)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>NO(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>Pg(),storage:_O()}}function qO(){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 DO(){return{getItem(){return null},removeItem(){},setItem(){}}}function MO(){return{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:DO()}}function jO(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=MO();return t&&r?{storage:n.storage,...r,runtime:"custom"}:t&&VO()&&qO()?_g():n}function VO(){try{return typeof window=="object"}catch{return!1}}function LO(e){return{get:()=>Object.freeze(jO(e))}}function _A(e){let t=kO(e),r=PO(),n=LO(t),o=bO(n);return{emit:(i,a)=>{let p=t.get(),f=n.get(),m=FO(i,a,p,f,o);return CO({config:p,environment:f,event:m,listenerManager:r})},getMeta:i=>OA(i,t.get(),n.get(),o),on:(i,a)=>r.add({type:i,callback:a}),off:(i,a)=>r.remove(i,a),updateConfig:i=>t.update(i),version:PA}}d();c();l();u();function NA(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var qn="3.47.0",qA=["@coveo/atomic","@coveo/quantic"];var Hi=ot(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${qn}`));var ac=ot(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Hi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=QO(p);return _A({mode:i?"emit":"disabled",url:o??vu(e,t),token:r,trackingId:n??null,source:a,environment:f})}),UO={generateUUID:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:()=>{},storage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}},QO=e=>{if(!e)return;let t=e();return{...(NA()?_g():UO),generateUUID:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Nr(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 j(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(v){a(v)}}function f(h){try{m(n.throw(h))}catch(v){a(v)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var ke;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ke||(ke={}));function Dg(){return typeof window<"u"}function Kg(){return typeof navigator<"u"}function zi(){return typeof document<"u"}function Mg(){try{return typeof localStorage<"u"}catch{return!1}}function BO(){try{return typeof sessionStorage<"u"}catch{return!1}}function WA(){return Kg()&&navigator.cookieEnabled}var GO=[ke.click,ke.custom,ke.search,ke.view],$O=(e,t)=>GO.indexOf(e)!==-1?Object.assign({language:zi()?document.documentElement.lang:"unknown",userAgent:Kg()?navigator.userAgent:"unknown"},t):t,cc=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?DA(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],DA(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 DA(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function HO(){return Mg()?localStorage:WA()?new uc:BO()?sessionStorage:new Yi}var uc=class e{getItem(t){return cc.get(`${e.prefix}${t}`)}removeItem(t){cc.erase(`${e.prefix}${t}`)}setItem(t,r,n){cc.set(`${e.prefix}${t}`,r,n)}};uc.prefix="coveo_";var jg=class{constructor(){this.cookieStorage=new uc}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)}},Yi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ju="__coveo.analytics.history",zO=20,WO=1e3*60,YO=75,Uu=class{constructor(t){this.store=t||HO()}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 j(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 j(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ju);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return j(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ju);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ju,JSON.stringify(t.slice(0,zO)))}catch{}}clear(){try{this.store.removeItem(ju)}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,YO)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>WO:!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 KO=(e,t)=>j(void 0,void 0,void 0,function*(){return e===ke.view?(yield JO(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),JO=e=>j(void 0,void 0,void 0,function*(){let t=new Uu,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Vu,XO=new Uint8Array(16);function ZO(){if(!Vu&&(Vu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vu(XO)}var e_=/^(?:[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 Qu(e){return typeof e=="string"&&e_.test(e)}var It=[];for(let e=0;e<256;++e)It.push((e+256).toString(16).slice(1));function YA(e,t=0){return It[e[t+0]]+It[e[t+1]]+It[e[t+2]]+It[e[t+3]]+"-"+It[e[t+4]]+It[e[t+5]]+"-"+It[e[t+6]]+It[e[t+7]]+"-"+It[e[t+8]]+It[e[t+9]]+"-"+It[e[t+10]]+It[e[t+11]]+It[e[t+12]]+It[e[t+13]]+It[e[t+14]]+It[e[t+15]]}function t_(e){if(!Qu(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 r_(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var n_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function i_(e,t,r){function n(o,i,a,p){var f;if(typeof o=="string"&&(o=r_(o)),typeof i=="string"&&(i=t_(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 YA(m)}try{n.name=e}catch{}return n.DNS=n_,n.URL=o_,n}var a_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),MA={randomUUID:a_};function _o(e,t,r){if(MA.randomUUID&&!t&&!e)return MA.randomUUID();e=e||{};let n=e.random||(e.rng||ZO)();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 YA(n)}function s_(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 Ng(e,t){return e<<t|e>>>32-t}function c_(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]=Ng(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);let f=r[0],m=r[1],h=r[2],v=r[3],C=r[4];for(let g=0;g<80;++g){let S=Math.floor(g/20),x=Ng(f,5)+s_(S,m,h,v)+C+t[S]+p[g]>>>0;C=v,v=h,h=Ng(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]+v>>>0,r[4]=r[4]+C>>>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 u_=i_("v5",80,c_),jA=u_,KA="2.30.52",VA=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,sc={pageview:"pageview",event:"event"},Bu=class{constructor({client:t,uuidGenerator:r=_o}){this.client=t,this.uuidGenerator=r}},Vg=class extends Bu{constructor({client:t,uuidGenerator:r=_o}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=VA(window.location),this.lastReferrer=zi()?document.referrer:"",this.addHooks()}getApi(t){switch(t){case"setAction":return this.setAction;default:return 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:zi()?document.title:"",encoding:zi()?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===sc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===sc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===sc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===sc.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 VA(window.location)}},Dn=class e{constructor(t,r){if(!Qu(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 Qu(i)?new e(i,Number.parseInt(o)*1e3):null}};Dn.cvo_cid="cvo_cid";Dn.expirationTime=120;var Lg=class extends Bu{constructor({client:t,uuidGenerator:r=_o}){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 j(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(Dn.cvo_cid,new Dn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Lg.Id="link";var pr=Object.keys;function Lu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var qg=128,JA=192,LA=224,UA=240;function l_(e){return(e&248)===UA?4:(e&UA)===LA?3:(e&LA)===JA?2:1}function d_(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&qg)!=qg)break;if(r-=3,(n&JA)!=qg){t-r>=l_(n)*3&&(r=t);break}}return e.substring(0,r)}var Ug={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"},p_=pr(Ug).map(e=>Ug[e]),f_=[...p_].join("|"),m_=new RegExp(`^(${f_}$)`),g_={svcAction:"svc_action",svcActionData:"svc_action_data"},h_=e=>pr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Ug[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),y_=e=>m_.test(e),S_=[y_],QA={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},BA={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},_t={action:"pa",list:"pal",listSource:"pls"},Gu={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},v_=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Qg={id:"quoteId",affiliation:"quoteAffiliation"},Bg={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},A_={add:_t,bookmark_add:_t,bookmark_remove:_t,click:_t,checkout:_t,checkout_option:_t,detail:_t,impression:_t,remove:_t,refund:Object.assign(Object.assign({},_t),Gu),purchase:Object.assign(Object.assign({},_t),Gu),quickview:_t,quote:Object.assign(Object.assign({},_t),Qg),review:Object.assign(Object.assign({},_t),Bg)},C_=pr(QA).map(e=>QA[e]),b_=pr(BA).map(e=>BA[e]),x_=pr(_t).map(e=>_t[e]),R_=pr(Gu).map(e=>Gu[e]),w_=pr(Bg).map(e=>Bg[e]),I_=pr(Qg).map(e=>Qg[e]),E_=[...C_,"custom"].join("|"),F_=[...b_,"custom"].join("|"),XA="(pr[0-9]+)",ZA="(il[0-9]+pi[0-9]+)",T_=new RegExp(`^${XA}(${E_})$`),P_=new RegExp(`^(${ZA}(${F_}))|(il[0-9]+nm)$`),k_=new RegExp(`^(${x_.join("|")})$`),O_=new RegExp(`^(${R_.join("|")})$`),__=new RegExp(`^${XA}custom$`),N_=new RegExp(`^${ZA}custom$`),q_=new RegExp(`^(${[...v_,...w_,...I_].join("|")})$`),D_=e=>T_.test(e),M_=e=>P_.test(e),j_=e=>k_.test(e),V_=e=>O_.test(e),L_=e=>q_.test(e),U_=[M_,D_,j_,V_,L_],Q_=[__,N_],B_={anonymizeIp:"aip"},G_={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},$_={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},H_=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],z_=Object.assign(Object.assign(Object.assign(Object.assign({},B_),G_),$_),H_.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Gg=Object.assign(Object.assign({},z_),g_),W_=e=>{let t=!!e.action&&A_[e.action]||{};return pr(e).reduce((r,n)=>{let o=t[n]||Gg[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Y_=pr(Gg).map(e=>Gg[e]),K_=e=>Y_.indexOf(e)!==-1,J_=e=>e==="custom",X_=e=>[...U_,...S_,K_,J_].some(t=>t(e)),Z_=e=>pr(e).reduce((t,r)=>{let n=eN(r);return n?Object.assign(Object.assign({},t),tN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),eN=e=>{let t;return[...Q_].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},tN=(e,t)=>pr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),$g=class{constructor(t){this.opts=t}sendEvent(t,r){return j(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 j(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 j(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[ke.click,ke.custom,ke.search,ke.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}},Hg=class{sendEvent(t,r){return j(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return j(this,void 0,void 0,function*(){return Promise.resolve()})}},GA=y.fetch,$u=class{constructor(t){this.opts=t}sendEvent(t,r){return j(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=Nr(f,["url"]),v;try{v=yield GA(m,h)}catch(C){console.error("An error has occured when sending the event.",C);return}if(v.ok){let C=yield v.json();return C.visitorId&&o.setCurrentVisitorId(C.visitorId),C}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return j(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield GA(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ke.click,ke.custom,ke.search,ke.view].indexOf(t)!==-1}getVisitorIdParam(){return j(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"})}},zg=class{constructor(t,r){Mg()&&WA()?this.storage=new jg:Mg()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Yi),this.client=new $u(t),this.beaconClient=new $g(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}},Wg=class{constructor(t,r){this.storage=r||new Yi,this.client=new $u(t)}getClientDependingOnEventType(t){return this.client}},Hu=class{constructor(){this.storage=new Yi,this.client=new Hg}getClientDependingOnEventType(t){return this.client}},rN="xx",nN=e=>e?.startsWith(rN)||!1,oN=`
26
+ `;return new xo(r)}var xo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Ee=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 CP(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}},Be=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&te(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 ki(e){return e===void 0}function bP(e){return e===null}function te(e){return ki(e)||bP(e)}var ue=class{constructor(e={}){qe(this,"value");this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(xP(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function xP(e){return ki(e)||du(e)}function du(e){return typeof e=="boolean"}var ne=class{constructor(e={}){qe(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(RP(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 RP(e){return ki(e)||nv(e)}function nv(e){return typeof e=="number"&&!Number.isNaN(e)}var wP=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,L=class{constructor(e={}){qe(this,"value");qe(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Be(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(ki(e))return null;if(!Oi(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&&!(wP.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 Oi(e){return Object.prototype.toString.call(e)==="[object String]"}var W=class{constructor(e={}){qe(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(ki(e))return this.config.options.required?"value is required and is currently undefined":null;if(!ov(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&te(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 ov(e){return e!==void 0&&typeof e=="object"}var re=class{constructor(e={}){qe(this,"value");this.config=e,this.value=new Be(this.config)}validate(e){if(!te(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(te(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&&te(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 du(e)||Oi(e)||nv(e)||ov(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function _i(e){return Array.isArray(e)}var Us=class{constructor(e){qe(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t!==null?t:ki(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 pu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function fu(e){return Array.isArray(e)}function mu(e){return e.trim()===""}function iv(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function IP(e){return btoa(encodeURI(e))}function gu(e,t){let{[e]:r,...n}=t;return n}function Ni(e){return IP(JSON.stringify(e))}var EP=new Set(["1",1,"yes",!0]);function av(){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=>EP.has(r))}function sv(e){let t={};for(let[r,n]of e)t[r]=n;return t}function cv(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Qs(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function hu(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 FP(e){if(mu(e.openingDelimiter)||mu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(te(e.content)||mu(e.content))return e.content;if(e.highlights.length===0)return qi(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+=qi(e.content.slice(n,a)),r+=e.openingDelimiter,r+=qi(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=qi(e.content.slice(n))),r}function Km(e,t){return e=qi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Ym(n,t.notMatchDelimiters):o?Ym(o,t.exactMatchDelimiters):i?Ym(i,t.correctionDelimiters):r)}function Ym(e,t){return t?t.open+e+t.close:e}function qi(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 Av=Cr(hv(),1);d();c();l();u();var oe=new Error("Failed to load reducers."),Di=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."}},wo=class extends Error{constructor(r,n){super();qe(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 yv(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Sv(e){return typeof e!="object"||!e?!1:Object.values(e).every(ek)}function ek(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function vv(e){return e===429}var kr=class e{static call(t){return _asyncToGenerator(function*(){let r=tk(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(vv(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,Av.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let h=m&&vv(m.status);return h&&(n.info("Platform retrying request"),yield new Promise(A=>setTimeout(A,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 Di;case 404:throw new wo(i,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new wo(i):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...f}=t,m=Qs(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 We(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function $t(e,t="prod"){return`${We(e,t)}/rest/search/v2`}function Su(e,t="prod"){return`${We(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function tk(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",f=rk(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:f}),signal:a}}function rk(e,t){return t==="application/x-www-form-urlencoded"?Sv(e)?yv(e):"":JSON.stringify(e)}d();c();l();u();var $s=Cr(vu(),1),Iv=Cr(Cv(),1);d();c();l();u();var Au=Cr(vu(),1),xv=Cr(bv(),1);Au.default.extend(xv.default);var Rv="YYYY/MM/DD@HH:mm:ss",nk="1401-01-01";function Mi(e,t){let r=(0,Au.default)(e,t);return!r.isValid()&&!t?(0,Au.default)(e,Rv):r}function Cu(e){return e.format(Rv)}function wv(e,t){let r=Mi(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}`)}pg(r)}function pg(e){if(e.isBefore(nk))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}$s.default.extend(Iv.default);var Ev=["past","now","next"],Fv=["minute","hour","day","week","month","quarter","year"],ok=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new L({required:!t,constrainTo:Fv}),period:new L({required:!0,constrainTo:Ev})}};function bu(e){if(typeof e=="string"&&!_n(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?fg(e):e;new Ee(ok(t.period)).validate(t);let r=Pv(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);pg(r)}function Tv(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Pv(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,$s.default)().subtract(r,n);case"next":return(0,$s.default)().add(r,n);case"now":return(0,$s.default)()}}function Hs(e){return Cu(Pv(fg(e)))}function kv(e){return e.toLocaleLowerCase().split("-")}function _n(e){let[t,r,n]=kv(e);if(t==="now")return!0;if(!Ev.includes(t)||!Fv.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Ov(e){return!!e&&typeof e=="object"&&"period"in e}function fg(e){let[t,r,n]=kv(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function _v(e){return bu(e),fg(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function qv(_x3,_x4){return _qv.apply(this,arguments)}function _qv(){_qv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _qv.apply(this,arguments)}function Dv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=ak(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 Mv(e,t,r){let n=Nv(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=Nv();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":ik(h,n,t);break}}}}function ik(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function ak(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Nv(){return{data:"",event:"",id:"",retry:void 0}}var mg="text/event-stream",sk=1e3,jv="last-event-id";function Vv(){return typeof window<"u"}function xu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:f,...m}){return new Promise((h,A)=>{let S={...r};S.accept||(S.accept=mg);let g;function C(){g?.abort(),document.hidden||P()}!p&&Vv()&&document.addEventListener("visibilitychange",C);let x=sk,w;function R(){Vv()&&document.removeEventListener("visibilitychange",C),clearTimeout(w),g?.abort()}t?.addEventListener("abort",()=>{R(),h()});let E=f??v,F=n??ck;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){g=s.AbortController?new s.AbortController:null;try{let V=yield E(e,{...m,headers:S,signal:g?.signal});yield F(V),yield qv(V.body,Dv(Mv(q=>{q?S[jv]=q:delete S[jv]},q=>{x=q},o))),i?.(),R(),h()}catch(V){if(!g?.signal?.aborted)try{let q=a?.(V)??x;clearTimeout(w),w=setTimeout(P,q)}catch(q){R(),A(q)}}});return _P2.apply(this,arguments)}P()})}function ck(e){let t=e.headers.get("content-type");if(!t?.startsWith(mg))throw new Error(`Expected content-type to be ${mg}, Actual: ${t}`)}d();c();l();u();var Nn=class{constructor(t){qe(this,"_basePath");qe(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 uk=(e,t,r)=>new Nn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,Lv=3,lk=5e3,dk="text/event-stream",yg=1,gg=class extends Error{},zs=class extends Error{constructor(r){super(r.message);this.payload=r}},hg=class{constructor(){qe(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)}},Ru=class{constructor(t){qe(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,A=new hg;if(!i){this.logger.error("No stream ID found");return}let S=0,g,C=()=>{g&&!A.isActive(g)&&(w?.abort(),h(),R())},x=()=>{A.remove(g),g=cv(C,g,lk),A.add(g)},w=new s.AbortController,R=()=>xu(uk(n,o,i),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(E){return _asyncToGenerator(function*(){if(E.ok&&E.headers.get("content-type")===dk)return;throw E.status>=400&&E.status<500&&E.status!==429?new zs({message:"Error opening stream",code:E.status}):new gg})()},onmessage:E=>{if(w?.signal.aborted)return;let F=JSON.parse(E.data);if(F.finishReason==="ERROR"){A.remove(g),w?.abort(),f({message:F.errorMessage,code:F.statusCode});return}p(F),S=0,F.finishReason==="COMPLETED"?(A.remove(g),m()):x()},onerror:E=>{if(!w?.signal.aborted){if(A.remove(g),E instanceof zs)throw w?.abort(),f(E),E;if(++S>Lv){this.logger.info("Maximum retry exceeded.");let F={message:"Failed to complete stream.",code:yg};throw w?.abort(),f(F),new zs(F)}this.logger.info(`Retrying...(${S}/${Lv})`),h()}}});return R(),w}};d();c();l();u();var wu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function Ws(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Sg=e=>{let{response:t}=e;return t.body?pk(e):fk(t)},pk=e=>gk(e)?hk(e):mk(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},fk=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function mk(e){return e.body.statusCode!==void 0}function gk(e){return e.body.exception!==void 0}var hk=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function Uv(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var vg=(e,t,r,n)=>{let o=new Nn(`${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 Qv=(e,t)=>{let r=new Nn(`${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},Ag=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield kr.call({...vg(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Ws(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Uv(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return yk(a)?{success:a}:{error:Sg({response:r,body:a})}});return function Ag(_x5,_x6){return _ref3.apply(this,arguments)}}();function yk(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function ji(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function yt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:ji(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:ji(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function Sk(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function vk(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Vi(e,t){if(t&&e.name==="AbortError")return{error:vk(e)};if(e instanceof wo)return{error:Sk(e)};throw e}var qn=e=>e.success!==void 0,Ge=e=>e.error!==void 0;function Bv(e){return e.results!==void 0}function Gv(e){let t=ji();return te(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Cg=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,Ak=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,Ys=(e,t,r,n)=>{Ck(e);let o=Cg(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},$v=(e,t,r)=>{bk(e);let n=Ak(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},bg=e=>{let{insightId:t,...r}=Ws(e);return r},Hv=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.")},Ck=e=>{if(Hv(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},bk=e=>{if(Hv(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var zv=e=>({...Ys(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var Wv=e=>({...Ys(e,"POST","application/json","/search"),requestParams:bg(e)}),Yv=e=>({...Ys(e,"POST","application/json","/querysuggest"),requestParams:bg(e)});d();c();l();u();var Kv=e=>({...$v(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Iu=class{constructor(t){this.options=t}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield kr.call({...zv(t),..._this.options});if(r instanceof Error)return Vi(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 kr.call({...Wv(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Vi(n);let o=yield n.json();return Bv(o)&&(o=Gv(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield kr.call({...Yv(t),..._this3.options});if(r instanceof Error)return Vi(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield kr.call({...Kv(t),..._this4.options});if(r instanceof Error)return Vi(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return Ag(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var G=new L({required:!0,emptyAllowed:!1}),He=new L({required:!1,emptyAllowed:!1}),Ye=new L({required:!0,emptyAllowed:!0}),EH=new L({required:!1,emptyAllowed:!0}),Eu=new re({each:G,required:!0}),Xv=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Jv=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),FH=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),br=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),ur=(e,t)=>{if("required"in t)return{payload:new Ee({value:t}).validate({value:e}).value};let o=new W({options:{required:!0},values:t}).validate(e);if(o)throw new xo(o);return{payload:e}},_=(e,t)=>{try{return ur(e,t)}catch(r){return{payload:e,error:br(r)}}},lr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Zv(e,t,r,o,"Controller initialization error")},mt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Zv(e,t,r,o,"Controller initialization error")},Zv=(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 xt(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 xk=typeof Symbol=="function"&&Symbol.observable||"@@observable",eA=xk,xg=()=>Math.random().toString(36).substring(7).split("").join("."),Rk={INIT:`@@redux/INIT${xg()}`,REPLACE:`@@redux/REPLACE${xg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xg()}`},Fu=Rk;function Or(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 Rg(e,t,r){if(typeof e!="function")throw new Error(xt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(xt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(xt(1));return r(Rg)(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(xt(3));return o}function A(w){if(typeof w!="function")throw new Error(xt(4));if(f)throw new Error(xt(5));let R=!0;m();let E=p++;return a.set(E,w),function(){if(R){if(f)throw new Error(xt(6));R=!1,m(),a.delete(E),i=null}}}function S(w){if(!Or(w))throw new Error(xt(7));if(typeof w.type>"u")throw new Error(xt(8));if(typeof w.type!="string")throw new Error(xt(17));if(f)throw new Error(xt(9));try{f=!0,o=n(o,w)}finally{f=!1}return(i=a).forEach(E=>{E()}),w}function g(w){if(typeof w!="function")throw new Error(xt(10));n=w,S({type:Fu.REPLACE})}function C(){let w=A;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(xt(11));function E(){let P=R;P.next&&P.next(h())}return E(),{unsubscribe:w(E)}},[eA](){return this}}}return S({type:Fu.INIT}),{dispatch:S,subscribe:A,getState:h,replaceReducer:g,[eA]:C}}function wk(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Fu.INIT})>"u")throw new Error(xt(12));if(typeof r(void 0,{type:Fu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(xt(13))})}function Li(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{wk(r)}catch(a){i=a}return function(p={},f){if(i)throw i;let m=!1,h={};for(let A=0;A<n.length;A++){let S=n[A],g=r[S],C=p[S],x=g(C,f);if(typeof x>"u"){let w=f&&f.type;throw new Error(xt(14))}h[S]=x,m=m||x!==C}return m=m||n.length!==Object.keys(p).length,m?h:p}}function Ui(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function tA(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(xt(15))},a={getState:o.getState,dispatch:(f,...m)=>i(f,...m)},p=e.map(f=>f(a));return i=Ui(...p)(o.dispatch),{...o,dispatch:i}}}function Qi(e){return Or(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Ng=Symbol.for("immer-nothing"),Ks=Symbol.for("immer-draftable"),Ht=Symbol.for("immer-state");function Rt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Bi=Object.getPrototypeOf;function nr(e){return!!e&&!!e[Ht]}function zt(e){return e?sA(e)||Array.isArray(e)||!!e[Ks]||!!e.constructor?.[Ks]||Gi(e)||rc(e):!1}var Ik=Object.prototype.constructor.toString(),rA=new WeakMap;function sA(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=rA.get(r);return n===void 0&&(n=Function.toString.call(r),rA.set(r,n)),n===Ik}function qg(e){return nr(e)||Rt(15,e),e[Ht].base_}function Xs(e,t,r=!0){Eo(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Eo(e){let t=e[Ht];return t?t.type_:Array.isArray(e)?1:Gi(e)?2:rc(e)?3:0}function Js(e,t){return Eo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wg(e,t){return Eo(e)===2?e.get(t):e[t]}function cA(e,t,r){let n=Eo(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Ek(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Gi(e){return e instanceof Map}function rc(e){return e instanceof Set}function Io(e){return e.copy_||e.base_}function Fg(e,t){if(Gi(e))return new Map(e);if(rc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=sA(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[Ht];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(n[a]={configurable:!0,writable:!0,enumerable:p.enumerable,value:e[a]})}return Object.create(Bi(e),n)}else{let n=Bi(e);if(n!==null&&r)return{...e};let o=Object.create(n);return Object.assign(o,e)}}function Ou(e,t=!1){return _u(e)||nr(e)||!zt(e)||(Eo(e)>1&&Object.defineProperties(e,{set:Tu,add:Tu,clear:Tu,delete:Tu}),Object.freeze(e),t&&Object.values(e).forEach(r=>Ou(r,!0))),e}function Fk(){Rt(2)}var Tu={value:Fk};function _u(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Tg={};function Fo(e){let t=Tg[e];return t||Rt(0,e),t}function Tk(e,t){Tg[e]||(Tg[e]=t)}var Zs;function uA(){return Zs}function Pk(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nA(e,t){t&&(Fo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Pg(e){kg(e),e.drafts_.forEach(kk),e.drafts_=null}function kg(e){e===Zs&&(Zs=e.parent_)}function oA(e){return Zs=Pk(Zs,e)}function kk(e){let t=e[Ht];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function iA(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[Ht].modified_&&(Pg(t),Rt(4)),zt(e)&&(e=Pu(t,e),t.parent_||ku(t,e)),t.patches_&&Fo("Patches").generateReplacementPatches_(r[Ht].base_,e,t.patches_,t.inversePatches_)):e=Pu(t,r,[]),Pg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ng?e:void 0}function Pu(e,t,r){if(_u(t))return t;let n=e.immer_.shouldUseStrictIteration(),o=t[Ht];if(!o)return Xs(t,(i,a)=>aA(e,o,t,i,a,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return ku(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;let i=o.copy_,a=i,p=!1;o.type_===3&&(a=new Set(i),i.clear(),p=!0),Xs(a,(f,m)=>aA(e,o,i,f,m,r,p),n),ku(e,i,!1),r&&e.patches_&&Fo("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function aA(e,t,r,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;let p=_u(o);if(!(p&&!a)){if(nr(o)){let f=i&&t&&t.type_!==3&&!Js(t.assigned_,n)?i.concat(n):void 0,m=Pu(e,o,f);if(cA(r,n,m),nr(m))e.canAutoFreeze_=!1;else return}else a&&r.add(o);if(zt(o)&&!p){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&p)return;Pu(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Gi(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&ku(e,o)}}}function ku(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ou(t,r)}function Ok(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:uA(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=Dg;r&&(o=[n],i=ec);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,p}var Dg={get(e,t){if(t===Ht)return e;let r=Io(e);if(!Js(r,t))return _k(e,r,t);let n=r[t];return e.finalized_||!zt(n)?n:n===Ig(e.base_,t)?(Eg(e),e.copy_[t]=_g(n,e)):n},has(e,t){return t in Io(e)},ownKeys(e){return Reflect.ownKeys(Io(e))},set(e,t,r){let n=lA(Io(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ig(Io(e),t),i=o?.[Ht];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Ek(r,o)&&(r!==void 0||Js(e.base_,t)))return!0;Eg(e),Og(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_[t]=!0),!0},deleteProperty(e,t){return Ig(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Eg(e),Og(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Io(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Rt(11)},getPrototypeOf(e){return Bi(e.base_)},setPrototypeOf(){Rt(12)}},ec={};Xs(Dg,(e,t)=>{ec[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ec.deleteProperty=function(e,t){return ec.set.call(this,e,t,void 0)};ec.set=function(e,t,r){return Dg.set.call(this,e[0],t,r,e[0])};function Ig(e,t){let r=e[Ht];return(r?Io(r):e)[t]}function _k(e,t,r){let n=lA(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function lA(e,t){if(!(t in e))return;let r=Bi(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Bi(r)}}function Og(e){e.modified_||(e.modified_=!0,e.parent_&&Og(e.parent_))}function Eg(e){e.copy_||(e.copy_=Fg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Nk=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let a=this;return function(f=i,...m){return a.produce(f,h=>r.call(this,h,...m))}}typeof r!="function"&&Rt(6),n!==void 0&&typeof n!="function"&&Rt(7);let o;if(zt(t)){let i=oA(this),a=_g(t,void 0),p=!0;try{o=r(a),p=!1}finally{p?Pg(i):kg(i)}return nA(i,n),iA(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Ng&&(o=void 0),this.autoFreeze_&&Ou(o,!0),n){let i=[],a=[];Fo("Patches").generateReplacementPatches_(t,o,i,a),n(i,a)}return o}else Rt(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")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]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){zt(e)||Rt(8),nr(e)&&(e=dA(e));let t=oA(this),r=_g(e,void 0);return r[Ht].isManual_=!0,kg(t),r}finishDraft(e,t){let r=e&&e[Ht];(!r||!r.isManual_)&&Rt(9);let{scope_:n}=r;return nA(n,t),iA(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=Fo("Patches").applyPatches_;return nr(e)?n(e,t):this.produce(e,o=>n(o,t))}};function _g(e,t){let r=Gi(e)?Fo("MapSet").proxyMap_(e,t):rc(e)?Fo("MapSet").proxySet_(e,t):Ok(e,t);return(t?t.scope_:uA()).drafts_.push(r),r}function dA(e){return nr(e)||Rt(10,e),pA(e)}function pA(e){if(!zt(e)||_u(e))return e;let t=e[Ht],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fg(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Fg(e,!0);return Xs(r,(o,i)=>{cA(r,o,pA(i))},n),t&&(t.finalized_=!1),r}function fA(){let t="replace",r="add",n="remove";function o(S,g,C,x){switch(S.type_){case 0:case 2:return a(S,g,C,x);case 1:return i(S,g,C,x);case 3:return p(S,g,C,x)}}function i(S,g,C,x){let{base_:w,assigned_:R}=S,E=S.copy_;E.length<w.length&&([w,E]=[E,w],[C,x]=[x,C]);for(let F=0;F<w.length;F++)if(R[F]&&E[F]!==w[F]){let P=g.concat([F]);C.push({op:t,path:P,value:A(E[F])}),x.push({op:t,path:P,value:A(w[F])})}for(let F=w.length;F<E.length;F++){let P=g.concat([F]);C.push({op:r,path:P,value:A(E[F])})}for(let F=E.length-1;w.length<=F;--F){let P=g.concat([F]);x.push({op:n,path:P})}}function a(S,g,C,x){let{base_:w,copy_:R}=S;Xs(S.assigned_,(E,F)=>{let P=wg(w,E),V=wg(R,E),q=F?Js(w,E)?t:r:n;if(P===V&&q===t)return;let O=g.concat(E);C.push(q===n?{op:q,path:O}:{op:q,path:O,value:V}),x.push(q===r?{op:n,path:O}:q===n?{op:r,path:O,value:A(P)}:{op:t,path:O,value:A(P)})})}function p(S,g,C,x){let{base_:w,copy_:R}=S,E=0;w.forEach(F=>{if(!R.has(F)){let P=g.concat([E]);C.push({op:n,path:P,value:F}),x.unshift({op:r,path:P,value:F})}E++}),E=0,R.forEach(F=>{if(!w.has(F)){let P=g.concat([E]);C.push({op:r,path:P,value:F}),x.unshift({op:n,path:P,value:F})}E++})}function f(S,g,C,x){C.push({op:t,path:[],value:g===Ng?void 0:g}),x.push({op:t,path:[],value:S})}function m(S,g){return g.forEach(C=>{let{path:x,op:w}=C,R=S;for(let V=0;V<x.length-1;V++){let q=Eo(R),O=x[V];typeof O!="string"&&typeof O!="number"&&(O=""+O),(q===0||q===1)&&(O==="__proto__"||O==="constructor")&&Rt(19),typeof R=="function"&&O==="prototype"&&Rt(19),R=wg(R,O),typeof R!="object"&&Rt(18,x.join("/"))}let E=Eo(R),F=h(C.value),P=x[x.length-1];switch(w){case t:switch(E){case 2:return R.set(P,F);case 3:Rt(16);default:return R[P]=F}case r:switch(E){case 1:return P==="-"?R.push(F):R.splice(P,0,F);case 2:return R.set(P,F);case 3:return R.add(F);default:return R[P]=F}case n:switch(E){case 1:return R.splice(P,1);case 2:return R.delete(P);case 3:return R.delete(C.value);default:return delete R[P]}default:Rt(17,w)}}),S}function h(S){if(!zt(S))return S;if(Array.isArray(S))return S.map(h);if(Gi(S))return new Map(Array.from(S.entries()).map(([C,x])=>[C,h(x)]));if(rc(S))return new Set(Array.from(S).map(h));let g=Object.create(Bi(S));for(let C in S)g[C]=h(S[C]);return Js(S,Ks)&&(g[Ks]=S[Ks]),g}function A(S){return nr(S)?h(S):S}Tk("Patches",{applyPatches_:m,generatePatches_:o,generateReplacementPatches_:f})}var tc=new Nk,yn=tc.produce,Nu=tc.produceWithPatches.bind(tc);var Mg=tc.applyPatches.bind(tc);d();c();l();u();function qk(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Dk(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Mk(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 mA=e=>Array.isArray(e)?e:[e];function jk(e){let t=Array.isArray(e[0])?e[0]:e;return Mk(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Vk(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var $H=Object.getPrototypeOf({});var Lk=class{constructor(e){this.value=e}deref(){return this.value}},Uk=typeof WeakRef<"u"?WeakRef:Lk,Qk=0,gA=1;function qu(){return{s:Qk,v:void 0,o:null,p:null}}function $i(e,t={}){let r=qu(),{resultEqualityCheck:n}=t,o,i=0;function a(){let p=r,{length:f}=arguments;for(let A=0,S=f;A<S;A++){let g=arguments[A];if(typeof g=="function"||typeof g=="object"&&g!==null){let C=p.o;C===null&&(p.o=C=new WeakMap);let x=C.get(g);x===void 0?(p=qu(),C.set(g,p)):p=x}else{let C=p.p;C===null&&(p.p=C=new Map);let x=C.get(g);x===void 0?(p=qu(),C.set(g,p)):p=x}}let m=p,h;if(p.s===gA)h=p.v;else if(h=e.apply(null,arguments),i++,n){let A=o?.deref?.()??o;A!=null&&n(A,h)&&(h=A,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new Uk(h):h}return m.s=gA,m.v=h,h}return a.clearCache=()=>{r=qu(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function hA(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()),qk(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let h={...r,...f},{memoize:A,memoizeOptions:S=[],argsMemoize:g=$i,argsMemoizeOptions:C=[],devModeChecks:x={}}=h,w=mA(S),R=mA(C),E=jk(o),F=A(function(){return i++,m.apply(null,arguments)},...w),P=!0,V=g(function(){a++;let O=Vk(E,arguments);return p=F.apply(null,O),p},...R);return Object.assign(V,{resultFunc:m,memoizedResultFunc:F,dependencies:E,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:A,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var ot=hA($i),Bk=Object.assign((e,t=ot)=>{Dk(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:()=>Bk});d();c();l();u();function yA(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var SA=yA(),vA=yA;var Gk=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ui:Ui.apply(null,arguments)},u3=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},$k=e=>e&&typeof e.match=="function";function T(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(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=>Qi(n)&&n.type===e,r}var EA=class nc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,nc.prototype)}static get[Symbol.species](){return nc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new nc(...t[0].concat(this)):new nc(...t.concat(this))}};function AA(e){return zt(e)?yn(e,()=>{}):e}function CA(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Hk(e){return typeof e=="boolean"}var zk=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new EA;return r&&(Hk(r)?a.push(SA):a.push(vA(r.extraArgument))),a},oc="RTK_autoBatch",Wi=()=>e=>({payload:e,meta:{[oc]:!0}}),bA=e=>t=>{setTimeout(t,e)},Wk=(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:bA(10):e.type==="callback"?e.queueNotification:bA(e.timeout),m=()=>{a=!1,i&&(i=!1,p.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let A=()=>o&&h(),S=n.subscribe(A);return p.add(h),()=>{S(),p.delete(h)}},dispatch(h){try{return o=!h?.meta?.[oc],i=!o,i&&(a||(a=!0,f(m))),n.dispatch(h)}finally{o=!0}}})},Yk=e=>function(r){let{autoBatch:n=!0}=r??{},o=new EA(e);return n&&o.push(Wk(typeof n=="object"?n:void 0)),o};function FA(e){let t=zk(),{reducer:r=void 0,middleware:n,devTools:o=!0,preloadedState:i=void 0,enhancers:a=void 0}=e||{},p;if(typeof r=="function")p=r;else if(Or(r))p=Li(r);else throw new Error(Lt(1));let f;typeof n=="function"?f=n(t):f=t();let m=Ui;o&&(m=Gk({trace:!1,...(typeof o=="object"&&o)}));let h=tA(...f),A=Yk(h),S=typeof a=="function"?a(A):A(),g=m(...S);return Rg(p,i,g)}function TA(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(Lt(28));if(p in t)throw new Error(Lt(29));return t[p]=a,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 Kk(e){return typeof e=="function"}function ce(e,t){let[r,n,o]=TA(t),i;if(Kk(e))i=()=>AA(e());else{let p=AA(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,A)=>{if(A)if(nr(h)){let g=A(h,f);return g===void 0?h:g}else{if(zt(h))return yn(h,S=>A(S,f));{let S=A(h,f);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},p)}return a.getInitialState=i,a}var PA=(e,t)=>$k(e)?e.match(t):e(t);function _r(...e){return t=>e.some(r=>PA(r,t))}function zi(...e){return t=>e.every(r=>PA(r,t))}function Vu(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 ic(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Lu(...e){return e.length===0?t=>Vu(t,["pending"]):ic(e)?_r(...e.map(t=>t.pending)):Lu()(e[0])}function ko(...e){return e.length===0?t=>Vu(t,["rejected"]):ic(e)?_r(...e.map(t=>t.rejected)):ko()(e[0])}function ac(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?zi(ko(...e),t):ic(e)?zi(ko(...e),t):ac()(e[0])}function Sn(...e){return e.length===0?t=>Vu(t,["fulfilled"]):ic(e)?_r(...e.map(t=>t.fulfilled)):Sn()(e[0])}function Uu(...e){return e.length===0?t=>Vu(t,["pending","fulfilled","rejected"]):ic(e)?_r(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Uu()(e[0])}var Xk="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",sc=(e=21)=>{let t="",r=e;for(;r--;)t+=Xk[Math.random()*64|0];return t},Jk=["name","message","stack","code"],jg=class{constructor(e,t){qe(this,"_type");this.payload=e,this.meta=t}},xA=class{constructor(e,t){qe(this,"_type");this.payload=e,this.meta=t}},Zk=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Jk)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},le=(()=>{function e(t,r,n){let o=T(t+"/fulfilled",(f,m,h,A)=>({payload:f,meta:{...(A||{}),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,A,S)=>({payload:A,error:(n&&n.serializeError||Zk)(f||"Rejected"),meta:{...(S||{}),arg:h,requestId:m,rejectedWithValue:!!A,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f){return(m,h,A)=>{let S=n?.idGenerator?n.idGenerator(f):sc(),g=new s.AbortController,C,x;function w(E){x=E,g.abort()}let R=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:h,extra:A});if(tO(P)&&(P=yield P),P===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let V=new Promise((q,O)=>{C=()=>{O({name:"AbortError",message:x||"Aborted"})},g.signal.addEventListener("abort",C)});m(i(S,f,n?.getPendingMeta?.({requestId:S,arg:f},{getState:h,extra:A}))),E=yield Promise.race([V,Promise.resolve(r(f,{dispatch:m,getState:h,extra:A,requestId:S,signal:g.signal,abort:w,rejectWithValue:(q,O)=>new jg(q,O),fulfillWithValue:(q,O)=>new xA(q,O)})).then(q=>{if(q instanceof jg)throw q;return q instanceof xA?o(q.payload,S,f,q.meta):o(q,S,f)})])}catch(P){E=P instanceof jg?a(null,S,f,P.payload,P.meta):a(P,S,f)}finally{C&&g.signal.removeEventListener("abort",C)}return n&&!n.dispatchConditionRejection&&a.match(E)&&E.meta.condition||m(E),E})();return Object.assign(R,{abort:w,requestId:S,arg:f,unwrap(){return R.then(eO)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:_r(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function eO(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function tO(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var kA=Symbol.for("rtk-slice-createasyncthunk"),m3={[kA]:le};function rO(e,t){return`${e}/${t}`}function nO({creators:e}={}){let t=e?.asyncThunk?.[kA];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(iO()):n.reducers)||{},p=Object.keys(a),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,F){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(Lt(12));if(P in f.sliceCaseReducersByType)throw new Error(Lt(13));return f.sliceCaseReducersByType[P]=F,m},addMatcher(E,F){return f.sliceMatchers.push({matcher:E,reducer:F}),m},exposeAction(E,F){return f.actionCreators[E]=F,m},exposeCaseReducer(E,F){return f.sliceCaseReducersByName[E]=F,m}};p.forEach(E=>{let F=a[E],P={reducerName:E,type:rO(o,E),createNotation:typeof n.reducers=="function"};sO(F)?uO(P,F,m,t):aO(P,F,m)});function h(){let[E={},F=[],P=void 0]=typeof n.extraReducers=="function"?TA(n.extraReducers):[n.extraReducers],V={...E,...f.sliceCaseReducersByType};return ce(n.initialState,q=>{for(let O in V)q.addCase(O,V[O]);for(let O of f.sliceMatchers)q.addMatcher(O.matcher,O.reducer);for(let O of F)q.addMatcher(O.matcher,O.reducer);P&&q.addDefaultCase(P)})}let A=E=>E,S=new Map,g;function C(E,F){return g||(g=h()),g(E,F)}function x(){return g||(g=h()),g.getInitialState()}function w(E,F=!1){function P(q){let O=q[E];return typeof O>"u"&&F&&(O=x()),O}function V(q=A){let O=CA(S,F,()=>new WeakMap);return CA(O,q,()=>{let N={};for(let[M,U]of Object.entries(n.selectors??{}))N[M]=oO(U,q,x,F);return N})}return{reducerPath:E,getSelectors:V,get selectors(){return V(P)},selectSlice:P}}let R={name:o,reducer:C,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:x,...w(i),injectInto(E,{reducerPath:F,...P}={}){let V=F??i;return E.inject({reducerPath:V,reducer:C},P),{...R,...w(V,!0)}}};return R}}function oO(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 Oo=nO();function iO(){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 aO({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!cO(n))throw new Error(Lt(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 sO(e){return e._reducerDefinitionType==="asyncThunk"}function cO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function uO({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:f,settled:m,options:h}=r,A=o(e,i,h);n.exposeAction(t,A),a&&n.addCase(A.fulfilled,a),p&&n.addCase(A.pending,p),f&&n.addCase(A.rejected,f),m&&n.addMatcher(A.settled,m),n.exposeCaseReducer(t,{fulfilled:a||Du,pending:p||Du,rejected:f||Du,settled:m||Du})}function Du(){}var lO="task",OA="listener",_A="completed",Ug="cancelled",dO=`task-${Ug}`,pO=`task-${_A}`,Vg=`${OA}-${Ug}`,fO=`${OA}-${_A}`,Qu=class{constructor(e){qe(this,"name","TaskAbortError");qe(this,"message");this.code=e,this.message=`${lO} ${Ug} (reason: ${e})`}},Qg=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},Mu=()=>{},NA=(e,t=Mu)=>(e.catch(t),e),qA=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),To=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},Po=e=>{if(e.aborted){let{reason:t}=e;throw new Qu(t)}};function DA(e,t){let r=Mu;return new Promise((n,o)=>{let i=()=>o(new Qu(e.reason));if(e.aborted){i();return}r=qA(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Mu})}var mO=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Qu?"cancelled":"rejected",error:r}}finally{t?.()}});return function mO(_x7,_x8){return _ref5.apply(this,arguments)}}(),ju=e=>t=>NA(DA(e,t).then(r=>(Po(e),r))),MA=e=>{let t=ju(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Hi}=Object,RA={},Bu="listenerMiddleware",gO=(e,t)=>{let r=n=>qA(e,()=>To(n,e.reason));return(n,o)=>{Qg(n,"taskExecutor");let i=new s.AbortController;r(i);let a=mO(/*#__PURE__*/_asyncToGenerator(function*(){Po(e),Po(i.signal);let p=yield n({pause:ju(i.signal),delay:MA(i.signal),signal:i.signal});return Po(i.signal),p}),()=>To(i,pO));return o?.autoJoin&&t.push(a.catch(Mu)),{result:ju(e)(a),cancel(){To(i,dO)}}}},hO=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Po(t);let i=()=>{},p=[new Promise((f,m)=>{let h=e({predicate:n,effect:(A,S)=>{S.unsubscribe(),f([A,S.getState(),S.getOriginalState()])}});i=()=>{h(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield DA(t,Promise.race(p));return Po(t),f}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>NA(r(n,o))},jA=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(Lt(21));return Qg(i,"options.listener"),{predicate:o,type:t,effect:i}},VA=Hi(e=>{let{type:t,predicate:r,effect:n}=jA(e);return{id:sc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>VA}),wA=(e,t)=>{let{type:r,effect:n,predicate:o}=jA(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Lg=e=>{e.pending.forEach(t=>{To(t,Vg)})},yO=e=>()=>{e.forEach(Lg),e.clear()},IA=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},LA=Hi(T(`${Bu}/add`),{withTypes:()=>LA}),SO=T(`${Bu}/removeAll`),UA=Hi(T(`${Bu}/remove`),{withTypes:()=>UA}),vO=(...e)=>{console.error(`${Bu}/error`,...e)},QA=(e={})=>{let t=new Map,{extra:r,onError:n=vO}=e;Qg(n,"onError");let o=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),A=>{h.unsubscribe(),A?.cancelActive&&Lg(h)}),i=h=>{let A=wA(t,h)??VA(h);return o(A)};Hi(i,{withTypes:()=>i});let a=h=>{let A=wA(t,h);return A&&(A.unsubscribe(),h.cancelActive&&Lg(A)),!!A};Hi(a,{withTypes:()=>a});let p=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,A,S,g){let C=new s.AbortController,x=hO(i,C.signal),w=[];try{h.pending.add(C),yield Promise.resolve(h.effect(A,Hi({},S,{getOriginalState:g,condition:(R,E)=>x(R,E).then(Boolean),take:x,delay:MA(C.signal),pause:ju(C.signal),extra:r,signal:C.signal,fork:gO(C.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((R,E,F)=>{R!==C&&(To(R,Vg),F.delete(R))})},cancel:()=>{To(C,Vg),h.pending.delete(C)},throwIfCancelled:()=>{Po(C.signal)}})))}catch(R){R instanceof Qu||IA(n,R,{raisedBy:"effect"})}finally{yield Promise.all(w),To(C,fO),h.pending.delete(C)}});return function p(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),f=yO(t);return{middleware:h=>A=>S=>{if(!Qi(S))return A(S);if(LA.match(S))return i(S.payload);if(SO.match(S)){f();return}if(UA.match(S))return a(S.payload);let g=h.getState(),C=()=>{if(g===RA)throw new Error(Lt(23));return g},x;try{if(x=A(S),t.size>0){let w=h.getState(),R=Array.from(t.values());for(let E of R){let F=!1;try{F=E.predicate(S,w,g)}catch(P){F=!1,IA(n,P,{raisedBy:"predicate"})}F&&p(E,S,h,C)}}}finally{g=RA}return x},startListening:i,stopListening:a,clearListeners:f}};function Lt(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 BA(){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 GA=/^(?:[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 AO(e){return typeof e=="string"&&GA.test(e)}var Bg=AO;d();c();l();u();var wt=[];for(let e=0;e<256;++e)wt.push((e+256).toString(16).slice(1));function $A(e,t=0){return(wt[e[t+0]]+wt[e[t+1]]+wt[e[t+2]]+wt[e[t+3]]+"-"+wt[e[t+4]]+wt[e[t+5]]+"-"+wt[e[t+6]]+wt[e[t+7]]+"-"+wt[e[t+8]]+wt[e[t+9]]+"-"+wt[e[t+10]]+wt[e[t+11]]+wt[e[t+12]]+wt[e[t+13]]+wt[e[t+14]]+wt[e[t+15]]).toLowerCase()}d();c();l();u();var Gg,CO=new Uint8Array(16);function $g(){if(!Gg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Gg=crypto.getRandomValues.bind(crypto)}return Gg(CO)}d();c();l();u();d();c();l();u();var bO=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hg={randomUUID:bO};function xO(e,t,r){e=e||{};let n=e.random??e.rng?.()??$g();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 $A(n)}function RO(e,t,r){return Hg.randomUUID&&!t&&!e?Hg.randomUUID():xO(e,t,r)}var zg=RO;function wO(_x13){return _wO.apply(this,arguments)}function _wO(){_wO=_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 _wO.apply(this,arguments)}var XA="2.0.4",Wg=128,JA=192,HA=224,zA=240,IO=248;function EO(e){return(e&IO)===zA?4:(e&zA)===HA?3:(e&HA)===JA?2:1}function FO(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&Wg)!=Wg)break;if(r-=3,(n&JA)!=Wg){t-r>=EO(n)*3&&(r=t);break}}return e.substring(0,r)}function TO(e){let{trackingId:t}=e;return{trackingId:t}}function PO(e){return(e.source||[]).concat([`relay@${XA}`])}function ZA(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=TO(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:PO(t),clientId:p,userAgent:i(),referrer:WA(n()),location:WA(o())})}function WA(e){return e!==null?FO(e,1024):null}function kO(e,t,r,n){return{...t,meta:ZA(e,r,n)}}var OO="*";function _O(){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===OO)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 YA({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 NO(e){let t=YA(e);return{get:()=>t,update:r=>{t=YA({...t,...r})}}}var Yg=qO();function qO(){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 DO(){return{getItem(e){return Yg.getItem(e)||localStorage.getItem(e)},removeItem(e){Yg.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Yg.setItem(e,t,31556952e3)}}}var KA="visitorId";function MO(){let e=document.referrer;return e===""?null:e}function Kg(){let e=DO();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}`}});BA().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:()=>MO(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(KA);if(t&&Bg(t))return t;let r=zg();return e.setItem(KA,r),r}}}function jO(){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 VO(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function LO(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=VO();return t&&r?{...r,runtime:"custom"}:t&&UO()&&jO()?Kg():n}function UO(){try{return typeof window=="object"}catch{return!1}}function QO(e){return{get:()=>Object.freeze(LO(e))}}function eC(e){let t=NO(e),r=_O(),n=QO(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),f=kO(o,i,a,p);return wO({config:a,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>ZA(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:XA}}d();c();l();u();function tC(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Dn="3.47.2",rC=["@coveo/atomic","@coveo/quantic"];var Yi=ot(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Dn}`));var cc=ot(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Yi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let f=GO(p);return eC({mode:i?"emit":"disabled",url:o??Su(e,t),token:r,trackingId:n??null,source:a,environment:f})}),BO={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},GO=e=>{if(!e)return;let t=e();return{...(tC()?Kg():BO),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Nr(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 j(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(A){a(A)}}function f(h){try{m(n.throw(h))}catch(A){a(A)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var ke;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ke||(ke={}));function Zg(){return typeof window<"u"}function fh(){return typeof navigator<"u"}function Ki(){return typeof document<"u"}function eh(){try{return typeof localStorage<"u"}catch{return!1}}function $O(){try{return typeof sessionStorage<"u"}catch{return!1}}function gC(){return fh()&&navigator.cookieEnabled}var HO=[ke.click,ke.custom,ke.search,ke.view],zO=(e,t)=>HO.indexOf(e)!==-1?Object.assign({language:Ki()?document.documentElement.lang:"unknown",userAgent:fh()?navigator.userAgent:"unknown"},t):t,lc=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?nC(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],nC(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 nC(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function WO(){return eh()?localStorage:gC()?new dc:$O()?sessionStorage:new Ji}var dc=class e{getItem(t){return lc.get(`${e.prefix}${t}`)}removeItem(t){lc.erase(`${e.prefix}${t}`)}setItem(t,r,n){lc.set(`${e.prefix}${t}`,r,n)}};dc.prefix="coveo_";var th=class{constructor(){this.cookieStorage=new dc}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)}},Ji=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Gu="__coveo.analytics.history",YO=20,KO=1e3*60,XO=75,zu=class{constructor(t){this.store=t||WO()}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 j(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 j(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Gu);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return j(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Gu);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Gu,JSON.stringify(t.slice(0,YO)))}catch{}}clear(){try{this.store.removeItem(Gu)}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,XO)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>KO:!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 JO=(e,t)=>j(void 0,void 0,void 0,function*(){return e===ke.view?(yield ZO(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),ZO=e=>j(void 0,void 0,void 0,function*(){let t=new zu,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),$u,e_=new Uint8Array(16);function t_(){if(!$u&&($u=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$u))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $u(e_)}var r_=/^(?:[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 Wu(e){return typeof e=="string"&&r_.test(e)}var It=[];for(let e=0;e<256;++e)It.push((e+256).toString(16).slice(1));function hC(e,t=0){return It[e[t+0]]+It[e[t+1]]+It[e[t+2]]+It[e[t+3]]+"-"+It[e[t+4]]+It[e[t+5]]+"-"+It[e[t+6]]+It[e[t+7]]+"-"+It[e[t+8]]+It[e[t+9]]+"-"+It[e[t+10]]+It[e[t+11]]+It[e[t+12]]+It[e[t+13]]+It[e[t+14]]+It[e[t+15]]}function n_(e){if(!Wu(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 o_(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var i_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function s_(e,t,r){function n(o,i,a,p){var f;if(typeof o=="string"&&(o=o_(o)),typeof i=="string"&&(i=n_(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 hC(m)}try{n.name=e}catch{}return n.DNS=i_,n.URL=a_,n}var c_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oC={randomUUID:c_};function _o(e,t,r){if(oC.randomUUID&&!t&&!e)return oC.randomUUID();e=e||{};let n=e.random||(e.rng||t_)();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 hC(n)}function u_(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 Xg(e,t){return e<<t|e>>>32-t}function l_(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]=Xg(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);let f=r[0],m=r[1],h=r[2],A=r[3],S=r[4];for(let g=0;g<80;++g){let C=Math.floor(g/20),x=Xg(f,5)+u_(C,m,h,A)+S+t[C]+p[g]>>>0;S=A,A=h,h=Xg(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]+A>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var d_=s_("v5",80,l_),iC=d_,yC="2.30.52",aC=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,uc={pageview:"pageview",event:"event"},Yu=class{constructor({client:t,uuidGenerator:r=_o}){this.client=t,this.uuidGenerator=r}},rh=class extends Yu{constructor({client:t,uuidGenerator:r=_o}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=aC(window.location),this.lastReferrer=Ki()?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:Ki()?document.title:"",encoding:Ki()?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===uc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===uc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===uc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===uc.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 aC(window.location)}},Mn=class e{constructor(t,r){if(!Wu(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 Wu(i)?new e(i,Number.parseInt(o)*1e3):null}};Mn.cvo_cid="cvo_cid";Mn.expirationTime=120;var nh=class extends Yu{constructor({client:t,uuidGenerator:r=_o}){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 j(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(Mn.cvo_cid,new Mn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};nh.Id="link";var pr=Object.keys;function Hu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Jg=128,SC=192,sC=224,cC=240;function p_(e){return(e&248)===cC?4:(e&cC)===sC?3:(e&sC)===SC?2:1}function f_(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&Jg)!=Jg)break;if(r-=3,(n&SC)!=Jg){t-r>=p_(n)*3&&(r=t);break}}return e.substring(0,r)}var oh={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"},m_=pr(oh).map(e=>oh[e]),g_=[...m_].join("|"),h_=new RegExp(`^(${g_}$)`),y_={svcAction:"svc_action",svcActionData:"svc_action_data"},S_=e=>pr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=oh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),v_=e=>h_.test(e),A_=[v_],uC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},lC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},_t={action:"pa",list:"pal",listSource:"pls"},Ku={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},C_=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ih={id:"quoteId",affiliation:"quoteAffiliation"},ah={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},b_={add:_t,bookmark_add:_t,bookmark_remove:_t,click:_t,checkout:_t,checkout_option:_t,detail:_t,impression:_t,remove:_t,refund:Object.assign(Object.assign({},_t),Ku),purchase:Object.assign(Object.assign({},_t),Ku),quickview:_t,quote:Object.assign(Object.assign({},_t),ih),review:Object.assign(Object.assign({},_t),ah)},x_=pr(uC).map(e=>uC[e]),R_=pr(lC).map(e=>lC[e]),w_=pr(_t).map(e=>_t[e]),I_=pr(Ku).map(e=>Ku[e]),E_=pr(ah).map(e=>ah[e]),F_=pr(ih).map(e=>ih[e]),T_=[...x_,"custom"].join("|"),P_=[...R_,"custom"].join("|"),vC="(pr[0-9]+)",AC="(il[0-9]+pi[0-9]+)",k_=new RegExp(`^${vC}(${T_})$`),O_=new RegExp(`^(${AC}(${P_}))|(il[0-9]+nm)$`),__=new RegExp(`^(${w_.join("|")})$`),N_=new RegExp(`^(${I_.join("|")})$`),q_=new RegExp(`^${vC}custom$`),D_=new RegExp(`^${AC}custom$`),M_=new RegExp(`^(${[...C_,...E_,...F_].join("|")})$`),j_=e=>k_.test(e),V_=e=>O_.test(e),L_=e=>__.test(e),U_=e=>N_.test(e),Q_=e=>M_.test(e),B_=[V_,j_,L_,U_,Q_],G_=[q_,D_],$_={anonymizeIp:"aip"},H_={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},z_={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},W_=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Y_=Object.assign(Object.assign(Object.assign(Object.assign({},$_),H_),z_),W_.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),sh=Object.assign(Object.assign({},Y_),y_),K_=e=>{let t=!!e.action&&b_[e.action]||{};return pr(e).reduce((r,n)=>{let o=t[n]||sh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},X_=pr(sh).map(e=>sh[e]),J_=e=>X_.indexOf(e)!==-1,Z_=e=>e==="custom",eN=e=>[...B_,...A_,J_,Z_].some(t=>t(e)),tN=e=>pr(e).reduce((t,r)=>{let n=rN(r);return n?Object.assign(Object.assign({},t),nN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),rN=e=>{let t;return[...G_].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},nN=(e,t)=>pr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ch=class{constructor(t){this.opts=t}sendEvent(t,r){return j(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 j(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 j(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[ke.click,ke.custom,ke.search,ke.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}},uh=class{sendEvent(t,r){return j(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return j(this,void 0,void 0,function*(){return Promise.resolve()})}},dC=y.fetch,Xu=class{constructor(t){this.opts=t}sendEvent(t,r){return j(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=Nr(f,["url"]),A;try{A=yield dC(m,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(A.ok){let S=yield A.json();return S.visitorId&&o.setCurrentVisitorId(S.visitorId),S}else{try{A.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,A,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return j(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield dC(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ke.click,ke.custom,ke.search,ke.view].indexOf(t)!==-1}getVisitorIdParam(){return j(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"})}},lh=class{constructor(t,r){eh()&&gC()?this.storage=new th:eh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Ji),this.client=new Xu(t),this.beaconClient=new ch(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}},dh=class{constructor(t,r){this.storage=r||new Ji,this.client=new Xu(t)}getClientDependingOnEventType(t){return this.client}},Ju=class{constructor(){this.storage=new Ji,this.client=new uh}getClientDependingOnEventType(t){return this.client}},oN="xx",iN=e=>e?.startsWith(oN)||!1,aN=`
28
28
  We've detected you're using React Native but have not provided the corresponding runtime,
29
29
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
30
30
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
31
- `;function iN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var aN=["1",1,"yes",!0];function lc(){let e=[];return Dg()&&e.push(window.doNotTrack),Kg()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>aN.indexOf(t)!==-1)}var eC="v15",tC={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 sN(e=tC.default,t=eC,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 cN="38824e1f-37f5-42d3-8372-a4b8fa9df946",or=class{get defaultOptions(){return{endpoint:tC.default,isCustomEndpoint:!1,token:"",version:eC,beforeSendHooks:[],afterSendHooks:[]}}get version(){return KA}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=[KO,$O].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};lc()?this.runtime=new Hu:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ke.view,{newEventType:ke.view,addClientIdParameter:!0}),this.addEventTypeMapping(ke.click,{newEventType:ke.click,addClientIdParameter:!0}),this.addEventTypeMapping(ke.custom,{newEventType:ke.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ke.search,{newEventType:ke.search,addClientIdParameter:!0})}initRuntime(t){return Dg()&&zi()?new zg(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(iN()&&console.warn(oN),new Wg(t))}get storage(){return this.runtime.storage}determineVisitorId(){return j(this,void 0,void 0,function*(){try{return Dg()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||_o()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),_o()}})}getCurrentVisitorId(){return j(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return j(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return j(this,void 0,void 0,function*(){if(Qu(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(jA(t,jA(r,cN)))}})}getParameters(t,...r){return j(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return j(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(_o()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(lc())return null;try{let r=new URL(t).searchParams.get(Dn.cvo_cid);if(r==null)return null;let n=Dn.fromString(r);return!n||!zi()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return j(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=>j(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>j(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)=>j(this,void 0,void 0,function*(){let w=yield S;return yield x(t,w)}),g)].reduce((g,S)=>j(this,void 0,void 0,function*(){let x=yield g;return yield S(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return j(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?W_(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,C)=>j(this,void 0,void 0,function*(){let g=yield v;return yield C(g)}),Promise.resolve(r))})}makeEvent(t,...r){return j(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=>j(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 j(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return j(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 Uu().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.search,t)})}sendSearchEvent(t){return j(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Nr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.click,t)})}sendClickEvent(t){return j(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Nr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.custom,t)})}sendCustomEvent(t){return j(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Nr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.view,t)})}sendViewEvent(t){return j(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return j(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return j(this,void 0,void 0,function*(){return yield(yield A(`${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({[ke.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(X_(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=Nr(t,["custom"]),o={};r&&Lu(r)&&(o=this.lowercaseKeys(r));let i=Z_(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Nr(t,["custom"]);if(r&&Lu(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=Nr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ke.view||r==ke.click||r==ke.search||r==ke.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ke.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=Nr(t,["userId"]);return nN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Nr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Lu(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Lu(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"?d_(t,r):t}get baseUrl(){return sN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Et;(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"})(Et||(Et={}));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 Yg={[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",[Et.expandToFullUI]:"interface",[Et.openUserActions]:"User Actions",[Et.showPrecedingSessions]:"User Actions",[Et.showFollowingSessions]:"User Actions",[Et.clickViewedDocument]:"User Actions",[Et.clickPageView]:"User Actions",[Et.createArticle]:"createArticle"},Mn=class{constructor(){this.runtime=new Hu,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(ke.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ke.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ke.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ke.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return KA}};function uN(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function lN(e){return e.map(t=>t.replace(/;/g,""))}function rC(e){let r=e.join(";");return r.length<=256?r:rC(e.slice(1))}var $A=e=>{let t=lN(e),r=uN(t);return rC(r)};function HA(e){let t=typeof e.partialQueries=="string"?e.partialQueries:$A(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:$A(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var zu=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||lc();this.coveoAnalyticsClient=n?new Mn:new or(t)}disable(){this.coveoAnalyticsClient=new Mn}enable(){this.coveoAnalyticsClient=new or(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(k.interfaceLoad)}logInterfaceLoad(){return j(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(k.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return j(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(k.recommendation)}logRecommendation(){return j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(k.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return j(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(k.didyoumeanClick)}logDidYouMeanClick(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(k.searchboxSubmit)}logSearchboxSubmit(){return j(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(k.searchboxClear)}logSearchboxClear(){return j(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(k.searchboxAsYouType)}logSearchboxAsYouType(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(k.breadcrumbResetAll)}logBreadcrumbResetAll(){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(k.omniboxAnalytics,HA(t))}logOmniboxAnalytics(t){return j(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(k.omniboxFromLink,HA(t))}logOmniboxFromLink(t){return j(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(k.searchFromLink)}logSearchFromLink(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(k.pagerScrolling)}logPagerScrolling(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorBack);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorBack)})}})}logQueryErrorBack(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorRetry);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorRetry)})}})}logQueryErrorRetry(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorClear);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorClear)})}})}logQueryErrorClear(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(k.likeSmartSnippet)}logLikeSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(k.dislikeSmartSnippet)}logDislikeSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(k.expandSmartSnippet)}logExpandSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(k.collapseSmartSnippet)}logCollapseSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return j(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(k.clearRecentQueries)}logClearRecentQueries(){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(k.noResultsBack)}logNoResultsBack(){return j(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 j(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 j(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 j(this,arguments,void 0,function*(n,o,i=Yg[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 j(this,arguments,void 0,function*(n,o,i=Yg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return j(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return j(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 j(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 or?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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(k.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Wu=Object.assign({},sc),zA=Object.keys(Wu).map(e=>Wu[e]),Wi=class extends Vg{constructor({client:t,uuidGenerator:r=_o}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);if(r!==null)return r;switch(t){case"setTicket":return this.setTicket;default:return null}}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>zA.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(zA.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Wu.pageview,{newEventType:ke.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Wu.event,{newEventType:ke.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 h_(this.ticket)}};Wi.Id="svc";var Yu;(function(e){e.click="click",e.flowStart="flowStart"})(Yu||(Yu={}));var dr;(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"})(dr||(dr={}));var Ku;(function(e){e.quit="Quit",e.solved="Solved"})(Ku||(Ku={}));var Ju=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!lc();this.coveoAnalyticsClient=o?new or(t):new Mn,this.svc=new Wi({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Mn,this.svc=new Wi({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new or(this.options),this.svc=new Wi({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(dr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(dr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(dr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(dr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(dr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(dr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(dr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(dr.caseCancelled,{reason:Ku.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(dr.caseSolved,{reason:Ku.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(dr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Yu.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Yu.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return j(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 or?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 j(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)})}},dN=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},se=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,i=Nr(e,["caseContext","caseId","caseNumber"]),a=dN(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},i),!!a.context_Case_Subject&&{CaseSubject:a.context_Case_Subject}),t&&a)},Xu=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||lc();this.coveoAnalyticsClient=n?new Mn:new or(t)}disable(){this.coveoAnalyticsClient=new Mn}enable(){this.coveoAnalyticsClient=new or(this.opts)}logInterfaceLoad(t){if(t){let r=se(t);return this.logSearchEvent(k.interfaceLoad,r)}return this.logSearchEvent(k.interfaceLoad)}logRecentQueryClick(t){if(t){let r=se(t);return this.logSearchEvent(k.recentQueryClick,r)}return this.logSearchEvent(k.recentQueryClick)}logClearRecentQueries(t){if(t){let r=se(t);return this.logCustomEvent(k.clearRecentQueries,r)}return this.logCustomEvent(k.clearRecentQueries)}logInterfaceChange(t){let r=se(t);return this.logSearchEvent(k.interfaceChange,r)}logStaticFilterDeselect(t){let r=se(t);return this.logSearchEvent(k.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=se(t);return this.logCustomEvent(k.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(k.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=se(t);return this.logSearchEvent(k.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=se(t);return this.logSearchEvent(k.breadcrumbResetAll,r)}return this.logSearchEvent(k.breadcrumbResetAll)}logFacetSelect(t){let r=se(t);return this.logSearchEvent(k.facetSelect,r)}logFacetExclude(t){let r=se(t);return this.logSearchEvent(k.facetExclude,r)}logFacetDeselect(t){let r=se(t);return this.logSearchEvent(k.facetDeselect,r)}logFacetUpdateSort(t){let r=se(t);return this.logSearchEvent(k.facetUpdateSort,r)}logFacetClearAll(t){let r=se(t);return this.logSearchEvent(k.facetClearAll,r)}logFacetShowMore(t){let r=se(t,!1);return this.logCustomEvent(k.facetShowMore,r)}logFacetShowLess(t){let r=se(t,!1);return this.logCustomEvent(k.facetShowLess,r)}logQueryError(t){let r=se(t,!1);return this.logCustomEvent(k.queryError,r)}logPagerNumber(t){let r=se(t,!1);return this.logCustomEvent(k.pagerNumber,r)}logPagerNext(t){let r=se(t,!1);return this.logCustomEvent(k.pagerNext,r)}logPagerPrevious(t){let r=se(t,!1);return this.logCustomEvent(k.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=se(t);return this.logSearchEvent(k.didyoumeanAutomatic,r)}return this.logSearchEvent(k.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=se(t);return this.logSearchEvent(k.didyoumeanClick,r)}return this.logSearchEvent(k.didyoumeanClick)}logResultsSort(t){let r=se(t);return this.logSearchEvent(k.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=se(t);return this.logSearchEvent(k.searchboxSubmit,r)}return this.logSearchEvent(k.searchboxSubmit)}logContextChanged(t){let r=se(t);return this.logSearchEvent(Et.contextChanged,r)}logExpandToFullUI(t){let r=se(t);return this.logCustomEvent(Et.expandToFullUI,r)}logOpenUserActions(t){let r=se(t,!1);return this.logCustomEvent(Et.openUserActions,r)}logShowPrecedingSessions(t){let r=se(t,!1);return this.logCustomEvent(Et.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=se(t,!1);return this.logCustomEvent(Et.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(Et.clickViewedDocument,Object.assign(Object.assign({},se(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(Et.clickPageView,Object.assign(Object.assign({},se(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(Et.createArticle,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(k.documentOpen,t,r,n?se(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(k.copyToClipboard,t,r,n?se(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(k.caseSendEmail,t,r,n?se(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(k.feedItemTextPost,t,r,n?se(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({},se(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({},se(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&se(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(k.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(k.likeSmartSnippet,t?se(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(k.dislikeSmartSnippet,t?se(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(k.expandSmartSnippet,t?se(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(k.collapseSmartSnippet,t?se(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.openSmartSnippetFeedbackModal,t?se(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.closeSmartSnippetFeedbackModal,t?se(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(k.sendSmartSnippetReason,n?Object.assign(Object.assign({},se(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({},se(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({},se(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(k.openSmartSnippetSource,t,r,n?se(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({},se(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({},se(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({},se(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(k.likeGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(k.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(k.openGeneratedAnswerSource,r?Object.assign(Object.assign({},se(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({},se(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(k.generatedAnswerSourceHover,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(k.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(k.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(k.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(k.generatedAnswerExpand,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(k.generatedAnswerCollapse,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(k.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(k.retryGeneratedAnswer,t?Object.assign({},se(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(k.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},se(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({},se(n,!1)),r):r)}logCustomEvent(t,r){return j(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:Yg[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return j(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return j(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 j(this,void 0,void 0,function*(){return this.logClickEvent(k.showMoreFoldedResults,t,r,n?se(n,!1):void 0)})}logShowLessFoldedResults(t){return j(this,void 0,void 0,function*(){return this.logCustomEvent(k.showLessFoldedResults,t?se(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(k.triggerNotify,r?Object.assign(Object.assign({},se(r,!1)),t):t)}getBaseCustomEventRequest(t){return j(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return j(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 j(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 or?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var Ki=()=>"default";var pN=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},jn=class{constructor(t){this.getState=t;qe(this,"state");this.state=t()}getLanguage(){return pN(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=qn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Ki()}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 nC=e=>new or(e).getCurrentVisitorId(),Ji=(e,t)=>typeof t=="function"?(...r)=>{let n=Qs(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Xi=(e,t)=>(...r)=>{let n=Qs(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var dc=class extends jn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},oC=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new dc(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new Ju({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:Ji(e,n),beforeSendHooks:[Xi(e,r),(v,C)=>(e.info({...C,type:v,endpoint:p,token:a},"Analytics request"),C)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Zu(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function fN(e,t){return!!t&&t.facetId in e.facetSet}var vn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),iC=(e,t)=>e.facetSet[t]?.request,Zg=(e,t)=>{let r=vn(e,t);return fN(e,r)?r:void 0};var aC=(e,t)=>Zg(e,t)?.values.filter(r=>r.state!=="idle")||[],qr=e=>e.search.isLoading;d();c();l();u();function sC(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 Dr(e){let{activeValue:t,ancestryMap:r}=mN(e);return t?gN(t,r):[]}function mN(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 gN(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function hN(e,t){return!!t&&t.facetId in e.categoryFacetSet}var eh=(e,t)=>{let r=vn(e,t);if(hN(e,r))return r},th=(e,t)=>e.categoryFacetSet[t]?.request,cC=(e,t)=>{let r=eh(e,t);return Dr(r?.values??[])},rh=(e,t)=>{let r=th(e,t);return Dr(r?.currentValues??[])};d();c();l();u();function Zi(){return{}}d();c();l();u();function uC(e,t){return{request:e,tabs:t}}function ea(){return{}}d();c();l();u();function lC(e,t){return{request:e,tabs:t}}function ta(){return{}}d();c();l();u();function dC(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ra(){return{}}var No=(e,t)=>{let r=gC(t,e),n=r?r.field:"",o=nh(n,e);return{facetId:e,facetField:n,facetTitle:o}};function na(e,t){let{facetId:r,facetValue:n}=e,o=No(r,t),i=hC(t,r);return{...o,facetValue:i==="hierarchical"?mC(t,r):n}}function Wt(e){return{facetSet:e.facetSet??ra(),categoryFacetSet:e.categoryFacetSet??Zi(),dateFacetSet:e.dateFacetSet??ea(),numericFacetSet:e.numericFacetSet??ta(),automaticFacetSet:e.automaticFacetSet??Zu()}}var el=e=>{let t=[];return vN(e).forEach((r,n)=>{let o=hC(e,r.facetId),i=RN(r,n+1);if(SN(r)){if(!!!rh(e,r.facetId).length)return;t.push({...i,...bN(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,p)=>{if(a.state==="idle")return;let f=pC(a,p+1,o),m=yN(r)?fC(a):CN(a);t.push({...i,...f,...m})})}),AN(e).forEach((r,n)=>{let o=xN(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let p=pC(i,a+1,"specific"),f=fC(i);t.push({...o,...p,...f})})}),t},yN=e=>e.type==="specific",SN=e=>e.type==="hierarchical",vN=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),AN=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),pC=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),CN=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),fC=e=>({displayValue:e.value,value:e.value}),mC=(e,t)=>rh(e,t).map(n=>n.value).join(";"),bN=(e,t)=>{let n=mC(e,t);return{value:n,valuePosition:1,displayValue:n}},xN=(e,t)=>({title:nh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),RN=(e,t)=>({title:nh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),nh=(e,t)=>`${e}_${t}`,gC=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,hC=(e,t)=>{let r=gC(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var oh=e=>e.configuration.search.locale,yC=e=>e.configuration.search.timezone,SC=e=>e.configuration.accessToken,vC=e=>e.configuration.organizationId,AC=e=>e.configuration.environment,tl=e=>e.configuration?.knowledge?.agentId;var Ve=e=>{if(wN(e)||ih(e))return e.generatedAnswer?.answerId;if(IN(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},wN=e=>"answer"in e&&"generatedAnswer"in e&&!te(e.generatedAnswer?.answerConfigurationId),ih=e=>{let t=tl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},IN=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",ah=e=>e.generatedAnswer?.fieldsToIncludeInCitations,oa=ot(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));d();c();l();u();var at=()=>({q:"",enableQuerySyntax:!1});var pc=class extends jn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||yt().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 el(Wt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ve(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||at().q}get responseTime(){return this.state.search?.duration||yt().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||yt().response.results.length}},CC=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new pc(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new Xu({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:Ji(e,n),beforeSendHooks:[Xi(e,r),(v,C)=>(e.info({...C,type:v,endpoint:p,token:a},"Analytics request"),C)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();var rl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(rl||{}),nl=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(nl||{}),Mr=e=>{if(ki(e))return e.map(t=>Mr(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""}},ol=()=>({by:"relevancy"}),bC=e=>({by:"date",order:e});var xC=new W({values:{by:new Us({enum:nl,required:!0}),order:new Us({enum:rl}),field:new L}});function ir(){return Mr(ol())}d();c();l();u();d();c();l();u();d();c();l();u();var ia=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?sh(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],sh(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 sh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}d();c();l();u();function EN(){return typeof navigator<"u"}function RC(){try{return typeof localStorage<"u"}catch{return!1}}function wC(){try{return typeof sessionStorage<"u"}catch{return!1}}function IC(){return!!(EN()&&navigator.cookieEnabled)}var EC=null;function FC(){return EC||(RC()?localStorage:IC()?new ch:wC()?sessionStorage:new uh)}var aa=class aa{getItem(t){return ia.get(`${aa.prefix}${t}`)}removeItem(t){ia.erase(`${aa.prefix}${t}`)}setItem(t,r,n){ia.set(`${aa.prefix}${t}`,r,n)}};qe(aa,"prefix","coveo_");var ch=aa;var uh=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var il="__coveo.analytics.history",FN=20,TN=1e3*60,PN=75,qo=class qo{constructor(t){qe(this,"store");this.store=t||FC()}static getInstance(t){return qo.instance||(qo.instance=new qo(t)),qo.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(il);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(il);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(il,JSON.stringify(t.slice(0,FN)))}catch{}}clear(){try{this.store.removeItem(il)}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,PN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>TN:!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))}};qe(qo,"instance",null);var lh=qo,Nt=lh;var fc=class fc extends jn{constructor(){super(...arguments);qe(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 el(Wt(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||yt().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=Ve(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??ir()}}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||at().q}get responseTime(){return this.state.search?.duration||yt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||yt().response.totalCountFiltered}};qe(fc,"fallbackPipelineName","default");var Vn=fc,TC=({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??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new zu({token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:Ji(e,n),beforeSendHooks:[Xi(e,r),(v,C)=>(e.info({...C,type:v,endpoint:p,token:a},"Analytics request"),C)]},o);return m||h.disable(),h},dh=()=>{let t=Nt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function al(e){let t=PC(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return JS([e,...t,...r],o=>o.uniqueId)}function PC(e){return e.childResults?e.childResults.flatMap(t=>[t,...PC(t)]):[]}d();c();l();u();var mc=()=>"";function kC(e,t){return{...new Vn(t).getBaseMetadata(),actionCause:e,type:e}}function kN(e){return Object.assign(e,{instantlyCallable:!0})}function ON(e,t){let r=i=>kN(le(e,i)),n=r(/*#__PURE__*/function(){var _ref9=_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(_x13,_x14){return _ref9.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref0=_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 _ref1=_asyncToGenerator(function*(v,{getState:C,extra:g}){return yield h({state:C(),extra:g})});return function(_x16,_x17){return _ref1.apply(this,arguments)}}())}});return function prepare(_x15){return _ref0.apply(this,arguments)}}()}),n}var ph=(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 qN(i)}return n},_N=e=>e.configuration.analytics.analyticsMode==="legacy",NN=e=>e.configuration.analytics.analyticsMode==="next",qN=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=p=>new a(p)),ON(e,/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:h}){let v=[],C={log:function(){var _ref11=_asyncToGenerator(function*({state:R}){for(let I of v)yield I(R)});return function log(_x19){return _ref11.apply(this,arguments)}}()},g=p(),S=i({getState:p,logger:h,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),x=yield t(S,p());C.description=x?.description,v.push(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(R){_N(R)&&(yield DN(x,r,R,h,S.coveoAnalyticsClient))});return function(_x20){return _ref12.apply(this,arguments)}}());let{emit:w}=ac(g);return v.push(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(R){if(NN(R)&&o&&n){let I=n(R);yield GN(w,o,I)}});return function(_x21){return _ref13.apply(this,arguments)}}()),C});return function(_x18){return _ref10.apply(this,arguments)}}()));function DN(_x22,_x23,_x24,_x25,_x26){return _DN.apply(this,arguments)}function _DN(){_DN=_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 _DN.apply(this,arguments)}var OC=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref14=_asyncToGenerator(function*(i){r(n,o)});return function log(_x27){return _ref14.apply(this,arguments)}}()}),$e=ph(e=>TC({...e,provider:e.provider||new Vn(e.getState)}),e=>e,Vn),gK=ph(oC,OC("caseAssist"),dc),Z=e=>ph(CC,OC(e),pc),Ke=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=NC(e,o),n<0&&(n=BN(e,o)),n<0&&(n=0),jN(e,r(n),t)};var sl=(e,t)=>({sourceName:MN(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||mc()});function MN(e){let t=e.source;return te(t)?"unknown":t}var cl=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function jN(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:UN(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:QN(e),queryPipeline:r.pipeline||mc()}}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||""}),_C={urihash:new L,sourcetype:new L,permanentid:new L},ul={uniqueId:G,raw:new W({values:_C}),title:G,uri:G,clickUri:G,rankingModifier:new L({required:!1,emptyAllowed:!0})};function VN(e){return Object.assign({},...Object.keys(_C).map(t=>({[t]:e[t]})))}function LN(e){return Object.assign({},...Object.keys(ul).map(t=>({[t]:e[t]})),{raw:VN(e.raw)})}function UN(e){let t=e.raw.author;return te(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function QN(e){let t=e.raw.source;return te(t)?"unknown":t}var Ft=e=>new Ee(ul).validate(LN(e));function BN(e,t){for(let[r,n]of t.entries()){let o=al(n);if(NC(e,o)!==-1)return r}return-1}function NC(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function GN(_x28,_x29,_x30){return _GN.apply(this,arguments)}function _GN(){_GN=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _GN.apply(this,arguments)}var xr=(e,t)=>{let r=Je(e),n=Ke(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var fh=e=>_(e,{evt:G,type:He}),qC=e=>$e("analytics/generic/search",t=>{fh(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),DC=e=>$e("analytics/generic/click",(t,r)=>(Ft(e.result),fh(e),t.makeClickEvent(e.evt,Ke(e.result,r),Je(e.result),e.meta))),MC=e=>$e("analytics/generic/custom",t=>(fh(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var jC=()=>({actionCause:"interfaceLoad"}),sa=()=>({actionCause:"interfaceChange"});d();c();l();u();var mh=()=>He,VC=()=>G,ca=T("configuration/updateBasicConfiguration",e=>_(e,{accessToken:He,environment:new L({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),ua=T("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new L({required:!1,url:!0}),pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new re({required:!1,each:G})})),$N={enabled:new ue({default:!0}),originContext:mh(),originLevel2:mh(),originLevel3:mh(),proxyBaseUrl:new L({required:!1,url:!0}),runtimeEnvironment:new Be,anonymous:new ue({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:kv,analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new W({options:{required:!1},values:qA.reduce((e,t)=>(e[t]=Pv,e),{})})},ll=T("configuration/updateAnalyticsConfiguration",e=>_(e,$N)),dl=T("configuration/analytics/disable"),pl=T("configuration/analytics/enable"),LC=T("configuration/analytics/originlevel2",e=>_(e,{originLevel2:VC()})),UC=T("configuration/analytics/originlevel3",e=>_(e,{originLevel3:VC()})),QC=T("knowledge/setAgentId",e=>_(e,new L({required:!0})));d();c();l();u();var fl=T("insightConfiguration/set",e=>_(e,{insightId:G}));d();c();l();u();d();c();l();u();var BC=()=>({insightId:""});var ml=ce(BC(),e=>{e.addCase(fl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var gl=T("searchHub/set",e=>_(e,new L({required:!0,emptyAllowed:!0})));var jr=le("insight/interface/fetch",/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let i=t(),a=yield o.getInterface(HN(i));return Ge(a)?n(a.error):(r(gl(a.success.searchHub)),{response:a.success})});return function(_x31,_x32){return _ref15.apply(this,arguments)}}()),HN=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var GC=()=>({loading:!1,config:void 0});var Ln=ce(GC(),e=>{e.addCase(jr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(jr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(jr.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();var gc=Cr(hl(),1),KC=Cr($C(),1);d();c();l();u();var yl=Cr(hl(),1),zC=Cr(HC(),1);yl.default.extend(zC.default);var WC="YYYY/MM/DD@HH:mm:ss",zN="1401-01-01";function la(e,t){let r=(0,yl.default)(e,t);return!r.isValid()&&!t?(0,yl.default)(e,WC):r}function Sl(e){return e.format(WC)}function YC(e,t){let r=la(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}`)}Ch(r)}function Ch(e){if(e.isBefore(zN))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}gc.default.extend(KC.default);var JC=["past","now","next"],XC=["minute","hour","day","week","month","quarter","year"],WN=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new L({required:!t,constrainTo:XC}),period:new L({required:!0,constrainTo:JC})}};function vl(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"?bh(e):e;new Ee(WN(t.period)).validate(t);let r=eb(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Ch(r)}function ZC(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function eb(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,gc.default)().subtract(r,n);case"next":return(0,gc.default)().add(r,n);case"now":return(0,gc.default)()}}function hc(e){return Sl(eb(bh(e)))}function tb(e){return e.toLocaleLowerCase().split("-")}function Un(e){let[t,r,n]=tb(e);if(t==="now")return!0;if(!JC.includes(t)||!XC.includes(n))return!1;let o=parseInt(r);return!(Number.isNaN(o)||o<=0)}function rb(e){return!!e&&typeof e=="object"&&"period"in e}function bh(e){let[t,r,n]=tb(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r):void 0,unit:n||void 0}}function nb(e){return vl(e),bh(e)}d();c();l();u();function ob(e){return e.type==="dateRange"}function ib(e){return`start${e}`}function ab(e){return`end${e}`}var xh=()=>({dateFacetValueMap:{}});function YN(e,t,r){let n=e.start,o=e.end;return Un(n)&&(n=hc(n),r.dateFacetValueMap[t][ib(n)]=e.start),Un(o)&&(o=hc(o),r.dateFacetValueMap[t][ab(o)]=e.end),{...e,start:n,end:o}}function Rh(e,t){if(ob(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>YN(o,r,t))}}return e}function Vr(e){let t=xh();return{request:{...e,facets:e.facets?.map(n=>Rh(n,t))},mappings:t}}function KN(e,t,r){return{...e,start:r.dateFacetValueMap[t][ib(e.start)]||e.start,end:r.dateFacetValueMap[t][ab(e.end)]||e.end}}function JN(e,t){return e.facetId in t.dateFacetValueMap}function XN(e,t){return JN(e,t)?{...e,values:e.values.map(r=>KN(r,e.facetId,t))}:e}function Rr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>XN(n,t))}}:e}d();c();l();u();d();c();l();u();var Qn=/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield nC(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}),...(dh()&&{pageId:dh()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Hi(e)})}}});return function Qn(_x33,_x34){return _ref16.apply(this,arguments)}}();var sb=/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:We(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?Nt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield Qn(t.configuration.analytics)))})}});return function sb(_x35,_x36){return _ref17.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var Al=T("didYouMean/enable"),cb=T("didYouMean/disable"),Cl=T("didYouMean/automaticCorrections/disable"),ub=T("didYouMean/automaticCorrections/enable"),Yt=T("didYouMean/correction",e=>_(e,G)),yc=T("didYouMean/automaticCorrections/mode",e=>_(e,new L({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var ZN=T("history/undo"),e0=T("history/redo"),St=T("history/snapshot"),H8=le("history/back",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{dispatch:t}){t(ZN()),yield t(Ze())});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),z8=le("history/forward",/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,{dispatch:t}){t(e0()),yield t(Ze())});return function(_x39,_x40){return _ref19.apply(this,arguments)}}()),Ze=le("history/change",/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x41,_x42){return _ref20.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var An=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function bl(){return{contextValues:{}}}d();c();l();u();var xl=()=>!1;d();c();l();u();function lb(){return{contextValues:{}}}d();c();l();u();function wh(){return{enabled:!0,tabs:{}}}function Rl(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function db(){return[]}d();c();l();u();function Lr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function wl(){return{}}d();c();l();u();function pb(){return{}}d();c();l();u();function Il(){return{}}function vt(e){return{context:e.context||bl(),dictionaryFieldContext:e.dictionaryFieldContext||lb(),facetSet:e.facetSet||ra(),numericFacetSet:e.numericFacetSet||ta(),dateFacetSet:e.dateFacetSet||ea(),categoryFacetSet:e.categoryFacetSet||Zi(),automaticFacetSet:e.automaticFacetSet??Zu(),pagination:e.pagination||Lr(),query:e.query||at(),tabSet:e.tabSet||Il(),advancedSearchQueries:e.advancedSearchQueries||An(),staticFilterSet:e.staticFilterSet||pb(),querySet:e.querySet||wl(),sortCriteria:e.sortCriteria||ir(),pipeline:e.pipeline||mc(),searchHub:e.searchHub||Ki(),facetOptions:e.facetOptions||Rl(),facetOrder:e.facetOrder??db(),debug:e.debug??xl()}}d();c();l();u();var Ut=T("query/updateQuery",e=>_(e,{q:new L,enableQuerySyntax:new ue}));d();c();l();u();d();c();l();u();var fb=()=>({caseContext:{},caseId:"",caseNumber:""}),J=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var Ih=()=>Z("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(J(t.insightCaseContext))),da=e=>Z("query")("search/queryError",(t,r)=>t.logQueryError({...J(r.insightCaseContext),query:r.query?.q||at().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),mb=(e,t)=>Z("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),El=()=>Z("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(J(t.insightCaseContext))),Bn=()=>Z("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 Ur(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var gb=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=r0(e),n=t0(e);return Vr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??We(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Qn(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 gb(_x43,_x44){return _ref21.apply(this,arguments)}}(),fr=/*#__PURE__*/function(){var _ref22=_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 gb(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function fr(_x45,_x46){return _ref22.apply(this,arguments)}}(),hb=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){let r=yield gb(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function hb(_x47,_x48){return _ref23.apply(this,arguments)}}(),Fl=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=yield fr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function Fl(_x49,_x50){return _ref24.apply(this,arguments)}}(),Tl=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=yield fr(e,t);return r.request={...r.request,numberOfResults:0},r});return function Tl(_x51,_x52){return _ref25.apply(this,arguments)}}();function t0(e){return Ur({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function r0(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Do=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x53,_x54){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Rr(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 Ge(t.response)?(this.dispatch(da(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let C=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(St(vt(_this1.getState()))),C})()}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 Ge(i.response)?(_this10.dispatch(da(i.response.error)),_this10.rejectWithValue(i.response.error)):(_this10.dispatch(St(vt(_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 fr(r));return _this11.dispatch(Yt(t)),n})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Nn(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 yb=()=>Z("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(J(t.insightCaseContext))),Eh=()=>Z("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(J(t.insightCaseContext)));var Mo=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x55,_x56){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Rr(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 Ge(t.response)?(this.dispatch(da(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,v=!te(m)&&!te(m.correctedQuery);if(!h&&!v)return null;let g=h?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(St(vt(_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 Ge(i.response)?(_this15.dispatch(da(i.response.error)),_this15.rejectWithValue(i.response.error)):(_this15.dispatch(St(vt(_this15.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Eh()})})()}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:Eh()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Ut({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield fr(r));return _this16.dispatch(Yt(t)),n})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Nn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??at().enableQuerySyntax},search:{...yt(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Rr(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 Fh(_x57,_x58,_x59){return _Fh.apply(this,arguments)}function _Fh(){_Fh=_asyncToGenerator(function*(e,t,r){Sc(e);let n=new Mo({...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 fr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Fh.apply(this,arguments)}function Th(_x60,_x61,_x62){return _Th.apply(this,arguments)}function _Th(){_Th=_asyncToGenerator(function*(e,t,r){Sc(e);let n=new Mo({...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 fr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Th.apply(this,arguments)}function Ph(_x63,_x64){return _Ph.apply(this,arguments)}function _Ph(){_Ph=_asyncToGenerator(function*(e,t){let r=new Mo({...t,analyticsAction:Ih}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield Ih().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield Fl(e,a),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Ph.apply(this,arguments)}function kh(_x65,_x66,_x67){return _kh.apply(this,arguments)}function _kh(){_kh=_asyncToGenerator(function*(e,t,r){let n=new Mo({...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 Tl(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _kh.apply(this,arguments)}var Sb=le("search/executeSearch",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Fh(r,t,e)});return function(_x68,_x69){return _ref26.apply(this,arguments)}}()),vb=le("search/fetchPage",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Th(r,t,e)});return function(_x70,_x71){return _ref27.apply(this,arguments)}}()),Ab=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ph(r,t)});return function(_x72,_x73){return _ref28.apply(this,arguments)}}()),Cb=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield kh(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}());var bb=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let i=Date.now(),a=Rr(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 bb(_x76,_x77,_x78,_x79){return _ref30.apply(this,arguments)}}(),Se=le("search/executeSearch",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Fh(r,t,e.legacy);Sc(r);let n=new Do({...t}),o=e.next?Oh(e.next):void 0,i=yield fr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x80,_x81){return _ref31.apply(this,arguments)}}()),Pl=le("search/fetchPage",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Th(r,t,e.legacy);Sc(r);let n=new Do({...t}),o=e.next?Oh(e.next):void 0,i=yield fr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x82,_x83){return _ref32.apply(this,arguments)}}()),kl=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ph(r,t);let n=new Do({...t}),o=Oh({actionCause:"browseResults"}),i=yield Fl(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x84,_x85){return _ref33.apply(this,arguments)}}()),pa=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kh(r,t,e.legacy);let n=new Do({...t}),o=yield Tl(r),i=yield n.fetchFromAPI(o);return yield n.process(i)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),Ol=le("querySuggest/fetch",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:G});let i=e.id,a=yield sb(i,t()),p=yield n.querySuggest(a);return Ge(p)?r(p.error):{id:i,q:a.q,...p.success}});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),Sc=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Oh=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Kt=T("breadcrumb/deselectAll"),_l=T("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var fa=T("facet/updateFacetAutoSelection",e=>_(e,{allow:new ue({required:!0})}));d();c();l();u();d();c();l();u();var Nl=class extends Vn{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??at().q}get responseTime(){return this.activeInstantResultCache?.duration??yt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??yt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var xb=()=>$e("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Nl(e)),Rb=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var _h={id:G},n0={..._h,q:Ye},YJ=T("instantResults/register",e=>_(e,_h)),ql=T("instantResults/updateQuery",e=>_(e,n0)),KJ=T("instantResults/clearExpired",e=>_(e,_h));d();c();l();u();var Dl=new ne({required:!0,min:0}),Ml=T("pagination/registerNumberOfResults",e=>_(e,Dl)),jl=T("pagination/updateNumberOfResults",e=>_(e,Dl)),Vl=T("pagination/registerPage",e=>_(e,Dl)),Gn=T("pagination/updatePage",e=>_(e,Dl)),Ll=T("pagination/nextPage"),Ul=T("pagination/previousPage");d();c();l();u();d();c();l();u();var jo=(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:Hi(e)}});var ma=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??$t(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&&jo(e.configuration.analytics,t,r)),...(e.excerptLength&&!te(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 $n=/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??$t(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:Nt.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 Qn(e.configuration.analytics,t))),...(e.excerptLength&&!te(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function $n(_x90,_x91){return _ref36.apply(this,arguments)}}();d();c();l();u();var Nh=()=>$e("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Hn=e=>$e("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||at().q,aq:r.advancedSearchQueries?.aq||An().aq,cq:r.advancedSearchQueries?.cq||An().cq,dq:r.advancedSearchQueries?.dq||An().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var qh=()=>$e("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),wb=()=>({actionCause:"didYouMeanClick"}),Ib=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var JX=new W({values:{undoneQuery:Ye},options:{required:!0}}),Eb=()=>$e("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var ga=T("trigger/query/ignore",e=>_(e,new L({emptyAllowed:!0,required:!0}))),ha=T("trigger/query/modification",e=>_(e,new W({values:{originalQuery:He,modification:He}})));d();c();l();u();d();c();l();u();function vc(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Fb(e){return Ur(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Dh={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function o0(e){return Ur(e).map(t=>{let r=Dh[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function i0(e){return[...o0(e.facetSet??{}),...Fb(e.numericFacetSet??{}),...Fb(e.dateFacetSet??{}),...Ur(e.categoryFacetSet??{})]}function a0(e){return i0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Ql(e){return vc(a0(e),e.facetOrder??[])}var zn=/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=u0(e),n=Ql(e),o=s0(e),i=yield $n(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Vr({...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 zn(_x92,_x93){return _ref37.apply(this,arguments)}}();function s0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(c0).filter(r=>r.currentValues.length>0):void 0}function c0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function u0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=l0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function l0(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 Wn=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x94,_x95){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Rr(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 Ge(t.response)?(this.dispatch(Hn(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let C=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(St(vt(_this19.getState()))),C})()}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 Ge(i.response)?(_this20.dispatch(Hn(i.response.error)),_this20.rejectWithValue(i.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(St(vt(_this20.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:qh()})})()}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:qh()}}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(ga("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let i=_this21.getCurrentQuery(),a=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return Ge(a.response)?(_this21.dispatch(Hn(a.response.error)),_this21.rejectWithValue(a.response.error)):(_this21.dispatch(St(vt(_this21.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Eb()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??at().enableQuerySyntax},search:{...yt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Nn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield zn(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Yt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(ha({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield zn(_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 ree=le("search/executeSearch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Bl(r,t,e)});return function(_x96,_x97){return _ref38.apply(this,arguments)}}()),nee=le("search/fetchPage",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){let r=t.getState();return yield jh(r,t,e)});return function(_x98,_x99){return _ref39.apply(this,arguments)}}()),oee=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Vh(t,r)});return function(_x100,_x101){return _ref40.apply(this,arguments)}}()),iee=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield m0(t,e,r)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),aee=le("search/fetchInstantResults",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){return Mh(e,t)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),d0=/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=yield zn(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function d0(_x106,_x107){return _ref43.apply(this,arguments)}}(),p0=/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t,r){let n=yield $n(e);return Vr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function p0(_x108,_x109,_x110){return _ref44.apply(this,arguments)}}(),f0=/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){let r=yield zn(e,t);return r.request.numberOfResults=0,r});return function f0(_x111,_x112){return _ref45.apply(this,arguments)}}(),Tb=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Mh(_x113,_x114){return _Mh.apply(this,arguments)}function _Mh(){_Mh=_asyncToGenerator(function*(e,t){_(e,{id:G,q:G,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Wn({...t,analyticsAction:xb()},m=>{t.dispatch(ql({q:m,id:e.id}))}),a=yield p0(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 _Mh.apply(this,arguments)}function jh(_x115,_x116,_x117){return _jh.apply(this,arguments)}function _jh(){_jh=_asyncToGenerator(function*(e,t,r){Tb(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 Wn({...t,analyticsAction:r}),f=yield zn(e,a),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _jh.apply(this,arguments)}function Vh(_x118,_x119){return _Vh.apply(this,arguments)}function _Vh(){_Vh=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Nh().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Wn({...e,analyticsAction:Nh()}),p=yield d0(t,i),f=yield a.fetchFromAPI(p,{origin:"mainSearch"});return yield a.process(f)});return _Vh.apply(this,arguments)}function m0(_x120,_x121,_x122){return _m2.apply(this,arguments)}function _m2(){_m2=_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 Wn({...e,analyticsAction:t}),f=yield f0(r,a),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _m2.apply(this,arguments)}function Bl(_x123,_x124,_x125){return _Bl.apply(this,arguments)}function _Bl(){_Bl=_asyncToGenerator(function*(e,t,r){Tb(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 zn(e,a),f=new Wn({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _Bl.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var Pb=ot(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 mr=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t,r){let n=Uh(e),o=g0(e),i=h0(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield $n(e,r):ma(e,t,r);return Vr({...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:Lh(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 mr(_x126,_x127,_x128){return _ref46.apply(this,arguments)}}();function Lh(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function g0(e){return vc(S0(e),e.facetOrder??[])}function h0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(y0).filter(r=>r.currentValues.length>0):void 0}function y0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function S0(e){return v0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function v0(e){return[...A0(e.facetSet??{}),...kb(e.numericFacetSet??{}),...kb(e.dateFacetSet??{}),...Ur(e.categoryFacetSet??{})]}function A0(e){return Ur(e).map(t=>{let r=Dh[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function kb(e){return Ur(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 Uh(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=Pb(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}var Yn=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x129,_x130){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Rr(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 Ge(t.response)?(this.dispatch(Hn(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let C=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(St(vt(_this26.getState()))),C})()}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 Ge(i.response)?(_this27.dispatch(Hn(i.response.error)),_this27.rejectWithValue(i.response.error)):(_this27.dispatch(St(vt(_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(ga("")),null;let i=_this28.getCurrentQuery(),a=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return Ge(a.response)?(_this28.dispatch(Hn(a.response.error)),_this28.rejectWithValue(a.response.error)):(_this28.dispatch(St(vt(_this28.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Nn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Ib(),o=yield _this29.fetchFromAPI(yield mr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Yt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(ha({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield mr(_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 ya=le("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new L,enableQuerySyntax:new ue,clearFilters:new ue}),e.clearFilters&&(r(Kt()),r(_l())),r(fa({allow:!0})),r(Ut({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Gn(1))}),Ob=T("search/updateSearchAction"),Fe=le("search/executeSearch",/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bl(r,t,e.legacy);_b(r);let n=e.next?Nb(e.next):void 0,o=yield mr(r,t.extra.navigatorContext,n),i=new Yn({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x131,_x132){return _ref47.apply(this,arguments)}}()),Br=le("search/fetchPage",/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=t.getState();if(_b(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return jh(r,t,e.legacy);let n=new Yn({...t,analyticsAction:e.next}),o=yield mr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x133,_x134){return _ref48.apply(this,arguments)}}()),Kn=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Vh(t,r);let n=kC("browseResults",t.getState),o=new Yn({...t,analyticsAction:n}),i=yield C0(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x135,_x136){return _ref49.apply(this,arguments)}}()),Sa=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Bl(r,t,e.legacy);let n=new Yn({...t,analyticsAction:{}}),o=yield x0(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),ute=le("search/fetchInstantResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Mh(e,t);_(e,{id:G,q:G,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=Nb(Rb()),a=yield b0(r,t.extra.navigatorContext,n,o,i),p=new Yn({...t,analyticsAction:i},h=>{t.dispatch(ql({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(_x139,_x140){return _ref51.apply(this,arguments)}}()),C0=/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t,r){let n=yield mr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function C0(_x141,_x142,_x143){return _ref52.apply(this,arguments)}}(),b0=/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t,r,n,o){let i=ma(e,t,o);return Vr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function b0(_x144,_x145,_x146,_x147,_x148){return _ref53.apply(this,arguments)}}(),x0=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t,r){let n=yield mr(e,t,r);return n.request.numberOfResults=0,n});return function x0(_x149,_x150,_x151){return _ref54.apply(this,arguments)}}(),_b=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Nb=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function qb(_x152,_x153){return _qb.apply(this,arguments)}function _qb(){_qb=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??$t(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 _qb.apply(this,arguments)}var Ac=le("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield qb(o,e),a=yield t.apiClient.html(i);return Ge(a)?n(a.error):{content:a.success,uniqueId:e.uniqueId}});return function(_x154,_x155){return _ref55.apply(this,arguments)}}()),Gl=T("resultPreview/next"),$l=T("resultPreview/previous"),Mb=T("resultPreview/prepare",e=>_(e,{results:new re({required:!0})})),Db=2048,Hl=le("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Cv(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Db&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Db} characters.`),{contentURL:o}});return function(_x156,_x157){return _ref56.apply(this,arguments)}}());d();c();l();u();function Qh(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Bh=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Qh();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Gh=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),va=ce(Qh(),e=>{e.addCase(Ac.pending,t=>{t.isLoading=!0}).addCase(Ac.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(Fe.fulfilled,(t,r)=>{Bh(t),t.resultsWithPreview=Gh(r.payload.response.results)}).addCase(Kn.fulfilled,(t,r)=>{Bh(t),t.resultsWithPreview=t.resultsWithPreview.concat(Gh(r.payload.response.results))}).addCase(Br.fulfilled,Bh).addCase(Mb,(t,r)=>{t.resultsWithPreview=Gh(r.payload.results)}).addCase(Gl,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase($l,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Hl.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var Jn=(e,t)=>{let r=e;return te(r[t])?te(e.raw[t])?null:e.raw[t]:r[t]},R0=e=>t=>e.every(r=>!te(Jn(t,r))),w0=e=>t=>e.every(r=>te(Jn(t,r))),I0=(e,t)=>r=>{let n=jb(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},E0=(e,t)=>r=>{let n=jb(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},jb=(e,t)=>{let r=Jn(t,e);return du(r)?r:[r]},Vb={getResultProperty:Jn,fieldsMustBeDefined:R0,fieldsMustNotBeDefined:w0,fieldMustMatch:I0,fieldMustNotMatch:E0};function zl(e){return e.search.response.searchUid!==""}function Lb(e,t,r){return e.search.results.find(n=>Jn(n,t)===r)}var $h=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Aa=T("app/setError");function Hh(e,t){let r=t.payload??null;r&&(e.response=yt().response,e.results=[],e.questionAnswer=qi()),e.error=r,e.isLoading=!1}function zh(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function F0(e,t){zh(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 Ub(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function T0(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var xe=ce(yt(),e=>{e.addCase(Fe.rejected,(t,r)=>Hh(t,r)),e.addCase(Kn.rejected,(t,r)=>Hh(t,r)),e.addCase(Br.rejected,(t,r)=>Hh(t,r)),e.addCase(Fe.fulfilled,(t,r)=>{F0(t,r)}),e.addCase(Kn.fulfilled,(t,r)=>{zh(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Br.fulfilled,(t,r)=>{zh(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Sa.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(Fe.pending,Ub),e.addCase(Kn.pending,T0),e.addCase(Br.pending,Ub),e.addCase(Ob,(t,r)=>{t.searchAction=r.payload}),e.addCase(Aa,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Wl=ce(Ki(),e=>{e.addCase(gl,(t,r)=>r.payload).addCase(Ze.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(ua,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();function Qb(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var Bb=Or;function tx(e,t){if(e===t||!(Bb(e)&&Bb(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]=tx(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function Ca(e){let t=0;for(let r in e)t++;return t}var Gb=e=>[].concat(...e);function P0(e){return new RegExp("(^|:)//").test(e)}function k0(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Jl(e){return e!=null}function O0(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var _0=e=>e.replace(/\/$/,""),N0=e=>e.replace(/^\//,"");function q0(e,t){if(!e)return t;if(!t)return e;if(P0(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=_0(e),t=N0(t),`${e}${r}${t}`}function D0(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var $b=(...e)=>A(...e),M0=e=>e.status>=200&&e.status<=299,j0=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Hb(e){if(!Or(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function rx({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=$b,paramsSerializer:n,isJsonContentType:o=j0,jsonContentType:i="application/json",jsonReplacer:a,timeout:p,responseHandler:f,validateStatus:m,...h}={}){return typeof A>"u"&&r===$b&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(C,g,S){let{getState:x,extra:w,endpoint:R,forced:I,type:E}=g,P,{url:V,headers:q=new b(h.headers),params:O=void 0,responseHandler:N=f??"json",validateStatus:M=m??M0,timeout:U=p,...Y}=typeof C=="string"?{url:C}:C,H,B=g.signal;U&&(H=new s.AbortController,g.signal.addEventListener("abort",H.abort),B=H.signal);let Q={...h,signal:B,...Y};q=new b(Hb(q)),Q.headers=(yield t(q,{getState:x,arg:C,extra:w,endpoint:R,forced:I,type:E,extraOptions:S}))||q;let z=Ce=>typeof Ce=="object"&&(Or(Ce)||Array.isArray(Ce)||typeof Ce.toJSON=="function");if(!Q.headers.has("content-type")&&z(Q.body)&&Q.headers.set("content-type",i),z(Q.body)&&o(Q.headers)&&(Q.body=JSON.stringify(Q.body,a)),O){let Ce=~V.indexOf("?")?"&":"?",Te=n?n(O):new URLSearchParams(Hb(O));V+=Ce+Te}V=q0(e,V);let $=new Request(V,Q);P={request:new Request(V,Q)};let ee,pe=!1,Re=H&&setTimeout(()=>{pe=!0,H.abort()},U);try{ee=yield r($)}catch(Ce){return{error:{status:pe?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Ce)},meta:P}}finally{Re&&clearTimeout(Re),H?.signal.removeEventListener("abort",H.abort)}let _e=ee.clone();P.response=_e;let be,we="";try{let Ce;if(yield Promise.all([v(ee,N).then(Te=>be=Te,Te=>Ce=Te),_e.text().then(Te=>we=Te,()=>{})]),Ce)throw Ce}catch(Ce){return{error:{status:"PARSING_ERROR",originalStatus:ee.status,data:we,error:String(Ce)},meta:P}}return M(ee,be)?{data:be,meta:P}:{error:{status:ee.status,data:be},meta:P}});return function(_x158,_x159,_x160){return _ref57.apply(this,arguments)}}());function v(_x161,_x162){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(C,g){if(typeof g=="function")return g(C);if(g==="content-type"&&(g=o(C.headers)?"json":"text"),g==="json"){let S=yield C.text();return S.length?JSON.parse(S):null}return C.text()});return _v2.apply(this,arguments)}}var ba=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function V0(){return _V2.apply(this,arguments)}function _V2(){_V2=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(o=>setTimeout(i=>o(i),n))});return _V2.apply(this,arguments)}function L0(e,t){throw Object.assign(new ba({error:e,meta:t}),{throwImmediately:!0})}var zb={},U0=(e,t)=>(/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(r,n,o){let i=[5,(t||zb).maxRetries,(o||zb).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),f={maxRetries:a,backoff:V0,retryCondition:(h,v,{attempt:C})=>C<=a,...t,...o},m=0;for(;;)try{let h=yield e(r,n,o);if(h.error)throw new ba(h);return h}catch(h){if(m++,h.throwImmediately){if(h instanceof ba)return h.value;throw h}if(h instanceof ba&&!f.retryCondition(h.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return h.value;yield f.backoff(m,f.maxRetries)}});return function(_x163,_x164,_x165){return _ref58.apply(this,arguments)}}()),nx=Object.assign(U0,{fail:L0}),Jh=T("__rtkq/focused"),ox=T("__rtkq/unfocused"),Xh=T("__rtkq/online"),ix=T("__rtkq/offline");function Zh(e){return e.type==="query"}function Q0(e){return e.type==="mutation"}function ey(e){return e.type==="infinitequery"}function ty(e,t,r,n,o,i){return B0(e)?e(t,r,n,o).filter(Jl).map(Wh).map(i):Array.isArray(e)?e.map(Wh).map(i):[]}function B0(e){return typeof e=="function"}function Wh(e){return typeof e=="string"?{type:e}:e}function G0(e,t){return e.catch(t)}var bc=Symbol("forceQueryFn"),Yh=e=>typeof e[bc]=="function";function $0({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i}){let a=new Map,p=new Map,{unsubscribeQueryResult:f,removeMutationResult:m,updateSubscriptionOptions:h}=o.internalActions;return{buildInitiateQuery:R,buildInitiateInfiniteQuery:I,buildInitiateMutation:E,getRunningQueryThunk:v,getRunningMutationThunk:C,getRunningQueriesThunk:g,getRunningMutationsThunk:S};function v(P,V){return q=>{let O=i.endpointDefinitions[P],N=e({queryArgs:V,endpointDefinition:O,endpointName:P});return a.get(q)?.[N]}}function C(P,V){return q=>p.get(q)?.[V]}function g(){return P=>Object.values(a.get(P)||{}).filter(Jl)}function S(){return P=>Object.values(p.get(P)||{}).filter(Jl)}function x(P){}function w(P,V){let q=(O,{subscribe:N=!0,forceRefetch:M,subscriptionOptions:U,[bc]:Y,...H}={})=>(B,Q)=>{let z=e({queryArgs:O,endpointDefinition:V,endpointName:P}),$,X={...H,type:"query",subscribe:N,forceRefetch:M,subscriptionOptions:U,endpointName:P,originalArgs:O,queryCacheKey:z,[bc]:Y};if(Zh(V))$=t(X);else{let{direction:je,initialPageParam:it}=H;$=r({...X,direction:je,initialPageParam:it})}let ee=o.endpoints[P].select(O),pe=B($),Re=ee(Q());let{requestId:_e,abort:be}=pe,we=Re.requestId!==_e,Ce=a.get(B)?.[z],Te=()=>ee(Q()),ut=Object.assign(Y?pe.then(Te):we&&!Ce?Promise.resolve(Re):Promise.all([Ce,pe]).then(Te),{arg:O,requestId:_e,subscriptionOptions:U,queryCacheKey:z,abort:be,unwrap(){return _asyncToGenerator(function*(){let je=yield ut;if(je.isError)throw je.error;return je.data})()},refetch:()=>B(q(O,{subscribe:!1,forceRefetch:!0})),unsubscribe(){N&&B(f({queryCacheKey:z,requestId:_e}))},updateSubscriptionOptions(je){ut.subscriptionOptions=je,B(h({endpointName:P,requestId:_e,queryCacheKey:z,options:je}))}});if(!Ce&&!we&&!Y){let je=D0(a,B,{});je[z]=ut,ut.then(()=>{delete je[z],Ca(je)||a.delete(B)})}return ut};return q}function R(P,V){return w(P,V)}function I(P,V){return w(P,V)}function E(P){return(V,{track:q=!0,fixedCacheKey:O}={})=>(N,M)=>{let U=n({type:"mutation",endpointName:P,originalArgs:V,track:q,fixedCacheKey:O}),Y=N(U);let{requestId:H,abort:B,unwrap:Q}=Y,z=G0(Y.unwrap().then(pe=>({data:pe})),pe=>({error:pe})),$=()=>{N(m({requestId:H,fixedCacheKey:O}))},X=Object.assign(z,{arg:Y.arg,requestId:H,abort:B,unwrap:Q,reset:$}),ee=p.get(N)||{};return p.set(N,ee),ee[H]=X,X.then(()=>{delete ee[H],Ca(ee)||p.delete(N)}),O&&(ee[O]=X,X.then(()=>{ee[O]===X&&(delete ee[O],Ca(ee)||p.delete(N))})),X}}}function H0(e){return e}var Yl=(e={})=>({...e,[rc]:!0});function z0({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a}){let p=(N,M,U,Y)=>(H,B)=>{let Q=r[N],z=n({queryArgs:M,endpointDefinition:Q,endpointName:N});if(H(o.internalActions.queryResultPatched({queryCacheKey:z,patches:U})),!Y)return;let $=o.endpoints[N].select(M)(B()),X=ty(Q.providesTags,$.data,void 0,M,{},i);H(o.internalActions.updateProvidedBy({queryCacheKey:z,providedTags:X}))};function f(N,M,U=0){let Y=[M,...N];return U&&Y.length>U?Y.slice(0,-1):Y}function m(N,M,U=0){let Y=[...N,M];return U&&Y.length>U?Y.slice(1):Y}let h=(N,M,U,Y=!0)=>(H,B)=>{let z=o.endpoints[N].select(M)(B()),$={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(N,M,$.inversePatches,Y))};if(z.status==="uninitialized")return $;let X;if("data"in z)if(zt(z.data)){let[ee,pe,Re]=Fu(z.data,U);$.patches.push(...pe),$.inversePatches.push(...Re),X=ee}else X=U(z.data),$.patches.push({op:"replace",path:[],value:X}),$.inversePatches.push({op:"replace",path:[],value:z.data});return $.patches.length===0||H(o.util.patchQueryData(N,M,$.patches,Y)),$},v=(N,M,U)=>Y=>Y(o.endpoints[N].initiate(M,{subscribe:!1,forceRefetch:!0,[bc]:()=>({data:U})})),C=(N,M)=>N.query&&N[M]?N[M]:H0,g=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(N,{signal:M,abort:U,rejectWithValue:Y,fulfillWithValue:H,dispatch:B,getState:Q,extra:z}){let $=r[N.endpointName];try{let X=C($,"transformResponse"),ee={signal:M,abort:U,dispatch:B,getState:Q,extra:z,endpoint:N.endpointName,type:N.type,forced:N.type==="query"?S(N,Q()):void 0,queryCacheKey:N.type==="query"?N.queryCacheKey:void 0},pe=N.type==="query"?N[bc]:void 0,Re,_e=/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(we,Ce,Te,ut){if(Ce==null&&we.pages.length)return Promise.resolve({data:we});let je={queryArg:N.originalArgs,pageParam:Ce},it=yield be(je),ft=ut?f:m;return{data:{pages:ft(we.pages,it.data,Te),pageParams:ft(we.pageParams,Ce,Te)}}});return function _e(_x168,_x169,_x170,_x171){return _ref60.apply(this,arguments)}}();function be(_x172){return _be.apply(this,arguments)}function _be(){_be=_asyncToGenerator(function*(we){let Ce,{extraOptions:Te}=$;if(pe?Ce=pe():$.query?Ce=yield t($.query(we),ee,Te):Ce=yield $.queryFn(we,ee,Te,je=>t(je,ee,Te)),typeof process<"u",Ce.error)throw new ba(Ce.error,Ce.meta);let ut=yield X(Ce.data,Ce.meta,we);return{...Ce,data:ut}});return _be.apply(this,arguments)}if(N.type==="query"&&"infiniteQueryOptions"in $){let{infiniteQueryOptions:we}=$,{maxPages:Ce=1/0}=we,Te,ut={pages:[],pageParams:[]},je=a.selectQueryEntry(Q(),N.queryCacheKey)?.data,ft=S(N,Q())&&!N.direction||!je?ut:je;if("direction"in N&&N.direction&&ft.pages.length){let Gt=N.direction==="backward",On=(Gt?ax:Kh)(we,ft);Te=yield _e(ft,On,Ce,Gt)}else{let{initialPageParam:Gt=we.initialPageParam}=N,cr=je?.pageParams??[],On=cr[0]??Gt,wi=cr.length;Te=yield _e(ft,On,Ce),pe&&(Te={data:Te.data.pages[0]});for(let Ii=1;Ii<wi;Ii++){let Ns=Kh(we,Te.data);Te=yield _e(Te.data,Ns,Ce)}}Re=Te}else Re=yield be(N.originalArgs);return H(Re.data,Yl({fulfilledTimeStamp:Date.now(),baseQueryMeta:Re.meta}))}catch(X){let ee=X;if(ee instanceof ba){let pe=C($,"transformErrorResponse");try{return Y(yield pe(ee.value,ee.meta,N.originalArgs),Yl({baseQueryMeta:ee.meta}))}catch(Re){ee=Re}}throw typeof process<"u",console.error(ee),ee}});return function g(_x166,_x167){return _ref59.apply(this,arguments)}}();function S(N,M){let U=a.selectQueryEntry(M,N.queryCacheKey),Y=a.selectConfig(M).refetchOnMountOrArgChange,H=U?.fulfilledTimeStamp,B=N.forceRefetch??(N.subscribe&&Y);return B?B===!0||(Number(new Date)-Number(H))/1e3>=B:!1}let x=()=>le(`${e}/executeQuery`,g,{getPendingMeta({arg:M}){let U=r[M.endpointName];return Yl({startedTimeStamp:Date.now(),...(ey(U)?{direction:M.direction}:{})})},condition(M,{getState:U}){let Y=U(),H=a.selectQueryEntry(Y,M.queryCacheKey),B=H?.fulfilledTimeStamp,Q=M.originalArgs,z=H?.originalArgs,$=r[M.endpointName],X=M.direction;return Yh(M)?!0:H?.status==="pending"?!1:S(M,Y)||Zh($)&&$?.forceRefetch?.({currentArg:Q,previousArg:z,endpointState:H,state:Y})?!0:!(B&&!X)},dispatchConditionRejection:!0}),w=x(),R=x(),I=le(`${e}/executeMutation`,g,{getPendingMeta(){return Yl({startedTimeStamp:Date.now()})}}),E=N=>"force"in N,P=N=>"ifOlderThan"in N,V=(N,M,U)=>(Y,H)=>{let B=E(U)&&U.force,Q=P(U)&&U.ifOlderThan,z=(X=!0)=>{let ee={forceRefetch:X,isPrefetch:!0};return o.endpoints[N].initiate(M,ee)},$=o.endpoints[N].select(M)(H());if(B)Y(z());else if(Q){let X=$?.fulfilledTimeStamp;if(!X){Y(z());return}(Number(new Date)-Number(new Date(X)))/1e3>=Q&&Y(z())}else Y(z(!1))};function q(N){return M=>M?.meta?.arg?.endpointName===N}function O(N,M){return{matchPending:Gi(Nu(N),q(M)),matchFulfilled:Gi(Sn(N),q(M)),matchRejected:Gi(ko(N),q(M))}}return{queryThunk:w,mutationThunk:I,infiniteQueryThunk:R,prefetch:V,updateQueryData:h,upsertQueryData:v,patchQueryData:p,buildMatchThunkActions:O}}function Kh(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function ax(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function sx(e,t,r,n){return ty(r[e.meta.arg.endpointName][t],Sn(e)?e.payload:void 0,oc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Kl(e,t,r){let n=e[t];n&&r(n)}function xc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Wb(e,t,r){let n=e[xc(t)];n&&r(n)}var Cc={};function W0({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 v(q,O,N,M){var U;q[U=O.queryCacheKey]??(q[U]={status:"uninitialized",endpointName:O.endpointName}),Kl(q,O.queryCacheKey,Y=>{Y.status="pending",Y.requestId=N&&Y.requestId?Y.requestId:M.requestId,O.originalArgs!==void 0&&(Y.originalArgs=O.originalArgs),Y.startedTimeStamp=M.startedTimeStamp;let H=o[M.arg.endpointName];ey(H)&&"direction"in O&&(Y.direction=O.direction)})}function C(q,O,N,M){Kl(q,O.arg.queryCacheKey,U=>{if(U.requestId!==O.requestId&&!M)return;let{merge:Y}=o[O.arg.endpointName];if(U.status="fulfilled",Y){if(U.data!==void 0){let{fulfilledTimeStamp:H,arg:B,baseQueryMeta:Q,requestId:z}=O,$=yn(U.data,X=>Y(X,N,{arg:B.originalArgs,baseQueryMeta:Q,fulfilledTimeStamp:H,requestId:z}));U.data=$}else U.data=N;}else U.data=o[O.arg.endpointName].structuralSharing??!0?tx(nr(U.data)?Sg(U.data):U.data,N):N;delete U.error,U.fulfilledTimeStamp=O.fulfilledTimeStamp})}let g=Oo({name:`${e}/queries`,initialState:Cc,reducers:{removeQueryResult:{reducer(q,{payload:{queryCacheKey:O}}){delete q[O]},prepare:$i()},cacheEntriesUpserted:{reducer(q,O){for(let N of O.payload){let{queryDescription:M,value:U}=N;v(q,M,!0,{arg:M,requestId:O.meta.requestId,startedTimeStamp:O.meta.timestamp}),C(q,{arg:M,requestId:O.meta.requestId,fulfilledTimeStamp:O.meta.timestamp,baseQueryMeta:{}},U,!0)}},prepare:q=>({payload:q.map(M=>{let{endpointName:U,arg:Y,value:H}=M,B=o[U];return{queryDescription:{type:"query",endpointName:U,originalArgs:M.arg,queryCacheKey:n({queryArgs:Y,endpointDefinition:B,endpointName:U})},value:H}}),meta:{[rc]:!0,requestId:ic(),timestamp:Date.now()}})},queryResultPatched:{reducer(q,{payload:{queryCacheKey:O,patches:N}}){Kl(q,O,M=>{M.data=Ag(M.data,N.concat())})},prepare:$i()}},extraReducers(q){q.addCase(t.pending,(O,{meta:N,meta:{arg:M}})=>{let U=Yh(M);v(O,M,U,N)}).addCase(t.fulfilled,(O,{meta:N,payload:M})=>{let U=Yh(N.arg);C(O,N,M,U)}).addCase(t.rejected,(O,{meta:{condition:N,arg:M,requestId:U},error:Y,payload:H})=>{Kl(O,M.queryCacheKey,B=>{if(!N){if(B.requestId!==U)return;B.status="rejected",B.error=H??Y}})}).addMatcher(p,(O,N)=>{let{queries:M}=a(N);for(let[U,Y]of Object.entries(M))(Y?.status==="fulfilled"||Y?.status==="rejected")&&(O[U]=Y)})}}),S=Oo({name:`${e}/mutations`,initialState:Cc,reducers:{removeMutationResult:{reducer(q,{payload:O}){let N=xc(O);N in q&&delete q[N]},prepare:$i()}},extraReducers(q){q.addCase(r.pending,(O,{meta:N,meta:{requestId:M,arg:U,startedTimeStamp:Y}})=>{U.track&&(O[xc(N)]={requestId:M,status:"pending",endpointName:U.endpointName,startedTimeStamp:Y})}).addCase(r.fulfilled,(O,{payload:N,meta:M})=>{M.arg.track&&Wb(O,M,U=>{U.requestId===M.requestId&&(U.status="fulfilled",U.data=N,U.fulfilledTimeStamp=M.fulfilledTimeStamp)})}).addCase(r.rejected,(O,{payload:N,error:M,meta:U})=>{U.arg.track&&Wb(O,U,Y=>{Y.requestId===U.requestId&&(Y.status="rejected",Y.error=N??M)})}).addMatcher(p,(O,N)=>{let{mutations:M}=a(N);for(let[U,Y]of Object.entries(M))(Y?.status==="fulfilled"||Y?.status==="rejected")&&U!==Y?.requestId&&(O[U]=Y)})}}),x=Oo({name:`${e}/invalidation`,initialState:Cc,reducers:{updateProvidedBy:{reducer(q,O){var U,Y;let{queryCacheKey:N,providedTags:M}=O.payload;for(let H of Object.values(q))for(let B of Object.values(H)){let Q=B.indexOf(N);Q!==-1&&B.splice(Q,1)}for(let{type:H,id:B}of M){let Q=(U=q[H]??(q[H]={}))[Y=B||"__internal_without_id"]??(U[Y]=[]);Q.includes(N)||Q.push(N)}},prepare:$i()}},extraReducers(q){q.addCase(g.actions.removeQueryResult,(O,{payload:{queryCacheKey:N}})=>{for(let M of Object.values(O))for(let U of Object.values(M)){let Y=U.indexOf(N);Y!==-1&&U.splice(Y,1)}}).addMatcher(p,(O,N)=>{var U,Y;let{provided:M}=a(N);for(let[H,B]of Object.entries(M))for(let[Q,z]of Object.entries(B)){let $=(U=O[H]??(O[H]={}))[Y=Q||"__internal_without_id"]??(U[Y]=[]);for(let X of z)$.includes(X)||$.push(X)}}).addMatcher(_r(Sn(t),oc(t)),(O,N)=>{let M=sx(N,"providesTags",o,f),{queryCacheKey:U}=N.meta.arg;x.caseReducers.updateProvidedBy(O,x.actions.updateProvidedBy({queryCacheKey:U,providedTags:M}))})}}),w=Oo({name:`${e}/subscriptions`,initialState:Cc,reducers:{updateSubscriptionOptions(q,O){},unsubscribeQueryResult(q,O){},internal_getRTKQSubscriptions(){}}}),R=Oo({name:`${e}/internalSubscriptions`,initialState:Cc,reducers:{subscriptionsUpdated:{reducer(q,O){return Ag(q,O.payload)},prepare:$i()}}}),I=Oo({name:`${e}/config`,initialState:{online:O0(),focused:k0(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(q,{payload:O}){q.middlewareRegistered=q.middlewareRegistered==="conflict"||i!==O?"conflict":!0}},extraReducers:q=>{q.addCase(Xh,O=>{O.online=!0}).addCase(ix,O=>{O.online=!1}).addCase(Jh,O=>{O.focused=!0}).addCase(ox,O=>{O.focused=!1}).addMatcher(p,O=>({...O}))}}),E=Mi({queries:g.reducer,mutations:S.reducer,provided:x.reducer,subscriptions:R.reducer,config:I.reducer}),P=(q,O)=>E(h.match(O)?void 0:q,O),V={...I.actions,...g.actions,...w.actions,...R.actions,...S.actions,...x.actions,resetApiState:h};return{reducer:P,actions:V}}var Vo=Symbol.for("RTKQ/skipToken"),cx={status:"uninitialized"},Yb=yn(cx,()=>{}),Kb=yn(cx,()=>{});function Y0({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>Yb,o=E=>Kb;return{buildQuerySelector:C,buildInfiniteQuerySelector:g,buildMutationSelector:S,selectInvalidatedBy:x,selectCachedArgsForQuery:w,selectApiState:a,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:h};function i(E){return{...E,...Qb(E.status)}}function a(E){return E[t]}function p(E){return a(E)?.queries}function f(E,P){return p(E)?.[P]}function m(E){return a(E)?.mutations}function h(E){return a(E)?.config}function v(E,P,V){return q=>{if(q===Vo)return r(n,V);let O=e({queryArgs:q,endpointDefinition:P,endpointName:E});return r(M=>f(M,O)??Yb,V)}}function C(E,P){return v(E,P,i)}function g(E,P){let{infiniteQueryOptions:V}=P;function q(O){let N={...O,...Qb(O.status)},{isLoading:M,isError:U,direction:Y}=N,H=Y==="forward",B=Y==="backward";return{...N,hasNextPage:R(V,N.data),hasPreviousPage:I(V,N.data),isFetchingNextPage:M&&H,isFetchingPreviousPage:M&&B,isFetchNextPageError:U&&H,isFetchPreviousPageError:U&&B}}return v(E,P,q)}function S(){return E=>{let P;return typeof E=="object"?P=xc(E)??Vo:P=E,r(P===Vo?o:O=>a(O)?.mutations?.[P]??Kb,i)}}function x(E,P){let V=E[t],q=new Set;for(let O of P.filter(Jl).map(Wh)){let N=V.provided[O.type];if(!N)continue;let M=(O.id!==void 0?N[O.id]:Gb(Object.values(N)))??[];for(let U of M)q.add(U)}return Gb(Array.from(q.values()).map(O=>{let N=V.queries[O];return N?[{queryCacheKey:O,endpointName:N.endpointName,originalArgs:N.originalArgs}]:[]}))}function w(E,P){return Object.values(p(E)).filter(V=>V?.endpointName===P&&V.status!=="uninitialized").map(V=>V.originalArgs)}function R(E,P){return P?Kh(E,P)!=null:!1}function I(E,P){return!P||!E.getPreviousPageParam?!1:ax(E,P)!=null}}var Jb=WeakMap?new WeakMap:void 0,Xb=({endpointName:e,queryArgs:t})=>{let r="",n=Jb?.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=Or(a)?Object.keys(a).sort().reduce((p,f)=>(p[f]=a[f],p),{}):a,a));Or(t)&&Jb?.set(t,o),r=o}return`${e}(${r})`};function K0(...e){return function(r){let n=Qi(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=Xb;if("serializeQueryArgs"in m.endpointDefinition){let v=m.endpointDefinition.serializeQueryArgs;h=C=>{let g=v(C);return typeof g=="string"?g:Xb({...C,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(m)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(m){m()},apiUid:ic(),extractRehydrationInfo:n,hasRehydrationInfo:Qi(m=>n(m)!=null)},a={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:h}){if(m)for(let v of m)o.tagTypes.includes(v)||o.tagTypes.push(v);if(h)for(let[v,C]of Object.entries(h))typeof C=="function"?C(i.endpointDefinitions[v]):Object.assign(i.endpointDefinitions[v]||{},C);return a}},p=e.map(m=>m.init(a,o,i));function f(m){let h=m.endpoints({query:v=>({...v,type:"query"}),mutation:v=>({...v,type:"mutation"}),infiniteQuery:v=>({...v,type:"infinitequery"})});for(let[v,C]of Object.entries(h)){if(m.overrideExisting!==!0&&v in i.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=C;for(let g of p)g.injectEndpoint(v,C)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function Cn(e,...t){return Object.assign(e,...t)}var J0=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,o=null,i=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:p}=e.internalActions,f=(g,S)=>{var w,R;if(a.match(S)){let{queryCacheKey:I,requestId:E,options:P}=S.payload;return g?.[I]?.[E]&&(g[I][E]=P),!0}if(p.match(S)){let{queryCacheKey:I,requestId:E}=S.payload;return g[I]&&delete g[I][E],!0}if(e.internalActions.removeQueryResult.match(S))return delete g[S.payload.queryCacheKey],!0;if(t.pending.match(S)){let{meta:{arg:I,requestId:E}}=S,P=g[w=I.queryCacheKey]??(g[w]={});return P[`${E}_running`]={},I.subscribe&&(P[E]=I.subscriptionOptions??P[E]??{}),!0}let x=!1;if(t.fulfilled.match(S)||t.rejected.match(S)){let I=g[S.meta.arg.queryCacheKey]||{},E=`${S.meta.requestId}_running`;x||(x=!!I[E]),delete I[E]}if(t.rejected.match(S)){let{meta:{condition:I,arg:E,requestId:P}}=S;if(I&&E.subscribe){let V=g[R=E.queryCacheKey]??(g[R]={});V[P]=E.subscriptionOptions??V[P]??{},x=!0}}return x},m=()=>r.currentSubscriptions,C={getSubscriptions:m,getSubscriptionCount:g=>{let x=m()[g]??{};return Ca(x)},isRequestSubscribed:(g,S)=>!!m()?.[g]?.[S]};return(g,S)=>{if(o||(o=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return o=r.currentSubscriptions={},i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,C];let x=f(r.currentSubscriptions,g),w=!0;if(x){i||(i=setTimeout(()=>{let E=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,P]=Fu(o,()=>E);S.next(e.internalActions.subscriptionsUpdated(P)),o=E,i=null},500));let R=typeof g.type=="string"&&!!g.type.startsWith(n),I=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;w=!R&&!I}return[w,!1]}};function X0(e){for(let t in e)return!1;return!0}var Z0=2147483647/1e3-1,eq=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a}})=>{let{removeQueryResult:p,unsubscribeQueryResult:f,cacheEntriesUpserted:m}=t.internalActions,h=_r(f.match,r.fulfilled,r.rejected,m.match);function v(w){let R=o.currentSubscriptions[w];return!!R&&!X0(R)}let C={},g=(w,R,I)=>{let E=R.getState(),P=a(E);if(h(w)){let V;if(m.match(w))V=w.payload.map(q=>q.queryDescription.queryCacheKey);else{let{queryCacheKey:q}=f.match(w)?w.payload:w.meta.arg;V=[q]}S(V,R,P)}if(t.util.resetApiState.match(w))for(let[V,q]of Object.entries(C))q&&clearTimeout(q),delete C[V];if(n.hasRehydrationInfo(w)){let{queries:V}=n.extractRehydrationInfo(w);S(Object.keys(V),R,P)}};function S(w,R,I){let E=R.getState();for(let P of w){let V=i(E,P);x(P,V?.endpointName,R,I)}}function x(w,R,I,E){let V=n.endpointDefinitions[R]?.keepUnusedDataFor??E.keepUnusedDataFor;if(V===1/0)return;let q=Math.max(0,Math.min(V,Z0));if(!v(w)){let O=C[w];O&&clearTimeout(O),C[w]=setTimeout(()=>{v(w)||I.dispatch(p({queryCacheKey:w})),delete C[w]},q*1e3)}}return g},Zb=new Error("Promise never resolved before cacheEntryRemoved."),tq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:p}})=>{let f=qu(n),m=qu(o),h=Sn(n,o),v={};function C(R,I,E){let P=v[R];P?.valueResolved&&(P.valueResolved({data:I,meta:E}),delete P.valueResolved)}function g(R){let I=v[R];I&&(delete v[R],I.cacheEntryRemoved())}let S=(R,I,E)=>{let P=x(R);function V(q,O,N,M){let U=a(E,O),Y=a(I.getState(),O);!U&&Y&&w(q,M,O,I,N)}if(n.pending.match(R))V(R.meta.arg.endpointName,P,R.meta.requestId,R.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(R))for(let{queryDescription:q,value:O}of R.payload){let{endpointName:N,originalArgs:M,queryCacheKey:U}=q;V(N,U,R.meta.requestId,M),C(U,O,{})}else if(o.pending.match(R))I.getState()[t].mutations[P]&&w(R.meta.arg.endpointName,R.meta.arg.originalArgs,P,I,R.meta.requestId);else if(h(R))C(P,R.payload,R.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(R)||e.internalActions.removeMutationResult.match(R))g(P);else if(e.util.resetApiState.match(R))for(let q of Object.keys(v))g(q)};function x(R){return f(R)?R.meta.arg.queryCacheKey:m(R)?R.meta.arg.fixedCacheKey??R.meta.requestId:e.internalActions.removeQueryResult.match(R)?R.payload.queryCacheKey:e.internalActions.removeMutationResult.match(R)?xc(R.payload):""}function w(R,I,E,P,V){let q=r.endpointDefinitions[R],O=q?.onCacheEntryAdded;if(!O)return;let N={},M=new Promise(z=>{N.cacheEntryRemoved=z}),U=Promise.race([new Promise(z=>{N.valueResolved=z}),M.then(()=>{throw Zb})]);U.catch(()=>{}),v[E]=N;let Y=e.endpoints[R].select(q.type==="query"?I:E),H=P.dispatch((z,$,X)=>X),B={...P,getCacheEntry:()=>Y(P.getState()),requestId:V,extra:H,updateCachedData:q.type==="query"?z=>P.dispatch(e.util.updateQueryData(R,I,z)):void 0,cacheDataLoaded:U,cacheEntryRemoved:M},Q=O(I,B);Promise.resolve(Q).catch(z=>{if(z!==Zb)throw z})}return S},rq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},nq=({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=_r(Sn(n),oc(n)),v=_r(Sn(n,o),ko(n,o)),C=[],g=(w,R)=>{h(w)?x(sx(w,"invalidatesTags",r,a),R):v(w)?x([],R):i.util.invalidateTags.match(w)&&x(ty(w.payload,void 0,void 0,void 0,void 0,a),R)};function S(w){let{queries:R,mutations:I}=w;for(let E of[R,I])for(let P in E)if(E[P]?.status==="pending")return!0;return!1}function x(w,R){let I=R.getState(),E=I[e];if(C.push(...w),E.config.invalidationBehavior==="delayed"&&S(E))return;let P=C;if(C=[],P.length===0)return;let V=i.util.selectInvalidatedBy(I,P);t.batch(()=>{let q=Array.from(V.values());for(let{queryCacheKey:O}of q){let N=E.queries[O],M=f.currentSubscriptions[O]??{};N&&(Ca(M)===0?R.dispatch(m({queryCacheKey:O})):N.status!=="uninitialized"&&R.dispatch(p(N)))}})}return g},oq=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let i={},a=(g,S)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&m(g.payload,S),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&m(g.meta.arg,S),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&f(g.meta.arg,S),r.util.resetApiState.match(g)&&v()};function p(g,S){let w=S.getState()[e].queries[g],R=o.currentSubscriptions[g];if(!(!w||w.status==="uninitialized"))return R}function f({queryCacheKey:g},S){let x=S.getState()[e],w=x.queries[g],R=o.currentSubscriptions[g];if(!w||w.status==="uninitialized")return;let{lowestPollingInterval:I,skipPollingIfUnfocused:E}=C(R);if(!Number.isFinite(I))return;let P=i[g];P?.timeout&&(clearTimeout(P.timeout),P.timeout=void 0);let V=Date.now()+I;i[g]={nextPollTimestamp:V,pollingInterval:I,timeout:setTimeout(()=>{(x.config.focused||!E)&&S.dispatch(n(w)),f({queryCacheKey:g},S)},I)}}function m({queryCacheKey:g},S){let w=S.getState()[e].queries[g],R=o.currentSubscriptions[g];if(!w||w.status==="uninitialized")return;let{lowestPollingInterval:I}=C(R);if(!Number.isFinite(I)){h(g);return}let E=i[g],P=Date.now()+I;(!E||P<E.nextPollTimestamp)&&f({queryCacheKey:g},S)}function h(g){let S=i[g];S?.timeout&&clearTimeout(S.timeout),delete i[g]}function v(){for(let g of Object.keys(i))h(g)}function C(g={}){let S=!1,x=Number.POSITIVE_INFINITY;for(let w in g)g[w].pollingInterval&&(x=Math.min(g[w].pollingInterval,x),S=g[w].skipPollingIfUnfocused||S);return{lowestPollingInterval:x,skipPollingIfUnfocused:S}}return a},iq=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Nu(r,n),i=ko(r,n),a=Sn(r,n),p={};return(m,h)=>{if(o(m)){let{requestId:v,arg:{endpointName:C,originalArgs:g}}=m.meta,S=t.endpointDefinitions[C],x=S?.onQueryStarted;if(x){let w={},R=new Promise((V,q)=>{w.resolve=V,w.reject=q});R.catch(()=>{}),p[v]=w;let I=e.endpoints[C].select(S.type==="query"?g:v),E=h.dispatch((V,q,O)=>O),P={...h,getCacheEntry:()=>I(h.getState()),requestId:v,extra:E,updateCachedData:S.type==="query"?V=>h.dispatch(e.util.updateQueryData(C,g,V)):void 0,queryFulfilled:R};x(g,P)}}else if(a(m)){let{requestId:v,baseQueryMeta:C}=m.meta;p[v]?.resolve({data:m.payload,meta:C}),delete p[v]}else if(i(m)){let{requestId:v,rejectedWithValue:C,baseQueryMeta:g}=m.meta;p[v]?.reject({error:m.payload??m.error,isUnhandledError:!C,meta:g}),delete p[v]}}},aq=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(f,m)=>{Jh.match(f)&&p(m,"refetchOnFocus"),Xh.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let h=f.getState()[e],v=h.queries,C=o.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(C)){let S=v[g],x=C[g];if(!x||!S)continue;(Object.values(x).some(R=>R[m]===!0)||Object.values(x).every(R=>R[m]===void 0)&&h.config[m])&&(Ca(x)===0?f.dispatch(i({queryCacheKey:g})):S.status!=="uninitialized"&&f.dispatch(n(S)))}})}return a};function sq(e){let{reducerPath:t,queryThunk:r,api:n,context:o}=e,{apiUid:i}=o,a={invalidateTags:T(`${t}/invalidateTags`)},p=v=>v.type.startsWith(`${t}/`),f=[rq,eq,nq,oq,tq,iq];return{middleware:v=>{let C=!1,S={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:p},x=f.map(I=>I(S)),w=J0(S),R=aq(S);return I=>E=>{if(!Vi(E))return I(E);C||(C=!0,v.dispatch(n.internalActions.middlewareRegistered(i)));let P={...v,next:I},V=v.getState(),[q,O]=w(E,P,V),N;if(q?N=I(E):N=O,v.getState()[t]&&(R(E,P,V),p(E)||o.hasRehydrationInfo(E)))for(let M of x)M(E,P,V);return N}},actions:a};function h(v){return e.api.endpoints[v.endpointName].initiate(v.originalArgs,{subscribe:!1,forceRefetch:!0})}}var ex=Symbol(),cq=({createSelector:e=ot}={})=>({name:ex,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:h},v){Hv();let C=be=>(typeof process<"u",be);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Xh,onOffline:ix,onFocus:Jh,onFocusLost:ox},util:{}});let g=Y0({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:S,selectCachedArgsForQuery:x,buildQuerySelector:w,buildInfiniteQuerySelector:R,buildMutationSelector:I}=g;Cn(t.util,{selectInvalidatedBy:S,selectCachedArgsForQuery:x});let{queryThunk:E,infiniteQueryThunk:P,mutationThunk:V,patchQueryData:q,updateQueryData:O,upsertQueryData:N,prefetch:M,buildMatchThunkActions:U}=z0({baseQuery:r,reducerPath:o,context:v,api:t,serializeQueryArgs:i,assertTagType:C,selectors:g}),{reducer:Y,actions:H}=W0({context:v,queryThunk:E,infiniteQueryThunk:P,mutationThunk:V,serializeQueryArgs:i,reducerPath:o,assertTagType:C,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});Cn(t.util,{patchQueryData:q,updateQueryData:O,upsertQueryData:N,prefetch:M,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),Cn(t.internalActions,H);let{middleware:B,actions:Q}=sq({reducerPath:o,context:v,queryThunk:E,mutationThunk:V,infiniteQueryThunk:P,api:t,assertTagType:C,selectors:g});Cn(t.util,Q),Cn(t,{reducer:Y,middleware:B});let{buildInitiateQuery:z,buildInitiateInfiniteQuery:$,buildInitiateMutation:X,getRunningMutationThunk:ee,getRunningMutationsThunk:pe,getRunningQueriesThunk:Re,getRunningQueryThunk:_e}=$0({queryThunk:E,mutationThunk:V,infiniteQueryThunk:P,api:t,serializeQueryArgs:i,context:v});return Cn(t.util,{getRunningMutationThunk:ee,getRunningMutationsThunk:pe,getRunningQueryThunk:_e,getRunningQueriesThunk:Re}),{name:ex,injectEndpoint(be,we){var ut;let Te=(ut=t.endpoints)[be]??(ut[be]={});Zh(we)&&Cn(Te,{name:be,select:w(be,we),initiate:z(be,we)},U(E,be)),Q0(we)&&Cn(Te,{name:be,select:I(),initiate:X(be)},U(V,be)),ey(we)&&Cn(Te,{name:be,select:R(be,we),initiate:$(be,we)},U(E,be))}}}}),ux=K0(cq());d();c();l();u();d();c();l();u();var Lo=e=>e.query,lx=e=>e.query?.enableQuerySyntax;var dx=ot(e=>Lo(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})),Xl=ot(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Rc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var xa=e=>$e({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Ve(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Ve(t)??"",answerGenerated:e??!1})}),Ra=()=>$e({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});var px=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var fx=ot(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 mx=e=>e.context;d();c();l();u();var ry=e=>e.pipeline;d();c();l();u();var ny=e=>e.searchHub;d();c();l();u();var Qt=ot(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Dne=ot(e=>e,e=>{let t=Qt(e);return t&&e?e[t].expression:""});d();c();l();u();var gx=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var hx=e=>e.excerptLength?.length;d();c();l();u();var Gr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,yx=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Sx=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 vx=e=>e.sortCriteria;var Ax=/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Ax(_x173){return _ref61.apply(this,arguments)}}(),Cx=(e,t)=>{let r=Lo(e)?.q,{aq:n,cq:o,dq:i,lq:a}=lq(e),p=mx(e),f=jo(e.configuration.analytics,t,{actionCause:$h(e)}),m=ny(e),h=ry(e),v=ah(e)??[],C=xx(e),g=Qt(e.tabSet)||"default",S=oh(e),x=yC(e),w=t.referrer||"",R=yx(e),I=vx(e),E=uq(e),P=hx(e),V=Sx(e),q=gx(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:lx(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(m?.length&&{searchHub:m}),...(h?.length&&{pipeline:h}),...(C.length&&{facets:C}),...(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:Lh(e),firstResult:e.pagination.firstResult}),tab:g,locale:S,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(V??{}),...(P&&{excerptLength:P}),...(q&&{dictionaryFieldContext:q}),sortCriteria:I,...(R&&{facetOptions:R}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},bx=(e,t)=>{let r=Lo(e)?.q,n=xx(e),o=jo(e.configuration.analytics,t,{actionCause:$h(e)}),i=oh(e),a=ny(e),p=ry(e),f=ah(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:f}},...(a?.length&&{searchHub:a}),...(p?.length&&{pipeline:p}),...o,locale:i}},xx=e=>Ql(e)?.map(t=>Rh(t,xh())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),uq=e=>({actionsHistory:e.configuration.analytics.enabled?Nt.getInstance().getHistory():[]}),lq=e=>{let t=fx(e),r=Uh(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var wa=["searching","thinking","answering"];function oy(){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 Rx=["text/plain","text/markdown"];var Ia=new L({required:!0}),wx=new L,Ea=new ue({required:!0}),iy={id:Ia,title:Ia,uri:Ia,permanentid:Ia,clickUri:wx},Zl=new L({required:!0,constrainTo:Rx}),Fa=T("generatedAnswer/setIsVisible",e=>_(e,Ea)),Ta=T("generatedAnswer/setAnswerId",e=>_(e,G)),ed=T("generatedAnswer/setAnswerGenerationMode",e=>_(e,new L({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),wc=T("generatedAnswer/setIsEnabled",e=>_(e,Ea)),Qo=T("generatedAnswer/updateMessage",e=>_(e,{textDelta:Ia})),Bo=T("generatedAnswer/updateCitations",e=>_(e,{citations:new re({required:!0,each:new W({values:iy})})})),Go=T("generatedAnswer/updateError",e=>_(e,{message:wx,code:new ne({min:0})})),ar=T("generatedAnswer/resetAnswer"),td=T("generatedAnswer/like"),rd=T("generatedAnswer/dislike"),nd=T("generatedAnswer/feedbackModal/open"),Ic=T("generatedAnswer/expand"),od=T("generatedAnswer/collapse"),id=T("generatedAnswer/setId",e=>_(e,{id:new L({required:!0})})),ad=T("generatedAnswer/feedbackModal/close"),Pa=T("generatedAnswer/sendFeedback"),$r=T("generatedAnswer/setIsLoading",e=>_(e,Ea)),Uo=T("generatedAnswer/setIsStreaming",e=>_(e,Ea)),$o=T("generatedAnswer/setAnswerContentFormat",e=>_(e,Zl)),sd=T("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new re({each:Zl,default:["text/plain"]})})),cd=T("knowledge/updateAnswerConfigurationId",e=>_(e,Ia)),ud=T("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Cu)),Ec=T("generatedAnswer/setIsAnswerGenerated",e=>_(e,Ea)),Ho=T("generatedAnswer/setCannotAnswer",e=>_(e,Ea)),ay=T("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new W({}))),ld=T("generatedAnswer/startStep",e=>_(e,{name:new L({required:!0,constrainTo:wa}),startedAt:new ne({min:0,required:!0})})),dd=T("generatedAnswer/finishStep",e=>_(e,{name:new L({required:!0,constrainTo:wa}),finishedAt:new ne({min:0,required:!0})})),Ix=le("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref62=_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 Ax(r),h=(g,S)=>{switch(g){case"genqa.headerMessageType":{let x=JSON.parse(S);n($o(x.contentFormat));break}case"genqa.messageType":n(Qo(JSON.parse(S)));break;case"genqa.citationsType":n(Bo(JSON.parse(S)));break;case"genqa.endOfStreamType":{let x=JSON.parse(S).answerGenerated,w=p.length!==0&&!x;n(Ho(w)),n(Uo(!1)),n(Ec(x)),n(xa(x)),n(Ra());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${g}"`)}};n($r(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,C=o.streamingClient?.streamGeneratedAnswer(m,{write:g=>{v(m)&&(n($r(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(m)&&n(Go(g))},close:()=>{v(m)&&n(Uo(!1))},resetAnswer:()=>{v(m)&&n(ar())}});C?f(C):n($r(!1))});return function(_x174,_x175){return _ref62.apply(this,arguments)}}()),pd=le("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(ar());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=Cx(i,n);r(ay(a)),yield r(fd(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(_x176,_x177){return _ref63.apply(this,arguments)}}());d();c();l();u();var dq=/*#__PURE__*/function(){var _ref64=_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=We(a,i);return{data:rx({baseUrl:`${m}/rest/organizations/${a}/answer/v1/configs/${p}`,fetchFn:function(){var _ref65=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let C=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(S=>{g[S]=v[S]}),g.duplex="half",g.body=yield v.text(),A(C,g)});return function fetchFn(_x181){return _ref65.apply(this,arguments)}}()})(f,{...t,signal:null},r)}}catch(m){return{error:m}}});return function dq(_x178,_x179,_x180){return _ref64.apply(this,arguments)}}(),md=ux({reducerPath:"answer",baseQuery:nx(dq,{maxRetries:3}),endpoints:()=>({})});var pq=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},fq=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},mq=(e,t)=>{e.citations=t.citations},gq=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},hq=(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})`)},yq=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&hq(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(pq(t,o),r($o(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(fq(t,o),r(Qo({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(mq(t,o),r(Bo({citations:o.citations})));break;case"genqa.endOfStreamType":gq(t,o),r(xa(o.answerGenerated??!1)),r(Ra());break}},Sq=(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`},zo=md.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(_x182,_x183){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:v}=a,C=We(m,h),g=Sq(C,m,p.answerConfigurationId,f?.insightId);yield gu(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:A,onopen:function(){var _ref66=_asyncToGenerator(function*(S){let x=S.headers.get("x-answer-id");x&&o(w=>{w.answerId=x,i(Ta(x))})});return function onopen(_x184){return _ref66.apply(this,arguments)}}(),onmessage:S=>{o(x=>{yq(S,x,i)})},onerror:S=>{throw S},onclose:()=>{o(S=>{i(Ho(!S.generated))})}})}).apply(this,arguments)}})})}),fd=e=>zo.endpoints.getAnswer.initiate(e),sy=e=>{let t=Xl(e);return zo.endpoints.getAnswer.select(t??Vo)(e)};d();c();l();u();var Ex=ce(qn,e=>e);d();c();l();u();function vq(e){let t=e.payload?.analyticsAction;return Fx(e)&&!te(t)}function Fx(e){return"type"in e}var Tx=e=>t=>r=>{let n;vq(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Fx(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 gd={q:new L,enableQuerySyntax:new ue,aq:new L,cq:new L,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new L,f:new W,fExcluded:new W,cf:new W,nf:new W,mnf:new W,df:new W,debug:new ue,sf:new W,tab:new L,af:new W};var tt=T("searchParameters/restore",e=>_(e,gd)),hd=T("searchParameters/restoreTab",e=>_(e,G));d();c();l();u();var yd=T("tab/register",e=>{let t=new W({values:{id:G,expression:Ye}});return _(e,t)}),Tt=T("tab/updateActiveTab",e=>_(e,G));d();c();l();u();var Sd=Cr(hl(),1),Ox=Cr(Px(),1),_x=Cr(kx(),1);Sd.default.extend(_x.default);Sd.default.extend(Ox.default);var vd=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Sd.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 Aq=/(^|; )Coveo-Pendragon=([^;]*)/;function py(){return typeof window>"u"?!1:Aq.exec(document.cookie)?.pop()||null}var Ad=ce(vd(),e=>e.addCase(ca,(t,r)=>{Cq(t,r.payload)}).addCase(ua,(t,r)=>{bq(t,r.payload)}).addCase(ll,(t,r)=>{xq(t,r.payload)}).addCase(dl,t=>{t.analytics.enabled=!1}).addCase(pl,t=>{t.analytics.enabled=!0}).addCase(LC,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(UC,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Tt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hd,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(tt,(t,r)=>{te(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(QC,(t,{payload:r})=>{t.knowledge.agentId=r}));function Cq(e,t){te(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",te(t.organizationId)||(e.organizationId=t.organizationId)}function bq(e,t){te(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),te(t.locale)||(e.search.locale=t.locale),te(t.timezone)||(e.search.timezone=t.timezone),te(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xq(e,t){te(t.enabled)||(e.analytics.enabled=t.enabled),te(t.originContext)||(e.analytics.originContext=t.originContext),te(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),te(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),te(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),te(t.trackingId)||(e.analytics.trackingId=t.trackingId),te(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),te(t.source)||(e.analytics.source=t.source);try{let r=py();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}te(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),te(t.anonymous)||(e.analytics.anonymous=t.anonymous),te(t.deviceId)||(e.analytics.deviceId=t.deviceId),te(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),te(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var ve=Ad;d();c();l();u();function Rq(e){return e.instantlyCallable}var Nx=()=>e=>t=>e(Rq(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 Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function qx(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var fy,wq=new Uint8Array(16);function my(){if(!fy){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fy=crypto.getRandomValues.bind(crypto)}return fy(wq)}d();c();l();u();d();c();l();u();var Iq=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gy={randomUUID:Iq};function Eq(e,t,r){if(gy.randomUUID&&!t&&!e)return gy.randomUUID();e=e||{};let n=e.random??e.rng?.()??my();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 qx(n)}var Xn=Eq;d();c();l();u();d();c();l();u();var F={};Ms(F,{BRAND:()=>Zq,DIRTY:()=>Wo,EMPTY_PATH:()=>kq,INVALID:()=>ye,NEVER:()=>MD,OK:()=>qt,ParseStatus:()=>kt,Schema:()=>Pe,ZodAny:()=>to,ZodArray:()=>wn,ZodBigInt:()=>Ko,ZodBoolean:()=>Jo,ZodBranded:()=>Tc,ZodCatch:()=>ci,ZodDate:()=>Xo,ZodDefault:()=>si,ZodDiscriminatedUnion:()=>xd,ZodEffects:()=>yr,ZodEnum:()=>ii,ZodError:()=>Jt,ZodFirstPartyTypeKind:()=>Ae,ZodFunction:()=>wd,ZodIntersection:()=>ri,ZodIssueCode:()=>K,ZodLazy:()=>ni,ZodLiteral:()=>oi,ZodMap:()=>Da,ZodNaN:()=>ja,ZodNativeEnum:()=>ai,ZodNever:()=>wr,ZodNull:()=>ei,ZodNullable:()=>Wr,ZodNumber:()=>Yo,ZodObject:()=>Xt,ZodOptional:()=>gr,ZodParsedType:()=>ae,ZodPipeline:()=>Pc,ZodPromise:()=>ro,ZodReadonly:()=>ui,ZodRecord:()=>Rd,ZodSchema:()=>Pe,ZodSet:()=>Ma,ZodString:()=>eo,ZodSymbol:()=>Na,ZodTransformer:()=>yr,ZodTuple:()=>zr,ZodType:()=>Pe,ZodUndefined:()=>Zo,ZodUnion:()=>ti,ZodUnknown:()=>Rn,ZodVoid:()=>qa,addIssueToContext:()=>ie,any:()=>cD,array:()=>pD,bigint:()=>nD,boolean:()=>Hx,coerce:()=>DD,custom:()=>Bx,date:()=>oD,datetimeRegex:()=>Ux,defaultErrorMap:()=>bn,discriminatedUnion:()=>hD,effect:()=>FD,enum:()=>wD,function:()=>bD,getErrorMap:()=>ka,getParsedType:()=>Hr,instanceof:()=>tD,intersection:()=>yD,isAborted:()=>Cd,isAsync:()=>Oa,isDirty:()=>bd,isValid:()=>Zn,late:()=>eD,lazy:()=>xD,literal:()=>RD,makeIssue:()=>Fc,map:()=>AD,nan:()=>rD,nativeEnum:()=>ID,never:()=>lD,null:()=>sD,nullable:()=>PD,number:()=>$x,object:()=>fD,objectUtil:()=>hy,oboolean:()=>qD,onumber:()=>ND,optional:()=>TD,ostring:()=>_D,pipeline:()=>OD,preprocess:()=>kD,promise:()=>ED,quotelessJson:()=>Fq,record:()=>vD,set:()=>CD,setErrorMap:()=>Pq,strictObject:()=>mD,string:()=>Gx,symbol:()=>iD,transformer:()=>FD,tuple:()=>SD,undefined:()=>aD,union:()=>gD,unknown:()=>uD,util:()=>Ne,void:()=>dD});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 hy;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(hy||(hy={}));var ae=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hr=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}};var K=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"]),Fq=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Jt=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()}};Jt.create=e=>new Jt(e);var Tq=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===ae.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.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 K.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 K.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 K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ne.assertNever(e)}return{message:r}},bn=Tq;var Dx=bn;function Pq(e){Dx=e}function ka(){return Dx}d();c();l();u();var Fc=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}},kq=[];function ie(e,t){let r=ka(),n=Fc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===bn?void 0:bn].filter(o=>!!o)});e.common.issues.push(n)}var kt=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 ye;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 ye;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}}},ye=Object.freeze({status:"aborted"}),Wo=e=>({status:"dirty",value:e}),qt=e=>({status:"valid",value:e}),Cd=e=>e.status==="aborted",bd=e=>e.status==="dirty",Zn=e=>e.status==="valid",Oa=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var de;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(de||(de={}));var hr=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}},Mx=(e,t)=>{if(Zn(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 Jt(e.common.issues);return this._error=r,this._error}}};function Ie(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 Pe=class{get description(){return this._def.description}_getType(t){return Hr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new kt,ctx:{common:t.parent.common,data:t.data,parsedType:Hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Oa(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:Hr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Mx(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Zn(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=>Zn(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:Hr(t)},o=_this32._parse({data:t,path:n.path,parent:n}),i=yield Oa(o)?o:Promise.resolve(o);return Mx(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:K.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 yr({schema:this,typeName:Ae.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 gr.create(this,this._def)}nullable(){return Wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wn.create(this)}promise(){return ro.create(this,this._def)}or(t){return ti.create([this,t],this._def)}and(t){return ri.create(this,t,this._def)}transform(t){return new yr({...Ie(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new si({...Ie(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new Tc({typeName:Ae.ZodBranded,type:this,...Ie(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ci({...Ie(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Pc.create(this,t)}readonly(){return ui.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Oq=/^c[^\s-]{8,}$/i,_q=/^[0-9a-z]+$/,Nq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qq=/^[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,Dq=/^[a-z0-9_-]{21}$/i,Mq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jq=/^[-+]?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)?)??$/,Vq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yy,Uq=/^(?:(?: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])$/,Qq=/^(?:(?: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])$/,Bq=/^(([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]))$/,Gq=/^(([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])$/,$q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vx="((\\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])))",zq=new RegExp(`^${Vx}$`);function Lx(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 Wq(e){return new RegExp(`^${Lx(e)}$`)}function Ux(e){let t=`${Vx}T${Lx(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 Yq(e,t){return!!((t==="v4"||!t)&&Uq.test(e)||(t==="v6"||!t)&&Bq.test(e))}function Kq(e,t){if(!Mq.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 Jq(e,t){return!!((t==="v4"||!t)&&Qq.test(e)||(t==="v6"||!t)&&Gq.test(e))}var eo=class e extends Pe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.string,received:i.parsedType}),ye}let n=new kt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:K.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),ie(o,{code:K.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?ie(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):p&&ie(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Vq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")yy||(yy=new RegExp(Lq,"u")),yy.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")qq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Dq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Oq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")_q.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Nq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ie(o,{validation:"url",code:K.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),ie(o,{validation:"regex",code:K.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),ie(o,{code:K.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),ie(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ux(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?zq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Wq(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?jq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Yq(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Kq(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Jq(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?$q.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Hq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64url",code:K.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:K.invalid_string,...de.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...de.errToObj(t)})}url(t){return this._addCheck({kind:"url",...de.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...de.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...de.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...de.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...de.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...de.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...de.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...de.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...de.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...de.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...de.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...de.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,...de.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,...de.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...de.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...de.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...de.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...de.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...de.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...de.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...de.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...de.errToObj(r)})}nonempty(t){return this.min(1,de.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}};eo.create=e=>new eo({checks:[],typeName:Ae.ZodString,coerce:e?.coerce??!1,...Ie(e)});function Xq(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 Yo=class e extends Pe{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)!==ae.number){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.number,received:i.parsedType}),ye}let n,o=new kt;for(let i of this._def.checks)i.kind==="int"?Ne.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ie(n,{code:K.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),ie(n,{code:K.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),ie(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Xq(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ie(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ie(n,{code:K.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,de.toString(r))}gt(t,r){return this.setLimit("min",t,!1,de.toString(r))}lte(t,r){return this.setLimit("max",t,!0,de.toString(r))}lt(t,r){return this.setLimit("max",t,!1,de.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:de.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:de.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:de.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.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)}};Yo.create=e=>new Yo({checks:[],typeName:Ae.ZodNumber,coerce:e?.coerce||!1,...Ie(e)});var Ko=class e extends Pe{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)!==ae.bigint)return this._getInvalidInput(t);let n,o=new kt;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),ie(n,{code:K.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),ie(n,{code:K.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),ie(n,{code:K.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 ie(r,{code:K.invalid_type,expected:ae.bigint,received:r.parsedType}),ye}gte(t,r){return this.setLimit("min",t,!0,de.toString(r))}gt(t,r){return this.setLimit("min",t,!1,de.toString(r))}lte(t,r){return this.setLimit("max",t,!0,de.toString(r))}lt(t,r){return this.setLimit("max",t,!1,de.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:de.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:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:de.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}};Ko.create=e=>new Ko({checks:[],typeName:Ae.ZodBigInt,coerce:e?.coerce??!1,...Ie(e)});var Jo=class extends Pe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.boolean,received:n.parsedType}),ye}return qt(t.data)}};Jo.create=e=>new Jo({typeName:Ae.ZodBoolean,coerce:e?.coerce||!1,...Ie(e)});var Xo=class e extends Pe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.date,received:i.parsedType}),ye}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_date}),ye}let n=new kt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:K.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),ie(o,{code:K.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:de.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:de.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}};Xo.create=e=>new Xo({checks:[],coerce:e?.coerce||!1,typeName:Ae.ZodDate,...Ie(e)});var Na=class extends Pe{_parse(t){if(this._getType(t)!==ae.symbol){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.symbol,received:n.parsedType}),ye}return qt(t.data)}};Na.create=e=>new Na({typeName:Ae.ZodSymbol,...Ie(e)});var Zo=class extends Pe{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.undefined,received:n.parsedType}),ye}return qt(t.data)}};Zo.create=e=>new Zo({typeName:Ae.ZodUndefined,...Ie(e)});var ei=class extends Pe{_parse(t){if(this._getType(t)!==ae.null){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.null,received:n.parsedType}),ye}return qt(t.data)}};ei.create=e=>new ei({typeName:Ae.ZodNull,...Ie(e)});var to=class extends Pe{constructor(){super(...arguments),this._any=!0}_parse(t){return qt(t.data)}};to.create=e=>new to({typeName:Ae.ZodAny,...Ie(e)});var Rn=class extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qt(t.data)}};Rn.create=e=>new Rn({typeName:Ae.ZodUnknown,...Ie(e)});var wr=class extends Pe{_parse(t){let r=this._getOrReturnCtx(t);return ie(r,{code:K.invalid_type,expected:ae.never,received:r.parsedType}),ye}};wr.create=e=>new wr({typeName:Ae.ZodNever,...Ie(e)});var qa=class extends Pe{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.void,received:n.parsedType}),ye}return qt(t.data)}};qa.create=e=>new qa({typeName:Ae.ZodVoid,...Ie(e)});var wn=class e extends Pe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ae.array)return ie(r,{code:K.invalid_type,expected:ae.array,received:r.parsedType}),ye;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(a||p)&&(ie(r,{code:a?K.too_big:K.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&&(ie(r,{code:K.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&&(ie(r,{code:K.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 hr(r,a,r.path,p)))).then(a=>kt.mergeArray(n,a));let i=[...r.data].map((a,p)=>o.type._parseSync(new hr(r,a,r.path,p)));return kt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:de.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:de.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:de.toString(r)}})}nonempty(t){return this.min(1,t)}};wn.create=(e,t)=>new wn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...Ie(t)});function _a(e){if(e instanceof Xt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gr.create(_a(n))}return new Xt({...e._def,shape:()=>t})}else return e instanceof wn?new wn({...e._def,type:_a(e.element)}):e instanceof gr?gr.create(_a(e.unwrap())):e instanceof Wr?Wr.create(_a(e.unwrap())):e instanceof zr?zr.create(e.items.map(t=>_a(t))):e}var Xt=class e extends Pe{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)!==ae.object){let m=this._getOrReturnCtx(t);return ie(m,{code:K.invalid_type,expected:ae.object,received:m.parsedType}),ye}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),p=[];if(!(this._def.catchall instanceof wr&&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],v=o.data[m];f.push({key:{status:"valid",value:m},value:h._parse(new hr(o,v,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof wr){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&&(ie(o,{code:K.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 v=o.data[h];f.push({key:{status:"valid",value:h},value:m._parse(new hr(o,v,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 v=yield h.key,C=yield h.value;m.push({key:v,value:C,alwaysSet:h.alwaysSet})}return m})).then(m=>kt.mergeObjectSync(n,m)):kt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return de.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:de.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:Ae.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 _a(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 gr;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Qx(Ne.objectKeys(this.shape))}};Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});var ti=class extends Pe{_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 Jt(p.ctx.common.issues));return ie(r,{code:K.invalid_union,unionErrors:a}),ye}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref68=_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(_x185){return _ref68.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 Jt(f));return ie(r,{code:K.invalid_union,unionErrors:p}),ye}}get options(){return this._def.options}};ti.create=(e,t)=>new ti({options:e,typeName:Ae.ZodUnion,...Ie(t)});var xn=e=>e instanceof ni?xn(e.schema):e instanceof yr?xn(e.innerType()):e instanceof oi?[e.value]:e instanceof ii?e.options:e instanceof ai?Ne.objectValues(e.enum):e instanceof si?xn(e._def.innerType):e instanceof Zo?[void 0]:e instanceof ei?[null]:e instanceof gr?[void 0,...xn(e.unwrap())]:e instanceof Wr?[null,...xn(e.unwrap())]:e instanceof Tc||e instanceof ui?xn(e.unwrap()):e instanceof ci?xn(e._def.innerType):[],xd=class e extends Pe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.object)return ie(r,{code:K.invalid_type,expected:ae.object,received:r.parsedType}),ye;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}):(ie(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ye)}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=xn(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:Ae.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ie(n)})}};function Sy(e,t){let r=Hr(e),n=Hr(t);if(e===t)return{valid:!0,data:e};if(r===ae.object&&n===ae.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=Sy(e[p],t[p]);if(!f.valid)return{valid:!1};a[p]=f.data}return{valid:!0,data:a}}else if(r===ae.array&&n===ae.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=Sy(a,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ae.date&&n===ae.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ri=class extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Cd(i)||Cd(a))return ye;let p=Sy(i.value,a.value);return p.valid?((bd(i)||bd(a))&&r.dirty(),{status:r.value,value:p.data}):(ie(n,{code:K.invalid_intersection_types}),ye)};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}))}};ri.create=(e,t,r)=>new ri({left:e,right:t,typeName:Ae.ZodIntersection,...Ie(r)});var zr=class e extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.array)return ie(n,{code:K.invalid_type,expected:ae.array,received:n.parsedType}),ye;if(n.data.length<this._def.items.length)return ie(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&n.data.length>this._def.items.length&&(ie(n,{code:K.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 hr(n,a,n.path,p)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>kt.mergeArray(r,a)):kt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};zr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zr({items:e,typeName:Ae.ZodTuple,rest:null,...Ie(t)})};var Rd=class e extends Pe{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!==ae.object)return ie(n,{code:K.invalid_type,expected:ae.object,received:n.parsedType}),ye;let o=[],i=this._def.keyType,a=this._def.valueType;for(let p in n.data)o.push({key:i._parse(new hr(n,p,n.path,p)),value:a._parse(new hr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?kt.mergeObjectAsync(r,o):kt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Pe?new e({keyType:t,valueType:r,typeName:Ae.ZodRecord,...Ie(n)}):new e({keyType:eo.create(),valueType:t,typeName:Ae.ZodRecord,...Ie(r)})}},Da=class extends Pe{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!==ae.map)return ie(n,{code:K.invalid_type,expected:ae.map,received:n.parsedType}),ye;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new hr(n,p,n.path,[m,"key"])),value:i._parse(new hr(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 ye;(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 ye;(m.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(m.value,h.value)}return{status:r.value,value:p}}}};Da.create=(e,t,r)=>new Da({valueType:t,keyType:e,typeName:Ae.ZodMap,...Ie(r)});var Ma=class e extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.set)return ie(n,{code:K.invalid_type,expected:ae.set,received:n.parsedType}),ye;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ie(n,{code:K.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&&(ie(n,{code:K.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 ye;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 hr(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:de.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:de.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ma.create=(e,t)=>new Ma({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...Ie(t)});var wd=class e extends Pe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.function)return ie(r,{code:K.invalid_type,expected:ae.function,received:r.parsedType}),ye;function n(p,f){return Fc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ka(),bn].filter(m=>!!m),issueData:{code:K.invalid_arguments,argumentsError:f}})}function o(p,f){return Fc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ka(),bn].filter(m=>!!m),issueData:{code:K.invalid_return_type,returnTypeError:f}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ro){let p=this;return qt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new Jt([]),h=yield p._def.args.parseAsync(f,i).catch(g=>{throw m.addIssue(n(f,g)),m}),v=yield Reflect.apply(a,this,h);return yield p._def.returns._def.type.parseAsync(v,i).catch(g=>{throw m.addIssue(o(v,g)),m})}))}else{let p=this;return qt(function(...f){let m=p._def.args.safeParse(f,i);if(!m.success)throw new Jt([n(f,m.error)]);let h=Reflect.apply(a,this,m.data),v=p._def.returns.safeParse(h,i);if(!v.success)throw new Jt([o(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:zr.create(t).rest(Rn.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||zr.create([]).rest(Rn.create()),returns:r||Rn.create(),typeName:Ae.ZodFunction,...Ie(n)})}},ni=class extends Pe{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})}};ni.create=(e,t)=>new ni({getter:e,typeName:Ae.ZodLazy,...Ie(t)});var oi=class extends Pe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ie(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:t.data}}get value(){return this._def.value}};oi.create=(e,t)=>new oi({value:e,typeName:Ae.ZodLiteral,...Ie(t)});function Qx(e,t){return new ii({values:e,typeName:Ae.ZodEnum,...Ie(t)})}var ii=class e extends Pe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ie(r,{expected:Ne.joinValues(n),received:r.parsedType,code:K.invalid_type}),ye}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 ie(r,{received:r.data,code:K.invalid_enum_value,options:n}),ye}return qt(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})}};ii.create=Qx;var ai=class extends Pe{_parse(t){let r=Ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ae.string&&n.parsedType!==ae.number){let o=Ne.objectValues(r);return ie(n,{expected:Ne.joinValues(o),received:n.parsedType,code:K.invalid_type}),ye}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ne.objectValues(r);return ie(n,{received:n.data,code:K.invalid_enum_value,options:o}),ye}return qt(t.data)}get enum(){return this._def.values}};ai.create=(e,t)=>new ai({values:e,typeName:Ae.ZodNativeEnum,...Ie(t)});var ro=class extends Pe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.promise&&r.common.async===!1)return ie(r,{code:K.invalid_type,expected:ae.promise,received:r.parsedType}),ye;let n=r.parsedType===ae.promise?r.data:Promise.resolve(r.data);return qt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ro.create=(e,t)=>new ro({type:e,typeName:Ae.ZodPromise,...Ie(t)});var yr=class extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.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=>{ie(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 _ref71=_asyncToGenerator(function*(p){if(r.value==="aborted")return ye;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?ye:f.status==="dirty"?Wo(f.value):r.value==="dirty"?Wo(f.value):f});return function(_x186){return _ref71.apply(this,arguments)}}());{if(r.value==="aborted")return ye;let p=this._def.schema._parseSync({data:a,path:n.path,parent:n});return p.status==="aborted"?ye:p.status==="dirty"?Wo(p.value):r.value==="dirty"?Wo(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"?ye:(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"?ye:(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(!Zn(a))return ye;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=>Zn(a)?Promise.resolve(o.transform(a.value,i)).then(p=>({status:r.value,value:p})):ye);Ne.assertNever(o)}};yr.create=(e,t,r)=>new yr({schema:e,typeName:Ae.ZodEffects,effect:t,...Ie(r)});yr.createWithPreprocess=(e,t,r)=>new yr({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...Ie(r)});var gr=class extends Pe{_parse(t){return this._getType(t)===ae.undefined?qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gr.create=(e,t)=>new gr({innerType:e,typeName:Ae.ZodOptional,...Ie(t)});var Wr=class extends Pe{_parse(t){return this._getType(t)===ae.null?qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:Ae.ZodNullable,...Ie(t)});var si=class extends Pe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ae.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:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ie(t)});var ci=class extends Pe{_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 Oa(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Jt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Jt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ci.create=(e,t)=>new ci({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ie(t)});var ja=class extends Pe{_parse(t){if(this._getType(t)!==ae.nan){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.nan,received:n.parsedType}),ye}return{status:"valid",value:t.data}}};ja.create=e=>new ja({typeName:Ae.ZodNaN,...Ie(e)});var Zq=Symbol("zod_brand"),Tc=class extends Pe{_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}},Pc=class e extends Pe{_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"?ye:i.status==="dirty"?(r.dirty(),Wo(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"?ye: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:Ae.ZodPipeline})}},ui=class extends Pe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Zn(o)&&(o.value=Object.freeze(o.value)),o);return Oa(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ui.create=(e,t)=>new ui({innerType:e,typeName:Ae.ZodReadonly,...Ie(t)});function jx(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Bx(e,t={},r){return e?to.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let p=jx(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!i){let a=jx(t,n),p=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:p})}}):to.create()}var eD={object:Xt.lazycreate},Ae;(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"})(Ae||(Ae={}));var tD=(e,t={message:`Input not instance of ${e.name}`})=>Bx(r=>r instanceof e,t),Gx=eo.create,$x=Yo.create,rD=ja.create,nD=Ko.create,Hx=Jo.create,oD=Xo.create,iD=Na.create,aD=Zo.create,sD=ei.create,cD=to.create,uD=Rn.create,lD=wr.create,dD=qa.create,pD=wn.create,fD=Xt.create,mD=Xt.strictCreate,gD=ti.create,hD=xd.create,yD=ri.create,SD=zr.create,vD=Rd.create,AD=Da.create,CD=Ma.create,bD=wd.create,xD=ni.create,RD=oi.create,wD=ii.create,ID=ai.create,ED=ro.create,FD=yr.create,TD=gr.create,PD=Wr.create,kD=yr.createWithPreprocess,OD=Pc.create,_D=()=>Gx().optional(),ND=()=>$x().optional(),qD=()=>Hx().optional(),DD={string:e=>eo.create({...e,coerce:!0}),number:e=>Yo.create({...e,coerce:!0}),boolean:e=>Jo.create({...e,coerce:!0}),bigint:e=>Ko.create({...e,coerce:!0}),date:e=>Xo.create({...e,coerce:!0})};var MD=ye;var jD=F.object({name:F.string(),arguments:F.string()}),VD=F.object({id:F.string(),type:F.literal("function"),function:jD,encryptedValue:F.string().optional()}),Id=F.object({id:F.string(),role:F.string(),content:F.string().optional(),name:F.string().optional(),encryptedValue:F.string().optional()}),LD=F.object({type:F.literal("text"),text:F.string()}),zx=F.object({type:F.literal("binary"),mimeType:F.string(),id:F.string().optional(),url:F.string().optional(),data:F.string().optional(),filename:F.string().optional()}),Wx=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:F.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},Oce=zx.superRefine((e,t)=>{Wx(e,t)}),UD=F.discriminatedUnion("type",[LD,zx]),QD=UD.superRefine((e,t)=>{e.type==="binary"&&Wx(e,t)}),BD=Id.extend({role:F.literal("developer"),content:F.string()}),GD=Id.extend({role:F.literal("system"),content:F.string()}),$D=Id.extend({role:F.literal("assistant"),content:F.string().optional(),toolCalls:F.array(VD).optional()}),HD=Id.extend({role:F.literal("user"),content:F.union([F.string(),F.array(QD)])}),zD=F.object({id:F.string(),content:F.string(),role:F.literal("tool"),toolCallId:F.string(),error:F.string().optional(),encryptedValue:F.string().optional()}),WD=F.object({id:F.string(),role:F.literal("activity"),activityType:F.string(),content:F.record(F.any())}),YD=F.object({id:F.string(),role:F.literal("reasoning"),content:F.string(),encryptedValue:F.string().optional()}),Yx=F.discriminatedUnion("role",[BD,GD,$D,HD,zD,WD,YD]),_ce=F.union([F.literal("developer"),F.literal("system"),F.literal("assistant"),F.literal("user"),F.literal("tool"),F.literal("activity"),F.literal("reasoning")]),KD=F.object({description:F.string(),value:F.string()}),JD=F.object({name:F.string(),description:F.string(),parameters:F.any()}),XD=F.object({threadId:F.string(),runId:F.string(),parentRunId:F.string().optional(),state:F.any(),messages:F.array(Yx),tools:F.array(JD),context:F.array(KD),forwardedProps:F.any()}),ZD=F.any(),st=class extends Error{constructor(e){super(e)}},vy=class extends st{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Kx=F.union([F.literal("developer"),F.literal("system"),F.literal("assistant"),F.literal("user")]),D=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),Le=F.object({type:F.nativeEnum(D),timestamp:F.number().optional(),rawEvent:F.any().optional()}).passthrough(),eM=Le.extend({type:F.literal(D.TEXT_MESSAGE_START),messageId:F.string(),role:Kx.default("assistant")}),Jx=Le.extend({type:F.literal(D.TEXT_MESSAGE_CONTENT),messageId:F.string(),delta:F.string().refine(e=>e.length>0,"Delta must not be an empty string")}),tM=Le.extend({type:F.literal(D.TEXT_MESSAGE_END),messageId:F.string()}),rM=Le.extend({type:F.literal(D.TEXT_MESSAGE_CHUNK),messageId:F.string().optional(),role:Kx.optional(),delta:F.string().optional()}),nM=Le.extend({type:F.literal(D.THINKING_TEXT_MESSAGE_START)}),oM=Jx.omit({messageId:!0,type:!0}).extend({type:F.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),iM=Le.extend({type:F.literal(D.THINKING_TEXT_MESSAGE_END)}),aM=Le.extend({type:F.literal(D.TOOL_CALL_START),toolCallId:F.string(),toolCallName:F.string(),parentMessageId:F.string().optional()}),sM=Le.extend({type:F.literal(D.TOOL_CALL_ARGS),toolCallId:F.string(),delta:F.string()}),cM=Le.extend({type:F.literal(D.TOOL_CALL_END),toolCallId:F.string()}),uM=Le.extend({messageId:F.string(),type:F.literal(D.TOOL_CALL_RESULT),toolCallId:F.string(),content:F.string(),role:F.literal("tool").optional()}),lM=Le.extend({type:F.literal(D.TOOL_CALL_CHUNK),toolCallId:F.string().optional(),toolCallName:F.string().optional(),parentMessageId:F.string().optional(),delta:F.string().optional()}),dM=Le.extend({type:F.literal(D.THINKING_START),title:F.string().optional()}),pM=Le.extend({type:F.literal(D.THINKING_END)}),fM=Le.extend({type:F.literal(D.STATE_SNAPSHOT),snapshot:ZD}),mM=Le.extend({type:F.literal(D.STATE_DELTA),delta:F.array(F.any())}),gM=Le.extend({type:F.literal(D.MESSAGES_SNAPSHOT),messages:F.array(Yx)}),hM=Le.extend({type:F.literal(D.ACTIVITY_SNAPSHOT),messageId:F.string(),activityType:F.string(),content:F.record(F.any()),replace:F.boolean().optional().default(!0)}),yM=Le.extend({type:F.literal(D.ACTIVITY_DELTA),messageId:F.string(),activityType:F.string(),patch:F.array(F.any())}),SM=Le.extend({type:F.literal(D.RAW),event:F.any(),source:F.string().optional()}),vM=Le.extend({type:F.literal(D.CUSTOM),name:F.string(),value:F.any()}),AM=Le.extend({type:F.literal(D.RUN_STARTED),threadId:F.string(),runId:F.string(),parentRunId:F.string().optional(),input:XD.optional()}),CM=Le.extend({type:F.literal(D.RUN_FINISHED),threadId:F.string(),runId:F.string(),result:F.any().optional()}),bM=Le.extend({type:F.literal(D.RUN_ERROR),message:F.string(),code:F.string().optional()}),xM=Le.extend({type:F.literal(D.STEP_STARTED),stepName:F.string()}),RM=Le.extend({type:F.literal(D.STEP_FINISHED),stepName:F.string()}),wM=F.union([F.literal("tool-call"),F.literal("message")]),IM=Le.extend({type:F.literal(D.REASONING_START),messageId:F.string()}),EM=Le.extend({type:F.literal(D.REASONING_MESSAGE_START),messageId:F.string(),role:F.literal("reasoning")}),FM=Le.extend({type:F.literal(D.REASONING_MESSAGE_CONTENT),messageId:F.string(),delta:F.string().refine(e=>e.length>0,"Delta must not be an empty string")}),TM=Le.extend({type:F.literal(D.REASONING_MESSAGE_END),messageId:F.string()}),PM=Le.extend({type:F.literal(D.REASONING_MESSAGE_CHUNK),messageId:F.string().optional(),delta:F.string().optional()}),kM=Le.extend({type:F.literal(D.REASONING_END),messageId:F.string()}),OM=Le.extend({type:F.literal(D.REASONING_ENCRYPTED_VALUE),subtype:wM,entityId:F.string(),encryptedValue:F.string()}),Ed=F.discriminatedUnion("type",[eM,Jx,tM,rM,dM,pM,nM,oM,iM,aM,sM,cM,lM,uM,fM,mM,gM,hM,yM,SM,vM,AM,CM,bM,xM,RM,IM,EM,FM,TM,PM,kM,OM]);d();c();l();u();var Ay={};Ms(Ay,{JsonPatchError:()=>lt,_areEquals:()=>_c,applyOperation:()=>li,applyPatch:()=>no,applyReducer:()=>MM,deepClone:()=>qM,getValueByPointer:()=>Od,validate:()=>Zx,validator:()=>_d});d();c();l();u();d();c();l();u();var _M=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)}}(),NM=Object.prototype.hasOwnProperty;function Td(e,t){return NM.call(e,t)}function Pd(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)Td(e,o)&&n.push(o);return n}function Ot(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function kd(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 Yr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function kc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Fd(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Fd(e[t]))return!0}else if(typeof e=="object"){for(var n=Pd(e),o=n.length,i=0;i<o;i++)if(Fd(e[n[i]]))return!0}}return!1}function Xx(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 Oc=function(e){_M(t,e);function t(r,n,o,i,a){var p=this.constructor,f=e.call(this,Xx(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=Xx(r,{name:n,index:o,operation:i,tree:a}),f}return t}(Error);var lt=Oc,qM=Ot,Va={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=Od(r,this.path);n&&(n=Ot(n));var o=li(r,{op:"remove",path:this.from}).removed;return li(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Od(r,this.from);return li(r,{op:"add",path:this.path,value:Ot(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:_c(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},DM={add:function(e,t,r){return kd(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:Va.move,copy:Va.copy,test:Va.test,_get:Va._get};function Od(e,t){if(t=="")return e;var r={op:"_get",path:t};return li(e,r),r.value}function li(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):_d(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=Od(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=_c(e,t.value),a.test===!1)throw new lt("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 lt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Ot(e));var p=t.path||"",f=p.split("/"),m=e,h=1,v=f.length,C=void 0,g=void 0,S=void 0;for(typeof r=="function"?S=r:S=_d;;){if(g=f[h],g&&g.indexOf("~")!=-1&&(g=kc(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&&C===void 0&&(m[g]===void 0?C=f.slice(0,h).join("/"):h==v-1&&(C=t.path),C!==void 0&&S(t,0,e,C)),h++,Array.isArray(m)){if(g==="-")g=m.length;else{if(r&&!kd(g))throw new lt("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);kd(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>m.length)throw new lt("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=DM[t.op].call(t,m,g,e);if(a.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=v){var a=Va[t.op].call(t,m,g,e);if(a.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(m=m[g],r&&h<v&&(!m||typeof m!="object"))throw new lt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function no(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new lt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Ot(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=li(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function MM(e,t,r){var n=li(e,t);if(n.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function _d(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new lt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Va[e.op]){if(typeof e.path!="string")throw new lt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new lt("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 lt("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 lt("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")&&Fd(e.value))throw new lt("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 lt("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 lt("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=Zx([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new lt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new lt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Zx(e,t,r){try{if(!Array.isArray(e))throw new lt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)no(Ot(t),Ot(e),r||!0);else{r=r||_d;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof lt)return o;throw o}}function _c(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(!_c(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],!_c(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Ry={};Ms(Ry,{compare:()=>$M,generate:()=>Cy,observe:()=>GM,unobserve:()=>BM});d();c();l();u();var by=new WeakMap,jM=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),VM=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function LM(e){return by.get(e)}function UM(e,t){return e.observers.get(t)}function QM(e,t){e.observers.delete(t.callback)}function BM(e,t){t.unobserve()}function GM(e,t){var r=[],n,o=LM(e);if(!o)o=new jM(e),by.set(e,o);else{var i=UM(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Ot(e),t){n.callback=t,n.next=null;var a=function(){Cy(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(){Cy(n),clearTimeout(n.next),QM(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 VM(t,n)),n}function Cy(e,t){t===void 0&&(t=!1);var r=by.get(e.object);xy(r.value,e.object,e.patches,"",t),e.patches.length&&no(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function xy(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Pd(t),a=Pd(e),p=!1,f=!1,m=a.length-1;m>=0;m--){var h=a[m],v=e[h];if(Td(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var C=t[h];typeof v=="object"&&v!=null&&typeof C=="object"&&C!=null&&Array.isArray(v)===Array.isArray(C)?xy(v,C,r,n+"/"+Yr(h),o):v!==C&&(p=!0,o&&r.push({op:"test",path:n+"/"+Yr(h),value:Ot(v)}),r.push({op:"replace",path:n+"/"+Yr(h),value:Ot(C)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Yr(h),value:Ot(v)}),r.push({op:"remove",path:n+"/"+Yr(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];!Td(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Yr(h),value:Ot(t[h])})}}}function $M(e,t,r){r===void 0&&(r=!1);var n=[];return xy(e,t,n,"",r),n}var oue=Object.assign({},Ay,Ry,{JsonPatchError:Oc,deepClone:Ot,escapePathComponent:Yr,unescapePathComponent:kc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var wy=function(e,t){return wy=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])},wy(e,t)};function Kr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");wy(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(v){a(v)}}function f(h){try{m(n.throw(h))}catch(v){a(v)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function Nd(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 In(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 La(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 Ua(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 di(e){return this instanceof di?(this.v=e,this):new di(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,v)}}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){C(i[0][3],x)}}function m(g){g.value instanceof di?Promise.resolve(g.value.v).then(h,v):C(i[0][2],g)}function h(g){f("next",g)}function v(g){f("throw",g)}function C(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 In=="function"?In(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 Oe(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Qa(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 qd=Qa(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
31
+ `;function sN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var cN=["1",1,"yes",!0];function pc(){let e=[];return Zg()&&e.push(window.doNotTrack),fh()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>cN.indexOf(t)!==-1)}var CC="v15",bC={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 uN(e=bC.default,t=CC,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",or=class{get defaultOptions(){return{endpoint:bC.default,isCustomEndpoint:!1,token:"",version:CC,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=[JO,zO].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};pc()?this.runtime=new Ju:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ke.view,{newEventType:ke.view,addClientIdParameter:!0}),this.addEventTypeMapping(ke.click,{newEventType:ke.click,addClientIdParameter:!0}),this.addEventTypeMapping(ke.custom,{newEventType:ke.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ke.search,{newEventType:ke.search,addClientIdParameter:!0})}initRuntime(t){return Zg()&&Ki()?new lh(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(sN()&&console.warn(aN),new dh(t))}get storage(){return this.runtime.storage}determineVisitorId(){return j(this,void 0,void 0,function*(){try{return Zg()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||_o()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),_o()}})}getCurrentVisitorId(){return j(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return j(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return j(this,void 0,void 0,function*(){if(Wu(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(iC(t,iC(r,lN)))}})}getParameters(t,...r){return j(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return j(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(_o()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(pc())return null;try{let r=new URL(t).searchParams.get(Mn.cvo_cid);if(r==null)return null;let n=Mn.fromString(r);return!n||!Ki()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return j(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=>j(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>j(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((C,x)=>j(this,void 0,void 0,function*(){let w=yield C;return yield x(t,w)}),g)].reduce((g,C)=>j(this,void 0,void 0,function*(){let x=yield g;return yield C(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return j(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[A=>this.setTrackingIdIfTrackingIdNotPresent(A),A=>this.removeEmptyPayloadValues(A,t),A=>this.validateParams(A,t),A=>n?K_(A):A,A=>n?this.removeUnknownParameters(A):A,A=>n?this.processCustomParameters(A):this.mapCustomParametersToCustomData(A)].reduce((A,S)=>j(this,void 0,void 0,function*(){let g=yield A;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return j(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=>j(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 j(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return j(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 zu().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.search,t)})}sendSearchEvent(t){return j(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Nr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.click,t)})}sendClickEvent(t){return j(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Nr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.custom,t)})}sendCustomEvent(t){return j(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Nr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return j(this,void 0,void 0,function*(){return this.makeEvent(ke.view,t)})}sendViewEvent(t){return j(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return j(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return j(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({[ke.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(eN(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=Nr(t,["custom"]),o={};r&&Hu(r)&&(o=this.lowercaseKeys(r));let i=tN(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Nr(t,["custom"]);if(r&&Hu(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=Nr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ke.view||r==ke.click||r==ke.search||r==ke.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ke.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=Nr(t,["userId"]);return iN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Nr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Hu(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Hu(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"?f_(t,r):t}get baseUrl(){return uN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Et;(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"})(Et||(Et={}));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 ph={[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",[Et.expandToFullUI]:"interface",[Et.openUserActions]:"User Actions",[Et.showPrecedingSessions]:"User Actions",[Et.showFollowingSessions]:"User Actions",[Et.clickViewedDocument]:"User Actions",[Et.clickPageView]:"User Actions",[Et.createArticle]:"createArticle"},jn=class{constructor(){this.runtime=new Ju,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(ke.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ke.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ke.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ke.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return yC}};function dN(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function pN(e){return e.map(t=>t.replace(/;/g,""))}function xC(e){let r=e.join(";");return r.length<=256?r:xC(e.slice(1))}var pC=e=>{let t=pN(e),r=dN(t);return xC(r)};function fC(e){let t=typeof e.partialQueries=="string"?e.partialQueries:pC(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:pC(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Zu=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||pc();this.coveoAnalyticsClient=n?new jn:new or(t)}disable(){this.coveoAnalyticsClient=new jn}enable(){this.coveoAnalyticsClient=new or(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(k.interfaceLoad)}logInterfaceLoad(){return j(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(k.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return j(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(k.recommendation)}logRecommendation(){return j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(k.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return j(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(k.didyoumeanClick)}logDidYouMeanClick(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(k.searchboxSubmit)}logSearchboxSubmit(){return j(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(k.searchboxClear)}logSearchboxClear(){return j(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(k.searchboxAsYouType)}logSearchboxAsYouType(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(k.breadcrumbResetAll)}logBreadcrumbResetAll(){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(k.omniboxAnalytics,fC(t))}logOmniboxAnalytics(t){return j(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(k.omniboxFromLink,fC(t))}logOmniboxFromLink(t){return j(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(k.searchFromLink)}logSearchFromLink(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(k.pagerScrolling)}logPagerScrolling(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorBack);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorBack)})}})}logQueryErrorBack(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorRetry);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorRetry)})}})}logQueryErrorRetry(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return j(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(k.queryErrorClear);return{description:t.description,log:()=>j(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(k.queryErrorClear)})}})}logQueryErrorClear(){return j(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(k.likeSmartSnippet)}logLikeSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(k.dislikeSmartSnippet)}logDislikeSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(k.expandSmartSnippet)}logExpandSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(k.collapseSmartSnippet)}logCollapseSmartSnippet(){return j(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return j(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(k.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(k.clearRecentQueries)}logClearRecentQueries(){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(k.noResultsBack)}logNoResultsBack(){return j(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 j(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 j(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 j(this,arguments,void 0,function*(n,o,i=ph[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 j(this,arguments,void 0,function*(n,o,i=ph[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return j(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return j(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 j(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 or?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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(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 j(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(k.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return j(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 j(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},el=Object.assign({},uc),mC=Object.keys(el).map(e=>el[e]),Xi=class extends rh{constructor({client:t,uuidGenerator:r=_o}){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])=>mC.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(mC.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(el.pageview,{newEventType:ke.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(el.event,{newEventType:ke.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 S_(this.ticket)}};Xi.Id="svc";var tl;(function(e){e.click="click",e.flowStart="flowStart"})(tl||(tl={}));var dr;(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"})(dr||(dr={}));var rl;(function(e){e.quit="Quit",e.solved="Solved"})(rl||(rl={}));var nl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!pc();this.coveoAnalyticsClient=o?new or(t):new jn,this.svc=new Xi({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new jn,this.svc=new Xi({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new or(this.options),this.svc=new Xi({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(dr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(dr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(dr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(dr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(dr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(dr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(dr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(dr.caseCancelled,{reason:rl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(dr.caseSolved,{reason:rl.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(dr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",tl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",tl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return j(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 or?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 j(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)})}},fN=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},se=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,i=Nr(e,["caseContext","caseId","caseNumber"]),a=fN(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},i),!!a.context_Case_Subject&&{CaseSubject:a.context_Case_Subject}),t&&a)},ol=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||pc();this.coveoAnalyticsClient=n?new jn:new or(t)}disable(){this.coveoAnalyticsClient=new jn}enable(){this.coveoAnalyticsClient=new or(this.opts)}logInterfaceLoad(t){if(t){let r=se(t);return this.logSearchEvent(k.interfaceLoad,r)}return this.logSearchEvent(k.interfaceLoad)}logRecentQueryClick(t){if(t){let r=se(t);return this.logSearchEvent(k.recentQueryClick,r)}return this.logSearchEvent(k.recentQueryClick)}logClearRecentQueries(t){if(t){let r=se(t);return this.logCustomEvent(k.clearRecentQueries,r)}return this.logCustomEvent(k.clearRecentQueries)}logInterfaceChange(t){let r=se(t);return this.logSearchEvent(k.interfaceChange,r)}logStaticFilterDeselect(t){let r=se(t);return this.logSearchEvent(k.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=se(t);return this.logCustomEvent(k.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(k.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=se(t);return this.logSearchEvent(k.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=se(t);return this.logSearchEvent(k.breadcrumbResetAll,r)}return this.logSearchEvent(k.breadcrumbResetAll)}logFacetSelect(t){let r=se(t);return this.logSearchEvent(k.facetSelect,r)}logFacetExclude(t){let r=se(t);return this.logSearchEvent(k.facetExclude,r)}logFacetDeselect(t){let r=se(t);return this.logSearchEvent(k.facetDeselect,r)}logFacetUpdateSort(t){let r=se(t);return this.logSearchEvent(k.facetUpdateSort,r)}logFacetClearAll(t){let r=se(t);return this.logSearchEvent(k.facetClearAll,r)}logFacetShowMore(t){let r=se(t,!1);return this.logCustomEvent(k.facetShowMore,r)}logFacetShowLess(t){let r=se(t,!1);return this.logCustomEvent(k.facetShowLess,r)}logQueryError(t){let r=se(t,!1);return this.logCustomEvent(k.queryError,r)}logPagerNumber(t){let r=se(t,!1);return this.logCustomEvent(k.pagerNumber,r)}logPagerNext(t){let r=se(t,!1);return this.logCustomEvent(k.pagerNext,r)}logPagerPrevious(t){let r=se(t,!1);return this.logCustomEvent(k.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=se(t);return this.logSearchEvent(k.didyoumeanAutomatic,r)}return this.logSearchEvent(k.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=se(t);return this.logSearchEvent(k.didyoumeanClick,r)}return this.logSearchEvent(k.didyoumeanClick)}logResultsSort(t){let r=se(t);return this.logSearchEvent(k.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=se(t);return this.logSearchEvent(k.searchboxSubmit,r)}return this.logSearchEvent(k.searchboxSubmit)}logContextChanged(t){let r=se(t);return this.logSearchEvent(Et.contextChanged,r)}logExpandToFullUI(t){let r=se(t);return this.logCustomEvent(Et.expandToFullUI,r)}logOpenUserActions(t){let r=se(t,!1);return this.logCustomEvent(Et.openUserActions,r)}logShowPrecedingSessions(t){let r=se(t,!1);return this.logCustomEvent(Et.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=se(t,!1);return this.logCustomEvent(Et.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(Et.clickViewedDocument,Object.assign(Object.assign({},se(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(Et.clickPageView,Object.assign(Object.assign({},se(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(Et.createArticle,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(k.documentOpen,t,r,n?se(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(k.copyToClipboard,t,r,n?se(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(k.caseSendEmail,t,r,n?se(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(k.feedItemTextPost,t,r,n?se(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({},se(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({},se(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&se(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(k.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(k.likeSmartSnippet,t?se(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(k.dislikeSmartSnippet,t?se(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(k.expandSmartSnippet,t?se(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(k.collapseSmartSnippet,t?se(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.openSmartSnippetFeedbackModal,t?se(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(k.closeSmartSnippetFeedbackModal,t?se(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(k.sendSmartSnippetReason,n?Object.assign(Object.assign({},se(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({},se(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({},se(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(k.openSmartSnippetSource,t,r,n?se(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({},se(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({},se(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({},se(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(k.likeGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(k.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(k.openGeneratedAnswerSource,r?Object.assign(Object.assign({},se(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({},se(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(k.generatedAnswerSourceHover,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(k.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(k.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(k.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(k.generatedAnswerExpand,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(k.generatedAnswerCollapse,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(k.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(k.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},se(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(k.retryGeneratedAnswer,t?Object.assign({},se(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(k.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},se(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({},se(n,!1)),r):r)}logCustomEvent(t,r){return j(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:ph[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return j(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return j(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 j(this,void 0,void 0,function*(){return this.logClickEvent(k.showMoreFoldedResults,t,r,n?se(n,!1):void 0)})}logShowLessFoldedResults(t){return j(this,void 0,void 0,function*(){return this.logCustomEvent(k.showLessFoldedResults,t?se(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(k.triggerNotify,r?Object.assign(Object.assign({},se(r,!1)),t):t)}getBaseCustomEventRequest(t){return j(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return j(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 j(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 or?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var Zi=()=>"default";var mN=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Vn=class{constructor(t){this.getState=t;qe(this,"state");this.state=t()}getLanguage(){return mN(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=Dn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Zi()}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 RC=e=>new or(e).getCurrentVisitorId(),ea=(e,t)=>typeof t=="function"?(...r)=>{let n=Qs(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,ta=(e,t)=>(...r)=>{let n=Qs(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var fc=class extends Vn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},wC=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new fc(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new nl({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ea(e,n),beforeSendHooks:[ta(e,r),(A,S)=>(e.info({...S,type:A,endpoint:p,token:a},"Analytics request"),S)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function il(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function gN(e,t){return!!t&&t.facetId in e.facetSet}var vn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),IC=(e,t)=>e.facetSet[t]?.request,hh=(e,t)=>{let r=vn(e,t);return gN(e,r)?r:void 0};var EC=(e,t)=>hh(e,t)?.values.filter(r=>r.state!=="idle")||[],qr=e=>e.search.isLoading;d();c();l();u();function FC(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 Dr(e){let{activeValue:t,ancestryMap:r}=hN(e);return t?yN(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 yN(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function SN(e,t){return!!t&&t.facetId in e.categoryFacetSet}var yh=(e,t)=>{let r=vn(e,t);if(SN(e,r))return r},Sh=(e,t)=>e.categoryFacetSet[t]?.request,TC=(e,t)=>{let r=yh(e,t);return Dr(r?.values??[])},vh=(e,t)=>{let r=Sh(e,t);return Dr(r?.currentValues??[])};d();c();l();u();function ra(){return{}}d();c();l();u();function PC(e,t){return{request:e,tabs:t}}function na(){return{}}d();c();l();u();function kC(e,t){return{request:e,tabs:t}}function oa(){return{}}d();c();l();u();function OC(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ia(){return{}}var No=(e,t)=>{let r=DC(t,e),n=r?r.field:"",o=Ah(n,e);return{facetId:e,facetField:n,facetTitle:o}};function aa(e,t){let{facetId:r,facetValue:n}=e,o=No(r,t),i=MC(t,r);return{...o,facetValue:i==="hierarchical"?qC(t,r):n}}function Wt(e){return{facetSet:e.facetSet??ia(),categoryFacetSet:e.categoryFacetSet??ra(),dateFacetSet:e.dateFacetSet??na(),numericFacetSet:e.numericFacetSet??oa(),automaticFacetSet:e.automaticFacetSet??il()}}var al=e=>{let t=[];return CN(e).forEach((r,n)=>{let o=MC(e,r.facetId),i=IN(r,n+1);if(AN(r)){if(!!!vh(e,r.facetId).length)return;t.push({...i,...RN(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,p)=>{if(a.state==="idle")return;let f=_C(a,p+1,o),m=vN(r)?NC(a):xN(a);t.push({...i,...f,...m})})}),bN(e).forEach((r,n)=>{let o=wN(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let p=_C(i,a+1,"specific"),f=NC(i);t.push({...o,...p,...f})})}),t},vN=e=>e.type==="specific",AN=e=>e.type==="hierarchical",CN=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),bN=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),_C=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),xN=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),NC=e=>({displayValue:e.value,value:e.value}),qC=(e,t)=>vh(e,t).map(n=>n.value).join(";"),RN=(e,t)=>{let n=qC(e,t);return{value:n,valuePosition:1,displayValue:n}},wN=(e,t)=>({title:Ah(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),IN=(e,t)=>({title:Ah(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Ah=(e,t)=>`${e}_${t}`,DC=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,MC=(e,t)=>{let r=DC(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var Ch=e=>e.configuration.search.locale,jC=e=>e.configuration.search.timezone,VC=e=>e.configuration.accessToken,LC=e=>e.configuration.organizationId,UC=e=>e.configuration.environment,sl=e=>e.configuration?.knowledge?.agentId;var Ve=e=>{if(EN(e)||bh(e))return e.generatedAnswer?.answerId;if(FN(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},EN=e=>"answer"in e&&"generatedAnswer"in e&&!te(e.generatedAnswer?.answerConfigurationId),bh=e=>{let t=sl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},FN=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",xh=e=>e.generatedAnswer?.fieldsToIncludeInCitations,sa=ot(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));d();c();l();u();var at=()=>({q:"",enableQuerySyntax:!1});var mc=class extends Vn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||yt().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 al(Wt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ve(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||at().q}get responseTime(){return this.state.search?.duration||yt().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||yt().response.results.length}},QC=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new mc(t)})=>{let i=t(),a=i.configuration.accessToken,p=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new ol({enableAnalytics:m,token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ea(e,n),beforeSendHooks:[ta(e,r),(A,S)=>(e.info({...S,type:A,endpoint:p,token:a},"Analytics request"),S)]},o);return m||h.disable(),h};d();c();l();u();d();c();l();u();d();c();l();u();var cl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(cl||{}),ul=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(ul||{}),Mr=e=>{if(_i(e))return e.map(t=>Mr(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""}},ll=()=>({by:"relevancy"}),BC=e=>({by:"date",order:e});var GC=new W({values:{by:new Us({enum:ul,required:!0}),order:new Us({enum:cl}),field:new L}});function ir(){return Mr(ll())}d();c();l();u();d();c();l();u();d();c();l();u();var ca=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?Rh(t,r,i):(a=p.split("."),o=a[a.length-2]+"."+a[a.length-1],Rh(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 Rh(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}d();c();l();u();function TN(){return typeof navigator<"u"}function $C(){try{return typeof localStorage<"u"}catch{return!1}}function HC(){try{return typeof sessionStorage<"u"}catch{return!1}}function zC(){return!!(TN()&&navigator.cookieEnabled)}var WC=null;function YC(){return WC||($C()?localStorage:zC()?new wh:HC()?sessionStorage:new Ih)}var ua=class ua{getItem(t){return ca.get(`${ua.prefix}${t}`)}removeItem(t){ca.erase(`${ua.prefix}${t}`)}setItem(t,r,n){ca.set(`${ua.prefix}${t}`,r,n)}};qe(ua,"prefix","coveo_");var wh=ua;var Ih=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var dl="__coveo.analytics.history",PN=20,kN=1e3*60,ON=75,qo=class qo{constructor(t){qe(this,"store");this.store=t||YC()}static getInstance(t){return qo.instance||(qo.instance=new qo(t)),qo.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(dl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(dl);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(dl,JSON.stringify(t.slice(0,PN)))}catch{}}clear(){try{this.store.removeItem(dl)}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,ON)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>kN:!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))}};qe(qo,"instance",null);var Eh=qo,Nt=Eh;var gc=class gc extends Vn{constructor(){super(...arguments);qe(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 al(Wt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||gc.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||yt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||gc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ve(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??ir()}}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||at().q}get responseTime(){return this.state.search?.duration||yt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||yt().response.totalCountFiltered}};qe(gc,"fallbackPipelineName","default");var Ln=gc,KC=({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??We(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,m=i.configuration.analytics.enabled,h=new Zu({token:a,endpoint:p,runtimeEnvironment:f,preprocessRequest:ea(e,n),beforeSendHooks:[ta(e,r),(A,S)=>(e.info({...S,type:A,endpoint:p,token:a},"Analytics request"),S)]},o);return m||h.disable(),h},Fh=()=>{let t=Nt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function pl(e){let t=XC(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return iv([e,...t,...r],o=>o.uniqueId)}function XC(e){return e.childResults?e.childResults.flatMap(t=>[t,...XC(t)]):[]}d();c();l();u();var hc=()=>"";function JC(e,t){return{...new Ln(t).getBaseMetadata(),actionCause:e,type:e}}function _N(e){return Object.assign(e,{instantlyCallable:!0})}function NN(e,t){let r=i=>_N(le(e,i)),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*(A,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var Th=(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 MN(i)}return n},qN=e=>e.configuration.analytics.analyticsMode==="legacy",DN=e=>e.configuration.analytics.analyticsMode==="next",MN=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=p=>new a(p)),NN(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:h}){let A=[],S={log:function(){var _ref14=_asyncToGenerator(function*({state:R}){for(let E of A)yield E(R)});return function log(_x25){return _ref14.apply(this,arguments)}}()},g=p(),C=i({getState:p,logger:h,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),x=yield t(C,p());S.description=x?.description,A.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(R){qN(R)&&(yield jN(x,r,R,h,C.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:w}=cc(g);return A.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(R){if(DN(R)&&o&&n){let E=n(R);yield HN(w,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),S});return function(_x24){return _ref13.apply(this,arguments)}}()));function jN(_x28,_x29,_x30,_x31,_x32){return _jN.apply(this,arguments)}function _jN(){_jN=_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 _jN.apply(this,arguments)}var ZC=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)}}()}),$e=Th(e=>KC({...e,provider:e.provider||new Ln(e.getState)}),e=>e,Ln),_K=Th(wC,ZC("caseAssist"),fc),Z=e=>Th(QC,ZC(e),mc),Ke=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=tb(e,o),n<0&&(n=$N(e,o)),n<0&&(n=0),LN(e,r(n),t)};var fl=(e,t)=>({sourceName:VN(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||hc()});function VN(e){let t=e.source;return te(t)?"unknown":t}var ml=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function LN(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:BN(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:GN(e),queryPipeline:r.pipeline||hc()}}var Xe=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||""}),eb={urihash:new L,sourcetype:new L,permanentid:new L},gl={uniqueId:G,raw:new W({values:eb}),title:G,uri:G,clickUri:G,rankingModifier:new L({required:!1,emptyAllowed:!0})};function UN(e){return Object.assign({},...Object.keys(eb).map(t=>({[t]:e[t]})))}function QN(e){return Object.assign({},...Object.keys(gl).map(t=>({[t]:e[t]})),{raw:UN(e.raw)})}function BN(e){let t=e.raw.author;return te(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function GN(e){let t=e.raw.source;return te(t)?"unknown":t}var Ft=e=>new Ee(gl).validate(QN(e));function $N(e,t){for(let[r,n]of t.entries()){let o=pl(n);if(tb(e,o)!==-1)return r}return-1}function tb(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function HN(_x34,_x35,_x36){return _HN.apply(this,arguments)}function _HN(){_HN=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _HN.apply(this,arguments)}var xr=(e,t)=>{let r=Xe(e),n=Ke(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Ph=e=>_(e,{evt:G,type:He}),rb=e=>$e("analytics/generic/search",t=>{Ph(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),nb=e=>$e("analytics/generic/click",(t,r)=>(Ft(e.result),Ph(e),t.makeClickEvent(e.evt,Ke(e.result,r),Xe(e.result),e.meta))),ob=e=>$e("analytics/generic/custom",t=>(Ph(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var ib=()=>({actionCause:"interfaceLoad"}),la=()=>({actionCause:"interfaceChange"});d();c();l();u();var kh=()=>He,ab=()=>G,da=T("configuration/updateBasicConfiguration",e=>_(e,{accessToken:He,environment:new L({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),pa=T("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new L({required:!1,url:!0}),pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new re({required:!1,each:G})})),zN={enabled:new ue({default:!0}),originContext:kh(),originLevel2:kh(),originLevel3:kh(),proxyBaseUrl:new L({required:!1,url:!0}),runtimeEnvironment:new Be,anonymous:new ue({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Jv,analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new W({options:{required:!1},values:rC.reduce((e,t)=>(e[t]=Xv,e),{})})},hl=T("configuration/updateAnalyticsConfiguration",e=>_(e,zN)),yl=T("configuration/analytics/disable"),Sl=T("configuration/analytics/enable"),sb=T("configuration/analytics/originlevel2",e=>_(e,{originLevel2:ab()})),cb=T("configuration/analytics/originlevel3",e=>_(e,{originLevel3:ab()})),ub=T("knowledge/setAgentId",e=>_(e,new L({required:!0})));d();c();l();u();var vl=T("insightConfiguration/set",e=>_(e,{insightId:G}));d();c();l();u();d();c();l();u();var lb=()=>({insightId:""});var Al=ce(lb(),e=>{e.addCase(vl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Cl=T("searchHub/set",e=>_(e,new L({required:!0,emptyAllowed:!0})));var jr=le("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(WN(i));return Ge(a)?n(a.error):(r(Cl(a.success.searchHub)),{response:a.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),WN=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var db=()=>({loading:!1,config:void 0});var Un=ce(db(),e=>{e.addCase(jr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(jr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(jr.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 pb(e){return e.type==="dateRange"}function fb(e){return`start${e}`}function mb(e){return`end${e}`}var Oh=()=>({dateFacetValueMap:{}});function YN(e,t,r){let n=e.start,o=e.end;return _n(n)&&(n=Hs(n),r.dateFacetValueMap[t][fb(n)]=e.start),_n(o)&&(o=Hs(o),r.dateFacetValueMap[t][mb(o)]=e.end),{...e,start:n,end:o}}function _h(e,t){if(pb(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>YN(o,r,t))}}return e}function Vr(e){let t=Oh();return{request:{...e,facets:e.facets?.map(n=>_h(n,t))},mappings:t}}function KN(e,t,r){return{...e,start:r.dateFacetValueMap[t][fb(e.start)]||e.start,end:r.dateFacetValueMap[t][mb(e.end)]||e.end}}function XN(e,t){return e.facetId in t.dateFacetValueMap}function JN(e,t){return XN(e,t)?{...e,values:e.values.map(r=>KN(r,e.facetId,t))}:e}function Rr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>JN(n,t))}}:e}d();c();l();u();d();c();l();u();var Qn=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield RC(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}),...(Fh()&&{pageId:Fh()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Yi(e)})}}});return function Qn(_x39,_x40){return _ref19.apply(this,arguments)}}();var gb=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:We(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?Nt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield Qn(t.configuration.analytics)))})}});return function gb(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var bl=T("didYouMean/enable"),hb=T("didYouMean/disable"),xl=T("didYouMean/automaticCorrections/disable"),yb=T("didYouMean/automaticCorrections/enable"),Yt=T("didYouMean/correction",e=>_(e,G)),yc=T("didYouMean/automaticCorrections/mode",e=>_(e,new L({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var ZN=T("history/undo"),e0=T("history/redo"),St=T("history/snapshot"),L8=le("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(ZN()),yield t(Ze())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),U8=le("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(e0()),yield t(Ze())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),Ze=le("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 An=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function Rl(){return{contextValues:{}}}d();c();l();u();var wl=()=>!1;d();c();l();u();function Sb(){return{contextValues:{}}}d();c();l();u();function Nh(){return{enabled:!0,tabs:{}}}function Il(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function vb(){return[]}d();c();l();u();function Lr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function El(){return{}}d();c();l();u();function Ab(){return{}}d();c();l();u();function Fl(){return{}}function vt(e){return{context:e.context||Rl(),dictionaryFieldContext:e.dictionaryFieldContext||Sb(),facetSet:e.facetSet||ia(),numericFacetSet:e.numericFacetSet||oa(),dateFacetSet:e.dateFacetSet||na(),categoryFacetSet:e.categoryFacetSet||ra(),automaticFacetSet:e.automaticFacetSet??il(),pagination:e.pagination||Lr(),query:e.query||at(),tabSet:e.tabSet||Fl(),advancedSearchQueries:e.advancedSearchQueries||An(),staticFilterSet:e.staticFilterSet||Ab(),querySet:e.querySet||El(),sortCriteria:e.sortCriteria||ir(),pipeline:e.pipeline||hc(),searchHub:e.searchHub||Zi(),facetOptions:e.facetOptions||Il(),facetOrder:e.facetOrder??vb(),debug:e.debug??wl()}}d();c();l();u();var Ut=T("query/updateQuery",e=>_(e,{q:new L,enableQuerySyntax:new ue}));d();c();l();u();d();c();l();u();var Cb=()=>({caseContext:{},caseId:"",caseNumber:""}),X=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var qh=()=>Z("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(X(t.insightCaseContext))),fa=e=>Z("query")("search/queryError",(t,r)=>t.logQueryError({...X(r.insightCaseContext),query:r.query?.q||at().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),bb=(e,t)=>Z("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),Tl=()=>Z("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(X(t.insightCaseContext))),Bn=()=>Z("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...X(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Ur(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var xb=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=r0(e),n=t0(e);return Vr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??We(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Qn(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 xb(_x49,_x50){return _ref24.apply(this,arguments)}}(),fr=/*#__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 xb(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function fr(_x51,_x52){return _ref25.apply(this,arguments)}}(),Rb=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield xb(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function Rb(_x53,_x54){return _ref26.apply(this,arguments)}}(),Pl=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield fr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function Pl(_x55,_x56){return _ref27.apply(this,arguments)}}(),kl=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield fr(e,t);return r.request={...r.request,numberOfResults:0},r});return function kl(_x57,_x58){return _ref28.apply(this,arguments)}}();function t0(e){return Ur({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function r0(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Do=class{constructor(t,r=n=>{this.dispatch(Ut({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=Rr(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 Ge(t.response)?(this.dispatch(fa(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let S=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(St(vt(_this1.getState()))),S})()}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 Ge(i.response)?(_this10.dispatch(fa(i.response.error)),_this10.rejectWithValue(i.response.error)):(_this10.dispatch(St(vt(_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 fr(r));return _this11.dispatch(Yt(t)),n})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return qn(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 wb=()=>Z("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(X(t.insightCaseContext))),Dh=()=>Z("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(X(t.insightCaseContext)));var Mo=class{constructor(t,r=n=>{this.dispatch(Ut({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=Rr(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 Ge(t.response)?(this.dispatch(fa(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,A=!te(m)&&!te(m.correctedQuery);if(!h&&!A)return null;let g=h?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(St(vt(_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 Ge(i.response)?(_this15.dispatch(fa(i.response.error)),_this15.rejectWithValue(i.response.error)):(_this15.dispatch(St(vt(_this15.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Dh()})})()}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:Dh()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Ut({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield fr(r));return _this16.dispatch(Yt(t)),n})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return qn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??at().enableQuerySyntax},search:{...yt(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Rr(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 Mh(_x63,_x64,_x65){return _Mh.apply(this,arguments)}function _Mh(){_Mh=_asyncToGenerator(function*(e,t,r){Sc(e);let n=new Mo({...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 fr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Mh.apply(this,arguments)}function jh(_x66,_x67,_x68){return _jh.apply(this,arguments)}function _jh(){_jh=_asyncToGenerator(function*(e,t,r){Sc(e);let n=new Mo({...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 fr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _jh.apply(this,arguments)}function Vh(_x69,_x70){return _Vh.apply(this,arguments)}function _Vh(){_Vh=_asyncToGenerator(function*(e,t){let r=new Mo({...t,analyticsAction:qh}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield qh().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield Pl(e,a),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Vh.apply(this,arguments)}function Lh(_x71,_x72,_x73){return _Lh.apply(this,arguments)}function _Lh(){_Lh=_asyncToGenerator(function*(e,t,r){let n=new Mo({...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 kl(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Lh.apply(this,arguments)}var Ib=le("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Mh(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Eb=le("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield jh(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),Fb=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Vh(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Tb=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Lh(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var Pb=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let i=Date.now(),a=Rr(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 Pb(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),Se=le("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Mh(r,t,e.legacy);Sc(r);let n=new Do({...t}),o=e.next?Uh(e.next):void 0,i=yield fr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),Ol=le("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return jh(r,t,e.legacy);Sc(r);let n=new Do({...t}),o=e.next?Uh(e.next):void 0,i=yield fr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),_l=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Vh(r,t);let n=new Do({...t}),o=Uh({actionCause:"browseResults"}),i=yield Pl(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),ma=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Lh(r,t,e.legacy);let n=new Do({...t}),o=yield kl(r),i=yield n.fetchFromAPI(o);return yield n.process(i)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),Nl=le("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:G});let i=e.id,a=yield gb(i,t()),p=yield n.querySuggest(a);return Ge(p)?r(p.error):{id:i,q:a.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),Sc=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Uh=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Kt=T("breadcrumb/deselectAll"),ql=T("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var ga=T("facet/updateFacetAutoSelection",e=>_(e,{allow:new ue({required:!0})}));d();c();l();u();d();c();l();u();var Dl=class extends Ln{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??at().q}get responseTime(){return this.activeInstantResultCache?.duration??yt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??yt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var kb=()=>$e("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Dl(e)),Ob=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Qh={id:G},n0={...Qh,q:Ye},BX=T("instantResults/register",e=>_(e,Qh)),Ml=T("instantResults/updateQuery",e=>_(e,n0)),GX=T("instantResults/clearExpired",e=>_(e,Qh));d();c();l();u();var jl=new ne({required:!0,min:0}),Vl=T("pagination/registerNumberOfResults",e=>_(e,jl)),Ll=T("pagination/updateNumberOfResults",e=>_(e,jl)),Ul=T("pagination/registerPage",e=>_(e,jl)),Gn=T("pagination/updatePage",e=>_(e,jl)),Ql=T("pagination/nextPage"),Bl=T("pagination/previousPage");d();c();l();u();d();c();l();u();var jo=(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:Yi(e)}});var ha=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??$t(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&&jo(e.configuration.analytics,t,r)),...(e.excerptLength&&!te(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 $n=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??$t(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:Nt.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 Qn(e.configuration.analytics,t))),...(e.excerptLength&&!te(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function $n(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var Bh=()=>$e("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Hn=e=>$e("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||at().q,aq:r.advancedSearchQueries?.aq||An().aq,cq:r.advancedSearchQueries?.cq||An().cq,dq:r.advancedSearchQueries?.dq||An().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var Gh=()=>$e("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),_b=()=>({actionCause:"didYouMeanClick"}),Nb=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var $J=new W({values:{undoneQuery:Ye},options:{required:!0}}),qb=()=>$e("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var ya=T("trigger/query/ignore",e=>_(e,new L({emptyAllowed:!0,required:!0}))),Sa=T("trigger/query/modification",e=>_(e,new W({values:{originalQuery:He,modification:He}})));d();c();l();u();d();c();l();u();function vc(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function Db(e){return Ur(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var $h={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function o0(e){return Ur(e).map(t=>{let r=$h[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function i0(e){return[...o0(e.facetSet??{}),...Db(e.numericFacetSet??{}),...Db(e.dateFacetSet??{}),...Ur(e.categoryFacetSet??{})]}function a0(e){return i0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Gl(e){return vc(a0(e),e.facetOrder??[])}var zn=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=u0(e),n=Gl(e),o=s0(e),i=yield $n(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Vr({...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 zn(_x98,_x99){return _ref40.apply(this,arguments)}}();function s0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(c0).filter(r=>r.currentValues.length>0):void 0}function c0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function u0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=l0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function l0(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 Wn=class{constructor(t,r=n=>{this.dispatch(Ut({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=Rr(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 Ge(t.response)?(this.dispatch(Hn(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let S=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(St(vt(_this19.getState()))),S})()}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 Ge(i.response)?(_this20.dispatch(Hn(i.response.error)),_this20.rejectWithValue(i.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(St(vt(_this20.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Gh()})})()}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:Gh()}}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(ya("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let i=_this21.getCurrentQuery(),a=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return Ge(a.response)?(_this21.dispatch(Hn(a.response.error)),_this21.rejectWithValue(a.response.error)):(_this21.dispatch(St(vt(_this21.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:qb()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??at().enableQuerySyntax},search:{...yt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return qn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield zn(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Yt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Sa({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield zn(_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 KZ=le("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield $l(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),XZ=le("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield zh(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),JZ=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Wh(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),ZZ=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield m0(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),eee=le("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return Hh(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),d0=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield zn(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function d0(_x112,_x113){return _ref46.apply(this,arguments)}}(),p0=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield $n(e);return Vr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function p0(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),f0=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield zn(e,t);return r.request.numberOfResults=0,r});return function f0(_x117,_x118){return _ref48.apply(this,arguments)}}(),Mb=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Hh(_x119,_x120){return _Hh.apply(this,arguments)}function _Hh(){_Hh=_asyncToGenerator(function*(e,t){_(e,{id:G,q:G,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Wn({...t,analyticsAction:kb()},m=>{t.dispatch(Ml({q:m,id:e.id}))}),a=yield p0(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 _Hh.apply(this,arguments)}function zh(_x121,_x122,_x123){return _zh.apply(this,arguments)}function _zh(){_zh=_asyncToGenerator(function*(e,t,r){Mb(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 Wn({...t,analyticsAction:r}),f=yield zn(e,a),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _zh.apply(this,arguments)}function Wh(_x124,_x125){return _Wh.apply(this,arguments)}function _Wh(){_Wh=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Bh().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Wn({...e,analyticsAction:Bh()}),p=yield d0(t,i),f=yield a.fetchFromAPI(p,{origin:"mainSearch"});return yield a.process(f)});return _Wh.apply(this,arguments)}function m0(_x126,_x127,_x128){return _m2.apply(this,arguments)}function _m2(){_m2=_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 Wn({...e,analyticsAction:t}),f=yield f0(r,a),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _m2.apply(this,arguments)}function $l(_x129,_x130,_x131){return _$l.apply(this,arguments)}function _$l(){_$l=_asyncToGenerator(function*(e,t,r){Mb(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 zn(e,a),f=new Wn({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _$l.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var jb=ot(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 mr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=Kh(e),o=g0(e),i=h0(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield $n(e,r):ha(e,t,r);return Vr({...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:Yh(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 mr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function Yh(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function g0(e){return vc(S0(e),e.facetOrder??[])}function h0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(y0).filter(r=>r.currentValues.length>0):void 0}function y0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function S0(e){return v0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function v0(e){return[...A0(e.facetSet??{}),...Vb(e.numericFacetSet??{}),...Vb(e.dateFacetSet??{}),...Ur(e.categoryFacetSet??{})]}function A0(e){return Ur(e).map(t=>{let r=$h[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Vb(e){return Ur(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 Kh(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=jb(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}var Yn=class{constructor(t,r=n=>{this.dispatch(Ut({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=Rr(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 Ge(t.response)?(this.dispatch(Hn(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=!te(f)&&!te(f.correctedQuery);if(!m&&!h)return null;let S=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(St(vt(_this26.getState()))),S})()}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 Ge(i.response)?(_this27.dispatch(Hn(i.response.error)),_this27.rejectWithValue(i.response.error)):(_this27.dispatch(St(vt(_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(ya("")),null;let i=_this28.getCurrentQuery(),a=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return Ge(a.response)?(_this28.dispatch(Hn(a.response.error)),_this28.rejectWithValue(a.response.error)):(_this28.dispatch(St(vt(_this28.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(St(vt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return qn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Nb(),o=yield _this29.fetchFromAPI(yield mr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Yt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(Sa({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield mr(_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 va=le("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new L,enableQuerySyntax:new ue,clearFilters:new ue}),e.clearFilters&&(r(Kt()),r(ql())),r(ga({allow:!0})),r(Ut({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Gn(1))}),Lb=T("search/updateSearchAction"),Fe=le("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return $l(r,t,e.legacy);Ub(r);let n=e.next?Qb(e.next):void 0,o=yield mr(r,t.extra.navigatorContext,n),i=new Yn({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Br=le("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Ub(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return zh(r,t,e.legacy);let n=new Yn({...t,analyticsAction:e.next}),o=yield mr(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)}}()),Kn=le("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wh(t,r);let n=JC("browseResults",t.getState),o=new Yn({...t,analyticsAction:n}),i=yield C0(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)}}()),Aa=le("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return $l(r,t,e.legacy);let n=new Yn({...t,analyticsAction:{}}),o=yield x0(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)}}()),nte=le("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Hh(e,t);_(e,{id:G,q:G,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=Qb(Ob()),a=yield b0(r,t.extra.navigatorContext,n,o,i),p=new Yn({...t,analyticsAction:i},h=>{t.dispatch(Ml({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)}}()),C0=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield mr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function C0(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),b0=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let i=ha(e,t,o);return Vr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function b0(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),x0=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield mr(e,t,r);return n.request.numberOfResults=0,n});return function x0(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Ub=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Qb=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Bb(_x158,_x159){return _Bb.apply(this,arguments)}function _Bb(){_Bb=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??$t(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 _Bb.apply(this,arguments)}var Ac=le("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield Bb(o,e),a=yield t.apiClient.html(i);return Ge(a)?n(a.error):{content:a.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),Hl=T("resultPreview/next"),zl=T("resultPreview/previous"),$b=T("resultPreview/prepare",e=>_(e,{results:new re({required:!0})})),Gb=2048,Wl=le("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Qv(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Gb&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Gb} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Xh(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Jh=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Xh();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Zh=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Ca=ce(Xh(),e=>{e.addCase(Ac.pending,t=>{t.isLoading=!0}).addCase(Ac.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(Fe.fulfilled,(t,r)=>{Jh(t),t.resultsWithPreview=Zh(r.payload.response.results)}).addCase(Kn.fulfilled,(t,r)=>{Jh(t),t.resultsWithPreview=t.resultsWithPreview.concat(Zh(r.payload.response.results))}).addCase(Br.fulfilled,Jh).addCase($b,(t,r)=>{t.resultsWithPreview=Zh(r.payload.results)}).addCase(Hl,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(zl,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Wl.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var Xn=(e,t)=>{let r=e;return te(r[t])?te(e.raw[t])?null:e.raw[t]:r[t]},R0=e=>t=>e.every(r=>!te(Xn(t,r))),w0=e=>t=>e.every(r=>te(Xn(t,r))),I0=(e,t)=>r=>{let n=Hb(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},E0=(e,t)=>r=>{let n=Hb(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Hb=(e,t)=>{let r=Xn(t,e);return fu(r)?r:[r]},zb={getResultProperty:Xn,fieldsMustBeDefined:R0,fieldsMustNotBeDefined:w0,fieldMustMatch:I0,fieldMustNotMatch:E0};function Yl(e){return e.search.response.searchUid!==""}function Wb(e,t,r){return e.search.results.find(n=>Xn(n,t)===r)}var ey=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var ba=T("app/setError");function ty(e,t){let r=t.payload??null;r&&(e.response=yt().response,e.results=[],e.questionAnswer=ji()),e.error=r,e.isLoading=!1}function ry(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function F0(e,t){ry(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 Yb(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function T0(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var xe=ce(yt(),e=>{e.addCase(Fe.rejected,(t,r)=>ty(t,r)),e.addCase(Kn.rejected,(t,r)=>ty(t,r)),e.addCase(Br.rejected,(t,r)=>ty(t,r)),e.addCase(Fe.fulfilled,(t,r)=>{F0(t,r)}),e.addCase(Kn.fulfilled,(t,r)=>{ry(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Br.fulfilled,(t,r)=>{ry(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Aa.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(Fe.pending,Yb),e.addCase(Kn.pending,T0),e.addCase(Br.pending,Yb),e.addCase(Lb,(t,r)=>{t.searchAction=r.payload}),e.addCase(ba,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Kl=ce(Zi(),e=>{e.addCase(Cl,(t,r)=>r.payload).addCase(Ze.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(pa,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();function Kb(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var Xb=Or;function ux(e,t){if(e===t||!(Xb(e)&&Xb(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]=ux(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function xa(e){let t=0;for(let r in e)t++;return t}var Jb=e=>[].concat(...e);function P0(e){return new RegExp("(^|:)//").test(e)}function k0(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Zl(e){return e!=null}function O0(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var _0=e=>e.replace(/\/$/,""),N0=e=>e.replace(/^\//,"");function q0(e,t){if(!e)return t;if(!t)return e;if(P0(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=_0(e),t=N0(t),`${e}${r}${t}`}function D0(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var Zb=(...e)=>v(...e),M0=e=>e.status>=200&&e.status<=299,j0=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ex(e){if(!Or(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function lx({baseUrl:e,prepareHeaders:t=A=>A,fetchFn:r=Zb,paramsSerializer:n,isJsonContentType:o=j0,jsonContentType:i="application/json",jsonReplacer:a,timeout:p,responseHandler:f,validateStatus:m,...h}={}){return typeof v>"u"&&r===Zb&&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*(S,g,C){let{getState:x,extra:w,endpoint:R,forced:E,type:F}=g,P,{url:V,headers:q=new b(h.headers),params:O=void 0,responseHandler:N=f??"json",validateStatus:M=m??M0,timeout:U=p,...Y}=typeof S=="string"?{url:S}:S,H,B=g.signal;U&&(H=new s.AbortController,g.signal.addEventListener("abort",H.abort),B=H.signal);let Q={...h,signal:B,...Y};q=new b(ex(q)),Q.headers=(yield t(q,{getState:x,arg:S,extra:w,endpoint:R,forced:E,type:F,extraOptions:C}))||q;let z=Ce=>typeof Ce=="object"&&(Or(Ce)||Array.isArray(Ce)||typeof Ce.toJSON=="function");if(!Q.headers.has("content-type")&&z(Q.body)&&Q.headers.set("content-type",i),z(Q.body)&&o(Q.headers)&&(Q.body=JSON.stringify(Q.body,a)),O){let Ce=~V.indexOf("?")?"&":"?",Te=n?n(O):new URLSearchParams(ex(O));V+=Ce+Te}V=q0(e,V);let $=new Request(V,Q);P={request:new Request(V,Q)};let ee,pe=!1,Re=H&&setTimeout(()=>{pe=!0,H.abort()},U);try{ee=yield r($)}catch(Ce){return{error:{status:pe?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Ce)},meta:P}}finally{Re&&clearTimeout(Re),H?.signal.removeEventListener("abort",H.abort)}let _e=ee.clone();P.response=_e;let be,we="";try{let Ce;if(yield Promise.all([A(ee,N).then(Te=>be=Te,Te=>Ce=Te),_e.text().then(Te=>we=Te,()=>{})]),Ce)throw Ce}catch(Ce){return{error:{status:"PARSING_ERROR",originalStatus:ee.status,data:we,error:String(Ce)},meta:P}}return M(ee,be)?{data:be,meta:P}:{error:{status:ee.status,data:be},meta:P}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function A(_x167,_x168){return _A2.apply(this,arguments)}function _A2(){_A2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=o(S.headers)?"json":"text"),g==="json"){let C=yield S.text();return C.length?JSON.parse(C):null}return S.text()});return _A2.apply(this,arguments)}}var Ra=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function V0(){return _V2.apply(this,arguments)}function _V2(){_V2=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(o=>setTimeout(i=>o(i),n))});return _V2.apply(this,arguments)}function L0(e,t){throw Object.assign(new Ra({error:e,meta:t}),{throwImmediately:!0})}var tx={},U0=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let i=[5,(t||tx).maxRetries,(o||tx).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),f={maxRetries:a,backoff:V0,retryCondition:(h,A,{attempt:S})=>S<=a,...t,...o},m=0;for(;;)try{let h=yield e(r,n,o);if(h.error)throw new Ra(h);return h}catch(h){if(m++,h.throwImmediately){if(h instanceof Ra)return h.value;throw h}if(h instanceof Ra&&!f.retryCondition(h.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return h.value;yield f.backoff(m,f.maxRetries)}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),dx=Object.assign(U0,{fail:L0}),ay=T("__rtkq/focused"),px=T("__rtkq/unfocused"),sy=T("__rtkq/online"),fx=T("__rtkq/offline");function cy(e){return e.type==="query"}function Q0(e){return e.type==="mutation"}function uy(e){return e.type==="infinitequery"}function ly(e,t,r,n,o,i){return B0(e)?e(t,r,n,o).filter(Zl).map(ny).map(i):Array.isArray(e)?e.map(ny).map(i):[]}function B0(e){return typeof e=="function"}function ny(e){return typeof e=="string"?{type:e}:e}function G0(e,t){return e.catch(t)}var bc=Symbol("forceQueryFn"),oy=e=>typeof e[bc]=="function";function $0({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i}){let a=new Map,p=new Map,{unsubscribeQueryResult:f,removeMutationResult:m,updateSubscriptionOptions:h}=o.internalActions;return{buildInitiateQuery:R,buildInitiateInfiniteQuery:E,buildInitiateMutation:F,getRunningQueryThunk:A,getRunningMutationThunk:S,getRunningQueriesThunk:g,getRunningMutationsThunk:C};function A(P,V){return q=>{let O=i.endpointDefinitions[P],N=e({queryArgs:V,endpointDefinition:O,endpointName:P});return a.get(q)?.[N]}}function S(P,V){return q=>p.get(q)?.[V]}function g(){return P=>Object.values(a.get(P)||{}).filter(Zl)}function C(){return P=>Object.values(p.get(P)||{}).filter(Zl)}function x(P){}function w(P,V){let q=(O,{subscribe:N=!0,forceRefetch:M,subscriptionOptions:U,[bc]:Y,...H}={})=>(B,Q)=>{let z=e({queryArgs:O,endpointDefinition:V,endpointName:P}),$,J={...H,type:"query",subscribe:N,forceRefetch:M,subscriptionOptions:U,endpointName:P,originalArgs:O,queryCacheKey:z,[bc]:Y};if(cy(V))$=t(J);else{let{direction:je,initialPageParam:it}=H;$=r({...J,direction:je,initialPageParam:it})}let ee=o.endpoints[P].select(O),pe=B($),Re=ee(Q());let{requestId:_e,abort:be}=pe,we=Re.requestId!==_e,Ce=a.get(B)?.[z],Te=()=>ee(Q()),ut=Object.assign(Y?pe.then(Te):we&&!Ce?Promise.resolve(Re):Promise.all([Ce,pe]).then(Te),{arg:O,requestId:_e,subscriptionOptions:U,queryCacheKey:z,abort:be,unwrap(){return _asyncToGenerator(function*(){let je=yield ut;if(je.isError)throw je.error;return je.data})()},refetch:()=>B(q(O,{subscribe:!1,forceRefetch:!0})),unsubscribe(){N&&B(f({queryCacheKey:z,requestId:_e}))},updateSubscriptionOptions(je){ut.subscriptionOptions=je,B(h({endpointName:P,requestId:_e,queryCacheKey:z,options:je}))}});if(!Ce&&!we&&!Y){let je=D0(a,B,{});je[z]=ut,ut.then(()=>{delete je[z],xa(je)||a.delete(B)})}return ut};return q}function R(P,V){return w(P,V)}function E(P,V){return w(P,V)}function F(P){return(V,{track:q=!0,fixedCacheKey:O}={})=>(N,M)=>{let U=n({type:"mutation",endpointName:P,originalArgs:V,track:q,fixedCacheKey:O}),Y=N(U);let{requestId:H,abort:B,unwrap:Q}=Y,z=G0(Y.unwrap().then(pe=>({data:pe})),pe=>({error:pe})),$=()=>{N(m({requestId:H,fixedCacheKey:O}))},J=Object.assign(z,{arg:Y.arg,requestId:H,abort:B,unwrap:Q,reset:$}),ee=p.get(N)||{};return p.set(N,ee),ee[H]=J,J.then(()=>{delete ee[H],xa(ee)||p.delete(N)}),O&&(ee[O]=J,J.then(()=>{ee[O]===J&&(delete ee[O],xa(ee)||p.delete(N))})),J}}}function H0(e){return e}var Xl=(e={})=>({...e,[oc]:!0});function z0({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a}){let p=(N,M,U,Y)=>(H,B)=>{let Q=r[N],z=n({queryArgs:M,endpointDefinition:Q,endpointName:N});if(H(o.internalActions.queryResultPatched({queryCacheKey:z,patches:U})),!Y)return;let $=o.endpoints[N].select(M)(B()),J=ly(Q.providesTags,$.data,void 0,M,{},i);H(o.internalActions.updateProvidedBy({queryCacheKey:z,providedTags:J}))};function f(N,M,U=0){let Y=[M,...N];return U&&Y.length>U?Y.slice(0,-1):Y}function m(N,M,U=0){let Y=[...N,M];return U&&Y.length>U?Y.slice(1):Y}let h=(N,M,U,Y=!0)=>(H,B)=>{let z=o.endpoints[N].select(M)(B()),$={patches:[],inversePatches:[],undo:()=>H(o.util.patchQueryData(N,M,$.inversePatches,Y))};if(z.status==="uninitialized")return $;let J;if("data"in z)if(zt(z.data)){let[ee,pe,Re]=Nu(z.data,U);$.patches.push(...pe),$.inversePatches.push(...Re),J=ee}else J=U(z.data),$.patches.push({op:"replace",path:[],value:J}),$.inversePatches.push({op:"replace",path:[],value:z.data});return $.patches.length===0||H(o.util.patchQueryData(N,M,$.patches,Y)),$},A=(N,M,U)=>Y=>Y(o.endpoints[N].initiate(M,{subscribe:!1,forceRefetch:!0,[bc]:()=>({data:U})})),S=(N,M)=>N.query&&N[M]?N[M]:H0,g=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(N,{signal:M,abort:U,rejectWithValue:Y,fulfillWithValue:H,dispatch:B,getState:Q,extra:z}){let $=r[N.endpointName];try{let J=S($,"transformResponse"),ee={signal:M,abort:U,dispatch:B,getState:Q,extra:z,endpoint:N.endpointName,type:N.type,forced:N.type==="query"?C(N,Q()):void 0,queryCacheKey:N.type==="query"?N.queryCacheKey:void 0},pe=N.type==="query"?N[bc]:void 0,Re,_e=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(we,Ce,Te,ut){if(Ce==null&&we.pages.length)return Promise.resolve({data:we});let je={queryArg:N.originalArgs,pageParam:Ce},it=yield be(je),ft=ut?f:m;return{data:{pages:ft(we.pages,it.data,Te),pageParams:ft(we.pageParams,Ce,Te)}}});return function _e(_x174,_x175,_x176,_x177){return _ref63.apply(this,arguments)}}();function be(_x178){return _be.apply(this,arguments)}function _be(){_be=_asyncToGenerator(function*(we){let Ce,{extraOptions:Te}=$;if(pe?Ce=pe():$.query?Ce=yield t($.query(we),ee,Te):Ce=yield $.queryFn(we,ee,Te,je=>t(je,ee,Te)),typeof process<"u",Ce.error)throw new Ra(Ce.error,Ce.meta);let ut=yield J(Ce.data,Ce.meta,we);return{...Ce,data:ut}});return _be.apply(this,arguments)}if(N.type==="query"&&"infiniteQueryOptions"in $){let{infiniteQueryOptions:we}=$,{maxPages:Ce=1/0}=we,Te,ut={pages:[],pageParams:[]},je=a.selectQueryEntry(Q(),N.queryCacheKey)?.data,ft=C(N,Q())&&!N.direction||!je?ut:je;if("direction"in N&&N.direction&&ft.pages.length){let Gt=N.direction==="backward",On=(Gt?mx:iy)(we,ft);Te=yield _e(ft,On,Ce,Gt)}else{let{initialPageParam:Gt=we.initialPageParam}=N,cr=je?.pageParams??[],On=cr[0]??Gt,wi=cr.length;Te=yield _e(ft,On,Ce),pe&&(Te={data:Te.data.pages[0]});for(let Ii=1;Ii<wi;Ii++){let qs=iy(we,Te.data);Te=yield _e(Te.data,qs,Ce)}}Re=Te}else Re=yield be(N.originalArgs);return H(Re.data,Xl({fulfilledTimeStamp:Date.now(),baseQueryMeta:Re.meta}))}catch(J){let ee=J;if(ee instanceof Ra){let pe=S($,"transformErrorResponse");try{return Y(yield pe(ee.value,ee.meta,N.originalArgs),Xl({baseQueryMeta:ee.meta}))}catch(Re){ee=Re}}throw typeof process<"u",console.error(ee),ee}});return function g(_x172,_x173){return _ref62.apply(this,arguments)}}();function C(N,M){let U=a.selectQueryEntry(M,N.queryCacheKey),Y=a.selectConfig(M).refetchOnMountOrArgChange,H=U?.fulfilledTimeStamp,B=N.forceRefetch??(N.subscribe&&Y);return B?B===!0||(Number(new Date)-Number(H))/1e3>=B:!1}let x=()=>le(`${e}/executeQuery`,g,{getPendingMeta({arg:M}){let U=r[M.endpointName];return Xl({startedTimeStamp:Date.now(),...(uy(U)?{direction:M.direction}:{})})},condition(M,{getState:U}){let Y=U(),H=a.selectQueryEntry(Y,M.queryCacheKey),B=H?.fulfilledTimeStamp,Q=M.originalArgs,z=H?.originalArgs,$=r[M.endpointName],J=M.direction;return oy(M)?!0:H?.status==="pending"?!1:C(M,Y)||cy($)&&$?.forceRefetch?.({currentArg:Q,previousArg:z,endpointState:H,state:Y})?!0:!(B&&!J)},dispatchConditionRejection:!0}),w=x(),R=x(),E=le(`${e}/executeMutation`,g,{getPendingMeta(){return Xl({startedTimeStamp:Date.now()})}}),F=N=>"force"in N,P=N=>"ifOlderThan"in N,V=(N,M,U)=>(Y,H)=>{let B=F(U)&&U.force,Q=P(U)&&U.ifOlderThan,z=(J=!0)=>{let ee={forceRefetch:J,isPrefetch:!0};return o.endpoints[N].initiate(M,ee)},$=o.endpoints[N].select(M)(H());if(B)Y(z());else if(Q){let J=$?.fulfilledTimeStamp;if(!J){Y(z());return}(Number(new Date)-Number(new Date(J)))/1e3>=Q&&Y(z())}else Y(z(!1))};function q(N){return M=>M?.meta?.arg?.endpointName===N}function O(N,M){return{matchPending:zi(Lu(N),q(M)),matchFulfilled:zi(Sn(N),q(M)),matchRejected:zi(ko(N),q(M))}}return{queryThunk:w,mutationThunk:E,infiniteQueryThunk:R,prefetch:V,updateQueryData:h,upsertQueryData:A,patchQueryData:p,buildMatchThunkActions:O}}function iy(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function mx(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function gx(e,t,r,n){return ly(r[e.meta.arg.endpointName][t],Sn(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 Jl(e,t,r){let n=e[t];n&&r(n)}function xc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function rx(e,t,r){let n=e[xc(t)];n&&r(n)}var Cc={};function W0({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 A(q,O,N,M){var U;q[U=O.queryCacheKey]??(q[U]={status:"uninitialized",endpointName:O.endpointName}),Jl(q,O.queryCacheKey,Y=>{Y.status="pending",Y.requestId=N&&Y.requestId?Y.requestId:M.requestId,O.originalArgs!==void 0&&(Y.originalArgs=O.originalArgs),Y.startedTimeStamp=M.startedTimeStamp;let H=o[M.arg.endpointName];uy(H)&&"direction"in O&&(Y.direction=O.direction)})}function S(q,O,N,M){Jl(q,O.arg.queryCacheKey,U=>{if(U.requestId!==O.requestId&&!M)return;let{merge:Y}=o[O.arg.endpointName];if(U.status="fulfilled",Y){if(U.data!==void 0){let{fulfilledTimeStamp:H,arg:B,baseQueryMeta:Q,requestId:z}=O,$=yn(U.data,J=>Y(J,N,{arg:B.originalArgs,baseQueryMeta:Q,fulfilledTimeStamp:H,requestId:z}));U.data=$}else U.data=N;}else U.data=o[O.arg.endpointName].structuralSharing??!0?ux(nr(U.data)?qg(U.data):U.data,N):N;delete U.error,U.fulfilledTimeStamp=O.fulfilledTimeStamp})}let g=Oo({name:`${e}/queries`,initialState:Cc,reducers:{removeQueryResult:{reducer(q,{payload:{queryCacheKey:O}}){delete q[O]},prepare:Wi()},cacheEntriesUpserted:{reducer(q,O){for(let N of O.payload){let{queryDescription:M,value:U}=N;A(q,M,!0,{arg:M,requestId:O.meta.requestId,startedTimeStamp:O.meta.timestamp}),S(q,{arg:M,requestId:O.meta.requestId,fulfilledTimeStamp:O.meta.timestamp,baseQueryMeta:{}},U,!0)}},prepare:q=>({payload:q.map(M=>{let{endpointName:U,arg:Y,value:H}=M,B=o[U];return{queryDescription:{type:"query",endpointName:U,originalArgs:M.arg,queryCacheKey:n({queryArgs:Y,endpointDefinition:B,endpointName:U})},value:H}}),meta:{[oc]:!0,requestId:sc(),timestamp:Date.now()}})},queryResultPatched:{reducer(q,{payload:{queryCacheKey:O,patches:N}}){Jl(q,O,M=>{M.data=Mg(M.data,N.concat())})},prepare:Wi()}},extraReducers(q){q.addCase(t.pending,(O,{meta:N,meta:{arg:M}})=>{let U=oy(M);A(O,M,U,N)}).addCase(t.fulfilled,(O,{meta:N,payload:M})=>{let U=oy(N.arg);S(O,N,M,U)}).addCase(t.rejected,(O,{meta:{condition:N,arg:M,requestId:U},error:Y,payload:H})=>{Jl(O,M.queryCacheKey,B=>{if(!N){if(B.requestId!==U)return;B.status="rejected",B.error=H??Y}})}).addMatcher(p,(O,N)=>{let{queries:M}=a(N);for(let[U,Y]of Object.entries(M))(Y?.status==="fulfilled"||Y?.status==="rejected")&&(O[U]=Y)})}}),C=Oo({name:`${e}/mutations`,initialState:Cc,reducers:{removeMutationResult:{reducer(q,{payload:O}){let N=xc(O);N in q&&delete q[N]},prepare:Wi()}},extraReducers(q){q.addCase(r.pending,(O,{meta:N,meta:{requestId:M,arg:U,startedTimeStamp:Y}})=>{U.track&&(O[xc(N)]={requestId:M,status:"pending",endpointName:U.endpointName,startedTimeStamp:Y})}).addCase(r.fulfilled,(O,{payload:N,meta:M})=>{M.arg.track&&rx(O,M,U=>{U.requestId===M.requestId&&(U.status="fulfilled",U.data=N,U.fulfilledTimeStamp=M.fulfilledTimeStamp)})}).addCase(r.rejected,(O,{payload:N,error:M,meta:U})=>{U.arg.track&&rx(O,U,Y=>{Y.requestId===U.requestId&&(Y.status="rejected",Y.error=N??M)})}).addMatcher(p,(O,N)=>{let{mutations:M}=a(N);for(let[U,Y]of Object.entries(M))(Y?.status==="fulfilled"||Y?.status==="rejected")&&U!==Y?.requestId&&(O[U]=Y)})}}),x=Oo({name:`${e}/invalidation`,initialState:Cc,reducers:{updateProvidedBy:{reducer(q,O){var U,Y;let{queryCacheKey:N,providedTags:M}=O.payload;for(let H of Object.values(q))for(let B of Object.values(H)){let Q=B.indexOf(N);Q!==-1&&B.splice(Q,1)}for(let{type:H,id:B}of M){let Q=(U=q[H]??(q[H]={}))[Y=B||"__internal_without_id"]??(U[Y]=[]);Q.includes(N)||Q.push(N)}},prepare:Wi()}},extraReducers(q){q.addCase(g.actions.removeQueryResult,(O,{payload:{queryCacheKey:N}})=>{for(let M of Object.values(O))for(let U of Object.values(M)){let Y=U.indexOf(N);Y!==-1&&U.splice(Y,1)}}).addMatcher(p,(O,N)=>{var U,Y;let{provided:M}=a(N);for(let[H,B]of Object.entries(M))for(let[Q,z]of Object.entries(B)){let $=(U=O[H]??(O[H]={}))[Y=Q||"__internal_without_id"]??(U[Y]=[]);for(let J of z)$.includes(J)||$.push(J)}}).addMatcher(_r(Sn(t),ac(t)),(O,N)=>{let M=gx(N,"providesTags",o,f),{queryCacheKey:U}=N.meta.arg;x.caseReducers.updateProvidedBy(O,x.actions.updateProvidedBy({queryCacheKey:U,providedTags:M}))})}}),w=Oo({name:`${e}/subscriptions`,initialState:Cc,reducers:{updateSubscriptionOptions(q,O){},unsubscribeQueryResult(q,O){},internal_getRTKQSubscriptions(){}}}),R=Oo({name:`${e}/internalSubscriptions`,initialState:Cc,reducers:{subscriptionsUpdated:{reducer(q,O){return Mg(q,O.payload)},prepare:Wi()}}}),E=Oo({name:`${e}/config`,initialState:{online:O0(),focused:k0(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(q,{payload:O}){q.middlewareRegistered=q.middlewareRegistered==="conflict"||i!==O?"conflict":!0}},extraReducers:q=>{q.addCase(sy,O=>{O.online=!0}).addCase(fx,O=>{O.online=!1}).addCase(ay,O=>{O.focused=!0}).addCase(px,O=>{O.focused=!1}).addMatcher(p,O=>({...O}))}}),F=Li({queries:g.reducer,mutations:C.reducer,provided:x.reducer,subscriptions:R.reducer,config:E.reducer}),P=(q,O)=>F(h.match(O)?void 0:q,O),V={...E.actions,...g.actions,...w.actions,...R.actions,...C.actions,...x.actions,resetApiState:h};return{reducer:P,actions:V}}var Vo=Symbol.for("RTKQ/skipToken"),hx={status:"uninitialized"},nx=yn(hx,()=>{}),ox=yn(hx,()=>{});function Y0({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=F=>nx,o=F=>ox;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:C,selectInvalidatedBy:x,selectCachedArgsForQuery:w,selectApiState:a,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:h};function i(F){return{...F,...Kb(F.status)}}function a(F){return F[t]}function p(F){return a(F)?.queries}function f(F,P){return p(F)?.[P]}function m(F){return a(F)?.mutations}function h(F){return a(F)?.config}function A(F,P,V){return q=>{if(q===Vo)return r(n,V);let O=e({queryArgs:q,endpointDefinition:P,endpointName:F});return r(M=>f(M,O)??nx,V)}}function S(F,P){return A(F,P,i)}function g(F,P){let{infiniteQueryOptions:V}=P;function q(O){let N={...O,...Kb(O.status)},{isLoading:M,isError:U,direction:Y}=N,H=Y==="forward",B=Y==="backward";return{...N,hasNextPage:R(V,N.data),hasPreviousPage:E(V,N.data),isFetchingNextPage:M&&H,isFetchingPreviousPage:M&&B,isFetchNextPageError:U&&H,isFetchPreviousPageError:U&&B}}return A(F,P,q)}function C(){return F=>{let P;return typeof F=="object"?P=xc(F)??Vo:P=F,r(P===Vo?o:O=>a(O)?.mutations?.[P]??ox,i)}}function x(F,P){let V=F[t],q=new Set;for(let O of P.filter(Zl).map(ny)){let N=V.provided[O.type];if(!N)continue;let M=(O.id!==void 0?N[O.id]:Jb(Object.values(N)))??[];for(let U of M)q.add(U)}return Jb(Array.from(q.values()).map(O=>{let N=V.queries[O];return N?[{queryCacheKey:O,endpointName:N.endpointName,originalArgs:N.originalArgs}]:[]}))}function w(F,P){return Object.values(p(F)).filter(V=>V?.endpointName===P&&V.status!=="uninitialized").map(V=>V.originalArgs)}function R(F,P){return P?iy(F,P)!=null:!1}function E(F,P){return!P||!F.getPreviousPageParam?!1:mx(F,P)!=null}}var ix=WeakMap?new WeakMap:void 0,ax=({endpointName:e,queryArgs:t})=>{let r="",n=ix?.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=Or(a)?Object.keys(a).sort().reduce((p,f)=>(p[f]=a[f],p),{}):a,a));Or(t)&&ix?.set(t,o),r=o}return`${e}(${r})`};function K0(...e){return function(r){let n=$i(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=ax;if("serializeQueryArgs"in m.endpointDefinition){let A=m.endpointDefinition.serializeQueryArgs;h=S=>{let g=A(S);return typeof g=="string"?g:ax({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(m)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(m){m()},apiUid:sc(),extractRehydrationInfo:n,hasRehydrationInfo:$i(m=>n(m)!=null)},a={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:h}){if(m)for(let A of m)o.tagTypes.includes(A)||o.tagTypes.push(A);if(h)for(let[A,S]of Object.entries(h))typeof S=="function"?S(i.endpointDefinitions[A]):Object.assign(i.endpointDefinitions[A]||{},S);return a}},p=e.map(m=>m.init(a,o,i));function f(m){let h=m.endpoints({query:A=>({...A,type:"query"}),mutation:A=>({...A,type:"mutation"}),infiniteQuery:A=>({...A,type:"infinitequery"})});for(let[A,S]of Object.entries(h)){if(m.overrideExisting!==!0&&A in i.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[A]=S;for(let g of p)g.injectEndpoint(A,S)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function Cn(e,...t){return Object.assign(e,...t)}var X0=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,o=null,i=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:p}=e.internalActions,f=(g,C)=>{var w,R;if(a.match(C)){let{queryCacheKey:E,requestId:F,options:P}=C.payload;return g?.[E]?.[F]&&(g[E][F]=P),!0}if(p.match(C)){let{queryCacheKey:E,requestId:F}=C.payload;return g[E]&&delete g[E][F],!0}if(e.internalActions.removeQueryResult.match(C))return delete g[C.payload.queryCacheKey],!0;if(t.pending.match(C)){let{meta:{arg:E,requestId:F}}=C,P=g[w=E.queryCacheKey]??(g[w]={});return P[`${F}_running`]={},E.subscribe&&(P[F]=E.subscriptionOptions??P[F]??{}),!0}let x=!1;if(t.fulfilled.match(C)||t.rejected.match(C)){let E=g[C.meta.arg.queryCacheKey]||{},F=`${C.meta.requestId}_running`;x||(x=!!E[F]),delete E[F]}if(t.rejected.match(C)){let{meta:{condition:E,arg:F,requestId:P}}=C;if(E&&F.subscribe){let V=g[R=F.queryCacheKey]??(g[R]={});V[P]=F.subscriptionOptions??V[P]??{},x=!0}}return x},m=()=>r.currentSubscriptions,S={getSubscriptions:m,getSubscriptionCount:g=>{let x=m()[g]??{};return xa(x)},isRequestSubscribed:(g,C)=>!!m()?.[g]?.[C]};return(g,C)=>{if(o||(o=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return o=r.currentSubscriptions={},i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,S];let x=f(r.currentSubscriptions,g),w=!0;if(x){i||(i=setTimeout(()=>{let F=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,P]=Nu(o,()=>F);C.next(e.internalActions.subscriptionsUpdated(P)),o=F,i=null},500));let R=typeof g.type=="string"&&!!g.type.startsWith(n),E=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;w=!R&&!E}return[w,!1]}};function J0(e){for(let t in e)return!1;return!0}var Z0=2147483647/1e3-1,eq=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a}})=>{let{removeQueryResult:p,unsubscribeQueryResult:f,cacheEntriesUpserted:m}=t.internalActions,h=_r(f.match,r.fulfilled,r.rejected,m.match);function A(w){let R=o.currentSubscriptions[w];return!!R&&!J0(R)}let S={},g=(w,R,E)=>{let F=R.getState(),P=a(F);if(h(w)){let V;if(m.match(w))V=w.payload.map(q=>q.queryDescription.queryCacheKey);else{let{queryCacheKey:q}=f.match(w)?w.payload:w.meta.arg;V=[q]}C(V,R,P)}if(t.util.resetApiState.match(w))for(let[V,q]of Object.entries(S))q&&clearTimeout(q),delete S[V];if(n.hasRehydrationInfo(w)){let{queries:V}=n.extractRehydrationInfo(w);C(Object.keys(V),R,P)}};function C(w,R,E){let F=R.getState();for(let P of w){let V=i(F,P);x(P,V?.endpointName,R,E)}}function x(w,R,E,F){let V=n.endpointDefinitions[R]?.keepUnusedDataFor??F.keepUnusedDataFor;if(V===1/0)return;let q=Math.max(0,Math.min(V,Z0));if(!A(w)){let O=S[w];O&&clearTimeout(O),S[w]=setTimeout(()=>{A(w)||E.dispatch(p({queryCacheKey:w})),delete S[w]},q*1e3)}}return g},sx=new Error("Promise never resolved before cacheEntryRemoved."),tq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:p}})=>{let f=Uu(n),m=Uu(o),h=Sn(n,o),A={};function S(R,E,F){let P=A[R];P?.valueResolved&&(P.valueResolved({data:E,meta:F}),delete P.valueResolved)}function g(R){let E=A[R];E&&(delete A[R],E.cacheEntryRemoved())}let C=(R,E,F)=>{let P=x(R);function V(q,O,N,M){let U=a(F,O),Y=a(E.getState(),O);!U&&Y&&w(q,M,O,E,N)}if(n.pending.match(R))V(R.meta.arg.endpointName,P,R.meta.requestId,R.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(R))for(let{queryDescription:q,value:O}of R.payload){let{endpointName:N,originalArgs:M,queryCacheKey:U}=q;V(N,U,R.meta.requestId,M),S(U,O,{})}else if(o.pending.match(R))E.getState()[t].mutations[P]&&w(R.meta.arg.endpointName,R.meta.arg.originalArgs,P,E,R.meta.requestId);else if(h(R))S(P,R.payload,R.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(R)||e.internalActions.removeMutationResult.match(R))g(P);else if(e.util.resetApiState.match(R))for(let q of Object.keys(A))g(q)};function x(R){return f(R)?R.meta.arg.queryCacheKey:m(R)?R.meta.arg.fixedCacheKey??R.meta.requestId:e.internalActions.removeQueryResult.match(R)?R.payload.queryCacheKey:e.internalActions.removeMutationResult.match(R)?xc(R.payload):""}function w(R,E,F,P,V){let q=r.endpointDefinitions[R],O=q?.onCacheEntryAdded;if(!O)return;let N={},M=new Promise(z=>{N.cacheEntryRemoved=z}),U=Promise.race([new Promise(z=>{N.valueResolved=z}),M.then(()=>{throw sx})]);U.catch(()=>{}),A[F]=N;let Y=e.endpoints[R].select(q.type==="query"?E:F),H=P.dispatch((z,$,J)=>J),B={...P,getCacheEntry:()=>Y(P.getState()),requestId:V,extra:H,updateCachedData:q.type==="query"?z=>P.dispatch(e.util.updateQueryData(R,E,z)):void 0,cacheDataLoaded:U,cacheEntryRemoved:M},Q=O(E,B);Promise.resolve(Q).catch(z=>{if(z!==sx)throw z})}return C},rq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},nq=({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=_r(Sn(n),ac(n)),A=_r(Sn(n,o),ko(n,o)),S=[],g=(w,R)=>{h(w)?x(gx(w,"invalidatesTags",r,a),R):A(w)?x([],R):i.util.invalidateTags.match(w)&&x(ly(w.payload,void 0,void 0,void 0,void 0,a),R)};function C(w){let{queries:R,mutations:E}=w;for(let F of[R,E])for(let P in F)if(F[P]?.status==="pending")return!0;return!1}function x(w,R){let E=R.getState(),F=E[e];if(S.push(...w),F.config.invalidationBehavior==="delayed"&&C(F))return;let P=S;if(S=[],P.length===0)return;let V=i.util.selectInvalidatedBy(E,P);t.batch(()=>{let q=Array.from(V.values());for(let{queryCacheKey:O}of q){let N=F.queries[O],M=f.currentSubscriptions[O]??{};N&&(xa(M)===0?R.dispatch(m({queryCacheKey:O})):N.status!=="uninitialized"&&R.dispatch(p(N)))}})}return g},oq=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let i={},a=(g,C)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&m(g.payload,C),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&m(g.meta.arg,C),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&f(g.meta.arg,C),r.util.resetApiState.match(g)&&A()};function p(g,C){let w=C.getState()[e].queries[g],R=o.currentSubscriptions[g];if(!(!w||w.status==="uninitialized"))return R}function f({queryCacheKey:g},C){let x=C.getState()[e],w=x.queries[g],R=o.currentSubscriptions[g];if(!w||w.status==="uninitialized")return;let{lowestPollingInterval:E,skipPollingIfUnfocused:F}=S(R);if(!Number.isFinite(E))return;let P=i[g];P?.timeout&&(clearTimeout(P.timeout),P.timeout=void 0);let V=Date.now()+E;i[g]={nextPollTimestamp:V,pollingInterval:E,timeout:setTimeout(()=>{(x.config.focused||!F)&&C.dispatch(n(w)),f({queryCacheKey:g},C)},E)}}function m({queryCacheKey:g},C){let w=C.getState()[e].queries[g],R=o.currentSubscriptions[g];if(!w||w.status==="uninitialized")return;let{lowestPollingInterval:E}=S(R);if(!Number.isFinite(E)){h(g);return}let F=i[g],P=Date.now()+E;(!F||P<F.nextPollTimestamp)&&f({queryCacheKey:g},C)}function h(g){let C=i[g];C?.timeout&&clearTimeout(C.timeout),delete i[g]}function A(){for(let g of Object.keys(i))h(g)}function S(g={}){let C=!1,x=Number.POSITIVE_INFINITY;for(let w in g)g[w].pollingInterval&&(x=Math.min(g[w].pollingInterval,x),C=g[w].skipPollingIfUnfocused||C);return{lowestPollingInterval:x,skipPollingIfUnfocused:C}}return a},iq=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Lu(r,n),i=ko(r,n),a=Sn(r,n),p={};return(m,h)=>{if(o(m)){let{requestId:A,arg:{endpointName:S,originalArgs:g}}=m.meta,C=t.endpointDefinitions[S],x=C?.onQueryStarted;if(x){let w={},R=new Promise((V,q)=>{w.resolve=V,w.reject=q});R.catch(()=>{}),p[A]=w;let E=e.endpoints[S].select(C.type==="query"?g:A),F=h.dispatch((V,q,O)=>O),P={...h,getCacheEntry:()=>E(h.getState()),requestId:A,extra:F,updateCachedData:C.type==="query"?V=>h.dispatch(e.util.updateQueryData(S,g,V)):void 0,queryFulfilled:R};x(g,P)}}else if(a(m)){let{requestId:A,baseQueryMeta:S}=m.meta;p[A]?.resolve({data:m.payload,meta:S}),delete p[A]}else if(i(m)){let{requestId:A,rejectedWithValue:S,baseQueryMeta:g}=m.meta;p[A]?.reject({error:m.payload??m.error,isUnhandledError:!S,meta:g}),delete p[A]}}},aq=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(f,m)=>{ay.match(f)&&p(m,"refetchOnFocus"),sy.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let h=f.getState()[e],A=h.queries,S=o.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(S)){let C=A[g],x=S[g];if(!x||!C)continue;(Object.values(x).some(R=>R[m]===!0)||Object.values(x).every(R=>R[m]===void 0)&&h.config[m])&&(xa(x)===0?f.dispatch(i({queryCacheKey:g})):C.status!=="uninitialized"&&f.dispatch(n(C)))}})}return a};function sq(e){let{reducerPath:t,queryThunk:r,api:n,context:o}=e,{apiUid:i}=o,a={invalidateTags:T(`${t}/invalidateTags`)},p=A=>A.type.startsWith(`${t}/`),f=[rq,eq,nq,oq,tq,iq];return{middleware:A=>{let S=!1,C={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:p},x=f.map(E=>E(C)),w=X0(C),R=aq(C);return E=>F=>{if(!Qi(F))return E(F);S||(S=!0,A.dispatch(n.internalActions.middlewareRegistered(i)));let P={...A,next:E},V=A.getState(),[q,O]=w(F,P,V),N;if(q?N=E(F):N=O,A.getState()[t]&&(R(F,P,V),p(F)||o.hasRehydrationInfo(F)))for(let M of x)M(F,P,V);return N}},actions:a};function h(A){return e.api.endpoints[A.endpointName].initiate(A.originalArgs,{subscribe:!1,forceRefetch:!0})}}var cx=Symbol(),cq=({createSelector:e=ot}={})=>({name:cx,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:h},A){fA();let S=be=>(typeof process<"u",be);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:sy,onOffline:fx,onFocus:ay,onFocusLost:px},util:{}});let g=Y0({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:C,selectCachedArgsForQuery:x,buildQuerySelector:w,buildInfiniteQuerySelector:R,buildMutationSelector:E}=g;Cn(t.util,{selectInvalidatedBy:C,selectCachedArgsForQuery:x});let{queryThunk:F,infiniteQueryThunk:P,mutationThunk:V,patchQueryData:q,updateQueryData:O,upsertQueryData:N,prefetch:M,buildMatchThunkActions:U}=z0({baseQuery:r,reducerPath:o,context:A,api:t,serializeQueryArgs:i,assertTagType:S,selectors:g}),{reducer:Y,actions:H}=W0({context:A,queryThunk:F,infiniteQueryThunk:P,mutationThunk:V,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});Cn(t.util,{patchQueryData:q,updateQueryData:O,upsertQueryData:N,prefetch:M,resetApiState:H.resetApiState,upsertQueryEntries:H.cacheEntriesUpserted}),Cn(t.internalActions,H);let{middleware:B,actions:Q}=sq({reducerPath:o,context:A,queryThunk:F,mutationThunk:V,infiniteQueryThunk:P,api:t,assertTagType:S,selectors:g});Cn(t.util,Q),Cn(t,{reducer:Y,middleware:B});let{buildInitiateQuery:z,buildInitiateInfiniteQuery:$,buildInitiateMutation:J,getRunningMutationThunk:ee,getRunningMutationsThunk:pe,getRunningQueriesThunk:Re,getRunningQueryThunk:_e}=$0({queryThunk:F,mutationThunk:V,infiniteQueryThunk:P,api:t,serializeQueryArgs:i,context:A});return Cn(t.util,{getRunningMutationThunk:ee,getRunningMutationsThunk:pe,getRunningQueryThunk:_e,getRunningQueriesThunk:Re}),{name:cx,injectEndpoint(be,we){var ut;let Te=(ut=t.endpoints)[be]??(ut[be]={});cy(we)&&Cn(Te,{name:be,select:w(be,we),initiate:z(be,we)},U(F,be)),Q0(we)&&Cn(Te,{name:be,select:E(),initiate:J(be)},U(V,be)),uy(we)&&Cn(Te,{name:be,select:R(be,we),initiate:$(be,we)},U(F,be))}}}}),yx=K0(cq());d();c();l();u();d();c();l();u();var Lo=e=>e.query,Sx=e=>e.query?.enableQuerySyntax;var vx=ot(e=>Lo(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})),ed=ot(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Rc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var wa=e=>$e({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Ve(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Ve(t)??"",answerGenerated:e??!1})}),Ia=()=>$e({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});var Ax=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var Cx=ot(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 bx=e=>e.context;d();c();l();u();var dy=e=>e.pipeline;d();c();l();u();var py=e=>e.searchHub;d();c();l();u();var Qt=ot(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Pne=ot(e=>e,e=>{let t=Qt(e);return t&&e?e[t].expression:""});d();c();l();u();var xx=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var Rx=e=>e.excerptLength?.length;d();c();l();u();var Gr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,wx=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Ix=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 Ex=e=>e.sortCriteria;var Fx=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Fx(_x179){return _ref64.apply(this,arguments)}}(),Tx=(e,t)=>{let r=Lo(e)?.q,{aq:n,cq:o,dq:i,lq:a}=lq(e),p=bx(e),f=jo(e.configuration.analytics,t,{actionCause:ey(e)}),m=py(e),h=dy(e),A=xh(e)??[],S=kx(e),g=Qt(e.tabSet)||"default",C=Ch(e),x=jC(e),w=t.referrer||"",R=wx(e),E=Ex(e),F=uq(e),P=Rx(e),V=Ix(e),q=xx(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Sx(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:A}},...(m?.length&&{searchHub:m}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Yh(e),firstResult:e.pagination.firstResult}),tab:g,locale:C,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...F,...(V??{}),...(P&&{excerptLength:P}),...(q&&{dictionaryFieldContext:q}),sortCriteria:E,...(R&&{facetOptions:R}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Px=(e,t)=>{let r=Lo(e)?.q,n=kx(e),o=jo(e.configuration.analytics,t,{actionCause:ey(e)}),i=Ch(e),a=py(e),p=dy(e),f=xh(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:f}},...(a?.length&&{searchHub:a}),...(p?.length&&{pipeline:p}),...o,locale:i}},kx=e=>Gl(e)?.map(t=>_h(t,Oh())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),uq=e=>({actionsHistory:e.configuration.analytics.enabled?Nt.getInstance().getHistory():[]}),lq=e=>{let t=Cx(e),r=Kh(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var td=["searching","thinking","answering"];function rd(e){return e.toLowerCase()}function fy(){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 Ox=["text/plain","text/markdown"];var Ea=new L({required:!0}),_x=new L,Fa=new ue({required:!0}),my={id:Ea,title:Ea,uri:Ea,permanentid:Ea,clickUri:_x},nd=new L({required:!0,constrainTo:Ox}),Nx=new L({required:!0,constrainTo:td}),qx=e=>({...e,name:rd(e.name)}),Ta=T("generatedAnswer/setIsVisible",e=>_(e,Fa)),Pa=T("generatedAnswer/setAnswerId",e=>_(e,G)),od=T("generatedAnswer/setAnswerGenerationMode",e=>_(e,new L({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),wc=T("generatedAnswer/setIsEnabled",e=>_(e,Fa)),Qo=T("generatedAnswer/updateMessage",e=>_(e,{textDelta:Ea})),Bo=T("generatedAnswer/updateCitations",e=>_(e,{citations:new re({required:!0,each:new W({values:my})})})),Go=T("generatedAnswer/updateError",e=>_(e,{message:_x,code:new ne({min:0})})),ar=T("generatedAnswer/resetAnswer"),id=T("generatedAnswer/like"),ad=T("generatedAnswer/dislike"),sd=T("generatedAnswer/feedbackModal/open"),Ic=T("generatedAnswer/expand"),cd=T("generatedAnswer/collapse"),ud=T("generatedAnswer/setId",e=>_(e,{id:new L({required:!0})})),ld=T("generatedAnswer/feedbackModal/close"),ka=T("generatedAnswer/sendFeedback"),$r=T("generatedAnswer/setIsLoading",e=>_(e,Fa)),Uo=T("generatedAnswer/setIsStreaming",e=>_(e,Fa)),$o=T("generatedAnswer/setAnswerContentFormat",e=>_(e,nd)),dd=T("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new re({each:nd,default:["text/plain"]})})),pd=T("knowledge/updateAnswerConfigurationId",e=>_(e,Ea)),fd=T("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Eu)),Ec=T("generatedAnswer/setIsAnswerGenerated",e=>_(e,Fa)),Ho=T("generatedAnswer/setCannotAnswer",e=>_(e,Fa)),gy=T("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new W({}))),md=T("generatedAnswer/startStep",e=>_(qx(e),{name:Nx,startedAt:new ne({min:0,required:!0})})),gd=T("generatedAnswer/finishStep",e=>_(qx(e),{name:Nx,finishedAt:new ne({min:0,required:!0})})),Dx=le("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 Fx(r),h=(g,C)=>{switch(g){case"genqa.headerMessageType":{let x=JSON.parse(C);n($o(x.contentFormat));break}case"genqa.messageType":n(Qo(JSON.parse(C)));break;case"genqa.citationsType":n(Bo(JSON.parse(C)));break;case"genqa.endOfStreamType":{let x=JSON.parse(C).answerGenerated,w=p.length!==0&&!x;n(Ho(w)),n(Uo(!1)),n(Ec(x)),n(wa(x)),n(Ia());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${g}"`)}};n($r(!0));let A=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=o.streamingClient?.streamGeneratedAnswer(m,{write:g=>{A(m)&&(n($r(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{A(m)&&n(Go(g))},close:()=>{A(m)&&n(Uo(!1))},resetAnswer:()=>{A(m)&&n(ar())}});S?f(S):n($r(!1))});return function(_x180,_x181){return _ref65.apply(this,arguments)}}()),hd=le("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(ar());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=Tx(i,n);r(gy(a)),yield r(yd(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(_x182,_x183){return _ref66.apply(this,arguments)}}());d();c();l();u();var dq=/*#__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=We(a,i);return{data:lx({baseUrl:`${m}/rest/organizations/${a}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(A){if(A instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=A.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(C=>{g[C]=A[C]}),g.duplex="half",g.body=yield A.text(),v(S,g)});return function fetchFn(_x187){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}}catch(m){return{error:m}}});return function dq(_x184,_x185,_x186){return _ref67.apply(this,arguments)}}(),Sd=yx({reducerPath:"answer",baseQuery:dx(dq,{maxRetries:3}),endpoints:()=>({})});var pq=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},fq=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},mq=(e,t)=>{e.citations=t.citations},gq=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},hq=(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})`)},yq=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&hq(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(pq(t,o),r($o(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(fq(t,o),r(Qo({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(mq(t,o),r(Bo({citations:o.citations})));break;case"genqa.endOfStreamType":gq(t,o),r(wa(o.answerGenerated??!1)),r(Ia());break}},Sq=(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`},zo=Sd.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(_x188,_x189){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:A}=a,S=We(m,h),g=Sq(S,m,p.answerConfigurationId,f?.insightId);yield xu(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${A}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(C){let x=C.headers.get("x-answer-id");x&&o(w=>{w.answerId=x,i(Pa(x))})});return function onopen(_x190){return _ref69.apply(this,arguments)}}(),onmessage:C=>{o(x=>{yq(C,x,i)})},onerror:C=>{throw C},onclose:()=>{o(C=>{i(Ho(!C.generated))})}})}).apply(this,arguments)}})})}),yd=e=>zo.endpoints.getAnswer.initiate(e),hy=e=>{let t=ed(e);return zo.endpoints.getAnswer.select(t??Vo)(e)};d();c();l();u();var Mx=ce(Dn,e=>e);d();c();l();u();function vq(e){let t=e.payload?.analyticsAction;return jx(e)&&!te(t)}function jx(e){return"type"in e}var Vx=e=>t=>r=>{let n;vq(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return jx(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 vd={q:new L,enableQuerySyntax:new ue,aq:new L,cq:new L,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new L,f:new W,fExcluded:new W,cf:new W,nf:new W,mnf:new W,df:new W,debug:new ue,sf:new W,tab:new L,af:new W};var tt=T("searchParameters/restore",e=>_(e,vd)),Ad=T("searchParameters/restoreTab",e=>_(e,G));d();c();l();u();var Cd=T("tab/register",e=>{let t=new W({values:{id:G,expression:Ye}});return _(e,t)}),Tt=T("tab/updateActiveTab",e=>_(e,G));d();c();l();u();var bd=Cr(vu(),1),Qx=Cr(Lx(),1),Bx=Cr(Ux(),1);bd.default.extend(Bx.default);bd.default.extend(Qx.default);var xd=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:bd.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 Aq=/(^|; )Coveo-Pendragon=([^;]*)/;function Cy(){return typeof window>"u"?!1:Aq.exec(document.cookie)?.pop()||null}var Rd=ce(xd(),e=>e.addCase(da,(t,r)=>{Cq(t,r.payload)}).addCase(pa,(t,r)=>{bq(t,r.payload)}).addCase(hl,(t,r)=>{xq(t,r.payload)}).addCase(yl,t=>{t.analytics.enabled=!1}).addCase(Sl,t=>{t.analytics.enabled=!0}).addCase(sb,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(cb,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Tt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ad,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(tt,(t,r)=>{te(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(ub,(t,{payload:r})=>{t.knowledge.agentId=r}));function Cq(e,t){te(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",te(t.organizationId)||(e.organizationId=t.organizationId)}function bq(e,t){te(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),te(t.locale)||(e.search.locale=t.locale),te(t.timezone)||(e.search.timezone=t.timezone),te(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xq(e,t){te(t.enabled)||(e.analytics.enabled=t.enabled),te(t.originContext)||(e.analytics.originContext=t.originContext),te(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),te(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),te(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),te(t.trackingId)||(e.analytics.trackingId=t.trackingId),te(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),te(t.source)||(e.analytics.source=t.source);try{let r=Cy();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}te(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),te(t.anonymous)||(e.analytics.anonymous=t.anonymous),te(t.deviceId)||(e.analytics.deviceId=t.deviceId),te(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),te(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var ve=Rd;d();c();l();u();function Rq(e){return e.instantlyCallable}var Gx=()=>e=>t=>e(Rq(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 Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function $x(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var by,wq=new Uint8Array(16);function xy(){if(!by){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");by=crypto.getRandomValues.bind(crypto)}return by(wq)}d();c();l();u();d();c();l();u();var Iq=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ry={randomUUID:Iq};function Eq(e,t,r){if(Ry.randomUUID&&!t&&!e)return Ry.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 $x(n)}var Jn=Eq;d();c();l();u();d();c();l();u();var I={};Ms(I,{BRAND:()=>Zq,DIRTY:()=>Wo,EMPTY_PATH:()=>kq,INVALID:()=>ye,NEVER:()=>MD,OK:()=>qt,ParseStatus:()=>kt,Schema:()=>Pe,ZodAny:()=>to,ZodArray:()=>wn,ZodBigInt:()=>Ko,ZodBoolean:()=>Xo,ZodBranded:()=>Tc,ZodCatch:()=>ci,ZodDate:()=>Jo,ZodDefault:()=>si,ZodDiscriminatedUnion:()=>Ed,ZodEffects:()=>yr,ZodEnum:()=>ii,ZodError:()=>Xt,ZodFirstPartyTypeKind:()=>Ae,ZodFunction:()=>Td,ZodIntersection:()=>ri,ZodIssueCode:()=>K,ZodLazy:()=>ni,ZodLiteral:()=>oi,ZodMap:()=>Ma,ZodNaN:()=>Va,ZodNativeEnum:()=>ai,ZodNever:()=>wr,ZodNull:()=>ei,ZodNullable:()=>Wr,ZodNumber:()=>Yo,ZodObject:()=>Jt,ZodOptional:()=>gr,ZodParsedType:()=>ae,ZodPipeline:()=>Pc,ZodPromise:()=>ro,ZodReadonly:()=>ui,ZodRecord:()=>Fd,ZodSchema:()=>Pe,ZodSet:()=>ja,ZodString:()=>eo,ZodSymbol:()=>qa,ZodTransformer:()=>yr,ZodTuple:()=>zr,ZodType:()=>Pe,ZodUndefined:()=>Zo,ZodUnion:()=>ti,ZodUnknown:()=>Rn,ZodVoid:()=>Da,addIssueToContext:()=>ie,any:()=>cD,array:()=>pD,bigint:()=>nD,boolean:()=>rR,coerce:()=>DD,custom:()=>Zx,date:()=>oD,datetimeRegex:()=>Xx,defaultErrorMap:()=>bn,discriminatedUnion:()=>hD,effect:()=>FD,enum:()=>wD,function:()=>bD,getErrorMap:()=>Oa,getParsedType:()=>Hr,instanceof:()=>tD,intersection:()=>yD,isAborted:()=>wd,isAsync:()=>_a,isDirty:()=>Id,isValid:()=>Zn,late:()=>eD,lazy:()=>xD,literal:()=>RD,makeIssue:()=>Fc,map:()=>AD,nan:()=>rD,nativeEnum:()=>ID,never:()=>lD,null:()=>sD,nullable:()=>PD,number:()=>tR,object:()=>fD,objectUtil:()=>wy,oboolean:()=>qD,onumber:()=>ND,optional:()=>TD,ostring:()=>_D,pipeline:()=>OD,preprocess:()=>kD,promise:()=>ED,quotelessJson:()=>Fq,record:()=>vD,set:()=>CD,setErrorMap:()=>Pq,strictObject:()=>mD,string:()=>eR,symbol:()=>iD,transformer:()=>FD,tuple:()=>SD,undefined:()=>aD,union:()=>gD,unknown:()=>uD,util:()=>Ne,void:()=>dD});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 wy;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(wy||(wy={}));var ae=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hr=e=>{switch(typeof e){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(e)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(e)?ae.array:e===null?ae.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ae.promise:typeof Map<"u"&&e instanceof Map?ae.map:typeof Set<"u"&&e instanceof Set?ae.set:typeof Date<"u"&&e instanceof Date?ae.date:ae.object;default:return ae.unknown}};var K=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"]),Fq=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Xt=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()}};Xt.create=e=>new Xt(e);var Tq=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===ae.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.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 K.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 K.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 K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ne.assertNever(e)}return{message:r}},bn=Tq;var Hx=bn;function Pq(e){Hx=e}function Oa(){return Hx}d();c();l();u();var Fc=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}},kq=[];function ie(e,t){let r=Oa(),n=Fc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===bn?void 0:bn].filter(o=>!!o)});e.common.issues.push(n)}var kt=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 ye;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 ye;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}}},ye=Object.freeze({status:"aborted"}),Wo=e=>({status:"dirty",value:e}),qt=e=>({status:"valid",value:e}),wd=e=>e.status==="aborted",Id=e=>e.status==="dirty",Zn=e=>e.status==="valid",_a=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var de;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(de||(de={}));var hr=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}},zx=(e,t)=>{if(Zn(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 Xt(e.common.issues);return this._error=r,this._error}}};function Ie(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 Pe=class{get description(){return this._def.description}_getType(t){return Hr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new kt,ctx:{common:t.parent.common,data:t.data,parsedType:Hr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(_a(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return zx(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Zn(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=>Zn(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:Hr(t)},o=_this32._parse({data:t,path:n.path,parent:n}),i=yield _a(o)?o:Promise.resolve(o);return zx(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:K.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 yr({schema:this,typeName:Ae.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 gr.create(this,this._def)}nullable(){return Wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wn.create(this)}promise(){return ro.create(this,this._def)}or(t){return ti.create([this,t],this._def)}and(t){return ri.create(this,t,this._def)}transform(t){return new yr({...Ie(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new si({...Ie(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new Tc({typeName:Ae.ZodBranded,type:this,...Ie(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ci({...Ie(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Pc.create(this,t)}readonly(){return ui.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Oq=/^c[^\s-]{8,}$/i,_q=/^[0-9a-z]+$/,Nq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qq=/^[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,Dq=/^[a-z0-9_-]{21}$/i,Mq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jq=/^[-+]?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)?)??$/,Vq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Iy,Uq=/^(?:(?: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])$/,Qq=/^(?:(?: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])$/,Bq=/^(([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]))$/,Gq=/^(([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])$/,$q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yx="((\\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])))",zq=new RegExp(`^${Yx}$`);function Kx(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 Wq(e){return new RegExp(`^${Kx(e)}$`)}function Xx(e){let t=`${Yx}T${Kx(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 Yq(e,t){return!!((t==="v4"||!t)&&Uq.test(e)||(t==="v6"||!t)&&Bq.test(e))}function Kq(e,t){if(!Mq.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 Xq(e,t){return!!((t==="v4"||!t)&&Qq.test(e)||(t==="v6"||!t)&&Gq.test(e))}var eo=class e extends Pe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ae.string){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.string,received:i.parsedType}),ye}let n=new kt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:K.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),ie(o,{code:K.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?ie(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):p&&ie(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Vq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Iy||(Iy=new RegExp(Lq,"u")),Iy.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")qq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Dq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Oq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")_q.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Nq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ie(o,{validation:"url",code:K.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),ie(o,{validation:"regex",code:K.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),ie(o,{code:K.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),ie(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Xx(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?zq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Wq(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?jq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Yq(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Kq(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Xq(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?$q.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Hq.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64url",code:K.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:K.invalid_string,...de.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...de.errToObj(t)})}url(t){return this._addCheck({kind:"url",...de.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...de.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...de.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...de.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...de.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...de.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...de.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...de.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...de.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...de.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...de.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...de.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,...de.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,...de.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...de.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...de.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...de.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...de.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...de.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...de.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...de.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...de.errToObj(r)})}nonempty(t){return this.min(1,de.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}};eo.create=e=>new eo({checks:[],typeName:Ae.ZodString,coerce:e?.coerce??!1,...Ie(e)});function Jq(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 Yo=class e extends Pe{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)!==ae.number){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.number,received:i.parsedType}),ye}let n,o=new kt;for(let i of this._def.checks)i.kind==="int"?Ne.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ie(n,{code:K.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),ie(n,{code:K.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),ie(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Jq(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ie(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ie(n,{code:K.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,de.toString(r))}gt(t,r){return this.setLimit("min",t,!1,de.toString(r))}lte(t,r){return this.setLimit("max",t,!0,de.toString(r))}lt(t,r){return this.setLimit("max",t,!1,de.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:de.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:de.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:de.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.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)}};Yo.create=e=>new Yo({checks:[],typeName:Ae.ZodNumber,coerce:e?.coerce||!1,...Ie(e)});var Ko=class e extends Pe{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)!==ae.bigint)return this._getInvalidInput(t);let n,o=new kt;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),ie(n,{code:K.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),ie(n,{code:K.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),ie(n,{code:K.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 ie(r,{code:K.invalid_type,expected:ae.bigint,received:r.parsedType}),ye}gte(t,r){return this.setLimit("min",t,!0,de.toString(r))}gt(t,r){return this.setLimit("min",t,!1,de.toString(r))}lte(t,r){return this.setLimit("max",t,!0,de.toString(r))}lt(t,r){return this.setLimit("max",t,!1,de.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:de.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:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:de.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}};Ko.create=e=>new Ko({checks:[],typeName:Ae.ZodBigInt,coerce:e?.coerce??!1,...Ie(e)});var Xo=class extends Pe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ae.boolean){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.boolean,received:n.parsedType}),ye}return qt(t.data)}};Xo.create=e=>new Xo({typeName:Ae.ZodBoolean,coerce:e?.coerce||!1,...Ie(e)});var Jo=class e extends Pe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ae.date){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_type,expected:ae.date,received:i.parsedType}),ye}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ie(i,{code:K.invalid_date}),ye}let n=new kt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:K.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),ie(o,{code:K.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:de.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:de.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}};Jo.create=e=>new Jo({checks:[],coerce:e?.coerce||!1,typeName:Ae.ZodDate,...Ie(e)});var qa=class extends Pe{_parse(t){if(this._getType(t)!==ae.symbol){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.symbol,received:n.parsedType}),ye}return qt(t.data)}};qa.create=e=>new qa({typeName:Ae.ZodSymbol,...Ie(e)});var Zo=class extends Pe{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.undefined,received:n.parsedType}),ye}return qt(t.data)}};Zo.create=e=>new Zo({typeName:Ae.ZodUndefined,...Ie(e)});var ei=class extends Pe{_parse(t){if(this._getType(t)!==ae.null){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.null,received:n.parsedType}),ye}return qt(t.data)}};ei.create=e=>new ei({typeName:Ae.ZodNull,...Ie(e)});var to=class extends Pe{constructor(){super(...arguments),this._any=!0}_parse(t){return qt(t.data)}};to.create=e=>new to({typeName:Ae.ZodAny,...Ie(e)});var Rn=class extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qt(t.data)}};Rn.create=e=>new Rn({typeName:Ae.ZodUnknown,...Ie(e)});var wr=class extends Pe{_parse(t){let r=this._getOrReturnCtx(t);return ie(r,{code:K.invalid_type,expected:ae.never,received:r.parsedType}),ye}};wr.create=e=>new wr({typeName:Ae.ZodNever,...Ie(e)});var Da=class extends Pe{_parse(t){if(this._getType(t)!==ae.undefined){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.void,received:n.parsedType}),ye}return qt(t.data)}};Da.create=e=>new Da({typeName:Ae.ZodVoid,...Ie(e)});var wn=class e extends Pe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ae.array)return ie(r,{code:K.invalid_type,expected:ae.array,received:r.parsedType}),ye;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(a||p)&&(ie(r,{code:a?K.too_big:K.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&&(ie(r,{code:K.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&&(ie(r,{code:K.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 hr(r,a,r.path,p)))).then(a=>kt.mergeArray(n,a));let i=[...r.data].map((a,p)=>o.type._parseSync(new hr(r,a,r.path,p)));return kt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:de.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:de.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:de.toString(r)}})}nonempty(t){return this.min(1,t)}};wn.create=(e,t)=>new wn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...Ie(t)});function Na(e){if(e instanceof Jt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gr.create(Na(n))}return new Jt({...e._def,shape:()=>t})}else return e instanceof wn?new wn({...e._def,type:Na(e.element)}):e instanceof gr?gr.create(Na(e.unwrap())):e instanceof Wr?Wr.create(Na(e.unwrap())):e instanceof zr?zr.create(e.items.map(t=>Na(t))):e}var Jt=class e extends Pe{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)!==ae.object){let m=this._getOrReturnCtx(t);return ie(m,{code:K.invalid_type,expected:ae.object,received:m.parsedType}),ye}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),p=[];if(!(this._def.catchall instanceof wr&&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],A=o.data[m];f.push({key:{status:"valid",value:m},value:h._parse(new hr(o,A,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof wr){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&&(ie(o,{code:K.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 A=o.data[h];f.push({key:{status:"valid",value:h},value:m._parse(new hr(o,A,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 A=yield h.key,S=yield h.value;m.push({key:A,value:S,alwaysSet:h.alwaysSet})}return m})).then(m=>kt.mergeObjectSync(n,m)):kt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return de.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:de.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:Ae.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 Na(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 gr;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Jx(Ne.objectKeys(this.shape))}};Jt.create=(e,t)=>new Jt({shape:()=>e,unknownKeys:"strip",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});Jt.strictCreate=(e,t)=>new Jt({shape:()=>e,unknownKeys:"strict",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});Jt.lazycreate=(e,t)=>new Jt({shape:e,unknownKeys:"strip",catchall:wr.create(),typeName:Ae.ZodObject,...Ie(t)});var ti=class extends Pe{_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 Xt(p.ctx.common.issues));return ie(r,{code:K.invalid_union,unionErrors:a}),ye}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(_x191){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 Xt(f));return ie(r,{code:K.invalid_union,unionErrors:p}),ye}}get options(){return this._def.options}};ti.create=(e,t)=>new ti({options:e,typeName:Ae.ZodUnion,...Ie(t)});var xn=e=>e instanceof ni?xn(e.schema):e instanceof yr?xn(e.innerType()):e instanceof oi?[e.value]:e instanceof ii?e.options:e instanceof ai?Ne.objectValues(e.enum):e instanceof si?xn(e._def.innerType):e instanceof Zo?[void 0]:e instanceof ei?[null]:e instanceof gr?[void 0,...xn(e.unwrap())]:e instanceof Wr?[null,...xn(e.unwrap())]:e instanceof Tc||e instanceof ui?xn(e.unwrap()):e instanceof ci?xn(e._def.innerType):[],Ed=class e extends Pe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.object)return ie(r,{code:K.invalid_type,expected:ae.object,received:r.parsedType}),ye;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}):(ie(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ye)}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=xn(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:Ae.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ie(n)})}};function Ey(e,t){let r=Hr(e),n=Hr(t);if(e===t)return{valid:!0,data:e};if(r===ae.object&&n===ae.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=Ey(e[p],t[p]);if(!f.valid)return{valid:!1};a[p]=f.data}return{valid:!0,data:a}}else if(r===ae.array&&n===ae.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=Ey(a,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ae.date&&n===ae.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ri=class extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(wd(i)||wd(a))return ye;let p=Ey(i.value,a.value);return p.valid?((Id(i)||Id(a))&&r.dirty(),{status:r.value,value:p.data}):(ie(n,{code:K.invalid_intersection_types}),ye)};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}))}};ri.create=(e,t,r)=>new ri({left:e,right:t,typeName:Ae.ZodIntersection,...Ie(r)});var zr=class e extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.array)return ie(n,{code:K.invalid_type,expected:ae.array,received:n.parsedType}),ye;if(n.data.length<this._def.items.length)return ie(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&n.data.length>this._def.items.length&&(ie(n,{code:K.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 hr(n,a,n.path,p)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>kt.mergeArray(r,a)):kt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};zr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zr({items:e,typeName:Ae.ZodTuple,rest:null,...Ie(t)})};var Fd=class e extends Pe{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!==ae.object)return ie(n,{code:K.invalid_type,expected:ae.object,received:n.parsedType}),ye;let o=[],i=this._def.keyType,a=this._def.valueType;for(let p in n.data)o.push({key:i._parse(new hr(n,p,n.path,p)),value:a._parse(new hr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?kt.mergeObjectAsync(r,o):kt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Pe?new e({keyType:t,valueType:r,typeName:Ae.ZodRecord,...Ie(n)}):new e({keyType:eo.create(),valueType:t,typeName:Ae.ZodRecord,...Ie(r)})}},Ma=class extends Pe{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!==ae.map)return ie(n,{code:K.invalid_type,expected:ae.map,received:n.parsedType}),ye;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new hr(n,p,n.path,[m,"key"])),value:i._parse(new hr(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 ye;(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 ye;(m.status==="dirty"||h.status==="dirty")&&r.dirty(),p.set(m.value,h.value)}return{status:r.value,value:p}}}};Ma.create=(e,t,r)=>new Ma({valueType:t,keyType:e,typeName:Ae.ZodMap,...Ie(r)});var ja=class e extends Pe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ae.set)return ie(n,{code:K.invalid_type,expected:ae.set,received:n.parsedType}),ye;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ie(n,{code:K.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&&(ie(n,{code:K.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 ye;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 hr(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:de.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:de.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ja.create=(e,t)=>new ja({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...Ie(t)});var Td=class e extends Pe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.function)return ie(r,{code:K.invalid_type,expected:ae.function,received:r.parsedType}),ye;function n(p,f){return Fc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Oa(),bn].filter(m=>!!m),issueData:{code:K.invalid_arguments,argumentsError:f}})}function o(p,f){return Fc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Oa(),bn].filter(m=>!!m),issueData:{code:K.invalid_return_type,returnTypeError:f}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ro){let p=this;return qt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new Xt([]),h=yield p._def.args.parseAsync(f,i).catch(g=>{throw m.addIssue(n(f,g)),m}),A=yield Reflect.apply(a,this,h);return yield p._def.returns._def.type.parseAsync(A,i).catch(g=>{throw m.addIssue(o(A,g)),m})}))}else{let p=this;return qt(function(...f){let m=p._def.args.safeParse(f,i);if(!m.success)throw new Xt([n(f,m.error)]);let h=Reflect.apply(a,this,m.data),A=p._def.returns.safeParse(h,i);if(!A.success)throw new Xt([o(h,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:zr.create(t).rest(Rn.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||zr.create([]).rest(Rn.create()),returns:r||Rn.create(),typeName:Ae.ZodFunction,...Ie(n)})}},ni=class extends Pe{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})}};ni.create=(e,t)=>new ni({getter:e,typeName:Ae.ZodLazy,...Ie(t)});var oi=class extends Pe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ie(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:t.data}}get value(){return this._def.value}};oi.create=(e,t)=>new oi({value:e,typeName:Ae.ZodLiteral,...Ie(t)});function Jx(e,t){return new ii({values:e,typeName:Ae.ZodEnum,...Ie(t)})}var ii=class e extends Pe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ie(r,{expected:Ne.joinValues(n),received:r.parsedType,code:K.invalid_type}),ye}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 ie(r,{received:r.data,code:K.invalid_enum_value,options:n}),ye}return qt(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})}};ii.create=Jx;var ai=class extends Pe{_parse(t){let r=Ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ae.string&&n.parsedType!==ae.number){let o=Ne.objectValues(r);return ie(n,{expected:Ne.joinValues(o),received:n.parsedType,code:K.invalid_type}),ye}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ne.objectValues(r);return ie(n,{received:n.data,code:K.invalid_enum_value,options:o}),ye}return qt(t.data)}get enum(){return this._def.values}};ai.create=(e,t)=>new ai({values:e,typeName:Ae.ZodNativeEnum,...Ie(t)});var ro=class extends Pe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ae.promise&&r.common.async===!1)return ie(r,{code:K.invalid_type,expected:ae.promise,received:r.parsedType}),ye;let n=r.parsedType===ae.promise?r.data:Promise.resolve(r.data);return qt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ro.create=(e,t)=>new ro({type:e,typeName:Ae.ZodPromise,...Ie(t)});var yr=class extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.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=>{ie(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 ye;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?ye:f.status==="dirty"?Wo(f.value):r.value==="dirty"?Wo(f.value):f});return function(_x192){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return ye;let p=this._def.schema._parseSync({data:a,path:n.path,parent:n});return p.status==="aborted"?ye:p.status==="dirty"?Wo(p.value):r.value==="dirty"?Wo(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"?ye:(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"?ye:(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(!Zn(a))return ye;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=>Zn(a)?Promise.resolve(o.transform(a.value,i)).then(p=>({status:r.value,value:p})):ye);Ne.assertNever(o)}};yr.create=(e,t,r)=>new yr({schema:e,typeName:Ae.ZodEffects,effect:t,...Ie(r)});yr.createWithPreprocess=(e,t,r)=>new yr({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...Ie(r)});var gr=class extends Pe{_parse(t){return this._getType(t)===ae.undefined?qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gr.create=(e,t)=>new gr({innerType:e,typeName:Ae.ZodOptional,...Ie(t)});var Wr=class extends Pe{_parse(t){return this._getType(t)===ae.null?qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:Ae.ZodNullable,...Ie(t)});var si=class extends Pe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ae.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:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ie(t)});var ci=class extends Pe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _a(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ci.create=(e,t)=>new ci({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ie(t)});var Va=class extends Pe{_parse(t){if(this._getType(t)!==ae.nan){let n=this._getOrReturnCtx(t);return ie(n,{code:K.invalid_type,expected:ae.nan,received:n.parsedType}),ye}return{status:"valid",value:t.data}}};Va.create=e=>new Va({typeName:Ae.ZodNaN,...Ie(e)});var Zq=Symbol("zod_brand"),Tc=class extends Pe{_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}},Pc=class e extends Pe{_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"?ye:i.status==="dirty"?(r.dirty(),Wo(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"?ye: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:Ae.ZodPipeline})}},ui=class extends Pe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Zn(o)&&(o.value=Object.freeze(o.value)),o);return _a(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ui.create=(e,t)=>new ui({innerType:e,typeName:Ae.ZodReadonly,...Ie(t)});function Wx(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Zx(e,t={},r){return e?to.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let p=Wx(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!i){let a=Wx(t,n),p=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:p})}}):to.create()}var eD={object:Jt.lazycreate},Ae;(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"})(Ae||(Ae={}));var tD=(e,t={message:`Input not instance of ${e.name}`})=>Zx(r=>r instanceof e,t),eR=eo.create,tR=Yo.create,rD=Va.create,nD=Ko.create,rR=Xo.create,oD=Jo.create,iD=qa.create,aD=Zo.create,sD=ei.create,cD=to.create,uD=Rn.create,lD=wr.create,dD=Da.create,pD=wn.create,fD=Jt.create,mD=Jt.strictCreate,gD=ti.create,hD=Ed.create,yD=ri.create,SD=zr.create,vD=Fd.create,AD=Ma.create,CD=ja.create,bD=Td.create,xD=ni.create,RD=oi.create,wD=ii.create,ID=ai.create,ED=ro.create,FD=yr.create,TD=gr.create,PD=Wr.create,kD=yr.createWithPreprocess,OD=Pc.create,_D=()=>eR().optional(),ND=()=>tR().optional(),qD=()=>rR().optional(),DD={string:e=>eo.create({...e,coerce:!0}),number:e=>Yo.create({...e,coerce:!0}),boolean:e=>Xo.create({...e,coerce:!0}),bigint:e=>Ko.create({...e,coerce:!0}),date:e=>Jo.create({...e,coerce:!0})};var MD=ye;var jD=I.object({name:I.string(),arguments:I.string()}),VD=I.object({id:I.string(),type:I.literal("function"),function:jD,encryptedValue:I.string().optional()}),Pd=I.object({id:I.string(),role:I.string(),content:I.string().optional(),name:I.string().optional(),encryptedValue:I.string().optional()}),LD=I.object({type:I.literal("text"),text:I.string()}),nR=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()}),oR=(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"]})},Ice=nR.superRefine((e,t)=>{oR(e,t)}),UD=I.discriminatedUnion("type",[LD,nR]),QD=UD.superRefine((e,t)=>{e.type==="binary"&&oR(e,t)}),BD=Pd.extend({role:I.literal("developer"),content:I.string()}),GD=Pd.extend({role:I.literal("system"),content:I.string()}),$D=Pd.extend({role:I.literal("assistant"),content:I.string().optional(),toolCalls:I.array(VD).optional()}),HD=Pd.extend({role:I.literal("user"),content:I.union([I.string(),I.array(QD)])}),zD=I.object({id:I.string(),content:I.string(),role:I.literal("tool"),toolCallId:I.string(),error:I.string().optional(),encryptedValue:I.string().optional()}),WD=I.object({id:I.string(),role:I.literal("activity"),activityType:I.string(),content:I.record(I.any())}),YD=I.object({id:I.string(),role:I.literal("reasoning"),content:I.string(),encryptedValue:I.string().optional()}),iR=I.discriminatedUnion("role",[BD,GD,$D,HD,zD,WD,YD]),Ece=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user"),I.literal("tool"),I.literal("activity"),I.literal("reasoning")]),KD=I.object({description:I.string(),value:I.string()}),XD=I.object({name:I.string(),description:I.string(),parameters:I.any()}),JD=I.object({threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),state:I.any(),messages:I.array(iR),tools:I.array(XD),context:I.array(KD),forwardedProps:I.any()}),ZD=I.any(),st=class extends Error{constructor(e){super(e)}},Fy=class extends st{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},aR=I.union([I.literal("developer"),I.literal("system"),I.literal("assistant"),I.literal("user")]),D=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),Le=I.object({type:I.nativeEnum(D),timestamp:I.number().optional(),rawEvent:I.any().optional()}).passthrough(),eM=Le.extend({type:I.literal(D.TEXT_MESSAGE_START),messageId:I.string(),role:aR.default("assistant")}),sR=Le.extend({type:I.literal(D.TEXT_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),tM=Le.extend({type:I.literal(D.TEXT_MESSAGE_END),messageId:I.string()}),rM=Le.extend({type:I.literal(D.TEXT_MESSAGE_CHUNK),messageId:I.string().optional(),role:aR.optional(),delta:I.string().optional()}),nM=Le.extend({type:I.literal(D.THINKING_TEXT_MESSAGE_START)}),oM=sR.omit({messageId:!0,type:!0}).extend({type:I.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),iM=Le.extend({type:I.literal(D.THINKING_TEXT_MESSAGE_END)}),aM=Le.extend({type:I.literal(D.TOOL_CALL_START),toolCallId:I.string(),toolCallName:I.string(),parentMessageId:I.string().optional()}),sM=Le.extend({type:I.literal(D.TOOL_CALL_ARGS),toolCallId:I.string(),delta:I.string()}),cM=Le.extend({type:I.literal(D.TOOL_CALL_END),toolCallId:I.string()}),uM=Le.extend({messageId:I.string(),type:I.literal(D.TOOL_CALL_RESULT),toolCallId:I.string(),content:I.string(),role:I.literal("tool").optional()}),lM=Le.extend({type:I.literal(D.TOOL_CALL_CHUNK),toolCallId:I.string().optional(),toolCallName:I.string().optional(),parentMessageId:I.string().optional(),delta:I.string().optional()}),dM=Le.extend({type:I.literal(D.THINKING_START),title:I.string().optional()}),pM=Le.extend({type:I.literal(D.THINKING_END)}),fM=Le.extend({type:I.literal(D.STATE_SNAPSHOT),snapshot:ZD}),mM=Le.extend({type:I.literal(D.STATE_DELTA),delta:I.array(I.any())}),gM=Le.extend({type:I.literal(D.MESSAGES_SNAPSHOT),messages:I.array(iR)}),hM=Le.extend({type:I.literal(D.ACTIVITY_SNAPSHOT),messageId:I.string(),activityType:I.string(),content:I.record(I.any()),replace:I.boolean().optional().default(!0)}),yM=Le.extend({type:I.literal(D.ACTIVITY_DELTA),messageId:I.string(),activityType:I.string(),patch:I.array(I.any())}),SM=Le.extend({type:I.literal(D.RAW),event:I.any(),source:I.string().optional()}),vM=Le.extend({type:I.literal(D.CUSTOM),name:I.string(),value:I.any()}),AM=Le.extend({type:I.literal(D.RUN_STARTED),threadId:I.string(),runId:I.string(),parentRunId:I.string().optional(),input:JD.optional()}),CM=Le.extend({type:I.literal(D.RUN_FINISHED),threadId:I.string(),runId:I.string(),result:I.any().optional()}),bM=Le.extend({type:I.literal(D.RUN_ERROR),message:I.string(),code:I.string().optional()}),xM=Le.extend({type:I.literal(D.STEP_STARTED),stepName:I.string()}),RM=Le.extend({type:I.literal(D.STEP_FINISHED),stepName:I.string()}),wM=I.union([I.literal("tool-call"),I.literal("message")]),IM=Le.extend({type:I.literal(D.REASONING_START),messageId:I.string()}),EM=Le.extend({type:I.literal(D.REASONING_MESSAGE_START),messageId:I.string(),role:I.literal("reasoning")}),FM=Le.extend({type:I.literal(D.REASONING_MESSAGE_CONTENT),messageId:I.string(),delta:I.string().refine(e=>e.length>0,"Delta must not be an empty string")}),TM=Le.extend({type:I.literal(D.REASONING_MESSAGE_END),messageId:I.string()}),PM=Le.extend({type:I.literal(D.REASONING_MESSAGE_CHUNK),messageId:I.string().optional(),delta:I.string().optional()}),kM=Le.extend({type:I.literal(D.REASONING_END),messageId:I.string()}),OM=Le.extend({type:I.literal(D.REASONING_ENCRYPTED_VALUE),subtype:wM,entityId:I.string(),encryptedValue:I.string()}),kd=I.discriminatedUnion("type",[eM,sR,tM,rM,dM,pM,nM,oM,iM,aM,sM,cM,lM,uM,fM,mM,gM,hM,yM,SM,vM,AM,CM,bM,xM,RM,IM,EM,FM,TM,PM,kM,OM]);d();c();l();u();var Ty={};Ms(Ty,{JsonPatchError:()=>lt,_areEquals:()=>_c,applyOperation:()=>li,applyPatch:()=>no,applyReducer:()=>MM,deepClone:()=>qM,getValueByPointer:()=>Dd,validate:()=>uR,validator:()=>Md});d();c();l();u();d();c();l();u();var _M=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)}}(),NM=Object.prototype.hasOwnProperty;function _d(e,t){return NM.call(e,t)}function Nd(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)_d(e,o)&&n.push(o);return n}function Ot(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function qd(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 Yr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function kc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Od(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Od(e[t]))return!0}else if(typeof e=="object"){for(var n=Nd(e),o=n.length,i=0;i<o;i++)if(Od(e[n[i]]))return!0}}return!1}function cR(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 Oc=function(e){_M(t,e);function t(r,n,o,i,a){var p=this.constructor,f=e.call(this,cR(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=cR(r,{name:n,index:o,operation:i,tree:a}),f}return t}(Error);var lt=Oc,qM=Ot,La={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=Dd(r,this.path);n&&(n=Ot(n));var o=li(r,{op:"remove",path:this.from}).removed;return li(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Dd(r,this.from);return li(r,{op:"add",path:this.path,value:Ot(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:_c(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},DM={add:function(e,t,r){return qd(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:La.move,copy:La.copy,test:La.test,_get:La._get};function Dd(e,t){if(t=="")return e;var r={op:"_get",path:t};return li(e,r),r.value}function li(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):Md(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=Dd(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=_c(e,t.value),a.test===!1)throw new lt("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 lt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Ot(e));var p=t.path||"",f=p.split("/"),m=e,h=1,A=f.length,S=void 0,g=void 0,C=void 0;for(typeof r=="function"?C=r:C=Md;;){if(g=f[h],g&&g.indexOf("~")!=-1&&(g=kc(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&&S===void 0&&(m[g]===void 0?S=f.slice(0,h).join("/"):h==A-1&&(S=t.path),S!==void 0&&C(t,0,e,S)),h++,Array.isArray(m)){if(g==="-")g=m.length;else{if(r&&!qd(g))throw new lt("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);qd(g)&&(g=~~g)}if(h>=A){if(r&&t.op==="add"&&g>m.length)throw new lt("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=DM[t.op].call(t,m,g,e);if(a.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=A){var a=La[t.op].call(t,m,g,e);if(a.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(m=m[g],r&&h<A&&(!m||typeof m!="object"))throw new lt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function no(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new lt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Ot(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=li(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function MM(e,t,r){var n=li(e,t);if(n.test===!1)throw new lt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Md(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new lt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(La[e.op]){if(typeof e.path!="string")throw new lt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new lt("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 lt("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 lt("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")&&Od(e.value))throw new lt("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 lt("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 lt("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=uR([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new lt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new lt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function uR(e,t,r){try{if(!Array.isArray(e))throw new lt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)no(Ot(t),Ot(e),r||!0);else{r=r||Md;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof lt)return o;throw o}}function _c(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(!_c(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],!_c(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var _y={};Ms(_y,{compare:()=>$M,generate:()=>Py,observe:()=>GM,unobserve:()=>BM});d();c();l();u();var ky=new WeakMap,jM=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),VM=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function LM(e){return ky.get(e)}function UM(e,t){return e.observers.get(t)}function QM(e,t){e.observers.delete(t.callback)}function BM(e,t){t.unobserve()}function GM(e,t){var r=[],n,o=LM(e);if(!o)o=new jM(e),ky.set(e,o);else{var i=UM(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Ot(e),t){n.callback=t,n.next=null;var a=function(){Py(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(){Py(n),clearTimeout(n.next),QM(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 VM(t,n)),n}function Py(e,t){t===void 0&&(t=!1);var r=ky.get(e.object);Oy(r.value,e.object,e.patches,"",t),e.patches.length&&no(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Oy(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Nd(t),a=Nd(e),p=!1,f=!1,m=a.length-1;m>=0;m--){var h=a[m],A=e[h];if(_d(t,h)&&!(t[h]===void 0&&A!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof A=="object"&&A!=null&&typeof S=="object"&&S!=null&&Array.isArray(A)===Array.isArray(S)?Oy(A,S,r,n+"/"+Yr(h),o):A!==S&&(p=!0,o&&r.push({op:"test",path:n+"/"+Yr(h),value:Ot(A)}),r.push({op:"replace",path:n+"/"+Yr(h),value:Ot(S)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Yr(h),value:Ot(A)}),r.push({op:"remove",path:n+"/"+Yr(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];!_d(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Yr(h),value:Ot(t[h])})}}}function $M(e,t,r){r===void 0&&(r=!1);var n=[];return Oy(e,t,n,"",r),n}var Jce=Object.assign({},Ty,_y,{JsonPatchError:Oc,deepClone:Ot,escapePathComponent:Yr,unescapePathComponent:kc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ny=function(e,t){return Ny=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])},Ny(e,t)};function Kr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ny(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function lR(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(A){a(A)}}function f(h){try{m(n.throw(h))}catch(A){a(A)}}function m(h){h.done?i(h.value):o(h.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function jd(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 In(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 Ua(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 Qa(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 di(e){return this instanceof di?(this.v=e,this):new di(e)}function dR(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(C){return Promise.resolve(C).then(g,A)}}function p(g,C){n[g]&&(o[g]=function(x){return new Promise(function(w,R){i.push([g,x,w,R])>1||f(g,x)})},C&&(o[g]=C(o[g])))}function f(g,C){try{m(n[g](C))}catch(x){S(i[0][3],x)}}function m(g){g.value instanceof di?Promise.resolve(g.value.v).then(h,A):S(i[0][2],g)}function h(g){f("next",g)}function A(g){f("throw",g)}function S(g,C){g(C),i.shift(),i.length&&f(i[0][0],i[0][1])}}function pR(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 In=="function"?In(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 Oe(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Ba(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 Vd=Ba(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
33
33
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
34
- `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Nc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ba=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=In(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(Oe(h))try{h()}catch(x){i=x instanceof qd?x.errors:[x]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var C=In(v),g=C.next();!g.done;g=C.next()){var S=g.value;try{nR(S)}catch(x){i=i??[],x instanceof qd?i=Ua(Ua([],La(i)),La(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{g&&!g.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(i)throw new qd(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)&&Nc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Nc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Iy=Ba.EMPTY;function Dd(e){return e instanceof Ba||e&&"closed"in e&&Oe(e.remove)&&Oe(e.add)&&Oe(e.unsubscribe)}function nR(e){Oe(e)?e():e.unsubscribe()}d();c();l();u();var Ir={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var Ga={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ga.delegate;return o?.setTimeout?o.setTimeout.apply(o,Ua([e,t],La(r))):setTimeout.apply(void 0,Ua([e,t],La(r)))},clearTimeout:function(e){var t=Ga.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Md(e){Ga.setTimeout(function(){var t=Ir.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function qc(){}d();c();l();u();var oR=function(){return Ey("C",void 0,void 0)}();function iR(e){return Ey("E",void 0,e)}function aR(e){return Ey("N",e,void 0)}function Ey(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var pi=null;function $a(e){if(Ir.useDeprecatedSynchronousErrorHandling){var t=!pi;if(t&&(pi={errorThrown:!1,error:null}),e(),t){var r=pi,n=r.errorThrown,o=r.error;if(pi=null,n)throw o}}else e()}function sR(e){Ir.useDeprecatedSynchronousErrorHandling&&pi&&(pi.errorThrown=!0,pi.error=e)}var Dc=function(e){Kr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Dd(r)&&r.add(n)):n.destination=KM,n}return t.create=function(r,n,o){return new Vd(r,n,o)},t.prototype.next=function(r){this.isStopped?Ty(aR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ty(iR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ty(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}(Ba);var zM=Function.prototype.bind;function Fy(e,t){return zM.call(e,t)}var WM=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){jd(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){jd(n)}else jd(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){jd(r)}},e}(),Vd=function(e){Kr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Oe(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&Ir.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Fy(r.next,p),error:r.error&&Fy(r.error,p),complete:r.complete&&Fy(r.complete,p)}):a=r}return i.destination=new WM(a),i}return t}(Dc);function jd(e){Ir.useDeprecatedSynchronousErrorHandling?sR(e):Md(e)}function YM(e){throw e}function Ty(e,t){var r=Ir.onStoppedNotification;r&&Ga.setTimeout(function(){return r(e,t)})}var KM={closed:!0,next:qc,error:YM,complete:qc};d();c();l();u();var Ha=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function za(e){return e}function Ld(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Py(e)}function Py(e){return e.length===0?za:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var rt=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=XM(t)?t:new Vd(t,r,n);return $a(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 Vd({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[Ha]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Py(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??Ir.Promise)!==null&&t!==void 0?t:Promise}function JM(e){return e&&Oe(e.next)&&Oe(e.error)&&Oe(e.complete)}function XM(e){return e&&e instanceof Dc||JM(e)&&Dd(e)}d();c();l();u();function ZM(e){return Oe(e?.lift)}function gt(e){return function(t){if(ZM(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 At(e,t,r,n,o){return new ej(e,t,r,n,o)}var ej=function(e){Kr(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}(Dc);d();c();l();u();d();c();l();u();var uR=Qa(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Jr=function(e){Kr(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;$a(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=In(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;$a(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;$a(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?Iy:(this.currentObservers=null,p.push(r),new Ba(function(){n.currentObservers=null,Nc(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 rt;return r.source=this,r},t.create=function(r,n){return new lR(r,n)},t}(rt);var lR=function(e){Kr(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:Iy},t}(Jr);d();c();l();u();d();c();l();u();var ky={now:function(){return(ky.delegate||Date).now()},delegate:void 0};var Ud=function(e){Kr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=ky);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}(Jr);d();c();l();u();var Qd=new rt(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function dR(e){return e&&Oe(e.schedule)}function tj(e){return e[e.length-1]}function pR(e){return dR(tj(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 Bd=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Gd(e){return Oe(e?.then)}d();c();l();u();function $d(e){return Oe(e[Ha])}d();c();l();u();function Hd(e){return Symbol.asyncIterator&&Oe(e?.[Symbol.asyncIterator])}d();c();l();u();function zd(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 rj(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Wd=rj();function Yd(e){return Oe(e?.[Wd])}d();c();l();u();function Kd(e){return tR(this,arguments,function(){var r,n,o,i;return Nd(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,di(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,di(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,di(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 Jd(e){return Oe(e?.getReader)}function Ct(e){if(e instanceof rt)return e;if(e!=null){if($d(e))return nj(e);if(Bd(e))return oj(e);if(Gd(e))return ij(e);if(Hd(e))return fR(e);if(Yd(e))return aj(e);if(Jd(e))return sj(e)}throw zd(e)}function nj(e){return new rt(function(t){var r=e[Ha]();if(Oe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function oj(e){return new rt(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function ij(e){return new rt(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Md)})}function aj(e){return new rt(function(t){var r,n;try{for(var o=In(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 rt(function(t){cj(e,t).catch(function(r){return t.error(r)})})}function sj(e){return fR(Kd(e))}function cj(e,t){var r,n,o,i;return eR(this,void 0,void 0,function(){var a,p;return Nd(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 Sr(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 Xd(e,t){return t===void 0&&(t=0),gt(function(r,n){r.subscribe(At(n,function(o){return Sr(n,e,function(){return n.next(o)},t)},function(){return Sr(n,e,function(){return n.complete()},t)},function(o){return Sr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Zd(e,t){return t===void 0&&(t=0),gt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mR(e,t){return Ct(e).pipe(Zd(t),Xd(t))}d();c();l();u();function gR(e,t){return Ct(e).pipe(Zd(t),Xd(t))}d();c();l();u();function hR(e,t){return new rt(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 rt(function(r){var n;return Sr(r,t,function(){n=e[Wd](),Sr(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 Oe(n?.return)&&n.return()}})}d();c();l();u();function ep(e,t){if(!e)throw new Error("Iterable cannot be null");return new rt(function(r){Sr(r,t,function(){var n=e[Symbol.asyncIterator]();Sr(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 ep(Kd(e),t)}function vR(e,t){if(e!=null){if($d(e))return mR(e,t);if(Bd(e))return hR(e,t);if(Gd(e))return gR(e,t);if(Hd(e))return ep(e,t);if(Yd(e))return yR(e,t);if(Jd(e))return SR(e,t)}throw zd(e)}function fi(e,t){return t?vR(e,t):Ct(e)}function ct(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pR(e);return fi(e,r)}d();c();l();u();function nt(e,t){var r=Oe(e)?e:function(){return e},n=function(o){return o.error(r())};return new rt(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var AR=Qa(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function tp(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 mi(e,t){return gt(function(r,n){var o=0;r.subscribe(At(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,v=!1,C=function(){v&&!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;Ct(r(x,h++)).subscribe(At(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 I=f.shift();a?Sr(t,a,function(){return S(I)}):S(I)};f.length&&m<n;)R();C()}catch(I){t.error(I)}}))};return e.subscribe(At(t,g,function(){v=!0,C()})),function(){p?.()}}function Zt(e,t,r){return r===void 0&&(r=1/0),Oe(t)?Zt(function(n,o){return mi(function(i,a){return t(n,i,o,a)})(Ct(e(n,o)))},r):(typeof t=="number"&&(r=t),gt(function(n,o){return CR(n,o,e,r)}))}function Oy(e){return e===void 0&&(e=1/0),Zt(za,e)}d();c();l();u();function _y(e){return new rt(function(t){Ct(e()).subscribe(t)})}d();c();l();u();function Mc(e){return gt(function(t,r){var n=null,o=!1,i;n=t.subscribe(At(r,void 0,void 0,function(a){i=Ct(e(a,Mc(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 rp(e,t){return Oe(t)?Zt(e,t,1):Zt(e,1)}d();c();l();u();function Ny(e){return gt(function(t,r){var n=!1;t.subscribe(At(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function gi(e){return gt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function qy(e,t){return gt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(At(n,function(f){o?.unsubscribe();var m=0,h=i++;Ct(e(f,h)).subscribe(o=At(n,function(v){return n.next(t?t(f,v,h,m++):v)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function np(e){return gt(function(t,r){Ct(e).subscribe(At(r,function(){return r.complete()},qc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function Dy(e,t,r){var n=Oe(e)||t||r?{next:e,error:t,complete:r}:e;return n?gt(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var p=!0;o.subscribe(At(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 op(e){for(var t=["topLevel"],r=0,n,o,i,a=function(I){return t.push(I)},p=function(I){return t[t.length-1]=I},f=function(I){n==null&&(n=r,o=t.length,i=I)},m=function(I){I===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},v=function(){return r--},C=function(I){if("0"<=I&&I<="9"){a("number");return}switch(I){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":C(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")&&(v(),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")&&(v(),h());break;case"arrayNeedsValue":S==="]"?h():bR(S)||(m("collectionItem"),p("arrayNeedsComma"),C(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"),C(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(I){return x.push(I.slice(e.length-e.lastIndexOf(I[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 RR(){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 ap(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 ip=4294967296;function My(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>=ip&&(o=o+(n/ip|0),n=n%ip)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?IR(n,o):Vy(n,o)}function wR(e,t){let r=Vy(e,t),n=r.hi&2147483648;n&&(r=IR(r.lo,r.hi));let o=jy(r.lo,r.hi);return n?"-"+o:o}function jy(e,t){if({lo:e,hi:t}=uj(e,t),t<=2097151)return String(ip*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 uj(e,t){return{lo:e>>>0,hi:t>>>0}}function Vy(e,t){return{lo:e|0,hi:t|0}}function IR(e,t){return t=~t,e?e=~e+1:t+=1,Vy(e,t)}var xR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Ly(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 Er=lj();function lj(){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),My(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),TR(r),My(r)},dec(r,n){return wR(r,n)},uDec(r,n){return jy(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 Uy=Symbol.for("@bufbuild/protobuf/text-encoding");function Qy(){if(y[Uy]==null){let e=new y.TextEncoder,t=new y.TextDecoder;y[Uy]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return y[Uy]}var oo;(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"})(oo||(oo={}));var dj=34028234663852886e22,pj=-34028234663852886e22,fj=4294967295,mj=2147483647,gj=-2147483648,Ue=class{constructor(t=Qy().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 By(t),Ly(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){hj(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){By(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return By(t),t=(t<<1^t>>31)>>>0,Ly(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Er.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=Er.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Er.enc(t);return ap(r.lo,r.hi,this.buf),this}sint64(t){let r=Er.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return ap(o,i,this.buf),this}uint64(t){let r=Er.uEnc(t);return ap(r.lo,r.hi,this.buf),this}},me=class{constructor(t,r=Qy().decodeUtf8){this.decodeUtf8=r,this.varint64=RR,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 oo.Varint:for(;this.buf[this.pos++]&128;);break;case oo.Bit64:this.pos+=4;case oo.Bit32:this.pos+=4;break;case oo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case oo.StartGroup:for(;;){let[i,a]=this.tag();if(a===oo.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 Er.dec(...this.varint64())}uint64(){return Er.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Er.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 Er.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Er.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 By(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>mj||e<gj)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>fj||e<0)throw new Error("invalid uint32: "+e)}function hj(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>dj||e<pj))throw new Error("invalid float32: "+e)}var yj=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Gy(){return{fields:{}}}var jc={encode(e,t=new Ue){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&zy.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=Gy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=zy.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 jc.fromPartial(e??{})},fromPartial(e){let t=Gy();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Gy();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 zy={encode(e,t=new Ue){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Me.encode(Me.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zy.fromPartial(e??{})},fromPartial(e){let t=kR();return t.key=e.key??"",t.value=e.value??void 0,t}};function $y(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Me={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&&jc.encode(jc.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vc.encode(Vc.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=$y();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=jc.unwrap(jc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Vc.unwrap(Vc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=$y();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=$y();if(e===null)t.nullValue=yj.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 Hy(){return{values:[]}}var Vc={encode(e,t=new Ue){for(let r of e.values)Me.encode(Me.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=Hy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(Me.unwrap(Me.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=Hy();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Hy();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},Sj=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 sp={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&&Me.encode(Me.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return sp.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 cp={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&&up.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=up.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return cp.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?up.fromPartial(e.function):void 0,t}};function NR(){return{name:"",arguments:""}}var up={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 me?e:new me(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 up.fromPartial(e??{})},fromPartial(e){let t=NR();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function qR(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var lp={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)cp.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 me?e:new me(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.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(cp.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 lp.fromPartial(e??{})},fromPartial(e){let t=qR();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=>cp.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},vj=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 DR(){return{type:0,timestamp:void 0,rawEvent:void 0}}var he={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&&Me.encode(Me.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Aj(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=DR();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 dp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 dp.fromPartial(e??{})},fromPartial(e){let t=MR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function jR(){return{baseEvent:void 0,messageId:"",delta:""}}var pp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 pp.fromPartial(e??{})},fromPartial(e){let t=jR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function VR(){return{baseEvent:void 0,messageId:""}}var fp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 fp.fromPartial(e??{})},fromPartial(e){let t=VR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function LR(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var mp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 mp.fromPartial(e??{})},fromPartial(e){let t=LR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 gp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 gp.fromPartial(e??{})},fromPartial(e){let t=UR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function QR(){return{baseEvent:void 0,toolCallId:""}}var hp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 hp.fromPartial(e??{})},fromPartial(e){let t=QR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function BR(){return{baseEvent:void 0,snapshot:void 0}}var yp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Me.encode(Me.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yp.fromPartial(e??{})},fromPartial(e){let t=BR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function GR(){return{baseEvent:void 0,delta:[]}}var Sp={encode(e,t=new Ue){e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)sp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(sp.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sp.fromPartial(e??{})},fromPartial(e){let t=GR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>sp.fromPartial(r))||[],t}};function $R(){return{baseEvent:void 0,messages:[]}}var vp={encode(e,t=new Ue){e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)lp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(lp.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vp.fromPartial(e??{})},fromPartial(e){let t=$R();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>lp.fromPartial(r))||[],t}};function HR(){return{baseEvent:void 0,event:void 0,source:void 0}}var Ap={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Me.encode(Me.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 me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Me.unwrap(Me.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 Ap.fromPartial(e??{})},fromPartial(e){let t=HR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 Cp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Me.encode(Me.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cp.fromPartial(e??{})},fromPartial(e){let t=zR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 bp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 bp.fromPartial(e??{})},fromPartial(e){let t=WR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 xp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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&&Me.encode(Me.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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=Me.unwrap(Me.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=YR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 Rp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 Rp.fromPartial(e??{})},fromPartial(e){let t=KR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function JR(){return{baseEvent:void 0,stepName:""}}var wp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 wp.fromPartial(e??{})},fromPartial(e){let t=JR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function XR(){return{baseEvent:void 0,stepName:""}}var Ip={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 Ip.fromPartial(e??{})},fromPartial(e){let t=XR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 Ep={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 Ep.fromPartial(e??{})},fromPartial(e){let t=ZR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 ew(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Fp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=ew();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Fp.fromPartial(e??{})},fromPartial(e){let t=ew();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 tw(){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 rw={encode(e,t=new Ue){return e.textMessageStart!==void 0&&dp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&pp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&fp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&mp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&gp.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&hp.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&yp.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Sp.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&vp.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Ap.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Cp.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&bp.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&xp.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Rp.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&wp.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Ip.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ep.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Fp.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=tw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=dp.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=pp.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=fp.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=mp.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=gp.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=hp.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=yp.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Sp.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=vp.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Ap.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Cp.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=bp.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=xp.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Rp.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=wp.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Ip.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Ep.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Fp.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return rw.fromPartial(e??{})},fromPartial(e){let t=tw();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?dp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?pp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?fp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?mp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?gp.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?hp.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?yp.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Sp.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?vp.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Ap.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Cp.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?bp.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?xp.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Rp.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?wp.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Ip.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ep.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Fp.fromPartial(e.toolCallChunk):void 0,t}};function Aj(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 nw(e){let t=rw.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=vj[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=Sj[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]}),Ed.parse(r)}var ow="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var bj=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Wy=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(bj);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},iw=e=>e==="*"||e==="x"||e==="X",aw=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},xj=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Rj=(e,t)=>{if(iw(e)||iw(t))return 0;let[r,n]=xj(aw(e),aw(t));return r>n?1:r<n?-1:0},Yy=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=Rj(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Tp=(e,t)=>{let r=Wy(e),n=Wy(t),o=r.pop(),i=n.pop(),a=Yy(r,n);return a!==0?a:o&&i?Yy(o.split("."),i.split(".")):o||i?o?-1:1:0};var Xe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Lc(){return Xn()}function ze(_x187,_x188,_x189,_x190){return _ze.apply(this,arguments)}function _ze(){_ze=_asyncToGenerator(function*(e,t,r,n){let o=t,i=r,a;for(let p of e)try{let f=yield n(p,Xe(o),Xe(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 _ze.apply(this,arguments)}var pw=(e,t,r,n)=>{let o=Xe(r.messages),i=Xe(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=Xe(a);return a={},m.messages!==void 0||m.state!==void 0?ct(m):Qd};return t.pipe(rp(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(m){let h=yield ze(n,o,i,(v,C,g)=>v.onEvent?.({event:m,agent:r,input:e,messages:C,state:g}));if(p(h),h.stopPropagation===!0)return f();switch(m.type){case D.TEXT_MESSAGE_START:{let v=yield ze(n,o,i,(C,g,S)=>C.onTextMessageStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{messageId:C,role:g="assistant"}=m;if(!o.find(S=>S.id===C)){let S={id:C,role:g,content:""};o.push(S),p({messages:o})}}return f()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:C}=m,g=o.find(x=>x.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),f();let S=yield ze(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:""}${C}`,p({messages:o})),f()}case D.TEXT_MESSAGE_END:{let{messageId:v}=m,C=o.find(g=>g.id===v);return C?(p(yield ze(n,o,i,(g,S,x)=>g.onTextMessageEndEvent?.({event:m,messages:S,state:x,agent:r,input:e,textMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:C,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),f())}case D.TOOL_CALL_START:{let v=yield ze(n,o,i,(C,g,S)=>C.onToolCallStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{toolCallId:C,toolCallName:g,parentMessageId:S}=m,x;S&&o.length>0&&o[o.length-1].id===S?x=o[o.length-1]:(x={id:S||C,role:"assistant",toolCalls:[]},o.push(x)),x.toolCalls??(x.toolCalls=[]),x.toolCalls.push({id:C,type:"function",function:{name:g,arguments:""}}),p({messages:o})}return f()}case D.TOOL_CALL_ARGS:{let{toolCallId:v,delta:C}=m,g=o.find(w=>w.toolCalls?.some(R=>R.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),f();let S=g.toolCalls?.find(w=>w.id===v);if(!S)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),f();let x=yield ze(n,o,i,(w,R,I)=>{let E=S.function.arguments,P=S.function.name,V={};try{V=op(E)}catch{}return w.onToolCallArgsEvent?.({event:m,messages:R,state:I,agent:r,input:e,toolCallBuffer:E,toolCallName:P,partialToolCallArgs:V})});return p(x),x.stopPropagation!==!0&&(S.function.arguments+=C,p({messages:o})),f()}case D.TOOL_CALL_END:{let{toolCallId:v}=m,C=o.find(S=>S.toolCalls?.some(x=>x.id===v));if(!C)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),f();let g=C.toolCalls?.find(S=>S.id===v);return g?(p(yield ze(n,o,i,(S,x,w)=>{let R=g.function.arguments,I=g.function.name,E={};try{E=JSON.parse(R)}catch{}return S.onToolCallEndEvent?.({event:m,messages:x,state:w,agent:r,input:e,toolCallName:I,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 '${v}'`),f())}case D.TOOL_CALL_RESULT:{let v=yield ze(n,o,i,(C,g,S)=>C.onToolCallResultEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{messageId:C,toolCallId:g,content:S,role:x}=m,w={id:C,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 D.STATE_SNAPSHOT:{let v=yield ze(n,o,i,(C,g,S)=>C.onStateSnapshotEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{snapshot:C}=m;i=C,p({state:i})}return f()}case D.STATE_DELTA:{let v=yield ze(n,o,i,(C,g,S)=>C.onStateDeltaEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{delta:C}=m;try{i=no(i,C,!0,!1).newDocument,p({state:i})}catch(g){let S=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
34
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Nc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ga=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=In(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(Oe(h))try{h()}catch(x){i=x instanceof Vd?x.errors:[x]}var A=this._finalizers;if(A){this._finalizers=null;try{for(var S=In(A),g=S.next();!g.done;g=S.next()){var C=g.value;try{fR(C)}catch(x){i=i??[],x instanceof Vd?i=Qa(Qa([],Ua(i)),Ua(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{g&&!g.done&&(o=S.return)&&o.call(S)}finally{if(n)throw n.error}}}if(i)throw new Vd(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)fR(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)&&Nc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Nc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var qy=Ga.EMPTY;function Ld(e){return e instanceof Ga||e&&"closed"in e&&Oe(e.remove)&&Oe(e.add)&&Oe(e.unsubscribe)}function fR(e){Oe(e)?e():e.unsubscribe()}d();c();l();u();var Ir={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var $a={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=$a.delegate;return o?.setTimeout?o.setTimeout.apply(o,Qa([e,t],Ua(r))):setTimeout.apply(void 0,Qa([e,t],Ua(r)))},clearTimeout:function(e){var t=$a.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Ud(e){$a.setTimeout(function(){var t=Ir.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function qc(){}d();c();l();u();var mR=function(){return Dy("C",void 0,void 0)}();function gR(e){return Dy("E",void 0,e)}function hR(e){return Dy("N",e,void 0)}function Dy(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var pi=null;function Ha(e){if(Ir.useDeprecatedSynchronousErrorHandling){var t=!pi;if(t&&(pi={errorThrown:!1,error:null}),e(),t){var r=pi,n=r.errorThrown,o=r.error;if(pi=null,n)throw o}}else e()}function yR(e){Ir.useDeprecatedSynchronousErrorHandling&&pi&&(pi.errorThrown=!0,pi.error=e)}var Dc=function(e){Kr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ld(r)&&r.add(n)):n.destination=KM,n}return t.create=function(r,n,o){return new Bd(r,n,o)},t.prototype.next=function(r){this.isStopped?jy(hR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?jy(gR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?jy(mR,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}(Ga);var zM=Function.prototype.bind;function My(e,t){return zM.call(e,t)}var WM=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){Qd(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Qd(n)}else Qd(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Qd(r)}},e}(),Bd=function(e){Kr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Oe(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&Ir.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&My(r.next,p),error:r.error&&My(r.error,p),complete:r.complete&&My(r.complete,p)}):a=r}return i.destination=new WM(a),i}return t}(Dc);function Qd(e){Ir.useDeprecatedSynchronousErrorHandling?yR(e):Ud(e)}function YM(e){throw e}function jy(e,t){var r=Ir.onStoppedNotification;r&&$a.setTimeout(function(){return r(e,t)})}var KM={closed:!0,next:qc,error:YM,complete:qc};d();c();l();u();var za=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function Wa(e){return e}function Gd(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vy(e)}function Vy(e){return e.length===0?Wa:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var rt=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=JM(t)?t:new Bd(t,r,n);return Ha(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=SR(r),new r(function(o,i){var a=new Bd({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[za]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Vy(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=SR(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 SR(e){var t;return(t=e??Ir.Promise)!==null&&t!==void 0?t:Promise}function XM(e){return e&&Oe(e.next)&&Oe(e.error)&&Oe(e.complete)}function JM(e){return e&&e instanceof Dc||XM(e)&&Ld(e)}d();c();l();u();function ZM(e){return Oe(e?.lift)}function gt(e){return function(t){if(ZM(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 At(e,t,r,n,o){return new ej(e,t,r,n,o)}var ej=function(e){Kr(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}(Dc);d();c();l();u();d();c();l();u();var vR=Ba(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Xr=function(e){Kr(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 AR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new vR},t.prototype.next=function(r){var n=this;Ha(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=In(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;Ha(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;Ha(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?qy:(this.currentObservers=null,p.push(r),new Ga(function(){n.currentObservers=null,Nc(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 rt;return r.source=this,r},t.create=function(r,n){return new AR(r,n)},t}(rt);var AR=function(e){Kr(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:qy},t}(Xr);d();c();l();u();d();c();l();u();var Ly={now:function(){return(Ly.delegate||Date).now()},delegate:void 0};var $d=function(e){Kr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Ly);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}(Xr);d();c();l();u();var Hd=new rt(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function CR(e){return e&&Oe(e.schedule)}function tj(e){return e[e.length-1]}function bR(e){return CR(tj(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 zd=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Wd(e){return Oe(e?.then)}d();c();l();u();function Yd(e){return Oe(e[za])}d();c();l();u();function Kd(e){return Symbol.asyncIterator&&Oe(e?.[Symbol.asyncIterator])}d();c();l();u();function Xd(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 rj(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Jd=rj();function Zd(e){return Oe(e?.[Jd])}d();c();l();u();function ep(e){return dR(this,arguments,function(){var r,n,o,i;return jd(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,di(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,di(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,di(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 tp(e){return Oe(e?.getReader)}function Ct(e){if(e instanceof rt)return e;if(e!=null){if(Yd(e))return nj(e);if(zd(e))return oj(e);if(Wd(e))return ij(e);if(Kd(e))return xR(e);if(Zd(e))return aj(e);if(tp(e))return sj(e)}throw Xd(e)}function nj(e){return new rt(function(t){var r=e[za]();if(Oe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function oj(e){return new rt(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function ij(e){return new rt(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ud)})}function aj(e){return new rt(function(t){var r,n;try{for(var o=In(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 xR(e){return new rt(function(t){cj(e,t).catch(function(r){return t.error(r)})})}function sj(e){return xR(ep(e))}function cj(e,t){var r,n,o,i;return lR(this,void 0,void 0,function(){var a,p;return jd(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=pR(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 Sr(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 rp(e,t){return t===void 0&&(t=0),gt(function(r,n){r.subscribe(At(n,function(o){return Sr(n,e,function(){return n.next(o)},t)},function(){return Sr(n,e,function(){return n.complete()},t)},function(o){return Sr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function np(e,t){return t===void 0&&(t=0),gt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function RR(e,t){return Ct(e).pipe(np(t),rp(t))}d();c();l();u();function wR(e,t){return Ct(e).pipe(np(t),rp(t))}d();c();l();u();function IR(e,t){return new rt(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 ER(e,t){return new rt(function(r){var n;return Sr(r,t,function(){n=e[Jd](),Sr(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 Oe(n?.return)&&n.return()}})}d();c();l();u();function op(e,t){if(!e)throw new Error("Iterable cannot be null");return new rt(function(r){Sr(r,t,function(){var n=e[Symbol.asyncIterator]();Sr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function FR(e,t){return op(ep(e),t)}function TR(e,t){if(e!=null){if(Yd(e))return RR(e,t);if(zd(e))return IR(e,t);if(Wd(e))return wR(e,t);if(Kd(e))return op(e,t);if(Zd(e))return ER(e,t);if(tp(e))return FR(e,t)}throw Xd(e)}function fi(e,t){return t?TR(e,t):Ct(e)}function ct(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=bR(e);return fi(e,r)}d();c();l();u();function nt(e,t){var r=Oe(e)?e:function(){return e},n=function(o){return o.error(r())};return new rt(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var PR=Ba(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ip(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 PR)}})})}d();c();l();u();function mi(e,t){return gt(function(r,n){var o=0;r.subscribe(At(n,function(i){n.next(e.call(t,i,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function kR(e,t,r,n,o,i,a,p){var f=[],m=0,h=0,A=!1,S=function(){A&&!f.length&&!m&&t.complete()},g=function(x){return m<n?C(x):f.push(x)},C=function(x){i&&t.next(x),m++;var w=!1;Ct(r(x,h++)).subscribe(At(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 E=f.shift();a?Sr(t,a,function(){return C(E)}):C(E)};f.length&&m<n;)R();S()}catch(E){t.error(E)}}))};return e.subscribe(At(t,g,function(){A=!0,S()})),function(){p?.()}}function Zt(e,t,r){return r===void 0&&(r=1/0),Oe(t)?Zt(function(n,o){return mi(function(i,a){return t(n,i,o,a)})(Ct(e(n,o)))},r):(typeof t=="number"&&(r=t),gt(function(n,o){return kR(n,o,e,r)}))}function Uy(e){return e===void 0&&(e=1/0),Zt(Wa,e)}d();c();l();u();function Qy(e){return new rt(function(t){Ct(e()).subscribe(t)})}d();c();l();u();function Mc(e){return gt(function(t,r){var n=null,o=!1,i;n=t.subscribe(At(r,void 0,void 0,function(a){i=Ct(e(a,Mc(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 ap(e,t){return Oe(t)?Zt(e,t,1):Zt(e,1)}d();c();l();u();function By(e){return gt(function(t,r){var n=!1;t.subscribe(At(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function gi(e){return gt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function Gy(e,t){return gt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(At(n,function(f){o?.unsubscribe();var m=0,h=i++;Ct(e(f,h)).subscribe(o=At(n,function(A){return n.next(t?t(f,A,h,m++):A)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function sp(e){return gt(function(t,r){Ct(e).subscribe(At(r,function(){return r.complete()},qc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function $y(e,t,r){var n=Oe(e)||t||r?{next:e,error:t,complete:r}:e;return n?gt(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var p=!0;o.subscribe(At(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)}))}):Wa}d();c();l();u();d();c();l();u();function OR(e){return` \r
35
+ `.indexOf(e)>=0}function cp(e){for(var t=["topLevel"],r=0,n,o,i,a=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,i=E)},m=function(E){E===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},A=function(){return r--},S=function(E){if("0"<=E&&E<="9"){a("number");return}switch(E){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 C=e[r];switch(t[t.length-1]){case"topLevel":S(C);break;case"string":switch(C){case"\"":h();break;case"\\":f("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":C==="u"?a("stringUnicode"):(m("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),h());break;case"number":C==="."?p("numberNeedsDigit"):C==="e"||C==="E"?p("numberNeedsExponent"):(C<"0"||C>"9")&&(A(),h());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(C==="+"||C==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(C<"a"||C>"z")&&(A(),h());break;case"arrayNeedsValue":C==="]"?h():OR(C)||(m("collectionItem"),p("arrayNeedsComma"),S(C));break;case"arrayNeedsComma":C==="]"?h():C===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":C==="}"?h():C==="\""&&(f("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":C===":"&&p("objectNeedsValue");break;case"objectNeedsValue":OR(C)||(m("collectionItem"),p("objectNeedsComma"),S(C));break;case"objectNeedsComma":C==="}"?h():C===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(E){return x.push(E.slice(e.length-e.lastIndexOf(E[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 NR(){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 lp(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 up=4294967296;function Hy(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>=up&&(o=o+(n/up|0),n=n%up)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?DR(n,o):Wy(n,o)}function qR(e,t){let r=Wy(e,t),n=r.hi&2147483648;n&&(r=DR(r.lo,r.hi));let o=zy(r.lo,r.hi);return n?"-"+o:o}function zy(e,t){if({lo:e,hi:t}=uj(e,t),t<=2097151)return String(up*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()+_R(a)+_R(i)}function uj(e,t){return{lo:e>>>0,hi:t>>>0}}function Wy(e,t){return{lo:e|0,hi:t|0}}function DR(e,t){return t=~t,e?e=~e+1:t+=1,Wy(e,t)}var _R=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Yy(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 MR(){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 Er=lj();function lj(){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()),jR(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),VR(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),jR(r),Hy(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),VR(r),Hy(r)},dec(r,n){return qR(r,n)},uDec(r,n){return zy(r,n)}}}function jR(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function VR(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var Ky=Symbol.for("@bufbuild/protobuf/text-encoding");function Xy(){if(y[Ky]==null){let e=new y.TextEncoder,t=new y.TextDecoder;y[Ky]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return y[Ky]}var oo;(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"})(oo||(oo={}));var dj=34028234663852886e22,pj=-34028234663852886e22,fj=4294967295,mj=2147483647,gj=-2147483648,Ue=class{constructor(t=Xy().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(LR(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Jy(t),Yy(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){hj(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){LR(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Jy(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Jy(t),t=(t<<1^t>>31)>>>0,Yy(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Er.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=Er.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Er.enc(t);return lp(r.lo,r.hi,this.buf),this}sint64(t){let r=Er.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return lp(o,i,this.buf),this}uint64(t){let r=Er.uEnc(t);return lp(r.lo,r.hi,this.buf),this}},me=class{constructor(t,r=Xy().decodeUtf8){this.decodeUtf8=r,this.varint64=NR,this.uint32=MR,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 oo.Varint:for(;this.buf[this.pos++]&128;);break;case oo.Bit64:this.pos+=4;case oo.Bit32:this.pos+=4;break;case oo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case oo.StartGroup:for(;;){let[i,a]=this.tag();if(a===oo.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 Er.dec(...this.varint64())}uint64(){return Er.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Er.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 Er.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Er.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 Jy(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>mj||e<gj)throw new Error("invalid int32: "+e)}function LR(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>fj||e<0)throw new Error("invalid uint32: "+e)}function hj(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>dj||e<pj))throw new Error("invalid float32: "+e)}var yj=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Zy(){return{fields:{}}}var jc={encode(e,t=new Ue){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&rS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=Zy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=rS.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 jc.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Zy();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 UR(){return{key:"",value:void 0}}var rS={encode(e,t=new Ue){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Me.encode(Me.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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.key=r.string();continue;case 2:if(i!==18)break;o.value=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return rS.fromPartial(e??{})},fromPartial(e){let t=UR();return t.key=e.key??"",t.value=e.value??void 0,t}};function eS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Me={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&&jc.encode(jc.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vc.encode(Vc.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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!==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=jc.unwrap(jc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Vc.unwrap(Vc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=eS();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=eS();if(e===null)t.nullValue=yj.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 Vc={encode(e,t=new Ue){for(let r of e.values)Me.encode(Me.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(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(Me.unwrap(Me.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vc.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}},Sj=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 QR(){return{op:0,path:"",from:void 0,value:void 0}}var dp={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&&Me.encode(Me.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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.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=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dp.fromPartial(e??{})},fromPartial(e){let t=QR();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function BR(){return{id:"",type:"",function:void 0}}var pp={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&&fp.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=fp.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pp.fromPartial(e??{})},fromPartial(e){let t=BR();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?fp.fromPartial(e.function):void 0,t}};function GR(){return{name:"",arguments:""}}var fp={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 me?e:new me(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.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 fp.fromPartial(e??{})},fromPartial(e){let t=GR();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function $R(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var mp={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)pp.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 me?e:new me(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.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(pp.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 mp.fromPartial(e??{})},fromPartial(e){let t=$R();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=>pp.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},vj=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 HR(){return{type:0,timestamp:void 0,rawEvent:void 0}}var he={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&&Me.encode(Me.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Aj(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=HR();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function zR(){return{baseEvent:void 0,messageId:"",role:void 0}}var gp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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=zR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function WR(){return{baseEvent:void 0,messageId:"",delta:""}}var hp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 hp.fromPartial(e??{})},fromPartial(e){let t=WR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function YR(){return{baseEvent:void 0,messageId:""}}var yp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 yp.fromPartial(e??{})},fromPartial(e){let t=YR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function KR(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Sp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 Sp.fromPartial(e??{})},fromPartial(e){let t=KR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function XR(){return{baseEvent:void 0,toolCallId:"",delta:""}}var vp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(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=he.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 vp.fromPartial(e??{})},fromPartial(e){let t=XR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function JR(){return{baseEvent:void 0,toolCallId:""}}var Ap={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof me?e:new me(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=he.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 Ap.fromPartial(e??{})},fromPartial(e){let t=JR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function ZR(){return{baseEvent:void 0,snapshot:void 0}}var Cp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Me.encode(Me.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(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=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cp.fromPartial(e??{})},fromPartial(e){let t=ZR();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function ew(){return{baseEvent:void 0,delta:[]}}var bp={encode(e,t=new Ue){e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)dp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=ew();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(dp.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bp.fromPartial(e??{})},fromPartial(e){let t=ew();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>dp.fromPartial(r))||[],t}};function tw(){return{baseEvent:void 0,messages:[]}}var xp={encode(e,t=new Ue){e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)mp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=tw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(mp.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=tw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>mp.fromPartial(r))||[],t}};function rw(){return{baseEvent:void 0,event:void 0,source:void 0}}var Rp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Me.encode(Me.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=rw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=Me.unwrap(Me.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 Rp.fromPartial(e??{})},fromPartial(e){let t=rw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function nw(){return{baseEvent:void 0,name:"",value:void 0}}var wp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Me.encode(Me.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=nw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wp.fromPartial(e??{})},fromPartial(e){let t=nw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function ow(){return{baseEvent:void 0,threadId:"",runId:""}}var Ip={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=ow();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Ip.fromPartial(e??{})},fromPartial(e){let t=ow();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function iw(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Ep={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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&&Me.encode(Me.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=iw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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=Me.unwrap(Me.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ep.fromPartial(e??{})},fromPartial(e){let t=iw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function aw(){return{baseEvent:void 0,code:void 0,message:""}}var Fp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=aw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Fp.fromPartial(e??{})},fromPartial(e){let t=aw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function sw(){return{baseEvent:void 0,stepName:""}}var Tp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=sw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Tp.fromPartial(e??{})},fromPartial(e){let t=sw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function cw(){return{baseEvent:void 0,stepName:""}}var Pp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=cw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Pp.fromPartial(e??{})},fromPartial(e){let t=cw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function uw(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var kp={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=uw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 kp.fromPartial(e??{})},fromPartial(e){let t=uw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 lw(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Op={encode(e,t=new Ue){return e.baseEvent!==void 0&&he.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 me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=lw();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=he.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 Op.fromPartial(e??{})},fromPartial(e){let t=lw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?he.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 dw(){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 pw={encode(e,t=new Ue){return e.textMessageStart!==void 0&&gp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&hp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&yp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Sp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&vp.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ap.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Cp.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&bp.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&xp.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Rp.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&wp.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Ip.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ep.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Fp.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Tp.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Pp.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&kp.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Op.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof me?e:new me(e),n=t===void 0?r.len:r.pos+t,o=dw();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=hp.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=yp.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Sp.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=vp.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Ap.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Cp.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=bp.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=xp.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Rp.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=wp.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Ip.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Ep.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Fp.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Tp.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Pp.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=kp.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Op.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pw.fromPartial(e??{})},fromPartial(e){let t=dw();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?hp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?yp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Sp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?vp.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ap.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Cp.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?bp.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?xp.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Rp.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?wp.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Ip.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ep.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Fp.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Tp.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Pp.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?kp.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Op.fromPartial(e.toolCallChunk):void 0,t}};function Aj(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 fw(e){let t=pw.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=vj[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===D.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===D.STATE_DELTA)for(let n of r.delta)n.op=Sj[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]}),kd.parse(r)}var mw="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var bj=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,nS=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(bj);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},gw=e=>e==="*"||e==="x"||e==="X",hw=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},xj=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Rj=(e,t)=>{if(gw(e)||gw(t))return 0;let[r,n]=xj(hw(e),hw(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=Rj(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var _p=(e,t)=>{let r=nS(e),n=nS(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 Je=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Lc(){return Jn()}function ze(_x193,_x194,_x195,_x196){return _ze.apply(this,arguments)}function _ze(){_ze=_asyncToGenerator(function*(e,t,r,n){let o=t,i=r,a;for(let p of e)try{let f=yield n(p,Je(o),Je(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 _ze.apply(this,arguments)}var bw=(e,t,r,n)=>{let o=Je(r.messages),i=Je(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=Je(a);return a={},m.messages!==void 0||m.state!==void 0?ct(m):Hd};return t.pipe(ap(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(m){let h=yield ze(n,o,i,(A,S,g)=>A.onEvent?.({event:m,agent:r,input:e,messages:S,state:g}));if(p(h),h.stopPropagation===!0)return f();switch(m.type){case D.TEXT_MESSAGE_START:{let A=yield ze(n,o,i,(S,g,C)=>S.onTextMessageStartEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=m;if(!o.find(C=>C.id===S)){let C={id:S,role:g,content:""};o.push(C),p({messages:o})}}return f()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:A,delta:S}=m,g=o.find(x=>x.id===A);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${A}'`),f();let C=yield ze(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(C),C.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,p({messages:o})),f()}case D.TEXT_MESSAGE_END:{let{messageId:A}=m,S=o.find(g=>g.id===A);return S?(p(yield ze(n,o,i,(g,C,x)=>g.onTextMessageEndEvent?.({event:m,messages:C,state:x,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${A}'`),f())}case D.TOOL_CALL_START:{let A=yield ze(n,o,i,(S,g,C)=>S.onToolCallStartEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:C}=m,x;C&&o.length>0&&o[o.length-1].id===C?x=o[o.length-1]:(x={id:C||S,role:"assistant",toolCalls:[]},o.push(x)),x.toolCalls??(x.toolCalls=[]),x.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),p({messages:o})}return f()}case D.TOOL_CALL_ARGS:{let{toolCallId:A,delta:S}=m,g=o.find(w=>w.toolCalls?.some(R=>R.id===A));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${A}'`),f();let C=g.toolCalls?.find(w=>w.id===A);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${A}'`),f();let x=yield ze(n,o,i,(w,R,E)=>{let F=C.function.arguments,P=C.function.name,V={};try{V=cp(F)}catch{}return w.onToolCallArgsEvent?.({event:m,messages:R,state:E,agent:r,input:e,toolCallBuffer:F,toolCallName:P,partialToolCallArgs:V})});return p(x),x.stopPropagation!==!0&&(C.function.arguments+=S,p({messages:o})),f()}case D.TOOL_CALL_END:{let{toolCallId:A}=m,S=o.find(C=>C.toolCalls?.some(x=>x.id===A));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${A}'`),f();let g=S.toolCalls?.find(C=>C.id===A);return g?(p(yield ze(n,o,i,(C,x,w)=>{let R=g.function.arguments,E=g.function.name,F={};try{F=JSON.parse(R)}catch{}return C.onToolCallEndEvent?.({event:m,messages:x,state:w,agent:r,input:e,toolCallName:E,toolCallArgs:F})})),yield Promise.all(n.map(C=>{C.onNewToolCall?.({toolCall:g,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${A}'`),f())}case D.TOOL_CALL_RESULT:{let A=yield ze(n,o,i,(S,g,C)=>S.onToolCallResultEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:C,role:x}=m,w={id:S,toolCallId:g,role:x||"tool",content:C};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 D.STATE_SNAPSHOT:{let A=yield ze(n,o,i,(S,g,C)=>S.onStateSnapshotEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{snapshot:S}=m;i=S,p({state:i})}return f()}case D.STATE_DELTA:{let A=yield ze(n,o,i,(S,g,C)=>S.onStateDeltaEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{delta:S}=m;try{i=no(i,S,!0,!1).newDocument,p({state:i})}catch(g){let C=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
36
36
  Current state: ${JSON.stringify(i,null,2)}
37
- Patch operations: ${JSON.stringify(C,null,2)}
38
- Error: ${S}`)}}return f()}case D.MESSAGES_SNAPSHOT:{let v=yield ze(n,o,i,(C,g,S)=>C.onMessagesSnapshotEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{messages:C}=m;o=C,p({messages:o})}return f()}case D.ACTIVITY_SNAPSHOT:{let v=m,C=o.findIndex(R=>R.id===v.messageId),g=C>=0?o[C]:void 0,S=g?.role==="activity"?g:void 0,x=v.replace??!0,w=yield ze(n,o,i,(R,I,E)=>R.onActivitySnapshotEvent?.({event:v,messages:I,state:E,agent:r,input:e,activityMessage:S,existingMessage:g}));if(p(w),w.stopPropagation!==!0){let R={id:v.messageId,role:"activity",activityType:v.activityType,content:Xe(v.content)},I;C===-1?(o.push(R),I=R):S?x&&(o[C]={...S,activityType:v.activityType,content:Xe(v.content)}):x&&(o[C]=R,I=R),p({messages:o}),I&&(yield Promise.all(n.map(E=>E.onNewMessage?.({message:I,messages:o,state:i,agent:r,input:e}))))}return f()}case D.ACTIVITY_DELTA:{let v=m,C=o.findIndex(w=>w.id===v.messageId);if(C===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),f();let g=o[C];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),f();let S=g,x=yield ze(n,o,i,(w,R,I)=>w.onActivityDeltaEvent?.({event:v,messages:R,state:I,agent:r,input:e,activityMessage:S}));if(p(x),x.stopPropagation!==!0)try{let w=Xe(S.content??{}),R=no(w,v.patch??[],!0,!1).newDocument;o[C]={...S,content:Xe(R),activityType:v.activityType},p({messages:o})}catch(w){let R=w instanceof Error?w.message:String(w);console.warn(`Failed to apply activity patch for '${v.messageId}': ${R}`)}return f()}case D.RAW:return p(yield ze(n,o,i,(v,C,g)=>v.onRawEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.CUSTOM:return p(yield ze(n,o,i,(v,C,g)=>v.onCustomEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.RUN_STARTED:{let v=yield ze(n,o,i,(C,g,S)=>C.onRunStartedEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let C=m;if(C.input?.messages){for(let g of C.input.messages)o.find(S=>S.id===g.id)||o.push(g);p({messages:o})}}return f()}case D.RUN_FINISHED:return p(yield ze(n,o,i,(v,C,g)=>v.onRunFinishedEvent?.({event:m,messages:C,state:g,agent:r,input:e,result:m.result}))),f();case D.RUN_ERROR:return p(yield ze(n,o,i,(v,C,g)=>v.onRunErrorEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.STEP_STARTED:return p(yield ze(n,o,i,(v,C,g)=>v.onStepStartedEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.STEP_FINISHED:return p(yield ze(n,o,i,(v,C,g)=>v.onStepFinishedEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return f();case D.THINKING_END:return f();case D.THINKING_TEXT_MESSAGE_START:return f();case D.THINKING_TEXT_MESSAGE_CONTENT:return f();case D.THINKING_TEXT_MESSAGE_END:return f();case D.REASONING_START:return p(yield ze(n,o,i,(v,C,g)=>v.onReasoningStartEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.REASONING_MESSAGE_START:{let v=yield ze(n,o,i,(C,g,S)=>C.onReasoningMessageStartEvent?.({event:m,messages:g,state:S,agent:r,input:e}));if(p(v),v.stopPropagation!==!0){let{messageId:C}=m;if(!o.find(g=>g.id===C)){let g={id:C,role:"reasoning",content:""};o.push(g),p({messages:o})}}return f()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:C}=m,g=o.find(x=>x.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),f();let S=yield ze(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:""}${C}`,p({messages:o})),f()}case D.REASONING_MESSAGE_END:{let{messageId:v}=m,C=o.find(g=>g.id===v);return C?(p(yield ze(n,o,i,(g,S,x)=>g.onReasoningMessageEndEvent?.({event:m,messages:S,state:x,agent:r,input:e,reasoningMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:C,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),f())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return p(yield ze(n,o,i,(v,C,g)=>v.onReasoningEndEvent?.({event:m,messages:C,state:g,agent:r,input:e}))),f();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:C,encryptedValue:g}=m,S=yield ze(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(v==="tool-call"){for(let w of o)if(w.role==="assistant"&&w.toolCalls){let R=w.toolCalls.find(I=>I.id===C);if(R){R.encryptedValue=g,x=!0;break}}}else{let w=o.find(R=>R.id===C);w?.role!=="activity"&&w&&(w.encryptedValue=g,x=!0)}x&&(a.messages=o)}return f()}}return m.type,f()});return function(_x191){return _ref73.apply(this,arguments)}}()),Oy(),n.length>0?Ny({}):m=>m)},Ky=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,p=new Map,f=!1,m=!1,h=!1,v=()=>{r.clear(),n.clear(),p.clear(),f=!1,m=!1,o=!1,i=!1,h=!0};return t.pipe(Zt(C=>{let g=C.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(C)),i)return nt(()=>new st(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==D.RUN_ERROR&&g!==D.RUN_STARTED)return nt(()=>new st(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===D.RUN_STARTED){if(h&&!o)return nt(()=>new st("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&&v()}}else if(a=!0,g!==D.RUN_STARTED&&g!==D.RUN_ERROR)return nt(()=>new st("First event must be 'RUN_STARTED'"));switch(g){case D.TEXT_MESSAGE_START:{let S=C.messageId;return r.has(S)?nt(()=>new st(`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),ct(C))}case D.TEXT_MESSAGE_CONTENT:{let S=C.messageId;return r.has(S)?ct(C):nt(()=>new st(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${S}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let S=C.messageId;return r.has(S)?(r.delete(S),ct(C)):nt(()=>new st(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${S}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let S=C.toolCallId;return n.has(S)?nt(()=>new st(`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),ct(C))}case D.TOOL_CALL_ARGS:{let S=C.toolCallId;return n.has(S)?ct(C):nt(()=>new st(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${S}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let S=C.toolCallId;return n.has(S)?(n.delete(S),ct(C)):nt(()=>new st(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${S}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let S=C.stepName;return p.has(S)?nt(()=>new st(`Step "${S}" is already active for 'STEP_STARTED'`)):(p.set(S,!0),ct(C))}case D.STEP_FINISHED:{let S=C.stepName;return p.has(S)?(p.delete(S),ct(C)):nt(()=>new st(`Cannot send 'STEP_FINISHED' for step "${S}" that was not started`))}case D.RUN_STARTED:return h=!0,ct(C);case D.RUN_FINISHED:if(p.size>0){let S=Array.from(p.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while steps are still active: ${S}`))}if(r.size>0){let S=Array.from(r.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while text messages are still active: ${S}`))}if(n.size>0){let S=Array.from(n.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${S}`))}return o=!0,ct(C);case D.RUN_ERROR:return i=!0,ct(C);case D.CUSTOM:return ct(C);case D.THINKING_TEXT_MESSAGE_START:return f?m?nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(m=!0,ct(C)):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return m?ct(C):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return m?(m=!1,ct(C)):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return f?nt(()=>new st("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(f=!0,ct(C));case D.THINKING_END:return f?(f=!1,ct(C)):nt(()=>new st("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return ct(C)}}))},hi=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),wj=(e,t)=>_y(()=>fi(A(e,t))).pipe(qy(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return fi(r.text()).pipe(Zt(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,nt(()=>f)}))}let n={type:hi.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new rt(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:p}=yield o.read();if(a)break;let f={type:hi.DATA,data:p};i.next(f)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):nt(()=>Error("Failed to getReader() from response"))})),Ij=e=>{let t=new Jr,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==hi.HEADERS&&i.type===hi.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(`
37
+ Patch operations: ${JSON.stringify(S,null,2)}
38
+ Error: ${C}`)}}return f()}case D.MESSAGES_SNAPSHOT:{let A=yield ze(n,o,i,(S,g,C)=>S.onMessagesSnapshotEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{messages:S}=m;o=S,p({messages:o})}return f()}case D.ACTIVITY_SNAPSHOT:{let A=m,S=o.findIndex(R=>R.id===A.messageId),g=S>=0?o[S]:void 0,C=g?.role==="activity"?g:void 0,x=A.replace??!0,w=yield ze(n,o,i,(R,E,F)=>R.onActivitySnapshotEvent?.({event:A,messages:E,state:F,agent:r,input:e,activityMessage:C,existingMessage:g}));if(p(w),w.stopPropagation!==!0){let R={id:A.messageId,role:"activity",activityType:A.activityType,content:Je(A.content)},E;S===-1?(o.push(R),E=R):C?x&&(o[S]={...C,activityType:A.activityType,content:Je(A.content)}):x&&(o[S]=R,E=R),p({messages:o}),E&&(yield Promise.all(n.map(F=>F.onNewMessage?.({message:E,messages:o,state:i,agent:r,input:e}))))}return f()}case D.ACTIVITY_DELTA:{let A=m,S=o.findIndex(w=>w.id===A.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${A.messageId}' to apply patch`),f();let g=o[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${A.messageId}' is not an activity message`),f();let C=g,x=yield ze(n,o,i,(w,R,E)=>w.onActivityDeltaEvent?.({event:A,messages:R,state:E,agent:r,input:e,activityMessage:C}));if(p(x),x.stopPropagation!==!0)try{let w=Je(C.content??{}),R=no(w,A.patch??[],!0,!1).newDocument;o[S]={...C,content:Je(R),activityType:A.activityType},p({messages:o})}catch(w){let R=w instanceof Error?w.message:String(w);console.warn(`Failed to apply activity patch for '${A.messageId}': ${R}`)}return f()}case D.RAW:return p(yield ze(n,o,i,(A,S,g)=>A.onRawEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.CUSTOM:return p(yield ze(n,o,i,(A,S,g)=>A.onCustomEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.RUN_STARTED:{let A=yield ze(n,o,i,(S,g,C)=>S.onRunStartedEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let S=m;if(S.input?.messages){for(let g of S.input.messages)o.find(C=>C.id===g.id)||o.push(g);p({messages:o})}}return f()}case D.RUN_FINISHED:return p(yield ze(n,o,i,(A,S,g)=>A.onRunFinishedEvent?.({event:m,messages:S,state:g,agent:r,input:e,result:m.result}))),f();case D.RUN_ERROR:return p(yield ze(n,o,i,(A,S,g)=>A.onRunErrorEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.STEP_STARTED:return p(yield ze(n,o,i,(A,S,g)=>A.onStepStartedEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.STEP_FINISHED:return p(yield ze(n,o,i,(A,S,g)=>A.onStepFinishedEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case D.THINKING_START:return f();case D.THINKING_END:return f();case D.THINKING_TEXT_MESSAGE_START:return f();case D.THINKING_TEXT_MESSAGE_CONTENT:return f();case D.THINKING_TEXT_MESSAGE_END:return f();case D.REASONING_START:return p(yield ze(n,o,i,(A,S,g)=>A.onReasoningStartEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.REASONING_MESSAGE_START:{let A=yield ze(n,o,i,(S,g,C)=>S.onReasoningMessageStartEvent?.({event:m,messages:g,state:C,agent:r,input:e}));if(p(A),A.stopPropagation!==!0){let{messageId:S}=m;if(!o.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};o.push(g),p({messages:o})}}return f()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:A,delta:S}=m,g=o.find(x=>x.id===A);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${A}'`),f();let C=yield ze(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(C),C.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,p({messages:o})),f()}case D.REASONING_MESSAGE_END:{let{messageId:A}=m,S=o.find(g=>g.id===A);return S?(p(yield ze(n,o,i,(g,C,x)=>g.onReasoningMessageEndEvent?.({event:m,messages:C,state:x,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),f()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${A}'`),f())}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return p(yield ze(n,o,i,(A,S,g)=>A.onReasoningEndEvent?.({event:m,messages:S,state:g,agent:r,input:e}))),f();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:A,entityId:S,encryptedValue:g}=m,C=yield ze(n,o,i,(x,w,R)=>x.onReasoningEncryptedValueEvent?.({event:m,messages:w,state:R,agent:r,input:e}));if(p(C),C.stopPropagation!==!0){let x=!1;if(A==="tool-call"){for(let w of o)if(w.role==="assistant"&&w.toolCalls){let R=w.toolCalls.find(E=>E.id===S);if(R){R.encryptedValue=g,x=!0;break}}}else{let w=o.find(R=>R.id===S);w?.role!=="activity"&&w&&(w.encryptedValue=g,x=!0)}x&&(a.messages=o)}return f()}}return m.type,f()});return function(_x197){return _ref76.apply(this,arguments)}}()),Uy(),n.length>0?By({}):m=>m)},iS=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,p=new Map,f=!1,m=!1,h=!1,A=()=>{r.clear(),n.clear(),p.clear(),f=!1,m=!1,o=!1,i=!1,h=!0};return t.pipe(Zt(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),i)return nt(()=>new st(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==D.RUN_ERROR&&g!==D.RUN_STARTED)return nt(()=>new st(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===D.RUN_STARTED){if(h&&!o)return nt(()=>new st("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&&A()}}else if(a=!0,g!==D.RUN_STARTED&&g!==D.RUN_ERROR)return nt(()=>new st("First event must be 'RUN_STARTED'"));switch(g){case D.TEXT_MESSAGE_START:{let C=S.messageId;return r.has(C)?nt(()=>new st(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${C}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(C,!0),ct(S))}case D.TEXT_MESSAGE_CONTENT:{let C=S.messageId;return r.has(C)?ct(S):nt(()=>new st(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${C}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case D.TEXT_MESSAGE_END:{let C=S.messageId;return r.has(C)?(r.delete(C),ct(S)):nt(()=>new st(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${C}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case D.TOOL_CALL_START:{let C=S.toolCallId;return n.has(C)?nt(()=>new st(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${C}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(C,!0),ct(S))}case D.TOOL_CALL_ARGS:{let C=S.toolCallId;return n.has(C)?ct(S):nt(()=>new st(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${C}'. Start a tool call with 'TOOL_CALL_START' first.`))}case D.TOOL_CALL_END:{let C=S.toolCallId;return n.has(C)?(n.delete(C),ct(S)):nt(()=>new st(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${C}'. A 'TOOL_CALL_START' event must be sent first.`))}case D.STEP_STARTED:{let C=S.stepName;return p.has(C)?nt(()=>new st(`Step "${C}" is already active for 'STEP_STARTED'`)):(p.set(C,!0),ct(S))}case D.STEP_FINISHED:{let C=S.stepName;return p.has(C)?(p.delete(C),ct(S)):nt(()=>new st(`Cannot send 'STEP_FINISHED' for step "${C}" that was not started`))}case D.RUN_STARTED:return h=!0,ct(S);case D.RUN_FINISHED:if(p.size>0){let C=Array.from(p.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while steps are still active: ${C}`))}if(r.size>0){let C=Array.from(r.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while text messages are still active: ${C}`))}if(n.size>0){let C=Array.from(n.keys()).join(", ");return nt(()=>new st(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${C}`))}return o=!0,ct(S);case D.RUN_ERROR:return i=!0,ct(S);case D.CUSTOM:return ct(S);case D.THINKING_TEXT_MESSAGE_START:return f?m?nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(m=!0,ct(S)):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return m?ct(S):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return m?(m=!1,ct(S)):nt(()=>new st("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return f?nt(()=>new st("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(f=!0,ct(S));case D.THINKING_END:return f?(f=!1,ct(S)):nt(()=>new st("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return ct(S)}}))},hi=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),wj=(e,t)=>Qy(()=>fi(v(e,t))).pipe(Gy(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return fi(r.text()).pipe(Zt(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,nt(()=>f)}))}let n={type:hi.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new rt(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:p}=yield o.read();if(a)break;let f={type:hi.DATA,data:p};i.next(f)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):nt(()=>Error("Failed to getReader() from response"))})),Ij=e=>{let t=new Xr,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==hi.HEADERS&&i.type===hi.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
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()},Ej=e=>{let t=new Jr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==hi.HEADERS&&o.type===hi.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=nw(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()},Fj=e=>{let t=new Jr,r=new Ud,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===hi.HEADERS&&!n?(n=!0,o.headers.get("content-type")===ow?Ej(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):Ij(r).subscribe({next:i=>{try{let a=Ed.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:D.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()},et=F.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Tj=F.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Pj=F.object({type:F.literal(et.enum.TextMessageStart),messageId:F.string(),parentMessageId:F.string().optional(),role:F.string().optional()}),kj=F.object({type:F.literal(et.enum.TextMessageContent),messageId:F.string(),content:F.string()}),Oj=F.object({type:F.literal(et.enum.TextMessageEnd),messageId:F.string()}),_j=F.object({type:F.literal(et.enum.ActionExecutionStart),actionExecutionId:F.string(),actionName:F.string(),parentMessageId:F.string().optional()}),Nj=F.object({type:F.literal(et.enum.ActionExecutionArgs),actionExecutionId:F.string(),args:F.string()}),qj=F.object({type:F.literal(et.enum.ActionExecutionEnd),actionExecutionId:F.string()}),Dj=F.object({type:F.literal(et.enum.ActionExecutionResult),actionName:F.string(),actionExecutionId:F.string(),result:F.string()}),Mj=F.object({type:F.literal(et.enum.AgentStateMessage),threadId:F.string(),agentName:F.string(),nodeName:F.string(),runId:F.string(),active:F.boolean(),role:F.string(),state:F.string(),running:F.boolean()}),jj=F.object({type:F.literal(et.enum.MetaEvent),name:Tj,value:F.any()}),Vj=F.object({type:F.literal(et.enum.RunError),message:F.string(),code:F.string().optional()});F.discriminatedUnion("type",[Pj,kj,Oj,_j,Nj,qj,Dj,Mj,jj,Vj]),F.object({id:F.string(),role:F.string(),content:F.string(),parentMessageId:F.string().optional()}),F.object({id:F.string(),name:F.string(),arguments:F.any(),parentMessageId:F.string().optional()}),F.object({id:F.string(),result:F.any(),actionExecutionId:F.string(),actionName:F.string()});var Lj=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
- `)},Uj=(e,t,r)=>n=>{let o={},i=!0,a=!0,p="",f=null,m=null,h=[],v={},C=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(Zt(g=>{switch(g.type){case D.TEXT_MESSAGE_START:{let S=g;return[{type:et.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case D.TEXT_MESSAGE_CONTENT:{let S=g;return[{type:et.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case D.TEXT_MESSAGE_END:{let S=g;return[{type:et.enum.TextMessageEnd,messageId:S.messageId}]}case D.TOOL_CALL_START:{let S=g;return h.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),a=!0,v[S.toolCallId]=S.toolCallName,[{type:et.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case D.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(I=>I.tool==x.function.name);if(R)try{let I=JSON.parse(op(x.function.arguments));R.tool_argument&&R.tool_argument in I?(C({...o,[R.state_key]:I[R.tool_argument]}),w=!0):R.tool_argument||(C({...o,[R.state_key]:I}),w=!0)}catch{}}return[{type:et.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...(w?[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case D.TOOL_CALL_END:{let S=g;return[{type:et.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case D.TOOL_CALL_RESULT:{let S=g;return[{type:et.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:v[S.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let S=g;switch(S.name){case"Exit":i=!1;break;case"PredictState":m=S.value;break}return[{type:et.enum.MetaEvent,name:S.name,value:S.value}]}case D.STATE_SNAPSHOT:return C(g.snapshot),[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case D.STATE_DELTA:{let S=g,x=no(o,S.delta,!0,!1);return x?(C(x.newDocument),[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case D.MESSAGES_SNAPSHOT:return f=g.messages,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:Qj(f)}:{})}),active:!1}];case D.RUN_ERROR:{let S=g;return[{type:et.enum.RunError,message:S.message,code:S.code}]}case D.STEP_STARTED:return p=g.stepName,h=[],m=null,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return h=[],m=null,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Qj(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Lj(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 Pp=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:D.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:D.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:D.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(Zt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...m(),h];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[h];case D.TEXT_MESSAGE_CHUNK:let v=h,C=[];if((i!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&C.push(...m()),i!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},i="text";let R={type:D.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};C.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(R))}if(v.delta!==void 0){let R={type:D.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};C.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(R))}return C;case D.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:D.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:D.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 D.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:D.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:D.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,[]}),gi(()=>{m()}))},Jy=class{runNext(e,t){return t.run(e).pipe(Pp(!1))}runNextWithState(e,t){let r=Xe(e.messages||[]),n=Xe(e.state||{}),o=new Ud;return pw(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(rp(/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Xe(r),state:Xe(n)}});return function(_x192){return _ref75.apply(this,arguments)}}()))}},Bj=class extends Jy{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Gj(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 $j=class extends Jy{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Gj)};return this.runNext(o,t)}},sw="THINKING_START",cw="THINKING_END",uw="THINKING_TEXT_MESSAGE_START",lw="THINKING_TEXT_MESSAGE_CONTENT",dw="THINKING_TEXT_MESSAGE_END",Hj=class extends Jy{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(mi(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case sw:{this.currentReasoningId=Lc();let{title:t,...r}=e;return this.warnAboutTransformation(sw,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case uw:return this.currentMessageId=Lc(),this.warnAboutTransformation(uw,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case lw:{let{delta:t,...r}=e;return this.warnAboutTransformation(lw,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Lc(),delta:t}}case dw:{let t=this.currentMessageId??Lc();return this.warnAboutTransformation(dw,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case cw:{let t=this.currentReasoningId??Lc();return this.warnAboutTransformation(cw,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}},zj="0.0.45",Wj=class{get maxVersion(){return zj}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??Xn(),this.messages=Xe(n??[]),this.state=Xe(o??{}),this.debug=i??!1,Tp(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new $j),Tp(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Hj)}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 Bj(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??Xn();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 Jr;let a;_this35.activeRunCompletionPromise=new Promise(f=>{a=f}),yield tp(Ld(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:h=>m.run(h,f)}),_this35).run(r),Pp(_this35.debug),Ky(_this35.debug),f=>f.pipe(np(_this35.activeRunDetach$)),f=>_this35.apply(r,f,i),f=>_this35.processApplyEvents(r,f,i),Mc(f=>(_this35.isRunning=!1,_this35.onError(r,f,i))),gi(()=>{_this35.isRunning=!1,_this35.onFinalize(r,i),a?.(),a=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(ct(null)));let p=Xe(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new vy}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??Xn();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 Jr;let a;_this36.activeRunCompletionPromise=new Promise(f=>{a=f}),yield tp(Ld(()=>_this36.connect(r),Pp(_this36.debug),Ky(_this36.debug),f=>f.pipe(np(_this36.activeRunDetach$)),f=>_this36.apply(r,f,i),f=>_this36.processApplyEvents(r,f,i),Mc(f=>(_this36.isRunning=!1,f instanceof vy?Qd:_this36.onError(r,f,i))),gi(()=>{_this36.isRunning=!1,_this36.onFinalize(r,i),a?.(),a=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(ct(null)));let p=Xe(_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 pw(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(Dy(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=Xe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Xn(),tools:Xe(e?.tools??[]),context:Xe(e?.context??[]),forwardedProps:Xe(e?.forwardedProps??{}),state:Xe(this.state),messages:t}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){let r=yield ze(t,_this38.messages,_this38.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return fi(ze(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(mi(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 ze(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=Xe(this.messages),e.state=Xe(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=Xe(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=Xe(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??Xn();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(Pp(this.debug),Ky(this.debug),Uj(this.threadId,t.runId,this.agentId),r=>r.pipe(mi(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},fw=class extends Wj{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=Xe(e.headers??{})}run(e){return Fj(wj(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Xe(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 mw=(e,t,r)=>{let n=We(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 Xy=class extends fw{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},gw=(e,t,r)=>new Xy({url:`${mw(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var Yj=new L({required:!0}),hw=T("followUpAnswers/setIsEnabled",e=>_(e,new ue({required:!0}))),yw=T("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,G)),Lve=T("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:G})),Uve=T("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,G)),Qve=T("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Zl,answerId:G})),Bve=T("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new ue({required:!0}),answerId:G})),Gve=T("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new ue({required:!0}),answerId:G})),$ve=T("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:Yj,answerId:G})),Hve=T("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new re({required:!0,each:new W({values:iy})}),answerId:G})),zve=T("followUpAnswers/followUpCompleted",e=>_(e,{answerId:G,cannotAnswer:new ue({required:!1})})),Wve=T("followUpAnswers/followUpFailed",e=>_(e,{message:new L,code:new ne({min:0}),answerId:G})),Yve=T("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new L})),Kve=T("followUpAnswers/likeFollowUp",e=>_(e,{answerId:G})),Jve=T("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:G})),Xve=T("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:G})),Sw=T("followUpAnswers/resetFollowUpAnswers"),Zve=T("followUpAnswers/stepStarted",e=>_(e,{answerId:G,name:new L({required:!0,constrainTo:wa}),startedAt:new ne({min:0,required:!0})})),eAe=T("followUpAnswers/stepFinished",e=>_(e,{answerId:G,name:new L({required:!0,constrainTo:wa}),finishedAt:new ne({min:0,required:!0})}));d();c();l();u();var Kj={"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};function vw(e){return e?Kj[e]??1004:1004}var Aw=e=>({onRunStartedEvent:({event:t})=>{e(Ta(t.runId)),e($r(!1)),e(Uo(!0)),e(yw(t.threadId))},onStepStartedEvent:({event:t})=>{e(ld({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(dd({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(Qo({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e($o(n.contentFormat)),n?.followUpEnabled&&e(hw(n.followUpEnabled));return}case"citations":{e(Bo({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=vw(t.code);e(Go({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.answerGenerated??!1;e(Ec(r)),e(Ho(!r)),e(Uo(!1)),e(xa(r)),e(Ra())}});var Cw=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref80=_asyncToGenerator(function*(n,o,i){t();let a=tl(n),p=vC(n),f=AC(n),m=SC(n),h=gw(a,p,f);e=h;let v=Aw(o),C=bx(n,i());try{o($r(!0)),yield h.runAgent({forwardedProps:{params:C,accessToken:m}},v)}catch(g){o($r(!1)),o(Go({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x193,_x194,_x195){return _ref80.apply(this,arguments)}}(),abortRun:t}};var bw=e=>{let t=CA({extra:e}),r=Cw();return t.startListening({actionCreator:Fe.pending,effect:function(){var _ref81=_asyncToGenerator(function*(n,o){let i=o.getState();if(!ih(i))return;r.abortRun(),o.dispatch(ar()),o.dispatch(Sw());let a=Lo(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x196,_x197){return _ref81.apply(this,arguments)}}()}),t};d();c();l();u();var xw=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)},Rw=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var Zy=(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 ww(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=ZS(Object.entries(t).filter(([a])=>!(a in r)).map(([a,p])=>[a,()=>p]));return o(Mi({...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 Jj(e){if(!e||!Xj(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 Iw(e,t=60){if(!e)return!1;let r=Jj(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function Xj(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Fw(e,t){let r=0,n=null,o=mu(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref82=_asyncToGenerator(function*(f,m=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(C){if(!m)throw C;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&f.dispatch(ca({accessToken:v})),v});return function i(_x198){return _ref82.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref84=_asyncToGenerator(function*(f){let m=f.getState(),h=eV(m);if(!(!h||!Iw(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(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x199){return _ref84.apply(this,arguments)}}(),p=/*#__PURE__*/function(){var _ref85=_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."),Ew(f,m.error),m;r++,o(),yield i(f,!0),f.dispatch(h)});return function p(_x200,_x201,_x202){return _ref85.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref86=_asyncToGenerator(function*(h){let v=typeof h=="function",C=typeof t=="function";if(!v)return m(h);C&&(yield a(f));let g=yield m(h);return Zj(g)?C?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."),Ew(f,g.error),g):g});return function(_x203){return _ref86.apply(this,arguments)}}())}function Zj(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ni().name}function Ew(e,t){e.dispatch(Aa({status:401,statusCode:401,message:t.message,type:t.name}))}function eV(e){return e.configuration.accessToken}d();c();l();u();function Tw({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return sA({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(Rw(n.logger))})}function tV(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&XS()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function Pw(e,t){let r={...e.reducers,configuration:ve,version:Ex},n=rV({...e,reducers:r},t,ve),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(ca({accessToken:o,environment:i,organizationId:a}));let p=tV(e.configuration,n.logger);return p&&n.dispatch(ll(p)),n}function rV(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=ww({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,p={...t,get relay(){return ac(m.state,o)},get navigatorContext(){return Zy(this.relay,o)}},f=nV(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(pl())},disableAnalytics(){f.dispatch(dl())},get state(){return f.getState()},get relay(){return ac(this.state,o)},get navigatorContext(){return Zy(this.relay,o)},logger:a,store:f};return m}function nV(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=oV(e,t.logger,()=>t.navigatorContext);return Tw({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function oV(e,t,r){let{renewAccessToken:n}=e.configuration,o=Fw(t,n),i=bw({getNavigatorContext:r});return[Nx,o,xw(t),Tx].concat(zo.middleware,i.middleware,e.middlewares||[])}var iV=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
40
+ `),m=JSON.parse(f);t.next(m)}catch(f){t.error(f)}}return t.asObservable()},Ej=e=>{let t=new Xr,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==hi.HEADERS&&o.type===hi.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=fw(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()},Fj=e=>{let t=new Xr,r=new $d,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===hi.HEADERS&&!n?(n=!0,o.headers.get("content-type")===mw?Ej(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):Ij(r).subscribe({next:i=>{try{let a=kd.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:D.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()},et=I.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),Tj=I.enum(["LangGraphInterruptEvent","PredictState","Exit"]),Pj=I.object({type:I.literal(et.enum.TextMessageStart),messageId:I.string(),parentMessageId:I.string().optional(),role:I.string().optional()}),kj=I.object({type:I.literal(et.enum.TextMessageContent),messageId:I.string(),content:I.string()}),Oj=I.object({type:I.literal(et.enum.TextMessageEnd),messageId:I.string()}),_j=I.object({type:I.literal(et.enum.ActionExecutionStart),actionExecutionId:I.string(),actionName:I.string(),parentMessageId:I.string().optional()}),Nj=I.object({type:I.literal(et.enum.ActionExecutionArgs),actionExecutionId:I.string(),args:I.string()}),qj=I.object({type:I.literal(et.enum.ActionExecutionEnd),actionExecutionId:I.string()}),Dj=I.object({type:I.literal(et.enum.ActionExecutionResult),actionName:I.string(),actionExecutionId:I.string(),result:I.string()}),Mj=I.object({type:I.literal(et.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()}),jj=I.object({type:I.literal(et.enum.MetaEvent),name:Tj,value:I.any()}),Vj=I.object({type:I.literal(et.enum.RunError),message:I.string(),code:I.string().optional()});I.discriminatedUnion("type",[Pj,kj,Oj,_j,Nj,qj,Dj,Mj,jj,Vj]),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 Lj=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
+ `)},Uj=(e,t,r)=>n=>{let o={},i=!0,a=!0,p="",f=null,m=null,h=[],A={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(Zt(g=>{switch(g.type){case D.TEXT_MESSAGE_START:{let C=g;return[{type:et.enum.TextMessageStart,messageId:C.messageId,role:C.role}]}case D.TEXT_MESSAGE_CONTENT:{let C=g;return[{type:et.enum.TextMessageContent,messageId:C.messageId,content:C.delta}]}case D.TEXT_MESSAGE_END:{let C=g;return[{type:et.enum.TextMessageEnd,messageId:C.messageId}]}case D.TOOL_CALL_START:{let C=g;return h.push({id:C.toolCallId,type:"function",function:{name:C.toolCallName,arguments:""}}),a=!0,A[C.toolCallId]=C.toolCallName,[{type:et.enum.ActionExecutionStart,actionExecutionId:C.toolCallId,actionName:C.toolCallName,parentMessageId:C.parentMessageId}]}case D.TOOL_CALL_ARGS:{let C=g,x=h.find(R=>R.id===C.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${C.toolCallId}'`),[];x.function.arguments+=C.delta;let w=!1;if(m){let R=m.find(E=>E.tool==x.function.name);if(R)try{let E=JSON.parse(cp(x.function.arguments));R.tool_argument&&R.tool_argument in E?(S({...o,[R.state_key]:E[R.tool_argument]}),w=!0):R.tool_argument||(S({...o,[R.state_key]:E}),w=!0)}catch{}}return[{type:et.enum.ActionExecutionArgs,actionExecutionId:C.toolCallId,args:C.delta},...(w?[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case D.TOOL_CALL_END:{let C=g;return[{type:et.enum.ActionExecutionEnd,actionExecutionId:C.toolCallId}]}case D.TOOL_CALL_RESULT:{let C=g;return[{type:et.enum.ActionExecutionResult,actionExecutionId:C.toolCallId,result:C.content,actionName:A[C.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let C=g;switch(C.name){case"Exit":i=!1;break;case"PredictState":m=C.value;break}return[{type:et.enum.MetaEvent,name:C.name,value:C.value}]}case D.STATE_SNAPSHOT:return S(g.snapshot),[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case D.STATE_DELTA:{let C=g,x=no(o,C.delta,!0,!1);return x?(S(x.newDocument),[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case D.MESSAGES_SNAPSHOT:return f=g.messages,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(f?{messages:Qj(f)}:{})}),active:!1}];case D.RUN_ERROR:{let C=g;return[{type:et.enum.RunError,message:C.message,code:C.code}]}case D.STEP_STARTED:return p=g.stepName,h=[],m=null,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return h=[],m=null,[{type:et.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Qj(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=Lj(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 Np=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:D.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:D.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:D.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(Zt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.MESSAGES_SNAPSHOT:case D.CUSTOM:case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...m(),h];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:return[h];case D.TEXT_MESSAGE_CHUNK:let A=h,S=[];if((i!=="text"||A.messageId!==void 0&&A.messageId!==r?.messageId)&&S.push(...m()),i!=="text"){if(A.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:A.messageId},i="text";let R={type:D.TEXT_MESSAGE_START,messageId:A.messageId,role:A.role||"assistant"};S.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(R))}if(A.delta!==void 0){let R={type:D.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:A.delta};S.push(R),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(R))}return S;case D.TOOL_CALL_CHUNK:let g=h,C=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&C.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:D.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};C.push(R),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(R))}if(g.delta!==void 0){let R={type:D.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};C.push(R),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(R))}return C;case D.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:D.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:D.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,[]}),gi(()=>{m()}))},aS=class{runNext(e,t){return t.run(e).pipe(Np(!1))}runNextWithState(e,t){let r=Je(e.messages||[]),n=Je(e.state||{}),o=new $d;return bw(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ap(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Je(r),state:Je(n)}});return function(_x198){return _ref78.apply(this,arguments)}}()))}},Bj=class extends aS{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Gj(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 $j=class extends aS{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Gj)};return this.runNext(o,t)}},yw="THINKING_START",Sw="THINKING_END",vw="THINKING_TEXT_MESSAGE_START",Aw="THINKING_TEXT_MESSAGE_CONTENT",Cw="THINKING_TEXT_MESSAGE_END",Hj=class extends aS{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(mi(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case yw:{this.currentReasoningId=Lc();let{title:t,...r}=e;return this.warnAboutTransformation(yw,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case vw:return this.currentMessageId=Lc(),this.warnAboutTransformation(vw,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Aw:{let{delta:t,...r}=e;return this.warnAboutTransformation(Aw,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Lc(),delta:t}}case Cw:{let t=this.currentMessageId??Lc();return this.warnAboutTransformation(Cw,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case Sw:{let t=this.currentReasoningId??Lc();return this.warnAboutTransformation(Sw,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}},zj="0.0.45",Wj=class{get maxVersion(){return zj}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??Jn(),this.messages=Je(n??[]),this.state=Je(o??{}),this.debug=i??!1,_p(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new $j),_p(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Hj)}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 Bj(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??Jn();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 Xr;let a;_this35.activeRunCompletionPromise=new Promise(f=>{a=f}),yield ip(Gd(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:h=>m.run(h,f)}),_this35).run(r),Np(_this35.debug),iS(_this35.debug),f=>f.pipe(sp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,i),f=>_this35.processApplyEvents(r,f,i),Mc(f=>(_this35.isRunning=!1,_this35.onError(r,f,i))),gi(()=>{_this35.isRunning=!1,_this35.onFinalize(r,i),a?.(),a=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(ct(null)));let p=Je(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new Fy}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??Jn();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 Xr;let a;_this36.activeRunCompletionPromise=new Promise(f=>{a=f}),yield ip(Gd(()=>_this36.connect(r),Np(_this36.debug),iS(_this36.debug),f=>f.pipe(sp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,i),f=>_this36.processApplyEvents(r,f,i),Mc(f=>(_this36.isRunning=!1,f instanceof Fy?Hd:_this36.onError(r,f,i))),gi(()=>{_this36.isRunning=!1,_this36.onFinalize(r,i),a?.(),a=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(ct(null)));let p=Je(_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 bw(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe($y(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=Je(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Jn(),tools:Je(e?.tools??[]),context:Je(e?.context??[]),forwardedProps:Je(e?.forwardedProps??{}),state:Je(this.state),messages:t}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){let r=yield ze(t,_this38.messages,_this38.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return fi(ze(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(mi(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 ze(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=Je(this.messages),e.state=Je(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=Je(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=Je(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??Jn();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(Np(this.debug),iS(this.debug),Uj(this.threadId,t.runId,this.agentId),r=>r.pipe(mi(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},xw=class extends Wj{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=Je(e.headers??{})}run(e){return Fj(wj(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Je(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 Rw=(e,t,r)=>{let n=We(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 sS=class extends xw{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},ww=(e,t,r)=>new sS({url:`${Rw(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var Yj=new L({required:!0}),Iw=new L({required:!0,constrainTo:td}),Ew=e=>({...e,name:rd(e.name)}),Fw=T("followUpAnswers/setIsEnabled",e=>_(e,new ue({required:!0}))),Tw=T("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,G)),Nve=T("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:G})),qve=T("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,G)),Dve=T("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:nd,answerId:G})),Mve=T("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new ue({required:!0}),answerId:G})),jve=T("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new ue({required:!0}),answerId:G})),Vve=T("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:Yj,answerId:G})),Lve=T("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new re({required:!0,each:new W({values:my})}),answerId:G})),Uve=T("followUpAnswers/followUpCompleted",e=>_(e,{answerId:G,cannotAnswer:new ue({required:!1})})),Qve=T("followUpAnswers/followUpFailed",e=>_(e,{message:new L,code:new ne({min:0}),answerId:G})),Bve=T("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new L})),Gve=T("followUpAnswers/likeFollowUp",e=>_(e,{answerId:G})),$ve=T("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:G})),Hve=T("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:G})),Pw=T("followUpAnswers/resetFollowUpAnswers"),zve=T("followUpAnswers/stepStarted",e=>_(Ew(e),{answerId:G,name:Iw,startedAt:new ne({min:0,required:!0})})),Wve=T("followUpAnswers/stepFinished",e=>_(Ew(e),{answerId:G,name:Iw,finishedAt:new ne({min:0,required:!0})}));d();c();l();u();var Kj={"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 kw(e){return e?Kj[e]??1004:1004}function Xj(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 qp(e){if(e)return Xj({...e})}var Ow=e=>({onRunStartedEvent:({event:t})=>{e(Pa(t.runId)),e($r(!1)),e(Uo(!0)),e(Tw(t.threadId))},onStepStartedEvent:({event:t})=>{e(md({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(gd({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(Qo({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e($o(n.contentFormat)),n?.followUpEnabled&&e(Fw(n.followUpEnabled));return}case"citations":{e(Bo({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=kw(t.code);e(Go({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.completionReason==="ANSWERED";e(Ec(r)),e(Ho(!r)),e(Uo(!1)),e(wa(r)),e(Ia())}});var _w=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,i){t();let a=sl(n),p=LC(n),f=UC(n),m=VC(n),h=ww(a,p,f);e=h;let A=Ow(o),S=Px(n,i());try{o($r(!0)),yield h.runAgent({forwardedProps:{params:S,accessToken:m}},A)}catch(g){o($r(!1)),o(Go({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x199,_x200,_x201){return _ref83.apply(this,arguments)}}(),abortRun:t}};var Nw=e=>{let t=QA({extra:e}),r=_w();return t.startListening({actionCreator:Fe.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let i=o.getState();if(!bh(i))return;r.abortRun(),o.dispatch(ar()),o.dispatch(Pw());let a=Lo(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x202,_x203){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var qw=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)},Dw=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var cS=(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 Mw(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=sv(Object.entries(t).filter(([a])=>!(a in r)).map(([a,p])=>[a,()=>p]));return o(Li({...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 Jj(e){if(!e||!Zj(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 jw(e,t=60){if(!e)return!1;let r=Jj(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function Zj(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Lw(e,t){let r=0,n=null,o=hu(()=>{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(S){if(!m)throw S;return null}})().finally(()=>{n=null}));let A=yield n;return h&&A&&f.dispatch(da({accessToken:A})),A});return function i(_x204){return _ref85.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),h=tV(m);if(!(!h||!jw(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(A){e.warn(A,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x205){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."),Vw(f,m.error),m;r++,o(),yield i(f,!0),f.dispatch(h)});return function p(_x206,_x207,_x208){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(h){let A=typeof h=="function",S=typeof t=="function";if(!A)return m(h);S&&(yield a(f));let g=yield m(h);return eV(g)?S?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."),Vw(f,g.error),g):g});return function(_x209){return _ref89.apply(this,arguments)}}())}function eV(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Di().name}function Vw(e,t){e.dispatch(ba({status:401,statusCode:401,message:t.message,type:t.name}))}function tV(e){return e.configuration.accessToken}d();c();l();u();function Uw({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return FA({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(Dw(n.logger))})}function rV(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&av()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function Qw(e,t){let r={...e.reducers,configuration:ve,version:Mx},n=nV({...e,reducers:r},t,ve),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(da({accessToken:o,environment:i,organizationId:a}));let p=rV(e.configuration,n.logger);return p&&n.dispatch(hl(p)),n}function nV(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Mw({...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 cS(this.relay,o)}},f=oV(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(Sl())},disableAnalytics(){f.dispatch(yl())},get state(){return f.getState()},get relay(){return cc(this.state,o)},get navigatorContext(){return cS(this.relay,o)},logger:a,store:f};return m}function oV(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=iV(e,t.logger,()=>t.navigatorContext);return Uw({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function iV(e,t,r){let{renewAccessToken:n}=e.configuration,o=Lw(t,n),i=Nw({getNavigatorContext:r});return[Gx,o,qw(t),Vx].concat(zo.middleware,i.middleware,e.middlewares||[])}var aV=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
42
42
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
43
43
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
44
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function kp(e){e==="next"&&console.warn(iV)}d();c();l();u();var Vw=Cr(jw(),1);function Lw(e){return(0,Vw.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function Uw(e,t){let r=xV(e),n=ur,o=RV(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function xV(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function RV(e){return e.preprocessRequest||yu}d();c();l();u();d();c();l();u();var Qw={organizationId:G,accessToken:G,name:new L({required:!1,emptyAllowed:!1}),analytics:new W({options:{required:!1},values:{enabled:new ue({required:!1}),originContext:new L({required:!1}),originLevel2:new L({required:!1}),originLevel3:new L({required:!1}),analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new L({required:!1,url:!0}),trackingId:new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new L({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function Bw(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var Gw=new Ee({...Qw,insightId:G,search:new W({options:{required:!1},values:{locale:He}})}),wV="2729db39-d7fd-4504-a06e-668c64968c95";function iS(){return{...Bw(),insightId:wV}}var IV={insightConfiguration:ml,search:xe,insightInterface:Ln,searchHub:Wl,resultPreview:va};function $w(e){let t=Lw(e.loggerOptions);EV(e.configuration,t);let r=FV(e.configuration,t),n=TV(t),o={...Uw(e.configuration,t),apiClient:r,streamingClient:n},i={...e,reducers:IV},a=Pw(i,o);kp(a.state.configuration.analytics.analyticsMode);let{insightId:p,search:f}=e.configuration;return a.dispatch(fl({insightId:p})),a.dispatch(jr()),f&&a.dispatch(ua(f)),{...a,get state(){return a.state},executeFirstSearch(m=El()){zl(a.state)||a.dispatch(Se({legacy:m,next:jC()}))}}}function EV(e,t){try{Gw.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function FV(e,t){return new Au({logger:t,preprocessRequest:e.preprocessRequest||yu})}function TV(e){return new hu({logger:e})}d();c();l();u();function fe(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 Hw={articleLanguage:He,articlePublishStatus:He,articleVersionNumber:He,caseId:G,knowledgeArticleId:He,name:He,permanentId:He,resultUrl:He,source:He,title:G,uriHash:He,isAttachedFromCitation:new ue({required:!1,default:!1})},PV=new W({options:{required:!0},values:Hw}),Np=T("insight/attachToCase/setAttachedResults",e=>_(e,{results:new re({each:PV}),loading:new ue({required:!1,default:!1})})),ao=T("insight/attachToCase/attach",e=>zw(e)),so=T("insight/attachToCase/detach",e=>zw(e)),zw=e=>te(e.permanentId)&&te(e.uriHash)?{payload:e,error:br(new xo("Either permanentId or uriHash is required"))}:_(e,Hw);d();c();l();u();d();c();l();u();var Fr=e=>{let t=J(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var Ya=e=>Z("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ft(e);let n=J(r.insightCaseContext);return t.logCaseAttach(Ke(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Fr(t)}}}),Ka=e=>Z("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,J(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:xr(e,t),context:Fr(t)})});d();c();l();u();d();c();l();u();function Ww(){return{results:[],loading:!1}}var co=ce(Ww(),e=>{e.addCase(Np,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(ao,(t,r)=>{(!te(r.payload.permanentId)||!te(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(so,(t,r)=>{t.results=t.results.filter(n=>kV(n,r.payload))})}),kV=(e,t)=>{let r=!te(e.permanentId)&&e?.permanentId===t?.permanentId,n=!te(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var qp=(e,t)=>Pi(e.raw[t])?String(e.raw[t]):void 0,Ja=(e,t)=>({articleLanguage:qp(e,"sflanguage"),articleVersionNumber:qp(e,"sflanguage"),articlePublishStatus:qp(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:qp(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function Yw(e,t){if(!OV(e))throw oe;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=fe(e),{result:i,caseId:a}=t.options,p=()=>te(a)||te(i.raw.permanentid)&&te(i.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=a===f.caseId,h=!te(f.permanentId)&&f.permanentId===i.raw.permanentid,v=!te(f.uriHash)&&f.uriHash===i.raw.urihash;return m&&(h||v)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(ao(Ja(i,a))),r(Ya(i))},detach(){r(so(Ja(i,a))),r(Ka(i))}}}function OV(e){return e.addReducers({configuration:ve,attachedResults:co}),!0}d();c();l();u();function Kw(e,t){if(!_V(e))throw oe;let{dispatch:r}=e,n=fe(e),{caseId:o}=t.options,i=p=>te(o)||te(p.raw.permanentid)&&te(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,h=!te(f.permanentId)&&f.permanentId===p.raw.permanentid,v=!te(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(h||v)}),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(ao(Ja(p,o))),r(Ya(p))},detach(p){r(so(Ja(p,o))),r(Ka(p))}}}function _V(e){return e.addReducers({configuration:ve,attachedResults:co}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ge=G;d();c();l();u();var NV={state:new Be({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new L({required:!0,emptyAllowed:!0}),path:new re({required:!0,each:G}),moreValuesAvailable:new ue({required:!1})};function aS(e){e.children.forEach(t=>{aS(t)}),ur({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},NV)}var Xa={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),delimitingCharacter:new L({required:!1,emptyAllowed:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),basePath:new re({required:!1,each:G}),filterByBasePath:new ue({required:!1})};var Za=T("categoryFacet/register",e=>_(e,Xa)),es=T("categoryFacet/toggleSelectValue",e=>{try{return ur(e.facetId,G),aS(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),uo=T("categoryFacet/deselectAll",e=>_(e,Xa.facetId)),Qc=T("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:Xa.facetId,numberOfValues:Xa.numberOfValues})),Dp=T("categoryFacet/updateSortCriterion",e=>_(e,{facetId:Xa.facetId,criterion:new Be})),Jw=T("categoryFacet/updateBasePath",e=>_(e,{facetId:Xa.facetId,basePath:new re({each:G})}));d();c();l();u();var YRe={categoryFacetId:ge,categoryFacetPath:new re({required:!0,each:G})};var Xw=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var qV={categoryFacetId:ge,categoryFacetPath:new re({required:!0,each:G})},DV=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,i=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:i}},Mp=e=>Z("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,qV);let n={...DV(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Qe=T("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new ue({required:!1})})),er=T("facetOptions/facet/enable",e=>_(e,ge)),dt=T("facetOptions/facet/disable",e=>_(e,ge));d();c();l();u();var tr=(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 Bc={facetId:ge,captions:new W({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new L({required:!1,emptyAllowed:!0})};var MV={path:new re({required:!0,each:G}),displayValue:Ye,rawValue:Ye,count:new ne({required:!0,min:0})},jp=T("categoryFacet/selectSearchResult",e=>_(e,{facetId:ge,value:new W({values:MV})})),Zw=T("categoryFacetSearch/register",e=>_(e,Bc));d();c();l();u();function ts(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function rs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Vp(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Gc(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Lp(e,t,r){e.currentValues=jV(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function jV(e,t){if(!e.length)return[];let r=eI(e[0],t),n=r;for(let o of e.splice(1)){let i=eI(o,t);n.children.push(i),n=i}return n.state="selected",n.retrieveChildren=!0,[r]}function eI(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Up=ce(Zi(),e=>{e.addCase(Za,(t,r)=>{let n=r.payload,{facetId:o,tabs:i}=n;if(o in t)return;let a=LV(n),p=a.numberOfValues;t[o]={request:a,initialNumberOfValues:p,tabs:i}}).addCase(Ze.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(tt,(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)&&!tr(a.tabs,o)){p.currentValues.length&&Lp(p,[],a.initialNumberOfValues);return}let m=n[i]||[];(m.length||p.currentValues.length)&&Lp(p,m,a.initialNumberOfValues)})}).addCase(Dp,(t,r)=>{let{facetId:n,criterion:o}=r.payload,i=t[n]?.request;i&&(i.sortCriteria=o)}).addCase(Jw,(t,r)=>{let{facetId:n,basePath:o}=r.payload,i=t[n]?.request;i&&(i.basePath=[...o])}).addCase(es,(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=VV(a,f,i);if(m.length){let v=m[0];v.retrieveChildren=!0,v.state="selected",v.previousState="idle",v.children=[];return}let h=rI(o.value,i);h.state="selected",h.previousState="idle",m.push(h),a.numberOfValues=1}).addCase(uo,(t,r)=>{let n=r.payload;Gc(t,n)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>Gc(t,r))}).addCase(fa,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(Qc,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,i=t[n]?.request;if(i){if(!i.currentValues.length)return Vp(i,o);UV(t,r.payload)}}).addCase(jp,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n];if(!i)return;let a=[...o.path,o.rawValue];Lp(i.request,a,i.initialNumberOfValues)}).addCase(Sa.fulfilled,(t,r)=>{tI(t,r.payload.response.facets)}).addCase(Fe.fulfilled,(t,r)=>{tI(t,r.payload.response.facets)}).addCase(dt,(t,r)=>{Gc(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&Gc(t,o)})})}),sS={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function VV(e,t,r){let n=e.currentValues;for(let o of t){let i=n[0];(!i||o!==i.value)&&(i=rI(o,r),n.length=0,n.push(i)),i.retrieveChildren=!1,i.previousState=void 0,i.state="idle",n=i.children}return n}function LV(e){return{...sS,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function rI(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function tI(e,t){t.forEach(r=>{if(!QV(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let i=BV(o,r);o.currentValues=i?[]:o.currentValues,o.preventAutoSelect=!1})}function UV(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 QV(e,t){return t.facetId in e}function BV(e,t){let r=Dr(e.currentValues),n=Dr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var Xr=new L({regex:/^[a-zA-Z0-9-_]+$/}),Zr=new L({required:!0}),nI=new re({each:new L}),oI=new L,iI=new ue,en=new ue,tn=new ne({min:0}),Tr=new ne({min:1}),Qp=new ue({required:!0}),GV=new W,$V=new L,HV={captions:GV,numberOfValues:Tr,query:$V},ns=new W({values:HV}),Bp=new W({options:{required:!1},values:{type:new L({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new re({required:!0,max:25,each:new L({emptyAllowed:!1,required:!0})})}}),AIe=new ue,Gp=new re({min:1,max:25,required:!1,each:new L({emptyAllowed:!1,required:!0})});d();c();l();u();var Si={value:G,numberOfResults:new ne({min:0}),state:G};var zV={facetId:ge,field:new L({required:!0,emptyAllowed:!0}),tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),resultsMustMatch:new Be({required:!1}),allowedValues:Bp,customSort:Gp},os=T("facet/register",e=>_(e,zV)),lo=T("facet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Si})})),po=T("facet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Si})})),ht=T("facet/deselectAll",e=>_(e,ge)),$p=T("facet/updateSortCriterion",e=>_(e,{facetId:ge,criterion:new Be({required:!0})})),$c=T("facet/updateNumberOfValues",e=>_(e,{facetId:ge,numberOfValues:new ne({required:!0,min:1})})),Hc=T("facet/updateIsFieldExpanded",e=>_(e,{facetId:ge,isFieldExpanded:new ue({required:!0})})),vi=T("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ge,freezeCurrentValues:new ue({required:!0})}));d();c();l();u();var is=e=>$e("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o=na(e,n);return t.makeFacetUnexclude(o)});var rr=()=>({actionCause:"facetClearAll"}),sr=()=>({actionCause:"facetSelect"}),Hp=()=>({actionCause:"facetExclude"}),Fn=()=>({actionCause:"facetDeselect"});var cS=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var as=e=>Z("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ge);let n={...No(e,Wt(r)),...J(r.insightCaseContext)};return t.logFacetShowMore(n)}),ss=e=>Z("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ge);let n={...No(e,Wt(r)),...J(r.insightCaseContext)};return t.logFacetShowLess(n)}),rn=e=>Z("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ge,sortCriterion:new Be({required:!0})});let{facetId:n,sortCriterion:o}=e,i=Wt(r),p={...No(n,i),criteria:o,...J(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Dt=e=>Z("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ge);let n=Wt(r),o={...No(e,n),...J(r.insightCaseContext)};return t.logFacetClearAll(o)}),Bt=e=>Z("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o={...na(e,n),...J(r.insightCaseContext)};return t.logFacetSelect(o)}),Pr=e=>Z("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o={...na(e,n),...J(r.insightCaseContext)};return t.logFacetDeselect(o)}),zc=e=>Z("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n={...na(e,Wt(r)),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var aI={facetId:ge,value:new W({values:{displayValue:Ye,rawValue:Ye,count:new ne({required:!0,min:0})}})},sI=T("facetSearch/register",e=>_(e,Bc)),zp=T("facetSearch/update",e=>_(e,Bc)),Wp=T("facetSearch/toggleSelectValue",e=>_(e,aI)),Yp=T("facetSearch/toggleExcludeValue",e=>_(e,aI));var cs=ce(ra(),e=>{e.addCase(os,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=dC(WV(r.payload),o))}).addCase(Ze.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(tt,(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,v=p.currentValues.filter(C=>!f.includes(C.value)&&!m.includes(C.value));p.currentValues=[...f.map(uI),...m.map(lI),...v.map(KV)],p.preventAutoSelect=h>0,p.numberOfValues=Math.max(h,p.numberOfValues)})}).addCase(lo,(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){Kp(i,o);return}let p=a.state==="selected";a.previousState=a.state,a.state=p?"idle":"selected",i.freezeCurrentValues=!0}).addCase(po,(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){Kp(i,o);return}let p=a.state==="excluded";a.previousState=a.state,a.state=p?"idle":"excluded",i.freezeCurrentValues=!0}).addCase(vi,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,i=t[n]?.request;i&&(i.freezeCurrentValues=o)}).addCase(ht,(t,r)=>{rs(t[r.payload]?.request)}).addCase(Kt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>rs(r))}).addCase(_l,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>rs(r))}).addCase(fa,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase($p,(t,r)=>{ts(t,r.payload)}).addCase($c,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Vp(t[n]?.request,o)}).addCase(Hc,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,i=t[n]?.request;i&&(i.isFieldExpanded=o)}).addCase(Fe.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>cI(t[o.facetId]?.request,o))}).addCase(Sa.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>cI(t[o.facetId]?.request,o))}).addCase(Wp,(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=uI(a);Kp(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(Yp,(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=lI(a);Kp(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(dt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];rs(n)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&rs(i.request)})})});function Kp(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 cI(e,t){e&&(e.currentValues=t.values.map(YV),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var uS={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function WV(e){return{...uS,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function YV(e){let{value:t,state:r}=e;return{value:t,state:r}}function uI(e){return{value:e,state:"selected"}}function lI(e){return{value:e,state:"excluded"}}function KV(e){return{...e,state:"idle"}}d();c();l();u();var Jp=()=>Z("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();function us(e){let t=dI(e.start,e),r=dI(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function dI(e,t){let{dateFormat:r}=t;return rb(e)?(vl(e),ZC(e)):typeof e=="string"&&Un(e)?(vl(e),e):(YC(e,r),Sl(la(e,r)))}d();c();l();u();var ls=T("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ge,criterion:new Be({required:!0})}));d();c();l();u();var Ai={state:G,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ue({required:!0}),numberOfResults:new ne({required:!0,min:0})},Ci={start:G,end:G,endInclusive:new ue({required:!0}),state:G,numberOfResults:new ne({required:!0,min:0})},Tn=e=>({facetId:ge,selection:typeof e.start=="string"?new W({values:Ci}):new W({values:Ai})});var JV={start:G,end:G,endInclusive:new ue({required:!0}),state:G},XV={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),currentValues:new re({required:!1,each:new W({values:JV})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function pI(e){return Un(e)?hc(e):e}function Xp(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=us(t);if(la(pI(r)).isAfter(la(pI(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var nn=T("dateFacet/register",e=>{try{return ur(e,XV),Xp(e),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),on=T("dateFacet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Ci})})),an=T("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Ci})})),Pn=T("dateFacet/updateFacetValues",e=>{try{return ur(e,{facetId:ge,values:new re({each:new W({values:Ci})})}),Xp({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),Zp=ls,ef=ht;d();c();l();u();d();c();l();u();var tf=(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}`}},rf=()=>({actionCause:"breadcrumbFacet"});var lS=rf;d();c();l();u();var Wc=e=>Z("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,Tn(e.selection));let n={...tf(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function ZV(e,t){return!!t&&t.facetId in e.dateFacetSet}var fI=(e,t)=>{let r=vn(e,t);if(ZV(e,r))return r},mI=(e,t)=>(fI(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),gI=(e,t)=>(fI(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var of={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function af(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=hI(r);r.numberOfValues=o,e[n]=t}function sf(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=hI(n))}function cf(e,t,r){let n=e[t]?.request;if(!n)return;let o=nf(n.currentValues,r);if(!o)return;let i=o.state==="selected";o.previousState=o.state,o.state=i?"idle":"selected",n.preventAutoSelect=!0}function uf(e,t,r){let n=e[t]?.request;if(!n)return;let o=nf(n.currentValues,r);if(!o)return;let i=o.state==="excluded";o.previousState=o.state,o.state=i?"idle":"excluded",n.preventAutoSelect=!0}function sn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function lf(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!nf(o,p)&&(p.state="selected"),p));let i=o.filter(p=>!nf(n.currentValues,p)),a=n.currentValues;a.push(...i),n.numberOfValues=Math.max(n.numberOfValues,a.length)})}function df(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 nf(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function hI(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var cn=ce(ea(),e=>{e.addCase(nn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=eL(n);af(t,uC(i,o))}).addCase(Ze.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(tt,(t,r)=>{let n=r.payload.df||{};lf(t,n)}).addCase(on,(t,r)=>{let{facetId:n,selection:o}=r.payload;cf(t,n,o)}).addCase(an,(t,r)=>{let{facetId:n,selection:o}=r.payload;uf(t,n,o)}).addCase(Pn,(t,r)=>{let{facetId:n,values:o}=r.payload;sf(t,n,o)}).addCase(ef,(t,r)=>{sn(t,r.payload)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>{sn(t,r)})}).addCase(Zp,(t,r)=>{ts(t,r.payload)}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.facets;df(t,n,tL)}).addCase(dt,(t,r)=>{sn(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&sn(t,o)})})});function eL(e){return{...of,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function tL(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var rL={state:G,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ue({required:!0})},nL={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),currentValues:new re({required:!1,each:new W({values:rL})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function pf(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 un=T("numericFacet/register",e=>{try{return _(e,nL),pf(e),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),ln=T("numericFacet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Ai})})),dn=T("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Ai})})),kn=T("numericFacet/updateFacetValues",e=>{try{return ur(e,{facetId:ge,values:new re({each:new W({values:Ai})})}),pf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),ff=ls,mf=ht;d();c();l();u();var dS=rf;d();c();l();u();d();c();l();u();var yI=(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 Yc=e=>Z("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,Tn(e.selection));let n={...yI(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function oL(e,t){return!!t&&t.facetId in e.numericFacetSet}var SI=(e,t)=>{let r=vn(e,t);if(oL(e,r))return r},vI=(e,t)=>(SI(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),AI=(e,t)=>(SI(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var fo=ce(ta(),e=>{e.addCase(un,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=iL(n);af(t,lC(i,o))}).addCase(Ze.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(tt,(t,r)=>{let n=r.payload.nf||{};lf(t,n)}).addCase(ln,(t,r)=>{let{facetId:n,selection:o}=r.payload;cf(t,n,o)}).addCase(dn,(t,r)=>{let{facetId:n,selection:o}=r.payload;uf(t,n,o)}).addCase(kn,(t,r)=>{let{facetId:n,values:o}=r.payload;sf(t,n,o)}).addCase(mf,(t,r)=>{sn(t,r.payload)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>{sn(t,r)})}).addCase(ff,(t,r)=>{ts(t,r.payload)}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.facets;df(t,n,aL)}).addCase(dt,(t,r)=>{sn(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&sn(t,o)})})});function iL(e){return{...of,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function aL(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Kc=G,gf=new W({options:{required:!0},values:{caption:Ye,expression:Ye,state:new L({constrainTo:["idle","selected","excluded"]})}}),CI=new re({required:!0,each:gf});var JPe=T("staticFilter/register",e=>_(e,{id:Kc,values:CI})),bI=T("staticFilter/toggleSelect",e=>_(e,{id:Kc,value:gf})),xI=T("staticFilter/toggleExclude",e=>_(e,{id:Kc,value:gf})),XPe=T("staticFilter/deselectAllFilterValues",e=>_(e,Kc));d();c();l();u();var hf=e=>Z("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...J(r.insightCaseContext)}));d();c();l();u();var yf=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 RI(e){let t=fe(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Kt())},deselectBreadcrumb(n){n.deselect()}}}function wI(e){if(!sL(e))throw oe;let t=RI(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let g={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:S,selection:x})=>{let w=zc({facetId:S,facetValue:x.value});r(lo({facetId:S,selection:x})),r(vi({facetId:S,freezeCurrentValues:!1})),r(Se({legacy:w,next:cS()}))},executeToggleExclude:({facetId:S,selection:x})=>{let w=zc({facetId:S,facetValue:x.value});r(po({facetId:S,selection:x})),r(vi({facetId:S,freezeCurrentValues:!1})),r(Se({legacy:w,next:cS()}))},facetValuesSelector:aC};return yf(g)},i=()=>{let g={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:S=>{r(ln(S)),r(Se({legacy:Yc(S),next:dS()}))},executeToggleExclude:S=>{r(dn(S)),r(Se({legacy:Yc(S),next:dS()}))},facetValuesSelector:vI};return yf(g)},a=()=>{let g={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:S=>{r(on(S)),r(Se({legacy:Wc(S),next:lS()}))},executeToggleExclude:S=>{r(an(S)),r(Se({legacy:Wc(S),next:lS()}))},facetValuesSelector:gI};return yf(g)},p=g=>{let S=cC(n(),g);return{facetId:g,field:n().categoryFacetSet[g].request.field,path:S,deselect:()=>{r(uo(g)),r(Se({legacy:Mp({categoryFacetPath:S.map(x=>x.value),categoryFacetId:g}),next:Xw()}))}}},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=>v(S,R));return{id:S,values:w}},v=(g,S)=>({value:S,deselect:()=>{let{caption:x,expression:w}=S,R=hf({staticFilterId:g,staticFilterValue:{caption:x,expression:w}});S.state==="selected"?r(bI({id:g,value:S})):S.state==="excluded"&&r(xI({id:g,value:S})),r(Se({legacy:R}))}});function C(){return!![...o(),...i(),...a(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:i(),dateFacetBreadcrumbs:a(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:C()}},deselectAll:()=>{t.deselectAll(),r(Se({legacy:Jp(),next:{actionCause:"breadcrumbResetAll"}}))}}}function sL(e){return e.addReducers({configuration:ve,search:xe,facetSet:cs,numericFacetSet:fo,dateFacetSet:cn,categoryFacetSet:Up}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var II=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Sf=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),EI=()=>({correctedQuery:"",corrections:[],originalQuery:""});function FI(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Sf(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var TI=(e,t)=>{let r={...EI(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var PI=ce(FI(),e=>{e.addCase(Al,t=>{t.enableDidYouMean=!0}).addCase(cb,t=>{t.enableDidYouMean=!1}).addCase(ub,t=>{t.automaticallyCorrectQuery=!0}).addCase(Cl,t=>{t.automaticallyCorrectQuery=!1}).addCase(Fe.pending,t=>{t.queryCorrection=Sf(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(Fe.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let i=o?.[0]?o[0]:Sf();t.queryCorrection=i}t.queryCorrectionMode==="next"&&TI(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Yt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(yc,(t,r)=>{t.queryCorrectionMode=r.payload})});function kI(e,t={}){if(!cL(e))throw oe;let r=fe(e),{dispatch:n}=e;n(Al()),t.options?.automaticallyCorrectQuery===!1&&n(Cl()),n(yc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,i=()=>II(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(Yt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(a){n(yc(a))}}}function cL(e){return e.addReducers({configuration:ve,didYouMean:PI}),!0}var OI={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function _I(e,t={options:OI}){let r={...OI,...t.options},n=kI(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Se({legacy:yb(),next:wb()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Mt=ce(Rl(),e=>{e.addCase(Qe,(t,r)=>({...t,...r.payload})).addCase(Fe.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(Fe.rejected,t=>{t.freezeFacetOrder=!1}).addCase(Ze.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(Za,(t,r)=>{let{facetId:n,tabs:o}=r.payload;vf(o,t,n)}).addCase(os,(t,r)=>{let{facetId:n,tabs:o}=r.payload;vf(o,t,n)}).addCase(nn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;vf(o,t,n)}).addCase(un,(t,r)=>{let{facetId:n,tabs:o}=r.payload;vf(o,t,n)}).addCase(er,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(dt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(tt,(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]=wh()),t.facets[n].enabled=!0})})});function vf(e,t,r){let n={...wh(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Af=ce(Il(),e=>{e.addCase(yd,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(Tt,(t,r)=>{let n=r.payload;NI(t,n)}).addCase(hd,(t,r)=>{let n=r.payload;NI(t,n)}).addCase(Ze.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(tt,(t,r)=>{let n=r.payload.tab;te(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function NI(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function qI(e){if(!uL(e))throw oe;let t=fe(e),r=ot(n=>n.tabSet,n=>Object.values(n).find(i=>i.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function uL(e){return e.addReducers({tabSet:Af}),!0}function DI(e,t){if(!lL(e))throw oe;let r=qI(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=()=>Oi({isFacetRegistered:i(t.facetId),parentFacets:t.conditions.map(({parentFacetId:S})=>i(S)?{enabled:n(S),values:o(S)}:null),isTabEnabled:tr(a(t.facetId),r.state.activeTab)}),f=()=>{let S=p();return S===C?!1:(C=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(vi({facetId:S,freezeCurrentValues:!1})))},v=()=>{if(!i(t.facetId))return;let S=n(t.facetId),x=m(),w=tr(a(t.facetId),r.state.activeTab),R=x&&w;S!==R&&(e.dispatch(R?er(t.facetId):dt(t.facetId)),h())},C=p(),g=e.subscribe(()=>{f()&&v()});return v(),{stopWatching(){g()}}}function lL(e){return e.addReducers({facetOptions:Mt}),!0}function MI(e,t){return DI(e,t)}d();c();l();u();d();c();l();u();function jI(e){if(!dL(e))throw oe;let t=fe(e),r=()=>e.state;return{...t,sort(n){return vc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(i=>i.facetId)}}}}function dL(e){return e.addReducers({search:xe,facetOptions:Mt}),!0}function VI(e){return jI(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Cf(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,i={...ds,...t},a=r();e[n]={options:i,isLoading:o,response:a,initialNumberOfValues:i.numberOfValues,requestId:""}}function bf(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function xf(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Rf(e,t){let r=e[t];r&&(r.isLoading=!1)}function wf(e,t,r){let{facetId:n,response:o}=t,i=e[n];i&&i.requestId===r&&(i.isLoading=!1,i.response=o)}function Jc(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=ds.query)}function If(e,t){Object.keys(e).forEach(r=>Jc(e,{facetId:r},t))}var ds={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var LI=/*#__PURE__*/function(){var _ref87=_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:v,filterFacetCount:C}=i,g=pL(i),S=g.length?[g]:[],x=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??$t(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:v,captions:a,numberOfValues:f,query:x,field:m,delimitingCharacter:h,ignorePaths:S,filterFacetCount:C,type:"hierarchical",...(n?{}:{searchContext:(yield mr(t,r)).request})}});return function LI(_x204,_x205,_x206,_x207){return _ref87.apply(this,arguments)}}(),pL=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var UI=/*#__PURE__*/function(){var _ref88=_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(C=>C.state!=="idle").map(C=>C.value),v=`*${i}*`;return{url:t.configuration.search.apiBaseUrl??$t(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:v,field:p,ignoreValues:h,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield mr(t,r)).request})}});return function UI(_x208,_x209,_x210,_x211){return _ref88.apply(this,arguments)}}();var QI=e=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){let a=r(),p;o(t,G),fL(a,t)?p=yield UI(t,a,i,e):p=yield LI(t,a,i,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x212,_x213){return _ref89.apply(this,arguments)}}()),mo=le("facetSearch/executeSearch",QI(!1)),PNe=le("facetSearch/executeSearch",QI(!0)),Ef=T("facetSearch/clearResults",e=>_(e,{facetId:ge})),fL=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function BI(){return{}}var GI=ce(BI(),e=>{e.addCase(Zw,(t,r)=>{let n=r.payload;Cf(t,n,pS)}).addCase(zp,(t,r)=>{bf(t,r.payload)}).addCase(mo.pending,(t,r)=>{let n=r.meta.arg;xf(t,n,r.meta.requestId)}).addCase(mo.rejected,(t,r)=>{let n=r.meta.arg;Rf(t,n)}).addCase(mo.fulfilled,(t,r)=>{wf(t,r.payload,r.meta.requestId)}).addCase(Ef,(t,{payload:{facetId:r}})=>{Jc(t,{facetId:r},pS)}).addCase(Fe.fulfilled,t=>{If(t,pS)})});function pS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function $I(e,t){let{field:r,state:n}=e;if(!mL(e))return r;let o=`${r}_`,i=gL(o,n);return yL(r,t),`${o}${i}`}function mL(e){let{field:t,state:r}=e;return HI(r).some(o=>o&&t in o)}function gL(e,t){let n=HI(t).map(o=>Object.keys(o||{})).reduce((o,i)=>o.concat(i),[]);return hL(n,e)+1}function HI(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function hL(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 yL(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 vr(e,t){let{state:r,logger:n}=e,{field:o,facetId:i}=t;return i||$I({field:o,state:r},n)}d();c();l();u();d();c();l();u();var zI=["alphanumeric","occurrences"];var WI=new Ee({field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),basePath:nI,delimitingCharacter:oI,facetId:Xr,facetSearch:ns,filterByBasePath:iI,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:zI})});function YI(e,t){if(!SL(e))throw oe;let r=fe(e),{dispatch:n}=e,o=vr(e,t.options),i=t.options.tabs??{},a=Qt(e.state.tabSet),p={...sS,...fu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:i,activeTab:a},f={facetSearch:{...ds,...t.options.facetSearch},...p};mt(e,WI,f,"buildCategoryFacet");let m=()=>th(e.state,o),h=()=>eh(e.state,o),v=()=>qr(e.state),C=()=>Gr(e.state,o);return n(Za(p)),{...r,toggleSelect(g){let S=f.numberOfValues;n(es({facetId:o,selection:g,retrieveCount:S})),n(Qe())},deselectAll(){n(uo(o)),n(Qe())},sortBy(g){n(Dp({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(Qc({facetId:o,numberOfValues:w})),n(Qe())},showLessValues(){let{numberOfValues:g}=f;n(Qc({facetId:o,numberOfValues:g})),n(Qe())},enable(){n(er(o))},disable(){n(dt(o))},get state(){let g=m(),S=h(),x=v(),w=C(),R=S?.values??[],I=R.some(U=>U.children.length>0)??!1,{parents:E,values:P}=sC(S?.values),V=Dr(R),q=V.length?V[V.length-1]:void 0,O=!!q,N=q?.moreValuesAvailable??S?.moreValuesAvailable??!1,M=q?q.children.length>f.numberOfValues:R.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:V,values:P,isHierarchical:I,valuesAsTrees:R,activeValue:q,isLoading:x,hasActiveValues:O,canShowMoreValues:N,canShowLessValues:M,sortCriteria:g.sortCriteria,enabled:w}}}}function SL(e){return e.addReducers({categoryFacetSet:Up,categoryFacetSearchSet:GI,facetOptions:Mt,configuration:ve,search:xe}),!0}function KI(e,t){let r=YI(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=vL(o(),m);n(Se({legacy:h,next:AL(m)}))},deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(m){r.sortBy(m),n(Se({legacy:rn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(pa({legacy:as(o())}))},showLessValues(){r.showLessValues(),n(pa({legacy:ss(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function vL(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Pr(r):Bt(r)}function AL(e){return e.state==="selected"?Fn():sr()}d();c();l();u();d();c();l();u();d();c();l();u();function JI(){return{}}var Ff=ce(JI(),e=>{e.addCase(sI,(t,r)=>{let n=r.payload;Cf(t,n,fS)}).addCase(zp,(t,r)=>{bf(t,r.payload)}).addCase(mo.pending,(t,r)=>{let n=r.meta.arg;xf(t,n,r.meta.requestId)}).addCase(mo.rejected,(t,r)=>{let n=r.meta.arg;Rf(t,n)}).addCase(mo.fulfilled,(t,r)=>{wf(t,r.payload,r.meta.requestId)}).addCase(Ef,(t,{payload:r})=>{Jc(t,r,fS)}).addCase(Fe.fulfilled,t=>{If(t,fS)})});function fS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var CL=e=>e.state==="selected",XI=(e,t)=>{let r={facetId:e,facetValue:t.value};return CL(t)?Pr(r):Bt(r)};d();c();l();u();var mS=e=>e.state==="selected",rE=e=>e.state==="excluded";var nE=e=>mS(e)?Fn():sr();d();c();l();u();d();c();l();u();var oE={facetId:ge,selection:new W({values:Si})},iE=le("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},oE),n(lo({facetId:e,selection:t})),n(Qe())}),aE=le("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},oE),n(po({facetId:e,selection:t})),n(Qe())});d();c();l();u();d();c();l();u();var ps=["allValues","atLeastOneValue"];d();c();l();u();var Tf=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var sE=new Ee({facetId:Xr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),field:Zr,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:Tf}),resultsMustMatch:new L({constrainTo:ps}),facetSearch:ns});function cE(e,t,r=sE){if(!bL(e))throw oe;let{dispatch:n}=e,o=fe(e),i=vr(e,t.options),a=t.options.tabs??{},p=Qt(e.state.tabSet),f={...uS,...fu("facetSearch",t.options),field:t.options.field,facetId:i,tabs:a,activeTab:p},m={facetSearch:{...ds,...t.options.facetSearch},...f};mt(e,r,m,"buildFacet");let h=()=>iC(e.state,i),v=()=>Zg(e.state,i),C=()=>qr(e.state),g=()=>Gr(e.state,i),S=()=>{let{currentValues:w}=h();return w.filter(R=>R.state!=="idle").length},x=()=>{let{currentValues:w}=h(),R=m.numberOfValues,I=!!w.find(E=>E.state==="idle");return R<w.length&&I};return n(os(f)),{...o,toggleSelect:w=>n(iE({facetId:m.facetId,selection:w})),toggleExclude:w=>n(aE({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(ht(i)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(ht(i)),this.toggleExclude(w)},isValueSelected:mS,isValueExcluded:rE,deselectAll(){n(ht(i)),n(Qe())},sortBy(w){n($p({facetId:i,criterion:w})),n(Qe())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=h().numberOfValues,R=m.numberOfValues,I=R-w%R,E=w+I;n($c({facetId:i,numberOfValues:E})),n(Hc({facetId:i,isFieldExpanded:!0})),n(Qe())},showLessValues(){let w=m.numberOfValues,R=Math.max(w,S());n($c({facetId:i,numberOfValues:R})),n(Hc({facetId:i,isFieldExpanded:!1})),n(Qe())},enable(){n(er(i))},disable(){n(dt(i))},get state(){let w=h(),R=v(),I=C(),E=g(),P;typeof w.sortCriteria=="object"?P=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":P=w.sortCriteria;let V=R?R.values:[],q=V.some(M=>M.state!=="idle"),O=R?R.moreValuesAvailable:!1,N=w.resultsMustMatch;return{label:R?.label,facetId:i,tabs:a,values:V,sortCriterion:P,resultsMustMatch:N,isLoading:I,hasActiveValues:q,canShowMoreValues:O,canShowLessValues:x(),enabled:E}}}}function bL(e){return e.addReducers({facetSet:cs,facetOptions:Mt,configuration:ve,facetSearchSet:Ff}),!0}d();c();l();u();var uE=new Ee({facetId:Xr,field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:Tf}),resultsMustMatch:new L({constrainTo:ps}),facetSearch:ns,allowedValues:Bp,customSort:Gp});function lE(e,t){if(!xL(e))throw oe;let{dispatch:r}=e,n=cE(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},uE),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(Se({legacy:XI(o(),m),next:nE(m)}))},deselectAll(){n.deselectAll(),r(Se({legacy:Dt(o()),next:rr()}))},sortBy(m){n.sortBy(m),r(Se({legacy:rn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(pa({legacy:as(o())}))},showLessValues(){n.showLessValues(),r(pa({legacy:ss(o())}))},get state(){return{...n.state,facetSearch:a.state}}}}function xL(e){return e.addReducers({facetSet:cs,configuration:ve,facetSearchSet:Ff,search:xe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var Xc=e=>e.state==="selected",dE=e=>e.state==="excluded";var Pf=e=>Xc(e)?Fn():sr();var kf=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Xc(t)?Pr(n):Bt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Of=T("rangeFacet/executeToggleSelect",e=>_(e,Tn(e.selection))),_f=T("rangeFacet/executeToggleExclude",e=>_(e,Tn(e.selection)));var pE={facetId:ge,selection:new W({values:Ci})},fE=le("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,pE),t(on(e)),t(Of(e)),t(Qe())}),mE=le("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,pE),t(an(e)),t(_f(e)),t(Qe())});d();c();l();u();function Nf(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 qf(e,t){let{facetId:r,getRequest:n}=t,o=fe(e),i=e.dispatch,a=()=>Gr(e.state,r);return{...o,isValueSelected:Xc,isValueExcluded:dE,deselectAll(){i(ht(r)),i(Qe())},sortBy(p){i(ls({facetId:r,criterion:p})),i(Qe())},isSortedBy(p){return this.state.sortCriterion===p},enable(){i(er(r))},disable(){i(dt(r))},get state(){let p=n(),f=vn(e.state,r),m=p.sortCriteria,h=p.resultsMustMatch,v=f?f.values:[],C=qr(e.state),g=a(),S=v.some(w=>w.state!=="idle"),x=f?.domain;return{facetId:r,values:v,sortCriterion:m,resultsMustMatch:h,hasActiveValues:S,isLoading:C,enabled:g,domain:x}}}}d();c();l();u();d();c();l();u();var Df=["idle","selected","excluded"];d();c();l();u();var Mf=["ascending","descending"],jf=["even","equiprobable"];var RL={start:new L,end:new L,endInclusive:new ue,state:new L({constrainTo:Df})},wL=new Ee({facetId:Xr,field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),generateAutomaticRanges:Qp,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,currentValues:new re({each:new W({values:RL})}),sortCriteria:new L({constrainTo:Mf}),rangeAlgorithm:new L({constrainTo:jf})});function Vf(e,t){mt(e,wL,t,"buildDateFacet"),Xp(t)}function gE(e,t){if(!IL(e))throw oe;Nf(t.options,"buildDateFacet");let r=e.dispatch,n=vr(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};Vf(e,a),r(nn(a));let p=qf(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(fE({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(ht(n)),this.toggleSelect(f)},toggleExclude:f=>r(mE({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(ht(n)),this.toggleExclude(f)},get state(){return p.state}}}function IL(e){return e.addReducers({configuration:ve,search:xe,dateFacetSet:cn,facetOptions:Mt}),!0}function hE(e,t){let r=gE(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(i){r.sortBy(i),n(Se({legacy:rn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Se({legacy:kf(o(),i),next:Pf(i)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function yE(e,t){if(!EL(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=vr(e,t.options),a=t.options.tabs??{},p=Qt(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};Vf(e,f),n(nn(f));let m=()=>Gr(e.state,i);return{...r,clear:()=>{n(Pn({facetId:i,values:[]})),n(Qe())},setRange:h=>{let v={...h,state:"selected",numberOfResults:0,endInclusive:!0},C=Pn({facetId:i,values:[v]});return C.error?!1:(n(C),n(Qe()),!0)},enable(){n(er(i))},disable(){n(dt(i))},get state(){let h=qr(o()),v=m(),C=mI(o(),i),g=C.length?C[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:v}}}}function EL(e){return e.addReducers({dateFacetSet:cn,facetOptions:Mt,configuration:ve,search:xe}),!0}function SE(e,t){if(!FL(e))throw oe;let r=yE(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Se({legacy:Dt(o()),next:rr()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Se({legacy:Bt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:sr()})),a},get state(){return{...r.state}}}}function FL(e){return e.addReducers({dateFacetSet:cn,configuration:ve,search:xe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var vE={facetId:ge,selection:new W({values:Ai})},AE=le("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,vE),t(ln(e)),t(Of(e)),t(Qe())}),NVe=le("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,vE),t(dn(e)),t(_f(e)),t(Qe())});d();c();l();u();var TL={start:new ne,end:new ne,endInclusive:new ue,state:new L({constrainTo:Df})},PL=new Ee({facetId:Xr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),field:Zr,generateAutomaticRanges:Qp,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,currentValues:new re({each:new W({values:TL})}),sortCriteria:new L({constrainTo:Mf}),resultsMustMatch:new L({constrainTo:ps}),rangeAlgorithm:new L({constrainTo:jf})});function Lf(e,t){mt(e,PL,t,"buildNumericFacet"),pf(t)}d();c();l();u();function Uf(e){return{endInclusive:!1,state:"idle",...e}}function CE(e,t){if(!kL(e))throw oe;Nf(t.options,"buildNumericFacet");let r=e.dispatch,n=vr(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};Lf(e,a),r(un(a));let p=qf(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(AE({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(ht(n)),this.toggleSelect(f)},get state(){return p.state}}}function kL(e){return e.addReducers({numericFacetSet:fo,facetOptions:Mt,configuration:ve,search:xe}),!0}function bE(e,t){let r=CE(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(i){r.sortBy(i),n(Se({legacy:rn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Se({legacy:kf(o(),i),next:Pf(i)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function xE(e,t){if(!OL(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=vr(e,t.options),a=t.options.tabs??{},p=Qt(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};Lf(e,f),n(un(f));let m=()=>Gr(e.state,i);return{...r,clear:()=>{n(kn({facetId:i,values:[]})),n(Qe())},setRange:h=>{let v={...h,state:"selected",numberOfResults:0,endInclusive:!0},C=kn({facetId:i,values:[v]});return C.error?!1:(n(C),n(Qe()),!0)},enable(){n(er(i))},disable(){n(dt(i))},get state(){let h=qr(o()),v=m(),C=AI(o(),i),g=C.length?C[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:v}}}}function OL(e){return e.addReducers({numericFacetSet:fo,facetOptions:Mt,configuration:ve,search:xe}),!0}function RE(e,t){let r=xE(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Se({legacy:Dt(o()),next:rr()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Se({legacy:Bt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:sr()})),a},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var _L=e=>Z("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ft(e),t.logShowMoreFoldedResults(Ke(e,r),Je(e),J(r.insightCaseContext)))),NL=()=>Z("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(J(t.insightCaseContext))),wE={logShowMoreFoldedResults:_L,logShowLessFoldedResults:NL};d();c();l();u();d();c();l();u();var Zc={collectionField:new L({emptyAllowed:!1,required:!1}),parentField:new L({emptyAllowed:!1,required:!1}),childField:new L({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},fs=T("folding/register",e=>_(e,Zc)),Qf=le("folding/loadCollection",/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield $n(i):ma(i,o),p=yield n.search({...a,q:qL(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 Ge(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x214,_x215){return _ref90.apply(this,arguments)}}());function qL(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var IE=T("folding/register",e=>_(e,Zc)),Bf=le("folding/loadCollection",/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield hb(o,e),p=(yield bb(n,o,i,{origin:"foldingCollection"})).response;return Ge(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x216,_x217){return _ref91.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Gf=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function DL(e,t){return e.raw[t.collection]}function gS(e,t){return e.raw[t.parent]}function eu(e,t){let r=e.raw[t.child];return du(r)?r[0]:r}function ML(e,t){return(e||t)!==void 0&&e===t}function FE(e,t,r,n=[]){let o=eu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(i=>{let a=eu(i,r)===eu(e,r);return gS(i,r)===o&&!a}).map(i=>{let a={...i,searchUid:e.searchUid};return{result:a,children:FE(a,t,r,[...n,o])}}):[]}function jL(e,t){return e.find(r=>{let n=gS(r,t)===void 0,o=ML(gS(r,t),eu(r,t));return n||o})}function TE(e){return e.parentResult?TE(e.parentResult):e}function VL(e,t,r,n){let o=al(e),a={...(n??jL(o,t)??TE(e)),searchUid:r},p=FE(a,o,t);return{result:a,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function $f(e,t,r,n){let o={};return e.forEach(i=>{let a=DL(i,t);a&&(!eu(i,t)&&!i.parentResult||(o[a]=VL(i,t,r,n)))}),o}function EE(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 Hf=ce(Gf(),e=>e.addCase(Fe.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?$f(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Br.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?$f(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Kn.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...$f(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(fs,(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(Qf.pending,(t,{meta:r})=>{let n=r.arg;EE(t,n).isLoadingMoreResults=!0}).addCase(Qf.rejected,(t,{meta:r})=>{let n=r.arg;EE(t,n).isLoadingMoreResults=!1}).addCase(Qf.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:i}})=>{let a=$f(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 tu={id:G},go=T("querySuggest/register",e=>_(e,{...tu,count:new ne({min:0})})),PE=T("querySuggest/unregister",e=>_(e,tu)),ho=T("querySuggest/selectSuggestion",e=>_(e,{...tu,expression:Ye})),yo=T("querySuggest/clear",e=>_(e,tu)),ms=le("querySuggest/fetch",/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){o(e,tu);let a=e.id,p=yield LL(a,t(),i),f=yield n.querySuggest(p);return Ge(f)?r(f.error):{id:a,q:p.q,...f.success}});return function(_x218,_x219){return _ref92.apply(this,arguments)}}()),LL=/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??$t(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?Nt.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 Qn(t.configuration.analytics):jo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function LL(_x220,_x221,_x222){return _ref93.apply(this,arguments)}}();var So=ce(at(),e=>e.addCase(Ut,(t,r)=>({...t,...r.payload})).addCase(Yt,(t,r)=>{t.q=r.payload}).addCase(ho,(t,r)=>{t.q=r.payload.expression}).addCase(Ze.fulfilled,(t,r)=>r.payload?.query??t).addCase(tt,(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 vo=T("fields/registerFieldsToInclude",e=>_(e,Cu)),zf=T("fields/fetchall/enable"),Wf=T("fields/fetchall/disable"),Yf=le("fields/fetchDescription",/*#__PURE__*/function(){var _ref94=_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??$t(p,a)});return Ge(m)?n(m.error):m.success.fields});return function(_x223,_x224){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var kE=["author","language","urihash","objecttype","collection","source","permanentid"],UL=[...kE,"date","filetype","parents"],_Qe=[...UL,"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"],OE=()=>({fieldsToInclude:kE,fetchAllFields:!1,fieldsDescription:[]});var gs=ce(OE(),e=>e.addCase(vo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(zf,t=>{t.fetchAllFields=!0}).addCase(Wf,t=>{t.fetchAllFields=!1}).addCase(Yf.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(fs,(t,{payload:r})=>{let n=Gf().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function hs(e){if(!QL(e))throw oe;let t=fe(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:zl(n)}}}}function QL(e){return e.addReducers({search:xe}),!0}var BL=new Ee({fieldsToInclude:new re({required:!1,each:new L({required:!0,emptyAllowed:!1})})});function Kf(e,t){if(!GL(e))throw oe;let r=fe(e),n=hs(e),{dispatch:o}=e,i=()=>e.state,a=mt(e,BL,t?.options,"buildCoreResultList");a.fieldsToInclude&&o(vo(a.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,h=5,v=200,C=!1;return{...r,get state(){let S=i();return{...n.state,results:S.search.results,moreResultsAvailable:p(),searchResponseId:S.search.searchResponseId}},fetchMoreResults:function(){var _ref95=_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<v){if(m++,m>=h){f=Date.now(),!C&&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.`),C=!0;return}}else m=0;C=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref95.apply(this,arguments)}}()}}function GL(e){return e.addReducers({search:xe,configuration:ve,fields:gs}),!0}var $L=new Ee(Zc);function _E(e,t,r){if(!HL(e))throw oe;let n=Kf(e,t),{dispatch:o}=e,i=()=>e.state,a=t.options?.folding?mt(e,$L,t.options.folding,"buildFoldedResultList"):{};return o(fs({...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 hS(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return hS(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 HL(e){return e.addReducers({search:xe,configuration:Ad,folding:Hf,query:So}),!0}function hS(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=hS(n.children,t);if(o)return o}}return null}function NE(e,t={}){let r=_E(e,{...t,loadCollectionActionCreator:Bf,fetchMoreResultsActionCreator:kl},wE);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var zL=()=>Z("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(J(t.insightCaseContext))),yS=e=>Z("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ve(r),o=oa(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(sl(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:cl(o)},J(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=oa(t,e);return{answerId:Ve(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),WL=(e,t)=>Z("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ve(n),i=oa(n,e);return!o||!i?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t},J(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=oa(r,e);return{answerId:Ve(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),YL=()=>Z("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"like"})}),KL=()=>Z("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"dislike"})}),JL=e=>Z("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ve(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},J(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ve(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Rc(o),documented:Rc(i),correctTopic:Rc(p),hallucinationFree:Rc(a)},additionalNotes:m,correctAnswerUrl:f}}}),XL=e=>Z("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Ve(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:Ve(t)??"",answerGenerated:e})});var ZL=()=>Z("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"show"})}),eU=()=>Z("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"hide"})}),tU=()=>Z("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"expand"})}),rU=()=>Z("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"collapse"})}),nU=()=>Z("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"copyToClipboard"})}),Jf={logCopyGeneratedAnswer:nU,logGeneratedAnswerHideAnswers:eU,logGeneratedAnswerShowAnswers:ZL,logGeneratedAnswerStreamEnd:XL,logGeneratedAnswerFeedback:JL,logDislikeGeneratedAnswer:KL,logLikeGeneratedAnswer:YL,logHoverCitation:WL,logOpenGeneratedAnswerSource:yS,logRetryGeneratedAnswer:zL,logGeneratedAnswerExpand:tU,logGeneratedAnswerCollapse:rU};d();c();l();u();d();c();l();u();d();c();l();u();function Xf(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var ys=ce(oy(),e=>e.addCase(Fa,(t,{payload:r})=>{t.isVisible=r}).addCase(wc,(t,{payload:r})=>{t.isEnabled=r}).addCase(id,(t,{payload:r})=>{t.id=r.id}).addCase(Qo,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.answer||(t.answer=""),t.answer+=r.textDelta,delete t.error}).addCase(Bo,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Xf([...t.citations,...r.citations]),delete t.error}).addCase(Go,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===Hm},t.citations=[],delete t.answer}).addCase(td,t=>{t.liked=!0,t.disliked=!1}).addCase(rd,t=>{t.liked=!1,t.disliked=!0}).addCase(nd,t=>{t.feedbackModalOpen=!0}).addCase(ad,t=>{t.feedbackModalOpen=!1}).addCase(Pa,t=>{t.feedbackSubmitted=!0}).addCase(ar,t=>({...oy(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase($r,(t,{payload:r})=>{t.isLoading=r}).addCase(Uo,(t,{payload:r})=>{t.isStreaming=r}).addCase($o,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(sd,(t,{payload:r})=>{t.responseFormat=r}).addCase(ud,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Ec,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Ic,t=>{t.expanded=!0}).addCase(od,t=>{t.expanded=!1}).addCase(cd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(Ho,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(ay,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Ta,(t,{payload:r})=>{t.answerId=r}).addCase(ed,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(ld,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(dd,(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 Zf(e,t,r={}){if(!oU(e))throw oe;let{dispatch:n}=e,o=fe(e),i=()=>e.state,a=r.initialState?.isVisible;a!==void 0&&n(Fa(a));let p=r.initialState?.responseFormat;p&&n(sd(p));let f=r.fieldsToIncludeInCitations;return f&&n(ud(f)),r.initialState?.expanded&&n(Ic()),{...o,get state(){return i().generatedAnswer},like(h){this.state.liked||(n(td()),n(t.logLikeGeneratedAnswer(h)))},dislike(h){this.state.disliked||(n(rd()),n(t.logDislikeGeneratedAnswer(h)))},openFeedbackModal(){n(nd())},closeFeedbackModal(){n(ad())},sendFeedback(h){n(t.logGeneratedAnswerFeedback(h)),n(Pa())},logCitationClick(h,v){n(t.logOpenGeneratedAnswerSource(h,v))},logCitationHover(h,v,C){n(t.logHoverCitation(h,v,C))},show(){this.state.isVisible||(n(Fa(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Fa(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Ic()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(od()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(wc(!0))},disable(){this.state.isEnabled&&n(wc(!1))},logCopyToClipboard(h){n(t.logCopyGeneratedAnswer(h))},retry(){}}}function oU(e){return e.addReducers({generatedAnswer:ys}),!0}var jt={engines:{},setAbortControllerRef:(e,t)=>{jt.engines[t].abortController=e},getIsStreamInProgress:e=>!jt.engines[e].abortController||jt.engines[e].abortController?.signal.aborted?(jt.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(jt.engines[i].lastRequestId!==n){if(jt.engines[i].lastRequestId=n,jt.engines[i].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(ar())}if(!jt.getIsStreamInProgress(i)&&o&&o!==jt.engines[i].lastStreamId){if(jt.engines[i].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Ix({setAbortControllerRef:p=>jt.setAbortControllerRef(p,i)}))}};return e.subscribe(t)}};function qE(e,t,r={}){if(!iU(e))throw oe;let n=Zf(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!jt.engines[e.state.generatedAnswer.id]&&(jt.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=lu("genQA-",12);e.dispatch(id({id:a}))}jt.engines[e.state.generatedAnswer.id]||(jt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),jt.subscribeToSearchRequests(e);let i=a=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in a;return{...n,get state(){return o().generatedAnswer},retry(){i(e)&&e.dispatch(Fe({legacy:t.logRetryGeneratedAnswer()}))}}}function iU(e){return e.addReducers({generatedAnswer:ys}),!0}d();c();l();u();d();c();l();u();var DE=md.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var em=e=>e==="yes"?!0:e==="no"?!1:null,aU=({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:em(t.correctTopic),documented:em(t.documented),hallucinationFree:em(t.hallucinationFree),readable:em(t.readable)},helpful:t.helpful,question:r}),sU=e=>{let t="",r=()=>{let n=e.state,o=dx(n),i=o.requestId;i!==t&&(t=i,e.dispatch(ar()),o.q?.length>0&&e.dispatch(pd()))};e.subscribe(r)};function ME(e,t,r={}){if(!cU(e))throw oe;kp(e.state.configuration.analytics.analyticsMode);let{...n}=Zf(e,t,r),o=()=>e.state;return e.dispatch(cd(r.answerConfigurationId)),sU(e),{...n,get state(){let i=sy(e.state).data,a=o().generatedAnswer;return{...a,answer:i?.answer,citations:Xf(i?.citations??[]),error:{message:i?.error?.message,statusCode: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=Xl(o());e.dispatch(fd(i??Vo))},reset(){e.dispatch(ar())},sendFeedback(i){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(i));let a=aU({query:o().query.q,feedback:i,answerApiState:sy(e.state).data});e.dispatch(DE.endpoints.post.initiate(a)),e.dispatch(Pa())})()}}}function cU(e){return e.addReducers({[zo.reducerPath]:zo.reducer,query:So}),!0}function jE(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?ME(e,Jf,t):qE(e,Jf,t);return{...n,get state(){return n.state},retry(){r(Se({legacy:Jf.logRetryGeneratedAnswer(),next:px()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function pn(e,t,r){if(!uU(e))throw oe;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:mu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function uU(e){return e.addReducers({configuration:ve}),!0}function VE(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logOpenGeneratedAnswerSource(r.options.citation.id,r.options.answerId)))};return pn(e,r,()=>{o()})}function LE(e,t){return VE(e,{logOpenGeneratedAnswerSource:yS},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var fU=new ne({min:1,default:8,required:!1}),mU=new ne({min:1,max:20,default:5,required:!1}),gU={desiredCount:mU,numberOfValues:fU},DGe=T("automaticFacet/setOptions",e=>_(e,gU)),MGe=T("automaticFacet/deselectAll",e=>_(e,ge)),hU=G,UE=T("automaticFacet/toggleSelectValue",e=>_(e,{field:hU,selection:new W({values:Si})}));var vs=ce(Lr(),e=>{e.addCase(Ml,(t,r)=>{let n=SS(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ru(n,o)}).addCase(jl,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(Tt,t=>{t.firstResult=0}).addCase(Vl,(t,r)=>{let n=r.payload;t.firstResult=ru(n,t.numberOfResults)}).addCase(Gn,(t,r)=>{let n=r.payload;t.firstResult=ru(n,t.numberOfResults)}).addCase(Ul,t=>{let r=SS(t),n=Math.max(r-1,1);t.firstResult=ru(n,t.numberOfResults)}).addCase(Ll,t=>{let r=SS(t),n=yU(t),o=Math.min(r+1,n);t.firstResult=ru(o,t.numberOfResults)}).addCase(Ze.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(tt,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Fe.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Br.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(ht,t=>{Vt(t)}).addCase(an,t=>{Vt(t)}).addCase(po,t=>{Vt(t)}).addCase(dn,t=>{Vt(t)}).addCase(Yp,t=>{Vt(t)}).addCase(lo,t=>{Vt(t)}).addCase(uo,t=>{Vt(t)}).addCase(es,t=>{Vt(t)}).addCase(jp,t=>{Vt(t)}).addCase(on,t=>{Vt(t)}).addCase(ln,t=>{Vt(t)}).addCase(Kt,t=>{Vt(t)}).addCase(Pn,t=>{Vt(t)}).addCase(kn,t=>{Vt(t)}).addCase(Wp,t=>{Vt(t)}).addCase(UE,t=>{Vt(t)})});function Vt(e){e.firstResult=Lr().firstResult}function SS(e){let{firstResult:t,numberOfResults:r}=e;return vS(t,r)}function yU(e){let{totalCountFiltered:t,numberOfResults:r}=e;return AS(t,r)}function ru(e,t){return(e-1)*t}function vS(e,t){return Math.round(e/t)+1}function AS(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function SU(e){return e.pagination.firstResult}function QE(e){return e.pagination.numberOfResults}function vU(e){return e.pagination.totalCountFiltered}var Ao=e=>{let t=SU(e),r=QE(e);return vS(t,r)},CS=e=>{let t=vU(e),r=QE(e);return AS(t,r)},BE=(e,t)=>{let r=Ao(e),n=CS(e),o=AU(r,t);return o=CU(o),o=bU(o,n),xU(o)};function AU(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 CU(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function bU(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 xU(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var bS=()=>$e("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Lr().numberOfResults}));var As=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var tm=()=>Z("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Ao(t),...J(t.insightCaseContext)})),rm=()=>Z("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Ao(t),...J(t.insightCaseContext)})),nm=()=>Z("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Ao(t),...J(t.insightCaseContext)}));d();c();l();u();var RU=new Ee({numberOfPages:new ne({default:5,min:0})}),wU=new Ee({page:new ne({min:1})});function GE(e,t={}){if(!IU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=mt(e,RU,t.options,"buildPager"),a=lr(e,wU,t.initialState,"buildPager").page;a&&n(Vl(a));let p=()=>Ao(e.state),f=()=>{let{numberOfPages:h}=o;return BE(e.state,h)},m=()=>CS(e.state);return{...r,get state(){let h=p(),v=m(),C=h>1&&v>0,g=h<v;return{currentPage:h,currentPages:f(),maxPage:v,hasPreviousPage:C,hasNextPage:g}},selectPage(h){n(Gn(h))},nextPage(){n(Ll())},previousPage(){n(Ul())},isCurrentPage(h){return h===this.state.currentPage}}}function IU(e){return e.addReducers({configuration:ve,pagination:vs}),!0}function $E(e,t={}){let{dispatch:r}=e,n=GE(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Pl({legacy:tm(),next:As()}))},nextPage(){n.nextPage(),r(Pl({legacy:rm(),next:As()}))},previousPage(){n.previousPage(),r(Pl({legacy:nm(),next:As()}))}}}d();c();l();u();d();c();l();u();function HE(e){if(!EU(e))throw oe;let t=fe(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function EU(e){return e.addReducers({search:xe}),!0}function zE(e){return HE(e)}d();c();l();u();d();c();l();u();function WE(e){if(!FU(e))throw oe;let t=fe(e),r=hs(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 FU(e){return e.addReducers({search:xe,pagination:vs}),!0}function YE(e){return WE(e)}d();c();l();u();d();c();l();u();function KE(_x225,_x226){return _KE.apply(this,arguments)}function _KE(){_KE=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:i}=e.insightConfiguration,a=e.query?.q||"";return{url:og({url:We(n,o),accessToken:r,organizationId:n,insightId:i}),accessToken:r,organizationId:n,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0}});return _KE.apply(this,arguments)}d();c();l();u();var JE=e=>Z("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ft(e);let n=Ke(e,r),o=Je(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{action:"preview",itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Fr(t)}}});d();c();l();u();function XE(e,t,r,n,o){if(!TU(e))throw oe;let{dispatch:i}=e,a=()=>e.state,p=fe(e),{result:f,maximumPreviewSize:m}=t.options,h=()=>{let{resultsWithPreview:C,position:g}=a().resultPreview;return C[g]},v=C=>{i(Hl({uniqueId:C,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Ac({uniqueId:C,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){v(f.uniqueId)},next(){i(Gl()),v(h())},previous(){i($l()),v(h())},get state(){let C=a(),g=f.hasHtmlVersion,S=C.resultPreview,x=f.uniqueId===S.uniqueId?S.content:"",w=S.isLoading,R=S.contentURL,I=h();return{content:x,resultHasPreview:g,isLoading:w,contentURL:R,currentResultUniqueId:I}}}}function TU(e){return e.addReducers({configuration:ve,resultPreview:va}),!0}function ZE(e,t){if(!PU(e))throw oe;let r=()=>{e.dispatch(JE(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return XE(e,o,(i,a)=>KE(i,a),n,r)}function PU(e){return e.addReducers({configuration:ve,resultPreview:va,insightInterface:Ln}),!0}d();c();l();u();d();c();l();u();var eF=()=>Z("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(J(t.insightCaseContext))),tF=()=>Z("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var kU={queries:new re({required:!0,each:new L({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},nu=T("recentQueries/registerRecentQueries",e=>_(e,kU)),om=T("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function rF(){return{queries:[],maxLength:10}}var nF=ce(rF(),e=>{e.addCase(nu,OU).addCase(om,_U).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||NU(n,t)})});function OU(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 _U(e){e.queries=[]}function NU(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 qU={queries:[]},DU={maxLength:10,clearFilters:!0},MU=new Ee({queries:new re({required:!0})}),jU=new Ee({maxLength:new ne({required:!0,min:1}),clearFilters:new ue});function VU(e,t){mt(e,jU,t?.options,"buildRecentQueriesList"),lr(e,MU,t?.initialState,"buildRecentQueriesList")}function oF(e,t){if(!LU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i={...DU,...t?.options},a={...qU,...t?.initialState};VU(e,{options:i,initialState:a});let p={queries:a.queries,maxLength:i.maxLength};return n(nu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(om())},updateRecentQueries(f){let m=new re({required:!0,each:new L({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(nu({queries:f,maxLength:i.maxLength}))},executeRecentQuery(f){let m=new ne({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let h={q:this.state.queries[f],clearFilters:i.clearFilters};uu(e.state.query?.enableQuerySyntax)&&(h.enableQuerySyntax=e.state.query.enableQuerySyntax),n(ya(h))}}}function LU(e){return e.addReducers({search:xe,recentQueries:nF,query:So}),!0}function iF(e,t){let r=oF(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(eF()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Se({legacy:tF(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var UU={results:new re({required:!0,each:new W({values:ul})}),maxLength:new ne({required:!0,min:1,default:10})},im=T("recentResults/registerRecentResults",e=>_(e,UU)),fn=T("recentResults/pushRecentResult",e=>(Ft(e),{payload:e})),am=T("recentResults/clearRecentResults");d();c();l();u();var aF=e=>Z("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ft(e);let n=J(r.insightCaseContext);return t.logDocumentOpen(Ke(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Fr(t)}}});function sF(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(aF(t.options.result)))};return pn(e,t,()=>{n(),e.dispatch(fn(t.options.result))})}d();c();l();u();function cF(e,t){return Kf(e,{...t,fetchMoreResultsActionCreator:kl})}d();c();l();u();d();c();l();u();var QU=new Ee({numberOfResults:new ne({min:0})});function uF(e,t={}){if(!BU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,a=lr(e,QU,t.initialState,"buildResultsPerPage").numberOfResults;return a!==void 0&&n(Ml(a)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(jl(p))},isSetTo(p){return p===this.state.numberOfResults}}}function BU(e){return e.addReducers({pagination:vs,configuration:ve}),!0}function lF(e,t={}){let r=uF(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Se({legacy:bS(),next:As()}))}}}d();c();l();u();d();c();l();u();var xS=()=>$e("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),sm=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var cm=()=>Z("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var dF={id:G,query:Ye},Cs=T("querySet/register",e=>_(e,dF)),bi=T("querySet/update",e=>_(e,dF));d();c();l();u();var bs=ce(wl(),e=>{e.addCase(Cs,(t,r)=>$U(t,r.payload)).addCase(bi,(t,r)=>{let{id:n,query:o}=r.payload;RS(t,n,o)}).addCase(ho,(t,r)=>{let{id:n,expression:o}=r.payload;RS(t,n,o)}).addCase(Fe.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;pF(t,n)}).addCase(tt,GU).addCase(Ze.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))RS(t,n,o)})});function GU(e,t){te(t.payload.q)||pF(e,t.payload.q)}function pF(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var RS=(e,t,r)=>{t in e&&(e[t]=r)},$U=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var fF=e=>$e("analytics/querySuggest",(t,r)=>{let n=HU(r,e);return t.makeOmniboxAnalytics(n)}),mF=()=>({actionCause:"omniboxAnalytics"});function HU(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 gF(e,t){let r=t.id;r in e||(e[r]=zU(t))}function hF(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function yF(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function SF(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function zU(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var vF=()=>({});var um=ce(vF(),e=>e.addCase(go,(t,r)=>{gF(t,r.payload)}).addCase(PE,(t,r)=>{delete t[r.payload.id]}).addCase(ms.pending,hF).addCase(ms.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(ms.rejected,yF).addCase(yo,(t,r)=>{SF(t,r.payload)}).addCase(Aa,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var AF={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},wS={open:new L,close:new L},WU={id:G,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new ue,highlightOptions:new W({values:{notMatchDelimiters:new W({values:wS}),exactMatchDelimiters:new W({values:wS}),correctionDelimiters:new W({values:wS})}}),clearFilters:new ue},CF=new Ee(WU);function bF(e,t){if(!KU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=t.options?.id||lu("search_box"),a={id:i,highlightOptions:{...t.options?.highlightOptions},...AF,...t.options};mt(e,CF,a,"buildSearchBox"),n(Cs({id:i,query:e.state.query.q})),a.numberOfSuggestions&&n(go({id:i,count:a.numberOfSuggestions})),a.enableQuerySyntax&&n(Ut({enableQuerySyntax:a.enableQuerySyntax}));let p=()=>e.state.querySet[a.id],f=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(m){let{enableQuerySyntax:h,clearFilters:v}=a;n(ya({q:p(),enableQuerySyntax:h,clearFilters:v})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x227){return _ref96.apply(this,arguments)}}();return{...r,updateText(m){n(bi({id:i,query:m})),this.showSuggestions()},clear(){n(bi({id:i,query:""})),n(yo({id:i}))},showSuggestions(){a.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:i}))},selectSuggestion(m){n(ho({id:i,expression:m})),f({legacy:fF({id:i,suggestion:m}),next:mF()}).then(()=>{n(yo({id:i}))})},submit(m=xS(),h){f({legacy:m,next:h}),n(yo({id:i}))},get state(){let m=o(),h=m.querySuggest[a.id],v=YU(h,a.highlightOptions),C=h?h.isLoading:!1;return{searchBoxId:i,value:p(),suggestions:v,isLoading:m.search.isLoading,isLoadingSuggestions:C}}}}function YU(e,t){return e?e.completions.map(r=>({highlightedValue:Um(r.highlighted,t),rawValue:r.expression})):[]}function KU(e){return e.addReducers({query:So,querySuggest:um,configuration:ve,querySet:bs,search:xe}),!0}function xF(e,t={}){let r=bF(e,{...t,executeSearchActionCreator:Se,fetchQuerySuggestionsActionCreator:Ol,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(cm(),sm())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var lm=()=>({actionCause:"resultsSort"});function RF(e,t){return e.q!==t.q?sm():e.sortCriteria!==t.sortCriteria?lm():xs(e.f,t.f)?Rs(e.f,t.f):xs(e.fExcluded,t.fExcluded)?Rs(e.fExcluded,t.fExcluded,!0):xs(e.cf,t.cf)?Rs(e.cf,t.cf):xs(e.af,t.af)?Rs(e.af,t.af):xs(e.nf,t.nf)?Rs(dm(e.nf),dm(t.nf)):xs(e.df,t.df)?Rs(dm(e.df),dm(t.df)):sa()}function xs(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Rs(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(C=>!o.includes(C));if(i.length){let C=i[0];return e[C].length>1?rr():Fn()}if(o.filter(C=>!n.includes(C)).length)return r?Hp():sr();let p=o.find(C=>t[C].filter(g=>e[C].includes(g)));if(!p)return sa();let f=e[p],m=t[p];return m.filter(C=>!f.includes(C)).length?r?Hp():sr():f.filter(C=>!m.includes(C)).length?Fn():sa()}function dm(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 ws=()=>Z("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ir(),...J(t.insightCaseContext)}));function EF(e,t){return e.q!==t.q?cm():e.sortCriteria!==t.sortCriteria?ws():ou(e.f,t.f)?ou(e.cf,t.cf)?ou(e.nf,t.nf)?ou(e.df,t.df)?ou(e.fExcluded,t.fExcluded)?Bn():JU(e.fExcluded,t.fExcluded):IF(e.df,t.df):IF(e.nf,t.nf):pm(e.cf,t.cf):pm(e.f,t.f)}function ou(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function wF(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function pm(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(C=>!o.includes(C));if(i.length){let C=i[0];return e[C].length>1?Dt(C):(r?is:Pr)({facetId:C,facetValue:e[C][0]})}let a=o.filter(C=>!n.includes(C));if(a.length){let C=a[0];return Bt({facetId:C,facetValue:t[C][0]})}let p=o.find(C=>t[C].filter(g=>e[C].includes(g)));if(!p)return Bn();let f=e[p],m=t[p],h=m.filter(C=>!f.includes(C));if(h.length)return Bt({facetId:p,facetValue:h[0]});let v=f.filter(C=>!m.includes(C));return v.length?(r?is:Pr)({facetId:p,facetValue:v[0]}):Bn()}function IF(e={},t={}){return pm(wF(e),wF(t))}function JU(e={},t={}){return pm(e,t,!0)}d();c();l();u();d();c();l();u();var XU=Object.getOwnPropertyNames,ZU=Object.getOwnPropertySymbols,eQ=Object.prototype.hasOwnProperty;function FF(e,t){return function(n,o,i){return e(n,o,i)&&t(n,o,i)}}function fm(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);var i=o.cache,a=i.get(r),p=i.get(n);if(a&&p)return a===n&&p===r;i.set(r,n),i.set(n,r);var f=e(r,n,o);return i.delete(r),i.delete(n),f}}function TF(e){return XU(e).concat(ZU(e))}var tQ=Object.hasOwn||function(e,t){return eQ.call(e,t)};function xi(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var rQ="__v",nQ="__o",oQ="_owner",PF=Object.getOwnPropertyDescriptor,kF=Object.keys;function iQ(e,t,r){var 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 aQ(e,t){return xi(e.getTime(),t.getTime())}function sQ(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function cQ(e,t){return e===t}function OF(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o=new Array(n),i=e.entries(),a,p,f=0;(a=i.next())&&!a.done;){for(var m=t.entries(),h=!1,v=0;(p=m.next())&&!p.done;){if(o[v]){v++;continue}var C=a.value,g=p.value;if(r.equals(C[0],g[0],f,v,e,t,r)&&r.equals(C[1],g[1],C[0],g[0],e,t,r)){h=o[v]=!0;break}v++}if(!h)return!1;f++}return!0}var uQ=xi;function lQ(e,t,r){var n=kF(e),o=n.length;if(kF(t).length!==o)return!1;for(;o-->0;)if(!DF(e,t,r,n[o]))return!1;return!0}function iu(e,t,r){var n=TF(e),o=n.length;if(TF(t).length!==o)return!1;for(var i,a,p;o-->0;)if(i=n[o],!DF(e,t,r,i)||(a=PF(e,i),p=PF(t,i),(a||p)&&(!a||!p||a.configurable!==p.configurable||a.enumerable!==p.enumerable||a.writable!==p.writable)))return!1;return!0}function dQ(e,t){return xi(e.valueOf(),t.valueOf())}function pQ(e,t){return e.source===t.source&&e.flags===t.flags}function _F(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o=new Array(n),i=e.values(),a,p;(a=i.next())&&!a.done;){for(var f=t.values(),m=!1,h=0;(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 fQ(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function mQ(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 DF(e,t,r,n){return(n===oQ||n===nQ||n===rQ)&&(e.$$typeof||t.$$typeof)?!0:tQ(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var gQ="[object Arguments]",hQ="[object Boolean]",yQ="[object Date]",SQ="[object Error]",vQ="[object Map]",AQ="[object Number]",CQ="[object Object]",bQ="[object RegExp]",xQ="[object Set]",RQ="[object String]",wQ="[object URL]",IQ=Array.isArray,NF=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,qF=Object.assign,EQ=Object.prototype.toString.call.bind(Object.prototype.toString);function FQ(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,o=e.areFunctionsEqual,i=e.areMapsEqual,a=e.areNumbersEqual,p=e.areObjectsEqual,f=e.arePrimitiveWrappersEqual,m=e.areRegExpsEqual,h=e.areSetsEqual,v=e.areTypedArraysEqual,C=e.areUrlsEqual;return function(S,x,w){if(S===x)return!0;if(S==null||x==null)return!1;var R=typeof S;if(R!==typeof x)return!1;if(R!=="object")return R==="number"?a(S,x,w):R==="function"?o(S,x,w):!1;var I=S.constructor;if(I!==x.constructor)return!1;if(I===Object)return p(S,x,w);if(IQ(S))return t(S,x,w);if(NF!=null&&NF(S))return v(S,x,w);if(I===Date)return r(S,x,w);if(I===RegExp)return m(S,x,w);if(I===Map)return i(S,x,w);if(I===Set)return h(S,x,w);var E=EQ(S);return E===yQ?r(S,x,w):E===bQ?m(S,x,w):E===vQ?i(S,x,w):E===xQ?h(S,x,w):E===CQ?typeof S.then!="function"&&typeof x.then!="function"&&p(S,x,w):E===wQ?C(S,x,w):E===SQ?n(S,x,w):E===gQ?p(S,x,w):E===hQ||E===AQ||E===RQ?f(S,x,w):!1}}function TQ(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,o={areArraysEqual:n?iu:iQ,areDatesEqual:aQ,areErrorsEqual:sQ,areFunctionsEqual:cQ,areMapsEqual:n?FF(OF,iu):OF,areNumbersEqual:uQ,areObjectsEqual:n?iu:lQ,arePrimitiveWrappersEqual:dQ,areRegExpsEqual:pQ,areSetsEqual:n?FF(_F,iu):_F,areTypedArraysEqual:n?iu:fQ,areUrlsEqual:mQ};if(r&&(o=qF({},o,r(o))),t){var i=fm(o.areArraysEqual),a=fm(o.areMapsEqual),p=fm(o.areObjectsEqual),f=fm(o.areSetsEqual);o=qF({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:p,areSetsEqual:f})}return o}function PQ(e){return function(t,r,n,o,i,a,p){return e(t,r,p)}}function kQ(e){var t=e.circular,r=e.comparator,n=e.createState,o=e.equals,i=e.strict;if(n)return function(f,m){var h=n(),v=h.cache,C=v===void 0?t?new WeakMap:void 0:v,g=h.meta;return r(f,m,{cache:C,equals:o,meta:g,strict:i})};if(t)return function(f,m){return r(f,m,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(f,m){return r(f,m,a)}}var Z4e=mn(),eYe=mn({strict:!0}),tYe=mn({circular:!0}),rYe=mn({circular:!0,strict:!0}),nYe=mn({createInternalComparator:function(){return xi}}),oYe=mn({strict:!0,createInternalComparator:function(){return xi}}),iYe=mn({circular:!0,createInternalComparator:function(){return xi}}),aYe=mn({circular:!0,createInternalComparator:function(){return xi},strict:!0});function mn(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,o=e.createState,i=e.strict,a=i===void 0?!1:i,p=TQ(e),f=FQ(p),m=n?n(f):PQ(f);return kQ({circular:r,comparator:f,createState:o,equals:m,strict:a})}function MF(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function OQ(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>IS(r,n))!==-1)}var IS=mn({createCustomConfig:e=>({...e,areArraysEqual:OQ})});d();c();l();u();d();c();l();u();function jF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function VF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{sortCriteria:n}:{}}function mm(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 LF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function UF(e){return{q:at().q,enableQuerySyntax:at().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??An().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??An().defaultFilters.cq,firstResult:Lr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Lr().defaultNumberOfResults,sortCriteria:ir(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:xl(),sf:{},tab:"",af:{},mnf:{}}}var _Q=new Ee({parameters:new W({options:{required:!0},values:gd})});function BF(e,t){let{dispatch:r}=e,n=fe(e);lr(e,_Q,t.initialState,"buildSearchParameterManager");let o=QF(e.state.tabSet,t.initialState.parameters);return r(tt(o)),{...n,synchronize(i){let a=QF(e.state.tabSet,gm(e,i));r(tt(a))},get state(){return{parameters:ES(e)}}}}function gm(e,t){return{...UF(e.state),...t}}function QF(e,t){if(t.tab&&e){let r=Object.values(e).some(o=>o.id===t.tab),n=Object.values(e).find(o=>o.isActive);if(!r&&n)return{...t,tab:n.id};if(!r)return{...t,tab:""}}return t}function ES(e){let t=e.state;return{...jF(t.query,r=>r.q,at().q),...LF(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]:""),...VF(t.sortCriteria,r=>r,ir()),...qQ(t),...DQ(t),...MQ(t),...jQ(t),...VQ(t)}}function NQ(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function hm(e){let t=NQ(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,i=tr(n?.tabs,t);return o&&i}}function GF(e){return e.currentValues.filter(t=>t.state==="selected")}function qQ(e){let t=e.facetSet;if(t===void 0)return{};let r=hm(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 DQ(e){return mm(e.categoryFacetSet,hm(e),t=>Dr(t.currentValues).map(r=>r.value),"cf")}function MQ(e){return mm(e.numericFacetSet,hm(e),GF,"nf")}function jQ(e){return mm(e.dateFacetSet,hm(e),GF,"df")}function VQ(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let i=LQ(o);return i.length?{[n]:i}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function LQ(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function $F(e,t){let{dispatch:r}=e,n=BF(e,t);return{...n,synchronize(o){let i=ES(e),a=gm(e,i),p=gm(e,o);IS(a,p)||(n.synchronize(o),r(Se({legacy:EF(a,p),next:RF(a,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var au=()=>new W({values:{questionAnswerId:G},options:{required:!0}}),ym=()=>new W({values:{linkText:Ye,linkURL:Ye},options:{required:!0}});function Ri(e){return _(e,au())}d();c();l();u();function pt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Lb(e,r.contentIdKey,r.contentIdValue)}function Ar(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var HF={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var UQ=()=>Z("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(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}}}}),QQ=()=>Z("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(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}}}}),BQ=()=>Z("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(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}}}}),GQ=()=>Z("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(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}}}}),$Q=()=>Z("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=pt(t);return e.logOpenSmartSnippetSource(Ke(r,t),Je(r),J(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=pt(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}}}}),FS=e=>Z("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,ym());let n=pt(r);return t.logOpenSmartSnippetInlineLink(Ke(n,r),{...Je(n),...e},J(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=pt(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}}}}),HQ=()=>Z("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(J(t.insightCaseContext))),zQ=()=>Z("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(J(t.insightCaseContext))),WQ=e=>Z("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=pt(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:HF[e]}}}),YQ=e=>Z("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=pt(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}}}),KQ=e=>Z("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Ri(e);let n=Ar(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=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(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}}}}}),JQ=e=>Z("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Ri(e);let n=Ar(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=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(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}}}}}),TS=e=>Z("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,au());let n=Ar(r,e.questionAnswerId);if(!n)return null;let o=pt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Ke(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),zF=(e,t)=>Z("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,au()),_(t,ym());let o=Ar(n,e.questionAnswerId);if(!o)return null;let i=pt(n,o.documentId);return i?r.logOpenSmartSnippetSuggestionInlineLink(Ke(i,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=Ar(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let i=pt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:i?.title,url:i?.clickUri}}}}}),Sm={logExpandSmartSnippet:UQ,logCollapseSmartSnippet:QQ,logLikeSmartSnippet:BQ,logDislikeSmartSnippet:GQ,logOpenSmartSnippetSource:$Q,logOpenSmartSnippetInlineLink:FS,logOpenSmartSnippetFeedbackModal:HQ,logCloseSmartSnippetFeedbackModal:zQ,logSmartSnippetFeedback:WQ,logSmartSnippetDetailedFeedback:YQ,logExpandSmartSnippetSuggestion:KQ,logCollapseSmartSnippetSuggestion:JQ,logOpenSmartSnippetSuggestionSource:TS};d();c();l();u();d();c();l();u();var Is=T("smartSnippet/expand"),Es=T("smartSnippet/collapse"),Fs=T("smartSnippet/like"),Ts=T("smartSnippet/dislike"),Ps=T("smartSnippet/feedbackModal/open"),Co=T("smartSnippet/feedbackModal/close"),ks=T("smartSnippet/related/expand",e=>Ri(e)),Os=T("smartSnippet/related/collapse",e=>Ri(e));d();c();l();u();d();c();l();u();var PS=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var WF=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function YF({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Oi({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function XQ(e,t){let r=YF(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var gn=ce(PS(),e=>e.addCase(Is,t=>{t.expanded=!0}).addCase(Es,t=>{t.expanded=!1}).addCase(Fs,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Ts,t=>{t.liked=!1,t.disliked=!0}).addCase(Ps,t=>{t.feedbackModalOpen=!0}).addCase(Co,t=>{t.feedbackModalOpen=!1}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((i,a)=>XQ(i,t.relatedQuestions[a])),o=YF(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...PS(),relatedQuestions:n,questionAnswerId:o}}).addCase(ks,(t,r)=>{let n=WF(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Os,(t,r)=>{let n=WF(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function KF(e,t,r){if(!ZQ(e))throw oe;let n=fe(e),o=()=>e.state,i=()=>pt(o()),a=null,p=pn(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(fn(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(Is())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Es())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Fs())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Ts())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Ps())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Co())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(Co())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(Co())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function ZQ(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}d();c();l();u();function vm(e,t){if(!eB(e))throw oe;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,v,C)=>pn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(v)||e.dispatch(C?zF({questionAnswerId:C},h):FS(h))}),f={},m=(h,v)=>{let{searchResponseId:C}=r().search;a(C);let g=Oi({...h,questionAnswerId:v});return g in f||(f[g]=p(h,g,v)),f[g]};return{selectInlineLink(h,v){m(h,v)?.select()},beginDelayedSelectInlineLink(h,v){m(h,v)?.beginDelayedSelect()},cancelPendingSelectInlineLink(h,v){m(h,v)?.cancelPendingSelect()}}}function eB(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}function JF(e,t){let r=KF(e,Sm,t),n=vm(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 XF(e,t){if(!tB(e))throw oe;let r=fe(e),n=()=>e.state,o=i=>{let{contentIdKey:a,contentIdValue:p}=i;return e.state.search.results.find(f=>Jn(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(ks(a))},collapse(i){let a={questionAnswerId:i};e.dispatch(t.logCollapseSmartSnippetSuggestion(a)),e.dispatch(Os(a))}}}function tB(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}d();c();l();u();function ZF(e,t){if(!rB(e))throw oe;let r=()=>e.state,n=v=>{let C=r(),g=Ar(C,v);return g?pt(C,g.documentId):null},o=new Set,i=v=>o.has(v)?!0:(o.add(v),!1),a=null,p=v=>{a!==v&&(a=v,m={},o.clear())},f=(v,C)=>pn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{i(C)||(e.dispatch(TS({questionAnswerId:C})),e.dispatch(fn(v)))}),m={},h=v=>{let{searchResponseId:C}=r().search;p(C);let g=n(v);return g?(v in m||(m[v]=f(g,v)),m[v]):null};return{selectSource(v){h(v)?.select()},beginDelayedSelectSource(v){h(v)?.beginDelayedSelect()},cancelPendingSelectSource(v){h(v)?.cancelPendingSelect()}}}function rB(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}function eT(e,t){let r=XF(e,Sm),n=vm(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=ZF(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 tT={by:new Us({enum:nl,required:!0})},Am=T("sortCriteria/register",e=>rT(e)),Cm=T("sortCriteria/update",e=>rT(e)),rT=e=>ki(e)?(e.forEach(t=>_(t,tT)),{payload:e}):_(e,tT);d();c();l();u();var nT=ce(ir(),e=>{e.addCase(Am,(t,r)=>Mr(r.payload)).addCase(Cm,(t,r)=>Mr(r.payload)).addCase(Ze.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(tt,(t,r)=>r.payload.sortCriteria??t)});function nB(e,t){if(!t)return;let r=new Ee({criterion:new re({each:xC})}),n=oB(t),o={...t,criterion:n};lr(e,r,o,"buildSort")}function oB(e){return e.criterion?ki(e.criterion)?e.criterion:[e.criterion]:[]}function oT(e,t){if(!iB(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state;nB(e,t.initialState);let i=t.initialState?.criterion;return i&&n(Am(i)),{...r,sortBy(a){n(Cm(a)),n(Gn(1))},isSortedBy(a){return this.state.sortCriteria===Mr(a)},get state(){return{sortCriteria:o().sortCriteria}}}}function iB(e){return e.addReducers({configuration:ve,sortCriteria:nT}),!0}function iT(e,t={}){let{dispatch:r}=e,n=oT(e,t),o=()=>r(Se({legacy:ws(),next:lm()}));return{...n,get state(){return n.state},sortBy(i){n.sortBy(i),o()}}}d();c();l();u();function aT(e){return hs(e)}d();c();l();u();d();c();l();u();var aB=new Ee({expression:Ye,id:G,clearFiltersOnTabChange:new ue}),sB=new Ee({isActive:new ue});function sT(e,t){if(uB(t.options.id),!cB(e))throw oe;let r=fe(e),{dispatch:n}=e;mt(e,aB,t.options,"buildTab");let o=lr(e,sB,t.initialState,"buildTab"),{id:i,expression:a}=t.options;return n(yd({id:i,expression:a})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(Tt(i)),{...r,select(){t.options.clearFiltersOnTabChange&&n(ya({q:"",clearFilters:!0})),n(Tt(i))},get state(){return{isActive:e.state.tabSet[i]?.isActive}}}}function cB(e){return e.addReducers({configuration:ve,tabSet:Af}),!0}function uB(e){let t=vd().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 cT(e,t){let{dispatch:r}=e,n=sT(e,t),o=()=>r(Se({legacy:Bn(),next:sa()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var uT=()=>Z("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 lT(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function dT(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 pT(e,t){return e.queryModification={...t,queryToIgnore:""},e}function fT(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var mT=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var gT=ce(mT(),e=>e.addCase(Fe.pending,lT).addCase(Fe.fulfilled,(t,r)=>dT(t,r.payload.response.triggers)).addCase(ha,(t,r)=>pT(t,r.payload)).addCase(ga,(t,r)=>fT(t,r.payload)));function hT(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!lB(e))throw oe;let n=fe(e),{dispatch:o}=e,i=()=>e.state,a=i().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!MF(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 lB(e){return e.addReducers({triggers:gT}),!0}function yT(e){return hT(e,{options:{logNotifyTriggerActionCreator:uT}})}d();c();l();u();d();c();l();u();var ST=(e,t)=>Z("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=J(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=J(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),vT=e=>Z("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:G}),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}}}}),bm=()=>Z("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(J(t.insightCaseContext))});d();c();l();u();d();c();l();u();var AT=/*#__PURE__*/function(){var _ref97=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),userId:t}});return function AT(_x228,_x229){return _ref97.apply(this,arguments)}}();var dB={ticketCreationDate:new L({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new re({required:!1,each:He})},_s=T("insight/userActions/registerUserActions",e=>_(e,dB)),bo=le("insight/userActions/fetch",/*#__PURE__*/function(){var _ref98=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.userActions(yield AT(o,e));return Ge(i)?r(i.error):{response:i.success}});return function(_x230,_x231){return _ref98.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function CT(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var pB=1e3,fB=pB*60,kS=30*fB,mB=2,gB=2,RT=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,i=yB(t);return vB(i,n,o)},hB=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}},yB=e=>{let t=!1,r=e.reduce((n,o)=>{try{let i=hB(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},SB=(e,t)=>Math.abs(e.timestamp-t)<kS,bT=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-kS&&t<=e.end+kS){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)},xT=(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},vB=(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(SB(i,o.start)){o.actions.push(i),o.start=i.timestamp;return}o.actions=o.actions.filter(a=>!xT(a,r)),bT(o,t,n),o={start:i.timestamp,end:i.timestamp,actions:[i]}}),o.actions=o.actions.filter(i=>!xT(i,r)),bT(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,mB),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-gB)}};var xm=ce(CT(),e=>{e.addCase(_s,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(bo.pending,t=>{t.loading=!0,t.error=void 0}).addCase(bo.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(bo.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=RT(t,r.payload.response.value)})});function wT(e,t){if(!AB(e))throw oe;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=fe(e),{ticketCreationDate:i,excludedCustomActions:a}=t.options;return r(_s({ticketCreationDate:i,excludedCustomActions:a})),{...o,get state(){return n()},fetchUserActions(p){r(bo(p))},logOpenUserActions(){r(bm())}}}function AB(e){return e.addReducers({configuration:ve,insightUserActions:xm}),!0}d();c();l();u();function IT(e){if(!CB(e))throw oe;let t=fe(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(jr())}}}function CB(e){return e.addReducers({configuration:ve,insightConfiguration:ml,insightInterface:Ln,searchHub:Wl}),!0}d();c();l();u();function bB(e){return e.addReducers({}),{logSearchEvent:qC,logClickEvent:DC,logCustomEvent:MC}}d();c();l();u();d();c();l();u();var ET=e=>Z("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ft(e);let n=J(r.insightCaseContext);return t.logCopyToClipboard(Ke(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Fr(t)}}}),FT=e=>Z("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ft(e);let n=J(r.insightCaseContext);return t.logCaseSendEmail(Ke(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Fr(t)}}}),TT=e=>Z("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ft(e);let n=J(r.insightCaseContext);return t.logFeedItemTextPost(Ke(e,r),Je(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Fr(t)}}});function xB(e){return e.addReducers({}),{logClearBreadcrumbs:Jp,logInterfaceLoad:El,logInterfaceChange:Bn,logCreateArticle:vT,logCategoryFacetBreadcrumb:Mp,logFacetBreadcrumb:zc,logFacetClearAll:Dt,logFacetDeselect:Pr,logFacetSelect:Bt,logFacetShowLess:ss,logFacetShowMore:as,logFacetUpdateSort:rn,logDateFacetBreadcrumb:Wc,logNumericFacetBreadcrumb:Yc,logPageNext:rm,logPageNumber:tm,logPagePrevious:nm,logResultsSort:ws,logStaticFilterDeselect:hf,logCopyToClipboard:ET,logCaseSendEmail:FT,logFeedItemTextPost:TT,logOpenUserActions:bm}}d();c();l();u();function RB(e){return e.addReducers({attachedResults:co}),{setAttachedResults:Np,detachResult:so,attachResult:ao}}d();c();l();u();function wB(e){return e.addReducers({attachedResults:co}),{logCaseDetach:Ka,logCaseAttach:Ya}}d();c();l();u();d();c();l();u();d();c();l();u();var Rm=T("insight/caseContext/set",e=>{let t=new W({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new re({each:Ye}),i=_(n,o).error;return i?{payload:e,error:i}:{payload:e}}),wm=T("insight/caseId/set",e=>{let r=_(e,Ye).error;return r?{payload:e,error:r}:{payload:e}}),Im=T("insight/caseNumber/set",e=>{let r=_(e,Ye).error;return r?{payload:e,error:r}:{payload:e}});var PT=ce(fb(),e=>{e.addCase(Rm,(t,r)=>{t.caseContext=r.payload}).addCase(wm,(t,r)=>{t.caseId=r.payload}).addCase(Im,(t,r)=>{t.caseNumber=r.payload})});function IB(e){return e.addReducers({insightCaseContext:PT}),{setCaseContext:Rm,setCaseId:wm,setCaseNumber:Im}}d();c();l();u();d();c();l();u();d();c();l();u();var EB=new re({each:G,required:!0}),kT=(e,t)=>(_(e,G),Pi(t)?_(t,G):_(t,EB),{payload:{contextKey:e,contextValue:t}}),Em=T("context/set",e=>{for(let[t,r]of Object.entries(e))kT(t,r);return{payload:e}}),Fm=T("context/add",e=>kT(e.contextKey,e.contextValue)),Tm=T("context/remove",e=>_(e,G));var OT=ce(bl(),e=>{e.addCase(Em,(t,r)=>{t.contextValues=r.payload}).addCase(Fm,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Tm,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ze.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function FB(e){return e.addReducers({context:OT}),{addContext:Fm,removeContext:Tm,setContext:Em}}d();c();l();u();function TB(e){return e.addReducers({dateFacetSet:cn}),{deselectAllDateFacetValues:ef,registerDateFacet:nn,toggleSelectDateFacetValue:on,toggleExcludeDateFacetValue:an,updateDateFacetSortCriterion:Zp,updateDateFacetValues:Pn}}d();c();l();u();function PB(e){return e.addReducers({numericFacetSet:fo}),{deselectAllNumericFacetValues:mf,registerNumericFacet:un,toggleSelectNumericFacetValue:ln,toggleExcludeNumericFacetValue:dn,updateNumericFacetSortCriterion:ff,updateNumericFacetValues:kn}}d();c();l();u();function kB(e){return e.addReducers({fields:gs}),{registerFieldsToInclude:vo,enableFetchAllFields:zf,disableFetchAllFields:Wf,fetchFieldsDescription:Yf}}d();c();l();u();function OB(e){return e.addReducers({folding:Hf}),{registerFolding:IE,loadCollection:Bf}}d();c();l();u();function _B(e){return e.addReducers({generatedAnswer:ys}),{generateAnswer:pd,resetAnswer:ar,setAnswerGenerationMode:ed}}d();c();l();u();function NB(e){return e.addReducers({insightInterface:Ln}),{fetch:jr}}d();c();l();u();function qB(e){return e.addReducers({querySet:bs}),{registerQuerySetQuery:Cs,updateQuerySetQuery:bi}}d();c();l();u();function DB(e){return e.addReducers({search:xe}),{executeSearch:Sb,fetchFacetValues:Cb,fetchMoreResults:Ab,fetchPage:vb,fetchQuerySuggestions:Ol,registerQuerySuggest:go}}d();c();l();u();function MB(e){return e.addReducers({}),{logContextChanged:mb,logExpandToFullUI:ST}}d();c();l();u();function jB(e){return e.addReducers({insightUserActions:xm}),{registerUserActions:_s,fetchUserActions:bo}}d();c();l();u();function VB(e){return e.addReducers({querySuggest:um,querySet:bs}),{clearQuerySuggest:yo,fetchQuerySuggestions:ms,registerQuerySuggest:go,selectQuerySuggestion:ho}}d();c();l();u();function LB(e){return e.addReducers({questionAnswering:gn}),{collapseSmartSnippet:Es,expandSmartSnippet:Is,dislikeSmartSnippet:Ts,likeSmartSnippet:Fs,openFeedbackModal:Ps,closeFeedbackModal:Co,expandSmartSnippetRelatedQuestion:ks,collapseSmartSnippetRelatedQuestion:Os}}d();c();l();u();d();c();l();u();d();c();l();u();function _T(){return{results:[],maxLength:10}}var NT=ce(_T(),e=>{e.addCase(im,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(am,t=>{t.results=[]}).addCase(fn,(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 UB(e){return e.addReducers({recentResults:NT}),{registerRecentResults:im,clearRecentResults:am,pushRecentResult:fn}}d();c();l();u();d();c();l();u();var QB=new Ee({content:new Be({required:!0}),conditions:new Be({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new re({required:!1,each:G})});function qT(){let e=[],t=r=>{let n=QB.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new xo("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 DT(e){if(!BB(e))throw oe;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=qT();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(vo(i))},selectTemplate:r,selectLinkTemplate:n}}function BB(e){return e.addReducers({fields:gs}),!0}/**
44
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Dp(e){e==="next"&&console.warn(aV)}d();c();l();u();var Xw=Cr(Kw(),1);function Jw(e){return(0,Xw.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function Zw(e,t){let r=RV(e),n=ur,o=wV(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function RV(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function wV(e){return e.preprocessRequest||wu}d();c();l();u();d();c();l();u();var eI={organizationId:G,accessToken:G,name:new L({required:!1,emptyAllowed:!1}),analytics:new W({options:{required:!1},values:{enabled:new ue({required:!1}),originContext:new L({required:!1}),originLevel2:new L({required:!1}),originLevel3:new L({required:!1}),analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new L({required:!1,url:!0}),trackingId:new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new L({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function tI(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var rI=new Ee({...eI,insightId:G,search:new W({options:{required:!1},values:{locale:He}})}),IV="2729db39-d7fd-4504-a06e-668c64968c95";function mS(){return{...tI(),insightId:IV}}var EV={insightConfiguration:Al,search:xe,insightInterface:Un,searchHub:Kl,resultPreview:Ca};function nI(e){let t=Jw(e.loggerOptions);FV(e.configuration,t);let r=TV(e.configuration,t),n=PV(t),o={...Zw(e.configuration,t),apiClient:r,streamingClient:n},i={...e,reducers:EV},a=Qw(i,o);Dp(a.state.configuration.analytics.analyticsMode);let{insightId:p,search:f}=e.configuration;return a.dispatch(vl({insightId:p})),a.dispatch(jr()),f&&a.dispatch(pa(f)),{...a,get state(){return a.state},executeFirstSearch(m=Tl()){Yl(a.state)||a.dispatch(Se({legacy:m,next:ib()}))}}}function FV(e,t){try{rI.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function TV(e,t){return new Iu({logger:t,preprocessRequest:e.preprocessRequest||wu})}function PV(e){return new Ru({logger:e})}d();c();l();u();function fe(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 oI={articleLanguage:He,articlePublishStatus:He,articleVersionNumber:He,caseId:G,knowledgeArticleId:He,name:He,permanentId:He,resultUrl:He,source:He,title:G,uriHash:He,isAttachedFromCitation:new ue({required:!1,default:!1})},kV=new W({options:{required:!0},values:oI}),Vp=T("insight/attachToCase/setAttachedResults",e=>_(e,{results:new re({each:kV}),loading:new ue({required:!1,default:!1})})),ao=T("insight/attachToCase/attach",e=>iI(e)),so=T("insight/attachToCase/detach",e=>iI(e)),iI=e=>te(e.permanentId)&&te(e.uriHash)?{payload:e,error:br(new xo("Either permanentId or uriHash is required"))}:_(e,oI);d();c();l();u();d();c();l();u();var Fr=e=>{let t=X(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var Ka=e=>Z("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ft(e);let n=X(r.insightCaseContext);return t.logCaseAttach(Ke(e,r),Xe(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Fr(t)}}}),Xa=e=>Z("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,X(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:xr(e,t),context:Fr(t)})});d();c();l();u();d();c();l();u();function aI(){return{results:[],loading:!1}}var co=ce(aI(),e=>{e.addCase(Vp,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(ao,(t,r)=>{(!te(r.payload.permanentId)||!te(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(so,(t,r)=>{t.results=t.results.filter(n=>OV(n,r.payload))})}),OV=(e,t)=>{let r=!te(e.permanentId)&&e?.permanentId===t?.permanentId,n=!te(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Lp=(e,t)=>Oi(e.raw[t])?String(e.raw[t]):void 0,Ja=(e,t)=>({articleLanguage:Lp(e,"sflanguage"),articleVersionNumber:Lp(e,"sflanguage"),articlePublishStatus:Lp(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Lp(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function sI(e,t){if(!_V(e))throw oe;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=fe(e),{result:i,caseId:a}=t.options,p=()=>te(a)||te(i.raw.permanentid)&&te(i.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=a===f.caseId,h=!te(f.permanentId)&&f.permanentId===i.raw.permanentid,A=!te(f.uriHash)&&f.uriHash===i.raw.urihash;return m&&(h||A)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(ao(Ja(i,a))),r(Ka(i))},detach(){r(so(Ja(i,a))),r(Xa(i))}}}function _V(e){return e.addReducers({configuration:ve,attachedResults:co}),!0}d();c();l();u();function cI(e,t){if(!NV(e))throw oe;let{dispatch:r}=e,n=fe(e),{caseId:o}=t.options,i=p=>te(o)||te(p.raw.permanentid)&&te(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,h=!te(f.permanentId)&&f.permanentId===p.raw.permanentid,A=!te(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(h||A)}),a=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:a(),loading:e.state.attachedResults.loading}},isAttached(p){return i(p)},attach(p){r(ao(Ja(p,o))),r(Ka(p))},detach(p){r(so(Ja(p,o))),r(Xa(p))}}}function NV(e){return e.addReducers({configuration:ve,attachedResults:co}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ge=G;d();c();l();u();var qV={state:new Be({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new L({required:!0,emptyAllowed:!0}),path:new re({required:!0,each:G}),moreValuesAvailable:new ue({required:!1})};function gS(e){e.children.forEach(t=>{gS(t)}),ur({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},qV)}var Za={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),delimitingCharacter:new L({required:!1,emptyAllowed:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),basePath:new re({required:!1,each:G}),filterByBasePath:new ue({required:!1})};var es=T("categoryFacet/register",e=>_(e,Za)),ts=T("categoryFacet/toggleSelectValue",e=>{try{return ur(e.facetId,G),gS(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),uo=T("categoryFacet/deselectAll",e=>_(e,Za.facetId)),Qc=T("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:Za.facetId,numberOfValues:Za.numberOfValues})),Up=T("categoryFacet/updateSortCriterion",e=>_(e,{facetId:Za.facetId,criterion:new Be})),uI=T("categoryFacet/updateBasePath",e=>_(e,{facetId:Za.facetId,basePath:new re({each:G})}));d();c();l();u();var BRe={categoryFacetId:ge,categoryFacetPath:new re({required:!0,each:G})};var lI=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var DV={categoryFacetId:ge,categoryFacetPath:new re({required:!0,each:G})},MV=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,i=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:i}},Qp=e=>Z("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,DV);let n={...MV(r,e),...X(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Qe=T("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new ue({required:!1})})),er=T("facetOptions/facet/enable",e=>_(e,ge)),dt=T("facetOptions/facet/disable",e=>_(e,ge));d();c();l();u();var tr=(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 Bc={facetId:ge,captions:new W({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new L({required:!1,emptyAllowed:!0})};var jV={path:new re({required:!0,each:G}),displayValue:Ye,rawValue:Ye,count:new ne({required:!0,min:0})},Bp=T("categoryFacet/selectSearchResult",e=>_(e,{facetId:ge,value:new W({values:jV})})),dI=T("categoryFacetSearch/register",e=>_(e,Bc));d();c();l();u();function rs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function ns(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Gp(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Gc(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function $p(e,t,r){e.currentValues=VV(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function VV(e,t){if(!e.length)return[];let r=pI(e[0],t),n=r;for(let o of e.splice(1)){let i=pI(o,t);n.children.push(i),n=i}return n.state="selected",n.retrieveChildren=!0,[r]}function pI(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Hp=ce(ra(),e=>{e.addCase(es,(t,r)=>{let n=r.payload,{facetId:o,tabs:i}=n;if(o in t)return;let a=UV(n),p=a.numberOfValues;t[o]={request:a,initialNumberOfValues:p,tabs:i}}).addCase(Ze.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(tt,(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)&&!tr(a.tabs,o)){p.currentValues.length&&$p(p,[],a.initialNumberOfValues);return}let m=n[i]||[];(m.length||p.currentValues.length)&&$p(p,m,a.initialNumberOfValues)})}).addCase(Up,(t,r)=>{let{facetId:n,criterion:o}=r.payload,i=t[n]?.request;i&&(i.sortCriteria=o)}).addCase(uI,(t,r)=>{let{facetId:n,basePath:o}=r.payload,i=t[n]?.request;i&&(i.basePath=[...o])}).addCase(ts,(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=LV(a,f,i);if(m.length){let A=m[0];A.retrieveChildren=!0,A.state="selected",A.previousState="idle",A.children=[];return}let h=mI(o.value,i);h.state="selected",h.previousState="idle",m.push(h),a.numberOfValues=1}).addCase(uo,(t,r)=>{let n=r.payload;Gc(t,n)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>Gc(t,r))}).addCase(ga,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(Qc,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,i=t[n]?.request;if(i){if(!i.currentValues.length)return Gp(i,o);QV(t,r.payload)}}).addCase(Bp,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n];if(!i)return;let a=[...o.path,o.rawValue];$p(i.request,a,i.initialNumberOfValues)}).addCase(Aa.fulfilled,(t,r)=>{fI(t,r.payload.response.facets)}).addCase(Fe.fulfilled,(t,r)=>{fI(t,r.payload.response.facets)}).addCase(dt,(t,r)=>{Gc(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&Gc(t,o)})})}),hS={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function LV(e,t,r){let n=e.currentValues;for(let o of t){let i=n[0];(!i||o!==i.value)&&(i=mI(o,r),n.length=0,n.push(i)),i.retrieveChildren=!1,i.previousState=void 0,i.state="idle",n=i.children}return n}function UV(e){return{...hS,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function mI(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function fI(e,t){t.forEach(r=>{if(!BV(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let i=GV(o,r);o.currentValues=i?[]:o.currentValues,o.preventAutoSelect=!1})}function QV(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 BV(e,t){return t.facetId in e}function GV(e,t){let r=Dr(e.currentValues),n=Dr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var Jr=new L({regex:/^[a-zA-Z0-9-_]+$/}),Zr=new L({required:!0}),gI=new re({each:new L}),hI=new L,yI=new ue,en=new ue,tn=new ne({min:0}),Tr=new ne({min:1}),zp=new ue({required:!0}),$V=new W,HV=new L,zV={captions:$V,numberOfValues:Tr,query:HV},os=new W({values:zV}),Wp=new W({options:{required:!1},values:{type:new L({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new re({required:!0,max:25,each:new L({emptyAllowed:!1,required:!0})})}}),mIe=new ue,Yp=new re({min:1,max:25,required:!1,each:new L({emptyAllowed:!1,required:!0})});d();c();l();u();var Si={value:G,numberOfResults:new ne({min:0}),state:G};var WV={facetId:ge,field:new L({required:!0,emptyAllowed:!0}),tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),resultsMustMatch:new Be({required:!1}),allowedValues:Wp,customSort:Yp},is=T("facet/register",e=>_(e,WV)),lo=T("facet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Si})})),po=T("facet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Si})})),ht=T("facet/deselectAll",e=>_(e,ge)),Kp=T("facet/updateSortCriterion",e=>_(e,{facetId:ge,criterion:new Be({required:!0})})),$c=T("facet/updateNumberOfValues",e=>_(e,{facetId:ge,numberOfValues:new ne({required:!0,min:1})})),Hc=T("facet/updateIsFieldExpanded",e=>_(e,{facetId:ge,isFieldExpanded:new ue({required:!0})})),vi=T("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ge,freezeCurrentValues:new ue({required:!0})}));d();c();l();u();var as=e=>$e("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o=aa(e,n);return t.makeFacetUnexclude(o)});var rr=()=>({actionCause:"facetClearAll"}),sr=()=>({actionCause:"facetSelect"}),Xp=()=>({actionCause:"facetExclude"}),Fn=()=>({actionCause:"facetDeselect"});var yS=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var ss=e=>Z("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ge);let n={...No(e,Wt(r)),...X(r.insightCaseContext)};return t.logFacetShowMore(n)}),cs=e=>Z("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ge);let n={...No(e,Wt(r)),...X(r.insightCaseContext)};return t.logFacetShowLess(n)}),rn=e=>Z("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ge,sortCriterion:new Be({required:!0})});let{facetId:n,sortCriterion:o}=e,i=Wt(r),p={...No(n,i),criteria:o,...X(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Dt=e=>Z("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ge);let n=Wt(r),o={...No(e,n),...X(r.insightCaseContext)};return t.logFacetClearAll(o)}),Bt=e=>Z("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o={...aa(e,n),...X(r.insightCaseContext)};return t.logFacetSelect(o)}),Pr=e=>Z("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n=Wt(r),o={...aa(e,n),...X(r.insightCaseContext)};return t.logFacetDeselect(o)}),zc=e=>Z("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ge,facetValue:G});let n={...aa(e,Wt(r)),...X(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var SI={facetId:ge,value:new W({values:{displayValue:Ye,rawValue:Ye,count:new ne({required:!0,min:0})}})},vI=T("facetSearch/register",e=>_(e,Bc)),Jp=T("facetSearch/update",e=>_(e,Bc)),Zp=T("facetSearch/toggleSelectValue",e=>_(e,SI)),ef=T("facetSearch/toggleExcludeValue",e=>_(e,SI));var us=ce(ia(),e=>{e.addCase(is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=OC(YV(r.payload),o))}).addCase(Ze.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(tt,(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,A=p.currentValues.filter(S=>!f.includes(S.value)&&!m.includes(S.value));p.currentValues=[...f.map(CI),...m.map(bI),...A.map(XV)],p.preventAutoSelect=h>0,p.numberOfValues=Math.max(h,p.numberOfValues)})}).addCase(lo,(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){tf(i,o);return}let p=a.state==="selected";a.previousState=a.state,a.state=p?"idle":"selected",i.freezeCurrentValues=!0}).addCase(po,(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){tf(i,o);return}let p=a.state==="excluded";a.previousState=a.state,a.state=p?"idle":"excluded",i.freezeCurrentValues=!0}).addCase(vi,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,i=t[n]?.request;i&&(i.freezeCurrentValues=o)}).addCase(ht,(t,r)=>{ns(t[r.payload]?.request)}).addCase(Kt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>ns(r))}).addCase(ql,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>ns(r))}).addCase(ga,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Kp,(t,r)=>{rs(t,r.payload)}).addCase($c,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Gp(t[n]?.request,o)}).addCase(Hc,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,i=t[n]?.request;i&&(i.isFieldExpanded=o)}).addCase(Fe.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>AI(t[o.facetId]?.request,o))}).addCase(Aa.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>AI(t[o.facetId]?.request,o))}).addCase(Zp,(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=CI(a);tf(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(ef,(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=bI(a);tf(i,m),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(dt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];ns(n)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&ns(i.request)})})});function tf(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 AI(e,t){e&&(e.currentValues=t.values.map(KV),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var SS={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function YV(e){return{...SS,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function KV(e){let{value:t,state:r}=e;return{value:t,state:r}}function CI(e){return{value:e,state:"selected"}}function bI(e){return{value:e,state:"excluded"}}function XV(e){return{...e,state:"idle"}}d();c();l();u();var rf=()=>Z("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(X(t.insightCaseContext)));d();c();l();u();d();c();l();u();function ls(e){let t=xI(e.start,e),r=xI(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function xI(e,t){let{dateFormat:r}=t;return Ov(e)?(bu(e),Tv(e)):typeof e=="string"&&_n(e)?(bu(e),e):(wv(e,r),Cu(Mi(e,r)))}d();c();l();u();var ds=T("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ge,criterion:new Be({required:!0})}));d();c();l();u();var Ai={state:G,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ue({required:!0}),numberOfResults:new ne({required:!0,min:0})},Ci={start:G,end:G,endInclusive:new ue({required:!0}),state:G,numberOfResults:new ne({required:!0,min:0})},Tn=e=>({facetId:ge,selection:typeof e.start=="string"?new W({values:Ci}):new W({values:Ai})});var JV={start:G,end:G,endInclusive:new ue({required:!0}),state:G},ZV={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),currentValues:new re({required:!1,each:new W({values:JV})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function RI(e){return _n(e)?Hs(e):e}function nf(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=ls(t);if(Mi(RI(r)).isAfter(Mi(RI(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var nn=T("dateFacet/register",e=>{try{return ur(e,ZV),nf(e),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),on=T("dateFacet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Ci})})),an=T("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Ci})})),Pn=T("dateFacet/updateFacetValues",e=>{try{return ur(e,{facetId:ge,values:new re({each:new W({values:Ci})})}),nf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),of=ds,af=ht;d();c();l();u();d();c();l();u();var sf=(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}`}},cf=()=>({actionCause:"breadcrumbFacet"});var vS=cf;d();c();l();u();var Wc=e=>Z("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,Tn(e.selection));let n={...sf(r,e),...X(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function eL(e,t){return!!t&&t.facetId in e.dateFacetSet}var wI=(e,t)=>{let r=vn(e,t);if(eL(e,r))return r},II=(e,t)=>(wI(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),EI=(e,t)=>(wI(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var lf={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function df(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=FI(r);r.numberOfValues=o,e[n]=t}function pf(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=FI(n))}function ff(e,t,r){let n=e[t]?.request;if(!n)return;let o=uf(n.currentValues,r);if(!o)return;let i=o.state==="selected";o.previousState=o.state,o.state=i?"idle":"selected",n.preventAutoSelect=!0}function mf(e,t,r){let n=e[t]?.request;if(!n)return;let o=uf(n.currentValues,r);if(!o)return;let i=o.state==="excluded";o.previousState=o.state,o.state=i?"idle":"excluded",n.preventAutoSelect=!0}function sn(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=>(uf(o,p)&&(p.state="selected"),p));let i=o.filter(p=>!uf(n.currentValues,p)),a=n.currentValues;a.push(...i),n.numberOfValues=Math.max(n.numberOfValues,a.length)})}function hf(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 uf(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function FI(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var cn=ce(na(),e=>{e.addCase(nn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=tL(n);df(t,PC(i,o))}).addCase(Ze.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(tt,(t,r)=>{let n=r.payload.df||{};gf(t,n)}).addCase(on,(t,r)=>{let{facetId:n,selection:o}=r.payload;ff(t,n,o)}).addCase(an,(t,r)=>{let{facetId:n,selection:o}=r.payload;mf(t,n,o)}).addCase(Pn,(t,r)=>{let{facetId:n,values:o}=r.payload;pf(t,n,o)}).addCase(af,(t,r)=>{sn(t,r.payload)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>{sn(t,r)})}).addCase(of,(t,r)=>{rs(t,r.payload)}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.facets;hf(t,n,rL)}).addCase(dt,(t,r)=>{sn(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&sn(t,o)})})});function tL(e){return{...lf,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function rL(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var nL={state:G,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ue({required:!0})},oL={facetId:ge,field:G,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),activeTab:new L({required:!1}),currentValues:new re({required:!1,each:new W({values:nL})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function yf(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 un=T("numericFacet/register",e=>{try{return _(e,oL),yf(e),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),ln=T("numericFacet/toggleSelectValue",e=>_(e,{facetId:ge,selection:new W({values:Ai})})),dn=T("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ge,selection:new W({values:Ai})})),kn=T("numericFacet/updateFacetValues",e=>{try{return ur(e,{facetId:ge,values:new re({each:new W({values:Ai})})}),yf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:br(t)}}}),Sf=ds,vf=ht;d();c();l();u();var AS=cf;d();c();l();u();d();c();l();u();var TI=(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 Yc=e=>Z("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,Tn(e.selection));let n={...TI(r,e),...X(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function iL(e,t){return!!t&&t.facetId in e.numericFacetSet}var PI=(e,t)=>{let r=vn(e,t);if(iL(e,r))return r},kI=(e,t)=>(PI(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),OI=(e,t)=>(PI(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var fo=ce(oa(),e=>{e.addCase(un,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=aL(n);df(t,kC(i,o))}).addCase(Ze.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(tt,(t,r)=>{let n=r.payload.nf||{};gf(t,n)}).addCase(ln,(t,r)=>{let{facetId:n,selection:o}=r.payload;ff(t,n,o)}).addCase(dn,(t,r)=>{let{facetId:n,selection:o}=r.payload;mf(t,n,o)}).addCase(kn,(t,r)=>{let{facetId:n,values:o}=r.payload;pf(t,n,o)}).addCase(vf,(t,r)=>{sn(t,r.payload)}).addCase(Kt,t=>{Object.keys(t).forEach(r=>{sn(t,r)})}).addCase(Sf,(t,r)=>{rs(t,r.payload)}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.facets;hf(t,n,sL)}).addCase(dt,(t,r)=>{sn(t,r.payload)}).addCase(Tt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!tr(i.tabs,n)&&sn(t,o)})})});function aL(e){return{...lf,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function sL(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Kc=G,Af=new W({options:{required:!0},values:{caption:Ye,expression:Ye,state:new L({constrainTo:["idle","selected","excluded"]})}}),_I=new re({required:!0,each:Af});var $Pe=T("staticFilter/register",e=>_(e,{id:Kc,values:_I})),NI=T("staticFilter/toggleSelect",e=>_(e,{id:Kc,value:Af})),qI=T("staticFilter/toggleExclude",e=>_(e,{id:Kc,value:Af})),HPe=T("staticFilter/deselectAllFilterValues",e=>_(e,Kc));d();c();l();u();var Cf=e=>Z("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...X(r.insightCaseContext)}));d();c();l();u();var bf=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 DI(e){let t=fe(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Kt())},deselectBreadcrumb(n){n.deselect()}}}function MI(e){if(!cL(e))throw oe;let t=DI(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let g={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:C,selection:x})=>{let w=zc({facetId:C,facetValue:x.value});r(lo({facetId:C,selection:x})),r(vi({facetId:C,freezeCurrentValues:!1})),r(Se({legacy:w,next:yS()}))},executeToggleExclude:({facetId:C,selection:x})=>{let w=zc({facetId:C,facetValue:x.value});r(po({facetId:C,selection:x})),r(vi({facetId:C,freezeCurrentValues:!1})),r(Se({legacy:w,next:yS()}))},facetValuesSelector:EC};return bf(g)},i=()=>{let g={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:C=>{r(ln(C)),r(Se({legacy:Yc(C),next:AS()}))},executeToggleExclude:C=>{r(dn(C)),r(Se({legacy:Yc(C),next:AS()}))},facetValuesSelector:kI};return bf(g)},a=()=>{let g={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:C=>{r(on(C)),r(Se({legacy:Wc(C),next:vS()}))},executeToggleExclude:C=>{r(an(C)),r(Se({legacy:Wc(C),next:vS()}))},facetValuesSelector:EI};return bf(g)},p=g=>{let C=TC(n(),g);return{facetId:g,field:n().categoryFacetSet[g].request.field,path:C,deselect:()=>{r(uo(g)),r(Se({legacy:Qp({categoryFacetPath:C.map(x=>x.value),categoryFacetId:g}),next:lI()}))}}},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:C,values:x}=g,w=x.filter(R=>R.state!=="idle").map(R=>A(C,R));return{id:C,values:w}},A=(g,C)=>({value:C,deselect:()=>{let{caption:x,expression:w}=C,R=Cf({staticFilterId:g,staticFilterValue:{caption:x,expression:w}});C.state==="selected"?r(NI({id:g,value:C})):C.state==="excluded"&&r(qI({id:g,value:C})),r(Se({legacy:R}))}});function S(){return!![...o(),...i(),...a(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:i(),dateFacetBreadcrumbs:a(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:S()}},deselectAll:()=>{t.deselectAll(),r(Se({legacy:rf(),next:{actionCause:"breadcrumbResetAll"}}))}}}function cL(e){return e.addReducers({configuration:ve,search:xe,facetSet:us,numericFacetSet:fo,dateFacetSet:cn,categoryFacetSet:Hp}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var jI=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var xf=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),VI=()=>({correctedQuery:"",corrections:[],originalQuery:""});function LI(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:xf(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var UI=(e,t)=>{let r={...VI(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var QI=ce(LI(),e=>{e.addCase(bl,t=>{t.enableDidYouMean=!0}).addCase(hb,t=>{t.enableDidYouMean=!1}).addCase(yb,t=>{t.automaticallyCorrectQuery=!0}).addCase(xl,t=>{t.automaticallyCorrectQuery=!1}).addCase(Fe.pending,t=>{t.queryCorrection=xf(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(Fe.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let i=o?.[0]?o[0]:xf();t.queryCorrection=i}t.queryCorrectionMode==="next"&&UI(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Yt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(yc,(t,r)=>{t.queryCorrectionMode=r.payload})});function BI(e,t={}){if(!uL(e))throw oe;let r=fe(e),{dispatch:n}=e;n(bl()),t.options?.automaticallyCorrectQuery===!1&&n(xl()),n(yc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,i=()=>jI(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(Yt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(a){n(yc(a))}}}function uL(e){return e.addReducers({configuration:ve,didYouMean:QI}),!0}var GI={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function $I(e,t={options:GI}){let r={...GI,...t.options},n=BI(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Se({legacy:wb(),next:_b()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Mt=ce(Il(),e=>{e.addCase(Qe,(t,r)=>({...t,...r.payload})).addCase(Fe.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(Fe.rejected,t=>{t.freezeFacetOrder=!1}).addCase(Ze.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(es,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Rf(o,t,n)}).addCase(is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Rf(o,t,n)}).addCase(nn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Rf(o,t,n)}).addCase(un,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Rf(o,t,n)}).addCase(er,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(dt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(tt,(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]=Nh()),t.facets[n].enabled=!0})})});function Rf(e,t,r){let n={...Nh(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var wf=ce(Fl(),e=>{e.addCase(Cd,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(Tt,(t,r)=>{let n=r.payload;HI(t,n)}).addCase(Ad,(t,r)=>{let n=r.payload;HI(t,n)}).addCase(Ze.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(tt,(t,r)=>{let n=r.payload.tab;te(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function HI(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function zI(e){if(!lL(e))throw oe;let t=fe(e),r=ot(n=>n.tabSet,n=>Object.values(n).find(i=>i.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function lL(e){return e.addReducers({tabSet:wf}),!0}function WI(e,t){if(!dL(e))throw oe;let r=zI(e),n=C=>e.state.facetOptions.facets[C]?.enabled??!1,o=C=>e.state.facetSet?.[C]?.request?.currentValues??e.state.categoryFacetSet?.[C]?.request?.currentValues??e.state.numericFacetSet?.[C]?.request?.currentValues??e.state.dateFacetSet?.[C]?.request?.currentValues??null,i=C=>C in e.state.facetOptions.facets,a=C=>e.state.facetOptions.facets[C]?.tabs,p=()=>Ni({isFacetRegistered:i(t.facetId),parentFacets:t.conditions.map(({parentFacetId:C})=>i(C)?{enabled:n(C),values:o(C)}:null),isTabEnabled:tr(a(t.facetId),r.state.activeTab)}),f=()=>{let C=p();return C===S?!1:(S=C,!0)},m=()=>t.conditions.length>0?t.conditions.some(C=>{if(!n(C.parentFacetId))return!1;let x=o(C.parentFacetId);return x===null?!1:C.condition(x)}):!0,h=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([C,x])=>x.request.freezeCurrentValues&&e.dispatch(vi({facetId:C,freezeCurrentValues:!1})))},A=()=>{if(!i(t.facetId))return;let C=n(t.facetId),x=m(),w=tr(a(t.facetId),r.state.activeTab),R=x&&w;C!==R&&(e.dispatch(R?er(t.facetId):dt(t.facetId)),h())},S=p(),g=e.subscribe(()=>{f()&&A()});return A(),{stopWatching(){g()}}}function dL(e){return e.addReducers({facetOptions:Mt}),!0}function YI(e,t){return WI(e,t)}d();c();l();u();d();c();l();u();function KI(e){if(!pL(e))throw oe;let t=fe(e),r=()=>e.state;return{...t,sort(n){return vc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(i=>i.facetId)}}}}function pL(e){return e.addReducers({search:xe,facetOptions:Mt}),!0}function XI(e){return KI(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function If(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,i={...ps,...t},a=r();e[n]={options:i,isLoading:o,response:a,initialNumberOfValues:i.numberOfValues,requestId:""}}function Ef(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Ff(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Tf(e,t){let r=e[t];r&&(r.isLoading=!1)}function Pf(e,t,r){let{facetId:n,response:o}=t,i=e[n];i&&i.requestId===r&&(i.isLoading=!1,i.response=o)}function Xc(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=ps.query)}function kf(e,t){Object.keys(e).forEach(r=>Xc(e,{facetId:r},t))}var ps={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var JI=/*#__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:A,filterFacetCount:S}=i,g=fL(i),C=g.length?[g]:[],x=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??$t(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:A,captions:a,numberOfValues:f,query:x,field:m,delimitingCharacter:h,ignorePaths:C,filterFacetCount:S,type:"hierarchical",...(n?{}:{searchContext:(yield mr(t,r)).request})}});return function JI(_x210,_x211,_x212,_x213){return _ref90.apply(this,arguments)}}(),fL=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var ZI=/*#__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(S=>S.state!=="idle").map(S=>S.value),A=`*${i}*`;return{url:t.configuration.search.apiBaseUrl??$t(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:a,query:A,field:p,ignoreValues:h,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield mr(t,r)).request})}});return function ZI(_x214,_x215,_x216,_x217){return _ref91.apply(this,arguments)}}();var eE=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){let a=r(),p;o(t,G),mL(a,t)?p=yield ZI(t,a,i,e):p=yield JI(t,a,i,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x218,_x219){return _ref92.apply(this,arguments)}}()),mo=le("facetSearch/executeSearch",eE(!1)),RNe=le("facetSearch/executeSearch",eE(!0)),Of=T("facetSearch/clearResults",e=>_(e,{facetId:ge})),mL=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function tE(){return{}}var rE=ce(tE(),e=>{e.addCase(dI,(t,r)=>{let n=r.payload;If(t,n,CS)}).addCase(Jp,(t,r)=>{Ef(t,r.payload)}).addCase(mo.pending,(t,r)=>{let n=r.meta.arg;Ff(t,n,r.meta.requestId)}).addCase(mo.rejected,(t,r)=>{let n=r.meta.arg;Tf(t,n)}).addCase(mo.fulfilled,(t,r)=>{Pf(t,r.payload,r.meta.requestId)}).addCase(Of,(t,{payload:{facetId:r}})=>{Xc(t,{facetId:r},CS)}).addCase(Fe.fulfilled,t=>{kf(t,CS)})});function CS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function nE(e,t){let{field:r,state:n}=e;if(!gL(e))return r;let o=`${r}_`,i=hL(o,n);return SL(r,t),`${o}${i}`}function gL(e){let{field:t,state:r}=e;return oE(r).some(o=>o&&t in o)}function hL(e,t){let n=oE(t).map(o=>Object.keys(o||{})).reduce((o,i)=>o.concat(i),[]);return yL(n,e)+1}function oE(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function yL(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 SL(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 vr(e,t){let{state:r,logger:n}=e,{field:o,facetId:i}=t;return i||nE({field:o,state:r},n)}d();c();l();u();d();c();l();u();var iE=["alphanumeric","occurrences"];var aE=new Ee({field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),basePath:gI,delimitingCharacter:hI,facetId:Jr,facetSearch:os,filterByBasePath:yI,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:iE})});function sE(e,t){if(!vL(e))throw oe;let r=fe(e),{dispatch:n}=e,o=vr(e,t.options),i=t.options.tabs??{},a=Qt(e.state.tabSet),p={...hS,...gu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:i,activeTab:a},f={facetSearch:{...ps,...t.options.facetSearch},...p};mt(e,aE,f,"buildCategoryFacet");let m=()=>Sh(e.state,o),h=()=>yh(e.state,o),A=()=>qr(e.state),S=()=>Gr(e.state,o);return n(es(p)),{...r,toggleSelect(g){let C=f.numberOfValues;n(ts({facetId:o,selection:g,retrieveCount:C})),n(Qe())},deselectAll(){n(uo(o)),n(Qe())},sortBy(g){n(Up({facetId:o,criterion:g})),n(Qe())},isSortedBy(g){return m().sortCriteria===g},showMoreValues(){let{numberOfValues:g}=f,{activeValue:C,valuesAsTrees:x}=this.state,w=(C?.children.length??x.length)+g;n(Qc({facetId:o,numberOfValues:w})),n(Qe())},showLessValues(){let{numberOfValues:g}=f;n(Qc({facetId:o,numberOfValues:g})),n(Qe())},enable(){n(er(o))},disable(){n(dt(o))},get state(){let g=m(),C=h(),x=A(),w=S(),R=C?.values??[],E=R.some(U=>U.children.length>0)??!1,{parents:F,values:P}=FC(C?.values),V=Dr(R),q=V.length?V[V.length-1]:void 0,O=!!q,N=q?.moreValuesAvailable??C?.moreValuesAvailable??!1,M=q?q.children.length>f.numberOfValues:R.length>f.numberOfValues;return{facetId:o,parents:F,selectedValueAncestry:V,values:P,isHierarchical:E,valuesAsTrees:R,activeValue:q,isLoading:x,hasActiveValues:O,canShowMoreValues:N,canShowLessValues:M,sortCriteria:g.sortCriteria,enabled:w}}}}function vL(e){return e.addReducers({categoryFacetSet:Hp,categoryFacetSearchSet:rE,facetOptions:Mt,configuration:ve,search:xe}),!0}function cE(e,t){let r=sE(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=AL(o(),m);n(Se({legacy:h,next:CL(m)}))},deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(m){r.sortBy(m),n(Se({legacy:rn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(ma({legacy:ss(o())}))},showLessValues(){r.showLessValues(),n(ma({legacy:cs(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function AL(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Pr(r):Bt(r)}function CL(e){return e.state==="selected"?Fn():sr()}d();c();l();u();d();c();l();u();d();c();l();u();function uE(){return{}}var _f=ce(uE(),e=>{e.addCase(vI,(t,r)=>{let n=r.payload;If(t,n,bS)}).addCase(Jp,(t,r)=>{Ef(t,r.payload)}).addCase(mo.pending,(t,r)=>{let n=r.meta.arg;Ff(t,n,r.meta.requestId)}).addCase(mo.rejected,(t,r)=>{let n=r.meta.arg;Tf(t,n)}).addCase(mo.fulfilled,(t,r)=>{Pf(t,r.payload,r.meta.requestId)}).addCase(Of,(t,{payload:r})=>{Xc(t,r,bS)}).addCase(Fe.fulfilled,t=>{kf(t,bS)})});function bS(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var bL=e=>e.state==="selected",lE=(e,t)=>{let r={facetId:e,facetValue:t.value};return bL(t)?Pr(r):Bt(r)};d();c();l();u();var xS=e=>e.state==="selected",mE=e=>e.state==="excluded";var gE=e=>xS(e)?Fn():sr();d();c();l();u();d();c();l();u();var hE={facetId:ge,selection:new W({values:Si})},yE=le("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},hE),n(lo({facetId:e,selection:t})),n(Qe())}),SE=le("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},hE),n(po({facetId:e,selection:t})),n(Qe())});d();c();l();u();d();c();l();u();var fs=["allValues","atLeastOneValue"];d();c();l();u();var Nf=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var vE=new Ee({facetId:Jr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),field:Zr,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:Nf}),resultsMustMatch:new L({constrainTo:fs}),facetSearch:os});function AE(e,t,r=vE){if(!xL(e))throw oe;let{dispatch:n}=e,o=fe(e),i=vr(e,t.options),a=t.options.tabs??{},p=Qt(e.state.tabSet),f={...SS,...gu("facetSearch",t.options),field:t.options.field,facetId:i,tabs:a,activeTab:p},m={facetSearch:{...ps,...t.options.facetSearch},...f};mt(e,r,m,"buildFacet");let h=()=>IC(e.state,i),A=()=>hh(e.state,i),S=()=>qr(e.state),g=()=>Gr(e.state,i),C=()=>{let{currentValues:w}=h();return w.filter(R=>R.state!=="idle").length},x=()=>{let{currentValues:w}=h(),R=m.numberOfValues,E=!!w.find(F=>F.state==="idle");return R<w.length&&E};return n(is(f)),{...o,toggleSelect:w=>n(yE({facetId:m.facetId,selection:w})),toggleExclude:w=>n(SE({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(ht(i)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(ht(i)),this.toggleExclude(w)},isValueSelected:xS,isValueExcluded:mE,deselectAll(){n(ht(i)),n(Qe())},sortBy(w){n(Kp({facetId:i,criterion:w})),n(Qe())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=h().numberOfValues,R=m.numberOfValues,E=R-w%R,F=w+E;n($c({facetId:i,numberOfValues:F})),n(Hc({facetId:i,isFieldExpanded:!0})),n(Qe())},showLessValues(){let w=m.numberOfValues,R=Math.max(w,C());n($c({facetId:i,numberOfValues:R})),n(Hc({facetId:i,isFieldExpanded:!1})),n(Qe())},enable(){n(er(i))},disable(){n(dt(i))},get state(){let w=h(),R=A(),E=S(),F=g(),P;typeof w.sortCriteria=="object"?P=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":P=w.sortCriteria;let V=R?R.values:[],q=V.some(M=>M.state!=="idle"),O=R?R.moreValuesAvailable:!1,N=w.resultsMustMatch;return{label:R?.label,facetId:i,tabs:a,values:V,sortCriterion:P,resultsMustMatch:N,isLoading:E,hasActiveValues:q,canShowMoreValues:O,canShowLessValues:x(),enabled:F}}}}function xL(e){return e.addReducers({facetSet:us,facetOptions:Mt,configuration:ve,facetSearchSet:_f}),!0}d();c();l();u();var CE=new Ee({facetId:Jr,field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,sortCriteria:new L({constrainTo:Nf}),resultsMustMatch:new L({constrainTo:fs}),facetSearch:os,allowedValues:Wp,customSort:Yp});function bE(e,t){if(!RL(e))throw oe;let{dispatch:r}=e,n=AE(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},CE),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(Se({legacy:lE(o(),m),next:gE(m)}))},deselectAll(){n.deselectAll(),r(Se({legacy:Dt(o()),next:rr()}))},sortBy(m){n.sortBy(m),r(Se({legacy:rn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(ma({legacy:ss(o())}))},showLessValues(){n.showLessValues(),r(ma({legacy:cs(o())}))},get state(){return{...n.state,facetSearch:a.state}}}}function RL(e){return e.addReducers({facetSet:us,configuration:ve,facetSearchSet:_f,search:xe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var Jc=e=>e.state==="selected",xE=e=>e.state==="excluded";var qf=e=>Jc(e)?Fn():sr();var Df=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Jc(t)?Pr(n):Bt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Mf=T("rangeFacet/executeToggleSelect",e=>_(e,Tn(e.selection))),jf=T("rangeFacet/executeToggleExclude",e=>_(e,Tn(e.selection)));var RE={facetId:ge,selection:new W({values:Ci})},wE=le("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,RE),t(on(e)),t(Mf(e)),t(Qe())}),IE=le("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,RE),t(an(e)),t(jf(e)),t(Qe())});d();c();l();u();function Vf(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 Lf(e,t){let{facetId:r,getRequest:n}=t,o=fe(e),i=e.dispatch,a=()=>Gr(e.state,r);return{...o,isValueSelected:Jc,isValueExcluded:xE,deselectAll(){i(ht(r)),i(Qe())},sortBy(p){i(ds({facetId:r,criterion:p})),i(Qe())},isSortedBy(p){return this.state.sortCriterion===p},enable(){i(er(r))},disable(){i(dt(r))},get state(){let p=n(),f=vn(e.state,r),m=p.sortCriteria,h=p.resultsMustMatch,A=f?f.values:[],S=qr(e.state),g=a(),C=A.some(w=>w.state!=="idle"),x=f?.domain;return{facetId:r,values:A,sortCriterion:m,resultsMustMatch:h,hasActiveValues:C,isLoading:S,enabled:g,domain:x}}}}d();c();l();u();d();c();l();u();var Uf=["idle","selected","excluded"];d();c();l();u();var Qf=["ascending","descending"],Bf=["even","equiprobable"];var wL={start:new L,end:new L,endInclusive:new ue,state:new L({constrainTo:Uf})},IL=new Ee({facetId:Jr,field:Zr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),generateAutomaticRanges:zp,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,currentValues:new re({each:new W({values:wL})}),sortCriteria:new L({constrainTo:Qf}),rangeAlgorithm:new L({constrainTo:Bf})});function Gf(e,t){mt(e,IL,t,"buildDateFacet"),nf(t)}function EE(e,t){if(!EL(e))throw oe;Vf(t.options,"buildDateFacet");let r=e.dispatch,n=vr(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};Gf(e,a),r(nn(a));let p=Lf(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(wE({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(ht(n)),this.toggleSelect(f)},toggleExclude:f=>r(IE({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(ht(n)),this.toggleExclude(f)},get state(){return p.state}}}function EL(e){return e.addReducers({configuration:ve,search:xe,dateFacetSet:cn,facetOptions:Mt}),!0}function FE(e,t){let r=EE(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(i){r.sortBy(i),n(Se({legacy:rn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Se({legacy:Df(o(),i),next:qf(i)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function TE(e,t){if(!FL(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=vr(e,t.options),a=t.options.tabs??{},p=Qt(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};Gf(e,f),n(nn(f));let m=()=>Gr(e.state,i);return{...r,clear:()=>{n(Pn({facetId:i,values:[]})),n(Qe())},setRange:h=>{let A={...h,state:"selected",numberOfResults:0,endInclusive:!0},S=Pn({facetId:i,values:[A]});return S.error?!1:(n(S),n(Qe()),!0)},enable(){n(er(i))},disable(){n(dt(i))},get state(){let h=qr(o()),A=m(),S=II(o(),i),g=S.length?S[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:A}}}}function FL(e){return e.addReducers({dateFacetSet:cn,facetOptions:Mt,configuration:ve,search:xe}),!0}function PE(e,t){if(!TL(e))throw oe;let r=TE(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Se({legacy:Dt(o()),next:rr()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Se({legacy:Bt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:sr()})),a},get state(){return{...r.state}}}}function TL(e){return e.addReducers({dateFacetSet:cn,configuration:ve,search:xe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var kE={facetId:ge,selection:new W({values:Ai})},OE=le("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,kE),t(ln(e)),t(Mf(e)),t(Qe())}),FVe=le("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,kE),t(dn(e)),t(jf(e)),t(Qe())});d();c();l();u();var PL={start:new ne,end:new ne,endInclusive:new ue,state:new L({constrainTo:Uf})},kL=new Ee({facetId:Jr,tabs:new W({options:{required:!1},values:{included:new re({each:new L}),excluded:new re({each:new L})}}),field:Zr,generateAutomaticRanges:zp,filterFacetCount:en,injectionDepth:tn,numberOfValues:Tr,currentValues:new re({each:new W({values:PL})}),sortCriteria:new L({constrainTo:Qf}),resultsMustMatch:new L({constrainTo:fs}),rangeAlgorithm:new L({constrainTo:Bf})});function $f(e,t){mt(e,kL,t,"buildNumericFacet"),yf(t)}d();c();l();u();function Hf(e){return{endInclusive:!1,state:"idle",...e}}function _E(e,t){if(!OL(e))throw oe;Vf(t.options,"buildNumericFacet");let r=e.dispatch,n=vr(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};$f(e,a),r(un(a));let p=Lf(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(OE({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(ht(n)),this.toggleSelect(f)},get state(){return p.state}}}function OL(e){return e.addReducers({numericFacetSet:fo,facetOptions:Mt,configuration:ve,search:xe}),!0}function NE(e,t){let r=_E(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Se({legacy:Dt(o()),next:rr()}))},sortBy(i){r.sortBy(i),n(Se({legacy:rn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(Se({legacy:Df(o(),i),next:qf(i)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function qE(e,t){if(!_L(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=vr(e,t.options),a=t.options.tabs??{},p=Qt(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};$f(e,f),n(un(f));let m=()=>Gr(e.state,i);return{...r,clear:()=>{n(kn({facetId:i,values:[]})),n(Qe())},setRange:h=>{let A={...h,state:"selected",numberOfResults:0,endInclusive:!0},S=kn({facetId:i,values:[A]});return S.error?!1:(n(S),n(Qe()),!0)},enable(){n(er(i))},disable(){n(dt(i))},get state(){let h=qr(o()),A=m(),S=OI(o(),i),g=S.length?S[0]:void 0;return{facetId:i,isLoading:h,range:g,enabled:A}}}}function _L(e){return e.addReducers({numericFacetSet:fo,facetOptions:Mt,configuration:ve,search:xe}),!0}function DE(e,t){let r=qE(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Se({legacy:Dt(o()),next:rr()}))},setRange:i=>{let a=r.setRange(i);return a&&n(Se({legacy:Bt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:sr()})),a},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var NL=e=>Z("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ft(e),t.logShowMoreFoldedResults(Ke(e,r),Xe(e),X(r.insightCaseContext)))),qL=()=>Z("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(X(t.insightCaseContext))),ME={logShowMoreFoldedResults:NL,logShowLessFoldedResults:qL};d();c();l();u();d();c();l();u();var Zc={collectionField:new L({emptyAllowed:!1,required:!1}),parentField:new L({emptyAllowed:!1,required:!1}),childField:new L({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},ms=T("folding/register",e=>_(e,Zc)),zf=le("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 $n(i):ha(i,o),p=yield n.search({...a,q:DL(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 Ge(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x220,_x221){return _ref93.apply(this,arguments)}}());function DL(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var jE=T("folding/register",e=>_(e,Zc)),Wf=le("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield Rb(o,e),p=(yield Pb(n,o,i,{origin:"foldingCollection"})).response;return Ge(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x222,_x223){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Yf=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function ML(e,t){return e.raw[t.collection]}function RS(e,t){return e.raw[t.parent]}function eu(e,t){let r=e.raw[t.child];return fu(r)?r[0]:r}function jL(e,t){return(e||t)!==void 0&&e===t}function LE(e,t,r,n=[]){let o=eu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(i=>{let a=eu(i,r)===eu(e,r);return RS(i,r)===o&&!a}).map(i=>{let a={...i,searchUid:e.searchUid};return{result:a,children:LE(a,t,r,[...n,o])}}):[]}function VL(e,t){return e.find(r=>{let n=RS(r,t)===void 0,o=jL(RS(r,t),eu(r,t));return n||o})}function UE(e){return e.parentResult?UE(e.parentResult):e}function LL(e,t,r,n){let o=pl(e),a={...(n??VL(o,t)??UE(e)),searchUid:r},p=LE(a,o,t);return{result:a,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Kf(e,t,r,n){let o={};return e.forEach(i=>{let a=ML(i,t);a&&(!eu(i,t)&&!i.parentResult||(o[a]=LL(i,t,r,n)))}),o}function VE(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 Xf=ce(Yf(),e=>e.addCase(Fe.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Kf(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Br.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Kf(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Kn.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Kf(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(ms,(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(zf.pending,(t,{meta:r})=>{let n=r.arg;VE(t,n).isLoadingMoreResults=!0}).addCase(zf.rejected,(t,{meta:r})=>{let n=r.arg;VE(t,n).isLoadingMoreResults=!1}).addCase(zf.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:i}})=>{let a=Kf(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 tu={id:G},go=T("querySuggest/register",e=>_(e,{...tu,count:new ne({min:0})})),QE=T("querySuggest/unregister",e=>_(e,tu)),ho=T("querySuggest/selectSuggestion",e=>_(e,{...tu,expression:Ye})),yo=T("querySuggest/clear",e=>_(e,tu)),gs=le("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){o(e,tu);let a=e.id,p=yield UL(a,t(),i),f=yield n.querySuggest(p);return Ge(f)?r(f.error):{id:a,q:p.q,...f.success}});return function(_x224,_x225){return _ref95.apply(this,arguments)}}()),UL=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??$t(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?Nt.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 Qn(t.configuration.analytics):jo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function UL(_x226,_x227,_x228){return _ref96.apply(this,arguments)}}();var So=ce(at(),e=>e.addCase(Ut,(t,r)=>({...t,...r.payload})).addCase(Yt,(t,r)=>{t.q=r.payload}).addCase(ho,(t,r)=>{t.q=r.payload.expression}).addCase(Ze.fulfilled,(t,r)=>r.payload?.query??t).addCase(tt,(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 vo=T("fields/registerFieldsToInclude",e=>_(e,Eu)),Jf=T("fields/fetchall/enable"),Zf=T("fields/fetchall/disable"),em=le("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??$t(p,a)});return Ge(m)?n(m.error):m.success.fields});return function(_x229,_x230){return _ref97.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var BE=["author","language","urihash","objecttype","collection","source","permanentid"],QL=[...BE,"date","filetype","parents"],EQe=[...QL,"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"],GE=()=>({fieldsToInclude:BE,fetchAllFields:!1,fieldsDescription:[]});var hs=ce(GE(),e=>e.addCase(vo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Jf,t=>{t.fetchAllFields=!0}).addCase(Zf,t=>{t.fetchAllFields=!1}).addCase(em.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(ms,(t,{payload:r})=>{let n=Yf().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function ys(e){if(!BL(e))throw oe;let t=fe(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:Yl(n)}}}}function BL(e){return e.addReducers({search:xe}),!0}var GL=new Ee({fieldsToInclude:new re({required:!1,each:new L({required:!0,emptyAllowed:!1})})});function tm(e,t){if(!$L(e))throw oe;let r=fe(e),n=ys(e),{dispatch:o}=e,i=()=>e.state,a=mt(e,GL,t?.options,"buildCoreResultList");a.fieldsToInclude&&o(vo(a.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,h=5,A=200,S=!1;return{...r,get state(){let C=i();return{...n.state,results:C.search.results,moreResultsAvailable:p(),searchResponseId:C.search.searchResponseId}},fetchMoreResults:function(){var _ref98=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-f<A){if(m++,m>=h){f=Date.now(),!S&&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.`),S=!0;return}}else m=0;S=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function $L(e){return e.addReducers({search:xe,configuration:ve,fields:hs}),!0}var HL=new Ee(Zc);function $E(e,t,r){if(!zL(e))throw oe;let n=tm(e,t),{dispatch:o}=e,i=()=>e.state,a=t.options?.folding?mt(e,HL,t.options.folding,"buildFoldedResultList"):{};return o(ms({...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 wS(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return wS(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 zL(e){return e.addReducers({search:xe,configuration:Rd,folding:Xf,query:So}),!0}function wS(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=wS(n.children,t);if(o)return o}}return null}function HE(e,t={}){let r=$E(e,{...t,loadCollectionActionCreator:Wf,fetchMoreResultsActionCreator:_l},ME);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var WL=()=>Z("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(X(t.insightCaseContext))),IS=e=>Z("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ve(r),o=sa(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(fl(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:ml(o)},X(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=sa(t,e);return{answerId:Ve(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),YL=(e,t)=>Z("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ve(n),i=sa(n,e);return!o||!i?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t},X(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=sa(r,e);return{answerId:Ve(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),KL=()=>Z("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"like"})}),XL=()=>Z("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"dislike"})}),JL=e=>Z("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ve(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},X(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ve(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Rc(o),documented:Rc(i),correctTopic:Rc(p),hallucinationFree:Rc(a)},additionalNotes:m,correctAnswerUrl:f}}}),ZL=e=>Z("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Ve(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o},X(r.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Ve(t)??"",answerGenerated:e})});var eU=()=>Z("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"show"})}),tU=()=>Z("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"hide"})}),rU=()=>Z("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"expand"})}),nU=()=>Z("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"collapse"})}),oU=()=>Z("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},X(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"copyToClipboard"})}),rm={logCopyGeneratedAnswer:oU,logGeneratedAnswerHideAnswers:tU,logGeneratedAnswerShowAnswers:eU,logGeneratedAnswerStreamEnd:ZL,logGeneratedAnswerFeedback:JL,logDislikeGeneratedAnswer:XL,logLikeGeneratedAnswer:KL,logHoverCitation:YL,logOpenGeneratedAnswerSource:IS,logRetryGeneratedAnswer:WL,logGeneratedAnswerExpand:rU,logGeneratedAnswerCollapse:nU};d();c();l();u();d();c();l();u();d();c();l();u();function nm(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Ss=ce(fy(),e=>e.addCase(Ta,(t,{payload:r})=>{t.isVisible=r}).addCase(wc,(t,{payload:r})=>{t.isEnabled=r}).addCase(ud,(t,{payload:r})=>{t.id=r.id}).addCase(Qo,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.answer||(t.answer=""),t.answer+=r.textDelta,delete t.error}).addCase(Bo,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=nm([...t.citations,...r.citations]),delete t.error}).addCase(Go,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===yg},t.citations=[],delete t.answer}).addCase(id,t=>{t.liked=!0,t.disliked=!1}).addCase(ad,t=>{t.liked=!1,t.disliked=!0}).addCase(sd,t=>{t.feedbackModalOpen=!0}).addCase(ld,t=>{t.feedbackModalOpen=!1}).addCase(ka,t=>{t.feedbackSubmitted=!0}).addCase(ar,t=>({...fy(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase($r,(t,{payload:r})=>{t.isLoading=r}).addCase(Uo,(t,{payload:r})=>{t.isStreaming=r}).addCase($o,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(dd,(t,{payload:r})=>{t.responseFormat=r}).addCase(fd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Ec,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Ic,t=>{t.expanded=!0}).addCase(cd,t=>{t.expanded=!1}).addCase(pd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(Ho,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(gy,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Pa,(t,{payload:r})=>{t.answerId=r}).addCase(od,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(md,(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 om(e,t,r={}){if(!iU(e))throw oe;let{dispatch:n}=e,o=fe(e),i=()=>e.state,a=r.initialState?.isVisible;a!==void 0&&n(Ta(a));let p=r.initialState?.responseFormat;p&&n(dd(p));let f=r.fieldsToIncludeInCitations;return f&&n(fd(f)),r.initialState?.expanded&&n(Ic()),{...o,get state(){let h=i().generatedAnswer;return{...h,error:qp(h.error)}},like(h){this.state.liked||(n(id()),n(t.logLikeGeneratedAnswer(h)))},dislike(h){this.state.disliked||(n(ad()),n(t.logDislikeGeneratedAnswer(h)))},openFeedbackModal(){n(sd())},closeFeedbackModal(){n(ld())},sendFeedback(h){n(t.logGeneratedAnswerFeedback(h)),n(ka())},logCitationClick(h,A){n(t.logOpenGeneratedAnswerSource(h,A))},logCitationHover(h,A,S){n(t.logHoverCitation(h,A,S))},show(){this.state.isVisible||(n(Ta(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Ta(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Ic()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(cd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(wc(!0))},disable(){this.state.isEnabled&&n(wc(!1))},logCopyToClipboard(h){n(t.logCopyGeneratedAnswer(h))},retry(){}}}function iU(e){return e.addReducers({generatedAnswer:Ss}),!0}var jt={engines:{},setAbortControllerRef:(e,t)=>{jt.engines[t].abortController=e},getIsStreamInProgress:e=>!jt.engines[e].abortController||jt.engines[e].abortController?.signal.aborted?(jt.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(jt.engines[i].lastRequestId!==n){if(jt.engines[i].lastRequestId=n,jt.engines[i].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(ar())}if(!jt.getIsStreamInProgress(i)&&o&&o!==jt.engines[i].lastStreamId){if(jt.engines[i].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Dx({setAbortControllerRef:p=>jt.setAbortControllerRef(p,i)}))}};return e.subscribe(t)}};function zE(e,t,r={}){if(!aU(e))throw oe;let n=om(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!jt.engines[e.state.generatedAnswer.id]&&(jt.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=pu("genQA-",12);e.dispatch(ud({id:a}))}jt.engines[e.state.generatedAnswer.id]||(jt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),jt.subscribeToSearchRequests(e);let i=a=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in a;return{...n,get state(){return o().generatedAnswer},retry(){i(e)&&e.dispatch(Fe({legacy:t.logRetryGeneratedAnswer()}))}}}function aU(e){return e.addReducers({generatedAnswer:Ss}),!0}d();c();l();u();d();c();l();u();var WE=Sd.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var im=e=>e==="yes"?!0:e==="no"?!1:null,sU=({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:im(t.correctTopic),documented:im(t.documented),hallucinationFree:im(t.hallucinationFree),readable:im(t.readable)},helpful:t.helpful,question:r}),cU=e=>{let t="",r=()=>{let n=e.state,o=vx(n),i=o.requestId;i!==t&&(t=i,e.dispatch(ar()),o.q?.length>0&&e.dispatch(hd()))};e.subscribe(r)};function YE(e,t,r={}){if(!uU(e))throw oe;Dp(e.state.configuration.analytics.analyticsMode);let{...n}=om(e,t,r),o=()=>e.state;return e.dispatch(pd(r.answerConfigurationId)),cU(e),{...n,get state(){let i=hy(e.state).data,a=o().generatedAnswer;return{...a,answer:i?.answer,citations:nm(i?.citations??[]),error:qp({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=ed(o());e.dispatch(yd(i??Vo))},reset(){e.dispatch(ar())},sendFeedback(i){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(i));let a=sU({query:o().query.q,feedback:i,answerApiState:hy(e.state).data});e.dispatch(WE.endpoints.post.initiate(a)),e.dispatch(ka())})()}}}function uU(e){return e.addReducers({[zo.reducerPath]:zo.reducer,query:So}),!0}function KE(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?YE(e,rm,t):zE(e,rm,t);return{...n,get state(){return n.state},retry(){r(Se({legacy:rm.logRetryGeneratedAnswer(),next:Ax()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function pn(e,t,r){if(!lU(e))throw oe;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:hu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function lU(e){return e.addReducers({configuration:ve}),!0}function XE(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logOpenGeneratedAnswerSource(r.options.citation.id,r.options.answerId)))};return pn(e,r,()=>{o()})}function JE(e,t){return XE(e,{logOpenGeneratedAnswerSource:IS},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var mU=new ne({min:1,default:8,required:!1}),gU=new ne({min:1,max:20,default:5,required:!1}),hU={desiredCount:gU,numberOfValues:mU},OGe=T("automaticFacet/setOptions",e=>_(e,hU)),_Ge=T("automaticFacet/deselectAll",e=>_(e,ge)),yU=G,ZE=T("automaticFacet/toggleSelectValue",e=>_(e,{field:yU,selection:new W({values:Si})}));var As=ce(Lr(),e=>{e.addCase(Vl,(t,r)=>{let n=ES(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ru(n,o)}).addCase(Ll,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(Tt,t=>{t.firstResult=0}).addCase(Ul,(t,r)=>{let n=r.payload;t.firstResult=ru(n,t.numberOfResults)}).addCase(Gn,(t,r)=>{let n=r.payload;t.firstResult=ru(n,t.numberOfResults)}).addCase(Bl,t=>{let r=ES(t),n=Math.max(r-1,1);t.firstResult=ru(n,t.numberOfResults)}).addCase(Ql,t=>{let r=ES(t),n=SU(t),o=Math.min(r+1,n);t.firstResult=ru(o,t.numberOfResults)}).addCase(Ze.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(tt,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Fe.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Br.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(ht,t=>{Vt(t)}).addCase(an,t=>{Vt(t)}).addCase(po,t=>{Vt(t)}).addCase(dn,t=>{Vt(t)}).addCase(ef,t=>{Vt(t)}).addCase(lo,t=>{Vt(t)}).addCase(uo,t=>{Vt(t)}).addCase(ts,t=>{Vt(t)}).addCase(Bp,t=>{Vt(t)}).addCase(on,t=>{Vt(t)}).addCase(ln,t=>{Vt(t)}).addCase(Kt,t=>{Vt(t)}).addCase(Pn,t=>{Vt(t)}).addCase(kn,t=>{Vt(t)}).addCase(Zp,t=>{Vt(t)}).addCase(ZE,t=>{Vt(t)})});function Vt(e){e.firstResult=Lr().firstResult}function ES(e){let{firstResult:t,numberOfResults:r}=e;return FS(t,r)}function SU(e){let{totalCountFiltered:t,numberOfResults:r}=e;return TS(t,r)}function ru(e,t){return(e-1)*t}function FS(e,t){return Math.round(e/t)+1}function TS(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function vU(e){return e.pagination.firstResult}function eF(e){return e.pagination.numberOfResults}function AU(e){return e.pagination.totalCountFiltered}var Ao=e=>{let t=vU(e),r=eF(e);return FS(t,r)},PS=e=>{let t=AU(e),r=eF(e);return TS(t,r)},tF=(e,t)=>{let r=Ao(e),n=PS(e),o=CU(r,t);return o=bU(o),o=xU(o,n),RU(o)};function CU(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 bU(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function xU(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 RU(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var kS=()=>$e("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Lr().numberOfResults}));var Cs=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var am=()=>Z("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Ao(t),...X(t.insightCaseContext)})),sm=()=>Z("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Ao(t),...X(t.insightCaseContext)})),cm=()=>Z("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Ao(t),...X(t.insightCaseContext)}));d();c();l();u();var wU=new Ee({numberOfPages:new ne({default:5,min:0})}),IU=new Ee({page:new ne({min:1})});function rF(e,t={}){if(!EU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=mt(e,wU,t.options,"buildPager"),a=lr(e,IU,t.initialState,"buildPager").page;a&&n(Ul(a));let p=()=>Ao(e.state),f=()=>{let{numberOfPages:h}=o;return tF(e.state,h)},m=()=>PS(e.state);return{...r,get state(){let h=p(),A=m(),S=h>1&&A>0,g=h<A;return{currentPage:h,currentPages:f(),maxPage:A,hasPreviousPage:S,hasNextPage:g}},selectPage(h){n(Gn(h))},nextPage(){n(Ql())},previousPage(){n(Bl())},isCurrentPage(h){return h===this.state.currentPage}}}function EU(e){return e.addReducers({configuration:ve,pagination:As}),!0}function nF(e,t={}){let{dispatch:r}=e,n=rF(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Ol({legacy:am(),next:Cs()}))},nextPage(){n.nextPage(),r(Ol({legacy:sm(),next:Cs()}))},previousPage(){n.previousPage(),r(Ol({legacy:cm(),next:Cs()}))}}}d();c();l();u();d();c();l();u();function oF(e){if(!FU(e))throw oe;let t=fe(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function FU(e){return e.addReducers({search:xe}),!0}function iF(e){return oF(e)}d();c();l();u();d();c();l();u();function aF(e){if(!TU(e))throw oe;let t=fe(e),r=ys(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 TU(e){return e.addReducers({search:xe,pagination:As}),!0}function sF(e){return aF(e)}d();c();l();u();d();c();l();u();function cF(_x231,_x232){return _cF.apply(this,arguments)}function _cF(){_cF=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:i}=e.insightConfiguration,a=e.query?.q||"";return{url:Cg({url:We(n,o),accessToken:r,organizationId:n,insightId:i}),accessToken:r,organizationId:n,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0}});return _cF.apply(this,arguments)}d();c();l();u();var uF=e=>Z("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ft(e);let n=Ke(e,r),o=Xe(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{action:"preview",itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Fr(t)}}});d();c();l();u();function lF(e,t,r,n,o){if(!PU(e))throw oe;let{dispatch:i}=e,a=()=>e.state,p=fe(e),{result:f,maximumPreviewSize:m}=t.options,h=()=>{let{resultsWithPreview:S,position:g}=a().resultPreview;return S[g]},A=S=>{i(Wl({uniqueId:S,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(Ac({uniqueId:S,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){A(f.uniqueId)},next(){i(Hl()),A(h())},previous(){i(zl()),A(h())},get state(){let S=a(),g=f.hasHtmlVersion,C=S.resultPreview,x=f.uniqueId===C.uniqueId?C.content:"",w=C.isLoading,R=C.contentURL,E=h();return{content:x,resultHasPreview:g,isLoading:w,contentURL:R,currentResultUniqueId:E}}}}function PU(e){return e.addReducers({configuration:ve,resultPreview:Ca}),!0}function dF(e,t){if(!kU(e))throw oe;let r=()=>{e.dispatch(uF(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return lF(e,o,(i,a)=>cF(i,a),n,r)}function kU(e){return e.addReducers({configuration:ve,resultPreview:Ca,insightInterface:Un}),!0}d();c();l();u();d();c();l();u();var pF=()=>Z("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(X(t.insightCaseContext))),fF=()=>Z("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(X(t.insightCaseContext)));d();c();l();u();d();c();l();u();var OU={queries:new re({required:!0,each:new L({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},nu=T("recentQueries/registerRecentQueries",e=>_(e,OU)),um=T("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function mF(){return{queries:[],maxLength:10}}var gF=ce(mF(),e=>{e.addCase(nu,_U).addCase(um,NU).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||qU(n,t)})});function _U(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 NU(e){e.queries=[]}function qU(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 DU={queries:[]},MU={maxLength:10,clearFilters:!0},jU=new Ee({queries:new re({required:!0})}),VU=new Ee({maxLength:new ne({required:!0,min:1}),clearFilters:new ue});function LU(e,t){mt(e,VU,t?.options,"buildRecentQueriesList"),lr(e,jU,t?.initialState,"buildRecentQueriesList")}function hF(e,t){if(!UU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i={...MU,...t?.options},a={...DU,...t?.initialState};LU(e,{options:i,initialState:a});let p={queries:a.queries,maxLength:i.maxLength};return n(nu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(um())},updateRecentQueries(f){let m=new re({required:!0,each:new L({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(nu({queries:f,maxLength:i.maxLength}))},executeRecentQuery(f){let m=new ne({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let h={q:this.state.queries[f],clearFilters:i.clearFilters};du(e.state.query?.enableQuerySyntax)&&(h.enableQuerySyntax=e.state.query.enableQuerySyntax),n(va(h))}}}function UU(e){return e.addReducers({search:xe,recentQueries:gF,query:So}),!0}function yF(e,t){let r=hF(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(pF()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Se({legacy:fF(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var QU={results:new re({required:!0,each:new W({values:gl})}),maxLength:new ne({required:!0,min:1,default:10})},lm=T("recentResults/registerRecentResults",e=>_(e,QU)),fn=T("recentResults/pushRecentResult",e=>(Ft(e),{payload:e})),dm=T("recentResults/clearRecentResults");d();c();l();u();var SF=e=>Z("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ft(e);let n=X(r.insightCaseContext);return t.logDocumentOpen(Ke(e,r),Xe(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Fr(t)}}});function vF(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(SF(t.options.result)))};return pn(e,t,()=>{n(),e.dispatch(fn(t.options.result))})}d();c();l();u();function AF(e,t){return tm(e,{...t,fetchMoreResultsActionCreator:_l})}d();c();l();u();d();c();l();u();var BU=new Ee({numberOfResults:new ne({min:0})});function CF(e,t={}){if(!GU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,a=lr(e,BU,t.initialState,"buildResultsPerPage").numberOfResults;return a!==void 0&&n(Vl(a)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Ll(p))},isSetTo(p){return p===this.state.numberOfResults}}}function GU(e){return e.addReducers({pagination:As,configuration:ve}),!0}function bF(e,t={}){let r=CF(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Se({legacy:kS(),next:Cs()}))}}}d();c();l();u();d();c();l();u();var OS=()=>$e("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),pm=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var fm=()=>Z("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(X(t.insightCaseContext)));d();c();l();u();d();c();l();u();var xF={id:G,query:Ye},bs=T("querySet/register",e=>_(e,xF)),bi=T("querySet/update",e=>_(e,xF));d();c();l();u();var xs=ce(El(),e=>{e.addCase(bs,(t,r)=>HU(t,r.payload)).addCase(bi,(t,r)=>{let{id:n,query:o}=r.payload;_S(t,n,o)}).addCase(ho,(t,r)=>{let{id:n,expression:o}=r.payload;_S(t,n,o)}).addCase(Fe.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;RF(t,n)}).addCase(tt,$U).addCase(Ze.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))_S(t,n,o)})});function $U(e,t){te(t.payload.q)||RF(e,t.payload.q)}function RF(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var _S=(e,t,r)=>{t in e&&(e[t]=r)},HU=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var wF=e=>$e("analytics/querySuggest",(t,r)=>{let n=zU(r,e);return t.makeOmniboxAnalytics(n)}),IF=()=>({actionCause:"omniboxAnalytics"});function zU(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 EF(e,t){let r=t.id;r in e||(e[r]=WU(t))}function FF(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function TF(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function PF(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function WU(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var kF=()=>({});var mm=ce(kF(),e=>e.addCase(go,(t,r)=>{EF(t,r.payload)}).addCase(QE,(t,r)=>{delete t[r.payload.id]}).addCase(gs.pending,FF).addCase(gs.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(gs.rejected,TF).addCase(yo,(t,r)=>{PF(t,r.payload)}).addCase(ba,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var OF={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},NS={open:new L,close:new L},YU={id:G,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new ue,highlightOptions:new W({values:{notMatchDelimiters:new W({values:NS}),exactMatchDelimiters:new W({values:NS}),correctionDelimiters:new W({values:NS})}}),clearFilters:new ue},_F=new Ee(YU);function NF(e,t){if(!XU(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state,i=t.options?.id||pu("search_box"),a={id:i,highlightOptions:{...t.options?.highlightOptions},...OF,...t.options};mt(e,_F,a,"buildSearchBox"),n(bs({id:i,query:e.state.query.q})),a.numberOfSuggestions&&n(go({id:i,count:a.numberOfSuggestions})),a.enableQuerySyntax&&n(Ut({enableQuerySyntax:a.enableQuerySyntax}));let p=()=>e.state.querySet[a.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:h,clearFilters:A}=a;n(va({q:p(),enableQuerySyntax:h,clearFilters:A})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x233){return _ref99.apply(this,arguments)}}();return{...r,updateText(m){n(bi({id:i,query:m})),this.showSuggestions()},clear(){n(bi({id:i,query:""})),n(yo({id:i}))},showSuggestions(){a.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:i}))},selectSuggestion(m){n(ho({id:i,expression:m})),f({legacy:wF({id:i,suggestion:m}),next:IF()}).then(()=>{n(yo({id:i}))})},submit(m=OS(),h){f({legacy:m,next:h}),n(yo({id:i}))},get state(){let m=o(),h=m.querySuggest[a.id],A=KU(h,a.highlightOptions),S=h?h.isLoading:!1;return{searchBoxId:i,value:p(),suggestions:A,isLoading:m.search.isLoading,isLoadingSuggestions:S}}}}function KU(e,t){return e?e.completions.map(r=>({highlightedValue:Km(r.highlighted,t),rawValue:r.expression})):[]}function XU(e){return e.addReducers({query:So,querySuggest:mm,configuration:ve,querySet:xs,search:xe}),!0}function qF(e,t={}){let r=NF(e,{...t,executeSearchActionCreator:Se,fetchQuerySuggestionsActionCreator:Nl,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(fm(),pm())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var gm=()=>({actionCause:"resultsSort"});function DF(e,t){return e.q!==t.q?pm():e.sortCriteria!==t.sortCriteria?gm():Rs(e.f,t.f)?ws(e.f,t.f):Rs(e.fExcluded,t.fExcluded)?ws(e.fExcluded,t.fExcluded,!0):Rs(e.cf,t.cf)?ws(e.cf,t.cf):Rs(e.af,t.af)?ws(e.af,t.af):Rs(e.nf,t.nf)?ws(hm(e.nf),hm(t.nf)):Rs(e.df,t.df)?ws(hm(e.df),hm(t.df)):la()}function Rs(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function ws(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(S=>!o.includes(S));if(i.length){let S=i[0];return e[S].length>1?rr():Fn()}if(o.filter(S=>!n.includes(S)).length)return r?Xp():sr();let p=o.find(S=>t[S].filter(g=>e[S].includes(g)));if(!p)return la();let f=e[p],m=t[p];return m.filter(S=>!f.includes(S)).length?r?Xp():sr():f.filter(S=>!m.includes(S)).length?Fn():la()}function hm(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 Is=()=>Z("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ir(),...X(t.insightCaseContext)}));function VF(e,t){return e.q!==t.q?fm():e.sortCriteria!==t.sortCriteria?Is():ou(e.f,t.f)?ou(e.cf,t.cf)?ou(e.nf,t.nf)?ou(e.df,t.df)?ou(e.fExcluded,t.fExcluded)?Bn():JU(e.fExcluded,t.fExcluded):jF(e.df,t.df):jF(e.nf,t.nf):ym(e.cf,t.cf):ym(e.f,t.f)}function ou(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function MF(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function ym(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(S=>!o.includes(S));if(i.length){let S=i[0];return e[S].length>1?Dt(S):(r?as:Pr)({facetId:S,facetValue:e[S][0]})}let a=o.filter(S=>!n.includes(S));if(a.length){let S=a[0];return Bt({facetId:S,facetValue:t[S][0]})}let p=o.find(S=>t[S].filter(g=>e[S].includes(g)));if(!p)return Bn();let f=e[p],m=t[p],h=m.filter(S=>!f.includes(S));if(h.length)return Bt({facetId:p,facetValue:h[0]});let A=f.filter(S=>!m.includes(S));return A.length?(r?as:Pr)({facetId:p,facetValue:A[0]}):Bn()}function jF(e={},t={}){return ym(MF(e),MF(t))}function JU(e={},t={}){return ym(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:ZU,getOwnPropertySymbols:eQ}=Object,{hasOwnProperty:tQ}=Object.prototype;function qS(e,t){return function(n,o,i){return e(n,o,i)&&t(n,o,i)}}function Sm(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 LF(e){return ZU(e).concat(eQ(e))}var rQ=Object.hasOwn||((e,t)=>tQ.call(e,t)),nQ="__v",oQ="__o",iQ="_owner",{getOwnPropertyDescriptor:UF,keys:QF}=Object,xi=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function aQ(e,t){return e===t}function sQ(e,t){return e.byteLength===t.byteLength&&vm(new Uint8Array(e),new Uint8Array(t))}function cQ(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 uQ(e,t){return e.byteLength===t.byteLength&&vm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function lQ(e,t){return xi(e.getTime(),t.getTime())}function dQ(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function BF(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,A=0;for(;(p=m.next())&&!p.done;){if(o[A]){A++;continue}let S=a.value,g=p.value;if(r.equals(S[0],g[0],f,A,e,t,r)&&r.equals(S[1],g[1],S[0],g[0],e,t,r)){h=o[A]=!0;break}A++}if(!h)return!1;f++}return!0}function pQ(e,t,r){let n=QF(e),o=n.length;if(QF(t).length!==o)return!1;for(;o-->0;)if(!$F(e,t,r,n[o]))return!1;return!0}function iu(e,t,r){let n=LF(e),o=n.length;if(LF(t).length!==o)return!1;let i,a,p;for(;o-->0;)if(i=n[o],!$F(e,t,r,i)||(a=UF(e,i),p=UF(t,i),(a||p)&&(!a||!p||a.configurable!==p.configurable||a.enumerable!==p.enumerable||a.writable!==p.writable)))return!1;return!0}function fQ(e,t){return xi(e.valueOf(),t.valueOf())}function mQ(e,t){return e.source===t.source&&e.flags===t.flags}function GF(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 vm(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 gQ(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 $F(e,t,r,n){return(n===iQ||n===oQ||n===nQ)&&(e.$$typeof||t.$$typeof)?!0:rQ(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var hQ=Object.prototype.toString;function yQ(e){let t=CQ(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:h}=e;return function(S,g,C){if(S===g)return!0;if(S==null||g==null)return!1;let x=typeof S;if(x!==typeof g)return!1;if(x!=="object")return x==="number"||x==="bigint"?a(S,g,C):x==="function"?o(S,g,C):!1;let w=S.constructor;if(w!==g.constructor)return!1;if(w===Object)return p(S,g,C);if(w===Array)return r(S,g,C);if(w===Date)return n(S,g,C);if(w===RegExp)return f(S,g,C);if(w===Map)return i(S,g,C);if(w===Set)return m(S,g,C);if(w===Promise)return!1;if(Array.isArray(S))return r(S,g,C);let R=hQ.call(S),E=t[R];if(E)return E(S,g,C);let F=h&&h(S,g,C,R);return F?F(S,g,C):!1}}function SQ({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:sQ,areArraysEqual:r?iu:cQ,areDataViewsEqual:uQ,areDatesEqual:lQ,areErrorsEqual:dQ,areFunctionsEqual:aQ,areMapsEqual:r?qS(BF,iu):BF,areNumbersEqual:xi,areObjectsEqual:r?iu:pQ,arePrimitiveWrappersEqual:fQ,areRegExpsEqual:mQ,areSetsEqual:r?qS(GF,iu):GF,areTypedArraysEqual:r?qS(vm,iu):vm,areUrlsEqual:gQ,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=Sm(n.areArraysEqual),i=Sm(n.areMapsEqual),a=Sm(n.areObjectsEqual),p=Sm(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:i,areObjectsEqual:a,areSetsEqual:p})}return n}function vQ(e){return function(t,r,n,o,i,a,p){return e(t,r,p)}}function AQ({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 CQ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:h,areSetsEqual:A,areTypedArraysEqual:S,areUrlsEqual:g}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":i,"[object BigInt]":p,"[object BigInt64Array]":S,"[object BigUint64Array]":S,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":S,"[object Float32Array]":S,"[object Float64Array]":S,"[object Function]":i,"[object GeneratorFunction]":i,"[object Int8Array]":S,"[object Int16Array]":S,"[object Int32Array]":S,"[object Map]":a,"[object Number]":m,"[object Object]":(C,x,w)=>typeof C.then!="function"&&typeof x.then!="function"&&f(C,x,w),"[object RegExp]":h,"[object Set]":A,"[object String]":m,"[object URL]":g,"[object Uint8Array]":S,"[object Uint8ClampedArray]":S,"[object Uint16Array]":S,"[object Uint32Array]":S}}var Y4e=mn(),K4e=mn({strict:!0}),X4e=mn({circular:!0}),J4e=mn({circular:!0,strict:!0}),Z4e=mn({createInternalComparator:()=>xi}),eYe=mn({strict:!0,createInternalComparator:()=>xi}),tYe=mn({circular:!0,createInternalComparator:()=>xi}),rYe=mn({circular:!0,createInternalComparator:()=>xi,strict:!0});function mn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,i=SQ(e),a=yQ(i),p=r?r(a):vQ(a);return AQ({circular:t,comparator:a,createState:n,equals:p,strict:o})}function HF(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function bQ(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>DS(r,n))!==-1)}var DS=mn({createCustomConfig:e=>({...e,areArraysEqual:bQ})});d();c();l();u();d();c();l();u();function zF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function WF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{sortCriteria:n}:{}}function Am(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 YF(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function KF(e){return{q:at().q,enableQuerySyntax:at().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??An().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??An().defaultFilters.cq,firstResult:Lr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Lr().defaultNumberOfResults,sortCriteria:ir(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:wl(),sf:{},tab:"",af:{},mnf:{}}}var xQ=new Ee({parameters:new W({options:{required:!0},values:vd})});function ZF(e,t){let{dispatch:r}=e,n=fe(e);lr(e,xQ,t.initialState,"buildSearchParameterManager");let o=XF(e.state.tabSet,t.initialState.parameters);return r(tt(o)),{...n,synchronize(i){let a=XF(e.state.tabSet,Cm(e,i));r(tt(a))},get state(){return{parameters:MS(e)}}}}function Cm(e,t){return{...KF(e.state),...t}}function XF(e,t){if(te(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:JF(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??JF(e)}}return t}function JF(e){return Object.keys(e)[0]??""}function MS(e){let t=e.state;return{...zF(t.query,r=>r.q,at().q),...YF(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]:""),...WF(t.sortCriteria,r=>r,ir()),...wQ(t),...IQ(t),...EQ(t),...FQ(t),...TQ(t)}}function RQ(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function bm(e){let t=RQ(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,i=tr(n?.tabs,t);return o&&i}}function eT(e){return e.currentValues.filter(t=>t.state==="selected")}function wQ(e){let t=e.facetSet;if(t===void 0)return{};let r=bm(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 IQ(e){return Am(e.categoryFacetSet,bm(e),t=>Dr(t.currentValues).map(r=>r.value),"cf")}function EQ(e){return Am(e.numericFacetSet,bm(e),eT,"nf")}function FQ(e){return Am(e.dateFacetSet,bm(e),eT,"df")}function TQ(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let i=PQ(o);return i.length?{[n]:i}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function PQ(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function tT(e,t){let{dispatch:r}=e,n=ZF(e,t);return{...n,synchronize(o){let i=MS(e),a=Cm(e,i),p=Cm(e,o);DS(a,p)||(n.synchronize(o),r(Se({legacy:VF(a,p),next:DF(a,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var au=()=>new W({values:{questionAnswerId:G},options:{required:!0}}),xm=()=>new W({values:{linkText:Ye,linkURL:Ye},options:{required:!0}});function Ri(e){return _(e,au())}d();c();l();u();function pt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Wb(e,r.contentIdKey,r.contentIdValue)}function Ar(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var rT={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var kQ=()=>Z("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(X(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(e),r=Xe(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}}}}),OQ=()=>Z("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(X(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(e),r=Xe(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}}}}),_Q=()=>Z("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(X(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(e),r=Xe(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}}}}),NQ=()=>Z("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(X(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=pt(e),r=Xe(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}}}}),qQ=()=>Z("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=pt(t);return e.logOpenSmartSnippetSource(Ke(r,t),Xe(r),X(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=pt(e),r=Xe(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}}}}),jS=e=>Z("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,xm());let n=pt(r);return t.logOpenSmartSnippetInlineLink(Ke(n,r),{...Xe(n),...e},X(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=pt(t),n=Xe(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}}}}),DQ=()=>Z("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(X(t.insightCaseContext))),MQ=()=>Z("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(X(t.insightCaseContext))),jQ=e=>Z("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,X(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=pt(t),n=Xe(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:rT[e]}}}),VQ=e=>Z("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,X(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=pt(t),n=Xe(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}}}),LQ=e=>Z("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Ri(e);let n=Ar(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},X(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(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}}}}}),UQ=e=>Z("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Ri(e);let n=Ar(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},X(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(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}}}}}),VS=e=>Z("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,au());let n=Ar(r,e.questionAnswerId);if(!n)return null;let o=pt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Ke(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},X(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Ar(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=pt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),nT=(e,t)=>Z("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,au()),_(t,xm());let o=Ar(n,e.questionAnswerId);if(!o)return null;let i=pt(n,o.documentId);return i?r.logOpenSmartSnippetSuggestionInlineLink(Ke(i,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},X(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Ar(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let i=pt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:i?.title,url:i?.clickUri}}}}}),Rm={logExpandSmartSnippet:kQ,logCollapseSmartSnippet:OQ,logLikeSmartSnippet:_Q,logDislikeSmartSnippet:NQ,logOpenSmartSnippetSource:qQ,logOpenSmartSnippetInlineLink:jS,logOpenSmartSnippetFeedbackModal:DQ,logCloseSmartSnippetFeedbackModal:MQ,logSmartSnippetFeedback:jQ,logSmartSnippetDetailedFeedback:VQ,logExpandSmartSnippetSuggestion:LQ,logCollapseSmartSnippetSuggestion:UQ,logOpenSmartSnippetSuggestionSource:VS};d();c();l();u();d();c();l();u();var Es=T("smartSnippet/expand"),Fs=T("smartSnippet/collapse"),Ts=T("smartSnippet/like"),Ps=T("smartSnippet/dislike"),ks=T("smartSnippet/feedbackModal/open"),Co=T("smartSnippet/feedbackModal/close"),Os=T("smartSnippet/related/expand",e=>Ri(e)),_s=T("smartSnippet/related/collapse",e=>Ri(e));d();c();l();u();d();c();l();u();var LS=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var oT=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function iT({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Ni({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function QQ(e,t){let r=iT(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var gn=ce(LS(),e=>e.addCase(Es,t=>{t.expanded=!0}).addCase(Fs,t=>{t.expanded=!1}).addCase(Ts,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Ps,t=>{t.liked=!1,t.disliked=!0}).addCase(ks,t=>{t.feedbackModalOpen=!0}).addCase(Co,t=>{t.feedbackModalOpen=!1}).addCase(Fe.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((i,a)=>QQ(i,t.relatedQuestions[a])),o=iT(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...LS(),relatedQuestions:n,questionAnswerId:o}}).addCase(Os,(t,r)=>{let n=oT(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(_s,(t,r)=>{let n=oT(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function aT(e,t,r){if(!BQ(e))throw oe;let n=fe(e),o=()=>e.state,i=()=>pt(o()),a=null,p=pn(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(fn(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(Es())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Fs())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Ts())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Ps())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(ks())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Co())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(Co())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(Co())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function BQ(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}d();c();l();u();function wm(e,t){if(!GQ(e))throw oe;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,A,S)=>pn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(A)||e.dispatch(S?nT({questionAnswerId:S},h):jS(h))}),f={},m=(h,A)=>{let{searchResponseId:S}=r().search;a(S);let g=Ni({...h,questionAnswerId:A});return g in f||(f[g]=p(h,g,A)),f[g]};return{selectInlineLink(h,A){m(h,A)?.select()},beginDelayedSelectInlineLink(h,A){m(h,A)?.beginDelayedSelect()},cancelPendingSelectInlineLink(h,A){m(h,A)?.cancelPendingSelect()}}}function GQ(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}function sT(e,t){let r=aT(e,Rm,t),n=wm(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 cT(e,t){if(!$Q(e))throw oe;let r=fe(e),n=()=>e.state,o=i=>{let{contentIdKey:a,contentIdValue:p}=i;return e.state.search.results.find(f=>Xn(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(Os(a))},collapse(i){let a={questionAnswerId:i};e.dispatch(t.logCollapseSmartSnippetSuggestion(a)),e.dispatch(_s(a))}}}function $Q(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}d();c();l();u();function uT(e,t){if(!HQ(e))throw oe;let r=()=>e.state,n=A=>{let S=r(),g=Ar(S,A);return g?pt(S,g.documentId):null},o=new Set,i=A=>o.has(A)?!0:(o.add(A),!1),a=null,p=A=>{a!==A&&(a=A,m={},o.clear())},f=(A,S)=>pn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{i(S)||(e.dispatch(VS({questionAnswerId:S})),e.dispatch(fn(A)))}),m={},h=A=>{let{searchResponseId:S}=r().search;p(S);let g=n(A);return g?(A in m||(m[A]=f(g,A)),m[A]):null};return{selectSource(A){h(A)?.select()},beginDelayedSelectSource(A){h(A)?.beginDelayedSelect()},cancelPendingSelectSource(A){h(A)?.cancelPendingSelect()}}}function HQ(e){return e.addReducers({search:xe,questionAnswering:gn}),!0}function lT(e,t){let r=cT(e,Rm),n=wm(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=uT(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 dT={by:new Us({enum:ul,required:!0})},Im=T("sortCriteria/register",e=>pT(e)),Em=T("sortCriteria/update",e=>pT(e)),pT=e=>_i(e)?(e.forEach(t=>_(t,dT)),{payload:e}):_(e,dT);d();c();l();u();var fT=ce(ir(),e=>{e.addCase(Im,(t,r)=>Mr(r.payload)).addCase(Em,(t,r)=>Mr(r.payload)).addCase(Ze.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(tt,(t,r)=>r.payload.sortCriteria??t)});function zQ(e,t){if(!t)return;let r=new Ee({criterion:new re({each:GC})}),n=WQ(t),o={...t,criterion:n};lr(e,r,o,"buildSort")}function WQ(e){return e.criterion?_i(e.criterion)?e.criterion:[e.criterion]:[]}function mT(e,t){if(!YQ(e))throw oe;let r=fe(e),{dispatch:n}=e,o=()=>e.state;zQ(e,t.initialState);let i=t.initialState?.criterion;return i&&n(Im(i)),{...r,sortBy(a){n(Em(a)),n(Gn(1))},isSortedBy(a){return this.state.sortCriteria===Mr(a)},get state(){return{sortCriteria:o().sortCriteria}}}}function YQ(e){return e.addReducers({configuration:ve,sortCriteria:fT}),!0}function gT(e,t={}){let{dispatch:r}=e,n=mT(e,t),o=()=>r(Se({legacy:Is(),next:gm()}));return{...n,get state(){return n.state},sortBy(i){n.sortBy(i),o()}}}d();c();l();u();function hT(e){return ys(e)}d();c();l();u();d();c();l();u();var KQ=new Ee({expression:Ye,id:G,clearFiltersOnTabChange:new ue}),XQ=new Ee({isActive:new ue});function yT(e,t){if(ZQ(t.options.id),!JQ(e))throw oe;let r=fe(e),{dispatch:n}=e;mt(e,KQ,t.options,"buildTab");let o=lr(e,XQ,t.initialState,"buildTab"),{id:i,expression:a}=t.options;return n(Cd({id:i,expression:a})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(Tt(i)),{...r,select(){t.options.clearFiltersOnTabChange&&n(va({q:"",clearFilters:!0})),n(Tt(i))},get state(){return{isActive:e.state.tabSet[i]?.isActive}}}}function JQ(e){return e.addReducers({configuration:ve,tabSet:wf}),!0}function ZQ(e){let t=xd().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 ST(e,t){let{dispatch:r}=e,n=yT(e,t),o=()=>r(Se({legacy:Bn(),next:la()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var vT=()=>Z("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},X(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function AT(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function CT(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 bT(e,t){return e.queryModification={...t,queryToIgnore:""},e}function xT(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var RT=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var wT=ce(RT(),e=>e.addCase(Fe.pending,AT).addCase(Fe.fulfilled,(t,r)=>CT(t,r.payload.response.triggers)).addCase(Sa,(t,r)=>bT(t,r.payload)).addCase(ya,(t,r)=>xT(t,r.payload)));function IT(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!eB(e))throw oe;let n=fe(e),{dispatch:o}=e,i=()=>e.state,a=i().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!HF(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 eB(e){return e.addReducers({triggers:wT}),!0}function ET(e){return IT(e,{options:{logNotifyTriggerActionCreator:vT}})}d();c();l();u();d();c();l();u();var FT=(e,t)=>Z("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=X(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=X(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),TT=e=>Z("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:G}),t.logCreateArticle(e,X(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=X(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Fm=()=>Z("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(X(t.insightCaseContext))});d();c();l();u();d();c();l();u();var PT=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),userId:t}});return function PT(_x234,_x235){return _ref100.apply(this,arguments)}}();var tB={ticketCreationDate:new L({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new re({required:!1,each:He})},Ns=T("insight/userActions/registerUserActions",e=>_(e,tB)),bo=le("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 PT(o,e));return Ge(i)?r(i.error):{response:i.success}});return function(_x236,_x237){return _ref101.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function kT(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var rB=1e3,nB=rB*60,US=30*nB,oB=2,iB=2,NT=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,i=sB(t);return uB(i,n,o)},aB=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}},sB=e=>{let t=!1,r=e.reduce((n,o)=>{try{let i=aB(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},cB=(e,t)=>Math.abs(e.timestamp-t)<US,OT=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-US&&t<=e.end+US){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)},_T=(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},uB=(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(cB(i,o.start)){o.actions.push(i),o.start=i.timestamp;return}o.actions=o.actions.filter(a=>!_T(a,r)),OT(o,t,n),o={start:i.timestamp,end:i.timestamp,actions:[i]}}),o.actions=o.actions.filter(i=>!_T(i,r)),OT(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,oB),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-iB)}};var Tm=ce(kT(),e=>{e.addCase(Ns,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(bo.pending,t=>{t.loading=!0,t.error=void 0}).addCase(bo.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(bo.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=NT(t,r.payload.response.value)})});function qT(e,t){if(!lB(e))throw oe;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=fe(e),{ticketCreationDate:i,excludedCustomActions:a}=t.options;return r(Ns({ticketCreationDate:i,excludedCustomActions:a})),{...o,get state(){return n()},fetchUserActions(p){r(bo(p))},logOpenUserActions(){r(Fm())}}}function lB(e){return e.addReducers({configuration:ve,insightUserActions:Tm}),!0}d();c();l();u();function DT(e){if(!dB(e))throw oe;let t=fe(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(jr())}}}function dB(e){return e.addReducers({configuration:ve,insightConfiguration:Al,insightInterface:Un,searchHub:Kl}),!0}d();c();l();u();function pB(e){return e.addReducers({}),{logSearchEvent:rb,logClickEvent:nb,logCustomEvent:ob}}d();c();l();u();d();c();l();u();var MT=e=>Z("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ft(e);let n=X(r.insightCaseContext);return t.logCopyToClipboard(Ke(e,r),Xe(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Fr(t)}}}),jT=e=>Z("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ft(e);let n=X(r.insightCaseContext);return t.logCaseSendEmail(Ke(e,r),Xe(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Fr(t)}}}),VT=e=>Z("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ft(e);let n=X(r.insightCaseContext);return t.logFeedItemTextPost(Ke(e,r),Xe(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Ke(e,t);return{itemMetadata:xr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Fr(t)}}});function fB(e){return e.addReducers({}),{logClearBreadcrumbs:rf,logInterfaceLoad:Tl,logInterfaceChange:Bn,logCreateArticle:TT,logCategoryFacetBreadcrumb:Qp,logFacetBreadcrumb:zc,logFacetClearAll:Dt,logFacetDeselect:Pr,logFacetSelect:Bt,logFacetShowLess:cs,logFacetShowMore:ss,logFacetUpdateSort:rn,logDateFacetBreadcrumb:Wc,logNumericFacetBreadcrumb:Yc,logPageNext:sm,logPageNumber:am,logPagePrevious:cm,logResultsSort:Is,logStaticFilterDeselect:Cf,logCopyToClipboard:MT,logCaseSendEmail:jT,logFeedItemTextPost:VT,logOpenUserActions:Fm}}d();c();l();u();function mB(e){return e.addReducers({attachedResults:co}),{setAttachedResults:Vp,detachResult:so,attachResult:ao}}d();c();l();u();function gB(e){return e.addReducers({attachedResults:co}),{logCaseDetach:Xa,logCaseAttach:Ka}}d();c();l();u();d();c();l();u();d();c();l();u();var Pm=T("insight/caseContext/set",e=>{let t=new W({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new re({each:Ye}),i=_(n,o).error;return i?{payload:e,error:i}:{payload:e}}),km=T("insight/caseId/set",e=>{let r=_(e,Ye).error;return r?{payload:e,error:r}:{payload:e}}),Om=T("insight/caseNumber/set",e=>{let r=_(e,Ye).error;return r?{payload:e,error:r}:{payload:e}});var LT=ce(Cb(),e=>{e.addCase(Pm,(t,r)=>{t.caseContext=r.payload}).addCase(km,(t,r)=>{t.caseId=r.payload}).addCase(Om,(t,r)=>{t.caseNumber=r.payload})});function hB(e){return e.addReducers({insightCaseContext:LT}),{setCaseContext:Pm,setCaseId:km,setCaseNumber:Om}}d();c();l();u();d();c();l();u();d();c();l();u();var yB=new re({each:G,required:!0}),UT=(e,t)=>(_(e,G),Oi(t)?_(t,G):_(t,yB),{payload:{contextKey:e,contextValue:t}}),_m=T("context/set",e=>{for(let[t,r]of Object.entries(e))UT(t,r);return{payload:e}}),Nm=T("context/add",e=>UT(e.contextKey,e.contextValue)),qm=T("context/remove",e=>_(e,G));var QT=ce(Rl(),e=>{e.addCase(_m,(t,r)=>{t.contextValues=r.payload}).addCase(Nm,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(qm,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ze.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function SB(e){return e.addReducers({context:QT}),{addContext:Nm,removeContext:qm,setContext:_m}}d();c();l();u();function vB(e){return e.addReducers({dateFacetSet:cn}),{deselectAllDateFacetValues:af,registerDateFacet:nn,toggleSelectDateFacetValue:on,toggleExcludeDateFacetValue:an,updateDateFacetSortCriterion:of,updateDateFacetValues:Pn}}d();c();l();u();function AB(e){return e.addReducers({numericFacetSet:fo}),{deselectAllNumericFacetValues:vf,registerNumericFacet:un,toggleSelectNumericFacetValue:ln,toggleExcludeNumericFacetValue:dn,updateNumericFacetSortCriterion:Sf,updateNumericFacetValues:kn}}d();c();l();u();function CB(e){return e.addReducers({fields:hs}),{registerFieldsToInclude:vo,enableFetchAllFields:Jf,disableFetchAllFields:Zf,fetchFieldsDescription:em}}d();c();l();u();function bB(e){return e.addReducers({folding:Xf}),{registerFolding:jE,loadCollection:Wf}}d();c();l();u();function xB(e){return e.addReducers({generatedAnswer:Ss}),{generateAnswer:hd,resetAnswer:ar,setAnswerGenerationMode:od}}d();c();l();u();function RB(e){return e.addReducers({insightInterface:Un}),{fetch:jr}}d();c();l();u();function wB(e){return e.addReducers({querySet:xs}),{registerQuerySetQuery:bs,updateQuerySetQuery:bi}}d();c();l();u();function IB(e){return e.addReducers({search:xe}),{executeSearch:Ib,fetchFacetValues:Tb,fetchMoreResults:Fb,fetchPage:Eb,fetchQuerySuggestions:Nl,registerQuerySuggest:go}}d();c();l();u();function EB(e){return e.addReducers({}),{logContextChanged:bb,logExpandToFullUI:FT}}d();c();l();u();function FB(e){return e.addReducers({insightUserActions:Tm}),{registerUserActions:Ns,fetchUserActions:bo}}d();c();l();u();function TB(e){return e.addReducers({querySuggest:mm,querySet:xs}),{clearQuerySuggest:yo,fetchQuerySuggestions:gs,registerQuerySuggest:go,selectQuerySuggestion:ho}}d();c();l();u();function PB(e){return e.addReducers({questionAnswering:gn}),{collapseSmartSnippet:Fs,expandSmartSnippet:Es,dislikeSmartSnippet:Ps,likeSmartSnippet:Ts,openFeedbackModal:ks,closeFeedbackModal:Co,expandSmartSnippetRelatedQuestion:Os,collapseSmartSnippetRelatedQuestion:_s}}d();c();l();u();d();c();l();u();d();c();l();u();function BT(){return{results:[],maxLength:10}}var GT=ce(BT(),e=>{e.addCase(lm,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(dm,t=>{t.results=[]}).addCase(fn,(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 kB(e){return e.addReducers({recentResults:GT}),{registerRecentResults:lm,clearRecentResults:dm,pushRecentResult:fn}}d();c();l();u();d();c();l();u();var OB=new Ee({content:new Be({required:!0}),conditions:new Be({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new re({required:!1,each:G})});function $T(){let e=[],t=r=>{let n=OB.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new xo("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 HT(e){if(!_B(e))throw oe;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=$T();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(vo(i))},selectTemplate:r,selectLinkTemplate:n}}function _B(e){return e.addReducers({fields:hs}),!0}/**
46
46
  * @license
47
47
  *
48
48
  * Copyright 2026 Coveo Solutions Inc.
@@ -75,4 +75,4 @@ fast-json-patch/module/duplex.mjs:
75
75
  *)
76
76
  */if(__exports!=exports)module.exports=exports;return module.exports});
77
77
 
78
- window.coveoQuanticVersion = '3.36.8';
78
+ window.coveoQuanticVersion = '3.36.10';