@algolia/sitesearch
Version:
Opinionated site search modal for the web. Ships zero-build CDN bundles (JS + CSS) and a one-line init API. Powered by Algolia InstantSearch.
122 lines • 473 kB
JavaScript
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SiteSearchAskAI={}))})(this,function(exports){Object.defineProperty(exports,`__esModule`,{value:!0});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(n({},`__esModule`,{value:!0}),e);function p(e,t){for(var n in t)e[n]=t[n];return e}function m(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function h(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?be.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return g(e,o,r,i,null)}function g(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xe,__i:-1,__u:0};return i==null&&w.vnode!=null&&w.vnode(a),a}function _(){return{current:null}}function v(e){return e.children}function y(e,t){this.props=e,this.context=t}function b(e,t){if(t==null)return e.__?b(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?b(e):null}function x(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return x(e)}}function S(e){(!e.__d&&(e.__d=!0)&&Ce.push(e)&&!C.__r++||we!=w.debounceRendering)&&((we=w.debounceRendering)||Te)(C)}function C(){for(var e,t,n,r,i,a,o,s=1;Ce.length;)Ce.length>s&&Ce.sort(Ee),e=Ce.shift(),s=Ce.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,a=[],o=[],t.__P&&((n=p({},r)).__v=r.__v+1,w.vnode&&w.vnode(n),ce(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,a,i??b(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,ue(a,n,o),r.__e=r.__=null,n.__e!=i&&x(n)));C.__r=0}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||Ne,y=t.length;for(c=te(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i==-1?Me:v[p.__i]||Me,p.__i=d,g=ce(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&pe(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?c=ne(p,c,e,_):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function te(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?g(null,o,null,null,null):Fe(o)?g(v,{children:o},null,null,null):o.constructor==null&&o.__b>0?g(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=ie(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=b(s)),me(s,s));return r}function ne(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=ne(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=b(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function re(e,t){return t||=[],e==null||typeof e==`boolean`||(Fe(e)?e.some(function(e){re(e,t)}):t.push(e)),t}function ie(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ae(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||Pe.test(t)?n:n+`px`}function oe(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ae(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ae(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(De,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=Oe,e.addEventListener(t,a?Ae:ke,a)):e.removeEventListener(t,a?Ae:ke,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function se(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Oe++;else if(t.t<n.u)return;return n(w.event?w.event(t):t)}}}function ce(e,t,n,r,i,a,o,s,c,l){var u,d,f,h,g,_,b,x,S,C,te,ne,re,ie,ae,oe,se,ce=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=w.__b)&&u(t);n:if(typeof ce==`function`)try{if(x=t.props,S=`prototype`in ce&&ce.prototype.render,C=(u=ce.contextType)&&r[u.__c],te=u?C?C.props.value:u.__:r,n.__c?b=(d=t.__c=n.__c).__=d.__E:(S?t.__c=d=new ce(x,te):(t.__c=d=new y(x,te),d.constructor=ce,d.render=he),C&&C.sub(d),d.props=x,d.state||={},d.context=te,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),S&&d.__s==null&&(d.__s=d.state),S&&ce.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=p({},d.__s)),p(d.__s,ce.getDerivedStateFromProps(x,d.__s))),h=d.props,g=d.state,d.__v=t,f)S&&ce.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),S&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(S&&ce.getDerivedStateFromProps==null&&x!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(x,te),!d.__e&&d.shouldComponentUpdate!=null&&!1===d.shouldComponentUpdate(x,d.__s,te)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=x,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ne=0;ne<d._sb.length;ne++)d.__h.push(d._sb[ne]);d._sb=[],d.__h.length&&o.push(d);break n}d.componentWillUpdate!=null&&d.componentWillUpdate(x,d.__s,te),S&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,g,_)})}if(d.context=te,d.props=x,d.__P=e,d.__e=!1,re=w.__r,ie=0,S){for(d.state=d.__s,d.__d=!1,re&&re(t),u=d.render(d.props,d.state,d.context),ae=0;ae<d._sb.length;ae++)d.__h.push(d._sb[ae]);d._sb=[]}else do d.__d=!1,re&&re(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++ie<25);d.state=d.__s,d.getChildContext!=null&&(r=p(p({},r),d.getChildContext())),S&&!f&&d.getSnapshotBeforeUpdate!=null&&(_=d.getSnapshotBeforeUpdate(h,g)),oe=u,u!=null&&u.type===v&&u.key==null&&(oe=de(u.props.children)),s=ee(e,Fe(oe)?oe:[oe],t,n,r,i,a,o,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),b&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(se=a.length;se--;)m(a[se]);le(t)}else t.__e=n.__e,t.__k=n.__k,e.then||le(t);w.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=fe(n.__e,t,n,r,i,a,o,c,l);return(u=w.diffed)&&u(t),128&t.__u?void 0:s}function le(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(le)}function ue(e,t,n){for(var r=0;r<n.length;r++)pe(n[r],n[++r],n[++r]);w.__c&&w.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){w.__e(e,t.__v)}})}function de(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Fe(e)?e.map(de):p({},e)}function fe(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,h,g,_=n.props,v=t.props,y=t.type;if(y==`svg`?i=`http://www.w3.org/2000/svg`:y==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!y&&(y?p.localName==y:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(v);e=document.createElementNS(i,y,v.is&&v),s&&(w.__m&&w.__m(t,a),s=!1),a=null}if(y==null)_===v||s&&e.data==v||(e.data=v);else{if(a&&=be.call(e.childNodes),_=n.props||Me,!s&&a!=null)for(_={},l=0;l<e.attributes.length;l++)_[(p=e.attributes[l]).name]=p.value;for(l in _)if(p=_[l],l!=`children`){if(l==`dangerouslySetInnerHTML`)d=p;else if(!(l in v)){if(l==`value`&&`defaultValue`in v||l==`checked`&&`defaultChecked`in v)continue;oe(e,l,null,p,i)}}for(l in v)p=v[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?h=p:l==`checked`?g=p:s&&typeof p!=`function`||_[l]===p||oe(e,l,p,_[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,Fe(f)?f:[f],t,n,r,y==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&b(n,0),s,c),a!=null)for(l=a.length;l--;)m(a[l]);s||(l=`value`,y==`progress`&&h==null?e.removeAttribute(`value`):h!=null&&(h!==e[l]||y==`progress`&&!h||y==`option`&&h!=_[l])&&oe(e,l,h,_[l],i),l=`checked`,g!=null&&g!=e[l]&&oe(e,l,g,_[l],i))}return e}function pe(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){w.__e(e,n)}}function me(e,t,n){var r,i;if(w.unmount&&w.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){w.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&me(r[i],t,n||typeof e.type!=`function`);n||m(e.__e),e.__c=e.__=e.__e=void 0}function he(e,t,n){return this.constructor(e,n)}function ge(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),w.__&&w.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],ce(t,e=(!r&&n||t).__k=h(v,null,[e]),i||Me,Me,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?be.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ue(a,e,o)}function _e(e,t){ge(e,t,_e)}function ve(e,t,n){var r,i,a,o,s=p({},e.props);for(a in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)a==`key`?r=t[a]:a==`ref`?i=t[a]:s[a]=t[a]===void 0&&o!=null?o[a]:t[a];return arguments.length>2&&(s.children=arguments.length>3?be.call(arguments,2):n),g(e.type,s,r||e.key,i||e.ref,null)}function ye(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,S(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+ je++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}var be,w,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie=s(()=>{Me={},Ne=[],Pe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fe=Array.isArray,be=Ne.slice,w={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},xe=0,Se=function(e){return e!=null&&e.constructor==null},y.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=p({},this.state),typeof e==`function`&&(e=e(p({},n),this.props)),e&&p(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),S(this))},y.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),S(this))},y.prototype.render=v,Ce=[],Te=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ee=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0,De=/(PointerCapture)$|Capture$/i,Oe=0,ke=se(!1),Ae=se(!0),je=0});function Le(){function e(e){return new Promise(t=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),Object.keys(e.headers).forEach(t=>n.setRequestHeader(t,e.headers[t]));let r=(e,r)=>setTimeout(()=>{n.abort(),t({status:0,content:r,isTimedOut:!0})},e),i=r(e.connectTimeout,`Connection timeout`),a;n.onreadystatechange=()=>{n.readyState>n.OPENED&&a===void 0&&(clearTimeout(i),a=r(e.responseTimeout,`Socket timeout`))},n.onerror=()=>{n.status===0&&(clearTimeout(i),clearTimeout(a),t({content:n.responseText||`Network request failed`,status:n.status,isTimedOut:!1}))},n.onload=()=>{clearTimeout(i),clearTimeout(a),t({content:n.responseText,status:n.status,isTimedOut:!1})},n.send(e.data)})}return{send:e}}function Re(e){let t,n=`algolia-client-js-${e.key}`;function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function i(){return JSON.parse(r().getItem(n)||`{}`)}function a(e){r().setItem(n,JSON.stringify(e))}function o(){let t=e.timeToLive?e.timeToLive*1e3:null,n=i(),r=Object.fromEntries(Object.entries(n).filter(([,e])=>e.timestamp!==void 0));if(a(r),!t)return;let o=Object.fromEntries(Object.entries(r).filter(([,e])=>{let n=new Date().getTime(),r=e.timestamp+t<n;return!r}));a(o)}return{get(e,t,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(o(),i()[JSON.stringify(e)])).then(e=>Promise.all([e?e.value:t(),e!==void 0])).then(([e,t])=>Promise.all([e,t||n.miss(e)])).then(([e])=>e)},set(e,t){return Promise.resolve().then(()=>{let a=i();return a[JSON.stringify(e)]={timestamp:new Date().getTime(),value:t},r().setItem(n,JSON.stringify(a)),t})},delete(e){return Promise.resolve().then(()=>{let t=i();delete t[JSON.stringify(e)],r().setItem(n,JSON.stringify(t))})},clear(){return Promise.resolve().then(()=>{r().removeItem(n)})}}}function ze(){return{get(e,t,n={miss:()=>Promise.resolve()}){let r=t();return r.then(e=>Promise.all([e,n.miss(e)])).then(([e])=>e)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function Be(e){let t=[...e.caches],n=t.shift();return n===void 0?ze():{get(e,r,i={miss:()=>Promise.resolve()}){return n.get(e,r,i).catch(()=>Be({caches:t}).get(e,r,i))},set(e,r){return n.set(e,r).catch(()=>Be({caches:t}).set(e,r))},delete(e){return n.delete(e).catch(()=>Be({caches:t}).delete(e))},clear(){return n.clear().catch(()=>Be({caches:t}).clear())}}}function Ve(e={serializable:!0}){let t={};return{get(n,r,i={miss:()=>Promise.resolve()}){let a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);let o=r();return o.then(e=>i.miss(e)).then(()=>o)},set(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function He(e){let t={value:`Algolia for JavaScript (${e})`,add(e){let n=`; ${e.segment}${e.version===void 0?``:` (${e.version})`}`;return t.value.indexOf(n)===-1&&(t.value=`${t.value}${n}`),t}};return t}function Ue(e,t,n=`WithinHeaders`){let r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return n===`WithinHeaders`?r:{}},queryParameters(){return n===`WithinQueryParameters`?r:{}}}}function We({algoliaAgents:e,client:t,version:n}){let r=He(n).add({segment:t,version:n});return e.forEach(e=>r.add(e)),r}function Ge(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var Ke=2*60*1e3;function qe(e,t=`up`){let n=Date.now();function r(){return t===`up`||Date.now()-n>Ke}function i(){return t===`timed out`&&Date.now()-n<=Ke}return{...e,status:t,lastUpdate:n,isUp:r,isTimedOut:i}}var Je=class extends Error{name=`AlgoliaError`;constructor(e,t){super(e),t&&(this.name=t)}},Ye=class extends Je{stackTrace;constructor(e,t,n){super(e,n),this.stackTrace=t}},Xe=class extends Ye{constructor(e){super(`Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support`,e,`RetryError`)}},Ze=class extends Ye{status;constructor(e,t,n,r=`ApiError`){super(e,n,r),this.status=t}},Qe=class extends Je{response;constructor(e,t){super(e,`DeserializationError`),this.response=t}},$e=class extends Ze{error;constructor(e,t,n,r){super(e,t,r,`DetailedApiError`),this.error=n}};function et(e){let t=e;for(let n=e.length-1;n>0;n--){let r=Math.floor(Math.random()*(n+1)),i=e[n];t[n]=e[r],t[r]=i}return t}function tt(e,t,n){let r=nt(n),i=`${e.protocol}://${e.url}${e.port?`:${e.port}`:``}/${t.charAt(0)===`/`?t.substring(1):t}`;return r.length&&(i+=`?${r}`),i}function nt(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${t}=${encodeURIComponent(Object.prototype.toString.call(e[t])===`[object Array]`?e[t].join(`,`):e[t]).replace(/\+/g,`%20`)}`).join(`&`)}function rt(e,t){if(e.method===`GET`||e.data===void 0&&t.data===void 0)return;let n=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(n)}function it(e,t,n){let r={Accept:`application/json`,...e,...t,...n},i={};return Object.keys(r).forEach(e=>{let t=r[e];i[e.toLowerCase()]=t}),i}function at(e){try{return JSON.parse(e.content)}catch(t){throw new Qe(t.message,e)}}function ot({content:e,status:t},n){try{let r=JSON.parse(e);return`error`in r?new $e(r.message,t,r.error,n):new Ze(r.message,t,n)}catch{}return new Ze(e,t,n)}function st({isTimedOut:e,status:t}){return!e&&~~t===0}function ct({isTimedOut:e,status:t}){return e||st({isTimedOut:e,status:t})||~~(t/100)!=2&&~~(t/100)!=4}function lt({status:e}){return~~(e/100)==2}function ut(e){return e.map(e=>dt(e))}function dt(e){let t=e.request.headers[`x-algolia-api-key`]?{"x-algolia-api-key":`*****`}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ft({hosts:e,hostsCache:t,baseHeaders:n,logger:r,baseQueryParameters:i,algoliaAgent:a,timeouts:o,requester:s,requestsCache:c,responsesCache:l}){async function u(e){let n=await Promise.all(e.map(e=>t.get(e,()=>Promise.resolve(qe(e))))),r=n.filter(e=>e.isUp()),i=n.filter(e=>e.isTimedOut()),a=[...r,...i],o=a.length>0?a:e;return{hosts:o,getTimeout(e,t){let n=i.length===0&&e===0?1:i.length+3+e;return n*t}}}async function d(c,l,d=!0){let f=[],p=rt(c,l),m=it(n,c.headers,l.headers),h=c.method===`GET`?{...c.data,...l.data}:{},g={...i,...c.queryParameters,...h};if(a.value&&(g[`x-algolia-agent`]=a.value),l&&l.queryParameters)for(let e of Object.keys(l.queryParameters))!l.queryParameters[e]||Object.prototype.toString.call(l.queryParameters[e])===`[object Object]`?g[e]=l.queryParameters[e]:g[e]=l.queryParameters[e].toString();let _=0,v=async(e,n)=>{let i=e.pop();if(i===void 0)throw new Xe(ut(f));let a={...o,...l.timeouts},u={data:p,headers:m,method:c.method,url:tt(i,c.path,g),connectTimeout:n(_,a.connect),responseTimeout:n(_,d?a.read:a.write)},h=t=>{let n={request:u,response:t,host:i,triesLeft:e.length};return f.push(n),n},y=await s.send(u);if(ct(y)){let a=h(y);return y.isTimedOut&&_++,r.info(`Retryable failure`,dt(a)),await t.set(i,qe(i,y.isTimedOut?`timed out`:`down`)),v(e,n)}if(lt(y))return at(y);throw h(y),ot(y,f)},y=e.filter(e=>e.accept===`readWrite`||(d?e.accept===`read`:e.accept===`write`)),b=await u(y);return v([...b.hosts].reverse(),b.getTimeout)}function f(e,t={}){let r=e.useReadTransporter||e.method===`GET`;if(!r)return d(e,t,r);let a=()=>d(e,t),o=t.cacheable||e.cacheable;if(o!==!0)return a();let s={request:e,requestOptions:t,transporter:{queryParameters:i,headers:n}};return l.get(s,()=>c.get(s,()=>c.set(s,a()).then(e=>Promise.all([c.delete(s),e]),e=>Promise.all([c.delete(s),Promise.reject(e)])).then(([e,t])=>t)),{miss:e=>l.set(s,e)})}return{hostsCache:t,requester:s,timeouts:o,logger:r,algoliaAgent:a,baseHeaders:n,baseQueryParameters:i,hosts:e,request:f,requestsCache:c,responsesCache:l}}var pt=`5.40.0`;function mt(e){return[{url:`${e}-dsn.algolia.net`,accept:`read`,protocol:`https`},{url:`${e}.algolia.net`,accept:`write`,protocol:`https`}].concat(et([{url:`${e}-1.algolianet.com`,accept:`readWrite`,protocol:`https`},{url:`${e}-2.algolianet.com`,accept:`readWrite`,protocol:`https`},{url:`${e}-3.algolianet.com`,accept:`readWrite`,protocol:`https`}]))}function ht({appId:e,apiKey:t,authMode:n,algoliaAgents:r,...i}){let a=Ue(e,t,n),o=ft({hosts:mt(e),...i,algoliaAgent:We({algoliaAgents:r,client:`Lite`,version:pt}),baseHeaders:{"content-type":`text/plain`,...a.headers(),...i.baseHeaders},baseQueryParameters:{...a.queryParameters(),...i.baseQueryParameters}});return{transporter:o,appId:e,apiKey:t,clearCache(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then(()=>void 0)},get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!n||n===`WithinHeaders`?o.baseHeaders[`x-algolia-api-key`]=e:o.baseQueryParameters[`x-algolia-api-key`]=e},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},customPost({path:e,parameters:t,body:n},r){if(!e)throw Error("Parameter `path` is required when calling `customPost`.");let i=`/{path}`.replace(`{path}`,e),a={},s=t||{},c={method:`POST`,path:i,queryParameters:s,headers:a,data:n||{}};return o.request(c,r)},getRecommendations(e,t){if(e&&Array.isArray(e)){let t={requests:e};e=t}if(!e)throw Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let n=`/1/indexes/*/recommendations`,r={},i={},a={method:`POST`,path:n,queryParameters:i,headers:r,data:e,useReadTransporter:!0,cacheable:!0};return o.request(a,t)},search(e,t){if(e&&Array.isArray(e)){let t={requests:e.map(({params:e,...t})=>t.type===`facet`?{...t,...e,type:`facet`}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})};e=t}if(!e)throw Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let n=`/1/indexes/*/queries`,r={},i={},a={method:`POST`,path:n,queryParameters:i,headers:r,data:e,useReadTransporter:!0,cacheable:!0};return o.request(a,t)}}}function gt(e,t,n){if(!e||typeof e!=`string`)throw Error("`appId` is missing.");if(!t||typeof t!=`string`)throw Error("`apiKey` is missing.");return ht({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},logger:Ge(),requester:Le(),algoliaAgents:[{segment:`Browser`}],authMode:`WithinQueryParameters`,responsesCache:Ve(),requestsCache:Ve({serializable:!1}),hostsCache:Be({caches:[Re({key:`${pt}-${e}`}),Ve()]}),...n})}function _t(e,t){Bt.__h&&Bt.__h(Ft,e,Rt||t),Rt=0;var n=Ft.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function T(e){return Rt=1,vt(Nt,e)}function vt(e,t,n){var r=_t(Pt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Nt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ft,!Ft.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};Ft.__f=!0;var a=Ft.shouldComponentUpdate,o=Ft.componentWillUpdate;Ft.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Ft.shouldComponentUpdate=i}return r.__N||r.__}function E(e,t){var n=_t(Pt++,3);!Bt.__s&&Mt(n.__H,t)&&(n.__=e,n.u=t,Ft.__H.__h.push(n))}function yt(e,t){var n=_t(Pt++,4);!Bt.__s&&Mt(n.__H,t)&&(n.__=e,n.u=t,Ft.__h.push(n))}function bt(e){return Rt=5,St(function(){return{current:e}},[])}function xt(e,t,n){Rt=6,yt(function(){if(typeof e==`function`){var n=e(t());return function(){e(null),n&&typeof n==`function`&&n()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function St(e,t){var n=_t(Pt++,7);return Mt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ct(e,t){return Rt=8,St(function(){return e},t)}function wt(e){var t=Ft.context[e.__c],n=_t(Pt++,9);return n.c=e,t?(n.__??(n.__=!0,t.sub(Ft)),t.props.value):e.__}function Tt(e,t){Bt.useDebugValue&&Bt.useDebugValue(t?t(e):e)}function Et(e){var t=_t(Pt++,10),n=T();return t.__=e,Ft.componentDidCatch||=function(e,r){t.__&&t.__(e,r),n[1](e)},[n[0],function(){n[1](void 0)}]}function Dt(){var e=_t(Pt++,11);if(!e.__){for(var t=Ft.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||=[0,0];e.__=`P`+n[0]+`-`+ n[1]++}return e.__}function Ot(){for(var e;e=zt.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(At),e.__H.__h.forEach(jt),e.__H.__h=[]}catch(t){e.__H.__h=[],Bt.__e(t,e.__v)}}function kt(e){var t,n=function(){clearTimeout(r),qt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);qt&&(t=requestAnimationFrame(n))}function At(e){var t=Ft,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Ft=t}function jt(e){var t=Ft;e.__c=e.__(),Ft=t}function Mt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Nt(e,t){return typeof t==`function`?t(e):t}var Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt=s(()=>{Ie(),Rt=0,zt=[],Bt=w,Vt=Bt.__b,Ht=Bt.__r,Ut=Bt.diffed,Wt=Bt.__c,Gt=Bt.unmount,Kt=Bt.__,Bt.__b=function(e){Ft=null,Vt&&Vt(e)},Bt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Kt&&Kt(e,t)},Bt.__r=function(e){Ht&&Ht(e),Pt=0;var t=(Ft=e.__c).__H;t&&(It===Ft?(t.__h=[],Ft.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(At),t.__h.forEach(jt),t.__h=[],Pt=0)),It=Ft},Bt.diffed=function(e){Ut&&Ut(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zt.push(t)!==1&&Lt===Bt.requestAnimationFrame||((Lt=Bt.requestAnimationFrame)||kt)(Ot)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),It=Ft=null},Bt.__c=function(e,t){t.some(function(e){try{e.__h.forEach(At),e.__h=e.__h.filter(function(e){return!e.__||jt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Bt.__e(n,e.__v)}}),Wt&&Wt(e,t)},Bt.unmount=function(e){Gt&&Gt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{At(e)}catch(e){t=e}}),n.__H=void 0,t&&Bt.__e(t,n.__v))},qt=typeof requestAnimationFrame==`function`}),Yt={};l(Yt,{Children:()=>Mn,Component:()=>y,Fragment:()=>v,PureComponent:()=>rn,StrictMode:()=>Qn,Suspense:()=>ln,SuspenseList:()=>fn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>Jn,cloneElement:()=>Tn,createContext:()=>ye,createElement:()=>h,createFactory:()=>xn,createPortal:()=>hn,createRef:()=>_,default:()=>er,findDOMNode:()=>Dn,flushSync:()=>Zn,forwardRef:()=>on,hydrate:()=>_n,isElement:()=>$n,isFragment:()=>Cn,isMemo:()=>wn,isValidElement:()=>Sn,lazy:()=>dn,memo:()=>an,render:()=>gn,startTransition:()=>en,unmountComponentAtNode:()=>En,unstable_batchedUpdates:()=>Xn,useCallback:()=>Ct,useContext:()=>wt,useDebugValue:()=>Tt,useDeferredValue:()=>tn,useEffect:()=>E,useErrorBoundary:()=>Et,useId:()=>Dt,useImperativeHandle:()=>xt,useInsertionEffect:()=>On,useLayoutEffect:()=>yt,useMemo:()=>St,useReducer:()=>vt,useRef:()=>bt,useState:()=>T,useSyncExternalStore:()=>Qt,useTransition:()=>nn,version:()=>Yn});function Xt(e,t){for(var n in t)e[n]=t[n];return e}function Zt(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Qt(e,t){var n=t(),r=T({t:{__:n,u:t}}),i=r[0].t,a=r[1];return yt(function(){i.__=n,i.u=t,$t(i)&&a({t:i})},[e,n,t]),E(function(){return $t(i)&&a({t:i}),e(function(){$t(i)&&a({t:i})})},[e]),n}function $t(e){var t,n,r=e.u,i=e.__;try{var a=r();return!((t=i)===(n=a)&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}}function en(e){e()}function tn(e){return e}function nn(){return[!1,en]}function rn(e,t){this.props=e,this.context=t}function an(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Zt(this.props,e)}function r(t){return this.shouldComponentUpdate=n,h(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.prototype.isReactComponent=!0,r.__f=!0,r.type=e,r}function on(e){function t(t){var n=Xt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=An,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}function sn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Xt({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return sn(e,t,n)})),e}function cn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return cn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ln(){this.__u=0,this.o=null,this.__b=null}function un(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function dn(e){var t,n,r;function i(i){if(t||(t=e()).then(function(e){n=e.default||e},function(e){r=e}),r)throw r;if(!n)throw t;return h(n,i)}return i.displayName=`Lazy`,i.__f=!0,i}function fn(){this.i=null,this.l=null}function pn(e){return this.getChildContext=function(){return e.context},e.children}function mn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){ge(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}ge(h(pn,{context:t.context},e.__v),t.v)}function hn(e,t){var n=h(mn,{__v:e,h:t});return n.containerInfo=t,n}function gn(e,t,n){return t.__k??(t.textContent=``),ge(e,t),typeof n==`function`&&n(),e?e.__c:null}function _n(e,t,n){return _e(e,t),typeof n==`function`&&n(),e?e.__c:null}function vn(){}function yn(){return this.cancelBubble}function bn(){return this.defaultPrevented}function xn(e){return h.bind(null,e)}function Sn(e){return!!e&&e.$$typeof===In}function Cn(e){return Sn(e)&&e.type===v}function wn(e){return!!e&&!!e.displayName&&(typeof e.displayName==`string`||e.displayName instanceof String)&&e.displayName.startsWith(`Memo(`)}function Tn(e){return Sn(e)?ve.apply(null,arguments):e}function En(e){return!!e.__k&&(ge(null,e),!0)}function Dn(e){return e&&(e.base||e.nodeType===1&&e)||null}var On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,D=s(()=>{Ie(),Jt(),Jt(),On=yt,(rn.prototype=new y).isPureReactComponent=!0,rn.prototype.shouldComponentUpdate=function(e,t){return Zt(this.props,e)||Zt(this.state,t)},kn=w.__b,w.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),kn&&kn(e)},An=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911,jn=function(e,t){return e==null?null:re(re(e).map(t))},Mn={map:jn,forEach:jn,count:function(e){return e?re(e).length:0},only:function(e){var t=re(e);if(t.length!==1)throw`Children.only`;return t[0]},toArray:re},Nn=w.__e,w.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Nn(e,t,n,r)},Pn=w.unmount,w.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Pn&&Pn(e)},(ln.prototype=new y).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=un(r.__v),a=!1,o=function(){a||(a=!0,n.__R=null,i?i(s):s())};n.__R=o;var s=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=cn(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},ln.prototype.componentWillUnmount=function(){this.o=[]},ln.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=sn(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&h(v,null,e.fallback);return i&&(i.__u&=-33),[h(v,null,t.__a?null:e.children),i]},Fn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}},(fn.prototype=new y).__a=function(e){var t=this,n=un(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Fn(t,e,r)):i()};n?n(a):a()}},fn.prototype.render=function(e){this.i=null,this.l=new Map;var t=re(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fn.prototype.componentDidUpdate=fn.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Fn(e,n,t)})},In=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Ln=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Rn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,zn=/[A-Z0-9]/g,Bn=typeof document<`u`,Vn=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)},y.prototype.isReactComponent={},[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(y.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}),Hn=w.event,w.event=function(e){return Hn&&(e=Hn(e)),e.persist=vn,e.isPropagationStopped=yn,e.isDefaultPrevented=bn,e.nativeEvent=e},Wn={enumerable:!1,configurable:!0,get:function(){return this.class}},Gn=w.vnode,w.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)===-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Bn&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||Vn(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Rn.test(a)&&(a=s):s=a=`oninput`:i&&Ln.test(a)?a=a.replace(zn,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&r.multiple&&Array.isArray(r.value)&&(r.value=re(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),n==`select`&&r.defaultValue!=null&&(r.value=re(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value})),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,`className`,Wn)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=In,Gn&&Gn(e)},Kn=w.__r,w.__r=function(e){Kn&&Kn(e),Un=e.__c},qn=w.diffed,w.diffed=function(e){qn&&qn(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value),Un=null},Jn={ReactCurrentDispatcher:{current:{readContext:function(e){return Un.__n[e.__c].props.value},useCallback:Ct,useContext:wt,useDebugValue:Tt,useDeferredValue:tn,useEffect:E,useId:Dt,useImperativeHandle:xt,useInsertionEffect:On,useLayoutEffect:yt,useMemo:St,useReducer:vt,useRef:bt,useState:T,useSyncExternalStore:Qt,useTransition:nn}}},Yn=`18.3.1`,Xn=function(e,t){return e(t)},Zn=function(e,t){return e(t)},Qn=v,$n=Sn,er={useState:T,useId:Dt,useReducer:vt,useEffect:E,useLayoutEffect:yt,useInsertionEffect:On,useTransition:nn,useDeferredValue:tn,useSyncExternalStore:Qt,startTransition:en,useRef:bt,useImperativeHandle:xt,useMemo:St,useCallback:Ct,useContext:wt,useDebugValue:Tt,version:`18.3.1`,Children:Mn,render:gn,hydrate:_n,unmountComponentAtNode:En,createPortal:hn,createElement:h,createContext:ye,createFactory:xn,cloneElement:Tn,createRef:_,Fragment:v,isValidElement:Sn,isElement:$n,isFragment:Cn,isMemo:wn,findDOMNode:Dn,Component:y,PureComponent:rn,memo:an,forwardRef:on,flushSync:Zn,unstable_batchedUpdates:Xn,StrictMode:Qn,Suspense:ln,SuspenseList:fn,lazy:dn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Jn}}),tr=`7.16.3`,nr=c((exports,t)=>{function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}t.exports=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError(`n must be a positive number`);return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,c,l;if(this._events||={},e===`error`&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var u=Error(`Uncaught, unspecified "error" event. (`+t+`)`);throw u.context=t,u}if(n=this._events[e],o(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,c=0;c<i;c++)l[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError(`listener must be a function`);return this._events||={},this._events.newListener&&this.emit(`newListener`,e,r(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error(`(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.`,this._events[e].length),typeof console.trace==`function`&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError(`listener must be a function`);var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,i,o,s;if(!r(t))throw TypeError(`listener must be a function`);if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit(`removeListener`,e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;n.length===1?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit(`removeListener`,e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(t in this._events){if(t===`removeListener`)continue;this.removeAllListeners(t)}return this.removeAllListeners(`removeListener`),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=!this._events||!this._events[e]?[]:r(this._events[e])?[this._events[e]]:this._events[e].slice(),t},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)};function r(e){return typeof e==`function`}function i(e){return typeof e==`number`}function a(e){return typeof e==`object`&&!!e}function o(e){return e===void 0}}),rr=c((exports,t)=>{function n(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}t.exports=n}),ir=c((exports,t)=>{var n=nr(),r=rr();function i(e,t,n){this.main=e,this.fn=t,this.recommendFn=n,this.lastResults=null,this.lastRecommendResults=null}r(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},i.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},t.exports=i}),ar=c((exports,t)=>{function n(e){return typeof e==`string`?String(e).replace(/^-/,`\\-`):e}function r(e){return typeof e==`string`?e.replace(/^\\-/,`-`):e}t.exports={escapeFacetValue:n,unescapeFacetValue:r}}),or=c((exports,t)=>{function n(e){return typeof e==`object`&&e?i(Array.isArray(e)?[]:{},e):e}function r(e){return typeof e==`function`||Array.isArray(e)||Object.prototype.toString.call(e)===`[object Object]`}function i(e,t){if(e===t)return e;for(var a in t){if(!Object.prototype.hasOwnProperty.call(t,a)||a===`__proto__`||a===`constructor`)continue;var o=t[a],s=e[a];if(s!==void 0&&o===void 0)continue;r(s)&&r(o)?e[a]=i(s,o):e[a]=n(o)}return e}function a(e){r(e)||(e={});for(var t=1,n=arguments.length;t<n;t++){var a=arguments[t];r(a)&&i(e,a)}return e}t.exports=a}),sr=c((exports,t)=>{function n(e){return e&&Object.keys(e).length>0}t.exports=n}),cr=c((exports,t)=>{function n(e,t){if(e===null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}t.exports=n}),lr=c((exports,t)=>{function n(e){e||={},this.params=e.params||[]}n.prototype={constructor:n,addParams:function(e){var t=this.params.slice();return t.push(e),new n({params:t})},removeParams:function(e){return new n({params:this.params.filter(function(t){return t.$$id!==e})})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:`bought-together`}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:`related-products`}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:`trending-items`}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:`trending-facets`}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:`looking-similar`}))},_buildQueries:function(e,t){return this.params.filter(function(e){return t[e.$$id]===void 0}).map(function(t){var n=Object.assign({},t,{indexName:e,threshold:t.threshold||0});return delete n.$$id,n})}},t.exports=n}),ur=c((exports,t)=>{function n(e,t){this._state=e,this._rawResults={};var n=this;e.params.forEach(function(e){var r=e.$$id;n[r]=t[r],n._rawResults[r]=t[r]})}n.prototype={constructor:n},t.exports=n}),dr=c((exports,t)=>{var n=or();function r(e){return Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})}var i={_getQueries:function(e,t){var n=[];return n.push({indexName:e,params:i._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach(function(r){n.push({indexName:e,params:i._getDisjunctiveFacetSearchParams(t,r)})}),t.getRefinedHierarchicalFacets().forEach(function(r){var a=t.getHierarchicalFacetByName(r),o=t.getHierarchicalRefinement(r),s=t._getHierarchicalFacetSeparator(a);if(o.length>0&&o[0].split(s).length>1){var c=o[0].split(s).slice(0,-1).reduce(function(e,t,n){return e.concat({attribute:a.attributes[n],value:n===0?t:[e[e.length-1].value,t].join(s)})},[]);c.forEach(function(r,o){var s=i._getDisjunctiveFacetSearchParams(t,r.attribute,o===0);function l(e){return a.attributes.some(function(t){return t===e.split(`:`)[0]})}var u=(s.facetFilters||[]).reduce(function(e,t){if(Array.isArray(t)){var n=t.filter(function(e){return!l(e)});n.length>0&&e.push(n)}return typeof t==`string`&&!l(t)&&e.push(t),e},[]),d=c[o-1];o>0?s.facetFilters=u.concat(d.attribute+`:`+d.value):u.length>0?s.facetFilters=u:delete s.facetFilters,n.push({indexName:e,params:s})})}}),n},_getCompositionQueries:function(e){return[{compositionID:e.index,requestBody:{params:i._getCompositionHitsSearchParams(e)}}]},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(i._getHitsHierarchicalFacetsAttributes(e)).sort(),a=i._getFacetFilters(e),o=i._getNumericFilters(e),s=i._getTagFilters(e),c={};return t.length>0&&(c.facets=t.indexOf(`*`)>-1?[`*`]:t),s.length>0&&(c.tagFilters=s),a.length>0&&(c.facetFilters=a),o.length>0&&(c.numericFilters=o),r(n({},e.getQueryParams(),c))},_getCompositionHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets.map(function(t){return e.disjunctiveFacetsRefinements&&e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].length>0?`disjunctive(`+t+`)`:t})).concat(i._getHitsHierarchicalFacetsAttributes(e)).sort(),a=i._getFacetFilters(e),o=i._getNumericFilters(e),s=i._getTagFilters(e),c={};t.length>0&&(c.facets=t.indexOf(`*`)>-1?[`*`]:t),s.length>0&&(c.tagFilters=s),a.length>0&&(c.facetFilters=a),o.length>0&&(c.numericFilters=o);var l=e.getQueryParams();return delete l.highlightPreTag,delete l.highlightPostTag,delete l.index,r(n({},l,c))},_getDisjunctiveFacetSearchParams:function(e,t,a){var o=i._getFacetFilters(e,t,a),s=i._getNumericFilters(e,t),c=i._getTagFilters(e),l={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};c.length>0&&(l.tagFilters=c);var u=e.getHierarchicalFacetByName(t);return u?l.facets=i._getDisjunctiveHierarchicalFacetAttribute(e,u,a):l.facets=t,s.length>0&&(l.numericFilters=s),o.length>0&&(l.facetFilters=o),r(n({},e.getQueryParams(),l))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var n=[];return Object.keys(e.numericRefinements).forEach(function(r){var i=e.numericRefinements[r]||{};Object.keys(i).forEach(function(e){var a=i[e]||[];t!==r&&a.forEach(function(t){if(Array.isArray(t)){var i=t.map(function(t){return r+e+t});n.push(i)}else n.push(r+e+t)})})}),n},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(`,`)},_getFacetFilters:function(e,t,n){var r=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach(function(e){var t=i[e]||[];t.slice().sort().forEach(function(t){r.push(e+`:`+t)})});var a=e.facetsExcludes||{};Object.keys(a).sort().forEach(function(e){var t=a[e]||[];t.sort().forEach(function(t){r.push(e+`:-`+t)})});var o=e.disjunctiveFacetsRefinements||{};Object.keys(o).sort().forEach(function(e){var n=o[e]||[];if(!(e===t||!n||n.length===0)){var i=[];n.slice().sort().forEach(function(t){i.push(e+`:`+t)}),r.push(i)}});var s=e.hierarchicalFacetsRefinements||{};return Object.keys(s).sort().forEach(function(i){var a=s[i]||[],o=a[0];if(o!==void 0){var c=e.getHierarchicalFacetByName(i),l=e._getHierarchicalFacetSeparator(c),u=e._getHierarchicalRootPath(c),d,f;if(t===i){if(o.indexOf(l)===-1||!u&&n===!0||u&&u.split(l).length===o.split(l).length)return;u?(f=u.split(l).length-1,o=u):(f=o.split(l).length-2,o=o.slice(0,o.lastIndexOf(l))),d=c.attributes[f]}else f=o.split(l).length-1,d=c.attributes[f];d&&r.push([d+`:`+o])}}),r},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return e.hierarchicalFacets.reduce(function(t,n){var r=e.getHierarchicalRefinement(n.name)[0];if(!r)return t.push(n.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(n),a=r.split(i).length,o=n.attributes.slice(0,a+1);return t.concat(o)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,n){var r=e._getHierarchicalFacetSeparator(t);if(n===!0){var i=e._getHierarchicalRootPath(t),a=0;return i&&(a=i.split(r).length),[t.attributes[a]]}var o=e.getHierarchicalRefinement(t.name)[0]||``,s=o.split(r).length-1;return t.attributes.slice(0,s+1)},getSearchForFacetQuery:function(e,t,a,o){var s=o.isDisjunctiveFacet(e)?o.clearRefinements(e):o,c={facetQuery:t,facetName:e};return typeof a==`number`&&(c.maxFacetHits=a),r(n({},i._getHitsSearchParams(s),c))}};t.exports=i}),fr=c((exports,t)=>{t.exports=function(){var e=Array.prototype.slice.call(arguments);return e.reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(n){t[n]!==void 0&&(e[n]!==void 0&&delete e[n],e[n]=t[n])}),e},{})}}),pr=c((exports,t)=>{t.exports=function(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}}}),mr=c((exports,t)=>{function n(e,t){return e.filter(function(n,r){return t.indexOf(n)>-1&&e.indexOf(n)===r})}t.exports=n}),hr=c((exports,t)=>{function n(e){if(typeof e==`number`)return e;if(typeof e==`string`)return parseFloat(e);if(Array.isArray(e))return e.map(n);throw Error(`The value should be a number, a parsable string or an array of those.`)}t.exports=n}),gr=c((exports,t)=>{t.exports=function(e){return e===null?!1:/^[a-zA-Z0-9_-]{1,64}$/.test(e)}}),_r=c((exports,t)=>{var n=fr(),r=sr(),i=cr(),a={addRefinement:function(e,t,r){if(a.isRefined(e,t,r))return e;var i=``+r,o=e[t]?e[t].concat(i):[i],s={};return s[t]=o,n(s,e)},removeRefinement:function(e,t,n){if(n===void 0)return a.clearRefinement(e,function(e,n){return t===n});var r=``+n;return a.clearRefinement(e,function(e,n){return t===n&&r===e})},toggleRefinement:function(e,t,n){if(n===void 0)throw Error(`toggleRefinement should be used with a value`);return a.isRefined(e,t,n)?a.removeRefinement(e,t,n):a.addRefinement(e,t,n)},clearRefinement:function(e,t,n){if(t===void 0)return r(e)?{}:e;if(typeof t==`string`)return i(e,[t]);if(typeof t==`function`){var a=!1,o=Object.keys(e).reduce(function(r,i){var o=e[i]||[],s=o.filter(function(e){return!t(e,i,n)});return s.length!==o.length&&(a=!0),r[i]=s,r},{});return a?o:e}},isRefined:function(e,t,n){var r=!!e[t]&&e[t].length>0;if(n===void 0||!r)return r;var i=``+n;return e[t].indexOf(i)!==-1}};t.exports=a}),vr=c((exports,t)=>{var n=fr(),r=pr(),i=mr(),a=or(),o=sr(),s=cr(),c=hr(),l=gr(),u=_r();function d(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(function(e,n){return d(t[n],e)}):e===t}function f(e,t){return r(e,function(e){return d(e,t)})}function p(e){var t=e?p._parseNumbers(e):{};t.userToken!==void 0&&!l(t.userToken)&&console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var n=this;Object.keys(t).forEach(function(e){var r=p.PARAMETERS.indexOf(e)!==-1,i=t[e]!==void 0;!r&&i&&(n[e]=t[e])})}p.PARAMETERS=Object.keys(new p),p._parseNumbers=function(e){if(e instanceof p)return e;var t={},n=[`aroundPrecision`,`aroundRadius`,`getRankingInfo`,`minWordSizefor2Typos`,`minWordSizefor1Typo`,`page`,`maxValuesPerFacet`,`distinct`,`minimumAroundRadius`,`hitsPerPage`,`minProximity`];if(n.forEach(function(n){var r=e[n];if(typeof r==`string`){var i=parseFloat(r);t[n]=isNaN(i)?r:i}}),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map(function(e){return Array.isArray(e)?e.map(function(e){return parseFloat(e)}):e})),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach(function(e){var i=n[e],a=i.map(function(e){return Array.isArray(e)?e.map(function(e){return typeof e==`string`?parseFloat(e):e}):typeof e==`string`?parseFloat(e):e});r[t][e]=a})}),t.numericRefinements=r}return a(e,t)},p.make=function(e){var t=new p(e),n=e.hierarchicalFacets||[];return n.forEach(function(e){if(e.rootPath){var n=t.getHierarchicalRefinement(e.name);n.length>0&&n[0].indexOf(e.rootPath)!==0&&(t=t.clearRefinements(e.name)),n=t.getHierarchicalRefinement(e.name),n.length===0&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},p.validate=function(e,t){var n=t||{};return e.tagFilters&&n.tagRefinements&&n.tagRefinements.length>0?Error(`[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method.`):e.tagRefinements.length>0&&n.tagFilters?Error(`[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method.`):e.numericFilters&&n.numericRefinements&&o(n.numericRefinements)?Error(`[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters.`):o(e.numericRefinements)&&n.numericFilters?Error(`[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters.`):null},p.prototype={constructor:p,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:u.clearRefinement(this.facetsRefinements,e,`conjunctiveFacet`),facetsExcludes:u.clearRefinement(this.facetsExcludes,e,`exclude`),disjunctiveFacetsRefinements:u.clearRefinement(this.disjunctiveFacetsRefinements,e,`disjunctiveFacet`),hierarchicalFacetsRefinements:u.clearRefinement(this.hierarchicalFacetsRefinements,e,`hierarchicalFacet`)};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return this.tagFilters===void 0&&this.tagRefinements.length===0?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,n){var r=c(n);if(this.isNumericRefined(e,t,r))return this;var i=a({},this.numericRefinements);return i[e]=a({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(r)):i[e][t]=[r],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,n){var r=n;return r===void 0?t===void 0?this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,n){return n===e})}):this:this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this:this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,i){return i===e&&n.op===t&&d(n.val,c(r))})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(e===void 0)return o(this.numericRefinements)?{}:this.numericRefinements;if(typeof e==`string`)return s(this.numericRefinements,[e]);if(typeof e==`function`){var t=!1,n=this.numericRefinements,r=Object.keys(n).reduce(function(r,i){var a=n[i],o={};return a||={},Object.keys(a).forEach(function(n){var r=a[n]||[],s=[];r.forEach(function(t){var r=e({val:t,op:n},i,`numeric`);r||s.push(t)}),s.length!==r.length&&(t=!0),o[n]=s}),r[i]=o,r},{});return t?r:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return u.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:u.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return u.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:u.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw Error(e+` is not defined in the disjunctiveFacets attribute of the helper configuration`);return u.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:u.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter(function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter(function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter(function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return u.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:u.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return u.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:u.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw Error(e+` is not defined in the disjunctiveFacets attribute of the helper configuration`);return u.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:u.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter(function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw Error(`Cannot refine the undeclared facet `+e+`; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets`)},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return this.setQueryParameters({facetsRefinements:u.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw Error(e+` is not defined in the facets attribute of the helper configuration`);return this.setQueryParameters({facetsExcludes:u.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw Error(e+` is not defined in the disjunctiveFacets attribute of the helper configuration`);return this.setQueryParameters({disjunctiveFacetsRefinements:u.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw Error(e+` is not defined in the hierarchicalFacets attribute of the helper configuration`);var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={},a=this.hierarchicalFacetsRefinements[e]!==void 0&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||this.hierarchicalFacetsRefinements[e][0].indexOf(t+r)===0);return a?t.indexOf(r)===-1?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n(i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw Error(e+` is already refined.`);if(!this.isHierarchicalFacet(e))throw Error(e+` is not defined in the hierarchicalFacets attribute of the helper configuration.`);var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n(r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n(t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return this.getHierarchicalFacetByName(e)!==void 0},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return this.isConjunctiveFacet(e)?u.isRefined(this.facetsRefinements,e,t):!1},isExcludeRefined:function(e,t){return this.isConjunctiveFacet(e)?u.isRefined(this.facetsExcludes,e,t):!1},isDisjunctiveFacetRefined:function(e,t){return this.isDisjunctiveFacet(e)?u.isRefined(this.disjunctiveFacetsRefinements,e,t):!1},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var n=this.getHierarchicalRefinement(e);return t?n.indexOf(t)!==-1:n.length>0},isNumericRefined:function(e,t,n){if(n===void 0&&t===void 0)return!!this.numericRefinements[e];var r=this.numericRefinements[e]&&this.numericRefinements[e][t]!==void 0;if(n===void 0||!r)return r;var i=c(n),a=f(this.numericRefinements[e][t],i)!==void 0;return r&&a},isTagRefined:function(e){return this.tagRefinements.indexOf(e)!==-1},getRefinedDisjunctiveFacets:function(){var e=this,t=i(Object.keys(this.numericRefinements).filter(function(t){return Object.keys(e.numericRefinements[t]).length>0}),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter(function(t){return e.disjunctiveFacetsRefinements[t].length>0}).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return i(this.hierarchicalFacets.map(function(e){return e.name}),Object.keys(this.hierarchicalFacetsRefinements).filter(function(t){return e.hierarchicalFacetsRefinements[t].length>0})).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter(function(t){return e.indexOf(t)===-1})},managedParameters:[`index`,`facets`,`disjunctiveFacets`,`facetsRefinements`,`hierarchicalFacets`,`facetsExcludes`,`disjunctiveFacetsRefinements`,`numericRefinements`,`tagRefinements`,`hierarchicalFacetsRefinements`],getQueryParams:function(){var e=this.managedParameters,t={},n=this;return Object.keys(this).forEach(function(r){var i=n[r];e.indexOf(r)===-1&&i!==void 0&&(t[r]=i)}),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){if(!e)return this;var t=p.validate(this,e);if(t)throw t;var n=this,r=p._parseNumbers(e),i=Object.keys(this).reduce(function(e,t){return e[t]=n[t],e},{}),a=Object.keys(r).reduce(function(e,t){var n=e[t]!==void 0,i=r[t]!==void 0;return n&&!i?s(e,[t]):(i&&(e[t]=r[t]),e)},i);return new this.constructor(a)},resetPage:function(){return this.page===void 0?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||[`isRefined:desc`,`name:asc`]},_getHierarchicalFacetSeparator:function(e){return e.separator||` > `},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return typeof e.showParentLevel==`boolean`?e.showParentLevel:!0},getHierarchicalFacetByName:function(e){return r(this.hierarchicalFacets,function(t){return t.name===e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r=t.split(n);return r.map(function(e){return e.trim()})},toString:function(){return JSON.stringify(this,null,2)}},t.exports=p}),yr=c((exports,t)=>{t.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}}),br=c((exports,t)=>{t.exports=function(e,t){if(!Array.isArray(e))return-1;for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}}),xr=c((exports,t)=>{var n=pr();t.exports=function(e,t){var r=(t||[]).map(function(e){return e.split(`:`)});return e.reduce(function(e,t){var i=t.split(`:`),a=n(r,function(e){return e[0]===i[0]});return i.length>1||!a?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(a[0]),e[1].push(a[1]),e)},[[],[]])}}),Sr=c((exports,t)=>{function n(){var e=Array.prototype.slice.call(arguments);return e.reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(n){var r=typeof e[n]==`number`?e[n]:0,i=t[n];i!==void 0&&i>=r&&(e[n]!==void 0&&delete e[n],e[n]=i)}),e},{})}t.exports=n}),Cr=c((exports,t)=>{function n(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=t!==void 0,a=t===null;if(!a&&e>t||r&&i||!n)return 1;if(!r&&e<t||a&&n||!i)return-1}return 0}function r(e,t,r){if(!Array.isArray(e))return[];Array.isArray(r)||(r=[]);var i=e.map(function(e,n){return{criteria:t.map(function(t){return e[t]}),index:n,value:e}});return i.sort(function(e,t){for(var i=-1;++i<e.criteria.length;){var a=n(e.criteria[i],t.criteria[i]);if(a)return i>=r.length?a:r[i]===`desc`?-a:a}return e.index-t.index}),i.map(function(e){return e.value})}t.exports=r}),wr=c((exports,t)=>{t.exports=c;var n=ar(),r=pr(),i=xr(),a=Cr(),o=n.escapeFacetValue,s=n.unescapeFacetValue;function c(e){return function(t,n){var r=e.hierarchicalFacets[n],a=e.hierarchicalFacetsRefinements[r.name]&&e.hierarchicalFacetsRefinements[r.name][0]||``,o=e._getHierarchicalFacetSeparator(r),s=e._getHierarchicalRootPath(r),c=e._getHierarchicalShowParentLevel(r),u=i(e._getHierarchicalFacetSortBy(r)),d=t.every(function(e){return e.exhaustive}),f=l(u,o,s,c,a),p=t;return s&&(p=t.slice(s.split(o).length)),p.reduce(f,{name:e.hierarchicalFacets[n].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:d,data:null})}}function l(e,t,n,i,o){return function(c,l,f){var p=c;if(f>0){var m=0;for(p=c;m<f;){var h=p&&Array.isArray(p.data)?p.data:[];p=r(h,function(e){return e.isRefined}),m++}}if(p){var g=Object.keys(l.data).map(function(e){return[e,l.data[e]]}).filter(function(e){var r=e[0];return u(r,p.path||n,o,t,n,i)});p.data=a(g.map(function(e){var n=e[0],r=e[1];return d(r,n,t,s(o),l.exhaustive)}),e[0],e[1])}return c}}function u(e,t,n,r,i,a){return i&&(e.indexOf(i)!==0||i===e)?!1:!i&&e.indexOf(r)===-1||i&&e.split(r).length-i.split(r).length===1||e.indexOf(r)===-1&&n.indexOf(r)===-1||n.indexOf(e)===0||e.indexOf(t+r)===0&&(a||e.indexOf(n)===0)}function d(e,t,n,r,i){var a=t.split(n);return{name:a[a.length-1].trim(),path:t,escapedValue:o(t),count:e,isRefined:r===t||r.indexOf(t+n)===0,exhaustive:i,data:null}}}),Tr=c((exports,t)=>{var n=yr(),r=fr(),i=ar(),a=pr(),o=br(),s=xr(),c=Sr(),l=Cr(),u=i.escapeFacetValue,d=i.unescapeFacetValue,f=wr();function p(e){var t={};return e.forEach(function(e,n){t[e]=n}),t}function m(e,t,n){t&&t[n]&&(e.stats=t[n])}function h(e,t){return a(e,function(e){var n=e.attributes||[];return n.indexOf(t)>-1})}function g(e,t,i){var a=t[0]||{};this._rawResults=t;var s=this;Object.keys(a).forEach(function(e){s[e]=a[e]});var l=r(i,{persistHierarchicalRootCount:!1});Object.keys(l).forEach(function(e){s[e]=l[e]}),this.processingTimeMS=t.reduce(function(e,t){return t.processingTimeMS===void 0?e:e+t.processingTimeMS},0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map(function(){return[]}),this.facets=[];var u=e.getRefinedDisjunctiveFacets(),g=p(e.facets),_=p(e.disjunctiveFacets),v=1,y=a.facets||{};Object.keys(y).forEach(function(t){var n=y[t],r=h(e.hierarchicalFacets,t);if(r){var i=r.attributes.indexOf(t),c=o(e.hierarchicalFacets,function(e){return e.name===r.name});s.hierarchicalFacets[c][i]={attribute:t,data:n,exhaustive:a.exhaustiveFacetsCount}}else{var l=e.disjunctiveFacets.indexOf(t)!==-1,u=e.facets.indexOf(t)!==-1,d;l&&(d=_[t],s.disjunctiveFacets[d]={name:t,data:n,exhaustive:a.exhaustiveFacetsCount},m(s.disjunctiveFacets[d],a.facets_stats,t)),u&&(d=g[t],s.facets[d]={name:t,data:n,exhaustive:a.exhaustiveFacetsCount},m(s.facets[d],a.facets_stats,t))}}),this.hierarchicalFacets=n(this.hierarchicalFacets),u.forEach(function(n){var i=t[v],l=i&&i.facets?i.facets:{},u=e.getHierarchicalFacetByName(n);Object.keys(l).forEach(function(t){var n=l[t],f;if(u){f=o(e.hierarchicalFacets,function(e){return e.name===u.name});var p=o(s.hierarchicalFacets[f],function(e){return e.attribute===t});if(p===-1)return;s.hierarchicalFacets[f][p].data=s.persistHierarchicalRootCount?c(s.hierarchicalFacets[f][p].data,n):r(n,s.hierarchicalFacets[f][p].data)}else{f=_[t];var h=a.facets&&a.facets[t]||{};s.disjunctiveFacets[f]={name:t,data:c(h,n),exhaustive:i.exhaustiveFacetsCount},m(s.disjunctiveFacets[f],i.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach(function(n){!s.disjunctiveFacets[f].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(d(n))>-1&&(s.disjunctiveFacets[f].data[n]=0)})}}),v++}),e.getRefinedHierarchicalFacets().forEach(function(n){var i=e.getHierarchicalFacetByName(n),a=e._getHierarchicalFacetSeparator(i),c=e.getHierarchicalRefinement(n);c.length===0||c[0].split(a).length<2||t.slice(v).forEach(function(t){var n=t&&t.facets?t.facets:{};Object.keys(n).forEach(function(t){var l=n[t],u=o(e.hierarchicalFacets,function(e){return e.name===i.name}),d=o(s.hierarchicalFacets[u],function(e){return e.attribute===t});if(d!==-1){var f={};if(c.length>0&&!s.persistHierarchicalRootCount){var p=c[0].split(a)[0];f[p]=s.hierarchicalFacets[u][d].data[p]}s.hierarchicalFacets[u][d].data=r(f,l,s.hierarchicalFacets[u][d].data)}}),v++})}),Object.keys(e.facetsExcludes).forEach(function(t){var n=e.facetsExcludes[t],r=g[t];s.facets[r]={name:t,data:y[t],exhaustive:a.exhaustiveFacetsCount},n.forEach(function(e){s.facets[r]=s.facets[r]||{name:t},s.facets[r].data=s.facets[r].data||{},s.facets[r].data[e]=0})}),this.hierarchicalFacets=this.hierarchicalFacets.map(f(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}g.prototype.getFacetByName=function(e){function t(t){return t.name===e}return a(this.facets,t)||a(this.disjunctiveFacets,t)||a(this.hierarchicalFacets,t)};function _(e,t){function n(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var r=a(e.facets,n);return r?Object.keys(r.data).map(function(n){var i=u(n);return{name:n,escapedValue:i,count:r.data[n],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,n)}}):[]}else if(e._state.isDisjunctiveFacet(t)){var i=a(e.disjunctiveFacets,n);return i?Object.keys(i.data).map(function(n){var r=u(n);return{name:n,escapedValue:r,count:i.data[n],isRefined:e._state.isDisjunctiveFacetRefined(t,r)}}):[]}else if(e._state.isHierarchicalFacet(t)){var o=a(e.hierarchicalFacets,n);if(!o)return o;var s=e._state.getHierarchicalFacetByName(t),c=e._state._getHierarchicalFacetSeparator(s),l=d(e._state.getHierarchicalRefinement(t)[0]||``);l.indexOf(s.rootPath)===0&&(l=l.replace(s.rootPath+c,``));var f=l.split(c);return f.unshift(t),v(o,f,0),o}}function v(e,t,n){e.isRefined=e.name===(t[n]&&t[n].trim()),e.data&&e.data.forEach(function(e){v(e,t,n+1)})}function y(e,t,n,i){if(i||=0,Array.isArray(t))return e(t,n[i]);if(!t.data||t.data.length===0)return t;var a=t.data.map(function(t){return y(e,t,n,i+1)}),o=e(a,n[i]),s=r({data:o},t);return s}g.DEFAULT_SORT=[`isRefined:desc`,`count:desc`,`name:asc`];function b(e,t){return t.sort(e)}function x(e,t){var n=[],r=[],i=t.hide||[],a=t.order||[],o=a.reduce(function(e,t,n){return e[t]=n,e},{});e.forEach(function(e){var t=e.path||e.name,a=i.indexOf(t)>-1;!a&&o[t]!==void 0?n[o[t]]=e:a||r.push(e)}),n=n.filter(function(e){return e});var s=t.sortRemainingBy,c;return s===`hidden`?n:(c=s===`alpha`?[[`path`,`name`],[`asc`,`asc`]]:[[`count`],[`desc`]],n.concat(l(r,c[0],c[1])))}function S(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}g.prototype.getFacetValues=function(e,t){var n=_(this,e);if(n){var i=r(t,{sortBy:g.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),a=this,o;if(Array.isArray(n))o=[e];else{var c=a._state.getHierarchicalFacetByName(n.name);o=c.attributes}return y(function(e,t){if(i.facetOrdering){var n=S(a,t);if(n)return x(e,n)}if(Array.isArray(i.sortBy)){var r=s(i.sortBy,g.DEFAULT_SORT);return l(e,r[0],r[1])}else if(typeof i.sortBy==`function`)return b(i.sortBy,e);throw Error(`options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function`)},n,o)}},g.prototype.getFacetStats=function(e){if(this._state.isConjunctiveFacet(e))return C(this.facets,e);if(this._state.isDisjunctiveFacet(e))return C(this.disjunctiveFacets,e)};function C(e,t){var n=a(e,function(e){return e.name===t});return n&&n.stats}g.prototype.getRefinements=function(){var e=this._state,t=this,n=[];return Object.keys(e.facetsRefinements).forEach(function(r){e.facetsRefinements[r].forEach(function(i){n.push(ee(e,`facet`,r,i,t.facets))})}),Object.keys(e.facetsExcludes).forEach(function(r){e.facetsExcludes[r].forEach(function(i){n.push(ee(e,`exclude`,r,i,t.facets))})}),Object.keys(e.disjunctiveFacetsRefinements).forEach(function(r){e.disjunctiveFacetsRefinements[r].forEach(function(i){n.push(ee(e,`disjunctive`,r,i,t.disjunctiveFacets))})}),Object.keys(e.hierarchicalFacetsRefinements).forEach(function(r){e.hierarchicalFacetsRefinements[r].forEach(function(i){n.push(te(e,r,i,t.hierarchicalFacets))})}),Object.keys(e.numericRefinements).forEach(function(t){var r=e.numericRefinements[t];Object.keys(r).forEach(function(e){r[e].forEach(function(r){n.push({type:`numeric`,attributeName:t,name:r,numericValue:r,operator:e})})})}),e.tagRefinements.forEach(function(e){n.push({type:`tag`,attributeName:`_tags`,name:e})}),n};function ee(e,t,n,r,i){var o=a(i,function(e){return e.name===n}),s=o&&o.data&&o.data[r]?o.data[r]:0,c=o&&o.exhaustive||!1;return{type:t,attributeName:n,name:r,count:s,exhaustive:c}}function te(e,t,n,r){var i=e.getHierarchicalFacetByName(t),o=e._getHierarchicalFacetSeparator(i),s=n.split(o),c=a(r,function(e){return e.name===t}),l=s.reduce(function(e,t){var n=e&&a(e.data,function(e){return e.name===t});return n===void 0?e:n},c),u=l&&l.count||0,d=l&&l.exhaustive||!1,f=l&&l.path||``;return{type:`hierarchical`,attributeName:t,name:f,count:u,exhaustive:d}}t.exports=g}),Er=c((exports,t)=>{t.exports=function(e){return e.reduce(function(e,t){return e.concat(t)},[])}}),Dr=c((exports,t)=>{var n=pr(),r=Er();function i(e,t){var n=[];return Object.keys(e).forEach(function(r){e[r].count<2&&(e[r].indexSum+=100),n.push({objectID:r,avgOfIndices:e[r].indexSum/t})}),n.sort(function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1})}function a(e,t){var a={};t.forEach(function(t){t.forEach(function(t,n){e.includes(t.objectID)||(a[t.objectID]?a[t.objectID]={indexSum:a[t.objectID].indexSum+n,count:a[t.objectID].count+1}:a[t.objectID]={indexSum:n,count:1})})});var o=i(a,t.length),s=o.reduce(function(e,i){var a=n(r(t),function(e){return e.objectID===i.objectID});return a?e.concat(a):e},[]);return s}t.exports=a}),Or=c((exports,t)=>{t.exports=`3.26.0`}),kr=c((exports,t)=>{var n=nr(),r=ir(),i=ar().escapeFacetValue,a=rr(),o=or(),s=sr(),c=cr(),l=lr(),u=ur(),d=dr(),f=vr(),p=Tr(),m=Dr(),h=Or();function g(e,t,n,r){typeof e.addAlgoliaAgent==`function`&&e.addAlgoliaAgent(`JS Helper (`+h+`)`),this.setClient(e);var i=n||{};i.index=t,this.state=f.make(i),this.recommendState=new l({params:i.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=r,this._recommendCache={}}a(g,n),g.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},g.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},g.prototype.searchWithComposition=function(){return this._runComposition({onlyWithDerivedHelpers:!0}),this},g.prototype.recommend=function(){return this._recommend(),this},g.prototype.getQuery=function(){var e=this.state;return d._getHitsSearchParams(e)},g.prototype.searchOnce=function(e,t){var n=e?this.state.setQueryParameters(e):this.state,r=d._getQueries(n.index,n),i=this;if(this._currentNbQueries++,this.emit(`searchOnce`,{state:n}),t){this.client.search(r).then(function(e){i._currentNbQueries--,i._currentNbQueries===0&&i.emit(`searchQueueEmpty`),t(null,new p(n,e.results),n)}).catch(function(e){i._currentNbQueries--,i._currentNbQueries===0&&i.emit(`searchQueueEmpty`),t(e,null,n)});return}return this.client.search(r).then(function(e){return i._currentNbQueries--,i._currentNbQueries===0&&i.emit(`searchQueueEmpty`),{content:new p(n,e.results),state:n,_originalResponse:e}},function(e){throw i._currentNbQueries--,i._currentNbQueries===0&&i.emit(`searchQueueEmpty`),e})},g.prototype.findAnswers=function(e){console.warn(`[algoliasearch-helper] answers is no longer supported`);var t=this.state,n=this.derivedHelpers[0];if(!n)return Promise.resolve([]);var r=n.getModifiedState(t),i=o({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:c(d._getHitsSearchParams(r),[`attributesToSnippet`,`hitsPerPage`,`restrictSearchableAttributes`,`snippetEllipsisText`])}),a=`search for answers was called, but this client does not have a function client.initIndex(index).findAnswers`;if(typeof this.client.initIndex!=`function`)throw Error(a);var s=this.client.initIndex(r.index);if(typeof s.findAnswers!=`function`)throw Error(a);return s.findAnswers(r.query,e.queryLanguages,i)},g.prototype.searchForFacetValues=function(e,t,n,r){var a=typeof this.client.searchForFacetValues==`function`&&typeof this.client.searchForFacets!=`function`,o=typeof this.client.initIndex==`function`;if(!a&&!o&&typeof this.client.search!=`function`)throw Error(`search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues`);var s=this.state.setQueryParameters(r||{}),c=s.isDisjunctiveFacet(e),l=d.getSearchForFacetQuery(e,t,n,s);this._currentNbQueries++;var u=this,f;a?f=this.client.searchForFacetValues([{indexName:s.index,params:l}]):o?f=this.client.initIndex(s.index).searchForFacetValues(l):(delete l.facetName,f=this.client.search([{type:`facet`,facet:e,indexName:s.index,params:l}]).then(function(e){return e.results[0]})),this.emit(`searchForFacetValues`,{state:s,facet:e,query:t});var p=this.lastResults&&this.lastResults.index===s.index&&this.lastResults.renderingContent&&this.lastResults.renderingContent.facetOrdering&&this.lastResults.renderingContent.facetOrdering.values&&this.lastResults.renderingContent.facetOrdering.values[e]&&this.lastResults.renderingContent.facetOrdering.values[e].hide||[];return f.then(function(t){return u._currentNbQueries--,u._currentNbQueries===0&&u.emit(`searchQueueEmpty`),t=Array.isArray(t)?t[0]:t,t.facetHits.forEach(function(n,r){if(p.indexOf(n.value)>-1){t.facetHits.splice(r,1);return}n.escapedValue=i(n.value),n.isRefined=c?s.isDisjunctiveFacetRefined(e,n.escapedValue):s.isFacetRefined(e,n.escapedValue)}),t},function(e){throw u._currentNbQueries--,u._currentNbQueries===0&&u.emit(`searchQueueEmpty`),e})},g.prototype.searchForCompositionFacetValues=function(e,t,n,r){if(typeof this.client.searchForFacetValues!=`function`)throw Error(`search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues`);var a=this.state.setQueryParameters(r||{}),o=a.isDisjunctiveFacet(e);this._currentNbQueries++;var s=this,c;return c=this.client.searchForFacetValues({compositionID:a.index,facetName:e,searchForFacetValuesRequest:{params:{query:t,maxFacetHits:n,searchQuery:d._getCompositionHitsSearchParams(a)}}}),this.emit(`searchForFacetValues`,{state:a,facet:e,query:t}),c.then(function(t){return s._currentNbQueries--,s._currentNbQueries===0&&s.emit(`searchQueueEmpty`),t=t.results[0],t.facetHits.forEach(function(t){t.escapedValue=i(t.value),t.isRefined=o?a.isDisjunctiveFacetRefined(e,t.escapedValue):a.isFacetRefined(e,t.escapedValue)}),t},function(e){throw s._currentNbQueries--,s._currentNbQueries===0&&s.emit(`searchQueueEmpty`),e})},g.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},g.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},g.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},g.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},g.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.addNumericRefinement=function(e,t,n){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,n),isPageReset:!0}),this},g.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},g.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},g.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},g.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},g.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},g.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},g.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},g.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},g.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},g.prototype.removeNumericRefinement=function(e,t,n){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,n),isPageReset:!0}),this},g.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},g.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},g.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},g.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},g.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},g.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},g.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},g.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},g.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},g.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},g.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},g.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},g.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},g.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},g.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},g.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},g.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},g.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)};function _(e){if(e<0)throw Error(`Page requested below 0.`);return this._change({state:this.state.setPage(e),isPageReset:!1}),this}g.prototype.setCurrentPage=_,g.prototype.setPage=_,g.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},g.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},g.prototype.setState=function(e){return this._change({state:f.make(e),isPageReset:!1}),this},g.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new f(e),this},g.prototype.hasRefinements=function(e){return s(this.state.getNumericRefinements(e))?!0:this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):this.state.isHierarchicalFacet(e)?this.state.isHierarchicalFacetRefined(e):!1},g.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},g.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},g.prototype.hasTag=function(e){return this.state.isTagRefined(e)},g.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},g.prototype.getIndex=function(){return this.state.index};function v(){return this.state.page}g.prototype.getCurrentPage=v,g.prototype.getPage=v,g.prototype.getTags=function(){return this.state.tagRefinements},g.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);n.forEach(function(e){t.push({value:e,type:`conjunctive`})});var r=this.state.getExcludeRefinements(e);r.forEach(function(e){t.push({value:e,type:`exclude`})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);i.forEach(function(e){t.push({value:e,type:`disjunctive`})})}var a=this.state.getNumericRefinements(e);return Object.keys(a).forEach(function(e){var n=a[e];t.push({value:n,operator:e,type:`numeric`})}),t},g.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},g.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},g.prototype._search=function(e){var t=this.state,n=[],r=[];e.onlyWithDerivedHelpers||(r=d._getQueries(t.index,t),n.push({state:t,queriesCount:r.length,helper:this}),this.emit(`search`,{state:t,results:this.lastResults}));var i=this.derivedHelpers.map(function(e){var r=e.getModifiedState(t),i=r.index?d._getQueries(r.index,r):[];return n.push({state:r,queriesCount:i.length,helper:e}),e.emit(`search`,{state:r,results:e.lastResults}),i}),a=Array.prototype.concat.apply(r,i),o=this._queryId++;if(this._currentNbQueries++,!a.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,n,o));try{this.client.search(a).then(this._dispatchAlgoliaResponse.bind(this,n,o)).catch(this._dispatchAlgoliaError.bind(this,o))}catch(e){this.emit(`error`,{error:e})}},g.prototype._runComposition=function(){var e=this.state,t=[],n=[],r=this.derivedHelpers.map(function(n){var r=n.getModifiedState(e),i=d._getCompositionQueries(r);return t.push({state:r,queriesCount:i.length,helper:n}),n.emit(`search`,{state:r,results:n.lastResults}),i}),i=Array.prototype.concat.apply(n,r),a=this._queryId++;if(this._currentNbQueries++,!i.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,t,a));if(i.length>1)throw Error(`Only one query is allowed when using a composition.`);var o=i[0];try{this.client.search(o).then(this._dispatchAlgoliaResponse.bind(this,t,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(e){this.emit(`error`,{error:e})}},g.prototype._recommend=function(){var e=this.state,t=this.recommendState,n=this.getIndex(),r=[{state:t,index:n,helper:this}],i=t.params.map(function(e){return e.$$id});this.emit(`fetch`,{recommend:{state:t,results:this.lastRecommendResults}});var a=this._recommendCache,o=this.derivedHelpers.map(function(t){var n=t.getModifiedState(e).index;if(!n)return[];var o=t.getModifiedRecommendState(new l);return r.push({state:o,index:n,helper:t}),i=Array.prototype.concat.apply(i,o.params.map(function(e){return e.$$id})),t.emit(`fetch`,{recommend:{state:o,results:t.lastRecommendResults}}),o._buildQueries(n,a)}),s=Array.prototype.concat.apply(this.recommendState._buildQueries(n,a),o);if(s.length!==0){if(s.length>0&&this.client.getRecommendations===void 0){console.warn(`Please update algoliasearch/lite to the latest version in order to use recommend widgets.`);return}var c=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(s).then(this._dispatchRecommendResponse.bind(this,c,r,i)).catch(this._dispatchRecommendError.bind(this,c))}catch(e){this.emit(`error`,{error:e})}}},g.prototype._dispatchAlgoliaResponse=function(e,t,n){var r=this;if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,this._currentNbQueries===0&&this.emit(`searchQueueEmpty`);var i=n.results.slice(),a=Object.keys(n).reduce(function(e,t){return t!==`results`&&(e[t]=n[t]),e},{});Object.keys(a).length<=0&&(a=void 0),e.forEach(function(e){var t=e.state,n=e.queriesCount,o=e.helper,s=i.splice(0,n);if(!t.index){o.emit(`result`,{results:null,state:t});return}o.lastResults=new p(t,s,r._searchResultsOptions),a!==void 0&&(o.lastResults._rawContent=a),o.emit(`result`,{results:o.lastResults,state:t})})}},g.prototype._dispatchRecommendResponse=function(e,t,n,r){if(!(e<this._lastRecommendQueryIdReceived)){this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,this._currentNbRecommendQueries===0&&this.emit(`recommendQueueEmpty`);var i=this._recommendCache,a={};n.filter(function(e){return i[e]===void 0}).forEach(function(e,t){a[e]||(a[e]=[]),a[e].push(t)}),Object.keys(a).forEach(function(e){var t=a[e],o=r.results[t[0]];if(t.length===1){i[e]=o;return}i[e]=Object.assign({},o,{hits:m(n,t.map(function(e){return r.results[e].hits}))})});var o={};n.forEach(function(e){o[e]=i[e]}),t.forEach(function(e){var t=e.state,n=e.helper;if(!e.index){n.emit(`recommend:result`,{results:null,state:t});return}n.lastRecommendResults=new u(t,o),n.emit(`recommend:result`,{recommend:{results:n.lastRecommendResults,state:t}})})}},g.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit(`error`,{error:t}),this._currentNbQueries===0&&this.emit(`searchQueueEmpty`))},g.prototype._dispatchRecommendError=function(e,t){e<this._lastRecommendQueryIdReceived||(this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,this.emit(`error`,{error:t}),this._currentNbRecommendQueries===0&&this.emit(`recommendQueueEmpty`))},g.prototype.containsRefinement=function(e,t,n,r){return e||t.length!==0||n.length!==0||r.length!==0},g.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},g.prototype._change=function(e){var t=e.state,n=e.isPageReset;t!==this.state&&(this.state=t,this.emit(`change`,{state:this.state,results:this.lastResults,isPageReset:n}))},g.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit(`recommend:change`,{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},g.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},g.prototype.setClient=function(e){return this.client===e?this:(typeof e.addAlgoliaAgent==`function`&&e.addAlgoliaAgent(`JS Helper (`+h+`)`),this.client=e,this)},g.prototype.getClient=function(){return this.client},g.prototype.derive=function(e,t){var n=new r(this,e,t);return this.derivedHelpers.push(n),n},g.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(t===-1)throw Error(`Derived helper already detached`);this.derivedHelpers.splice(t,1)},g.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},t.exports=g}),Ar=c((exports,t)=>{var n=kr(),r=lr(),i=ur(),a=vr(),o=Tr();function s(e,t,r,i){return new n(e,t,r,i)}s.version=Or(),s.AlgoliaSearchHelper=n,s.SearchParameters=a,s.RecommendParameters=r,s.SearchResults=o,s.RecommendResults=i,t.exports=s}),jr=0;function Mr(e){e.dependsOn===`recommend`&&(e.$$id=jr++)}function Nr(){}function Pr(e){return Object.prototype.toString.call(e).slice(8,-1)}function Fr(e,t){if(e===void 0||typeof e!=`function`)throw Error(`The render function is not valid (received type ${Pr(e)}).
${t}`)}var Ir={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Lr=/[&<>"']/g,Rr=RegExp(Lr.source);function zr(e){return e&&Rr.test(e)?e.replace(Lr,function(e){return Ir[e]}):e}var Br={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`},Vr=/&(amp|quot|lt|gt|#39);/g,Hr=RegExp(Vr.source);function Ur(e){return e&&Hr.test(e)?e.replace(Vr,function(e){return Br[e]}):e}function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Wr(e)}function Gr(e){return e===null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function Kr(e){return Wr(e)===`object`&&e!==null}function qr(e){if(!Kr(e)||Gr(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Jr(e){"@babel/helpers - typeof";return Jr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Jr(e)}function Yr(e){if(e==null)throw TypeError(`Cannot destructure `+e)}function Xr(){return Xr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xr.apply(this,arguments)}function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Zr(Object(n),!0).forEach(function(t){$r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $r(e,t,n){return t=ei(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ei(e){var t=ti(e,`string`);return Jr(t)==`symbol`?t:String(t)}function ti(e,t){if(Jr(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Jr(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ni={highlightPreTag:`__ais-highlight__`,highlightPostTag:`__/ais-highlight__`},ri={highlightPreTag:`<mark>`,highlightPostTag:`</mark>`};function ii(e){return zr(e).replace(new RegExp(ni.highlightPreTag,`g`),ri.highlightPreTag).replace(new RegExp(ni.highlightPostTag,`g`),ri.highlightPostTag)}function ai(e){return qr(e)&&typeof e.value!=`string`?Object.keys(e).reduce(function(t,n){return Qr(Qr({},t),{},$r({},n,ai(e[n])))},{}):Array.isArray(e)?e.map(ai):Qr(Qr({},e),{},{value:ii(e.value)})}function oi(e){return e.__escaped===void 0&&(e=e.map(function(e){var t=Xr({},(Yr(e),e));return t._highlightResult&&=ai(t._highlightResult),t._snippetResult&&=ai(t._snippetResult),t}),e.__escaped=!0),e}function si(e){var t=ri.highlightPreTag,n=ri.highlightPostTag;return e.map(function(e){return e.isHighlighted?t+e.value+n:e.value}).join(``)}function ci(e){return btoa(encodeURIComponent(JSON.stringify(e)))}function li(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ui(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?li(Object(n),!0).forEach(function(t){di(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):li(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function di(e,t,n){return t=fi(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fi(e){var t=pi(e,`string`);return bi(t)==`symbol`?t:String(t)}function pi(e,t){if(bi(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(bi(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function mi(e,t){return yi(e)||vi(e,t)||gi(e,t)||hi()}function hi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gi(e,t){if(e){if(typeof e==`string`)return _i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _i(e,t)}}function _i(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function vi(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function yi(e){if(Array.isArray(e))return e}function bi(e){"@babel/helpers - typeof";return bi=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bi(e)}function xi(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,n=[],r=0;r<Math.ceil(e.length/t);r++)n.push(e.slice(r*t,(r+1)*t));return n}function Si(e){var t=e.helper,n=e.widgetType,r=e.methodName,i=e.args,a=e.instantSearchInstance;if(i.length===1&&bi(i[0])===`object`)return[i[0]];var o=i[0].split(`:`),s=mi(o,2),c=s[0],l=s[1],u=i[1],d=i[2],f=i[3]||{};if(!u||(c===`click`||c===`conversion`)&&!d)return[];var p=Array.isArray(u)?u:[u];if(p.length===0)return[];var m=p[0].__queryID,h=xi(p),g=h.map(function(e){return e.map(function(e){return e.objectID})}),_=h.map(function(e){return e.map(function(e){return e.__position})});return c===`view`?a.status===`idle`?h.map(function(e,r){var i;return{insightsMethod:`viewedObjectIDs`,widgetType:n,eventType:c,payload:ui({eventName:d||`Hits Viewed`,index:(i=t.lastResults)?.index||t.state.index,objectIDs:g[r]},f),hits:e,eventModifier:l}}):[]:c===`click`?h.map(function(e,r){var i;return{insightsMethod:`clickedObjectIDsAfterSearch`,widgetType:n,eventType:c,payload:ui({eventName:d||`Hit Clicked`,index:(i=t.lastResults)?.index||t.state.index,queryID:m,objectIDs:g[r],positions:_[r]},f),hits:e,eventModifier:l}}):c===`conversion`?h.map(function(e,r){var i;return{insightsMethod:`convertedObjectIDsAfterSearch`,widgetType:n,eventType:c,payload:ui({eventName:d||`Hit Converted`,index:(i=t.lastResults)?.index||t.state.index,queryID:m,objectIDs:g[r]},f),hits:e,eventModifier:l}}):[]}function Ci(e){var t=e.instantSearchInstance,n=e.helper,r=e.widgetType,i={},a=void 0,o=function(){for(var e=arguments.length,o=Array(e),s=0;s<e;s++)o[s]=arguments[s];var c=Si({widgetType:r,helper:n,methodName:`sendEvent`,args:o,instantSearchInstance:t});c.forEach(function(e){e.eventType===`click`&&e.eventModifier===`internal`&&i[e.eventType]||(i[e.eventType]=!0,t.sendEventToInsights(e))}),clearTimeout(a),a=setTimeout(function(){i={}},0)};return o}function wi(e){var t=e.helper,n=e.widgetType,r=e.instantSearchInstance,i=function(){for(var e=arguments.length,i=Array(e),a=0;a<e;a++)i[a]=arguments[a];var o=Si({widgetType:n,helper:t,methodName:`bindEvent`,args:i,instantSearchInstance:r});return o.length?`data-insights-event=${ci(o)}`:``};return i}function Ti(e){return e.$$type===`ais.index`}function Ei(e,t){var n=e[t.getIndexId()]||{};t.getHelper().setState(t.getWidgetSearchParameters(t.getHelper().state,{uiState:n})),t.getWidgets().filter(Ti).forEach(function(t){return Ei(e,t)})}var Di=Promise.resolve();function Oi(e){var t=null,n=!1,r=function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];t===null&&(t=Di.then(function(){if(t=null,n){n=!1;return}e.apply(void 0,i)}))};return r.wait=function(){if(t===null)throw Error("The deferred function should be called before calling `wait()`");return t},r.cancel=function(){t!==null&&(n=!0)},r}function ki(e){var t=e.name,n=e.connector,r=n===void 0?!1:n;return[`https://www.algolia.com/doc/api-reference/widgets/`,t,`/js/`,r?`#connector`:``].join(``)}function Ai(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.map(function(e){return ki(e)}).join(`, `);return function(e){return[e,`See documentation: ${r}`].filter(Boolean).join(`
`)}}function ji(e,t){for(var n,r=0;r<e.length;r++)if(n=e[r],t(n,r,e))return n}function Mi(e,t){if(!Array.isArray(e))return-1;for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}function Ni(e){if(e.appId&&e.apiKey)return[e.appId,e.apiKey];if(e.transporter){var t=e.transporter,n=t.headers||t.baseHeaders,r=t.queryParameters||t.baseQueryParameters,i=`x-algolia-application-id`,a=`x-algolia-api-key`,o=n[i]||r[i],s=n[a]||r[a];return[o,s]}else return[e.applicationID,e.apiKey]}function Pi(e){var t=ri.highlightPostTag,n=ri.highlightPreTag,r=e.split(n),i=r.shift(),a=i?[{value:i,isHighlighted:!1}]:[];return r.forEach(function(e){var n=e.split(t);a.push({value:n[0],isHighlighted:!0}),n[1]!==``&&a.push({value:n[1],isHighlighted:!1})}),a}var Fi=new RegExp(/\w/i);function Ii(e,t){var n,r,i=e[t],a=(n=e[t+1])?.isHighlighted||!0,o=(r=e[t-1])?.isHighlighted||!0;return!Fi.test(Ur(i.value))&&o===a?o:i.isHighlighted}function Li(e,t){var n=Array.isArray(t)?t:t.split(`.`);return n.reduce(function(e,t){return e&&e[t]},e)}function Ri(e){"@babel/helpers - typeof";return Ri=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ri(e)}function zi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zi(Object(n),!0).forEach(function(t){Vi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vi(e,t,n){return t=Hi(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hi(e){var t=Ui(e,`string`);return Ri(t)==`symbol`?t:String(t)}function Ui(e,t){if(Ri(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ri(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Wi(e,t,n){return e.map(function(e,r){return Bi(Bi({},e),{},{__position:n*t+r+1})})}function Gi(e){"@babel/helpers - typeof";return Gi=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Gi(e)}function Ki(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ki(Object(n),!0).forEach(function(t){Ji(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ki(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ji(e,t,n){return t=Yi(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yi(e){var t=Xi(e,`string`);return Gi(t)==`symbol`?t:String(t)}function Xi(e,t){if(Gi(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Gi(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Zi(e,t){return t?e.map(function(e){return qi(qi({},e),{},{__queryID:t})}):e}function Qi(e){"@babel/helpers - typeof";return Qi=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Qi(e)}function $i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ea(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?$i(Object(n),!0).forEach(function(t){ta(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ta(e,t,n){return t=na(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function na(e){var t=ra(e,`string`);return Qi(t)==`symbol`?t:String(t)}function ra(e,t){if(Qi(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Qi(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ia(e,t){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.recommendResults?ea(ea({},e),r.recommendResults.results):e},{});e._recommendCache=n}function aa(e){"@babel/helpers - typeof";return aa=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},aa(e)}function oa(e,t){return da(e)||ua(e,t)||ca(e,t)||sa()}function sa(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ca(e,t){if(e){if(typeof e==`string`)return la(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return la(e,t)}}function la(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ua(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function da(e){if(Array.isArray(e))return e}function fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fa(Object(n),!0).forEach(function(t){ma(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ma(e,t,n){return t=ha(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha(e){var t=ga(e,`string`);return aa(t)==`symbol`?t:String(t)}function ga(e,t){if(aa(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(aa(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _a(e,t){if(t&&!((!(`transporter`in e)||e._cacheHydrated)&&(!e._useCache||typeof e.addAlgoliaAgent!=`function`))){var n=[Object.keys(t).reduce(function(e,n){var r=t[n],i=r.state,a=r.requestParams,o=r.results,s=o&&i?o.map(function(e,t){return pa({indexName:i.index||e.index},a!=null&&a[t]||e.params?{params:ya(a?.[t]||va(e.params))}:{})}):[];return e.concat(s)},[])],r=Object.keys(t).reduce(function(e,n){var r=t[n].results;return r?e.concat(r):e},[]);if(`transporter`in e&&!e._cacheHydrated){e._cacheHydrated=!0;var i=e.search.bind(e);e.search=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];var o=Array.isArray(t)?t.map(function(e){return pa(pa({},e),{},{params:ya(e.params)})}):ya(t.requestBody.params);return e.transporter.responsesCache.get({method:`search`,args:[o].concat(r)},function(){return i.apply(void 0,[t].concat(r))})},e.transporter.responsesCache.set({method:`search`,args:n},{results:r})}if(!(`transporter`in e)){var a=`/1/indexes/*/queries_body_${JSON.stringify({requests:n})}`;e.cache=pa(pa({},e.cache),{},ma({},a,JSON.stringify({results:Object.keys(t).map(function(e){return t[e].results})})))}}}function va(e){return e.split(`&`).reduce(function(e,t){var n=t.split(`=`),r=oa(n,2),i=r[0],a=r[1];return e[i]=a?decodeURIComponent(a):``,e},{})}function ya(e){var t=function(e){return Object.prototype.toString.call(e)===`[object Object]`||Object.prototype.toString.call(e)===`[object Array]`},n=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=0;return e.replace(/%s/g,function(){return encodeURIComponent(n[i++])})};return Object.keys(e).map(function(r){return n(`%s=%s`,r,t(e[r])?JSON.stringify(e[r]):e[r])}).join(`&`)}function ba(e){return e!==Object(e)}function xa(e,t){if(e===t)return!0;if(ba(e)||ba(t)||typeof e==`function`||typeof t==`function`)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];if(!(i in t)||!xa(e[i],t[i]))return!1}return!0}function Sa(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})}function Ca(e){"@babel/helpers - typeof";return Ca=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ca(e)}var wa=[`facets`,`disjunctiveFacets`,`facetsRefinements`,`facetsExcludes`,`disjunctiveFacetsRefinements`,`numericRefinements`,`tagRefinements`,`hierarchicalFacets`,`hierarchicalFacetsRefinements`,`ruleContexts`];function Ta(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ea(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ta(Object(n),!0).forEach(function(t){Da(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ta(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Da(e,t,n){return t=Oa(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oa(e){var t=ka(e,`string`);return Ca(t)==`symbol`?t:String(t)}function ka(e,t){if(Ca(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ca(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Aa(e,t){if(e==null)return{};var n=ja(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ma=function(e,t){var n=t.facets,r=t.disjunctiveFacets,i=t.facetsRefinements,a=t.facetsExcludes,o=t.disjunctiveFacetsRefinements,s=t.numericRefinements,c=t.tagRefinements,l=t.hierarchicalFacets,u=t.hierarchicalFacetsRefinements,d=t.ruleContexts,f=Aa(t,wa);return e.setQueryParameters(f)},Na=function(e,t){return t.facets.reduce(function(e,t){return e.addFacet(t)},e)},Pa=function(e,t){return t.disjunctiveFacets.reduce(function(e,t){return e.addDisjunctiveFacet(t)},e)},Fa=function(e,t){return e.setQueryParameters({hierarchicalFacets:t.hierarchicalFacets.reduce(function(e,t){var n=Mi(e,function(e){return e.name===t.name});if(n===-1)return e.concat(t);var r=e.slice();return r.splice(n,1,t),r},e.hierarchicalFacets)})},Ia=function(e,t){return t.tagRefinements.reduce(function(e,t){return e.addTagRefinement(t)},e)},La=function(e,t){return e.setQueryParameters({facetsRefinements:Ea(Ea({},e.facetsRefinements),t.facetsRefinements)})},Ra=function(e,t){return e.setQueryParameters({facetsExcludes:Ea(Ea({},e.facetsExcludes),t.facetsExcludes)})},za=function(e,t){return e.setQueryParameters({disjunctiveFacetsRefinements:Ea(Ea({},e.disjunctiveFacetsRefinements),t.disjunctiveFacetsRefinements)})},Ba=function(e,t){return e.setQueryParameters({numericRefinements:Ea(Ea({},e.numericRefinements),t.numericRefinements)})},Va=function(e,t){return e.setQueryParameters({hierarchicalFacetsRefinements:Ea(Ea({},e.hierarchicalFacetsRefinements),t.hierarchicalFacetsRefinements)})},Ha=function(e,t){var n=Sa([].concat(e.ruleContexts).concat(t.ruleContexts).filter(Boolean));return n.length>0?e.setQueryParameters({ruleContexts:n}):e},Ua=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){var n=Va(e,t),r=Fa(n,t),i=Ia(r,t),a=Ba(i,t),o=za(a,t),s=Ra(o,t),c=La(s,t),l=Pa(c,t),u=Ha(l,t),d=Na(u,t);return Ma(d,t)})};function Wa(e,t,n){var r=t.getHelper();return{uiState:n,helper:r,parent:t,instantSearchInstance:e,state:r.state,renderState:e.renderState,templatesConfig:e.templatesConfig,createURL:t.createURL,scopedResults:[],searchMetadata:{isSearchStalled:e.status===`stalled`},status:e.status,error:e.error}}function Ga(e,t,n){var r=t.getResultsForWidget(n),i=t.getHelper();return{helper:i,parent:t,instantSearchInstance:e,results:r,scopedResults:t.getScopedResults(),state:r&&`_state`in r?r._state:i.state,renderState:e.renderState,templatesConfig:e.templatesConfig,createURL:t.createURL,searchMetadata:{isSearchStalled:e.status===`stalled`},status:e.status,error:e.error}}function Ka(e){for(var t=e.getParent(),n=[e.getHelper().state];t!==null;)n=[t.getHelper().state].concat(n),t=t.getParent();return n}function qa(e){"@babel/helpers - typeof";return qa=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qa(e)}function Ja(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ya(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ja(Object(n),!0).forEach(function(t){Xa(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ja(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xa(e,t,n){return t=Za(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Za(e){var t=Qa(e,`string`);return qa(t)==`symbol`?t:String(t)}function Qa(e,t){if(qa(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(qa(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $a(e){return e.some(function(e){return e.isHighlighted})?e.map(function(t,n){return Ya(Ya({},t),{},{isHighlighted:!Ii(e,n)})}):e.map(function(e){return Ya(Ya({},e),{},{isHighlighted:!1})})}function eo(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{fallback:function(){}},n=t.fallback;return typeof window>`u`?n():e({window})}var to=d(Ar());function no(e){"@babel/helpers - typeof";return no=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},no(e)}function ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function io(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ro(Object(n),!0).forEach(function(t){ao(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ro(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ao(e,t,n){return t=oo(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oo(e){var t=so(e,`string`);return no(t)==`symbol`?t:String(t)}function so(e,t){if(no(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(no(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var co=Ai({name:`configure`,connector:!0});function lo(e,t){return e.setQueryParameters(Object.keys(t.searchParameters).reduce(function(e,t){return io(io({},e),{},ao({},t,void 0))},{}))}var uo=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nr,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nr;return function(n){if(!n||!qr(n.searchParameters))throw Error(co("The `searchParameters` option expects an object."));var r={};function i(e){return function(t){var r=lo(e.state,n),i=Ua(r,new to.default.SearchParameters(t));n.searchParameters=t,e.setState(i).search()}}return{$$type:`ais.configure`,init:function(t){var n=t.instantSearchInstance;e(io(io({},this.getWidgetRenderState(t)),{},{instantSearchInstance:n}),!0)},render:function(t){var n=t.instantSearchInstance;e(io(io({},this.getWidgetRenderState(t)),{},{instantSearchInstance:n}),!1)},dispose:function(e){var r=e.state;return t(),lo(r,n)},getRenderState:function(e,t){var n,r=this.getWidgetRenderState(t);return io(io({},e),{},{configure:io(io({},r),{},{widgetParams:io(io({},r.widgetParams),{},{searchParameters:Ua(new to.default.SearchParameters((n=e.configure)?.widgetParams.searchParameters),new to.default.SearchParameters(r.widgetParams.searchParameters)).getQueryParams()})})})},getWidgetRenderState:function(e){var t=e.helper;return r.refine||=i(t),{refine:r.refine,widgetParams:n}},getWidgetSearchParameters:function(e,t){var r=t.uiState;return Ua(e,new to.default.SearchParameters(io(io({},r.configure),n.searchParameters)))},getWidgetUiState:function(e){return io(io({},e),{},{configure:io(io({},e.configure),n.searchParameters)})}}}},fo=uo;function po(e){"@babel/helpers - typeof";return po=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},po(e)}var mo=Object.prototype.hasOwnProperty;function ho(e,t,n){if(n!=null&&n(e,t))return!0;var r,i;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((i=e.length)===t.length)for(;i--&&ho(e[i],t[i],n););return i===-1}if(!r||po(e)===`object`){for(r in i=0,e)if(mo.call(e,r)&&++i&&!mo.call(t,r)||!(r in t)||!ho(e[r],t[r],n))return!1;return Object.keys(t).length===i}}return e!==e&&t!==t}var go=d(Ar(),1);function _o(e){var t,n,r;return new go.default.SearchResults(e,[{query:(t=e.query)??``,page:(n=e.page)??0,hitsPerPage:(r=e.hitsPerPage)??20,hits:[],nbHits:0,nbPages:0,params:``,exhaustiveNbHits:!0,exhaustiveFacetsCount:!0,processingTimeMS:0,index:e.index}],{__isArtificial:!0})}function vo(e){"@babel/helpers - typeof";return vo=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vo(e)}function yo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yo(Object(n),!0).forEach(function(t){xo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xo(e,t,n){return t=So(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function So(e){var t=Co(e,`string`);return vo(t)==`symbol`?t:String(t)}function Co(e,t){if(vo(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(vo(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function wo(e){var t=e.getHelper(),n=e.getResults()||_o(t.state),r=e.getScopedResults().map(function(t){var r=t.indexId===e.getIndexId()?n:_o(t.helper.state);return bo(bo({},t),{},{results:t.results||r})});return{results:n,scopedResults:r,recommendResults:t.lastRecommendResults}}D();var To=ye(null);function Eo(e,t){if(!e)throw Error(`Invariant failed`)}D();function Do(){var e=wt(To);return Eo(e!==null,`The <Index> component must be used within <InstantSearch>.`),e}D();var Oo=ye(null);D();function ko(){var e=wt(Oo);return Eo(e!==null,"Hooks must be used inside the <InstantSearch> component.\n\nThey are not compatible with the `react-instantsearch-core@6.x` and `react-instantsearch-dom` packages, so make sure to use the <InstantSearch> component from `react-instantsearch-core@7.x`."),e}D();var Ao=ye(null);D();function jo(){return wt(Ao)}D();var Mo=ye(null);D();function No(){return wt(Mo)}D();function Po(e,t){return zo(e)||Ro(e,t)||Io(e,t)||Fo()}function Fo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Io(e,t){if(e){if(typeof e==`string`)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lo(e,t)}}function Lo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function zo(e){if(Array.isArray(e))return e}function Bo(e){var t=T(function(){return e}),n=Po(t,2),r=n[0],i=n[1];return ho(r,e)||i(e),r}D();var Vo=`use`,Ho=Yt[Vo];D();var Uo=typeof window<`u`?yt:E;D();var Wo=ye({countRef:{current:0},waitForResultsRef:null,ignoreMultipleHooksWarning:!1});D();function Go(){return wt(Wo)}D();function Ko(e){var t,n,r=e.widget,i=e.parentIndex,a=e.props,o=e.shouldSsr,s=e.skipSuspense,c=Go(),l=c.waitForResultsRef,u=c.countRef,d=c.ignoreMultipleHooksWarning,f=bt(a);E(function(){f.current=a},[a]);var p=bt(r);E(function(){p.current=r},[r]);var m=bt(null),h=o&&!i.getWidgets().includes(r),g=ko();if(Uo(function(){var e=p.current;if(!m.current)o||i.addWidgets([r]);else{clearTimeout(m.current);var t=ho(a,f.current);t||(i.removeWidgets([e]),i.addWidgets([r]))}return function(){m.current=setTimeout(function(){g._schedule(function(){g._preventWidgetCleanup||i.removeWidgets([e])})})}},[i,r,o,g,a]),(h||(l==null?void 0:(t=l.current)?.status)===`pending`)&&i.addWidgets([r]),l!=null&&l.current&&!s){var _;Ho(l.current),r.$$type!==`ais.dynamicWidgets`&&(_=g.helper)!=null&&_.lastResults&&Ho(l.current)}(l==null?void 0:(n=l.current)?.status)===`fulfilled`&&(u.current+=1)}D();function qo(e){"@babel/helpers - typeof";return qo=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qo(e)}var Jo=[`skipSuspense`],Yo=[`instantSearchInstance`,`widgetParams`],Xo=[`widgetParams`];function Zo(e,t){return ns(e)||ts(e,t)||$o(e,t)||Qo()}function Qo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $o(e,t){if(e){if(typeof e==`string`)return es(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return es(e,t)}}function es(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ts(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function ns(e){if(Array.isArray(e))return e}function rs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rs(Object(n),!0).forEach(function(t){ss(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ss(e,t,n){return t=cs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cs(e){var t=ls(e,`string`);return qo(t)==`symbol`?t:String(t)}function ls(e,t){if(qo(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(qo(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function us(e,t){if(e==null)return{};var n=ds(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ds(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function fs(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.skipSuspense,i=r===void 0?!1:r,a=us(n,Jo),o=jo(),s=No(),c=ko(),l=Do(),u=Bo(t),d=Bo(a),f=bt(!0),p=bt(null),m=bt(c.status),h=St(function(){var t=e(function(e,t){if(t){f.current=!0;return}if(f.current){var n=e.instantSearchInstance,r=e.widgetParams,i=us(e,Yo);(!ho(i,p.current,function(e,t){return e?.constructor===Function&&t?.constructor===Function})||n.status!==m.current)&&(y(i),p.current=i,m.current=n.status)}},function(){f.current=!1});return os(os({},t(u)),d)},[e,u,d]),g=T(function(){if(h.getWidgetRenderState){var e,t=l.getHelper(),n=l.getWidgetUiState({})[l.getIndexId()];t.state=(e=h.getWidgetSearchParameters)?.call(h,t.state,{uiState:n})||t.state;var r=wo(l),i=r.results,a=r.scopedResults,o=r.recommendResults,u=h.getWidgetRenderState({helper:t,parent:l,instantSearchInstance:c,results:h.dependsOn===`recommend`&&o&&s?o[s.recommendIdx.current++]:i,scopedResults:a,state:t.state,renderState:c.renderState,templatesConfig:c.templatesConfig,createURL:l.createURL,searchMetadata:{isSearchStalled:c.status===`stalled`},status:c.status,error:c.error}),d=u.widgetParams,f=us(u,Xo);return f}return{}}),_=Zo(g,2),v=_[0],y=_[1];return Ko({widget:h,parentIndex:l,props:u,shouldSsr:!!o,skipSuspense:i}),v}function ps(e,t){return fs(fo,{searchParameters:e},t)}function ms(e){"@babel/helpers - typeof";return ms=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ms(e)}function hs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?hs(Object(n),!0).forEach(function(t){_s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _s(e,t,n){return t=vs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vs(e){var t=ys(e,`string`);return ms(t)==`symbol`?t:String(t)}function ys(e,t){if(ms(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ms(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function bs(e){return ps(gs({},e),{$$widgetType:`ais.configure`}),null}var xs=d(Ar());function Ss(e){"@babel/helpers - typeof";return Ss=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ss(e)}var Cs=[`initialSearchParameters`],ws=[`initialRecommendParameters`];function Ts(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Es(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ts(Object(n),!0).forEach(function(t){Ds(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ts(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ds(e,t,n){return t=Os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e){var t=ks(e,`string`);return Ss(t)==`symbol`?t:String(t)}function ks(e,t){if(Ss(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ss(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function As(e){return Ps(e)||Ns(e)||Ms(e)||js()}function js(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ms(e,t){if(e){if(typeof e==`string`)return Fs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fs(e,t)}}function Ns(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ps(e){if(Array.isArray(e))return Fs(e)}function Fs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Is(e,t){if(e==null)return{};var n=Ls(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ls(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Rs=Ai({name:`index-widget`});function zs(e,t){var n=t.state,r=t.recommendState,i=t.isPageReset,a=t._uiState;n!==e.state&&(e.state=n,e.emit(`change`,{state:e.state,results:e.lastResults,isPageReset:i,_uiState:a})),r!==e.recommendState&&(e.recommendState=r)}function Bs(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return e.reduce(function(e,n){return Ti(n)||!n.getWidgetUiState&&!n.getWidgetState?e:n.getWidgetUiState?n.getWidgetUiState(e,t):n.getWidgetState(e,t)},n)}function Vs(e,t){var n=t.initialSearchParameters,r=Is(t,Cs);return e.reduce(function(e,t){return!t.getWidgetSearchParameters||Ti(t)?e:t.dependsOn===`search`&&t.getWidgetParameters?t.getWidgetParameters(e,r):t.getWidgetSearchParameters(e,r)},n)}function Hs(e,t){var n=t.initialRecommendParameters,r=Is(t,ws);return e.reduce(function(e,t){return!Ti(t)&&t.dependsOn===`recommend`&&t.getWidgetParameters?t.getWidgetParameters(e,r):e},n)}function Us(e){var t=e.filter(Ti);t.length!==0&&t.forEach(function(e){var t=e.getHelper();zs(t,{state:t.state.resetPage(),recommendState:t.recommendState,isPageReset:!0}),Us(e.getWidgets())})}function Ws(e){var t=e.filter(Ti);return t.reduce(function(e,t){return e.concat.apply(e,[{indexId:t.getIndexId(),results:t.getResults(),helper:t.getHelper()}].concat(As(Ws(t.getWidgets()))))},[])}var Gs=function(e){if(e===void 0||e.indexName===void 0&&!e.EXPERIMENTAL_isolated)throw Error(Rs("The `indexName` option is required."));var t=e.indexName,n=t===void 0?``:t,r=e.indexId,i=r===void 0?n:r,a=e.EXPERIMENTAL_isolated,o=a===void 0?!1:a,s=[],c={},l=null,u=null,d=null,f=null,p=null,m=!1,h=!1;return{$$type:`ais.index`,$$widgetType:`ais.index`,_isolated:o,getIndexName:function(){return n},getIndexId:function(){return i},getHelper:function(){return d},getResults:function(){var e;return(e=f)!=null&&e.lastResults?(f.lastResults._state=d.state,f.lastResults):null},getResultsForWidget:function(e){var t;return e.dependsOn!==`recommend`||Ti(e)||e.$$id===void 0?this.getResults():(t=d)!=null&&t.lastRecommendResults?d.lastRecommendResults[e.$$id]:null},getPreviousState:function(){return p},getScopedResults:function(){var e=this.getParent(),t;return t=e?e.getWidgets():n.length===0?this.getWidgets():[this],Ws(t)},getParent:function(){return o?null:u},createURL:function(e){return typeof e==`function`?l._createURL(Ds({},i,e(c))):l._createURL(Ds({},i,Bs(s,{searchParameters:e,helper:d})))},getWidgets:function(){return s},addWidgets:function(e){var t=this;if(!Array.isArray(e))throw Error(Rs("The `addWidgets` method expects an array of widgets."));var n=e.reduce(function(e,t){return e.concat(Array.isArray(t)?t:[t])},[]);if(n.some(function(e){return typeof e.init!=`function`&&typeof e.render!=`function`}))throw Error(Rs("The widget definition expects a `render` and/or an `init` method."));if(n.forEach(function(e){Ti(e)||(l&&e.dependsOn===`recommend`?l._hasRecommendWidget=!0:l?l._hasSearchWidget=!0:e.dependsOn===`recommend`?m=!0:h=!0,Mr(e))}),s=s.concat(n),l&&n.length)if(zs(d,{state:Vs(s,{uiState:c,initialSearchParameters:d.state}),recommendState:Hs(s,{uiState:c,initialRecommendParameters:d.recommendState}),_uiState:c}),n.forEach(function(e){if(e.getRenderState){var n=e.getRenderState(l.renderState[t.getIndexId()]||{},Wa(l,t,l._initialUiState));qs({renderState:n,instantSearchInstance:l,parent:t})}}),n.forEach(function(e){e.init&&e.init(Wa(l,t,l._initialUiState))}),o){var r;(r=d)==null||r.search()}else l.scheduleSearch();return this},removeWidgets:function(e){var t=this;if(!Array.isArray(e))throw Error(Rs("The `removeWidgets` method expects an array of widgets."));var n=e.reduce(function(e,t){return e.concat(Array.isArray(t)?t:[t])},[]);if(n.some(function(e){return typeof e.dispose!=`function`}))throw Error(Rs("The widget definition expects a `dispose` method."));if(s=s.filter(function(e){return n.indexOf(e)===-1}),s.forEach(function(e){Ti(e)||(l&&e.dependsOn===`recommend`?l._hasRecommendWidget=!0:l?l._hasSearchWidget=!0:e.dependsOn===`recommend`?m=!0:h=!0)}),l&&n.length){var r=n.reduce(function(e,n){var r=n.dispose({helper:d,state:e.cleanedSearchState,recommendState:e.cleanedRecommendState,parent:t});return r instanceof xs.default.RecommendParameters?e.cleanedRecommendState=r:r&&(e.cleanedSearchState=r),e},{cleanedSearchState:d.state,cleanedRecommendState:d.recommendState}),i=r.cleanedSearchState,a=r.cleanedRecommendState,u=l.future.preserveSharedStateOnUnmount?Vs(s,{uiState:c,initialSearchParameters:new xs.default.SearchParameters({index:this.getIndexName()})}):Vs(s,{uiState:Bs(s,{searchParameters:i,helper:d}),initialSearchParameters:i});if(c=Bs(s,{searchParameters:u,helper:d}),d.setState(u),d.recommendState=a,s.length)if(o){var f;(f=d)==null||f.search()}else l.scheduleSearch()}return this},init:function(e){var t=this,r,a=e.instantSearchInstance,g=e.parent,_=e.uiState;if(d===null){l=a,u=g,c=_[i]||{};var v=a.mainHelper,y=Vs(s,{uiState:c,initialSearchParameters:new xs.default.SearchParameters({index:n})}),b=Hs(s,{uiState:c,initialRecommendParameters:new xs.default.RecommendParameters});d=(0,xs.default)(v.getClient(),y.index,y),d.recommendState=b,d.search=function(){return o?(a.status=`loading`,t.render({instantSearchInstance:a}),a.compositionID?d.searchWithComposition():d.searchOnlyWithDerivedHelpers()):a.onStateChange?(a.onStateChange({uiState:a.mainIndex.getWidgetUiState({}),setUiState:function(e){return a.setUiState(e,!1)}}),v):v.search()},d.searchWithoutTriggeringOnStateChange=function(){return v.search()},d.searchForFacetValues=function(e,t,n,r){var i=d.state.setQueryParameters(r);return v.searchForFacetValues(e,t,n,i)};var x=n?d:(0,xs.default)({},`__empty_index__`,{}),S=o?x:Js(g,v);f=S.derive(function(){return Ua.apply(void 0,[v.state].concat(As(Ka(t))))},function(){return t.getHelper().recommendState});var C=(r=a._initialResults)?.[this.getIndexId()];if(C!=null&&C.results){var ee=new xs.default.SearchResults(new xs.default.SearchParameters(C.state),C.results);f.lastResults=ee,d.lastResults=ee}if(C!=null&&C.recommendResults){var te=new xs.default.RecommendResults(new xs.default.RecommendParameters({params:C.recommendResults.params}),C.recommendResults.results);f.lastRecommendResults=te,d.lastRecommendResults=te}d.on(`change`,function(e){var t=e.isPageReset;t&&Us(s)}),f.on(`search`,function(){a.scheduleStalledRender()}),f.on(`result`,function(e){var t=e.results;a.scheduleRender(),d.lastResults=t,p=t?._state}),f.on(`recommend:result`,function(e){var t=e.recommend;a.scheduleRender(),d.lastRecommendResults=t.results}),s.forEach(function(e){if(e.getRenderState){var n=e.getRenderState(a.renderState[t.getIndexId()]||{},Wa(a,t,_));qs({renderState:n,instantSearchInstance:a,parent:t})}}),s.forEach(function(e){e.init&&e.init(Wa(a,t,_))}),d.on(`change`,function(e){var t=e.state,n=e._uiState;c=Bs(s,{searchParameters:t,helper:d},n||{}),a.onStateChange||a.onInternalStateChange()}),C&&a.scheduleRender(),m&&(a._hasRecommendWidget=!0),h&&(a._hasSearchWidget=!0)}},render:function(e){var t,r=this,i=e.instantSearchInstance;i.status===`error`&&!i.mainHelper.hasPendingRequests()&&p&&d.setState(p);var a=this.getResults()||(t=f)!=null&&t.lastRecommendResults||o&&!n?s:s.filter(Ti);a=a.filter(function(e){return e.shouldRender?e.shouldRender({instantSearchInstance:i}):!0}),a.forEach(function(e){if(e.getRenderState){var t=e.getRenderState(i.renderState[r.getIndexId()]||{},Ga(i,r,e));qs({renderState:t,instantSearchInstance:i,parent:r})}}),a.forEach(function(e){e.render&&e.render(Ga(i,r,e))})},dispose:function(){var e=this,t,n;s.forEach(function(t){t.dispose&&d&&t.dispose({helper:d,state:d.state,recommendState:d.recommendState,parent:e})}),l=null,u=null,(t=d)==null||t.removeAllListeners(),d=null,(n=f)==null||n.detach(),f=null},getWidgetUiState:function(e){return s.filter(Ti).filter(function(e){return!e._isolated}).reduce(function(e,t){return t.getWidgetUiState(e)},Es(Es({},e),{},Ds({},i,Es(Es({},e[i]),c))))},getWidgetState:function(e){return this.getWidgetUiState(e)},getWidgetSearchParameters:function(e,t){var n=t.uiState;return Vs(s,{uiState:n,initialSearchParameters:e})},refreshUiState:function(){c=Bs(s,{searchParameters:this.getHelper().state,helper:this.getHelper()},c)},setIndexUiState:function(e){var t=typeof e==`function`?e(c):e;l.setUiState(function(e){return Es(Es({},e),{},Ds({},i,t))})}}},Ks=Gs;function qs(e){var t=e.renderState,n=e.instantSearchInstance,r=e.parent,i=r?r.getIndexId():n.mainIndex.getIndexId();n.renderState=Es(Es({},n.renderState),{},Ds({},i,Es(Es({},n.renderState[i]),t)))}function Js(e,t){for(;e;){if(e._isolated)return e.getHelper();e=e.getParent()}return t}D();function Ys(e,t){return ec(e)||$s(e,t)||Zs(e,t)||Xs()}function Xs(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zs(e,t){if(e){if(typeof e==`string`)return Qs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qs(e,t)}}function Qs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $s(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function ec(e){if(Array.isArray(e))return e}function tc(){var e=vt(function(e){return e+1},0),t=Ys(e,2),n=t[1];return n}var nc=`ais`,rc=function(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.descendantName,r=t.modifierName,i=n?`-${n}`:``,a=r?`--${r}`:``;return`${nc}-${e}${i}${a}`}},ic=rc(`Highlight`);function ac(e){var t=e.attribute,n=e.highlightedTagName,r=n===void 0?`mark`:n,i=e.hit,a=e.cssClasses,o=a===void 0?{}:a,s=Li(i._highlightResult,t),c=s||{},l=c.value,u=l===void 0?``:l,d=ic({descendantName:`highlighted`})+(o.highlighted?` ${o.highlighted}`:``);return u.replace(new RegExp(ri.highlightPreTag,`g`),`<${r} class="${d}">`).replace(new RegExp(ri.highlightPostTag,`g`),`</${r}>`)}var oc=rc(`ReverseHighlight`);function sc(e){var t=e.attribute,n=e.highlightedTagName,r=n===void 0?`mark`:n,i=e.hit,a=e.cssClasses,o=a===void 0?{}:a,s=Li(i._highlightResult,t),c=s||{},l=c.value,u=l===void 0?``:l,d=oc({descendantName:`highlighted`})+(o.highlighted?` ${o.highlighted}`:``),f=si($a(Pi(u)));return f.replace(new RegExp(ri.highlightPreTag,`g`),`<${r} class="${d}">`).replace(new RegExp(ri.highlightPostTag,`g`),`</${r}>`)}var cc=rc(`Snippet`);function lc(e){var t=e.attribute,n=e.highlightedTagName,r=n===void 0?`mark`:n,i=e.hit,a=e.cssClasses,o=a===void 0?{}:a,s=Li(i._snippetResult,t),c=s||{},l=c.value,u=l===void 0?``:l,d=cc({descendantName:`highlighted`})+(o.highlighted?` ${o.highlighted}`:``);return u.replace(new RegExp(ri.highlightPreTag,`g`),`<${r} class="${d}">`).replace(new RegExp(ri.highlightPostTag,`g`),`</${r}>`)}var uc=rc(`ReverseSnippet`);function dc(e){var t=e.attribute,n=e.highlightedTagName,r=n===void 0?`mark`:n,i=e.hit,a=e.cssClasses,o=a===void 0?{}:a,s=Li(i._snippetResult,t),c=s||{},l=c.value,u=l===void 0?``:l,d=uc({descendantName:`highlighted`})+(o.highlighted?` ${o.highlighted}`:``),f=si($a(Pi(u)));return f.replace(new RegExp(ri.highlightPreTag,`g`),`<${r} class="${d}">`).replace(new RegExp(ri.highlightPostTag,`g`),`</${r}>`)}function fc(e){"@babel/helpers - typeof";return fc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fc(e)}function pc(e){var t=e.method,n=e.payload;if(fc(n)!==`object`)throw Error(`The insights helper expects the payload to be an object.`);var r;try{r=ci(n)}catch{throw Error(`Could not JSON serialize the payload object.`)}return`data-insights-method="${t}" data-insights-payload="${r}"`}function mc(e,t){return pc({method:e,payload:t})}function hc(e){"@babel/helpers - typeof";return hc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},hc(e)}var gc=`_ALGOLIA`;function _c(e){if(!((typeof document>`u`?`undefined`:hc(document))!==`object`||typeof document.cookie!=`string`))for(var t=`${e}=`,n=document.cookie.split(`;`),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)===` `;)i=i.substring(1);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}}function vc(){return _c(gc)}function yc(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=Math.random()*16|0,n=e===`x`?t:t&3|8;return n.toString(16)})}function bc(e){"@babel/helpers - typeof";return bc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bc(e)}function xc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xc(Object(n),!0).forEach(function(t){Cc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cc(e,t,n){return t=wc(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wc(e){var t=Tc(e,`string`);return bc(t)==`symbol`?t:String(t)}function Tc(e,t){if(bc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(bc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ec(e,t){return kc(e)||Oc(e,t)||Mc(e,t)||Dc()}function Dc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function kc(e){if(Array.isArray(e))return e}function Ac(e){return Pc(e)||Nc(e)||Mc(e)||jc()}function jc(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(e,t){if(e){if(typeof e==`string`)return Fc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fc(e,t)}}function Nc(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Pc(e){if(Array.isArray(e))return Fc(e)}function Fc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ic=`2.17.2`,Lc=`https://cdn.jsdelivr.net/npm/search-insights@${Ic}/dist/search-insights.min.js`;function Rc(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.insightsClient,n=e.insightsInitParams,r=e.onEvent,i=e.$$internal,a=i===void 0?!1:i,o=e.$$automatic,s=o===void 0?!1:o,c=t;!t&&t!==null&&eo(function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||`aa`;typeof n==`string`&&(c=t[n]),c||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];t[n].queue.push(r)},t[n].version=Ic,t[n].shouldAddScript=!0),c=t[n])});var l=c||Nr;return function(e){var t=e.instantSearchInstance,i=t.middleware.filter(function(e){return e.instance.$$type===`ais.insights`&&e.instance.$$internal}).map(function(e){return e.creator});t.unuse.apply(t,Ac(i));var o=Ni(t.client),c=Ec(o,2),u=c[0],d=c[1],f=void 0,p=void 0,m=void 0,h=l.queue;if(Array.isArray(h)){var g=[`setUserToken`,`init`].map(function(e){var t=ji(h.slice().reverse(),function(t){var n=Ec(t,1),r=n[0];return r===e})||[],n=Ec(t,2),r=n[1];return r}),_=Ec(g,2);p=_[0],f=_[1]}l(`getUserToken`,null,function(e,t){m=Hc(t)}),(n||!Vc(l))&&l(`init`,Sc({appId:u,apiKey:d,partial:!0},n));var v,y;return{$$type:`ais.insights`,$$internal:a,$$automatic:s,onStateChange:function(){},subscribe:function(){if(l.shouldAddScript){var e=`[insights middleware]: could not load search-insights.js. Please load it manually following https://alg.li/insights-init`;try{var n=document.createElement(`script`);n.async=!0,n.src=Lc,n.onerror=function(){t.emit(`error`,Error(e))},document.body.appendChild(n),l.shouldAddScript=!1}catch{l.shouldAddScript=!1,t.emit(`error`,Error(e))}}},started:function(){l(`addAlgoliaAgent`,`insights-middleware`),y=t.mainHelper;var e=l.queue;if(Array.isArray(e)){var i=[`setUserToken`,`init`].map(function(t){var n=ji(e.slice().reverse(),function(e){var n=Ec(e,1),r=n[0];return r===t})||[],r=Ec(n,2),i=r[1];return i}),o=Ec(i,2);p=o[0],f=o[1]}v=zc(t),s||y.overrideStateWithoutTriggeringChangeEvent(Sc(Sc({},y.state),{},{clickAnalytics:!0})),a||t.scheduleSearch();var c=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=Hc(e);if(!r)return;var i=y.state.userToken;function a(){y.overrideStateWithoutTriggeringChangeEvent(Sc(Sc({},y.state),{},{userToken:r})),i&&i!==e&&t.scheduleSearch()}n?a():setTimeout(a,0)};function u(e){c(e,!0),l(`setUserToken`,e)}var d=void 0,h=vc();if(h)d=h;else{var g=`anonymous-${yc()}`;d=g}var _,b=v.userToken;if(n!=null&&n.userToken&&(_=n.userToken),_)u(_);else if(b)u(b);else if(m)u(m);else if(p)u(p);else if(d){var x;if(u(d),n!=null&&n.useCookie||(x=f)!=null&&x.useCookie){var S;Bc(d,n?.cookieDuration||(S=f)?.cookieDuration)}}l(`onUserTokenChange`,function(e){return c(e,!0)},{immediate:!0});var C=l;Vc(l)&&(C=function(e,n){var r=Ni(t.client),i=Ec(r,2),a=i[0],o=i[1],s={headers:{"X-Algolia-Application-Id":a,"X-Algolia-API-Key":o}};return l(e,n,s)});var ee=new Set,te;t.mainHelper.derivedHelpers[0].on(`result`,function(e){var t=e.results;t&&(!t.queryID||t.queryID!==te)&&(te=t.queryID,ee.clear())}),t.sendEventToInsights=function(e){if(r)r(e,C);else if(e.insightsMethod){if(e.insightsMethod===`viewedObjectIDs`){var t=e.payload,n=t.objectIDs.filter(function(e){return!ee.has(e)});if(n.length===0)return;n.forEach(function(e){return ee.add(e)}),t.objectIDs=n}e.payload.algoliaSource=[`instantsearch`],s&&e.payload.algoliaSource.push(`instantsearch-automatic`),e.eventModifier===`internal`&&e.payload.algoliaSource.push(`instantsearch-internal`),C(e.insightsMethod,e.payload)}}},unsubscribe:function(){l(`onUserTokenChange`,void 0),t.sendEventToInsights=Nr,y&&v&&(y.overrideStateWithoutTriggeringChangeEvent(Sc(Sc({},y.state),v)),t.scheduleSearch())}}}}function zc(e){var t,n,r=((t=e._initialResults)==null?void 0:(n=t[e.indexName])?.state)||{},i=e.mainHelper.state;return{userToken:r.userToken||i.userToken,clickAnalytics:r.clickAnalytics||i.clickAnalytics}}function Bc(e,t){var n=30*24*60*60*1e3,r=new Date;r.setTime(r.getTime()+(t||n*6));var i=`expires=${r.toUTCString()}`;document.cookie=`_ALGOLIA=${e};${i};path=/`}function Vc(e){var t=(e.version||``).split(`.`).map(Number),n=Ec(t,2),r=n[0],i=n[1],a=r>=3,o=r===2&&i>=6,s=r===1&&i>=10;return a||o||s}function Hc(e){if(e)return typeof e==`number`?e.toString():e}function Uc(e,t,n){var r=Wa(t,t.mainIndex,t._initialUiState);e.forEach(function(e){var i={};if(e.getWidgetRenderState){var a=e.getWidgetRenderState(r);a&&a.widgetParams&&(i=a.widgetParams)}var o=Object.keys(i).filter(function(e){return i[e]!==void 0});n.widgets.push({type:e.$$type,widgetType:e.$$widgetType,params:o}),e.$$type===`ais.index`&&Uc(e.getWidgets(),t,n)})}function Wc(){return eo(function(e){var t,n,r=e.window;return((t=r.navigator)==null?void 0:(n=t.userAgent)?.indexOf(`Algolia Crawler`))>-1},{fallback:function(){return!1}})}function Gc(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.$$internal,n=t===void 0?!1:t;return function(e){var t=e.instantSearchInstance,r={widgets:[]},i=document.createElement(`meta`),a=document.querySelector(`head`);return i.name=`instantsearch:widgets`,{$$type:`ais.metadata`,$$internal:n,onStateChange:function(){},subscribe:function(){setTimeout(function(){var e=t.client;r.ua=e.transporter&&e.transporter.userAgent?e.transporter.userAgent.value:e._ua,Uc(t.mainIndex.getWidgets(),t,r),t.middleware.forEach(function(e){return r.widgets.push({middleware:!0,type:e.instance.$$type,internal:e.instance.$$internal})}),i.content=JSON.stringify(r),a.appendChild(i)},0)},started:function(){},unsubscribe:function(){i.remove()}}}}var Kc=c((exports,t)=>{var n=String.prototype.replace,r=/%20/g,i={RFC1738:`RFC1738`,RFC3986:`RFC3986`};t.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return n.call(e,r,`+`)},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}}),qc=c((exports,t)=>{var n=Kc(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e}(),o=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],a=0;a<n.length;++a)n[a]!==void 0&&r.push(n[a]);t.obj[t.prop]=r}}},s=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)e[r]!==void 0&&(n[r]=e[r]);return n},c=function e(t,n,a){if(!n)return t;if(typeof n!=`object`){if(i(t))t.push(n);else if(t&&typeof t==`object`)(a&&(a.plainObjects||a.allowPrototypes)||!r.call(Object.prototype,n))&&(t[n]=!0);else return[t,n];return t}if(!t||typeof t!=`object`)return[t].concat(n);var o=t;return i(t)&&!i(n)&&(o=s(t,a)),i(t)&&i(n)?(n.forEach(function(n,i){if(r.call(t,i)){var o=t[i];o&&typeof o==`object`&&n&&typeof n==`object`?t[i]=e(o,n,a):t.push(n)}else t[i]=n}),t):Object.keys(n).reduce(function(t,i){var o=n[i];return r.call(t,i)?t[i]=e(t[i],o,a):t[i]=o,t},o)},l=function(e,t){return Object.keys(t).reduce(function(e,n){return e[n]=t[n],e},e)},u=function(e,t,n){var r=e.replace(/\+/g,` `);if(n===`iso-8859-1`)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},d=function(e,t,r,i,o){if(e.length===0)return e;var s=e;if(typeof e==`symbol`?s=Symbol.prototype.toString.call(e):typeof e!=`string`&&(s=String(e)),r===`iso-8859-1`)return escape(s).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});for(var c=``,l=0;l<s.length;++l){var u=s.charCodeAt(l);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===n.RFC1738&&(u===40||u===41)){c+=s.charAt(l);continue}if(u<128){c+=a[u];continue}if(u<2048){c+=a[192|u>>6]+a[128|u&63];continue}if(u<55296||u>=57344){c+=a[224|u>>12]+a[128|u>>6&63]+a[128|u&63];continue}l+=1,u=65536+((u&1023)<<10|s.charCodeAt(l)&1023),c+=a[240|u>>18]+a[128|u>>12&63]+a[128|u>>6&63]+a[128|u&63]}return c},f=function(e){for(var t=[{obj:{o:e},prop:`o`}],n=[],r=0;r<t.length;++r)for(var i=t[r],a=i.obj[i.prop],s=Object.keys(a),c=0;c<s.length;++c){var l=s[c],u=a[l];typeof u==`object`&&u&&n.indexOf(u)===-1&&(t.push({obj:a,prop:l}),n.push(u))}return o(t),e},p=function(e){return Object.prototype.toString.call(e)===`[object RegExp]`},m=function(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},h=function(e,t){return[].concat(e,t)},g=function(e,t){if(i(e)){for(var n=[],r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)};t.exports={arrayToObject:s,assign:l,combine:h,compact:f,decode:u,encode:d,isBuffer:m,isRegExp:p,maybeMap:g,merge:c}}),Jc=c((exports,t)=>{var n=qc(),r=Kc(),i=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+`[]`},comma:`comma`,indices:function(e,t){return e+`[`+t+`]`},repeat:function(e){return e}},o=Array.isArray,s=String.prototype.split,c=Array.prototype.push,l=function(e,t){c.apply(e,o(t)?t:[t])},u=Date.prototype.toISOString,d=r.default,f={addQueryPrefix:!1,allowDots:!1,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:d,formatter:r.formatters[d],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},p=function(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`},m=function e(t,r,i,a,c,u,d,m,h,g,_,v,y,b){var x=t;if(typeof d==`function`?x=d(r,x):x instanceof Date?x=g(x):i===`comma`&&o(x)&&(x=n.maybeMap(x,function(e){return e instanceof Date?g(e):e})),x===null){if(a)return u&&!y?u(r,f.encoder,b,`key`,_):r;x=``}if(p(x)||n.isBuffer(x)){if(u){var S=y?r:u(r,f.encoder,b,`key`,_);if(i===`comma`&&y){for(var C=s.call(String(x),`,`),ee=``,te=0;te<C.length;++te)ee+=(te===0?``:`,`)+v(u(C[te],f.encoder,b,`value`,_));return[v(S)+`=`+ee]}return[v(S)+`=`+v(u(x,f.encoder,b,`value`,_))]}return[v(r)+`=`+v(String(x))]}var ne=[];if(x===void 0)return ne;var re;if(i===`comma`&&o(x))re=[{value:x.length>0?x.join(`,`)||null:void 0}];else if(o(d))re=d;else{var ie=Object.keys(x);re=m?ie.sort(m):ie}for(var ae=0;ae<re.length;++ae){var oe=re[ae],se=typeof oe==`object`&&oe.value!==void 0?oe.value:x[oe];if(!(c&&se===null)){var ce=o(x)?typeof i==`function`?i(r,oe):r:r+(h?`.`+oe:`[`+oe+`]`);l(ne,e(se,ce,i,a,c,u,d,m,h,g,_,v,y,b))}}return ne},h=function(e){if(!e)return f;if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);var t=e.charset||f.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);var n=r.default;if(e.format!==void 0){if(!i.call(r.formatters,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}var a=r.formatters[n],s=f.filter;return(typeof e.filter==`function`||o(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:f.addQueryPrefix,allowDots:e.allowDots===void 0?f.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:f.charsetSentinel,delimiter:e.delimiter===void 0?f.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:f.encode,encoder:typeof e.encoder==`function`?e.encoder:f.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:f.encodeValuesOnly,filter:s,format:n,formatter:a,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:f.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:f.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:f.strictNullHandling}};t.exports=function(e,t){var n=e,r=h(t),i,s;typeof r.filter==`function`?(s=r.filter,n=s(``,n)):o(r.filter)&&(s=r.filter,i=s);var c=[];if(typeof n!=`object`||!n)return``;var u;u=t&&t.arrayFormat in a?t.arrayFormat:t&&`indices`in t?t.indices?`indices`:`repeat`:`indices`;var d=a[u];i||=Object.keys(n),r.sort&&i.sort(r.sort);for(var f=0;f<i.length;++f){var p=i[f];r.skipNulls&&n[p]===null||l(c,m(n[p],p,d,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset))}var g=c.join(r.delimiter),_=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?_+=`utf8=%26%2310003%3B&`:_+=`utf8=%E2%9C%93&`),g.length>0?_+g:``}}),Yc=c((exports,t)=>{var n=qc(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:`utf-8`,charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:`&`,depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},o=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t){return e&&typeof e==`string`&&t.comma&&e.indexOf(`,`)>-1?e.split(`,`):e},c=`utf8=%26%2310003%3B`,l=`utf8=%E2%9C%93`,u=function(e,t){var u={},d=t.ignoreQueryPrefix?e.replace(/^\?/,``):e,f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=d.split(t.delimiter,f),m=-1,h,g=t.charset;if(t.charsetSentinel)for(h=0;h<p.length;++h)p[h].indexOf(`utf8=`)===0&&(p[h]===l?g=`utf-8`:p[h]===c&&(g=`iso-8859-1`),m=h,h=p.length);for(h=0;h<p.length;++h)if(h!==m){var _=p[h],v=_.indexOf(`]=`),y=v===-1?_.indexOf(`=`):v+1,b,x;y===-1?(b=t.decoder(_,a.decoder,g,`key`),x=t.strictNullHandling?null:``):(b=t.decoder(_.slice(0,y),a.decoder,g,`key`),x=n.maybeMap(s(_.slice(y+1),t),function(e){return t.decoder(e,a.decoder,g,`value`)})),x&&t.interpretNumericEntities&&g===`iso-8859-1`&&(x=o(x)),_.indexOf(`[]=`)>-1&&(x=i(x)?[x]:x),r.call(u,b)?u[b]=n.combine(u[b],x):u[b]=x}return u},d=function(e,t,n,r){for(var i=r?t:s(t,n),a=e.length-1;a>=0;--a){var o,c=e[a];if(c===`[]`&&n.parseArrays)o=[].concat(i);else{o=n.plainObjects?Object.create(null):{};var l=c.charAt(0)===`[`&&c.charAt(c.length-1)===`]`?c.slice(1,-1):c,u=parseInt(l,10);!n.parseArrays&&l===``?o={0:i}:!isNaN(u)&&c!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(o=[],o[u]=i):l!==`__proto__`&&(o[l]=i)}i=o}return i},f=function(e,t,n,i){if(e){var a=n.allowDots?e.replace(/\.([^.[]+)/g,`[$1]`):e,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,c=n.depth>0&&o.exec(a),l=c?a.slice(0,c.index):a,u=[];if(l){if(!n.plainObjects&&r.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var f=0;n.depth>0&&(c=s.exec(a))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&r.call(Object.prototype,c[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(c[1])}return c&&u.push(`[`+a.slice(c.index)+`]`),d(u,t,n,i)}},p=function(e){if(!e)return a;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!=`function`)throw TypeError(`Decoder has to be a function.`);if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);var t=e.charset===void 0?a.charset:e.charset;return{allowDots:e.allowDots===void 0?a.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes==`boolean`?e.allowPrototypes:a.allowPrototypes,arrayLimit:typeof e.arrayLimit==`number`?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:a.charsetSentinel,comma:typeof e.comma==`boolean`?e.comma:a.comma,decoder:typeof e.decoder==`function`?e.decoder:a.decoder,delimiter:typeof e.delimiter==`string`||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:typeof e.depth==`number`||e.depth===!1?+e.depth:a.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities==`boolean`?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:typeof e.parameterLimit==`number`?e.parameterLimit:a.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects==`boolean`?e.plainObjects:a.plainObjects,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:a.strictNullHandling}};t.exports=function(e,t){var r=p(t);if(e===``||e==null)return r.plainObjects?Object.create(null):{};for(var i=typeof e==`string`?u(e,r):e,a=r.plainObjects?Object.create(null):{},o=Object.keys(i),s=0;s<o.length;++s){var c=o[s],l=f(c,i[c],r,typeof e==`string`);a=n.merge(a,l,r)}return n.compact(a)}}),Xc=c((exports,t)=>{var n=Jc(),r=Yc(),i=Kc();t.exports={formats:i,parse:r,stringify:n}}),Zc=d(Xc());function Qc(e){"@babel/helpers - typeof";return Qc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Qc(e)}function $c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function el(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,rl(r.key),r)}}function tl(e,t,n){return t&&el(e.prototype,t),n&&el(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function nl(e,t,n){return t=rl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rl(e){var t=il(e,`string`);return Qc(t)==`symbol`?t:String(t)}function il(e,t){if(Qc(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Qc(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var al=function(e){e&&(window.document.title=e)},ol=function(){function e(t){var n=this,r=t.windowTitle,i=t.writeDelay,a=i===void 0?400:i,o=t.createURL,s=t.parseURL,c=t.getLocation,l=t.start,u=t.dispose,d=t.push,f=t.cleanUrlOnDispose;$c(this,e),nl(this,`$$type`,`ais.browser`),nl(this,`windowTitle`,void 0),nl(this,`writeDelay`,void 0),nl(this,`_createURL`,void 0),nl(this,`parseURL`,void 0),nl(this,`getLocation`,void 0),nl(this,`writeTimer`,void 0),nl(this,`_onPopState`,void 0),nl(this,`inPopState`,!1),nl(this,`isDisposed`,!1),nl(this,`latestAcknowledgedHistory`,0),nl(this,`_start`,void 0),nl(this,`_dispose`,void 0),nl(this,`_push`,void 0),nl(this,`_cleanUrlOnDispose`,void 0),this.windowTitle=r,this.writeTimer=void 0,this.writeDelay=a,this._createURL=o,this.parseURL=s,this.getLocation=c,this._start=l,this._dispose=u,this._push=d,this._cleanUrlOnDispose=f===void 0?!0:f,eo(function(e){var t=e.window,r=n.windowTitle&&n.windowTitle(n.read());al(r),n.latestAcknowledgedHistory=t.history.length})}return tl(e,[{key:`read`,value:function(){return this.parseURL({qsModule:Zc.default,location:this.getLocation()})}},{key:`write`,value:function(e){var t=this;eo(function(n){var r=n.window,i=t.createURL(e),a=t.windowTitle&&t.windowTitle(e);t.writeTimer&&clearTimeout(t.writeTimer),t.writeTimer=setTimeout(function(){al(a),t.shouldWrite(i)&&(t._push?t._push(i):r.history.pushState(e,a||``,i),t.latestAcknowledgedHistory=r.history.length),t.inPopState=!1,t.writeTimer=void 0},t.writeDelay)})}},{key:`onUpdate`,value:function(e){var t=this;this._start&&this._start(function(){e(t.read())}),this._onPopState=function(){t.writeTimer&&(clearTimeout(t.writeTimer),t.writeTimer=void 0),t.inPopState=!0,e(t.read())},eo(function(e){var n=e.window;n.addEventListener(`popstate`,t._onPopState)})}},{key:`createURL`,value:function(e){var t=this._createURL({qsModule:Zc.default,routeState:e,location:this.getLocation()});return t}},{key:`dispose`,value:function(){var e=this;this._dispose&&this._dispose(),this.isDisposed=!0,eo(function(t){var n=t.window;e._onPopState&&n.removeEventListener(`popstate`,e._onPopState)}),this.writeTimer&&clearTimeout(this.writeTimer),this._cleanUrlOnDispose&&this.write({})}},{key:`start`,value:function(){this.isDisposed=!1}},{key:`shouldWrite`,value:function(e){var t=this;return eo(function(n){var r=n.window;if(t.isDisposed&&!t._cleanUrlOnDispose)return!1;var i=!(t.isDisposed&&t.latestAcknowledgedHistory!==r.history.length);return!t.inPopState&&i&&e!==r.location.href})}}]),e}();function sl(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.createURL,n=t===void 0?function(e){var t=e.qsModule,n=e.routeState,r=e.location,i=r.protocol,a=r.hostname,o=r.port,s=o===void 0?``:o,c=r.pathname,l=r.hash,u=t.stringify(n),d=s===``?``:`:${s}`;return u?`${i}//${a}${d}${c}?${u}${l}`:`${i}//${a}${d}${c}${l}`}:t,r=e.parseURL,i=r===void 0?function(e){var t=e.qsModule,n=e.location;return t.parse(n.search.slice(1),{arrayLimit:99})}:r,a=e.writeDelay,o=a===void 0?400:a,s=e.windowTitle,c=e.getLocation,l=c===void 0?function(){return eo(function(e){var t=e.window;return t.location},{fallback:function(){throw Error("You need to provide `getLocation` to the `history` router in environments where `window` does not exist.")}})}:c,u=e.start,d=e.dispose,f=e.push,p=e.cleanUrlOnDispose;return new ol({createURL:n,parseURL:i,writeDelay:o,windowTitle:s,getLocation:l,start:u,dispose:d,push:f,cleanUrlOnDispose:p})}function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cl(e)}var ll=[`configure`];function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ul(Object(n),!0).forEach(function(t){fl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ul(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fl(e,t,n){return t=pl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pl(e){var t=ml(e,`string`);return cl(t)==`symbol`?t:String(t)}function ml(e,t){if(cl(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(cl(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hl(e,t){if(e==null)return{};var n=gl(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gl(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function _l(e){var t=e.configure,n=hl(e,ll);return n}function vl(){return{$$type:`ais.simple`,stateToRoute:function(e){return Object.keys(e).reduce(function(t,n){return dl(dl({},t),{},fl({},n,_l(e[n])))},{})},routeToState:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(e).reduce(function(t,n){return dl(dl({},t),{},fl({},n,_l(e[n])))},{})}}}function yl(e){"@babel/helpers - typeof";return yl=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},yl(e)}function bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?bl(Object(n),!0).forEach(function(t){Sl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Sl(e,t,n){return t=Cl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cl(e){var t=wl(e,`string`);return yl(t)==`symbol`?t:String(t)}function wl(e,t){if(yl(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(yl(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Tl=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.router,n=t===void 0?sl():t,r=e.stateMapping,i=r===void 0?vl():r,a=e.$$internal,o=a===void 0?!1:a;return function(e){var t=e.instantSearchInstance;function r(e){var r=t.mainIndex.getWidgets().length===0?t._initialUiState:t.mainIndex.getWidgetUiState({}),a=Object.keys(e).reduce(function(t,n){return xl(xl({},t),{},Sl({},n,e[n]))},r),o=i.stateToRoute(a);return n.createURL(o)}t._createURL=r;var a=void 0,s=t._initialUiState;return{$$type:`ais.router({router:${n.$$type||`__unknown__`}, stateMapping:${i.$$type||`__unknown__`}})`,$$internal:o,onStateChange:function(e){var t=e.uiState,r=i.stateToRoute(t);(a===void 0||!xa(a,r))&&(n.write(r),a=r)},subscribe:function(){t._initialUiState=xl(xl({},s),i.routeToState(n.read())),n.onUpdate(function(e){t.mainIndex.getWidgets().length>0&&t.setUiState(i.routeToState(e))})},started:function(){var e;(e=n.start)==null||e.call(n)},unsubscribe:function(){n.dispose()}}}};function El(e,t){return e.toLocaleString(t)}function Dl(e){"@babel/helpers - typeof";return Dl=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Dl(e)}function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ol(Object(n),!0).forEach(function(t){Al(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Al(e,t,n){return t=jl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jl(e){var t=Ml(e,`string`);return Dl(t)==`symbol`?t:String(t)}function Ml(e,t){if(Dl(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Dl(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Nl(e){var t=e.numberLocale;return{formatNumber:function(e,n){return El(Number(n(e)),t)},highlight:function(e,t){try{var n=JSON.parse(e);return t(ac(kl(kl({},n),{},{hit:this})))}catch{throw Error(`
The highlight helper expects a JSON object of the format:
{ "attribute": "name", "highlightedTagName": "mark" }`)}},reverseHighlight:function(e,t){try{var n=JSON.parse(e);return t(sc(kl(kl({},n),{},{hit:this})))}catch{throw Error(`
The reverseHighlight helper expects a JSON object of the format:
{ "attribute": "name", "highlightedTagName": "mark" }`)}},snippet:function(e,t){try{var n=JSON.parse(e);return t(lc(kl(kl({},n),{},{hit:this})))}catch{throw Error(`
The snippet helper expects a JSON object of the format:
{ "attribute": "name", "highlightedTagName": "mark" }`)}},reverseSnippet:function(e,t){try{var n=JSON.parse(e);return t(dc(kl(kl({},n),{},{hit:this})))}catch{throw Error(`
The reverseSnippet helper expects a JSON object of the format:
{ "attribute": "name", "highlightedTagName": "mark" }`)}},insights:function(e,t){try{var n=JSON.parse(e),r=n.method,i=n.payload;return t(mc(r,kl({objectIDs:[this.objectID]},i)))}catch{throw Error(`
The insights helper expects a JSON object of the format:
{ "method": "method-name", "payload": { "eventName": "name of the event" } }`)}}}}var Pl=`4.80.0`,Fl=d(nr()),Il=d(Ar());function Ll(e){"@babel/helpers - typeof";return Ll=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ll(e)}function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Rl(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bl(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Vl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Yl(r.key),r)}}function Hl(e,t,n){return t&&Vl(e.prototype,t),n&&Vl(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Ul(e,t){if(typeof t!=`function`&&t!==null)throw 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&&Wl(e,t)}function Wl(e,t){return Wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wl(e,t)}function Gl(e){var t=ql();return function(){var n=Jl(e),r;if(t){var i=Jl(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Kl(this,r)}}function Kl(e,t){if(t&&(Ll(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return O(e)}function O(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function ql(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jl(e){return Jl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Jl(e)}function k(e,t,n){return t=Yl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yl(e){var t=Xl(e,`string`);return Ll(t)==`symbol`?t:String(t)}function Xl(e,t){if(Ll(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ll(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Zl=Ai({name:`instantsearch`});function Ql(){return`#`}var $l={preserveSharedStateOnUnmount:!1,persistHierarchicalRootCount:!1},eu=function(e){Ul(n,e);var t=Gl(n);function n(e){var r,i;Bl(this,n),i=t.call(this),k(O(i),`client`,void 0),k(O(i),`indexName`,void 0),k(O(i),`compositionID`,void 0),k(O(i),`insightsClient`,void 0),k(O(i),`onStateChange`,null),k(O(i),`future`,void 0),k(O(i),`helper`,void 0),k(O(i),`mainHelper`,void 0),k(O(i),`mainIndex`,void 0),k(O(i),`started`,void 0),k(O(i),`templatesConfig`,void 0),k(O(i),`renderState`,{}),k(O(i),`_stalledSearchDelay`,void 0),k(O(i),`_searchStalledTimer`,void 0),k(O(i),`_initialUiState`,void 0),k(O(i),`_initialResults`,void 0),k(O(i),`_manuallyResetScheduleSearch`,!1),k(O(i),`_resetScheduleSearch`,void 0),k(O(i),`_createURL`,void 0),k(O(i),`_searchFunction`,void 0),k(O(i),`_mainHelperSearch`,void 0),k(O(i),`_hasSearchWidget`,!1),k(O(i),`_hasRecommendWidget`,!1),k(O(i),`_insights`,void 0),k(O(i),`middleware`,[]),k(O(i),`sendEventToInsights`,void 0),k(O(i),`status`,`idle`),k(O(i),`error`,void 0),k(O(i),`scheduleSearch`,Oi(function(){i.started&&i.mainHelper.search()})),k(O(i),`scheduleRender`,Oi(function(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;(e=i.mainHelper)!=null&&e.hasPendingRequests()||(clearTimeout(i._searchStalledTimer),i._searchStalledTimer=null,t&&(i.status=`idle`,i.error=void 0)),i.mainIndex.render({instantSearchInstance:O(i)}),i.emit(`render`)})),k(O(i),`onInternalStateChange`,Oi(function(){var e=i.mainIndex.getWidgetUiState({});i.middleware.forEach(function(t){var n=t.instance;n.onStateChange({uiState:e})})})),i.setMaxListeners(100);var a=e.indexName,o=a===void 0?``:a,s=e.compositionID,c=e.numberLocale,l=e.initialUiState,u=l===void 0?{}:l,d=e.routing,f=d===void 0?null:d,p=e.insights,m=p===void 0?void 0:p,h=e.searchFunction,g=e.stalledSearchDelay,_=g===void 0?200:g,v=e.searchClient,y=v===void 0?null:v,b=e.insightsClient,x=b===void 0?null:b,S=e.onStateChange,C=S===void 0?null:S,ee=e.future,te=ee===void 0?zl(zl({},$l),e.future||{}):ee;if(y===null)throw Error(Zl("The `searchClient` option is required."));if(typeof y.search!=`function`)throw Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/");if(typeof y.addAlgoliaAgent==`function`&&y.addAlgoliaAgent(`instantsearch.js (${Pl})`),x&&typeof x!=`function`)throw Error(Zl("The `insightsClient` option should be a function."));if(i.client=y,i.future=te,i.insightsClient=x,i.indexName=o,i.compositionID=s,i.helper=null,i.mainHelper=null,i.mainIndex=Ks({indexName:i.compositionID||i.indexName}),i.onStateChange=C,i.started=!1,i.templatesConfig={helpers:Nl({numberLocale:c}),compileOptions:{}},i._stalledSearchDelay=_,i._searchStalledTimer=null,i._createURL=Ql,i._initialUiState=u,i._initialResults=null,i._insights=m,h&&(i._searchFunction=h),i.sendEventToInsights=Nr,f){var ne=typeof f==`boolean`?{}:f;ne.$$internal=!0,i.use(Tl(ne))}if(m){var re=typeof m==`boolean`?{}:m;re.$$internal=!0,i.use(Rc(re))}return Wc()&&i.use(Gc({$$internal:!0})),i}return Hl(n,[{key:`_isSearchStalled`,get:function(){return this.status===`stalled`}},{key:`use`,value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.map(function(t){var n=zl({$$type:`__unknown__`,$$internal:!1,subscribe:Nr,started:Nr,unsubscribe:Nr,onStateChange:Nr},t({instantSearchInstance:e}));return e.middleware.push({creator:t,instance:n}),n});return this.started&&i.forEach(function(e){e.subscribe(),e.started()}),this}},{key:`unuse`,value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.middleware.filter(function(e){return t.includes(e.creator)}).forEach(function(e){return e.instance.unsubscribe()}),this.middleware=this.middleware.filter(function(e){return!t.includes(e.creator)}),this}},{key:`EXPERIMENTAL_use`,value:function(){return this.use.apply(this,arguments)}},{key:`addWidget`,value:function(e){return this.addWidgets([e])}},{key:`addWidgets`,value:function(e){if(!Array.isArray(e))throw Error(Zl("The `addWidgets` method expects an array of widgets. Please use `addWidget`."));if(this.compositionID&&e.some(function(e){return!Array.isArray(e)&&Ti(e)&&!e._isolated}))throw Error(Zl("The `index` widget cannot be used with a composition-based InstantSearch implementation."));return this.mainIndex.addWidgets(e),this}},{key:`removeWidget`,value:function(e){return this.removeWidgets([e])}},{key:`removeWidgets`,value:function(e){if(!Array.isArray(e))throw Error(Zl("The `removeWidgets` method expects an array of widgets. Please use `removeWidget`."));return this.mainIndex.removeWidgets(e),this}},{key:`start`,value:function(){var e=this;if(this.started)throw Error(Zl("The `start` method has already been called once."));var t=this.mainHelper||(0,Il.default)(this.client,this.indexName,void 0,{persistHierarchicalRootCount:this.future.persistHierarchicalRootCount});if(this.compositionID&&(t.searchForFacetValues=t.searchForCompositionFacetValues.bind(t)),t.search=function(){return e.status=`loading`,e.scheduleRender(!1),e._hasSearchWidget&&(e.compositionID?t.searchWithComposition():t.searchOnlyWithDerivedHelpers()),e._hasRecommendWidget&&t.recommend(),t},this._searchFunction){var n={search:function(){return new Promise(Nr)}};this._mainHelperSearch=t.search.bind(t),t.search=function(){var r=e.mainIndex.getHelper(),i=(0,Il.default)(n,r.state.index,r.state);return i.once(`search`,function(t){var n=t.state;r.overrideStateWithoutTriggeringChangeEvent(n),e._mainHelperSearch()}),i.on(`change`,function(e){var t=e.state;r.setState(t)}),e._searchFunction(i),t}}if(t.on(`error`,function(t){var n=t.error;if(!(n instanceof Error)){var r=n;n=Object.keys(r).reduce(function(e,t){return e[t]=r[t],e},Error(r.message))}n.error=n,e.error=n,e.status=`error`,e.scheduleRender(!1),e.emit(`error`,n)}),this.mainHelper=t,this.middleware.forEach(function(e){var t=e.instance;t.subscribe()}),this.mainIndex.init({instantSearchInstance:this,parent:null,uiState:this._initialUiState}),this._initialResults){_a(this.client,this._initialResults),ia(this.mainHelper,this._initialResults);var r=this.scheduleSearch;this.scheduleSearch=Oi(Nr),this._manuallyResetScheduleSearch?this._resetScheduleSearch=function(){e.scheduleSearch=r}:Oi(function(){e.scheduleSearch=r})()}else this.mainIndex.getWidgets().length>0&&this.scheduleSearch();this.helper=this.mainIndex.getHelper(),this.started=!0,this.middleware.forEach(function(e){var t=e.instance;t.started()}),this._insights===void 0&&t.derivedHelpers[0].once(`result`,function(){var t=e.mainIndex.getScopedResults().some(function(e){var t=e.results;return t?._automaticInsights});t&&e.use(Rc({$$internal:!0,$$automatic:!0}))})}},{key:`dispose`,value:function(){var e;this.scheduleSearch.cancel(),this.scheduleRender.cancel(),clearTimeout(this._searchStalledTimer),this.removeWidgets(this.mainIndex.getWidgets()),this.mainIndex.dispose(),this.started=!1,this.removeAllListeners(),(e=this.mainHelper)==null||e.removeAllListeners(),this.mainHelper=null,this.helper=null,this.middleware.forEach(function(e){var t=e.instance;t.unsubscribe()})}},{key:`scheduleStalledRender`,value:function(){var e=this;this._searchStalledTimer||=setTimeout(function(){e.status=`stalled`,e.scheduleRender()},this._stalledSearchDelay)}},{key:`setUiState`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!this.mainHelper)throw Error(Zl("The `start` method needs to be called before `setUiState`."));this.mainIndex.refreshUiState();var r=typeof e==`function`?e(this.mainIndex.getWidgetUiState({})):e;this.onStateChange&&n?this.onStateChange({uiState:r,setUiState:function(e){Ei(typeof e==`function`?e(r):e,t.mainIndex),t.scheduleSearch(),t.onInternalStateChange()}}):(Ei(r,this.mainIndex),this.scheduleSearch(),this.onInternalStateChange())}},{key:`getUiState`,value:function(){return this.started&&this.mainIndex.refreshUiState(),this.mainIndex.getWidgetUiState({})}},{key:`createURL`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.started)throw Error(Zl("The `start` method needs to be called before `createURL`."));return this._createURL(e)}},{key:`refresh`,value:function(){if(!this.mainHelper)throw Error(Zl("The `start` method needs to be called before `refresh`."));this.mainHelper.clearCache().search()}}]),n}(Fl.default),tu=eu,nu=c(exports=>{var t=(D(),f(Yt));function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;exports.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore}),ru=c((exports,t)=>{t.exports=nu()});D();var iu=d(ru(),1);function au(e){"@babel/helpers - typeof";return au=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},au(e)}function ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ou(Object(n),!0).forEach(function(t){cu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cu(e,t,n){return t=lu(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lu(e){var t=uu(e,`string`);return au(t)==`symbol`?t:String(t)}function uu(e,t){if(au(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(au(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var du=[`react (${Yn})`,`react-instantsearch (${tr})`,`react-instantsearch-core (${tr})`],fu=`react-instantsearch-server (${tr})`,pu=function(e){return e?`next.js (${e})`:null};function mu(e){var t=tc(),n=jo(),r=No(),i=Go(),a=i.waitForResultsRef,o=r?.initialResults,s=bt(e),c=n||o||a,l=bt(null);if(r!=null&&r.ssrSearchRef&&(l=r.ssrSearchRef),l.current===null){var u=new tu(e);u._schedule=function(e){u._schedule.queue.push(e),clearTimeout(u._schedule.timer),u._schedule.timer=setTimeout(function(){u._schedule.queue.forEach(function(e){e()}),u._schedule.queue=[]},0)},u._schedule.queue=[],c&&(u._initialResults=o||{},u._manuallyResetScheduleSearch=!0),hu(e.searchClient,[].concat(du,[n&&fu,pu(vu())])),c&&u.start(),n&&n.notifyServer({search:u}),gu(e.routing),_u(!!a),l.current=u}var d=l.current,f=s.current;if(f.indexName!==e.indexName&&(d.helper.setIndex(e.indexName||``).search(),s.current=e),f.searchClient!==e.searchClient&&(hu(e.searchClient,[].concat(du,[n&&fu])),d.mainHelper.setClient(e.searchClient).search(),s.current=e),f.onStateChange!==e.onStateChange&&(d.onStateChange=e.onStateChange,s.current=e),f.searchFunction!==e.searchFunction&&(d._searchFunction=e.searchFunction,s.current=e),f.stalledSearchDelay!==e.stalledSearchDelay){var p;d._stalledSearchDelay=(p=e.stalledSearchDelay)??200,s.current=e}ho(f.future,e.future)||(d.future=su(su({},$l),e.future),s.current=e);var m=bt(null),h=(0,iu.useSyncExternalStore)(Ct(function(){var e=l.current;return m.current===null?e.started||(e.start(),t()):(clearTimeout(m.current),e._preventWidgetCleanup=!1),function(){if(r!=null&&r.ssrSearchRef)return;function t(){e.dispose()}clearTimeout(e._schedule.timer),m.current=setTimeout(t),e._preventWidgetCleanup=!0}},[t,r]),function(){return l.current},function(){return l.current});return h}function hu(e,t){typeof e.addAlgoliaAgent==`function`&&t.filter(Boolean).forEach(function(t){e.addAlgoliaAgent(t)})}function gu(e){if(0)var t,n}function _u(e){var t}function vu(){var e,t;return typeof window<`u`&&(e=window.next)?.version||(typeof process<`u`?(t=process.env)?.NEXT_RUNTIME:void 0)}D();var yu=[`children`];function bu(e,t){if(e==null)return{};var n=xu(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xu(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Su(e){var t=e.children,n=bu(e,yu),r=mu(n);return r.started?er.createElement(Oo.Provider,{value:r},er.createElement(To.Provider,{value:r.mainIndex},t,er.createElement(Cu,{search:r}))):null}function Cu(e){var t=e.search;return E(function(){t._resetScheduleSearch&&t._resetScheduleSearch()},[t]),null}function wu(e){"@babel/helpers - typeof";return wu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wu(e)}function Tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Tu(Object(n),!0).forEach(function(t){Du(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Du(e,t,n){return t=Ou(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ou(e){var t=ku(e,`string`);return wu(t)==`symbol`?t:String(t)}function ku(e,t){if(wu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(wu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Au=Ai({name:`hits`,connector:!0}),ju=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nr;return Fr(e,Au()),function(n){var r=n||{},i=r.escapeHTML,a=i===void 0?!0:i,o=r.transformItems,s=o===void 0?function(e){return e}:o,c,l;return{$$type:`ais.hits`,init:function(t){e(Eu(Eu({},this.getWidgetRenderState(t)),{},{instantSearchInstance:t.instantSearchInstance}),!0)},render:function(t){var n=this.getWidgetRenderState(t);e(Eu(Eu({},n),{},{instantSearchInstance:t.instantSearchInstance}),!1),n.sendEvent(`view:internal`,n.items)},getRenderState:function(e,t){return Eu(Eu({},e),{},{hits:this.getWidgetRenderState(t)})},getWidgetRenderState:function(e){var t,r,i,o=e.results,u=e.helper,d=e.instantSearchInstance;if(c||=Ci({instantSearchInstance:d,helper:u,widgetType:this.$$type}),l||=wi({helper:u,widgetType:this.$$type,instantSearchInstance:d}),!o)return{hits:[],items:[],results:void 0,banner:void 0,sendEvent:c,bindEvent:l,widgetParams:n};a&&o.hits.length>0&&(o.hits=oi(o.hits));var f=Wi(o.hits,o.page,o.hitsPerPage),p=Zi(f,o.queryID),m=s(p,{results:o}),h=(t=o.renderingContent)==null||(r=t.widgets)==null?void 0:(i=r.banners)?.[0];return{hits:m,items:m,results:o,banner:h,sendEvent:c,bindEvent:l,widgetParams:n}},dispose:function(e){var n=e.state;return t(),a?n.setQueryParameters(Object.keys(ni).reduce(function(e,t){return Eu(Eu({},e),{},Du({},t,void 0))},{})):n},getWidgetSearchParameters:function(e,t){return a?e.setQueryParameters(ni):e}}}};function Mu(e,t){return fs(ju,e,t)}function Nu(e){"@babel/helpers - typeof";return Nu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Nu(e)}function Pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Pu(Object(n),!0).forEach(function(t){Iu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Iu(e,t,n){return t=Lu(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lu(e){var t=Ru(e,`string`);return Nu(t)==`symbol`?t:String(t)}function Ru(e,t){if(Nu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Nu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var zu=Ai({name:`search-box`,connector:!0}),Bu=function(e,t){return t(e)},Vu=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nr;return Fr(e,zu()),function(n){var r=n||{},i=r.queryHook,a=i===void 0?Bu:i,o,s;return{$$type:`ais.searchBox`,init:function(t){var n=t.instantSearchInstance;e(Fu(Fu({},this.getWidgetRenderState(t)),{},{instantSearchInstance:n}),!0)},render:function(t){var n=t.instantSearchInstance;e(Fu(Fu({},this.getWidgetRenderState(t)),{},{instantSearchInstance:n}),!1)},dispose:function(e){var n=e.state;return t(),n.setQueryParameter(`query`,void 0)},getRenderState:function(e,t){return Fu(Fu({},e),{},{searchBox:this.getWidgetRenderState(t)})},getWidgetRenderState:function(e){var t=e.helper,r=e.instantSearchInstance,i=e.state;return o||(o=function(e){a(e,function(e){return t.setQuery(e).search()})},s=function(){t.setQuery(``).search()}),{query:i.query||``,refine:o,clear:s,widgetParams:n,isSearchStalled:r.status===`stalled`}},getWidgetUiState:function(e,t){var n=t.searchParameters,r=n.query||``;return r===``||e&&e.query===r?e:Fu(Fu({},e),{},{query:r})},getWidgetSearchParameters:function(e,t){var n=t.uiState;return e.setQueryParameter(`query`,n.query||``)}}}},Hu=Vu;function Uu(e,t){return fs(Hu,e,t)}D();function Wu(e,t){return Yu(e)||Ju(e,t)||Ku(e,t)||Gu()}function Gu(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ku(e,t){if(e){if(typeof e==`string`)return qu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qu(e,t)}}function qu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ju(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Yu(e){if(Array.isArray(e))return e}function Xu(){var e=ko(),t=Do(),n=T(function(){var e=wo(t);return{results:e.results,scopedResults:e.scopedResults}}),r=Wu(n,2),i=r[0],a=r[1];return E(function(){function n(){var n=t.getResults();if(n!==null)a({results:n,scopedResults:t.getScopedResults()});else if(e.mainIndex.getIndexName().length===0){var r=e.mainIndex.getWidgets().find(Ti);r&&a({results:wo(t).results,scopedResults:r.getScopedResults()})}}return e.addListener(`render`,n),n(),function(){e.removeListener(`render`,n)}},[e,t]),i}D();function Zu(e,t){return nd(e)||td(e,t)||$u(e,t)||Qu()}function Qu(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $u(e,t){if(e){if(typeof e==`string`)return ed(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ed(e,t)}}function ed(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function td(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function nd(e){if(Array.isArray(e))return e}function rd(){var e=ko(),t=Do(),n=t.getIndexId(),r=T(function(){return e.getUiState()}),i=Zu(r,2),a=i[0],o=i[1],s=a[n],c=T(function(){return e.renderState}),l=Zu(c,2),u=l[0],d=l[1],f=u[n]||{},p=Ct(function(t){e.setUiState(t)},[e]),m=Ct(function(e){t.setIndexUiState(e)},[t]);return E(function(){function t(){o(e.getUiState()),d(e.renderState)}return e.addListener(`render`,t),t(),function(){e.removeListener(`render`,t)}},[e]),{uiState:a,setUiState:p,indexUiState:s,setIndexUiState:m,renderState:u,indexRenderState:f}}D();function id(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.catchError,n=ko(),r=rd(),i=r.uiState,a=r.setUiState,o=r.indexUiState,s=r.setIndexUiState,c=r.renderState,l=r.indexRenderState,u=Xu(),d=u.results,f=u.scopedResults,p=Ct(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.use.apply(n,t),function(){n.unuse.apply(n,t)}},[n]),m=Ct(function(){n.refresh()},[n]);return Uo(function(){if(t){var e=function(){};return n.addListener(`error`,e),function(){return n.removeListener(`error`,e)}}return function(){}},[n,t]),{results:d,scopedResults:f,uiState:i,setUiState:a,indexUiState:o,setIndexUiState:s,renderState:c,indexRenderState:l,addMiddlewares:p,refresh:m,status:n.status,error:n.error}}function ad(){return ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ad.apply(null,arguments)}function od(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function sd(e,t){if(e==null)return{};var n,r,i=od(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function cd(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return Array.isArray(t)?e.concat(t):e.concat([t])},[]).filter(Boolean).join(` `)}var ld=[`parts`,`highlightedTagName`,`nonHighlightedTagName`,`separator`,`className`,`classNames`];function ud(e){var t=e.createElement;return function(e){var n=e.classNames,r=e.children,i=e.highlightedTagName,a=e.isHighlighted,o=e.nonHighlightedTagName,s=a?i:o;return t(s,{className:a?n.highlighted:n.nonHighlighted},r)}}function dd(e){var t=e.createElement,n=e.Fragment,r=ud({createElement:t,Fragment:n});return function(e){var i=e.parts,a=e.highlightedTagName,o=a===void 0?`mark`:a,s=e.nonHighlightedTagName,c=s===void 0?`span`:s,l=e.separator,u=l===void 0?`, `:l,d=e.className,f=e.classNames,p=f===void 0?{}:f,m=sd(e,ld);return t(`span`,ad({},m,{className:cd(p.root,d)}),i.map(function(e,a){var s=a===i.length-1;return t(n,{key:a},e.map(function(e,n){return t(r,{key:n,classNames:p,highlightedTagName:o,nonHighlightedTagName:c,isHighlighted:e.isHighlighted},e.value)}),!s&&t(`span`,{className:p.separator},u))}))}}D();var fd=dd({createElement:h,Fragment:v});D();var pd=[`classNames`];function md(){return md=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},md.apply(this,arguments)}function hd(e,t){if(e==null)return{};var n=gd(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gd(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function _d(e){var t=e.classNames,n=t===void 0?{}:t,r=hd(e,pd);return er.createElement(fd,md({classNames:{root:cd(`ais-Highlight`,n.root),highlighted:cd(`ais-Highlight-highlighted`,n.highlighted),nonHighlighted:cd(`ais-Highlight-nonHighlighted`,n.nonHighlighted),separator:cd(`ais-Highlight-separator`,n.separator)}},r))}D();var vd=[`hit`,`attribute`,`highlightedTagName`,`nonHighlightedTagName`,`separator`];function yd(){return yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yd.apply(this,arguments)}function bd(e,t){if(e==null)return{};var n=xd(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xd(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Sd(e){var t=e.hit,n=e.attribute,r=e.highlightedTagName,i=e.nonHighlightedTagName,a=e.separator,o=bd(e,vd),s=Li(t._highlightResult,n)||[],c=Array.isArray(s)?s:[s],l=c.map(function(e){return Pi(Ur(e.value||``))});return er.createElement(_d,yd({},o,{parts:l,highlightedTagName:r,nonHighlightedTagName:i,separator:a}))}var Cd=`vercel.ai.error`,wd=Symbol.for(Cd),Td,Ed=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Td]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Cd)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Td=wd;var Dd=Ed,Od=`AI_APICallError`,kd=`vercel.ai.error.${Od}`,Ad=Symbol.for(kd),jd;jd=Ad;var Md=`AI_EmptyResponseBodyError`,Nd=`vercel.ai.error.${Md}`,Pd=Symbol.for(Nd),Fd;Fd=Pd;function Id(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Ld=`AI_InvalidArgumentError`,Rd=`vercel.ai.error.${Ld}`,zd=Symbol.for(Rd),Bd,Vd=class extends Dd{constructor({message:e,cause:t,argument:n}){super({name:Ld,message:e,cause:t}),this[Bd]=!0,this.argument=n}static isInstance(e){return Dd.hasMarker(e,Rd)}};Bd=zd;var Hd=`AI_InvalidPromptError`,Ud=`vercel.ai.error.${Hd}`,Wd=Symbol.for(Ud),Gd;Gd=Wd;var Kd=`AI_InvalidResponseDataError`,qd=`vercel.ai.error.${Kd}`,Jd=Symbol.for(qd),Yd;Yd=Jd;var Xd=`AI_JSONParseError`,Zd=`vercel.ai.error.${Xd}`,Qd=Symbol.for(Zd),$d,ef=class extends Dd{constructor({text:e,cause:t}){super({name:Xd,message:`JSON parsing failed: Text: ${e}.
Error message: ${Id(t)}`,cause:t}),this[$d]=!0,this.text=e}static isInstance(e){return Dd.hasMarker(e,Zd)}};$d=Qd;var tf=`AI_LoadAPIKeyError`,nf=`vercel.ai.error.${tf}`,rf=Symbol.for(nf),af;af=rf;var sf=`AI_LoadSettingError`,cf=`vercel.ai.error.${sf}`,lf=Symbol.for(cf),uf;uf=lf;var df=`AI_NoContentGeneratedError`,ff=`vercel.ai.error.${df}`,pf=Symbol.for(ff),mf;mf=pf;var hf=`AI_NoSuchModelError`,gf=`vercel.ai.error.${hf}`,_f=Symbol.for(gf),vf;vf=_f;var yf=`AI_TooManyEmbeddingValuesForCallError`,bf=`vercel.ai.error.${yf}`,xf=Symbol.for(bf),Sf;Sf=xf;var Cf=`AI_TypeValidationError`,wf=`vercel.ai.error.${Cf}`,Tf=Symbol.for(wf),Ef,Df=class e extends Dd{constructor({value:e,cause:t}){super({name:Cf,message:`Type validation failed: Value: ${JSON.stringify(e)}.
Error message: ${Id(t)}`,cause:t}),this[Ef]=!0,this.value=e}static isInstance(e){return Dd.hasMarker(e,wf)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};Ef=Tf;var Of=Df,kf=`AI_UnsupportedFunctionalityError`,Af=`vercel.ai.error.${kf}`,jf=Symbol.for(Af),Mf;Mf=jf;var Nf=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Pf(e){}function Ff(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=Pf,onError:n=Pf,onRetry:r=Pf,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=If(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1,i=e.slice(t+r);f(n,i,e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
`;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new Nf(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Nf(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
`)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function If(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
`,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
`&&r++}}return[t,n]}var Lf=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Ff({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};let Rf=Object.freeze({status:`aborted`});function A(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}let zf=Symbol(`zod_brand`);var Bf=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let Vf={};function Hf(e){return e&&Object.assign(Vf,e),Vf}function Uf(e){let t=Object.values(e).filter(e=>typeof e==`number`),n=Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t);return n}function Wf(e,t){return typeof t==`bigint`?t.toString():t}function Gf(e){let t=!1;return{get value(){if(!t){let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Kf(e){return e==null}function qf(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Jf(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r,a=Number.parseInt(e.toFixed(i).replace(`.`,``)),o=Number.parseInt(t.toFixed(i).replace(`.`,``));return a%o/10**i}function j(e,t,n){let r=!1;Object.defineProperty(e,t,{get(){if(!r){let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Yf(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xf(e){return JSON.stringify(e)}let Zf=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Qf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let $f=Gf(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{let e=Function;return new e(``),!0}catch{return!1}});function ep(e){if(Qf(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Qf(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let tp=new Set([`string`,`number`,`symbol`]);function np(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function rp(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ip(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let ap={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function op(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);if(!t[e])continue;n[e]=r.shape[e]}return rp(e,{...e._zod.def,shape:n,checks:[]})}function sp(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);if(!t[e])continue;delete n[e]}return rp(e,{...e._zod.def,shape:n,checks:[]})}function cp(e,t){if(!ep(t))throw Error(`Invalid input to extend: expected a plain object`);let n={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Yf(this,`shape`,n),n},checks:[]};return rp(e,n)}function lp(e,t){return rp(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Yf(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function up(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);if(!n[t])continue;i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t]}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return rp(t,{...t._zod.def,shape:i,checks:[]})}function dp(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);if(!n[t])continue;i[t]=new e({type:`nonoptional`,innerType:r[t]})}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return rp(t,{...t._zod.def,shape:i,checks:[]})}function fp(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function pp(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function mp(e){return typeof e==`string`?e:e?.message}function hp(e,t,n){let r={...e,path:e.path??[]};if(!e.message){let i=mp(e.inst?._zod.def?.error?.(e))??mp(t?.error?.(e))??mp(n.customError?.(e))??mp(n.localeError?.(e))??`Invalid input`;r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function gp(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function _p(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let vp=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),Object.defineProperty(e,`message`,{get(){return JSON.stringify(t,Wf,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},yp=A(`$ZodError`,vp),bp=A(`$ZodError`,vp,{Parent:Error});function xp(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Sp(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i],a=i===t.path.length-1;a?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}let Cp=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Bf;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>hp(e,a,Hf())));throw Zf(t,i?.callee),t}return o.value},wp=Cp(bp),Tp=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>hp(e,a,Hf())));throw Zf(t,i?.callee),t}return o.value},Ep=Tp(bp),Dp=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Bf;return a.issues.length?{success:!1,error:new(e??yp)(a.issues.map(e=>hp(e,i,Hf())))}:{success:!0,data:a.value}},Op=Dp(bp),kp=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>hp(e,i,Hf())))}:{success:!0,data:a.value}},Ap=kp(bp),jp=/^[cC][^\s-]{8,}$/,Mp=/^[0-9a-z]+$/,Np=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pp=/^[0-9a-vA-V]{20}$/,Fp=/^[A-Za-z0-9]{27}$/,Ip=/^[a-zA-Z0-9_-]{21}$/,Lp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zp=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Bp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vp=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Hp(){return new RegExp(Vp,`u`)}let Up=/^(?:(?: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])$/,Wp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Gp=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Kp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jp=/^[A-Za-z0-9_-]*$/,Yp=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Xp=/^\+(?:[0-9]){6,14}[0-9]$/,Zp=`(?:(?:\\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])))`,Qp=RegExp(`^${Zp}$`);function $p(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`,n=typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;return n}function em(e){return RegExp(`^${$p(e)}$`)}function tm(e){let t=$p({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Zp}T(?:${r})$`)}let nm=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},rm=/^\d+$/,im=/^-?\d+(?:\.\d+)?/i,am=/true|false/i,om=/null/i,sm=/^[^A-Z]*$/,cm=/^[^a-z]*$/,lm=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),um={number:`number`,bigint:`bigint`,object:`date`},dm=A(`$ZodCheckLessThan`,(e,t)=>{lm.init(e,t);let n=um[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fm=A(`$ZodCheckGreaterThan`,(e,t)=>{lm.init(e,t);let n=um[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pm=A(`$ZodCheckMultipleOf`,(e,t)=>{lm.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);let r=typeof n.value==`bigint`?n.value%t.value===BigInt(0):Jf(n.value,t.value)===0;r||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),mm=A(`$ZodCheckNumberFormat`,(e,t)=>{lm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ap[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=rm)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),hm=A(`$ZodCheckMaxLength`,(e,t)=>{var n;lm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Kf(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if(i<=t.maximum)return;let a=gp(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gm=A(`$ZodCheckMinLength`,(e,t)=>{var n;lm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Kf(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if(i>=t.minimum)return;let a=gp(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_m=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;lm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Kf(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=gp(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vm=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;lm.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ym=A(`$ZodCheckRegex`,(e,t)=>{vm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bm=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=sm,vm.init(e,t)}),xm=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=cm,vm.init(e,t)}),Sm=A(`$ZodCheckIncludes`,(e,t)=>{lm.init(e,t);let n=np(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Cm=A(`$ZodCheckStartsWith`,(e,t)=>{lm.init(e,t);let n=RegExp(`^${np(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wm=A(`$ZodCheckEndsWith`,(e,t)=>{lm.init(e,t);let n=RegExp(`.*${np(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Tm=A(`$ZodCheckOverwrite`,(e,t)=>{lm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Em=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e,n=t.split(`
`).filter(e=>e),r=Math.min(...n.map(e=>e.length-e.trimStart().length)),i=n.map(e=>e.slice(r)).map(e=>` `.repeat(this.indent*2)+e);for(let e of i)this.content.push(e)}compile(){let e=Function,t=this?.args,n=this?.content??[``],r=[...n.map(e=>` ${e}`)];return new e(...t,r.join(`
`))}};let Dm={major:4,minor:0,patch:0},N=A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dm;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=fp(e),i;for(let a of t){if(a._zod.def.when){let t=a._zod.def.when(e);if(!t)continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Bf;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o;let n=e.issues.length;n!==t&&(r||=fp(e,t))});else{let n=e.issues.length;if(n===t)continue;r||=fp(e,t)}}return i?i.then(()=>e):e};e._zod.run=(n,i)=>{let a=e._zod.parse(n,i);if(a instanceof Promise){if(i.async===!1)throw new Bf;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e[`~standard`]={validate:t=>{try{let n=Op(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ap(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),Om=A(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??nm(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),km=A(`$ZodStringFormat`,(e,t)=>{vm.init(e,t),Om.init(e,t)}),Am=A(`$ZodGUID`,(e,t)=>{t.pattern??=Rp,km.init(e,t)}),jm=A(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8},n=e[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=zp(n)}else t.pattern??=zp();km.init(e,t)}),Mm=A(`$ZodEmail`,(e,t)=>{t.pattern??=Bp,km.init(e,t)}),Nm=A(`$ZodURL`,(e,t)=>{km.init(e,t),e._zod.check=n=>{try{let r=n.value,i=new URL(r),a=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:Yp.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith(`/`)&&a.endsWith(`/`)?n.value=a.slice(0,-1):n.value=a;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Pm=A(`$ZodEmoji`,(e,t)=>{t.pattern??=Hp(),km.init(e,t)}),Fm=A(`$ZodNanoID`,(e,t)=>{t.pattern??=Ip,km.init(e,t)}),Im=A(`$ZodCUID`,(e,t)=>{t.pattern??=jp,km.init(e,t)}),Lm=A(`$ZodCUID2`,(e,t)=>{t.pattern??=Mp,km.init(e,t)}),Rm=A(`$ZodULID`,(e,t)=>{t.pattern??=Np,km.init(e,t)}),zm=A(`$ZodXID`,(e,t)=>{t.pattern??=Pp,km.init(e,t)}),Bm=A(`$ZodKSUID`,(e,t)=>{t.pattern??=Fp,km.init(e,t)}),Vm=A(`$ZodISODateTime`,(e,t)=>{t.pattern??=tm(t),km.init(e,t)}),Hm=A(`$ZodISODate`,(e,t)=>{t.pattern??=Qp,km.init(e,t)}),Um=A(`$ZodISOTime`,(e,t)=>{t.pattern??=em(t),km.init(e,t)}),Wm=A(`$ZodISODuration`,(e,t)=>{t.pattern??=Lp,km.init(e,t)}),Gm=A(`$ZodIPv4`,(e,t)=>{t.pattern??=Up,km.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),Km=A(`$ZodIPv6`,(e,t)=>{t.pattern??=Wp,km.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),qm=A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Gp,km.init(e,t)}),Jm=A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Kp,km.init(e,t),e._zod.check=n=>{let[r,i]=n.value.split(`/`);try{if(!i)throw Error();let e=Number(i);if(`${e}`!==i||e<0||e>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ym(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Xm=A(`$ZodBase64`,(e,t)=>{t.pattern??=qp,km.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{Ym(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Zm(e){if(!Jp.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return Ym(n)}let Qm=A(`$ZodBase64URL`,(e,t)=>{t.pattern??=Jp,km.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{Zm(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),$m=A(`$ZodE164`,(e,t)=>{t.pattern??=Xp,km.init(e,t)});function eh(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let th=A(`$ZodJWT`,(e,t)=>{km.init(e,t),e._zod.check=n=>{eh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),nh=A(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??im,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),rh=A(`$ZodNumber`,(e,t)=>{mm.init(e,t),nh.init(e,t)}),ih=A(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=am,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ah=A(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=om,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),oh=A(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),sh=A(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ch(e,t,n){e.issues.length&&t.issues.push(...pp(n,e.issues)),t.value[n]=e.value}let lh=A(`$ZodArray`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>ch(t,n,e))):ch(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function uh(e,t,n){e.issues.length&&t.issues.push(...pp(n,e.issues)),t.value[n]=e.value}function dh(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...pp(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}let fh=A(`$ZodObject`,(e,t)=>{N.init(e,t);let n=Gf(()=>{let e=Object.keys(t.shape);for(let n of e)if(!(t.shape[n]instanceof N))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ip(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=e=>{let t=new Em([`shape`,`payload`,`ctx`]),r=n.value,i=e=>{let t=Xf(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of r.keys)a[e]=`key_${o++}`;t.write(`const newResult = {}`);for(let e of r.keys)if(r.optionalKeys.has(e)){let n=a[e];t.write(`const ${n} = ${i(e)};`);let r=Xf(e);t.write(`
if (${n}.issues.length) {
if (input[${r}] === undefined) {
if (${r} in input) {
newResult[${r}] = undefined;
}
} else {
payload.issues = payload.issues.concat(
${n}.issues.map((iss) => ({
...iss,
path: iss.path ? [${r}, ...iss.path] : [${r}],
}))
);
}
} else if (${n}.value === undefined) {
if (${r} in input) newResult[${r}] = undefined;
} else {
newResult[${r}] = ${n}.value;
}
`)}else{let n=a[e];t.write(`const ${n} = ${i(e)};`),t.write(`
if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
...iss,
path: iss.path ? [${Xf(e)}, ...iss.path] : [${Xf(e)}]
})));`),t.write(`newResult[${Xf(e)}] = ${n}.value`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},i,a=Qf,o=!Vf.jitless,s=$f,c=o&&s.value,l=t.catchall,u;e._zod.parse=(s,d)=>{u??=n.value;let f=s.value;if(!a(f))return s.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),s;let p=[];if(o&&c&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),s=i(s,d);else{s.value={};let e=u.shape;for(let t of u.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?dh(e,s,t,f):uh(e,s,t))):i?dh(r,s,t,f):uh(r,s,t)}}if(!l)return p.length?Promise.all(p).then(()=>s):s;let m=[],h=u.keySet,g=l._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>uh(t,s,e))):uh(t,s,e)}return m.length&&s.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>s):s}});function ph(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>hp(e,r,Hf())))}),t}let mh=A(`$ZodUnion`,(e,t)=>{N.init(e,t),j(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),j(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),j(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>qf(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>ph(t,n,e,r)):ph(a,n,e,r)}}),hh=A(`$ZodDiscriminatedUnion`,(e,t)=>{mh.init(e,t);let n=e._zod.parse;j(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Gf(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Qf(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,input:o,path:[t.discriminator],inst:e}),i)}}),gh=A(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n),o=i instanceof Promise||a instanceof Promise;return o?Promise.all([i,a]).then(([t,n])=>vh(e,t,n)):vh(e,i,a)}});function _h(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ep(e)&&ep(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=_h(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=_h(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vh(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),fp(e))return e;let r=_h(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}let yh=A(`$ZodRecord`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ep(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...pp(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...pp(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>hp(e,r,Hf())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...pp(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...pp(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),bh=A(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=Uf(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>tp.has(typeof e)).map(e=>typeof e==`string`?np(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),xh=A(`$ZodLiteral`,(e,t)=>{N.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?np(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),Sh=A(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async){let t=r instanceof Promise?r:Promise.resolve(r);return t.then(t=>(e.value=t,e))}if(r instanceof Promise)throw new Bf;return e.value=r,e}}),Ch=A(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${qf(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),wh=A(`$ZodNullable`,(e,t)=>{N.init(e,t),j(e._zod,`optin`,()=>t.innerType._zod.optin),j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${qf(e.source)}|null)$`):void 0}),j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Th=A(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Eh(e,t)):Eh(r,t)}});function Eh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Dh=A(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Oh=A(`$ZodNonOptional`,(e,t)=>{N.init(e,t),j(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>kh(t,e)):kh(i,e)}});function kh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Ah=A(`$ZodCatch`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>hp(e,n,Hf()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>hp(e,n,Hf()))},input:e.value}),e.issues=[]),e)}}),jh=A(`$ZodPipe`,(e,t)=>{N.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Mh(e,t,n)):Mh(r,t,n)}});function Mh(e,t,n){return fp(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}let Nh=A(`$ZodReadonly`,(e,t)=>{N.init(e,t),j(e._zod,`propValues`,()=>t.innerType._zod.propValues),j(e._zod,`values`,()=>t.innerType._zod.values),j(e._zod,`optin`,()=>t.innerType._zod.optin),j(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ph):Ph(r)}});function Ph(e){return e.value=Object.freeze(e.value),e}let Fh=A(`$ZodLazy`,(e,t)=>{N.init(e,t),j(e._zod,`innerType`,()=>t.getter()),j(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),j(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),j(e._zod,`optin`,()=>e._zod.innerType._zod.optin),j(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>{let r=e._zod.innerType;return r._zod.run(t,n)}}),Ih=A(`$ZodCustom`,(e,t)=>{lm.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Lh(t,n,r,e));Lh(i,n,r,e)}});function Lh(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(_p(e))}}let Rh=Symbol(`ZodOutput`),zh=Symbol(`ZodInput`);var Bh=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Vh(){return new Bh}let Hh=Vh();function Uh(e,t){return new e({type:`string`,...M(t)})}function Wh(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function Gh(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Kh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function qh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function Jh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Yh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Xh(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Zh(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Qh(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function $h(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function eg(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function tg(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function ng(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function rg(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function ig(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function ag(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function og(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function sg(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function cg(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function lg(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function ug(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function dg(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function fg(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function pg(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function mg(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function hg(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function gg(e,t){return new e({type:`number`,checks:[],...M(t)})}function _g(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function vg(e,t){return new e({type:`boolean`,...M(t)})}function yg(e,t){return new e({type:`null`,...M(t)})}function bg(e){return new e({type:`unknown`})}function xg(e,t){return new e({type:`never`,...M(t)})}function Sg(e,t){return new dm({check:`less_than`,...M(t),value:e,inclusive:!1})}function Cg(e,t){return new dm({check:`less_than`,...M(t),value:e,inclusive:!0})}function wg(e,t){return new fm({check:`greater_than`,...M(t),value:e,inclusive:!1})}function Tg(e,t){return new fm({check:`greater_than`,...M(t),value:e,inclusive:!0})}function Eg(e,t){return new pm({check:`multiple_of`,...M(t),value:e})}function Dg(e,t){let n=new hm({check:`max_length`,...M(t),maximum:e});return n}function Og(e,t){return new gm({check:`min_length`,...M(t),minimum:e})}function kg(e,t){return new _m({check:`length_equals`,...M(t),length:e})}function Ag(e,t){return new ym({check:`string_format`,format:`regex`,...M(t),pattern:e})}function jg(e){return new bm({check:`string_format`,format:`lowercase`,...M(e)})}function Mg(e){return new xm({check:`string_format`,format:`uppercase`,...M(e)})}function Ng(e,t){return new Sm({check:`string_format`,format:`includes`,...M(t),includes:e})}function Pg(e,t){return new Cm({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function Fg(e,t){return new wm({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function Ig(e){return new Tm({check:`overwrite`,tx:e})}function Lg(e){return Ig(t=>t.normalize(e))}function Rg(){return Ig(e=>e.trim())}function zg(){return Ig(e=>e.toLowerCase())}function Bg(){return Ig(e=>e.toUpperCase())}function Vg(e,t,n){return new e({type:`array`,element:t,...M(n)})}function Hg(e,t,n){let r=M(n);r.abort??=!0;let i=new e({type:`custom`,check:`custom`,fn:t,...r});return i}function Ug(e,t,n){let r=new e({type:`custom`,check:`custom`,fn:t,...M(n)});return r}var Wg=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Hh,this.target=e?.target??`draft-2020-12`,this.unrepresentable=e?.unrepresentable??`throw`,this.override=e?.override??(()=>{}),this.io=e?.io??`output`,this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let r=e._zod.def,i={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},a=this.seen.get(e);if(a){a.count++;let n=t.schemaPath.includes(e);return n&&(a.cycle=t.path),a.schema}let o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...t,schemaPath:[...t.schemaPath,e],path:t.path},a=e._zod.parent;if(a)o.ref=a,this.process(a,n),this.seen.get(a).isParent=!0;else{let t=o.schema;switch(r.type){case`string`:{let n=t;n.type=`string`;let{minimum:r,maximum:a,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof r==`number`&&(n.minLength=r),typeof a==`number`&&(n.maxLength=a),s&&(n.format=i[s]??s,n.format===``&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?n.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({...this.target===`draft-7`?{type:`string`}:{},pattern:e.source}))])}break}case`number`:{let n=t,{minimum:r,maximum:i,format:a,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:c}=e._zod.bag;typeof a==`string`&&a.includes(`int`)?n.type=`integer`:n.type=`number`,typeof c==`number`&&(n.exclusiveMinimum=c),typeof r==`number`&&(n.minimum=r,typeof c==`number`&&(c>=r?delete n.minimum:delete n.exclusiveMinimum)),typeof s==`number`&&(n.exclusiveMaximum=s),typeof i==`number`&&(n.maximum=i,typeof s==`number`&&(s<=i?delete n.maximum:delete n.exclusiveMaximum)),typeof o==`number`&&(n.multipleOf=o);break}case`boolean`:{let e=t;e.type=`boolean`;break}case`bigint`:if(this.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`);break;case`symbol`:if(this.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`);break;case`null`:t.type=`null`;break;case`any`:break;case`unknown`:break;case`undefined`:if(this.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`);break;case`void`:if(this.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`);break;case`never`:t.not={};break;case`date`:if(this.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`);break;case`array`:{let i=t,{minimum:a,maximum:o}=e._zod.bag;typeof a==`number`&&(i.minItems=a),typeof o==`number`&&(i.maxItems=o),i.type=`array`,i.items=this.process(r.element,{...n,path:[...n.path,`items`]});break}case`object`:{let e=t;e.type=`object`,e.properties={};let i=r.shape;for(let t in i)e.properties[t]=this.process(i[t],{...n,path:[...n.path,`properties`,t]});let a=new Set(Object.keys(i)),o=new Set([...a].filter(e=>{let t=r.shape[e]._zod;return this.io===`input`?t.optin===void 0:t.optout===void 0}));o.size>0&&(e.required=Array.from(o)),r.catchall?._zod.def.type===`never`?e.additionalProperties=!1:r.catchall?r.catchall&&(e.additionalProperties=this.process(r.catchall,{...n,path:[...n.path,`additionalProperties`]})):this.io===`output`&&(e.additionalProperties=!1);break}case`union`:{let e=t;e.anyOf=r.options.map((e,t)=>this.process(e,{...n,path:[...n.path,`anyOf`,t]}));break}case`intersection`:{let e=t,i=this.process(r.left,{...n,path:[...n.path,`allOf`,0]}),a=this.process(r.right,{...n,path:[...n.path,`allOf`,1]}),o=e=>`allOf`in e&&Object.keys(e).length===1,s=[...o(i)?i.allOf:[i],...o(a)?a.allOf:[a]];e.allOf=s;break}case`tuple`:{let i=t;i.type=`array`;let a=r.items.map((e,t)=>this.process(e,{...n,path:[...n.path,`prefixItems`,t]}));if(this.target===`draft-2020-12`?i.prefixItems=a:i.items=a,r.rest){let e=this.process(r.rest,{...n,path:[...n.path,`items`]});this.target===`draft-2020-12`?i.items=e:i.additionalItems=e}r.rest&&(i.items=this.process(r.rest,{...n,path:[...n.path,`items`]}));let{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s);break}case`record`:{let e=t;e.type=`object`,e.propertyNames=this.process(r.keyType,{...n,path:[...n.path,`propertyNames`]}),e.additionalProperties=this.process(r.valueType,{...n,path:[...n.path,`additionalProperties`]});break}case`map`:if(this.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`);break;case`set`:if(this.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`);break;case`enum`:{let e=t,n=Uf(r.entries);n.every(e=>typeof e==`number`)&&(e.type=`number`),n.every(e=>typeof e==`string`)&&(e.type=`string`),e.enum=n;break}case`literal`:{let e=t,n=[];for(let e of r.values)if(e===void 0){if(this.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(this.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);n.push(Number(e))}else n.push(e);if(n.length!==0)if(n.length===1){let t=n[0];e.type=t===null?`null`:typeof t,e.const=t}else n.every(e=>typeof e==`number`)&&(e.type=`number`),n.every(e=>typeof e==`string`)&&(e.type=`string`),n.every(e=>typeof e==`boolean`)&&(e.type=`string`),n.every(e=>e===null)&&(e.type=`null`),e.enum=n;break}case`file`:{let n=t,r={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:i,maximum:a,mime:o}=e._zod.bag;i!==void 0&&(r.minLength=i),a!==void 0&&(r.maxLength=a),o?o.length===1?(r.contentMediaType=o[0],Object.assign(n,r)):n.anyOf=o.map(e=>{let t={...r,contentMediaType:e};return t}):Object.assign(n,r);break}case`transform`:if(this.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`);break;case`nullable`:{let e=this.process(r.innerType,n);t.anyOf=[e,{type:`null`}];break}case`nonoptional`:this.process(r.innerType,n),o.ref=r.innerType;break;case`success`:{let e=t;e.type=`boolean`;break}case`default`:this.process(r.innerType,n),o.ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue));break;case`prefault`:this.process(r.innerType,n),o.ref=r.innerType,this.io===`input`&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break;case`catch`:{this.process(r.innerType,n),o.ref=r.innerType;let e;try{e=r.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}t.default=e;break}case`nan`:if(this.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`);break;case`template_literal`:{let n=t,r=e._zod.pattern;if(!r)throw Error(`Pattern not found in template literal`);n.type=`string`,n.pattern=r.source;break}case`pipe`:{let e=this.io===`input`?r.in._zod.def.type===`transform`?r.out:r.in:r.out;this.process(e,n),o.ref=e;break}case`readonly`:this.process(r.innerType,n),o.ref=r.innerType,t.readOnly=!0;break;case`promise`:this.process(r.innerType,n),o.ref=r.innerType;break;case`optional`:this.process(r.innerType,n),o.ref=r.innerType;break;case`lazy`:{let t=e._zod.innerType;this.process(t,n),o.ref=t;break}case`custom`:if(this.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`);break;default:}}}let c=this.metadataRegistry.get(e);c&&Object.assign(o.schema,c),this.io===`input`&&Kg(e)&&(delete o.schema.examples,delete o.schema.default),this.io===`input`&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;let l=this.seen.get(e);return l.schema}emit(e,t){let n={cycles:t?.cycles??`ref`,reused:t?.reused??`inline`,external:t?.external??void 0},r=this.seen.get(e);if(!r)throw Error(`Unprocessed schema. This is a bug in Zod.`);let i=e=>{let t=this.target===`draft-2020-12`?`$defs`:`definitions`;if(n.external){let r=n.external.registry.get(e[0])?.id,i=n.external.uri??(e=>e);if(r)return{ref:i(r)};let a=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${t}/${a}`}}if(e[1]===r)return{ref:`#`};let i=`#`,a=`${i}/${t}/`,o=e[1].schema.id??`__schema${this.counter++}`;return{defId:o,ref:a+o}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(n.cycles===`throw`)for(let e of this.seen.entries()){let t=e[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join(`/`)}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of this.seen.entries()){let r=t[1];if(e===t[0]){a(t);continue}if(n.external){let r=n.external.registry.get(t[0])?.id;if(e!==t[0]&&r){a(t);continue}}let i=this.metadataRegistry.get(t[0])?.id;if(i){a(t);continue}if(r.cycle){a(t);continue}if(r.count>1&&n.reused===`ref`){a(t);continue}}let o=(e,t)=>{let n=this.seen.get(e),r=n.def??n.schema,i={...r};if(n.ref===null)return;let a=n.ref;if(n.ref=null,a){o(a,t);let e=this.seen.get(a).schema;e.$ref&&t.target===`draft-7`?(r.allOf=r.allOf??[],r.allOf.push(e)):(Object.assign(r,e),Object.assign(r,i))}n.isParent||this.override({zodSchema:e,jsonSchema:r,path:n.path??[]})};for(let e of[...this.seen.entries()].reverse())o(e[0],{target:this.target});let s={};if(this.target===`draft-2020-12`?s.$schema=`https://json-schema.org/draft/2020-12/schema`:this.target===`draft-7`?s.$schema=`http://json-schema.org/draft-07/schema#`:console.warn(`Invalid target: ${this.target}`),n.external?.uri){let t=n.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");s.$id=n.external.uri(t)}Object.assign(s,r.def);let c=n.external?.defs??{};for(let e of this.seen.entries()){let t=e[1];t.def&&t.defId&&(c[t.defId]=t.def)}n.external||Object.keys(c).length>0&&(this.target===`draft-2020-12`?s.$defs=c:s.definitions=c);try{return JSON.parse(JSON.stringify(s))}catch{throw Error(`Error converting schema to JSON.`)}}};function Gg(e,t){if(e instanceof Bh){let n=new Wg(t),r={};for(let t of e._idmap.entries()){let[e,r]=t;n.process(r)}let i={},a={registry:e,uri:t?.uri,defs:r};for(let r of e._idmap.entries()){let[e,o]=r;i[e]=n.emit(o,{...t,external:a})}if(Object.keys(r).length>0){let e=n.target===`draft-2020-12`?`$defs`:`definitions`;i.__shared={[e]:r}}return{schemas:i}}let n=new Wg(t);return n.process(e),n.emit(e,t)}function Kg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e,i=r._zod.def;switch(i.type){case`string`:case`number`:case`bigint`:case`boolean`:case`date`:case`symbol`:case`undefined`:case`null`:case`any`:case`unknown`:case`never`:case`void`:case`literal`:case`enum`:case`nan`:case`file`:case`template_literal`:return!1;case`array`:return Kg(i.element,n);case`object`:for(let e in i.shape)if(Kg(i.shape[e],n))return!0;return!1;case`union`:for(let e of i.options)if(Kg(e,n))return!0;return!1;case`intersection`:return Kg(i.left,n)||Kg(i.right,n);case`tuple`:for(let e of i.items)if(Kg(e,n))return!0;return!!(i.rest&&Kg(i.rest,n));case`record`:return Kg(i.keyType,n)||Kg(i.valueType,n);case`map`:return Kg(i.keyType,n)||Kg(i.valueType,n);case`set`:return Kg(i.valueType,n);case`promise`:case`optional`:case`nonoptional`:case`nullable`:case`readonly`:return Kg(i.innerType,n);case`lazy`:return Kg(i.getter(),n);case`default`:return Kg(i.innerType,n);case`prefault`:return Kg(i.innerType,n);case`custom`:return!1;case`transform`:return!0;case`pipe`:return Kg(i.in,n)||Kg(i.out,n);case`success`:return!1;case`catch`:return!1;default:}throw Error(`Unknown schema type: ${i.type}`)}let qg=A(`ZodISODateTime`,(e,t)=>{Vm.init(e,t),d_.init(e,t)});function Jg(e){return fg(qg,e)}let Yg=A(`ZodISODate`,(e,t)=>{Hm.init(e,t),d_.init(e,t)});function Xg(e){return pg(Yg,e)}let Zg=A(`ZodISOTime`,(e,t)=>{Um.init(e,t),d_.init(e,t)});function Qg(e){return mg(Zg,e)}let $g=A(`ZodISODuration`,(e,t)=>{Wm.init(e,t),d_.init(e,t)});function e_(e){return hg($g,e)}let t_=(e,t)=>{yp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Sp(e,t)},flatten:{value:t=>xp(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})},n_=A(`ZodError`,t_),r_=A(`ZodError`,t_,{Parent:Error}),i_=Cp(r_),a_=Tp(r_),o_=Dp(r_),s_=kp(r_),c_=A(`ZodType`,(e,t)=>(N.init(e,t),e.def=t,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>rp(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>i_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>o_(e,t,n),e.parseAsync=async(t,n)=>a_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>s_(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(Tv(t,n)),e.superRefine=t=>e.check(Ev(t)),e.overwrite=t=>e.check(Ig(t)),e.optional=()=>av(e),e.nullable=()=>sv(e),e.nullish=()=>av(sv(e)),e.nonoptional=t=>pv(e,t),e.array=()=>H_(e),e.or=t=>K_([e,t]),e.and=t=>X_(e,t),e.transform=t=>_v(e,rv(t)),e.default=t=>lv(e,t),e.prefault=t=>dv(e,t),e.catch=t=>hv(e,t),e.pipe=t=>_v(e,t),e.readonly=()=>yv(e),e.describe=t=>{let n=e.clone();return Hh.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Hh.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Hh.get(e);let n=e.clone();return Hh.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),l_=A(`_ZodString`,(e,t)=>{Om.init(e,t),c_.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ag(...t)),e.includes=(...t)=>e.check(Ng(...t)),e.startsWith=(...t)=>e.check(Pg(...t)),e.endsWith=(...t)=>e.check(Fg(...t)),e.min=(...t)=>e.check(Og(...t)),e.max=(...t)=>e.check(Dg(...t)),e.length=(...t)=>e.check(kg(...t)),e.nonempty=(...t)=>e.check(Og(1,...t)),e.lowercase=t=>e.check(jg(t)),e.uppercase=t=>e.check(Mg(t)),e.trim=()=>e.check(Rg()),e.normalize=(...t)=>e.check(Lg(...t)),e.toLowerCase=()=>e.check(zg()),e.toUpperCase=()=>e.check(Bg())}),u_=A(`ZodString`,(e,t)=>{Om.init(e,t),l_.init(e,t),e.email=t=>e.check(Wh(f_,t)),e.url=t=>e.check(Xh(h_,t)),e.jwt=t=>e.check(dg(A_,t)),e.emoji=t=>e.check(Zh(g_,t)),e.guid=t=>e.check(Gh(p_,t)),e.uuid=t=>e.check(Kh(m_,t)),e.uuidv4=t=>e.check(qh(m_,t)),e.uuidv6=t=>e.check(Jh(m_,t)),e.uuidv7=t=>e.check(Yh(m_,t)),e.nanoid=t=>e.check(Qh(__,t)),e.guid=t=>e.check(Gh(p_,t)),e.cuid=t=>e.check($h(v_,t)),e.cuid2=t=>e.check(eg(y_,t)),e.ulid=t=>e.check(tg(b_,t)),e.base64=t=>e.check(cg(D_,t)),e.base64url=t=>e.check(lg(O_,t)),e.xid=t=>e.check(ng(x_,t)),e.ksuid=t=>e.check(rg(S_,t)),e.ipv4=t=>e.check(ig(C_,t)),e.ipv6=t=>e.check(ag(w_,t)),e.cidrv4=t=>e.check(og(T_,t)),e.cidrv6=t=>e.check(sg(E_,t)),e.e164=t=>e.check(ug(k_,t)),e.datetime=t=>e.check(Jg(t)),e.date=t=>e.check(Xg(t)),e.time=t=>e.check(Qg(t)),e.duration=t=>e.check(e_(t))});function P(e){return Uh(u_,e)}let d_=A(`ZodStringFormat`,(e,t)=>{km.init(e,t),l_.init(e,t)}),f_=A(`ZodEmail`,(e,t)=>{Mm.init(e,t),d_.init(e,t)}),p_=A(`ZodGUID`,(e,t)=>{Am.init(e,t),d_.init(e,t)}),m_=A(`ZodUUID`,(e,t)=>{jm.init(e,t),d_.init(e,t)}),h_=A(`ZodURL`,(e,t)=>{Nm.init(e,t),d_.init(e,t)}),g_=A(`ZodEmoji`,(e,t)=>{Pm.init(e,t),d_.init(e,t)}),__=A(`ZodNanoID`,(e,t)=>{Fm.init(e,t),d_.init(e,t)}),v_=A(`ZodCUID`,(e,t)=>{Im.init(e,t),d_.init(e,t)}),y_=A(`ZodCUID2`,(e,t)=>{Lm.init(e,t),d_.init(e,t)}),b_=A(`ZodULID`,(e,t)=>{Rm.init(e,t),d_.init(e,t)}),x_=A(`ZodXID`,(e,t)=>{zm.init(e,t),d_.init(e,t)}),S_=A(`ZodKSUID`,(e,t)=>{Bm.init(e,t),d_.init(e,t)}),C_=A(`ZodIPv4`,(e,t)=>{Gm.init(e,t),d_.init(e,t)}),w_=A(`ZodIPv6`,(e,t)=>{Km.init(e,t),d_.init(e,t)}),T_=A(`ZodCIDRv4`,(e,t)=>{qm.init(e,t),d_.init(e,t)}),E_=A(`ZodCIDRv6`,(e,t)=>{Jm.init(e,t),d_.init(e,t)}),D_=A(`ZodBase64`,(e,t)=>{Xm.init(e,t),d_.init(e,t)}),O_=A(`ZodBase64URL`,(e,t)=>{Qm.init(e,t),d_.init(e,t)}),k_=A(`ZodE164`,(e,t)=>{$m.init(e,t),d_.init(e,t)}),A_=A(`ZodJWT`,(e,t)=>{th.init(e,t),d_.init(e,t)}),j_=A(`ZodNumber`,(e,t)=>{nh.init(e,t),c_.init(e,t),e.gt=(t,n)=>e.check(wg(t,n)),e.gte=(t,n)=>e.check(Tg(t,n)),e.min=(t,n)=>e.check(Tg(t,n)),e.lt=(t,n)=>e.check(Sg(t,n)),e.lte=(t,n)=>e.check(Cg(t,n)),e.max=(t,n)=>e.check(Cg(t,n)),e.int=t=>e.check(P_(t)),e.safe=t=>e.check(P_(t)),e.positive=t=>e.check(wg(0,t)),e.nonnegative=t=>e.check(Tg(0,t)),e.negative=t=>e.check(Sg(0,t)),e.nonpositive=t=>e.check(Cg(0,t)),e.multipleOf=(t,n)=>e.check(Eg(t,n)),e.step=(t,n)=>e.check(Eg(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function M_(e){return gg(j_,e)}let N_=A(`ZodNumberFormat`,(e,t)=>{rh.init(e,t),j_.init(e,t)});function P_(e){return _g(N_,e)}let F_=A(`ZodBoolean`,(e,t)=>{ih.init(e,t),c_.init(e,t)});function F(e){return vg(F_,e)}let I_=A(`ZodNull`,(e,t)=>{ah.init(e,t),c_.init(e,t)});function L_(e){return yg(I_,e)}let R_=A(`ZodUnknown`,(e,t)=>{oh.init(e,t),c_.init(e,t)});function I(){return bg(R_)}let z_=A(`ZodNever`,(e,t)=>{sh.init(e,t),c_.init(e,t)});function B_(e){return xg(z_,e)}let V_=A(`ZodArray`,(e,t)=>{lh.init(e,t),c_.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Og(t,n)),e.nonempty=t=>e.check(Og(1,t)),e.max=(t,n)=>e.check(Dg(t,n)),e.length=(t,n)=>e.check(kg(t,n)),e.unwrap=()=>e.element});function H_(e,t){return Vg(V_,e,t)}let U_=A(`ZodObject`,(e,t)=>{fh.init(e,t),c_.init(e,t),j(e,`shape`,()=>t.shape),e.keyof=()=>ev(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:I()}),e.loose=()=>e.clone({...e._zod.def,catchall:I()}),e.strict=()=>e.clone({...e._zod.def,catchall:B_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>cp(e,t),e.merge=t=>lp(e,t),e.pick=t=>op(e,t),e.omit=t=>sp(e,t),e.partial=(...t)=>up(iv,e,t[0]),e.required=(...t)=>dp(fv,e,t[0])});function L(e,t){let n={type:`object`,get shape(){return Yf(this,`shape`,{...e}),this.shape},...M(t)};return new U_(n)}function W_(e,t){return new U_({type:`object`,get shape(){return Yf(this,`shape`,{...e}),this.shape},catchall:B_(),...M(t)})}let G_=A(`ZodUnion`,(e,t)=>{mh.init(e,t),c_.init(e,t),e.options=t.options});function K_(e,t){return new G_({type:`union`,options:e,...M(t)})}let q_=A(`ZodDiscriminatedUnion`,(e,t)=>{G_.init(e,t),hh.init(e,t)});function J_(e,t,n){return new q_({type:`union`,options:t,discriminator:e,...M(n)})}let Y_=A(`ZodIntersection`,(e,t)=>{gh.init(e,t),c_.init(e,t)});function X_(e,t){return new Y_({type:`intersection`,left:e,right:t})}let Z_=A(`ZodRecord`,(e,t)=>{yh.init(e,t),c_.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Q_(e,t,n){return new Z_({type:`record`,keyType:e,valueType:t,...M(n)})}let $_=A(`ZodEnum`,(e,t)=>{bh.init(e,t),c_.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new $_({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new $_({...t,checks:[],...M(r),entries:i})}});function ev(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new $_({type:`enum`,entries:n,...M(t)})}let tv=A(`ZodLiteral`,(e,t)=>{xh.init(e,t),c_.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function R(e,t){return new tv({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}let nv=A(`ZodTransform`,(e,t)=>{Sh.init(e,t),c_.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(_p(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(_p(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rv(e){return new nv({type:`transform`,transform:e})}let iv=A(`ZodOptional`,(e,t)=>{Ch.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType});function av(e){return new iv({type:`optional`,innerType:e})}let ov=A(`ZodNullable`,(e,t)=>{wh.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sv(e){return new ov({type:`nullable`,innerType:e})}let cv=A(`ZodDefault`,(e,t)=>{Th.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lv(e,t){return new cv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}let uv=A(`ZodPrefault`,(e,t)=>{Dh.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dv(e,t){return new uv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}let fv=A(`ZodNonOptional`,(e,t)=>{Oh.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pv(e,t){return new fv({type:`nonoptional`,innerType:e,...M(t)})}let mv=A(`ZodCatch`,(e,t)=>{Ah.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hv(e,t){return new mv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let gv=A(`ZodPipe`,(e,t)=>{jh.init(e,t),c_.init(e,t),e.in=t.in,e.out=t.out});function _v(e,t){return new gv({type:`pipe`,in:e,out:t})}let vv=A(`ZodReadonly`,(e,t)=>{Nh.init(e,t),c_.init(e,t)});function yv(e){return new vv({type:`readonly`,innerType:e})}let bv=A(`ZodLazy`,(e,t)=>{Fh.init(e,t),c_.init(e,t),e.unwrap=()=>e._zod.def.getter()});function xv(e){return new bv({type:`lazy`,getter:e})}let Sv=A(`ZodCustom`,(e,t)=>{Ih.init(e,t),c_.init(e,t)});function Cv(e){let t=new lm({check:`custom`});return t._zod.check=e,t}function wv(e,t){return Hg(Sv,e??(()=>!0),t)}function Tv(e,t={}){return Ug(Sv,e,t)}function Ev(e){let t=Cv(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(_p(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(_p(r))}},e(n.value,n)));return t}function Dv(e,t={error:`Input not instance of ${e.name}`}){let n=new Sv({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...M(t)});return n._zod.bag.Class=e,n}var z;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(z||={});var Ov;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ov||={});let B=z.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),kv=e=>{let t=typeof e;switch(t){case`undefined`:return B.undefined;case`string`:return B.string;case`number`:return Number.isNaN(e)?B.nan:B.number;case`boolean`:return B.boolean;case`function`:return B.function;case`bigint`:return B.bigint;case`symbol`:return B.symbol;case`object`:return Array.isArray(e)?B.array:e===null?B.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?B.promise:typeof Map<`u`&&e instanceof Map?B.map:typeof Set<`u`&&e instanceof Set?B.set:typeof Date<`u`&&e instanceof Date?B.date:B.object;default:return B.unknown}},V=z.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`]);var Av=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r],a=r===i.path.length-1;a?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Av.create=e=>{let t=new Av(e);return t};let jv=(e,t)=>{let n;switch(e.code){case V.invalid_type:n=e.received===B.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,z.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${z.joinValues(e.keys,`, `)}`;break;case V.invalid_union:n=`Invalid input`;break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${z.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${z.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n=`Invalid function arguments`;break;case V.invalid_return_type:n=`Invalid function return type`;break;case V.invalid_date:n=`Invalid date`;break;case V.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:z.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case V.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case V.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case V.custom:n=`Invalid input`;break;case V.invalid_intersection_types:n=`Intersection results could not be merged`;break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,z.assertNever(e)}return{message:n}};var Mv=jv;let Nv=Mv;function Pv(){return Nv}let Fv=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function H(e,t){let n=Pv(),r=Fv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Mv?void 0:Mv].filter(e=>!!e)});e.common.issues.push(r)}var Iv=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return U;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return U;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let U=Object.freeze({status:`aborted`}),Lv=e=>({status:`dirty`,value:e}),Rv=e=>({status:`valid`,value:e}),zv=e=>e.status===`aborted`,Bv=e=>e.status===`dirty`,Vv=e=>e.status===`valid`,Hv=e=>typeof Promise<`u`&&e instanceof Promise;var W;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(W||={});var Uv=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}};let Wv=(e,t)=>{if(Vv(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Av(e.common.issues);return this._error=t,this._error}}};function G(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:i};let a=(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}};return{errorMap:a,description:i}}var K=class{get description(){return this._def.description}_getType(e){return kv(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:kv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Iv,ctx:{common:e.parent.common,data:e.data,parsedType:kv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Hv(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kv(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Wv(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kv(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Vv(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Vv(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kv(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Hv(r)?r:Promise.resolve(r));return Wv(n,i)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:V.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new qy({schema:this,typeName:q.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:e=>this[`~validate`](e)}}optional(){return Jy.create(this,this._def)}nullable(){return Yy.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Oy.create(this)}promise(){return Ky.create(this,this._def)}or(e){return jy.create([this,e],this._def)}and(e){return Fy.create(this,e,this._def)}transform(e){return new qy({...G(this._def),schema:this,typeName:q.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Xy({...G(this._def),innerType:this,defaultValue:t,typeName:q.ZodDefault})}brand(){return new eb({typeName:q.ZodBranded,type:this,...G(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Zy({...G(this._def),innerType:this,catchValue:t,typeName:q.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return tb.create(this,e)}readonly(){return nb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let Gv=/^c[^\s-]{8,}$/i,Kv=/^[0-9a-z]+$/,qv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jv=/^[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,Yv=/^[a-z0-9_-]{21}$/i,Xv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zv=/^[-+]?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)?)??$/,Qv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$v=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,ey,ty=/^(?:(?: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])$/,ny=/^(?:(?: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])$/,ry=/^(([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]))$/,iy=/^(([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])$/,ay=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sy=`((\\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])))`,cy=RegExp(`^${sy}$`);function ly(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function uy(e){return RegExp(`^${ly(e)}$`)}function dy(e){let t=`${sy}T${ly(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function fy(e,t){return!!((t===`v4`||!t)&&ty.test(e)||(t===`v6`||!t)&&ry.test(e))}function py(e,t){if(!Xv.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function my(e,t){return!!((t===`v4`||!t)&&ny.test(e)||(t===`v6`||!t)&&iy.test(e))}var hy=class e extends K{_parse(e){this._def.coerce&&(e.data=String(e.data));let t=this._getType(e);if(t!==B.string){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.string,received:t.parsedType}),U}let n=new Iv,r;for(let t of this._def.checks)if(t.kind===`min`)e.data.length<t.value&&(r=this._getOrReturnCtx(e,r),H(r,{code:V.too_small,minimum:t.value,type:`string`,inclusive:!0,exact:!1,message:t.message}),n.dirty());else if(t.kind===`max`)e.data.length>t.value&&(r=this._getOrReturnCtx(e,r),H(r,{code:V.too_big,maximum:t.value,type:`string`,inclusive:!0,exact:!1,message:t.message}),n.dirty());else if(t.kind===`length`){let i=e.data.length>t.value,a=e.data.length<t.value;(i||a)&&(r=this._getOrReturnCtx(e,r),i?H(r,{code:V.too_big,maximum:t.value,type:`string`,inclusive:!0,exact:!0,message:t.message}):a&&H(r,{code:V.too_small,minimum:t.value,type:`string`,inclusive:!0,exact:!0,message:t.message}),n.dirty())}else if(t.kind===`email`)Qv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`email`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`emoji`)ey||=new RegExp($v,`u`),ey.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`emoji`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`uuid`)Jv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`uuid`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`nanoid`)Yv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`nanoid`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`cuid`)Gv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`cuid`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`cuid2`)Kv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`cuid2`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`ulid`)qv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`ulid`,code:V.invalid_string,message:t.message}),n.dirty());else if(t.kind===`url`)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),H(r,{validation:`url`,code:V.invalid_string,message:t.message}),n.dirty()}else if(t.kind===`regex`){t.regex.lastIndex=0;let i=t.regex.test(e.data);i||(r=this._getOrReturnCtx(e,r),H(r,{validation:`regex`,code:V.invalid_string,message:t.message}),n.dirty())}else if(t.kind===`trim`)e.data=e.data.trim();else if(t.kind===`includes`)e.data.includes(t.value,t.position)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:{includes:t.value,position:t.position},message:t.message}),n.dirty());else if(t.kind===`toLowerCase`)e.data=e.data.toLowerCase();else if(t.kind===`toUpperCase`)e.data=e.data.toUpperCase();else if(t.kind===`startsWith`)e.data.startsWith(t.value)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:{startsWith:t.value},message:t.message}),n.dirty());else if(t.kind===`endsWith`)e.data.endsWith(t.value)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:{endsWith:t.value},message:t.message}),n.dirty());else if(t.kind===`datetime`){let i=dy(t);i.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:`datetime`,message:t.message}),n.dirty())}else if(t.kind===`date`){let i=cy;i.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:`date`,message:t.message}),n.dirty())}else if(t.kind===`time`){let i=uy(t);i.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{code:V.invalid_string,validation:`time`,message:t.message}),n.dirty())}else t.kind===`duration`?Zv.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`duration`,code:V.invalid_string,message:t.message}),n.dirty()):t.kind===`ip`?fy(e.data,t.version)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`ip`,code:V.invalid_string,message:t.message}),n.dirty()):t.kind===`jwt`?py(e.data,t.alg)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`jwt`,code:V.invalid_string,message:t.message}),n.dirty()):t.kind===`cidr`?my(e.data,t.version)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`cidr`,code:V.invalid_string,message:t.message}),n.dirty()):t.kind===`base64`?ay.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`base64`,code:V.invalid_string,message:t.message}),n.dirty()):t.kind===`base64url`?oy.test(e.data)||(r=this._getOrReturnCtx(e,r),H(r,{validation:`base64url`,code:V.invalid_string,message:t.message}),n.dirty()):z.assertNever(t);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:V.invalid_string,...W.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...W.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...W.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...W.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...W.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...W.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...W.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...W.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...W.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...W.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...W.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...W.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...W.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...W.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}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(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};hy.create=e=>new hy({checks:[],typeName:q.ZodString,coerce:e?.coerce??!1,...G(e)});function gy(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r,a=Number.parseInt(e.toFixed(i).replace(`.`,``)),o=Number.parseInt(t.toFixed(i).replace(`.`,``));return a%o/10**i}var _y=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));let t=this._getType(e);if(t!==B.number){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.number,received:t.parsedType}),U}let n,r=new Iv;for(let t of this._def.checks)if(t.kind===`int`)z.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:V.invalid_type,expected:`integer`,received:`float`,message:t.message}),r.dirty());else if(t.kind===`min`){let i=t.inclusive?e.data<t.value:e.data<=t.value;i&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.too_small,minimum:t.value,type:`number`,inclusive:t.inclusive,exact:!1,message:t.message}),r.dirty())}else if(t.kind===`max`){let i=t.inclusive?e.data>t.value:e.data>=t.value;i&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.too_big,maximum:t.value,type:`number`,inclusive:t.inclusive,exact:!1,message:t.message}),r.dirty())}else t.kind===`multipleOf`?gy(e.data,t.value)!==0&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.not_multiple_of,multipleOf:t.value,message:t.message}),r.dirty()):t.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:V.not_finite,message:t.message}),r.dirty()):z.assertNever(t);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,W.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,W.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,W.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,W.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:W.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:W.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:W.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:W.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&z.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};_y.create=e=>new _y({checks:[],typeName:q.ZodNumber,coerce:e?.coerce||!1,...G(e)});var vy=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}let t=this._getType(e);if(t!==B.bigint)return this._getInvalidInput(e);let n,r=new Iv;for(let t of this._def.checks)if(t.kind===`min`){let i=t.inclusive?e.data<t.value:e.data<=t.value;i&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.too_small,type:`bigint`,minimum:t.value,inclusive:t.inclusive,message:t.message}),r.dirty())}else if(t.kind===`max`){let i=t.inclusive?e.data>t.value:e.data>=t.value;i&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.too_big,type:`bigint`,maximum:t.value,inclusive:t.inclusive,message:t.message}),r.dirty())}else t.kind===`multipleOf`?e.data%t.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),H(n,{code:V.not_multiple_of,multipleOf:t.value,message:t.message}),r.dirty()):z.assertNever(t);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.bigint,received:t.parsedType}),U}gte(e,t){return this.setLimit(`min`,e,!0,W.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,W.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,W.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,W.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:W.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};vy.create=e=>new vy({checks:[],typeName:q.ZodBigInt,coerce:e?.coerce??!1,...G(e)});var yy=class extends K{_parse(e){this._def.coerce&&(e.data=!!e.data);let t=this._getType(e);if(t!==B.boolean){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.boolean,received:t.parsedType}),U}return Rv(e.data)}};yy.create=e=>new yy({typeName:q.ZodBoolean,coerce:e?.coerce||!1,...G(e)});var by=class e extends K{_parse(e){this._def.coerce&&(e.data=new Date(e.data));let t=this._getType(e);if(t!==B.date){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.date,received:t.parsedType}),U}if(Number.isNaN(e.data.getTime())){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_date}),U}let n=new Iv,r;for(let t of this._def.checks)t.kind===`min`?e.data.getTime()<t.value&&(r=this._getOrReturnCtx(e,r),H(r,{code:V.too_small,message:t.message,inclusive:!0,exact:!1,minimum:t.value,type:`date`}),n.dirty()):t.kind===`max`?e.data.getTime()>t.value&&(r=this._getOrReturnCtx(e,r),H(r,{code:V.too_big,message:t.message,inclusive:!0,exact:!1,maximum:t.value,type:`date`}),n.dirty()):z.assertNever(t);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:W.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};by.create=e=>new by({checks:[],coerce:e?.coerce||!1,typeName:q.ZodDate,...G(e)});var xy=class extends K{_parse(e){let t=this._getType(e);if(t!==B.symbol){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.symbol,received:t.parsedType}),U}return Rv(e.data)}};xy.create=e=>new xy({typeName:q.ZodSymbol,...G(e)});var Sy=class extends K{_parse(e){let t=this._getType(e);if(t!==B.undefined){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.undefined,received:t.parsedType}),U}return Rv(e.data)}};Sy.create=e=>new Sy({typeName:q.ZodUndefined,...G(e)});var Cy=class extends K{_parse(e){let t=this._getType(e);if(t!==B.null){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.null,received:t.parsedType}),U}return Rv(e.data)}};Cy.create=e=>new Cy({typeName:q.ZodNull,...G(e)});var wy=class extends K{constructor(){super(...arguments),this._any=!0}_parse(e){return Rv(e.data)}};wy.create=e=>new wy({typeName:q.ZodAny,...G(e)});var Ty=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Rv(e.data)}};Ty.create=e=>new Ty({typeName:q.ZodUnknown,...G(e)});var Ey=class extends K{_parse(e){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.never,received:t.parsedType}),U}};Ey.create=e=>new Ey({typeName:q.ZodNever,...G(e)});var Dy=class extends K{_parse(e){let t=this._getType(e);if(t!==B.undefined){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.void,received:t.parsedType}),U}return Rv(e.data)}};Dy.create=e=>new Dy({typeName:q.ZodVoid,...G(e)});var Oy=class e extends K{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==B.array)return H(t,{code:V.invalid_type,expected:B.array,received:t.parsedType}),U;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(H(t,{code:e?V.too_big:V.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(H(t,{code:V.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(H(t,{code:V.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Uv(t,e,t.path,n)))).then(e=>Iv.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Uv(t,e,t.path,n)));return Iv.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:W.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:W.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:W.toString(n)}})}nonempty(e){return this.min(1,e)}};Oy.create=(e,t)=>new Oy({type:e,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...G(t)});function ky(e){if(e instanceof Ay){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Jy.create(ky(r))}return new Ay({...e._def,shape:()=>t})}else if(e instanceof Oy)return new Oy({...e._def,type:ky(e.element)});else if(e instanceof Jy)return Jy.create(ky(e.unwrap()));else if(e instanceof Yy)return Yy.create(ky(e.unwrap()));else if(e instanceof Iy)return Iy.create(e.items.map(e=>ky(e)));else return e}var Ay=class e extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=z.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){let t=this._getType(e);if(t!==B.object){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.object,received:t.parsedType}),U}let{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ey&&this._def.unknownKeys===`strip`))for(let e in r.data)a.includes(e)||o.push(e);let s=[];for(let e of a){let t=i[e],n=r.data[e];s.push({key:{status:`valid`,value:e},value:t._parse(new Uv(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ey){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of o)s.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)o.length>0&&(H(r,{code:V.unrecognized_keys,keys:o}),n.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of o){let n=r.data[t];s.push({key:{status:`valid`,value:t},value:e._parse(new Uv(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Iv.mergeObjectSync(n,e)):Iv.mergeObjectSync(n,s)}get shape(){return this._def.shape()}strict(t){return W.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:W.errToObj(t).message??r}:{message:r}}}})}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){let n=new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:q.ZodObject});return n}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of z.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of z.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ky(this)}partial(t){let n={};for(let e of z.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of z.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e],r=t;for(;r instanceof Jy;)r=r._def.innerType;n[e]=r}return new e({...this._def,shape:()=>n})}keyof(){return Uy(z.objectKeys(this.shape))}};Ay.create=(e,t)=>new Ay({shape:()=>e,unknownKeys:`strip`,catchall:Ey.create(),typeName:q.ZodObject,...G(t)}),Ay.strictCreate=(e,t)=>new Ay({shape:()=>e,unknownKeys:`strict`,catchall:Ey.create(),typeName:q.ZodObject,...G(t)}),Ay.lazycreate=(e,t)=>new Ay({shape:e,unknownKeys:`strip`,catchall:Ey.create(),typeName:q.ZodObject,...G(t)});var jy=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Av(e.ctx.common.issues));return H(t,{code:V.invalid_union,unionErrors:n}),U}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Av(e));return H(t,{code:V.invalid_union,unionErrors:i}),U}}get options(){return this._def.options}};jy.create=(e,t)=>new jy({options:e,typeName:q.ZodUnion,...G(t)});let My=e=>e instanceof Vy?My(e.schema):e instanceof qy?My(e.innerType()):e instanceof Hy?[e.value]:e instanceof Wy?e.options:e instanceof Gy?z.objectValues(e.enum):e instanceof Xy?My(e._def.innerType):e instanceof Sy?[void 0]:e instanceof Cy?[null]:e instanceof Jy?[void 0,...My(e.unwrap())]:e instanceof Yy?[null,...My(e.unwrap())]:e instanceof eb||e instanceof nb?My(e.unwrap()):e instanceof Zy?My(e._def.innerType):[];var Ny=class e extends K{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==B.object)return H(t,{code:V.invalid_type,expected:B.object,received:t.parsedType}),U;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(H(t,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=My(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...G(r)})}};function Py(e,t){let n=kv(e),r=kv(t);if(e===t)return{valid:!0,data:e};if(n===B.object&&r===B.object){let n=z.objectKeys(t),r=z.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Py(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===B.array&&r===B.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Py(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===B.date&&r===B.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Fy=class extends K{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(zv(e)||zv(r))return U;let i=Py(e.value,r.value);return i.valid?((Bv(e)||Bv(r))&&t.dirty(),{status:t.value,value:i.data}):(H(n,{code:V.invalid_intersection_types}),U)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Fy.create=(e,t,n)=>new Fy({left:e,right:t,typeName:q.ZodIntersection,...G(n)});var Iy=class e extends K{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.array)return H(n,{code:V.invalid_type,expected:B.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return H(n,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),U;let r=this._def.rest;!r&&n.data.length>this._def.items.length&&(H(n,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let i=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Uv(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(i).then(e=>Iv.mergeArray(t,e)):Iv.mergeArray(t,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Iy.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Iy({items:e,typeName:q.ZodTuple,rest:null,...G(t)})};var Ly=class e extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.object)return H(n,{code:V.invalid_type,expected:B.object,received:n.parsedType}),U;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Uv(n,e,n.path,e)),value:a._parse(new Uv(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Iv.mergeObjectAsync(t,r):Iv.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof K?new e({keyType:t,valueType:n,typeName:q.ZodRecord,...G(r)}):new e({keyType:hy.create(),valueType:t,typeName:q.ZodRecord,...G(n)})}},Ry=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.map)return H(n,{code:V.invalid_type,expected:B.map,received:n.parsedType}),U;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Uv(n,e,n.path,[a,`key`])),value:i._parse(new Uv(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return U;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return U;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ry.create=(e,t,n)=>new Ry({valueType:t,keyType:e,typeName:q.ZodMap,...G(n)});var zy=class e extends K{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.set)return H(n,{code:V.invalid_type,expected:B.set,received:n.parsedType}),U;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(H(n,{code:V.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(H(n,{code:V.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return U;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Uv(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:W.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:W.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zy.create=(e,t)=>new zy({valueType:e,minSize:null,maxSize:null,typeName:q.ZodSet,...G(t)});var By=class e extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==B.function)return H(t,{code:V.invalid_type,expected:B.function,received:t.parsedType}),U;function n(e,n){return Fv({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pv(),Mv].filter(e=>!!e),issueData:{code:V.invalid_arguments,argumentsError:n}})}function r(e,n){return Fv({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pv(),Mv].filter(e=>!!e),issueData:{code:V.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ky){let e=this;return Rv(async function(...t){let o=new Av([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o});return l})}else{let e=this;return Rv(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Av([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Av([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Iy.create(t).rest(Ty.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){let t=this.parse(e);return t}strictImplement(e){let t=this.parse(e);return t}static create(t,n,r){return new e({args:t||Iy.create([]).rest(Ty.create()),returns:n||Ty.create(),typeName:q.ZodFunction,...G(r)})}},Vy=class extends K{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.getter();return n._parse({data:t.data,path:t.path,parent:t})}};Vy.create=(e,t)=>new Vy({getter:e,typeName:q.ZodLazy,...G(t)});var Hy=class extends K{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return H(t,{received:t.data,code:V.invalid_literal,expected:this._def.value}),U}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Hy.create=(e,t)=>new Hy({value:e,typeName:q.ZodLiteral,...G(t)});function Uy(e,t){return new Wy({values:e,typeName:q.ZodEnum,...G(t)})}var Wy=class e extends K{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return H(t,{expected:z.joinValues(n),received:t.parsedType,code:V.invalid_type}),U}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return H(t,{received:t.data,code:V.invalid_enum_value,options:n}),U}return Rv(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Wy.create=Uy;var Gy=class extends K{_parse(e){let t=z.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==B.string&&n.parsedType!==B.number){let e=z.objectValues(t);return H(n,{expected:z.joinValues(e),received:n.parsedType,code:V.invalid_type}),U}if(this._cache||=new Set(z.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=z.objectValues(t);return H(n,{received:n.data,code:V.invalid_enum_value,options:e}),U}return Rv(e.data)}get enum(){return this._def.values}};Gy.create=(e,t)=>new Gy({values:e,typeName:q.ZodNativeEnum,...G(t)});var Ky=class extends K{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==B.promise&&t.common.async===!1)return H(t,{code:V.invalid_type,expected:B.promise,received:t.parsedType}),U;let n=t.parsedType===B.promise?t.data:Promise.resolve(t.data);return Rv(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ky.create=(e,t)=>new Ky({type:e,typeName:q.ZodPromise,...G(t)});var qy=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{H(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return U;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?U:r.status===`dirty`||t.value===`dirty`?Lv(r.value):r});{if(t.value===`aborted`)return U;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?U:r.status===`dirty`||t.value===`dirty`?Lv(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?U:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?U:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Vv(e))return U;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Vv(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):U);z.assertNever(r)}};qy.create=(e,t,n)=>new qy({schema:e,typeName:q.ZodEffects,effect:t,...G(n)}),qy.createWithPreprocess=(e,t,n)=>new qy({schema:t,effect:{type:`preprocess`,transform:e},typeName:q.ZodEffects,...G(n)});var Jy=class extends K{_parse(e){let t=this._getType(e);return t===B.undefined?Rv(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jy.create=(e,t)=>new Jy({innerType:e,typeName:q.ZodOptional,...G(t)});var Yy=class extends K{_parse(e){let t=this._getType(e);return t===B.null?Rv(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Yy.create=(e,t)=>new Yy({innerType:e,typeName:q.ZodNullable,...G(t)});var Xy=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===B.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Xy.create=(e,t)=>new Xy({innerType:e,typeName:q.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...G(t)});var Zy=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Hv(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Av(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Av(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Zy.create=(e,t)=>new Zy({innerType:e,typeName:q.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...G(t)});var Qy=class extends K{_parse(e){let t=this._getType(e);if(t!==B.nan){let t=this._getOrReturnCtx(e);return H(t,{code:V.invalid_type,expected:B.nan,received:t.parsedType}),U}return{status:`valid`,value:e.data}}};Qy.create=e=>new Qy({typeName:q.ZodNaN,...G(e)});let $y=Symbol(`zod_brand`);var eb=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},tb=class e extends K{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){let e=async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?U:e.status===`dirty`?(t.dirty(),Lv(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})};return e()}else{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?U:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:q.ZodPipeline})}},nb=class extends K{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Vv(e)&&(e.value=Object.freeze(e.value)),e);return Hv(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};nb.create=(e,t)=>new nb({innerType:e,typeName:q.ZodReadonly,...G(t)});let rb={object:Ay.lazycreate};var q;(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`})(q||={});let ib=hy.create,ab=_y.create,ob=Qy.create,sb=vy.create,cb=yy.create,lb=by.create,ub=xy.create,db=Sy.create,fb=Cy.create,pb=wy.create,mb=Ty.create,hb=Ey.create,gb=Dy.create,_b=Oy.create,vb=Ay.create,yb=Ay.strictCreate,bb=jy.create,xb=Ny.create,Sb=Fy.create,Cb=Iy.create,wb=Ly.create,Tb=Ry.create,Eb=zy.create,Db=By.create,Ob=Vy.create,kb=Hy.create,Ab=Wy.create,jb=Gy.create,Mb=Ky.create,Nb=qy.create,Pb=Jy.create,Fb=Yy.create,Ib=qy.createWithPreprocess,Lb=tb.create;var Rb=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new Vd({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},zb=Rb();function Bb(e=globalThis){var t,n,r;return e.window?`runtime/browser`:(t=e.navigator)?.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(r=(n=e.process)?.versions)?.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?`runtime/vercel-edge`:`runtime/unknown`}function Vb(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function Hb(e,...t){let n=new Headers(Vb(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}var Ub=/"__proto__"\s*:/,Wb=/"constructor"\s*:/;function Gb(e){let t=JSON.parse(e);return typeof t!=`object`||!t||Ub.test(e)===!1&&Wb.test(e)===!1?t:Kb(t)}function Kb(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function qb(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Gb(e)}try{return Gb(e)}finally{Error.stackTraceLimit=t}}var Jb=Symbol.for(`vercel.ai.validator`);function Yb(e){return{[Jb]:!0,validate:e}}function Xb(e){return typeof e==`object`&&!!e&&Jb in e&&e[Jb]===!0&&`validate`in e}function Zb(e){let t;return()=>(t??=e(),t)}function Qb(e){return Xb(e)?e:typeof e==`function`?e():$b(e)}function $b(e){return Yb(async t=>{let n=await e[`~standard`].validate(t);return n.issues==null?{success:!0,value:n.value}:{success:!1,error:new Of({value:t,cause:n.issues})}})}async function ex({value:e,schema:t}){let n=await tx({value:e,schema:t});if(!n.success)throw Of.wrap({value:e,cause:n.error});return n.value}async function tx({value:e,schema:t}){let n=Qb(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:Of.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:Of.wrap({value:e,cause:t}),rawValue:e}}}async function nx({text:e,schema:t}){try{let n=qb(e);return t==null?{success:!0,value:n,rawValue:n}:await tx({value:n,schema:t})}catch(t){return{success:!1,error:ef.isInstance(t)?t:new ef({text:e,cause:t}),rawValue:void 0}}}function rx({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Lf).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await nx({text:e,schema:t}))}}))}async function ix(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}function ax(e){if(e.type===`object`){e.additionalProperties=!1;let t=e.properties;if(t!=null)for(let e in t)t[e]=ax(t[e])}return e.type===`array`&&e.items!=null&&(Array.isArray(e.items)?e.items=e.items.map(e=>ax(e)):e.items=ax(e.items)),e}var ox=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)},sx=Symbol(`Let zodToJsonSchema decide on which parser to use`),cx={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},lx=e=>typeof e==`string`?{...cx,name:e}:{...cx,...e};function ux(){return{}}function dx(e,t){var n,r,i;let a={type:`array`};return(n=e.type)?._def&&(i=(r=e.type)?._def)?.typeName!==q.ZodAny&&(a.items=J(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(a.minItems=e.minLength.value),e.maxLength&&(a.maxItems=e.maxLength.value),e.exactLength&&(a.minItems=e.exactLength.value,a.maxItems=e.exactLength.value),a}function fx(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function px(){return{type:`boolean`}}function mx(e,t){return J(e.type._def,t)}var hx=(e,t)=>J(e.innerType._def,t);function gx(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>gx(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return _x(e)}}var _x=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t};function vx(e,t){return{...J(e.innerType._def,t),default:e.defaultValue()}}function yx(e,t){return t.effectStrategy===`input`?J(e.schema._def,t):ux()}function bx(e){return{type:`string`,enum:Array.from(e.values)}}var xx=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function Sx(e,t){let n=[J(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),J(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(xx(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function Cx(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var wx=void 0,Tx={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(wx===void 0&&(wx=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),wx),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ex(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:Ax(n,`email`,r.message,t);break;case`format:idn-email`:Ax(n,`idn-email`,r.message,t);break;case`pattern:zod`:jx(n,Tx.email,r.message,t);break}break;case`url`:Ax(n,`uri`,r.message,t);break;case`uuid`:Ax(n,`uuid`,r.message,t);break;case`regex`:jx(n,r.regex,r.message,t);break;case`cuid`:jx(n,Tx.cuid,r.message,t);break;case`cuid2`:jx(n,Tx.cuid2,r.message,t);break;case`startsWith`:jx(n,RegExp(`^${Dx(r.value,t)}`),r.message,t);break;case`endsWith`:jx(n,RegExp(`${Dx(r.value,t)}$`),r.message,t);break;case`datetime`:Ax(n,`date-time`,r.message,t);break;case`date`:Ax(n,`date`,r.message,t);break;case`time`:Ax(n,`time`,r.message,t);break;case`duration`:Ax(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:jx(n,RegExp(Dx(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&Ax(n,`ipv4`,r.message,t),r.version!==`v4`&&Ax(n,`ipv6`,r.message,t);break;case`base64url`:jx(n,Tx.base64url,r.message,t);break;case`jwt`:jx(n,Tx.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&jx(n,Tx.ipv4Cidr,r.message,t),r.version!==`v4`&&jx(n,Tx.ipv6Cidr,r.message,t);break;case`emoji`:jx(n,Tx.emoji(),r.message,t);break;case`ulid`:jx(n,Tx.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:Ax(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:jx(n,Tx.base64,r.message,t);break}break;case`nanoid`:jx(n,Tx.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function Dx(e,t){return t.patternStrategy===`escape`?kx(e):e}var Ox=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function kx(e){let t=``;for(let n=0;n<e.length;n++)Ox.has(e[n])||(t+=`\\`),t+=e[n];return t}function Ax(e,t,n,r){var i;e.format||(i=e.anyOf)?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function jx(e,t,n,r){var i;e.pattern||(i=e.allOf)?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Mx(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Mx(t,r)}function Mx(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},i=r.i?e.source.toLowerCase():e.source,a=``,o=!1,s=!1,c=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}if(r.i){if(s){if(i[e].match(/[a-z]/)){c?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),c=!1):i[e+1]===`-`&&(n=i[e+2])?.match(/[a-z]/)?(a+=i[e],c=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(r.m){if(i[e]===`^`){a+=`(^|(?<=[\r
]))`;continue}else if(i[e]===`$`){a+=`($|(?=[\r
]))`;continue}}if(r.s&&i[e]===`.`){a+=s?`${i[e]}\r
`:`[${i[e]}\r
]`;continue}a+=i[e],i[e]===`\\`?o=!0:s&&i[e]===`]`?s=!1:!s&&i[e]===`[`&&(s=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return a}function Nx(e,t){var n,r,i,a,o,s;let c={type:`object`,additionalProperties:(n=J(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]}))??t.allowedAdditionalProperties};if((r=e.keyType)?._def.typeName===q.ZodString&&(i=e.keyType._def.checks)?.length){let{type:n,...r}=Ex(e.keyType._def,t);return{...c,propertyNames:r}}else if((a=e.keyType)?._def.typeName===q.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};else if((o=e.keyType)?._def.typeName===q.ZodBranded&&e.keyType._def.type._def.typeName===q.ZodString&&(s=e.keyType._def.type._def.checks)?.length){let{type:n,...r}=mx(e.keyType._def,t);return{...c,propertyNames:r}}return c}function Px(e,t){if(t.mapStrategy===`record`)return Nx(e,t);let n=J(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||ux(),r=J(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||ux();return{type:`array`,maxItems:125,items:{type:`array`,items:[n,r],minItems:2,maxItems:2}}}function Fx(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`),r=n.map(e=>t[e]),i=Array.from(new Set(r.map(e=>typeof e)));return{type:i.length===1?i[0]===`string`?`string`:`number`:[`string`,`number`],enum:r}}function Ix(){return{not:ux()}}function Lx(){return{type:`null`}}var Rx={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function zx(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Rx&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=Rx[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];case`symbol`:case`undefined`:case`function`:default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Bx(e,t)}var Bx=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>J(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Vx(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Rx[e.innerType._def.typeName],`null`]};let n=J(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Hx(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function Ux(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=Gx(a),s=J(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});if(s===void 0)continue;n.properties[e]=s,o||r.push(e)}r.length&&(n.required=r);let a=Wx(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Wx(e,t){if(e.catchall._def.typeName!==`ZodNever`)return J(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Gx(e){try{return e.isOptional()}catch{return!0}}var Kx=(e,t)=>{var n;if(t.currentPath.toString()===(n=t.propertyPath)?.toString())return J(e.innerType._def,t);let r=J(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return r?{anyOf:[{not:ux()},r]}:ux()},qx=(e,t)=>{if(t.pipeStrategy===`input`)return J(e.in._def,t);if(t.pipeStrategy===`output`)return J(e.out._def,t);let n=J(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),r=J(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]});return{allOf:[n,r].filter(e=>e!==void 0)}};function Jx(e,t){return J(e.type._def,t)}function Yx(e,t){let n=J(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]}),r={type:`array`,uniqueItems:!0,items:n};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function Xx(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>J(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:J(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>J(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Zx(){return{not:ux()}}function Qx(){return ux()}var $x=(e,t)=>J(e.innerType._def,t),eS=(e,t,n)=>{switch(t){case q.ZodString:return Ex(e,n);case q.ZodNumber:return Hx(e);case q.ZodObject:return Ux(e,n);case q.ZodBigInt:return fx(e);case q.ZodBoolean:return px();case q.ZodDate:return gx(e,n);case q.ZodUndefined:return Zx();case q.ZodNull:return Lx();case q.ZodArray:return dx(e,n);case q.ZodUnion:case q.ZodDiscriminatedUnion:return zx(e,n);case q.ZodIntersection:return Sx(e,n);case q.ZodTuple:return Xx(e,n);case q.ZodRecord:return Nx(e,n);case q.ZodLiteral:return Cx(e);case q.ZodEnum:return bx(e);case q.ZodNativeEnum:return Fx(e);case q.ZodNullable:return Vx(e,n);case q.ZodOptional:return Kx(e,n);case q.ZodMap:return Px(e,n);case q.ZodSet:return Yx(e,n);case q.ZodLazy:return()=>e.getter()._def;case q.ZodPromise:return Jx(e,n);case q.ZodNaN:case q.ZodNever:return Ix();case q.ZodEffects:return yx(e,n);case q.ZodAny:return ux();case q.ZodUnknown:return Qx();case q.ZodDefault:return vx(e,n);case q.ZodBranded:return mx(e,n);case q.ZodReadonly:return $x(e,n);case q.ZodCatch:return hx(e,n);case q.ZodPipeline:return qx(e,n);case q.ZodFunction:case q.ZodVoid:case q.ZodSymbol:return;default:return(e=>void 0)(t)}};function J(e,t,n=!1){var r;let i=t.seen.get(e);if(t.override){let a=(r=t.override)?.call(t,e,t,i,n);if(a!==sx)return a}if(i&&!n){let e=tS(i,t);if(e!==void 0)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=eS(e,e.typeName,t),s=typeof o==`function`?J(o(),t):o;if(s&&nS(e,t,s),t.postProcess){let n=t.postProcess(s,e,t);return a.jsonSchema=s,n}return a.jsonSchema=s,s}var tS=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:ox(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),ux()):t.$refStrategy===`seen`?ux():void 0}},nS=(e,t,n)=>(e.description&&(n.description=e.description),n),rS=e=>{let t=lx(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},iS=(e,t)=>{var n;let r=rS(t),i=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var i;return{...e,[t]:(i=J(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))??ux()}},{}):void 0,a=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,o=(n=J(e._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))??ux(),s=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;s!==void 0&&(o.title=s);let c=a===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy===`relative`?[]:r.basePath,r.definitionPath,a].join(`/`),[r.definitionPath]:{...i,[a]:o}};return c.$schema=`http://json-schema.org/draft-07/schema#`,c},aS=iS;function oS(e,t){var n;let r=(n=t?.useReferences)??!1;return dS(()=>aS(e,{$refStrategy:r?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function sS(e,t){var n;let r=(n=t?.useReferences)??!1;return dS(()=>ax(Gg(e,{target:`draft-7`,io:`input`,reused:r?`ref`:`inline`})),{validate:async t=>{let n=await s_(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function cS(e){return`_zod`in e}function lS(e,t){return cS(e)?sS(e,t):oS(e,t)}var uS=Symbol.for(`vercel.ai.schema`);function dS(e,{validate:t}={}){return{[uS]:!0,_type:void 0,[Jb]:!0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function fS(e){return typeof e==`object`&&!!e&&uS in e&&e[uS]===!0&&`jsonSchema`in e&&`validate`in e}function pS(e){return e==null?dS({properties:{},additionalProperties:!1}):fS(e)?e:typeof e==`function`?e():lS(e)}var{btoa:mS,atob:hS}=globalThis,gS=Object.defineProperty,_S=(e,t)=>{for(var n in t)gS(e,n,{get:t[n],enumerable:!0})},vS=`AI_NoOutputSpecifiedError`,yS=`vercel.ai.error.${vS}`,bS=Symbol.for(yS),xS;xS=bS;var SS=`AI_InvalidArgumentError`,CS=`vercel.ai.error.${SS}`,wS=Symbol.for(CS),TS;TS=wS;var ES=`AI_InvalidStreamPartError`,DS=`vercel.ai.error.${ES}`,OS=Symbol.for(DS),kS;kS=OS;var AS=`AI_InvalidToolInputError`,jS=`vercel.ai.error.${AS}`,MS=Symbol.for(jS),NS;NS=MS;var PS=`AI_NoImageGeneratedError`,FS=`vercel.ai.error.${PS}`,IS=Symbol.for(FS),LS;LS=IS;var RS=`AI_NoObjectGeneratedError`,zS=`vercel.ai.error.${RS}`,BS=Symbol.for(zS),VS,HS=class extends Dd{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:RS,message:e,cause:t}),this[VS]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Dd.hasMarker(e,zS)}};VS=BS;var US=`AI_NoOutputGeneratedError`,WS=`vercel.ai.error.${US}`,GS=Symbol.for(WS),KS;KS=GS;var qS=`AI_NoSuchToolError`,JS=`vercel.ai.error.${qS}`,YS=Symbol.for(JS),XS;XS=YS;var ZS=`AI_ToolCallRepairError`,QS=`vercel.ai.error.${ZS}`,$S=Symbol.for(QS),eC;eC=$S;var tC=`AI_InvalidDataContentError`,nC=`vercel.ai.error.${tC}`,rC=Symbol.for(nC),iC;iC=rC;var aC=`AI_InvalidMessageRoleError`,oC=`vercel.ai.error.${aC}`,sC=Symbol.for(oC),cC;cC=sC;var lC=`AI_MessageConversionError`,uC=`vercel.ai.error.${lC}`,dC=Symbol.for(uC),fC;fC=dC;var pC=`AI_DownloadError`,mC=`vercel.ai.error.${pC}`,hC=Symbol.for(mC),gC;gC=hC;var _C=`AI_RetryError`,vC=`vercel.ai.error.${_C}`,yC=Symbol.for(vC),bC;bC=yC;var xC=`5.0.115`,SC=K_([P(),Dv(Uint8Array),Dv(ArrayBuffer),wv(e=>{var t,n;return(n=(t=globalThis.Buffer)?.isBuffer(e))??!1},{message:`Must be a Buffer`})]),CC=xv(()=>K_([L_(),P(),M_(),F(),Q_(P(),CC),H_(CC)])),Y=Q_(P(),Q_(P(),CC)),wC=L({type:R(`text`),text:P(),providerOptions:Y.optional()}),TC=L({type:R(`image`),image:K_([SC,Dv(URL)]),mediaType:P().optional(),providerOptions:Y.optional()}),EC=L({type:R(`file`),data:K_([SC,Dv(URL)]),filename:P().optional(),mediaType:P(),providerOptions:Y.optional()}),DC=L({type:R(`reasoning`),text:P(),providerOptions:Y.optional()}),OC=L({type:R(`tool-call`),toolCallId:P(),toolName:P(),input:I(),providerOptions:Y.optional(),providerExecuted:F().optional()}),kC=J_(`type`,[L({type:R(`text`),value:P()}),L({type:R(`json`),value:CC}),L({type:R(`error-text`),value:P()}),L({type:R(`error-json`),value:CC}),L({type:R(`content`),value:H_(K_([L({type:R(`text`),text:P()}),L({type:R(`media`),data:P(),mediaType:P()})]))})]),AC=L({type:R(`tool-result`),toolCallId:P(),toolName:P(),output:kC,providerOptions:Y.optional()}),jC=L({role:R(`system`),content:P(),providerOptions:Y.optional()}),MC=L({role:R(`user`),content:K_([P(),H_(K_([wC,TC,EC]))]),providerOptions:Y.optional()}),NC=L({role:R(`assistant`),content:K_([P(),H_(K_([wC,EC,DC,OC,AC]))]),providerOptions:Y.optional()}),PC=L({role:R(`tool`),content:H_(AC),providerOptions:Y.optional()}),FC=K_([jC,MC,NC,PC]),IC=Rb({prefix:`aitxt`,size:24}),LC=Zb(()=>lS(K_([W_({type:R(`text-start`),id:P(),providerMetadata:Y.optional()}),W_({type:R(`text-delta`),id:P(),delta:P(),providerMetadata:Y.optional()}),W_({type:R(`text-end`),id:P(),providerMetadata:Y.optional()}),W_({type:R(`error`),errorText:P()}),W_({type:R(`tool-input-start`),toolCallId:P(),toolName:P(),providerExecuted:F().optional(),dynamic:F().optional()}),W_({type:R(`tool-input-delta`),toolCallId:P(),inputTextDelta:P()}),W_({type:R(`tool-input-available`),toolCallId:P(),toolName:P(),input:I(),providerExecuted:F().optional(),providerMetadata:Y.optional(),dynamic:F().optional()}),W_({type:R(`tool-input-error`),toolCallId:P(),toolName:P(),input:I(),providerExecuted:F().optional(),providerMetadata:Y.optional(),dynamic:F().optional(),errorText:P()}),W_({type:R(`tool-output-available`),toolCallId:P(),output:I(),providerExecuted:F().optional(),dynamic:F().optional(),preliminary:F().optional()}),W_({type:R(`tool-output-error`),toolCallId:P(),errorText:P(),providerExecuted:F().optional(),dynamic:F().optional()}),W_({type:R(`reasoning-start`),id:P(),providerMetadata:Y.optional()}),W_({type:R(`reasoning-delta`),id:P(),delta:P(),providerMetadata:Y.optional()}),W_({type:R(`reasoning-end`),id:P(),providerMetadata:Y.optional()}),W_({type:R(`source-url`),sourceId:P(),url:P(),title:P().optional(),providerMetadata:Y.optional()}),W_({type:R(`source-document`),sourceId:P(),mediaType:P(),title:P(),filename:P().optional(),providerMetadata:Y.optional()}),W_({type:R(`file`),url:P(),mediaType:P(),providerMetadata:Y.optional()}),W_({type:wv(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:P().optional(),data:I(),transient:F().optional()}),W_({type:R(`start-step`)}),W_({type:R(`finish-step`)}),W_({type:R(`start`),messageId:P().optional(),messageMetadata:I().optional()}),W_({type:R(`finish`),finishReason:ev([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`,`unknown`]).optional(),messageMetadata:I().optional()}),W_({type:R(`abort`)}),W_({type:R(`message-metadata`),messageMetadata:I()})])));function RC(e){return e.type.startsWith(`data-`)}function zC(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=zC(a,i):n[r]=i}return n}function BC(e){let t=[`ROOT`],n=-1,r=null;function i(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s<e.length;s++){let c=e[s],l=t[t.length-1];switch(l){case`ROOT`:i(c,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=s,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(c){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:i(c,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:a(c,s);break;case`INSIDE_STRING`:switch(c){case`"`:t.pop(),n=s;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(c){case`]`:n=s,t.pop();break;default:n=s,i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(c){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=s,t.pop();break;default:n=s;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),n=s;break;case`INSIDE_NUMBER`:switch(c){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?a(c,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s)):n=s;break}}}let s=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--){let i=t[n];switch(i){case`INSIDE_STRING`:s+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}}return s}async function VC(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await nx({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await nx({text:BC(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function HC(e){return e.type.startsWith(`tool-`)}function UC(e){return e.type===`dynamic-tool`}function WC(e){return HC(e)||UC(e)}function GC(e){return e.type.split(`-`).slice(1).join(`-`)}function KC({lastMessage:e,messageId:t}){return{message:e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function qC({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{var l,u,d,f;function p(e){let t=r.message.parts.filter(HC),n=t.find(t=>t.toolCallId===e);if(n==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return n}function m(e){let t=r.message.parts.filter(e=>e.type===`dynamic-tool`),n=t.find(t=>t.toolCallId===e);if(n==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return n}function h(e){var t;let n=r.message.parts.find(t=>HC(t)&&t.toolCallId===e.toolCallId),i=e,a=n;n==null?r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,input:i.input,output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary,...i.providerMetadata==null?{}:{callProviderMetadata:i.providerMetadata}}):(n.state=e.state,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,a.preliminary=i.preliminary,a.providerExecuted=(t=i.providerExecuted)??n.providerExecuted,i.providerMetadata!=null&&n.state===`input-available`&&(n.callProviderMetadata=i.providerMetadata))}function g(e){var t,n;let i=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),a=e,o=i;i==null?r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:a.input,output:a.output,errorText:a.errorText,preliminary:a.preliminary,providerExecuted:a.providerExecuted,...a.providerMetadata==null?{}:{callProviderMetadata:a.providerMetadata}}):(i.state=e.state,o.toolName=e.toolName,o.input=a.input,o.output=a.output,o.errorText=a.errorText,o.rawInput=(t=a.rawInput)??o.rawInput,o.preliminary=a.preliminary,o.providerExecuted=(n=a.providerExecuted)??i.providerExecuted,a.providerMetadata!=null&&i.state===`input-available`&&(i.callProviderMetadata=a.providerMetadata))}async function _(e){if(e!=null){let n=r.message.metadata==null?e:zC(r.message.metadata,e);t!=null&&await ex({value:n,schema:t}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];t.text+=e.delta,t.providerMetadata=(l=e.providerMetadata)??t.providerMetadata,c();break}case`text-end`:{let t=r.activeTextParts[e.id];t.state=`done`,t.providerMetadata=(u=e.providerMetadata)??t.providerMetadata,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];t.text+=e.delta,t.providerMetadata=(d=e.providerMetadata)??t.providerMetadata,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];t.providerMetadata=(f=e.providerMetadata)??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(HC);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic},e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];t.text+=e.inputTextDelta;let{value:n}=await VC(t.text);t.dynamic?g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}):h({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}),c();break}case`tool-input-available`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break;case`tool-output-available`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:GC(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary})}c();break;case`tool-output-error`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:GC(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted})}c();break;case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts={},r.activeReasoningParts={};break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await _(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i?.(Error(e.errorText));break;default:if(RC(e)){n?.[e.type]!=null&&await ex({value:e.data,schema:n[e.type]});let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),c()}}s.enqueue(e)})}}))}async function JC({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t?.(e)}finally{n.releaseLock()}}var YC=Rb({prefix:`aitxt`,size:24}),XC=Rb({prefix:`aiobj`,size:24}),ZC=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}},QC=Rb({prefix:`aiobj`,size:24}),$C={};_S($C,{object:()=>tw,text:()=>ew});var ew=()=>({type:`text`,responseFormat:{type:`text`},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),tw=({schema:e})=>{let t=pS(e);return{type:`object`,responseFormat:{type:`json`,schema:t.jsonSchema},async parsePartial({text:e}){let t=await VC(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value};default:{let e=t.state;throw Error(`Unsupported parse state: ${e}`)}}},async parseOutput({text:e},n){let r=await nx({text:e});if(!r.success)throw new HS({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await tx({value:r.value,schema:t});if(!i.success)throw new HS({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}}},nw=`AI_NoSuchProviderError`,rw=`vercel.ai.error.${nw}`,iw=Symbol.for(rw),aw;aw=iw;async function ow(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e,r=await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{var n;t((n=e.target)?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)});return{type:`file`,mediaType:n,filename:t,url:r}}))}var sw=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var n,r,i,a,o;let s=await ix(this.body),c=await ix(this.headers),l=await ix(this.credentials),u={...Vb(c),...Vb(t.headers)},d=await(n=this.prepareSendMessagesRequest)?.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:u,credentials:l,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),f=(r=d?.api)??this.api,p=d?.headers===void 0?u:Vb(d.headers),m=d?.body===void 0?{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:d.body,h=(i=d?.credentials)??l,g=(a=this.fetch)??globalThis.fetch,_=await g(f,{method:`POST`,headers:Hb({"Content-Type":`application/json`,...p},`ai-sdk/${xC}`,Bb()),body:JSON.stringify(m),credentials:h,signal:e});if(!_.ok)throw Error((o=await _.text())??`Failed to fetch the chat response.`);if(!_.body)throw Error(`The response body is empty.`);return this.processResponseStream(_.body)}async reconnectToStream(e){var t,n,r,i,a;let o=await ix(this.body),s=await ix(this.headers),c=await ix(this.credentials),l={...Vb(s),...Vb(e.headers)},u=await(t=this.prepareReconnectToStreamRequest)?.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:l,credentials:c,requestMetadata:e.metadata}),d=(n=u?.api)??`${this.api}/${e.chatId}/stream`,f=u?.headers===void 0?l:Vb(u.headers),p=(r=u?.credentials)??c,m=(i=this.fetch)??globalThis.fetch,h=await m(d,{method:`GET`,headers:Hb(f,`ai-sdk/${xC}`,Bb()),credentials:p});if(h.status===204)return null;if(!h.ok)throw Error((a=await h.text())??`Failed to fetch the chat response.`);if(!h.body)throw Error(`The response body is empty.`);return this.processResponseStream(h.body)}},cw=class extends sw{constructor(e={}){super(e)}processResponseStream(e){return rx({stream:e,schema:LC}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},lw=class{constructor({generateId:e=zb,id:t=e(),transport:n=new cw,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new ZC,this.sendMessage=async(e,t)=>{var n,r,i,a;if(e==null){await this.makeRequest({trigger:`submit-message`,messageId:(n=this.lastMessage)?.id,...t});return}let o;if(`text`in e||`files`in e){let t=Array.isArray(e.files)?e.files:await ow(e.files);o={parts:[...t,...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}}else o=e;if(e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(this.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...o,id:e.messageId,role:(r=o.role)??`user`,metadata:e.metadata})}else this.state.pushMessage({...o,id:(i=o.id)??this.generateId(),role:(a=o.role)??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolOutput=async({state:e=`output-available`,tool:t,toolCallId:n,output:r,errorText:i})=>this.jobExecutor.run(async()=>{var t,a;let o=this.state.messages,s=o[o.length-1];this.state.replaceMessage(o.length-1,{...s,parts:s.parts.map(t=>WC(t)&&t.toolCallId===n?{...t,state:e,output:r,errorText:i}:t)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(t=>WC(t)&&t.toolCallId===n?{...t,state:e,output:r,errorText:i}:t)),this.status!==`streaming`&&this.status!==`submitted`&&(t=this.sendAutomaticallyWhen)?.call(this,{messages:this.state.messages})&&this.makeRequest({trigger:`submit-message`,messageId:(a=this.lastMessage)?.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;this.status!==`streaming`&&this.status!==`submitted`||(e=this.activeResponse)?.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a,o,s,c;this.setStatus({status:`submitted`,error:void 0});let l=this.lastMessage,u=!1,d=!1,f=!1;try{let a={state:KC({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};a.abortController.signal.addEventListener(`abort`,()=>{u=!0}),this.activeResponse=a;let o;if(e===`resume-stream`){let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(e==null){this.setStatus({status:`ready`});return}o=e}else o=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:a.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i});let s=e=>this.jobExecutor.run(()=>e({state:a.state,write:()=>{var e;this.setStatus({status:`streaming`});let t=a.state.message.id===(e=this.lastMessage)?.id;t?this.state.replaceMessage(this.state.messages.length-1,a.state.message):this.state.pushMessage(a.state.message)}}));await JC({stream:qC({stream:o,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:s,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:`ready`})}catch(e){if(u||e.name===`AbortError`)return u=!0,this.setStatus({status:`ready`}),null;f=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(d=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{(o=this.onFinish)==null||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:u,isDisconnect:d,isError:f,finishReason:(a=this.activeResponse)?.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}(s=this.sendAutomaticallyWhen)?.call(this,{messages:this.state.messages})&&!f&&await this.makeRequest({trigger:`submit-message`,messageId:(c=this.lastMessage)?.id,metadata:t,headers:n,body:r})}};function uw({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1).filter(WC).filter(e=>!e.providerExecuted);return r.length>0&&r.every(e=>e.state===`output-available`||e.state===`output-error`)}var dw=Zb(()=>lS(H_(L({id:P(),role:ev([`system`,`user`,`assistant`]),metadata:I().optional(),parts:H_(K_([L({type:R(`text`),text:P(),state:ev([`streaming`,`done`]).optional(),providerMetadata:Y.optional()}),L({type:R(`reasoning`),text:P(),state:ev([`streaming`,`done`]).optional(),providerMetadata:Y.optional()}),L({type:R(`source-url`),sourceId:P(),url:P(),title:P().optional(),providerMetadata:Y.optional()}),L({type:R(`source-document`),sourceId:P(),mediaType:P(),title:P(),filename:P().optional(),providerMetadata:Y.optional()}),L({type:R(`file`),mediaType:P(),filename:P().optional(),url:P(),providerMetadata:Y.optional()}),L({type:R(`step-start`)}),L({type:P().startsWith(`data-`),id:P().optional(),data:I()}),L({type:R(`dynamic-tool`),toolName:P(),toolCallId:P(),state:R(`input-streaming`),input:I().optional(),providerExecuted:F().optional(),output:B_().optional(),errorText:B_().optional()}),L({type:R(`dynamic-tool`),toolName:P(),toolCallId:P(),state:R(`input-available`),input:I(),providerExecuted:F().optional(),output:B_().optional(),errorText:B_().optional(),callProviderMetadata:Y.optional()}),L({type:R(`dynamic-tool`),toolName:P(),toolCallId:P(),state:R(`output-available`),input:I(),providerExecuted:F().optional(),output:I(),errorText:B_().optional(),callProviderMetadata:Y.optional(),preliminary:F().optional()}),L({type:R(`dynamic-tool`),toolName:P(),toolCallId:P(),state:R(`output-error`),input:I(),providerExecuted:F().optional(),output:B_().optional(),errorText:P(),callProviderMetadata:Y.optional()}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`input-streaming`),providerExecuted:F().optional(),input:I().optional(),output:B_().optional(),errorText:B_().optional(),approval:B_().optional()}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`input-available`),providerExecuted:F().optional(),input:I(),output:B_().optional(),errorText:B_().optional(),callProviderMetadata:Y.optional(),approval:B_().optional()}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`approval-requested`),input:I(),providerExecuted:F().optional(),output:B_().optional(),errorText:B_().optional(),callProviderMetadata:Y.optional(),approval:L({id:P(),approved:B_().optional(),reason:B_().optional()})}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`approval-responded`),input:I(),providerExecuted:F().optional(),output:B_().optional(),errorText:B_().optional(),callProviderMetadata:Y.optional(),approval:L({id:P(),approved:F(),reason:P().optional()})}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`output-available`),providerExecuted:F().optional(),input:I(),output:I(),errorText:B_().optional(),callProviderMetadata:Y.optional(),preliminary:F().optional(),approval:L({id:P(),approved:R(!0),reason:P().optional()}).optional()}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`output-error`),providerExecuted:F().optional(),input:I(),output:B_().optional(),errorText:P(),callProviderMetadata:Y.optional(),approval:L({id:P(),approved:R(!0),reason:P().optional()}).optional()}),L({type:P().startsWith(`tool-`),toolCallId:P(),state:R(`output-denied`),providerExecuted:F().optional(),input:I(),output:B_().optional(),errorText:B_().optional(),callProviderMetadata:Y.optional(),approval:L({id:P(),approved:R(!1),reason:P().optional()})})])).nonempty(`Message must contain at least one part`)})).nonempty(`Messages array must not be empty`))),fw=c((exports,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=a-r,s=t-o;s<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},s)}}t.exports=n});D();var pw=d(fw(),1),mw=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},X=(e,t,n)=>(mw(e,t,`read from private field`),n?n.call(e):t.get(e)),hw=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},gw=(e,t,n,r)=>(mw(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function _w(e,t){return t==null?e:(0,pw.default)(e,t)}var vw,yw,bw,xw,Sw,Cw,ww,Tw,Ew,Dw=class{constructor(e=[]){hw(this,vw,void 0),hw(this,yw,`ready`),hw(this,bw,void 0),hw(this,xw,new Set),hw(this,Sw,new Set),hw(this,Cw,new Set),this.pushMessage=e=>{gw(this,vw,X(this,vw).concat(e)),X(this,ww).call(this)},this.popMessage=()=>{gw(this,vw,X(this,vw).slice(0,-1)),X(this,ww).call(this)},this.replaceMessage=(e,t)=>{gw(this,vw,[...X(this,vw).slice(0,e),this.snapshot(t),...X(this,vw).slice(e+1)]),X(this,ww).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?_w(e,t):e;return X(this,xw).add(n),()=>{X(this,xw).delete(n)}},this[`~registerStatusCallback`]=e=>(X(this,Sw).add(e),()=>{X(this,Sw).delete(e)}),this[`~registerErrorCallback`]=e=>(X(this,Cw).add(e),()=>{X(this,Cw).delete(e)}),hw(this,ww,()=>{X(this,xw).forEach(e=>e())}),hw(this,Tw,()=>{X(this,Sw).forEach(e=>e())}),hw(this,Ew,()=>{X(this,Cw).forEach(e=>e())}),gw(this,vw,e)}get status(){return X(this,yw)}set status(e){gw(this,yw,e),X(this,Tw).call(this)}get error(){return X(this,bw)}set error(e){gw(this,bw,e),X(this,Ew).call(this)}get messages(){return X(this,vw)}set messages(e){gw(this,vw,[...e]),X(this,ww).call(this)}};vw=new WeakMap,yw=new WeakMap,bw=new WeakMap,xw=new WeakMap,Sw=new WeakMap,Cw=new WeakMap,ww=new WeakMap,Tw=new WeakMap,Ew=new WeakMap;var Ow,kw=class extends lw{constructor({messages:e,...t}){let n=new Dw(e);super({...t,state:n}),hw(this,Ow,void 0),this[`~registerMessagesCallback`]=(e,t)=>X(this,Ow)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>X(this,Ow)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>X(this,Ow)[`~registerErrorCallback`](e),gw(this,Ow,n)}};Ow=new WeakMap;function Aw({experimental_throttle:e,resume:t=!1,...n}={}){let r=bt(`chat`in n?n.chat:new kw(n)),i=`chat`in n&&n.chat!==r.current||`id`in n&&r.current.id!==n.id;i&&(r.current=`chat`in n?n.chat:new kw(n));let a=Ct(t=>r.current[`~registerMessagesCallback`](t,e),[e,r.current.id]),o=Qt(a,()=>r.current.messages,()=>r.current.messages),s=Qt(r.current[`~registerStatusCallback`],()=>r.current.status,()=>r.current.status),c=Qt(r.current[`~registerErrorCallback`],()=>r.current.error,()=>r.current.error),l=Ct(e=>{typeof e==`function`&&(e=e(r.current.messages)),r.current.messages=e},[r]);return E(()=>{t&&r.current.resumeStream()},[t,r]),{id:r.current.id,messages:o,setMessages:l,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:c,resumeStream:r.current.resumeStream,status:s,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput}}Ie();var jw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Mw=0,Nw=Array.isArray;function Z(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Mw,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return w.vnode&&w.vnode(l),l}let Pw=new Set([`AI-203`,`AI-205`,`AI-224`,`AI-225`]),Fw=`Could not complete response due to token output limits`;function Iw(e){if(e==null)return``;if(e instanceof Error){let t=e.message??``,n=e.cause;if(n instanceof Error){let e=n.message??``;e&&!t.includes(e)&&(t=t?`${t} ${e}`:e)}else typeof n==`string`&&n&&!t.includes(n)&&(t=t?`${t} ${n}`:n);return t}return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:``}function Lw(e,t){for(let[n,r]of Object.entries(e))if(n.toLowerCase()===t.toLowerCase()&&typeof r==`string`&&r.trim()!==``)return r.trim()}function Rw(e){let t=/\b(AI-\d{3})\b/i.exec(e);if(t)return t[1].toUpperCase();try{let t=JSON.parse(e),n=t.code??t.errorCode;if(typeof n==`string`&&/AI-\d{3}/i.test(n))return n.trim().toUpperCase()}catch{}}function zw(e){return e?e.toUpperCase().includes(`AI-217`)?!0:/conversation\s+depth/i.test(e):!1}function Bw(e){if(zw(e))return!0;try{let t=JSON.parse(e),n=t.code??t.errorCode;if(typeof n==`string`&&n.toUpperCase()===`AI-217`)return!0;let r=typeof t.message==`string`?t.message:``;return zw(r)}catch{return!1}}function Vw(e){return Bw(Iw(e))}function Hw(e){return/\brequest blocked for this domain\b/.test(e)||/\bblocked for this domain\b/.test(e)}function Uw(e){let t=e;return/\bstep limit\b/.test(t)||/\bmax steps\b/.test(t)||/\bmax step\b/.test(t)||/\bmaximum steps\b/.test(t)||/\bmaximum step\b/.test(t)||/\bmax agent steps\b/.test(t)||/\bmax agent step\b/.test(t)||/\bmaximum agent steps\b/.test(t)||/\bmaximum agent step\b/.test(t)||/\bmax steps per completion\b/.test(t)||/\bsteps per completion limit\b/.test(t)}function Ww(e){return/\b429\b/.test(e)||/\brate\s*limit/i.test(e)||/\btoo\s+many\s+attempts\b/.test(e)||/\btoo_many_requests\b/.test(e)}function Gw(e){return/\bTokenOutputLimitError\b/i.test(e)}function Kw(e){return/\bwhitelist(ed)?\b/.test(e)||/\bnot\s+allowed\s+for\s+this\s+domain\b/.test(e)}function qw(e){let t=e;return/\bcontext\s+length\b/.test(t)||/\bmax tokens\b/.test(t)||/\bmax token\b/.test(t)||/\bmaximum tokens\b/.test(t)||/\bmaximum token\b/.test(t)||/\btoken\s+limit\b/.test(t)||/\btoken\s+output\b/.test(t)||/\boutput\s+limits?\b/.test(t)}function Jw(e){let t=Lw(e,`message`)??``;return Hw(t.toLowerCase())}function Yw(e){let t=typeof e.type==`string`?e.type:``;if(/tokenoutput|outputlimit|steplimit|maxstep|ratelimit|domainnotallowed/i.test(t))return!0;let n=Lw(e,`error`)??``;if(n.toUpperCase()===`TOO_MANY_REQUESTS`||/token output|output limits|token limits|rate limit|whitelist|step limit|max steps|could not complete response due to token/i.test(n))return!0;let r=Lw(e,`message`)??``;if(/rate limit exceeded|retry after \d+/i.test(r)||/whitelist/i.test(r))return!0;let i=r.toLowerCase(),a=i.indexOf(`not allowed`);return a!==-1&&i.indexOf(`domain`,a)!==-1}function Xw(e){let t=e,n=t.toLowerCase(),r=null;try{let e=JSON.parse(t);e&&typeof e==`object`&&!Array.isArray(e)&&(r=e)}catch{}return{message:t,messageLower:n,parsedJson:r,extractedCodeUpper:Rw(t)}}let Zw=[{matches:e=>typeof e.extractedCodeUpper==`string`&&Pw.has(e.extractedCodeUpper)},{matches:e=>e.parsedJson!==null&&Jw(e.parsedJson),showNewConversationLink:!1},{matches:e=>e.parsedJson!==null&&Yw(e.parsedJson)},{matches:e=>Gw(e.message),showNewConversationLink:!1},{matches:e=>Ww(e.messageLower)},{matches:e=>Hw(e.messageLower),showNewConversationLink:!1},{matches:e=>Kw(e.messageLower)},{matches:e=>qw(e.messageLower)},{matches:e=>Uw(e.messageLower)}];function Qw(e){let t=Xw(e),n=Zw.filter(e=>e.matches(t));if(n.length===0)return{blocking:!1,showNewConversationLink:!0};let r=n.every(e=>e.showNewConversationLink!==!1);return{blocking:!0,showNewConversationLink:r}}function $w(e){return Qw(e).blocking}function eT(e,t=!1){return e==null?!1:Vw(e)?!0:t?$w(Iw(e)):!1}function tT(e){let t=Iw(e);if(/TokenOutputLimitError/i.test(t)||/could not complete response due to token output limits/i.test(t))return!0;try{let e=JSON.parse(t);if(typeof e.type==`string`&&/^TokenOutputLimitError$/i.test(e.type.trim())||typeof e.error==`string`&&/token output limits/i.test(e.error))return!0}catch{}return!1}function nT(e,t=!1){return e==null?!0:tT(e)?!1:Vw(e)||!t?!0:Qw(Iw(e)).showNewConversationLink}function rT(e){return e.replace(/\s*\(AI-\d{3}\)\s*$/i,``).trim()}function iT(e){let t=e.trim();return t.startsWith(`{`)&&t.endsWith(`}`)}function aT(e){let t=e.trim();if(!t)return;let n=0;for(;n<10;){n+=1;try{let e=JSON.parse(t);if(typeof e==`string`){let n=e.trim();if(!n)return;t=n}else if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e,n=Lw(t,`message`);if(n)return n;let r=Lw(t,`error`);return r||void 0}else return}catch{if(/\\"/.test(t))t=t.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim();else{let e=/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t);if(e?.[1])return e[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim();let n=/"error"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t);return n?.[1]?n[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim():void 0}}}}function oT(e){if(e==null)return!1;let t=Iw(e),n=t.toLowerCase();if(Hw(n))return!0;let r=aT(t.trim());if(r&&Hw(r.toLowerCase()))return!0;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)&&Jw(e))return!0}catch{}return!1}function sT(e){if(e==null)return;let t=Iw(e),n=aT(t);if(n)return n;let r=rT(t.trim());return r===``?void 0:r}function cT(e,t=!1){if(eT(e,t)){if(tT(e)){let t=sT(e);return t&&!iT(t)?t:Fw}return sT(e)}}function lT(e,t){if(!t||!eT(e,t))return!1;let n=Iw(e).toLowerCase();if(Uw(n)||tT(e))return!0;let r=cT(e,t);return r&&/could not complete response due to token output limits/i.test(r)||r&&Uw(r.toLowerCase())?!0:!nT(e,t)}let uT=({onNewChat:e,detailMessage:t,showNewConversationLink:n=!0})=>Z(`div`,{className:`ss-thread-depth-error-banner`,children:[t?Z(`p`,{className:`ss-thread-depth-error-detail`,children:t}):null,n?Z(`p`,{className:`ss-thread-depth-error-main`,children:[e?Z(`button`,{type:`button`,className:`ss-thread-depth-error-link`,onClick:e,children:`Start a new conversation`}):Z(`span`,{className:`ss-thread-depth-error-cta`,children:`Start a new conversation`}),` `,`to continue.`]}):null]});D();let dT=`https://askai.algolia.com`,fT=e=>`https://${e}.algolia.net/agent-studio/1`;function pT(e){return e.agentStudio?`${fT(e.applicationId)}/agents/${e.assistantId}/completions?stream=true&compatibilityMode=ai-sdk-5`:`${dT}/chat`}function mT(e){if(!e)throw Error(`config is required for useAskai`);let[t,n]=T(()=>zb()),r=St(()=>new cw({api:pT(e),headers:async()=>{if(e.agentStudio)return{"x-algolia-api-key":e.apiKey,"x-algolia-application-id":e.applicationId};let t=await yT({assistantId:e.assistantId});return{"x-algolia-api-key":e.apiKey,"x-algolia-application-id":e.applicationId,"x-algolia-index-name":e.indexName,"x-algolia-assistant-id":e.assistantId,"x-ai-sdk-version":`v5`,authorization:`TOKEN ${t}`}}}),[e.apiKey,e.applicationId,e.indexName,e.assistantId,e.agentStudio,e]),i=Aw({id:t,transport:r,sendAutomaticallyWhen:uw}),a=bt(i);a.current=i;let o=Ct(()=>{a.current.stop(),a.current.clearError(),n(zb())},[]),s=i.status===`submitted`||i.status===`streaming`,c=!!e.agentStudio,l=St(()=>i.status===`error`&&eT(i.error,c),[i.status,i.error,c]),u=St(()=>l&&(Vw(i.error)?i.messages.some(e=>e.role===`assistant`):!0),[l,i.error,i.messages]);return{...i,startNewConversation:o,isGenerating:s,promptBlockingError:l,showPromptBlockingError:u}}let hT=`askai_token`,gT=e=>{let[t]=e.split(`.`);return JSON.parse(atob(t))},_T=e=>{if(!e)return!0;try{let{exp:t}=gT(e);return Date.now()/1e3>t-30}catch{return!0}},vT=null,yT=async({assistantId:e})=>{let t=sessionStorage.getItem(hT);return _T(t)?(vT||=fetch(`${dT}/chat/token`,{method:`POST`,headers:{"x-algolia-assistant-id":e,"content-type":`application/json`}}).then(e=>e.json()).then(({token:e})=>(sessionStorage.setItem(hT,e),e)).finally(()=>{vT=null}),vT):t},bT=({agentId:e,vote:t,messageId:n,appId:r,apiKey:i})=>{let a=new Headers;a.set(`x-algolia-application-id`,r),a.set(`x-algolia-api-key`,i),a.set(`content-type`,`application/json`);let o=`${fT(r)}/feedback`;return fetch(o,{method:`POST`,body:JSON.stringify({messageId:n,agentId:e,vote:t}),headers:a})},xT=async({assistantId:e,thumbs:t,messageId:n,appId:r})=>{let i=new Headers;i.set(`x-algolia-assistant-id`,e),i.set(`content-type`,`application/json`);let a=await yT({assistantId:e});return i.set(`authorization`,`TOKEN ${a}`),fetch(`${dT}/chat/feedback`,{method:`POST`,body:JSON.stringify({appId:r,messageId:n,thumbs:t}),headers:i})},ST=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Z(`path`,{d:`M7 10v12`}),Z(`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`})]}),CT=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Z(`path`,{d:`M17 14V2`}),Z(`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`})]}),wT=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Z(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),Z(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]}),TT=({size:e=24,className:t,gradientIdSuffix:n=``})=>{let r=e=>`${e}${n}`;return Z(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:t,"aria-hidden":!0,children:[Z(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 1.5a.5.5 0 0 1 .475.344L9.75 5.719a.833.833 0 0 0 .53.531l3.876 1.275a.5.5 0 0 1 0 .95L10.281 9.75a.833.833 0 0 0-.531.53l-1.275 3.876a.5.5 0 0 1-.95 0L6.25 10.281a.833.833 0 0 0-.53-.531L1.843 8.475a.5.5 0 0 1 0-.95L5.719 6.25a.833.833 0 0 0 .531-.53l1.275-3.876A.5.5 0 0 1 8 1.5Zm-.8 4.532A1.833 1.833 0 0 1 6.032 7.2L3.6 8l2.432.8A1.833 1.833 0 0 1 7.2 9.968L8 12.4l.8-2.432A1.833 1.833 0 0 1 9.968 8.8L12.4 8l-2.432-.8A1.833 1.833 0 0 1 8.8 6.032L8 3.6l-.8 2.432Z`,fill:`url(#${r(`8aa5f4b5___a`)})`}),Z(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.333 1.5a.5.5 0 0 1 .5.5v2.667a.5.5 0 1 1-1 0V2a.5.5 0 0 1 .5-.5Z`,fill:`url(#${r(`8aa5f4b5___b`)})`}),Z(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.667 10.833a.5.5 0 0 1 .5.5V14a.5.5 0 0 1-1 0v-2.667a.5.5 0 0 1 .5-.5Z`,fill:`url(#${r(`8aa5f4b5___c`)})`}),Z(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 3.333a.5.5 0 0 1 .5-.5h2.667a.5.5 0 0 1 0 1H2a.5.5 0 0 1-.5-.5Z`,fill:`url(#${r(`8aa5f4b5___d`)})`}),Z(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.833 12.667a.5.5 0 0 1 .5-.5H14a.5.5 0 1 1 0 1h-2.667a.5.5 0 0 1-.5-.5Z`,fill:`url(#${r(`8aa5f4b5___e`)})`}),Z(`defs`,{children:[Z(`linearGradient`,{id:r(`8aa5f4b5___a`),x1:`15.03`,y1:`8`,x2:`2.03`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[Z(`stop`,{offset:`0.15`,stopColor:`#8E00FC`}),Z(`stop`,{offset:`1`,stopColor:`#003DFF`})]}),Z(`linearGradient`,{id:r(`8aa5f4b5___b`),x1:`15.03`,y1:`8`,x2:`2.03`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[Z(`stop`,{offset:`0.15`,stopColor:`#8E00FC`}),Z(`stop`,{offset:`1`,stopColor:`#003DFF`})]}),Z(`linearGradient`,{id:r(`8aa5f4b5___c`),x1:`15.03`,y1:`8`,x2:`2.03`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[Z(`stop`,{offset:`0.15`,stopColor:`#8E00FC`}),Z(`stop`,{offset:`1`,stopColor:`#003DFF`})]}),Z(`linearGradient`,{id:r(`8aa5f4b5___d`),x1:`15.03`,y1:`8`,x2:`2.03`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[Z(`stop`,{offset:`0.15`,stopColor:`#8E00FC`}),Z(`stop`,{offset:`1`,stopColor:`#003DFF`})]}),Z(`linearGradient`,{id:r(`8aa5f4b5___e`),x1:`15.03`,y1:`8`,x2:`2.03`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[Z(`stop`,{offset:`0.15`,stopColor:`#8E00FC`}),Z(`stop`,{offset:`1`,stopColor:`#003DFF`})]})]})]})},ET=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:t,width:e,height:e,children:[Z(`circle`,{cx:`11`,cy:`11`,r:`8`,stroke:t,fill:`none`,strokeWidth:`1.4`}),Z(`path`,{d:`m21 21-4.3-4.3`,stroke:t,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),DT=({size:e=24,color:t=`currentColor`,className:n})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:t,width:e,height:e,className:n,children:Z(`path`,{fill:t,d:`M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11z`})}),OT=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[` `,Z(`path`,{d:`M18 6 6 18`}),Z(`path`,{d:`m6 6 12 12`})]}),kT=({size:e=150})=>Z(`svg`,{width:`80`,height:`24`,"aria-label":`Algolia`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 2196.2 500`,style:{maxWidth:e},children:[Z(`defs`,{children:Z(`style`,{children:`.cls-1,.cls-2{fill:#003dff}.cls-2{fillRule:evenodd}`})}),Z(`path`,{className:`cls-2`,d:`M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z`}),Z(`rect`,{className:`cls-1`,x:`1845.88`,y:`104.73`,width:`62.58`,height:`277.9`,rx:`5.9`,ry:`5.9`}),Z(`path`,{className:`cls-2`,d:`M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z`}),Z(`path`,{className:`cls-2`,d:`M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z`}),Z(`path`,{className:`cls-2`,d:`M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z`}),Z(`path`,{className:`cls-2`,d:`M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z`}),Z(`path`,{className:`cls-2`,d:`M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z`}),Z(`path`,{className:`cls-2`,d:`M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z`}),Z(`path`,{className:`cls-1`,d:`M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z`})]}),AT=({size:e=20,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 20 20`,children:Z(`path`,{fill:t,d:`m14.878.282l.348 1.071a2.2 2.2 0 0 0 1.399 1.397l1.071.348l.021.006a.423.423 0 0 1 0 .798l-1.071.348a2.2 2.2 0 0 0-1.399 1.397l-.348 1.07a.423.423 0 0 1-.798 0l-.349-1.07a2.2 2.2 0 0 0-.532-.867a2.2 2.2 0 0 0-.866-.536l-1.071-.348a.423.423 0 0 1 0-.798l1.071-.348a2.2 2.2 0 0 0 1.377-1.397l.348-1.07a.423.423 0 0 1 .799 0m4.905 7.931l-.766-.248a1.58 1.58 0 0 1-.998-.999l-.25-.764a.302.302 0 0 0-.57 0l-.248.764a1.58 1.58 0 0 1-.984.999l-.765.248a.303.303 0 0 0 0 .57l.765.249a1.58 1.58 0 0 1 1 1.002l.248.764a.302.302 0 0 0 .57 0l.249-.764a1.58 1.58 0 0 1 .999-.999l.765-.248a.303.303 0 0 0 0-.57zM16.97 11.89a1.46 1.46 0 0 0 1.013.038q.016.158.016.32a3.25 3.25 0 0 1-2.575 3.178l-.037.185A2.973 2.973 0 0 1 10 16.678a2.973 2.973 0 0 1-5.388-1.068l-.037-.185a3.248 3.248 0 0 1-.77-6.088A2.5 2.5 0 0 1 3 7.5v-.198a2.7 2.7 0 0 1 2.169-2.646l.406-.08l.125-.628a2.423 2.423 0 0 1 4.3-1a2.4 2.4 0 0 1 .293-.318l-.033.045c-.17.24-.26.52-.26.821s.09.581.26.821q.104.147.24.265v10.445a1.973 1.973 0 0 0 3.907.387l.103-.512a.5.5 0 0 1 .392-.392l.291-.059a2.25 2.25 0 0 0 1.778-2.562M9.5 15.027V4.423a1.423 1.423 0 0 0-2.819-.279l-.19.954a.5.5 0 0 1-.393.392l-.733.147A1.7 1.7 0 0 0 4 7.302V7.5A1.5 1.5 0 0 0 5.5 9a.5.5 0 0 1 0 1h-.252a2.248 2.248 0 0 0-.441 4.451l.291.059a.5.5 0 0 1 .392.392l.103.512a1.973 1.973 0 0 0 3.907-.387`})}),jT=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Z(`path`,{d:`M20 6 9 17l-5-5`})}),MT=({size:e=24,color:t=`currentColor`})=>Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Z(`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),Z(`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`})]});function NT(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var PT=NT();function FT(e){PT=e}var IT={exec:()=>null};function Q(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(LT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var LT={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},RT=/^(?:[ \t]*(?:\n|$))+/,zT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,BT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,VT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,HT=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,UT=/(?:[*+-]|\d{1,9}[.)])/,WT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,GT=Q(WT).replace(/bull/g,UT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),KT=Q(WT).replace(/bull/g,UT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qT=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,JT=/^[^\n]+/,YT=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,XT=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,YT).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ZT=Q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,UT).getRegex(),QT=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,$T=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,eE=Q(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,$T).replace(`tag`,QT).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tE=Q(qT).replace(`hr`,VT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,QT).getRegex(),nE=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,tE).getRegex(),rE={blockquote:nE,code:zT,def:XT,fences:BT,heading:HT,hr:VT,html:eE,lheading:GT,list:ZT,newline:RT,paragraph:tE,table:IT,text:JT},iE=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,VT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,QT).getRegex(),aE={...rE,lheading:KT,table:iE,paragraph:Q(qT).replace(`hr`,VT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,iE).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,QT).getRegex()},oE={...rE,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,$T).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:IT,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(qT).replace(`hr`,VT).replace(`heading`,` *#{1,6} *[^
]`).replace(`lheading`,GT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},sE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lE=/^( {2,}|\\)\n(?!\s*$)/,uE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,dE=/[\p{P}\p{S}]/u,fE=/[\s\p{P}\p{S}]/u,pE=/[^\s\p{P}\p{S}]/u,mE=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,fE).getRegex(),hE=/(?!~)[\p{P}\p{S}]/u,gE=/(?!~)[\s\p{P}\p{S}]/u,_E=/(?:[^\s\p{P}\p{S}]|~)/u,vE=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,yE=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,bE=Q(yE,`u`).replace(/punct/g,dE).getRegex(),xE=Q(yE,`u`).replace(/punct/g,hE).getRegex(),SE=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,CE=Q(SE,`gu`).replace(/notPunctSpace/g,pE).replace(/punctSpace/g,fE).replace(/punct/g,dE).getRegex(),wE=Q(SE,`gu`).replace(/notPunctSpace/g,_E).replace(/punctSpace/g,gE).replace(/punct/g,hE).getRegex(),TE=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,pE).replace(/punctSpace/g,fE).replace(/punct/g,dE).getRegex(),EE=Q(/\\(punct)/,`gu`).replace(/punct/g,dE).getRegex(),DE=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),OE=Q($T).replace(`(?:-->|$)`,`-->`).getRegex(),kE=Q(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,OE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),AE=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,jE=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,AE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ME=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,AE).replace(`ref`,YT).getRegex(),NE=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,YT).getRegex(),PE=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ME).replace(`nolink`,NE).getRegex(),FE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,IE={_backpedal:IT,anyPunctuation:EE,autolink:DE,blockSkip:vE,br:lE,code:cE,del:IT,emStrongLDelim:bE,emStrongRDelimAst:CE,emStrongRDelimUnd:TE,escape:sE,link:jE,nolink:NE,punctuation:mE,reflink:ME,reflinkSearch:PE,tag:kE,text:uE,url:IT},LE={...IE,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,AE).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,AE).getRegex()},RE={...IE,emStrongRDelimAst:wE,emStrongLDelim:xE,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,FE).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,FE).getRegex()},zE={...RE,br:Q(lE).replace(`{2,}`,`*`).getRegex(),text:Q(RE.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},BE={normal:rE,gfm:aE,pedantic:oE},VE={normal:IE,gfm:RE,breaks:zE,pedantic:LE},HE={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},UE=e=>HE[e];function WE(e,t){if(t){if(LT.escapeTest.test(e))return e.replace(LT.escapeReplace,UE)}else if(LT.escapeTestNoEncode.test(e))return e.replace(LT.escapeReplaceNoEncode,UE);return e}function GE(e){try{e=encodeURI(e).replace(LT.percentDecode,`%`)}catch{return null}return e}function KE(e,t){let n=e.replace(LT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}),r=n.split(LT.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push(``);for(;i<r.length;i++)r[i]=r[i].trim().replace(LT.slashPipe,`|`);return r}function qE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function JE(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function YE(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function XE(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
`)}var ZE=class{options;rules;lexer;constructor(e){this.options=e||PT}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:qE(e,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=XE(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=qE(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:qE(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=qE(t[0],`
`).split(`
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
${s}`:s,r=r?`${r}
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=KE(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(KE(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=qE(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=JE(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),YE(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `),r=t[e.toLowerCase()];if(!r){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return YE(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},QE=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||PT,this.options.tokenizer=this.options.tokenizer||new ZE,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:LT,block:BE.normal,inline:VE.normal};this.options.pedantic?(t.block=BE.pedantic,t.inline=VE.pedantic):this.options.gfm&&(t.block=BE.gfm,this.options.breaks?t.inline=VE.breaks:t.inline=VE.gfm),this.tokenizer.rules=t}static get rules(){return{block:BE,inline:VE}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(LT.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(LT.tabCharGlobal,` `).replace(LT.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
`)?``:`
`)+r.raw,a.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},$E=class{options;parser;constructor(e){this.options=e||PT}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(LT.notSpaceStart)?.[0],i=e.replace(LT.endingNewline,``)+`
`;return r?`<pre><code class="language-`+WE(r)+`">`+(n?i:WE(i,!0))+`</code></pre>
`:`<pre><code>`+(n?i:WE(i,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
`+r+`</`+i+`>
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+WE(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${WE(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=GE(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+WE(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=GE(e);if(i===null)return WE(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${WE(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:WE(e.text)}},eD=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},tD=class e{options;renderer;textRenderer;constructor(e){this.options=e||PT,this.options.renderer=this.options.renderer||new $E,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new eD}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`def`:n+=this.renderer.def(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},nD=class{options;block;constructor(e){this.options=e||PT}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?QE.lex:QE.lexInline}provideParser(){return this.block?tD.parse:tD.parseInline}},rD=class{defaults=NT();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=tD;Renderer=$E;TextRenderer=eD;Lexer=QE;Tokenizer=ZE;Hooks=nD;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new $E(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ZE(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new nD;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];nD.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&nD.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return QE.lex(e,t??this.defaults)}parser(e,t){return tD.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?QE.lex:QE.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?tD.parse:tD.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?QE.lex:QE.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?tD.parse:tD.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+WE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},iD=new rD;function $(e,t){return iD.parse(e,t)}$.options=$.setOptions=function(e){return iD.setOptions(e),$.defaults=iD.defaults,FT($.defaults),$},$.getDefaults=NT,$.defaults=PT,$.use=function(...e){return iD.use(...e),$.defaults=iD.defaults,FT($.defaults),$},$.walkTokens=function(e,t){return iD.walkTokens(e,t)},$.parseInline=iD.parseInline,$.Parser=tD,$.parser=tD.parse,$.Renderer=$E,$.TextRenderer=eD,$.Lexer=QE,$.lexer=QE.lex,$.Tokenizer=ZE,$.Hooks=nD,$.parse=$;var aD=$.options,oD=$.setOptions,sD=$.use,cD=$.walkTokens,lD=$.parseInline,uD=$,dD=tD.parse,fD=QE.lex;function pD(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function mD(e){let t=e;for(let e=0;e<3;e+=1)try{let e=decodeURIComponent(t);if(e===t)break;t=e}catch{break}return t}function hD(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r>32&&r!==127&&(t+=e.charAt(n))}return t}function gD(e){if(!e)return``;let t=e.trim();if(!t)return``;let n=hD(mD(t)).replace(/\\/g,`/`);if(!n||n.startsWith(`//`))return``;if(!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return t;try{let e=new URL(n);if(e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`)return t}catch{return``}return``}function _D(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,`�`)}function vD(e){return typeof e==`string`?_D(e):``}function yD(e){let t=_D(e);try{return encodeURIComponent(t)}catch{return``}}let bD=new $.Renderer;bD.code=({text:e,lang:t=``,escaped:n})=>{let r=/^[a-zA-Z0-9_-]+$/.test(t)?t:``,i=r?`language-${r}`:``,a=n?e:pD(e),o=yD(e),s=[`<svg class="ss-markdown-copy-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">`,`<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>`,`<path d="m5 15-4-4 4-4"></path>`,`</svg>`].join(``),c=[`<svg class="ss-markdown-check-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">`,`<polyline points="20,6 9,17 4,12"></polyline>`,`</svg>`].join(``);return[`<div class="ss-markdown-code-snippet">`,`<button class="ss-markdown-copy-button" data-code="`+o+`" aria-label="Copy code to clipboard" title="Copy code">`,s,c,`<span class="ss-markdown-copy-label">Copy</span>`,`</button>`,`<pre><code class="`+i+`">`+a+`</code></pre>`,`</div>`].join(``)},bD.link=({href:e,title:t,text:n})=>{let r=pD(gD(e)),i=pD(n);if(!r)return i;let a=t?` title="`+pD(t)+`"`:``;return`<a href="`+r+`" target="_blank" rel="noopener noreferrer"`+a+`>`+i+`</a>`},bD.image=({href:e,title:t,text:n})=>{let r=pD(gD(e));if(!r)return pD(n);let i=t?` title="`+pD(t)+`"`:``;return`<img src="`+r+`" alt="`+pD(n)+`"`+i+` />`},bD.html=({text:e})=>pD(e);function xD(e){let t=vD(e);try{return $.parse(t,{gfm:!0,breaks:!0,renderer:bD})}catch(e){return console.error(`Error parsing markdown:`,e),pD(t)}}D();let SD=an(function({children:e,className:t=``}){let n=bt(null),r=St(()=>xD(e),[e]);return E(()=>{let e=n.current;if(!e)return;let t=async e=>{let t=e.target,n=t.closest(`.ss-markdown-copy-button`);if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.getAttribute(`data-code`);if(r)try{let e=decodeURIComponent(r);await navigator.clipboard.writeText(e),n.classList.add(`ss-markdown-copied`),setTimeout(()=>{n.classList.remove(`ss-markdown-copied`)},2e3)}catch(e){console.error(`Failed to copy code:`,e)}};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}},[r]),Z(`div`,{ref:n,className:`ss-markdown-content ${t}`.trim(),dangerouslySetInnerHTML:{__html:r}})});D();function CD(){let e=Ct(async e=>{try{await navigator.clipboard.writeText(e)}catch{}},[]);return{copyText:e}}let wD=an(function({messages:e,error:t,isGenerating:n,onCopy:r,onThumbsUp:i,onThumbsDown:a,applicationId:o,apiKey:s,assistantId:c,agentStudio:l,suggestedQuestions:u,onSuggestedQuestionClick:d,onNewChat:f,showPromptBlockingError:p=!1,threadDepthBannerInChat:m=!0,showAiDisclaimer:h=!0,newestExchangeFirst:g=!0}){let{copyText:_}=CD(),v=bt(null),y=bt(!0),[b,x]=T(null),S=bt(null),[C,ee]=T(new Set),[te,ne]=T(null),re=async(e,t)=>{if(!e.assistantMessage)return;let n=t===1?i:a;try{ne(e.id),n?await n(e.userMessage.id):l?s&&await bT({agentId:c,vote:t,messageId:e.assistantMessage.id,appId:o,apiKey:s}):await xT({assistantId:c,appId:o,messageId:e.userMessage.id,thumbs:t}),ee(t=>{let n=new Set(t);return n.add(e.id),n})}catch{}finally{ne(null)}},ie=St(()=>{let t=[];for(let n=0;n<e.length;n++){let r=e.at(n);if(r&&r.role===`user`){let i=r,a=e.at(n+1);a?.role===`assistant`?(t.push({id:i.id,userMessage:i,assistantMessage:a}),n++):t.push({id:i.id,userMessage:i,assistantMessage:null})}}return t},[e]),ae=St(()=>g?[...ie].reverse():ie,[ie,g]),oe=Ct(()=>{if(g)return;let e=v.current;if(!e)return;let t=80,n=e.scrollHeight-e.scrollTop-e.clientHeight;y.current=n<t},[g]);return yt(()=>{if(g)return;let e=v.current;e&&(y.current&&(e.scrollTop=e.scrollHeight),oe())},[g,e,n,ae.length,oe]),E(()=>()=>{S.current&&window.clearTimeout(S.current)},[]),Z(`div`,{className:`ss-chat-root`,ref:v,onScroll:oe,children:Z(`div`,{className:`ss-qa-list`,children:[ie.length===0?Z(`div`,{className:`ss-chat-welcome`,children:[Z(`h2`,{className:`ss-chat-welcome-title`,children:`How can I help you today?`}),Z(`p`,{className:`ss-chat-welcome-subtitle`,children:`I search through your content to help you find answers to your questions, fast.`}),u&&u.length>0?Z(`div`,{className:`ss-suggested-questions`,children:u.map(e=>Z(`button`,{type:`button`,className:`ss-suggested-question-btn`,disabled:n,onClick:()=>{n||d?.(e.question)},children:e.question},e.objectID))}):null]}):null,m&&p?Z(uT,{onNewChat:f,detailMessage:cT(t,l),showNewConversationLink:nT(t,l)}):null,h?Z(`p`,{className:`ss-hint`,children:`Answers are generated with AI which can make mistakes.`}):null,t&&!eT(t,!!l)&&Z(`div`,{className:`ss-error-banner`,children:t.message}),ae.map((e,t)=>{let i=g?t===0:t===ae.length-1;return Z(`article`,{className:`ss-qa-card`,children:[Z(`div`,{className:`ss-qa-header`,children:Z(`div`,{className:`ss-qa-question`,children:e.userMessage.parts.map((e,t)=>e.type===`text`?Z(`span`,{children:typeof e.text==`string`?e.text:``},t):null)})}),Z(`div`,{className:`ss-qa-answer`,children:Z(`div`,{className:`ss-qa-answer-content`,children:e.assistantMessage?Z(`div`,{className:`ss-qa-markdown`,children:e.assistantMessage.parts.map((e,t)=>{if(typeof e==`string`)return Z(`p`,{children:e},`${t}`);if(e.type===`text`){let n=typeof e.text==`string`?e.text:``;return Z(SD,{children:n},`${t}`)}else if(e.type===`reasoning`&&e.state===`streaming`)return Z(`p`,{className:`ss-tool-info`,children:[Z(AT,{}),` `,Z(`span`,{className:`ss-shimmer-text`,children:`Reasoning...`})]},`${t}`);else if(e.type===`tool-searchIndex`)return e.state===`input-streaming`?Z(`p`,{className:`ss-tool-info`,children:[Z(ET,{size:18}),` `,Z(`span`,{className:`ss-shimmer-text`,children:`Searching...`})]},`${t}`):e.state===`input-available`?Z(`p`,{className:`ss-tool-info`,children:[Z(ET,{size:18}),` `,Z(`span`,{className:`ss-shimmer-text`,children:[`Looking for`,` `,Z(`mark`,{children:[`"`,e.input?.query||``,`"`]})]})]},`${t}`):e.state===`output-available`?Z(`p`,{className:`ss-tool-info`,children:[Z(ET,{size:18}),` `,Z(`span`,{children:[`Searched for`,` `,Z(`mark`,{children:[`"`,e.output?.query,`"`]}),` `,`found`,` `,Array.isArray(e.output?.hits)?e.output.hits.length:`no`,` `,`results`]})]},`${t}`):e.state===`output-error`?Z(`p`,{className:`ss-tool-info`,children:e.errorText},`${t}`):null;else return null})}):Z(`div`,{className:`ss-qa-markdown ss-qa-generating ss-shimmer-text`,children:n&&i?`Thinking...`:``})})}),Z(`div`,{className:`ss-qa-actions`,children:[e.assistantMessage&&!n?C.has(e.id)?Z(`span`,{className:`ss-qa-feedback-ack ss-fade`,children:`Thanks for your feedback!`}):te===e.id?Z(`span`,{className:`ss-qa-feedback-ack ss-shimmer-text`,children:`Submitting...`}):Z(`div`,{className:`ss-qa-actions-group`,children:[Z(`button`,{type:`button`,title:`Like`,"aria-label":`Like`,className:`ss-qa-action-btn`,disabled:!e.assistantMessage||te===e.id,onClick:()=>re(e,1),children:Z(ST,{size:18})}),Z(`button`,{type:`button`,title:`Dislike`,"aria-label":`Dislike`,className:`ss-qa-action-btn`,disabled:!e.assistantMessage||te===e.id,onClick:()=>re(e,0),children:Z(CT,{size:18})})]}):null,Z(`button`,{type:`button`,className:`ss-qa-action-btn ${b===e.id?`is-copied`:``}`,"aria-label":b===e.id?`Copied`:`Copy answer`,title:b===e.id?`Copied`:`Copy answer`,disabled:!e.assistantMessage||b===e.id,onClick:async()=>{let t=e.assistantMessage?.parts??[],n=t.flatMap(e=>e.type===`text`&&typeof e.text==`string`?[e.text]:[]).join(``).trim();if(n)try{r?await r(n):await _(n),x(e.id),S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{x(null)},1500)}catch{}},children:b===e.id?Z(jT,{size:18}):Z(wT,{size:18})})]})]},e.id)})]})})});function TD(e){if(e)return e.includes(`.`)?e.split(`.`):e}function ED(e,t){if(!e||!t)return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let t=r;r=t[e]}return r}D();let DD=an(function({query:e,isSelected:t,onAskAI:n,onHoverIndex:r,hoverEnabled:i}){return Z(`div`,{className:`ss-infinite-hits-list`,children:Z(`article`,{onClick:n,className:`ss-infinite-hits-item ss-ask-ai-btn`,"aria-label":`Ask AI`,title:`Ask AI`,role:`option`,"aria-selected":t,onMouseEnter:()=>{i&&r?.(0)},onMouseMove:()=>{i&&r?.(0)},children:[Z(TT,{}),Z(`p`,{className:`ss-infinite-hits-item-title`,children:[`Ask AI: `,Z(`span`,{className:`ais-Highlight-highlighted`,children:[`"`,e,`"`]})]})]})})}),OD=an(function({hits:e,query:t,selectedIndex:n,onAskAI:r,attributes:i,onHoverIndex:a,hoverEnabled:o,sendEvent:s,openResultsInNewTab:c=!0}){let l=St(()=>({primaryText:i?.primaryText||`title`,secondaryText:i?.secondaryText||`description`,tertiaryText:i?.tertiaryText,url:i?.url||`url`,image:i?.image}),[i]),[u,d]=T({});return Z(v,{children:[Z(DD,{query:t,isSelected:n===0,onAskAI:r,onHoverIndex:a,hoverEnabled:o}),e.map((e,t)=>{let r=n===t+1,i=ED(e,l.primaryText),f=ED(e,l.url),p=ED(e,l.image),m=!!p,h=u[e.objectID]||!m;return Z(`a`,{href:f??`#`,target:c?`_blank`:void 0,rel:c?`noopener noreferrer`:void 0,className:`ss-infinite-hits-item ss-infinite-hits-anchor`,role:`option`,"aria-selected":r,onClick:()=>{s?.(`click`,e,`Hit Clicked`)},onMouseEnter:()=>{o&&a?.(t+1)},onMouseMove:()=>{o&&a?.(t+1)},children:[p?Z(`div`,{className:`ss-infinite-hits-item-image-container`,children:h?Z(`div`,{className:`ss-infinite-hits-item-placeholder`,"aria-hidden":`true`,children:Z(ET,{})}):Z(`img`,{src:p,alt:i,className:`ss-infinite-hits-item-image`,onError:()=>d(t=>({...t,[e.objectID]:!0}))})}):null,Z(`div`,{className:`ss-infinite-hits-item-content`,children:[Z(`p`,{className:`ss-infinite-hits-item-title`,children:Z(Sd,{attribute:TD(l.primaryText),hit:e})}),l.secondaryText?Z(`p`,{className:`ss-infinite-hits-item-description`,children:Z(Sd,{attribute:TD(l.secondaryText),hit:e})}):null,l.tertiaryText?Z(`p`,{className:`ss-infinite-hits-item-description`,children:Z(Sd,{attribute:TD(l.tertiaryText),hit:e})}):null]})]},e.objectID)})]})});D();let kD=an(function({showChat:e,setShowChat:t}){return e?Z(`button`,{type:`button`,onClick:()=>t(!1),className:`ss-search-left-button`,"aria-label":`Back to search`,title:`Back to search`,children:Z(DT,{})}):Z(`div`,{role:`button`,tabIndex:-1,className:`ss-search-left-button`,"aria-label":`Search`,title:`Search`,children:Z(ET,{})})}),AD=an(function(e){let{status:t}=id(),{query:n,refine:r}=Uu(),[i,a]=T(``),o=t===`stalled`;function s(t){e.showChat?a(t):r(t)}E(()=>{e.showChat&&a(``)},[e.showChat]);let c=oT(e.error),l=e.isPromptBlockingError&&c?``:e.isPromptBlockingError&&!c?`Conversation limit reached`:e.isGenerating?`Answering...`:e.showChat?`Ask AI anything`:e.placeholder,u=!!(e.showChat&&e.hideChatInput),d=e.showChat?i:n||``,f=e.isGenerating||e.isPromptBlockingError,p=[e.className,e.showChat?`ss-searchbox-form--chat`:``,u?`ss-searchbox-form--chat-no-input`:``].filter(Boolean).join(` `);return Z(`search`,{className:p,onSubmit:e=>{e.preventDefault(),e.stopPropagation()},onReset:t=>{t.preventDefault(),t.stopPropagation(),s(``),e.inputRef.current&&e.inputRef.current.focus()},children:[Z(kD,{showChat:e.showChat,setShowChat:e.setShowChat}),u?e.isPromptBlockingError&&!c?Z(`p`,{className:`ss-search-chat-blocking-placeholder`,children:l}):null:Z(`input`,{ref:e.inputRef,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,placeholder:l,spellCheck:!1,maxLength:512,type:`search`,value:d,disabled:f,onChange:e=>{s(e.currentTarget.value)},onKeyDown:t=>{if(f){t.preventDefault();return}if(t.key===`ArrowDown`){t.preventDefault(),e.onArrowDown?.();return}if(t.key===`ArrowUp`){t.preventDefault(),e.onArrowUp?.();return}if(t.key===`Enter`){t.preventDefault();let r=e.showChat?i:n||``;if(e.onEnter?.(r)){e.showChat?a(``):s(``);return}let o=r.trim();o&&e.setShowChat(!0)}}}),Z(`div`,{className:`ss-search-action-buttons-container`,children:[Z(`button`,{type:`reset`,className:`ss-search-clear-button`,hidden:!d||d.length===0||o,onClick:()=>{s(``),e.inputRef.current&&e.inputRef.current.focus()},children:`Clear`}),e.showChat?Z(`button`,{type:`button`,className:`ss-search-new-chat-button`,disabled:e.isGenerating&&!e.isPromptBlockingError,title:e.isPromptBlockingError?`Start a new conversation`:`New conversation`,"aria-label":e.isPromptBlockingError?`Start a new conversation`:`New conversation`,onClick:()=>{a(``),e.onNewChat?.()},children:Z(MT,{size:18})}):null,Z(`button`,{type:`button`,className:`ss-search-close-button`,onClick:e.onClose,children:Z(OT,{})})]})]})});D();function jD(e,t,n,r=!0){let[i,a]=T(0),[o,s]=T(`init`),c=St(()=>t.length+1,[t.length]),l=Ct(()=>{e||c===0||(a(e=>(e+1)%c),s(`keyboard`))},[e,c]),u=Ct(()=>{e||c===0||(a(e=>(e-1+c)%c),s(`keyboard`))},[e,c]),d=Ct(t=>{e||t<0||t>=c||(a(t),s(`pointer`))},[e,c]),f=Ct(()=>{if(e)return!1;if(i===0)return!0;if(i>0){let e=t[i-1],n=typeof e?.url==`string`?e.url:void 0;if(n)return r?window.open(n,`_blank`,`noopener,noreferrer`):window.location.assign(n),!0}return!1},[e,i,t,r]);return E(()=>{a(0),s(`init`)},[n,e]),{selectedIndex:i,moveDown:l,moveUp:u,activateSelection:f,hoverIndex:d,selectionOrigin:o}}D();function MD(){let[e,t]=T(!1),n=Ct(e=>{t(e)},[]);return{showChat:e,setShowChat:t,handleShowChat:n}}D();let ND=({onClick:e,darkMode:t})=>{let[n,r]=T(`⌘`),[i,a]=T(!1),[o,s]=T(!1);return E(()=>{if(typeof navigator>`u`)return;let e=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);r(e?`⌘`:`Ctrl`)},[]),E(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&a(!0),e.key.toLowerCase()===`k`&&s(!0)},t=e=>{!e.metaKey&&!e.ctrlKey&&a(!1),e.key.toLowerCase()===`k`&&s(!1)},n=()=>{a(!1),s(!1)};return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),window.addEventListener(`blur`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t),window.removeEventListener(`blur`,n)}},[]),Z(`button`,{className:`sitesearch-button-aa${t?` dark`:``}`,type:`button`,onClick:e,"aria-label":`Open search`,children:[Z(`span`,{className:`search-icon`,children:Z(ET,{})}),Z(`span`,{className:`button-text`,children:`Search`}),Z(`span`,{className:`keyboard-shortcut`,children:[Z(`kbd`,{className:i?`pressed`:``,children:n}),Z(`kbd`,{className:o?`pressed`:``,children:`K`})]})]})};D();let PD=({isOpen:e,onClose:t,children:n,isDark:r})=>(E(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(document.addEventListener(`keydown`,n),document.body.style.overflow=`hidden`),()=>{document.removeEventListener(`keydown`,n),document.body.style.overflow=`unset`}},[e,t]),e?hn(Z(`div`,{className:`modal-backdrop-askai${r?` dark`:``}`,onClick:t,children:Z(`div`,{className:`modal-content-askai ssask-exp${r?` dark`:``}`,onClick:e=>e.stopPropagation(),children:n})}),document.body):null);D();let FD=`algolia_ask_ai_suggested_questions`,ID=({assistantId:e,suggestedQuestionsEnabled:t=!1,searchClient:n,isOpen:r=!1})=>{let[i,a]=T([]),o=bt(!1);return E(()=>{if(o.current||!r)return;let i=async()=>{if(!(!t||!e||e===``))try{let{results:t}=await n.search({requests:[{indexName:FD,filters:`state:published AND assistantId:${e}`,hitsPerPage:3}]}),r=t[0];a(r.hits),o.current=!0}catch(e){console.error(`Failed to fetch suggested questions:`,e)}};i()},[t,e,r,n]),i};D();function LD(e){let t=St(()=>e===void 0?typeof document<`u`&&document.documentElement.classList.contains(`dark`)?!0:typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`).matches:!1:e,[e]),[n,r]=T(t);return E(()=>{if(e!==void 0){r(e);return}let t=!1,n=()=>{if(t)return;let e=document.documentElement.classList.contains(`dark`);if(e){r(!0);return}let n=window.matchMedia(`(prefers-color-scheme: dark)`).matches;r(n)},i=new MutationObserver(()=>n());i.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]});let a=window.matchMedia(`(prefers-color-scheme: dark)`),o=()=>n();return typeof a.addEventListener==`function`?a.addEventListener(`change`,o):typeof a.addListener==`function`&&a.addListener(o),n(),()=>{t=!0,i.disconnect(),typeof a.removeEventListener==`function`?a.removeEventListener(`change`,o):typeof a.removeListener==`function`&&a.removeListener(o)}},[e]),n}var RD=LD;D();let zD=an(function(e){return Z(AD,{className:e.className,placeholder:e.placeholder,showChat:e.showChat,isGenerating:e.isGenerating,isPromptBlockingError:e.isPromptBlockingError,hideChatInput:e.hideChatInput,error:e.error,inputRef:e.inputRef,setShowChat:e.setShowChat,onClose:e.onClose||(()=>{}),onArrowDown:e.onArrowDown,onArrowUp:e.onArrowUp,onEnter:e.onEnter,onNewChat:e.onNewChat})}),BD=an(function({query:e,onAskAI:t,onClear:n}){return Z(`div`,{className:`ss-no-results`,children:[Z(`div`,{className:`ss-no-results-icon`,children:Z(ET,{})}),Z(`p`,{className:`ss-no-results-title`,children:[`No results for "`,e,`"`]}),Z(`p`,{className:`ss-no-results-subtitle`,children:`Try a different query or ask AI to help.`}),Z(`div`,{className:`ss-no-results-actions`,children:[Z(`button`,{type:`button`,className:`ss-no-results-btn`,onClick:t,children:[Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,viewBox:`0 0 24 24`,children:[Z(`title`,{children:`Ask AI`}),Z(`path`,{fill:`currentColor`,d:`m6.8 13l2.9 2.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-4.6-4.6q-.15-.15-.213-.325T3.426 12t.063-.375t.212-.325l4.6-4.6q.275-.275.7-.275t.7.275t.275.7t-.275.7L6.8 11H19V8q0-.425.288-.712T20 7t.713.288T21 8v3q0 .825-.587 1.413T19 13z`})]}),`Ask AI`]}),Z(`button`,{type:`button`,className:`ss-no-results-btn`,onClick:n,children:`Clear`})]})]})}),VD=an(function({showChat:e,inputRef:t,setShowChat:n,query:r,selectedIndex:i,refine:a,config:o,messages:s,error:c,isGenerating:l,sendMessage:u,onHoverIndex:d,scrollOnSelectionChange:f=!0,sendEvent:p,suggestedQuestions:m,onNewChat:h,showPromptBlockingError:g,openResultsInNewTab:_=!0}){let{items:y}=Mu(o.transformItems?{transformItems:o.transformItems}:{}),b=bt(null),[x,S]=T(!1);E(()=>{if(e)return;let t=b.current;if(!t)return;S(!1);let n=()=>S(!0);return t.addEventListener(`pointermove`,n,{once:!0}),()=>{t.removeEventListener(`pointermove`,n)}},[e]),E(()=>{if(e||!f)return;let t=b.current;if(!t)return;let n=t.querySelector(`[aria-selected="true"]`);if(!n)return;let r=8,i=t.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<i.top+r?t.scrollTop-=i.top+r-a.top:a.bottom>i.bottom-r&&(t.scrollTop+=a.bottom-(i.bottom-r))},[i,e,y.length,f]);let C=bt(null);E(()=>{if(!e)return;let n=(r??``).trim();n&&C.current!==n&&(a(``),t.current&&t.current.focus(),u({text:n}),C.current=n)},[e,r,t,u,a]),E(()=>{s.length===0&&(C.current=null)},[s]);let ee=Ct(e=>{let t=e.trim();!t||l||u({text:t})},[l,u]);return e?Z(wD,{messages:s,error:c,isGenerating:l,applicationId:o.applicationId,apiKey:o.apiKey,assistantId:o.assistantId,agentStudio:o.agentStudio,suggestedQuestions:m,onSuggestedQuestionClick:ee,onNewChat:h,showPromptBlockingError:g}):Z(v,{children:Z(`div`,{ref:b,className:`ss-hits-container`,role:`listbox`,children:Z(OD,{hits:y,query:r,selectedIndex:i,onAskAI:()=>n(!0),attributes:o.attributes,onHoverIndex:d,hoverEnabled:x,sendEvent:p,openResultsInNewTab:_})})})});function HD({onClose:e,config:t}){let{query:n,refine:r}=Uu(),i=bt(null),a=id(),{items:o,sendEvent:s}=Mu(t.transformItems?{transformItems:t.transformItems}:{}),{showChat:c,setShowChat:l,handleShowChat:u}=MD();E(()=>{let e=requestAnimationFrame(()=>{i.current&&i.current.focus()});return()=>cancelAnimationFrame(e)},[]);let{messages:d,error:f,isGenerating:p,sendMessage:m,startNewConversation:h,promptBlockingError:g,showPromptBlockingError:_}=mT({applicationId:t.applicationId,apiKey:t.apiKey,indexName:t.indexName,assistantId:t.assistantId,agentStudio:t.agentStudio}),y=St(()=>{let e=gt(t.applicationId,t.apiKey);return e.addAlgoliaAgent(`algolia-sitesearch`),e},[t.applicationId,t.apiKey]),b=ID({searchClient:y,assistantId:t.assistantId,suggestedQuestionsEnabled:t.suggestedQuestionsEnabled??!1,isOpen:c}),x=St(()=>c&&_&&lT(f,!!t.agentStudio),[c,_,f,t.agentStudio]),S=a.results?.nbHits===0,{selectedIndex:C,moveDown:ee,moveUp:te,activateSelection:ne,hoverIndex:re,selectionOrigin:ie}=jD(c,o,n,t.openResultsInNewTab??!0),ae=Ct(()=>{if(C>0){let e=o[C-1];e&&s?.(`click`,e,`Hit Clicked`)}return ne()?(C===0&&u(!0),!0):!1},[ne,C,u,o,s]),oe=!S&&!!n||c,se=Ct(()=>{h(),l(!0),r(``),i.current&&i.current.focus()},[h,l,r]),ce=Ct(e=>{!e&&g&&h(),l(e)},[l,g,h]);return Z(v,{children:[Z(bs,{hitsPerPage:t.hitsPerPage||8,...t.searchParameters||{}}),Z(`div`,{className:`search-panel`,children:[Z(zD,{query:n,placeholder:t.placeholder||`What are you looking for?`,className:`ss-searchbox-form`,refine:r,showChat:c,isGenerating:p,isPromptBlockingError:_,hideChatInput:x,error:f,setShowChat:ce,onClose:e,onArrowDown:ee,onArrowUp:te,onEnter:e=>{let t=(e??``).trim();return c&&t?(r(t),!0):ae()},inputRef:i,onNewChat:se}),oe&&Z(VD,{showChat:c,inputRef:i,setShowChat:ce,query:n,selectedIndex:C,refine:r,config:t,messages:d,error:f,isGenerating:p,sendMessage:m,onHoverIndex:re,scrollOnSelectionChange:ie!==`pointer`,sendEvent:s,suggestedQuestions:b,onNewChat:se,showPromptBlockingError:_,openResultsInNewTab:t.openResultsInNewTab}),S&&n&&!c&&Z(BD,{query:n,onAskAI:()=>{l(!0)},onClear:()=>{r(``),i.current&&i.current.focus()}})]}),Z(UD,{showChat:c})]})}let UD=an(function({showChat:e}){let t=`https://www.algolia.com/developers?utm_medium=referral&utm_content=powered_by&utm_campaign=sitesearch`,n=typeof window<`u`?`${t}&utm_source=${encodeURIComponent(window.location.hostname)}`:t;return Z(`div`,{className:`ss-footer`,children:[Z(`div`,{className:`ss-footer-left`,children:[Z(`div`,{className:`ss-footer-kbd-group`,children:[Z(`kbd`,{className:`ss-kbd`,children:Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,viewBox:`0 0 24 24`,children:Z(`path`,{fill:`currentColor`,d:`m6.8 13l2.9 2.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-4.6-4.6q-.15-.15-.213-.325T3.426 12t.063-.375t.212-.325l4.6-4.6q.275-.275.7-.275t.7.275t.275.7t-.275.7L6.8 11H19V8q0-.425.288-.712T20 7t.713.288T21 8v3q0 .825-.587 1.413T19 13z`})})}),Z(`span`,{children:e?`Ask question`:`Open`})]}),Z(`div`,{className:`ss-footer-kbd-group`,children:[Z(`kbd`,{className:`ss-kbd`,children:Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,viewBox:`0 0 24 24`,children:Z(`path`,{fill:`currentColor`,d:`m11 7.825l-4.9 4.9q-.3.3-.7.288t-.7-.313q-.275-.3-.288-.7t.288-.7l6.6-6.6q.15-.15.325-.212T12 4.425t.375.063t.325.212l6.6 6.6q.275.275.275.688t-.275.712q-.3.3-.712.3t-.713-.3L13 7.825V19q0 .425-.288.713T12 20t-.712-.288T11 19z`})})}),Z(`kbd`,{className:`ss-kbd`,children:Z(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,viewBox:`0 0 24 24`,children:Z(`path`,{fill:`currentColor`,d:`M11 16.175V5q0-.425.288-.712T12 4t.713.288T13 5v11.175l4.9-4.9q.3-.3.7-.288t.7.313q.275.3.287.7t-.287.7l-6.6 6.6q-.15.15-.325.213t-.375.062t-.375-.062t-.325-.213l-6.6-6.6q-.275-.275-.275-.687T4.7 11.3q.3-.3.713-.3t.712.3z`})})}),Z(`span`,{children:`Navigate`})]})]}),Z(`div`,{className:`ss-footer-right`,children:Z(`a`,{className:`ss-footer-powered-by`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[Z(`span`,{children:`Powered by `}),Z(kT,{})]})})]})});function WD(e){let t=gt(e.applicationId,e.apiKey);t.addAlgoliaAgent(`algolia-sitesearch`);let[n,r]=T(!1),i=RD(e.darkMode),a=()=>r(!0),o=()=>r(!1);E(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),r(!0))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let s={...e.buttonProps,onClick:a};return Z(v,{children:[Z(ND,{...s,darkMode:i,children:e.buttonText}),Z(PD,{isOpen:n,onClose:o,isDark:i,children:Z(Su,{searchClient:t,indexName:e.indexName,future:{preserveSharedStateOnUnmount:!0},insights:e.insights||!0,children:Z(HD,{onClose:o,config:e})})})]})}let GD=/^#[^#\s]+$/;function KD(e){return typeof e==`string`?GD.test(e)?document.getElementById(e.slice(1)):document.querySelector(e):e}Ie();let qD=new Map;function JD({container:e,...t}){let n=KD(e);if(!n)throw Error(`Container not found`);ge(h(WD,{...t}),n),qD.set(n,!0)}function YD(e){let t=KD(e);t&&(ge(null,t),qD.delete(t))}var XD={init:JD,destroy:YD};exports.default=XD,exports.destroy=YD,exports.init=JD});
//# sourceMappingURL=search-askai.min.js.map