1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-plotly-Ce3vN96O.js","assets/react-vendor-C8w-UNLI.js"])))=>i.map(i=>d[i]); 2var Kf=Object.defineProperty;var Jf=(e,t,n)=>t in e?Kf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rn=(e,t,n)=>Jf(e,typeof t!="symbol"?t+"":t,n);import{j as o,F as Me,T as N,C as Xf,B as We,r as x,R as ct,A as ea,S as cn,a as ta,b as Qf,I as _n,c as na,d as eh,e as th,f as nh,g as rh,h as ih,G as oh,i as qa,u as sh,k as Mt,m as ah,l as hr,H as Rt,n as m,o as lh,P as Jt,p as ch,q as uh,s as dh,t as fh,v as hh,w as ph,x as mh,y as Pn,z as Te,M as gh,D as xh,E as bh,J as yh,K as wh,L as Zc,N as kh,O as Sh,Q as vh,U as jh,V as _h,W as Ch,X as Eh,Y as Ah,Z as Ih,_ as Rh,$ as Fr,a0 as Ut,a1 as Th,a2 as zh,a3 as Fh,a4 as Ph,a5 as Lh,a6 as Mh,a7 as Dh,a8 as tt,a9 as Oh,aa as Bh,ab as Nh,ac as $h,ad as Gc,ae as Wh,af as gi,ag as Uh,ah as Hh,ai as Yc,aj as xi,ak as ut,al as Bn,am as vs,an as qh,ao as Vh,ap as Zh,aq as Gh,ar as Yh,as as ra,at as tr,au as Kh,av as Jh,aw as Xh,ax as Qh,ay as ep,az as tp,aA as np,aB as js,aC as _s,aD as Xr,aE as Qr,aF as rp,aG as Rr,aH as ip,aI as op,aJ as cr,aK as ur,aL as Pt,aM as mt,aN as dr,aO as Ge,aP as sp,aQ as ap,aR as lp,aS as go,aT as cp,aU as up,aV as dp,aW as fp,aX as hp,aY as pp,aZ as mp,a_ as gp,a$ as xp,b0 as bp,b1 as yp,b2 as wp,b3 as kp,b4 as Sp,b5 as vp}from"./ui-vendor-kqy_wwo0.js";import{L as Lr,c as jp,O as Kc,u as un,a as Ht,b as pr,d as xn,e as Qt,r as $n,f as Jc,Q as _p,M as Cp,g as Ep,h as Ap,i as Ip,R as Rp}from"./router-vendor-9ZHqIYAq.js";import{a as Tp,g as xo}from"./react-vendor-C8w-UNLI.js";var Ii={},Va;function zp(){if(Va)return Ii;Va=1;var e=Tp();return Ii.createRoot=e.createRoot,Ii.hydrateRoot=e.hydrateRoot,Ii}var Fp=zp();const Pp=xo(Fp),Lp=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),Mp=function(e){return"/"+e},Za={},Xc=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=a(n.map(u=>{if(u=Mp(u),u in Za)return;Za[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Lp,d||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},Dp=()=>o.jsx(o.Fragment,{children:o.jsxs(Me,{height:"100vh",align:"center",justify:"center",flexDir:"column","data-testid":"not-found",p:4,children:[o.jsx(Me,{alignItems:"center",zIndex:1,children:o.jsxs(Me,{flexDir:"column",ml:4,align:"center",justify:"center",p:4,children:[o.jsx(N,{fontSize:{base:"6xl",md:"8xl"},lineHeight:"1",mb:4,children:"404"}),o.jsx(N,{fontSize:"2xl",mb:2,children:"Oops!"})]})}),o.jsx(N,{fontSize:"lg",color:"gray.600",mb:4,textAlign:"center",zIndex:1,children:"The page you are looking for was not found."}),o.jsx(Xf,{zIndex:1,children:o.jsx(Lr,{to:"/",children:o.jsx(We,{variant:"solid",colorScheme:"teal",mt:4,alignSelf:"center",children:"Go Back"})})})]})}),Op=()=>null,kr=jp({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(Kc,{}),o.jsx(x.Suspense,{children:o.jsx(Op,{})})]}),notFoundComponent:()=>o.jsx(Dp,{})});var bi=e=>e.type==="checkbox",Tr=e=>e instanceof Date,Kt=e=>e==null;const Qc=e=>typeof e=="object";var Dt=e=>!Kt(e)&&!Array.isArray(e)&&Qc(e)&&!Tr(e),eu=e=>Dt(e)&&e.target?bi(e.target)?e.target.checked:e.target.value:e,Bp=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,tu=(e,t)=>
2e.has(Bp(t)),Np=e=>{const t=e.constructor&&e.constructor.prototype;return Dt(t)&&t.hasOwnProperty("isPrototypeOf")},ia=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function sn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ia&&(e instanceof Blob||e instanceof FileList))&&(n||Dt(e)))if(t=n?[]:{},!n&&!Np(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=sn(e[r]));else return e;return t}var yi=e=>Array.isArray(e)?e.filter(Boolean):[],It=e=>e===void 0,be=(e,t,n)=>{if(!t||!Dt(e))return n;const r=yi(t.split(/[,[\].]+?/)).reduce((i,s)=>Kt(i)?i:i[s],e);return It(r)||r===e?It(e[t])?n:e[t]:r},Sn=e=>typeof e=="boolean";const Yi={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},vn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},On={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},$p=ct.createContext(null),oa=()=>ct.useContext($p);var nu=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const a=s;return t._proxyFormState[a]!==vn.all&&(t._proxyFormState[a]=!r||vn.all),n&&(n[a]=!0),e[a]}});return i},yn=e=>Dt(e)&&!Object.keys(e).length,ru=(e,t,n,r)=>{n(e);const{name:i,...s}=e;return yn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(a=>t[a]===(!r||vn.all))},Wi=e=>Array.isArray(e)?e:[e],iu=(e,t,n)=>!e||!t||e===t||Wi(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function sa(e){const t=ct.useRef(e);t.current=e,ct.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function Wp(e){const t=oa(),{control:n=t.control,disabled:r,name:i,exact:s}=e||{},[a,l]=ct.useState(n._formState),c=ct.useRef(!0),u=ct.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=ct.useRef(i);return d.current=i,sa({disabled:r,next:f=>c.current&&iu(d.current,f.name,s)&&ru(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),ct.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),nu(a,n,u.current,!1)}var Tn=e=>typeof e=="string",ou=(e,t,n,r,i)=>Tn(e)?(r&&t.watch.add(e),be(n,e,i)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),be(n,s))):(r&&(t.watchAll=!0),n);function Up(e){const t=oa(),{control:n=t.control,name:r,defaultValue:i,disabled:s,exact:a}=e||{},l=ct.useRef(r);l.current=r,sa({disabled:s,subject:n._subjects.values,next:d=>{iu(l.current,d.name,a)&&u(sn(ou(l.current,n._names,d.values||n._formValues,!1,i)))}});const[c,u]=ct.useState(n._getWatch(r,i));return ct.useEffect(()=>n._removeUnmounted()),c}var aa=e=>/^\w*$/.test(e),su=e=>yi(e.replace(/["|']|\]/g,"").split(/\.|\[/)),bt=(e,t,n)=>{let r=-1;const i=aa(t)?[t]:su(t),s=i.length,a=s-1;for(;++r<s;){const l=i[r];let c=n;if(r!==a){const u=e[l];c=Dt(u)||Array.isArray(u)?u:isNaN(+i[r+1])?{}:[]}e[l]=c,e=e[l]}return e};function Hp(e){const t=oa(),{name:n,disabled:r,control:i=t.control,shouldUnregister:s}=e,a=tu(i._names.array,n),l=Up({control:i,name:n,defaultValue:be(i._formValues,n,be(i._defaultValues,n,e.defaultValue)),exact:!0}),c=Wp({control:i,name:n}),u=ct.useRef(i.register(n,{...e.rules,value:l,...Sn(e.disabled)?{disabled:e.disabled}:{}}));return ct.useEffect(()=>{const d=i._options.shouldUnregister||s,f=(p,h)=>{const g=be(i._fields,p);g&&(g._f.mount=h)};if(f(n,!0),d){const p=sn(be(i._options.defaultValues,n));bt(i._defaultValues,n,p),It(be(i._formValues,n))&&bt(i._formValues,n,p)}return()=>{(a?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,a,s]),ct.useEffect(()=>{be(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:be(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:l,...Sn(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:ct.useCallback(d=>u.current.onChange({target:{value:eu(d),name:n},type:Yi.CHANGE}),[n]),onBlur:ct.useCallback(()=>u.current.onBlur({target:{value:be(i._formValues,n),name:n},type:Yi.BLUR}),[n,i]),ref:d=>{const f=be(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:p=>d.setCustomValidity(p),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!be(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!be(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!be(c.touchedFields,n)},error:{enumerable:!0,get:()=>be(c.errors,n)}})}}const Ki=e=>e.render(Hp(e));var qp=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Ga=e=>({isOnSubmit:!e||e===vn.onSubmit,isOnBlur:e===vn.onBlur,isOnChange:e===vn.onChange,isOnAll:e===vn.all,isOnTouch:e===vn.onTouched}),Ya=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ti=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const s=be(e,i);if(s){const{_f:a,...l}=s;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],i)&&!r)break;
vendor: 7,850 bytes, line 2
2if(a.ref&&t(a.ref,a.name)&&!r)break;ti(l,t)}else Dt(l)&&ti(l,t)}}};var Vp=(e,t,n)=>{const r=yi(be(e,n));return bt(r,"root",t[n]),bt(e,n,r),e},la=e=>e.type==="file",Qn=e=>typeof e=="function",Ji=e=>{if(!ia)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ui=e=>Tn(e),ca=e=>e.type==="radio",Xi=e=>e instanceof RegExp;const Ka={value:!1,isValid:!1},Ja={value:!0,isValid:!0};var au=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!It(e[0].attributes.value)?It(e[0].value)||e[0].value===""?Ja:{value:e[0].value,isValid:!0}:Ja:Ka}return Ka};const Xa={isValid:!1,value:null};var lu=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Xa):Xa;function Qa(e,t,n="validate"){if(Ui(e)||Array.isArray(e)&&e.every(Ui)||Sn(e)&&!e)return{type:n,message:Ui(e)?e:"",ref:t}}var _r=e=>Dt(e)&&!Xi(e)?e:{value:e,message:""},el=async(e,t,n,r,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:p,validate:h,name:g,valueAsNumber:k,mount:b,disabled:S}=e._f,y=be(t,g);if(!b||S)return{};const R=a?a[0]:s,L=z=>{r&&R.reportValidity&&(R.setCustomValidity(Sn(z)?"":z||""),R.reportValidity())},O={},T=ca(s),Z=bi(s),j=T||Z,E=(k||la(s))&&It(s.value)&&It(y)||Ji(s)&&s.value===""||y===""||Array.isArray(y)&&!y.length,w=qp.bind(null,g,n,O),M=(z,I,$,X=On.maxLength,xe=On.minLength)=>{const K=z?I:$;O[g]={type:z?X:xe,message:K,ref:s,...w(z?X:xe,K)}};if(i?!Array.isArray(y)||!y.length:l&&(!j&&(E||Kt(y))||Sn(y)&&!y||Z&&!au(a).isValid||T&&!lu(a).isValid)){const{value:z,message:I}=Ui(l)?{value:!!l,message:l}:_r(l);if(z&&(O[g]={type:On.required,message:I,ref:R,...w(On.required,I)},!n))return L(I),O}if(!E&&(!Kt(d)||!Kt(f))){let z,I;const $=_r(f),X=_r(d);if(!Kt(y)&&!isNaN(y)){const xe=s.valueAsNumber||y&&+y;Kt($.value)||(z=xe>$.value),Kt(X.value)||(I=xe<X.value)}else{const xe=s.valueAsDate||new Date(y),K=C=>new Date(new Date().toDateString()+" "+C),U=s.type=="time",ie=s.type=="week";Tn($.value)&&y&&(z=U?K(y)>K($.value):ie?y>$.value:xe>new Date($.value)),Tn(X.value)&&y&&(I=U?K(y)<K(X.value):ie?y<X.value:xe<new Date(X.value))}if((z||I)&&(M(!!z,$.message,X.message,On.max,On.min),!n))return L(O[g].message),O}if((c||u)&&!E&&(Tn(y)||i&&Array.isArray(y))){const z=_r(c),I=_r(u),$=!Kt(z.value)&&y.length>+z.value,X=!Kt(I.value)&&y.length<+I.value;if(($||X)&&(M($,z.message,I.message),!n))return L(O[g].message),O}if(p&&!E&&Tn(y)){const{value:z,message:I}=_r(p);if(Xi(z)&&!y.match(z)&&(O[g]={type:On.pattern,message:I,ref:s,...w(On.pattern,I)},!n))return L(I),O}if(h){if(Qn(h)){const z=await h(y,t),I=Qa(z,R);if(I&&(O[g]={...I,...w(On.validate,I.message)},!n))return L(I.message),O}else if(Dt(h)){let z={};for(const I in h){if(!yn(z)&&!n)break;const $=Qa(await h[I](y,t),R,I);$&&(z={...$,...w(I,$.message)},L($.message),n&&(O[g]=z))}if(!yn(z)&&(O[g]={ref:R,...z},!n))return O}}return L(!0),O};function Zp(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=It(e)?r++:e[t[r++]];return e}function Gp(e){for(const t in e)if(e.hasOwnProperty(t)&&!It(e[t]))return!1;return!0}function Wt(e,t){const n=Array.isArray(t)?t:aa(t)?[t]:su(t),r=n.length===1?e:Zp(e,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Dt(r)&&yn(r)||Array.isArray(r)&&Gp(r))&&Wt(e,n.slice(0,-1)),e}var qo=()=>{let e=[];return{get observers(){return e},next:i=>{for(const s of e)s.next&&s.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(s=>s!==i)}}),unsubscribe:()=>{e=[]}}},Qi=e=>Kt(e)||!Qc(e);function ar(e,t){if(Qi(e)||Qi(t))return e===t;if(Tr(e)&&Tr(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Tr(s)&&Tr(a)||Dt(s)&&Dt(a)||Array.isArray(s)&&Array.isArray(a)?!ar(s,a):s!==a)return!1}}return!0}var cu=e=>e.type==="select-multiple",Yp=e=>ca(e)||bi(e),Vo=e=>Ji(e)&&e.isConnected,uu=e=>{for(const t in e)if(Qn(e[t]))return!0;return!1};function eo(e,t={}){const n=Array.isArray(e);if(Dt(e)||n)for(const r in e)Array.isArray(e[r])||Dt(e[r])&&!uu(e[r])?(t[r]=Array.isArray(e[r])?[]:{},eo(e[r],t[r])):Kt(e[r])||(t[r]=!0);return t}function du(e,t,n){const r=Array.isArray(e);if(Dt(e)||r)for(const i in e)Array.isArray(e[i])||Dt(e[i])&&!uu(e[i])?It(t)||Qi(n[i])?n[i]=Array.isArray(e[i])?eo(e[i],[]):{...eo(e[i])}:du(e[i],Kt(t)?{}:t[i],n[i]):n[i]=!ar(e[i],t[i]);return n}var Zo=(e,t)=>du(e,t,eo(t)),fu=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>It(e)?e:t?e===""?NaN:e&&+e:n&&Tn(e)?new Date(e):r?r(e):e;function Go(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return la(t)?t.files:ca(t)?lu(e.refs).value:cu(t)?[...t.selectedOptions].map(({value:n})=>n):bi(t)?au(e.refs).value:fu(It(t.value)?e.ref.value:t.value,e)}var Kp=(e,t,n,r)=>{const i={};for(const s of e){const a=be(t,s);a&&bt(i,s,a._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Vr=e=>It(e)?e:Xi(e)?e.source:Dt(e)?Xi(e.value)?e.value.source:e.value:e,Jp=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function tl(e,t,n){const r=be(e,n);if(r||aa(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),a=be(t,s),l=be(e,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};i.pop()}return{name:n}}var Xp=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,Qp=(e,t)=>!yi(be(e,t)).length&&Wt(e,t);const em={mode:vn.onSubmit,reValidateMode:vn.onChange,shouldFocusError:!0};function tm(e={},t){let n={...em,...e},r={submitCount:0,isDirty:!1,isLoading:Qn(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},s=Dt(n.defaultValues)||Dt(n.values)?sn(n.defaultValues||n.values)||{}:{},a=n.shouldUnregister?{}:sn(s),l={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,d=0;const f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:qo(),array:qo(),state:qo()},h=Ga(n.mode),g=Ga(n.reValidateMode),k=n.criteriaMode===vn.all,b=A=>W=>{clearTimeout(d),d=setTimeout(A,W)},S=async A=>{if(f.isValid||A){const W=n.resolver?yn((await E()).errors):await M(i,!0);W!==r.isValid&&p.state.next({isValid:W})}},y=A=>f.isValidating&&p.state.next({isValidating:A}),R=(A,W=[],H,se,re=!0,Q=!0)=>{if(se&&H){if(l.action=!0,Q&&Array.isArray(be(i,A))){const me=H(be(i,A),se.argA,se.argB);re&&bt(i,A,me)}if(Q&&Array.isArray(be(r.errors,A))){const me=H(be(r.errors,A),se.argA,se.argB);re&&bt(r.errors,A,me),Qp(r.errors,A)}if(f.touchedFields&&Q&&Array.isArray(be(r.touchedFields,A))){const me=H(be(r.touchedFields,A),se.argA,se.argB);re&&bt(r.touchedFields,A,me)}f.dirtyFields&&(r.dirtyFields=Zo(s,a)),p.state.next({name:A,isDirty:I(A,W),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else bt(a,A,W)},L=(A,W)=>{bt(r.errors,A,W),p.state.next({errors:r.errors})},O=A=>{r.errors=A,p.state.next({errors:r.errors,isValid:!1})},T=(A,W,H,se)=>{const re=be(i,A);if(re){const Q=be(a,A,It(H)?be(s,A):H);It(Q)||se&&se.defaultChecked||W?bt(a,A,W?Q:Go(re._f)):xe(A,Q),l.mount&&S()}},Z=(A,W,H,se,re)=>{let Q=!1,me=!1;const D={name:A},q=!!(be(i,A)&&be(i,A)._f.disabled);if(!H||se){f.isDirty&&(me=r.isDirty,r.isDirty=D.isDirty=I(),Q=me!==D.isDirty);const fe=q||ar(be(s,A),W);me=!!(!q&&be(r.dirtyFields,A)),fe||q?Wt(r.dirtyFields,A):bt(r.dirtyFields,A,!0),D.dirtyFields=r.dirtyFields,Q=Q||f.dirtyFields&&me!==!fe}if(H){const fe=be(r.touchedFields,A);fe||(bt(r.touchedFields,A,H),D.touchedFields=r.touchedFields,Q=Q||f.touchedFields&&fe!==H)}
2return Q&&re&&p.state.next(D),Q?D:{}},j=(A,W,H,se)=>{const re=be(r.errors,A),Q=f.isValid&&Sn(W)&&r.isValid!==W;if(e.delayError&&H?(u=b(()=>L(A,H)),u(e.delayError)):(clearTimeout(d),u=null,H?bt(r.errors,A,H):Wt(r.errors,A)),(H?!ar(re,H):re)||!yn(se)||Q){const me={...se,...Q&&Sn(W)?{isValid:W}:{},errors:r.errors,name:A};r={...r,...me},p.state.next(me)}y(!1)},E=async A=>n.resolver(a,n.context,Kp(A||c.mount,i,n.criteriaMode,n.shouldUseNativeValidation)),w=async A=>{const{errors:W}=await E(A);if(A)for(const H of A){const se=be(W,H);se?bt(r.errors,H,se):Wt(r.errors,H)}else r.errors=W;return W},M=async(A,W,H={valid:!0})=>{for(const se in A){const re=A[se];if(re){const{_f:Q,...me}=re;if(Q){const D=c.array.has(Q.name),q=await el(re,a,k,n.shouldUseNativeValidation&&!W,D);if(q[Q.name]&&(H.valid=!1,W))break;!W&&(be(q,Q.name)?D?Vp(r.errors,q,Q.name):bt(r.errors,Q.name,q[Q.name]):Wt(r.errors,Q.name))}me&&await M(me,W,H)}}return H.valid},z=()=>{for(const A of c.unMount){const W=be(i,A);W&&(W._f.refs?W._f.refs.every(H=>!Vo(H)):!Vo(W._f.ref))&&et(A)}c.unMount=new Set},I=(A,W)=>(A&&W&&bt(a,A,W),!ar(ue(),s)),$=(A,W,H)=>ou(A,c,{...l.mount?a:It(W)?s:Tn(A)?{[A]:W}:W},H,W),X=A=>yi(be(l.mount?a:s,A,e.shouldUnregister?be(s,A,[]):[])),xe=(A,W,H={})=>{const se=be(i,A);let re=W;if(se){const Q=se._f;Q&&(!Q.disabled&&bt(a,A,fu(W,Q)),re=Ji(Q.ref)&&Kt(W)?"":W,cu(Q.ref)?[...Q.ref.options].forEach(me=>me.selected=re.includes(me.value)):Q.refs?bi(Q.ref)?Q.refs.length>1?Q.refs.forEach(me=>(!me.defaultChecked||!me.disabled)&&(me.checked=Array.isArray(re)?!!re.find(D=>D===me.value):re===me.value)):Q.refs[0]&&(Q.refs[0].checked=!!re):Q.refs.forEach(me=>me.checked=me.value===re):la(Q.ref)?Q.ref.value="":(Q.ref.value=re,Q.ref.type||p.values.next({name:A,values:{...a}})))}(H.shouldDirty||H.shouldTouch)&&Z(A,re,H.shouldTouch,H.shouldDirty,!0),H.shouldValidate&&ne(A)},K=(A,W,H)=>{for(const se in W){const re=W[se],Q=`${A}.${se}`,me=be(i,Q);(c.array.has(A)||!Qi(re)||me&&!me._f)&&!Tr(re)?K(Q,re,H):xe(Q,re,H)}},U=(A,W,H={})=>{const se=be(i,A),re=c.array.has(A),Q=sn(W);bt(a,A,Q),re?(p.array.next({name:A,values:{...a}}),(f.isDirty||f.dirtyFields)&&H.shouldDirty&&p.state.next({name:A,dirtyFields:Zo(s,a),isDirty:I(A,Q)})):se&&!se._f&&!Kt(Q)?K(A,Q,H):xe(A,Q,H),Ya(A,c)&&p.state.next({...r}),p.values.next({name:A,values:{...a}}),!l.mount&&t()},ie=async A=>{const W=A.target;let H=W.name,se=!0;const re=be(i,H),Q=()=>W.type?Go(re._f):eu(A),me=D=>{se=Number.isNaN(D)||D===be(a,H,D)};if(re){let D,q;const fe=Q(),ke=A.type===Yi.BLUR||A.type===Yi.FOCUS_OUT,$e=!Jp(re._f)&&!n.resolver&&!be(r.errors,H)&&!re._f.deps||Xp(ke,be(r.touchedFields,H),r.isSubmitted,g,h),Ke=Ya(H,c,ke);bt(a,H,fe),ke?(re._f.onBlur&&re._f.onBlur(A),u&&u(0)):re._f.onChange&&re._f.onChange(A);const nt=Z(H,fe,ke,!1),at=!yn(nt)||Ke;if(!ke&&p.values.next({name:H,type:A.type,values:{...a}}),$e)return f.isValid&&S(),at&&p.state.next({name:H,...Ke?{}:nt});if(!ke&&Ke&&p.state.next({...r}),y(!0),n.resolver){const{errors:vt}=await E([H]);if(me(fe),se){const Et=tl(r.errors,i,H),ht=tl(vt,i,Et.name||H);D=ht.error,H=ht.name,q=yn(vt)}}else D=(await el(re,a,k,n.shouldUseNativeValidation))[H],me(fe),se&&(D?q=!1:f.isValid&&(q=await M(i,!0)));se&&(re._f.deps&&ne(re._f.deps),j(H,q,D,nt))}},C=(A,W)=>{if(be(r.errors,W)&&A.focus)return A.focus(),1},ne=async(A,W={})=>{let H,se;const re=Wi(A);if(y(!0),n.resolver){const Q=await w(It(A)?A:re);H=yn(Q),se=A?!re.some(me=>be(Q,me)):H}else A?(se=(await Promise.all(re.map(async Q=>{const me=be(i,Q);return await M(me&&me._f?{[Q]:me}:me)}))).every(Boolean),!(!se&&!r.isValid)&&S()):se=H=await M(i);return p.state.next({...!Tn(A)||f.isValid&&H!==r.isValid?{}:{name:A},...n.resolver||!A?{isValid:H}:{},errors:r.errors,isValidating:!1}),W.shouldFocus&&!se&&ti(i,C,A?re:c.mount),se},ue=A=>{const W={...s,...l.mount?a:{}};return It(A)?W:Tn(A)?be(W,A):A.map(H=>be(W,H))},v=(A,W)=>({invalid:!!be((W||r).errors,A),isDirty:!!be((W||r).dirtyFields,A),isTouched:!!be((W||r).touchedFields,A),error:be((W||r).errors,A)}),ze=A=>{A&&Wi(A).forEach(W=>Wt(r.errors,W)),p.state.next({errors:A?r.errors:{}})},he=(A,W,H)=>{const se=(be(i,A,{_f:{}})._f||{}).ref;bt(r.errors,A,{...W,ref:se}),p.state.next({name:A,errors:r.errors,isValid:!1}
2),H&&H.shouldFocus&&se&&se.focus&&se.focus()},Pe=(A,W)=>Qn(A)?p.values.subscribe({next:H=>A($(void 0,W),H)}):$(A,W,!0),et=(A,W={})=>{for(const H of A?Wi(A):c.mount)c.mount.delete(H),c.array.delete(H),W.keepValue||(Wt(i,H),Wt(a,H)),!W.keepError&&Wt(r.errors,H),!W.keepDirty&&Wt(r.dirtyFields,H),!W.keepTouched&&Wt(r.touchedFields,H),!n.shouldUnregister&&!W.keepDefaultValue&&Wt(s,H);p.values.next({values:{...a}}),p.state.next({...r,...W.keepDirty?{isDirty:I()}:{}}),!W.keepIsValid&&S()},Se=({disabled:A,name:W,field:H,fields:se,value:re})=>{if(Sn(A)){const Q=A?void 0:It(re)?Go(H?H._f:be(se,W)._f):re;bt(a,W,Q),Z(W,Q,!1,!1,!0)}},Ie=(A,W={})=>{let H=be(i,A);const se=Sn(W.disabled);return bt(i,A,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:A}},name:A,mount:!0,...W}}),c.mount.add(A),H?Se({field:H,disabled:W.disabled,name:A,value:W.value}):T(A,!0,W.value),{...se?{disabled:W.disabled}:{},...n.progressive?{required:!!W.required,min:Vr(W.min),max:Vr(W.max),minLength:Vr(W.minLength),maxLength:Vr(W.maxLength),pattern:Vr(W.pattern)}:{},name:A,onChange:ie,onBlur:ie,ref:re=>{if(re){Ie(A,W),H=be(i,A);const Q=It(re.value)&&re.querySelectorAll&&re.querySelectorAll("input,select,textarea")[0]||re,me=Yp(Q),D=H._f.refs||[];if(me?D.find(q=>q===Q):Q===H._f.ref)return;bt(i,A,{_f:{...H._f,...me?{refs:[...D.filter(Vo),Q,...Array.isArray(be(s,A))?[{}]:[]],ref:{type:Q.type,name:A}}:{ref:Q}}}),T(A,!1,void 0,Q)}else H=be(i,A,{}),H._f&&(H._f.mount=!1),(n.shouldUnregister||W.shouldUnregister)&&!(tu(c.array,A)&&l.action)&&c.unMount.add(A)}}},Ve=()=>n.shouldFocusError&&ti(i,C,c.mount),ve=A=>{Sn(A)&&(p.state.next({disabled:A}),ti(i,(W,H)=>{let se=A;const re=be(i,H);re&&Sn(re._f.disabled)&&(se||(se=re._f.disabled)),W.disabled=se},0,!1))},Ae=(A,W)=>async H=>{H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let se=sn(a);if(p.state.next({isSubmitting:!0}),n.resolver){const{errors:re,values:Q}=await E();r.errors=re,se=Q}else await M(i);Wt(r.errors,"root"),yn(r.errors)?(p.state.next({errors:{}}),await A(se,H)):(W&&await W({...r.errors},H),Ve(),setTimeout(Ve)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yn(r.errors),submitCount:r.submitCount+1,errors:r.errors})},je=(A,W={})=>{be(i,A)&&(It(W.defaultValue)?U(A,sn(be(s,A))):(U(A,W.defaultValue),bt(s,A,sn(W.defaultValue))),W.keepTouched||Wt(r.touchedFields,A),W.keepDirty||(Wt(r.dirtyFields,A),r.isDirty=W.defaultValue?I(A,sn(be(s,A))):I()),W.keepError||(Wt(r.errors,A),f.isValid&&S()),p.state.next({...r}))},Ce=(A,W={})=>{const H=A?sn(A):s,se=sn(H),re=A&&!yn(A)?se:s;if(W.keepDefaultValues||(s=H),!W.keepValues){if(W.keepDirtyValues)for(const Q of c.mount)be(r.dirtyFields,Q)?bt(re,Q,be(a,Q)):U(Q,be(re,Q));else{if(ia&&It(A))for(const Q of c.mount){const me=be(i,Q);if(me&&me._f){const D=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(Ji(D)){const q=D.closest("form");if(q){q.reset();break}}}}i={}}a=e.shouldUnregister?W.keepDefaultValues?sn(s):{}:sn(re),p.array.next({values:{...re}}),p.values.next({values:{...re}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!f.isValid||!!W.keepIsValid,l.watch=!!e.shouldUnregister,p.state.next({submitCount:W.keepSubmitCount?r.submitCount:0,isDirty:W.keepDirty?r.isDirty:!!(W.keepDefaultValues&&!ar(A,s)),isSubmitted:W.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:W.keepDirtyValues?r.dirtyFields:W.keepDefaultValues&&A?Zo(s,A):{},touchedFields:W.keepTouched?r.touchedFields:{},errors:W.keepErrors?r.errors:{},isSubmitSuccessful:W.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Ee=(A,W)=>Ce(Qn(A)?A(a):A,W);return{control:{register:Ie,unregister:et,getFieldState:v,handleSubmit:Ae,setError:he,_executeSchema:E,_getWatch:$,_getDirty:I,_updateValid:S,_removeUnmounted:z,_updateFieldArray:R,_updateDisabledField:Se,_getFieldArray:X,_reset:Ce,_resetDefaultValues:()=>Qn(n.defaultValues)&&n.defaultValues().then(A=>{Ee(A,n.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:A=>{r={...r,...A}},_disableForm:ve,_subjects:p,_proxyFormState:f,_setErrors:O,get _fields(){return i},get _formValues(){return a},get _state(){return l},set _state(A){l=A},get _defaultValues(){return s},get _names(){return c},set _names(A){c=A},get _formState(){return r},set _formState(A){r=A},get _options(){return n},set _options(A){n={...n,...A}}},trigger:ne,register:Ie,handleSubmit:Ae,watch:Pe,setValue:U,getValues:ue,reset:Ee,resetField:je,clearErrors:ze,unregister:et,setError:he,setFocus:(A,W={})=>{const H=be(i,A),se=H&&H._f;if(se){const re=se.refs?se.refs[0]:se.ref;re.focus&&(re.focus(),W.shouldSelect&&re.select())}},getFieldState:v}}function Cn(e={}){const t=ct.useRef(),n=ct.useRef(),[r,i]=ct.useState({isDirty:!1,isValidating:!1,isLoading:Qn(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Qn(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...tm(e,()=>i(a=>({...a}))),formState:r});const s=t.current.control;return s._options=e,sa({subject:s._subjects.state,next:a=>{ru(a,s._proxyFormState,s._updateFormState,!0)&&i({...s._formState})}}),ct.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),ct.useEffect(()=>{if(s._proxyFormState.isDirty){const a=s._getDirty();a!==r.isDirty&&s._subjects.state.next({isDirty:a})}},[s,r.isDirty]),ct.useEffect(()=>{e.values&&!ar(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,i(a=>({...a}))):s._resetDefaultValues()},[e.values,s]),ct.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),ct.useEffect(()=>
2{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=nu(r,s),t.current}var hu={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},nl=ct.createContext&&ct.createContext(hu),nm=["attr","size","title"];function rm(e,t){if(e==null)return{};var n=im(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function im(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function to(){return to=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},to.apply(this,arguments)}function rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function no(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rl(Object(n),!0).forEach(function(r){om(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function om(e,t,n){return t=sm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sm(e){var t=am(e,"string");return typeof t=="symbol"?t:t+""}function am(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pu(e){return e&&e.map((t,n)=>ct.createElement(t.tag,no({key:n},t.attr),pu(t.child)))}function Ue(e){return t=>ct.createElement(lm,to({attr:no({},e.attr)},t),pu(e.child))}function lm(e){var t=n=>{var{attr:r,size:i,title:s}=e,a=rm(e,nm),l=i||n.size||"1em",c;return n.className&&(c=n.className),e.className&&(c=(c?c+" ":"")+e.className),ct.createElement("svg",to({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,a,{className:c,style:no(no({color:e.color||n.color},n.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),s&&ct.createElement("title",null,s),e.children)};return nl!==void 0?ct.createElement(nl.Consumer,null,n=>t(n)):t(hu)}function cm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12.01",y2:"16"},child:[]}]})(e)}function mu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"19",y1:"12",x2:"5",y2:"12"},child:[]},{tag:"polyline",attr:{points:"12 19 5 12 12 5"},child:[]}]})(e)}function gu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"5",y1:"12",x2:"19",y2:"12"},child:[]},{tag:"polyline",attr:{points:"12 5 19 12 12 19"},child:[]}]})(e)}function um(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"20",x2:"18",y2:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"20",x2:"12",y2:"4"},child:[]},{tag:"line",attr:{x1:"6",y1:"20",x2:"6",y2:"14"},child:[]}]})(e)}function dm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"},child:[]},{tag:"path",attr:{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"},child:[]}]})(e)}function fm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"6 9 12 15 18 9"},child:[]}]})(e)}function hm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 18 9 12 15 6"},child:[]}]})(e)}function pm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"9 18 15 12 9 6"},child:[]}]})(e)}function xu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"},child:[]},{tag:"path",attr:{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"},child:[]}]})(e)}function mm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},child:[]},{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"line",attr:{x1:"10",y1:"14",x2:"21",y2:"3"},child:[]}]})(e)}function gm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},child:[]},{tag:"line",attr:{x1:"1",y1:"1",x2:"23",y2:"23"},child:[]}]})(e)}function xm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},child:[]},{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]}]})(e)}function bm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"path",attr:{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},child:[]},{tag:"line",attr:{x1:"12",y1:"17",x2:"12.01",y2:"17"},child:[]}]})(e)}function bu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}function ai(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M7 11V7a5 5 0 0 1 10 0v4"},child:[]}]})(e)}function yu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},child:[]},{tag:"polyline",attr:{points:"16 17 21 12 16 7"},child:[]},{tag:"line",attr:{x1:"21",y1:"12",x2:"9",y2:"12"},child:[]}]})(e)}function ro(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"},child:[]},{tag:"polyline",attr:{points:"22,6 12,13 2,6"},child:[]}]})(e)}function wu(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},child:[]}]})(e)}function ku(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"8",y1:"12",x2:"16",y2:"12"},child:[]}]})(e)}function ym(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"}
2,child:[]}]})(e)}function wm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"11",cy:"11",r:"8"},child:[]},{tag:"line",attr:{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},child:[]}]})(e)}function km(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(e)}function Sm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"},child:[]}]})(e)}function vm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"5"},child:[]},{tag:"line",attr:{x1:"12",y1:"1",x2:"12",y2:"3"},child:[]},{tag:"line",attr:{x1:"12",y1:"21",x2:"12",y2:"23"},child:[]},{tag:"line",attr:{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"},child:[]},{tag:"line",attr:{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"},child:[]},{tag:"line",attr:{x1:"1",y1:"12",x2:"3",y2:"12"},child:[]},{tag:"line",attr:{x1:"21",y1:"12",x2:"23",y2:"12"},child:[]},{tag:"line",attr:{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"},child:[]},{tag:"line",attr:{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"},child:[]}]})(e)}function Su(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"3 6 5 6 21 6"},child:[]},{tag:"path",attr:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},child:[]},{tag:"line",attr:{x1:"10",y1:"11",x2:"10",y2:"17"},child:[]},{tag:"line",attr:{x1:"14",y1:"11",x2:"14",y2:"17"},child:[]}]})(e)}function il(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"23 18 13.5 8.5 8.5 13.5 1 6"},child:[]},{tag:"polyline",attr:{points:"17 18 23 18 23 12"},child:[]}]})(e)}function ol(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"23 6 13.5 15.5 8.5 10.5 1 18"},child:[]},{tag:"polyline",attr:{points:"17 6 23 6 23 12"},child:[]}]})(e)}function Cs(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"12",cy:"7",r:"4"},child:[]}]})(e)}function jm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"9",cy:"7",r:"4"},child:[]},{tag:"path",attr:{d:"M23 21v-2a4 4 0 0 0-3-3.87"},child:[]},{tag:"path",attr:{d:"M16 3.13a4 4 0 0 1 0 7.75"},child:[]}]})(e)}function _m(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(e)}const bo=x.forwardRef(function(t,n){const{loading:r,disabled:i,loadingText:s,children:a,...l}=t;return o.jsx(We,{disabled:r||i,ref:n,...l,children:r&&!s?o.jsxs(o.Fragment,{children:[o.jsx(ea,{display:"inline-flex",children:o.jsx(cn,{size:"inherit",color:"inherit"})}),o.jsx(ta,{opacity:0,children:a})]}):r&&s?o.jsxs(o.Fragment,{children:[o.jsx(cn,{size:"inherit",color:"inherit"}),s]}):a})});var Cm=(e,t,n,r,i,s,a,l)=>{let c=document.documentElement,u=["light","dark"];
2function d(h){(Array.isArray(e)?e:[e]).forEach(g=>{let k=g==="class",b=k&&s?i.map(S=>s[S]||S):i;k?(c.classList.remove(...b),c.classList.add(s&&s[h]?s[h]:h)):c.setAttribute(g,h)}),f(h)}function f(h){l&&u.includes(h)&&(c.style.colorScheme=h)}function p(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)d(r);else try{let h=localStorage.getItem(t)||n,g=a&&h==="system"?p():h;d(g)}catch{}},sl=["light","dark"],vu="(prefers-color-scheme: dark)",Em=typeof window>"u",ua=x.createContext(void 0),Am={setTheme:e=>{},themes:[]},ju=()=>{var e;return(e=x.useContext(ua))!=null?e:Am},Im=e=>x.useContext(ua)?x.createElement(x.Fragment,null,e.children):x.createElement(Tm,{...e}),Rm=["light","dark"],Tm=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i="theme",themes:s=Rm,defaultTheme:a=n?"system":"light",attribute:l="data-theme",value:c,children:u,nonce:d,scriptProps:f})=>{let[p,h]=x.useState(()=>Fm(i,a)),[g,k]=x.useState(()=>p==="system"?Yo():p),b=c?Object.values(c):s,S=x.useCallback(O=>{let T=O;if(!T)return;O==="system"&&n&&(T=Yo());let Z=c?c[T]:T,j=t?Pm(d):null,E=document.documentElement,w=M=>{M==="class"?(E.classList.remove(...b),Z&&E.classList.add(Z)):M.startsWith("data-")&&(Z?E.setAttribute(M,Z):E.removeAttribute(M))};if(Array.isArray(l)?l.forEach(w):w(l),r){let M=sl.includes(a)?a:null,z=sl.includes(T)?T:M;E.style.colorScheme=z}j==null||j()},[d]),y=x.useCallback(O=>{let T=typeof O=="function"?O(p):O;h(T);try{localStorage.setItem(i,T)}catch{}},[p]),R=x.useCallback(O=>{let T=Yo(O);k(T),p==="system"&&n&&!e&&S("system")},[p,e]);x.useEffect(()=>{let O=window.matchMedia(vu);return O.addListener(R),R(O),()=>O.removeListener(R)},[R]),x.useEffect(()=>{let O=T=>{T.key===i&&(T.newValue?h(T.newValue):y(a))};return window.addEventListener("storage",O),()=>window.removeEventListener("storage",O)},[y]),x.useEffect(()=>{S(e??p)},[e,p]);let L=x.useMemo(()=>({theme:p,setTheme:y,forcedTheme:e,resolvedTheme:p==="system"?g:p,themes:n?[...s,"system"]:s,systemTheme:n?g:void 0}),[p,y,e,g,n,s]);return x.createElement(ua.Provider,{value:L},x.createElement(zm,{forcedTheme:e,storageKey:i,attribute:l,enableSystem:n,enableColorScheme:r,defaultTheme:a,value:c,themes:s,nonce:d,scriptProps:f}),u)},zm=x.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:a,themes:l,nonce:c,scriptProps:u})=>{let d=JSON.stringify([n,t,s,e,l,a,r,i]).slice(1,-1);return x.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${Cm.toString()})(${d})`}})}),Fm=(e,t)=>{if(Em)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},Pm=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},Yo=e=>(e||(e=window.matchMedia(vu)),e.matches?"dark":"light");function Lm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"},child:[]},{tag:"path",attr:{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"},child:[]},{tag:"path",attr:{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"},child:[]},{tag:"path",attr:{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"},child:[]},{tag:"path",attr:{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"},child:[]},{tag:"path",attr:{d:"M3.477 10.896a4 4 0 0 1 .585-.396"},child:[]},{tag:"path",attr:{d:"M19.938 10.5a4 4 0 0 1 .585.396"},child:[]},{tag:"path",attr:{d:"M6 18a4 4 0 0 1-1.967-.516"},child:[]},{tag:"path",attr:{d:"M19.967 17.484A4 4 0 0 1 18 18"},child:[]}]})(e)}function _u(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(e)}function Mm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"m9 18 6-6-6-6"},child:[]}]})(e)}function Dm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12h14"},child:[]}]})(e)}
2function Om(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"},child:[]}]})(e)}function Bm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12h14"},child:[]},{tag:"path",attr:{d:"M12 5v14"},child:[]}]})(e)}function Nm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"},child:[]},{tag:"path",attr:{d:"m21.854 2.147-10.94 10.939"},child:[]}]})(e)}function $m(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"4"},child:[]},{tag:"path",attr:{d:"M12 2v2"},child:[]},{tag:"path",attr:{d:"M12 20v2"},child:[]},{tag:"path",attr:{d:"m4.93 4.93 1.41 1.41"},child:[]},{tag:"path",attr:{d:"m17.66 17.66 1.41 1.41"},child:[]},{tag:"path",attr:{d:"M2 12h2"},child:[]},{tag:"path",attr:{d:"M20 12h2"},child:[]},{tag:"path",attr:{d:"m6.34 17.66-1.41 1.41"},child:[]},{tag:"path",attr:{d:"m19.07 4.93-1.41 1.41"},child:[]}]})(e)}function Wm(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 6 6 18"},child:[]},{tag:"path",attr:{d:"m6 6 12 12"},child:[]}]})(e)}function Um(e){return o.jsx(Im,{attribute:"class",disableTransitionOnChange:!0,...e})}function yo(){const{resolvedTheme:e,setTheme:t}=ju();return{colorMode:e,setColorMode:t,toggleColorMode:()=>{t(e==="dark"?"light":"dark")}}}function le(e,t){const{colorMode:n}=yo();return n==="dark"?t:e}function Hm(){const{colorMode:e}=yo();return e==="dark"?o.jsx(Om,{}):o.jsx($m,{})}x.forwardRef(function(t,n){const{toggleColorMode:r}=yo();return o.jsx(Qf,{fallback:o.jsx(na,{boxSize:"8"}),children:o.jsx(_n,{onClick:r,variant:"ghost","aria-label":"Toggle color mode",size:"sm",ref:n,...t,css:{_icon:{width:"5",height:"5"}},children:o.jsx(Hm,{})})})});x.forwardRef(function(t,n){return o.jsx(ta,{color:"fg",display:"contents",className:"chakra-theme light",colorPalette:"gray",colorScheme:"light",ref:n,...t})});x.forwardRef(function(t,n){return o.jsx(ta,{color:"fg",display:"contents",className:"chakra-theme dark",colorPalette:"gray",colorScheme:"dark",ref:n,...t})});const _t=x.forwardRef(function(t,n){const{label:r,children:i,helperText:s,errorText:a,optionalText:l,...c}=t;return o.jsxs(eh,{ref:n,...c,children:[r&&o.jsxs(th,{children:[r,o.jsx(nh,{fallback:l})]}),i,s&&o.jsx(rh,{children:s}),a&&o.jsx(ih,{children:a})]})}),li=x.forwardRef(function(t,n){const{startElement:r,startElementProps:i,endElement:s,endElementProps:a,children:l,startOffset:c="6px",endOffset:u="6px",...d}=t,f=x.Children.only(l);return o.jsxs(oh,{ref:n,...d,children:[r&&o.jsx(qa,{pointerEvents:"none",...i,children:r}),x.cloneElement(f,{...r&&{ps:`calc(var(--input-height) - ${c})`},...s&&{pe:`calc(var(--input-height) - ${u})`},...l.props}),s&&o.jsx(qa,{placement:"end",...a,children:s})]})}),ci=x.forwardRef(function(t,n){var k;const{rootProps:r,defaultVisible:i,visible:s,onVisibleChange:a,visibilityIcon:l={on:o.jsx(xm,{}),off:o.jsx(gm,{})},startElement:c,type:u,errors:d,...f}=t,[p,h]=sh({value:s,defaultValue:i||!1,onChange:a}),g=x.useRef(null);return o.jsx(_t,{invalid:!!d[u],errorText:(k=d[u])==null?void 0:k.message,alignSelf:"start",children:o.jsx(li,{width:"100%",startElement:c,endElement:o.jsx(qm,{disabled:f.disabled,onPointerDown:b=>{f.disabled||b.button===0&&(b.preventDefault(),h(!p))},children:p?l.off:l.on}),...r,children:o.jsx(Mt,{...f,ref:ah(n,g),type:p?"text":"password"})})})}),qm=x.forwardRef(function(t,n){return o.jsx(_n,{tabIndex:-1,ref:n,me:"-2",aspectRatio:"square",size:"sm",variant:"ghost",height:"calc(100% - {spacing.2})","aria-label":"Toggle password visibility",color:"inherit",...t})});x.forwardRef(function(t,n){const{max:r=4,value:i,...s}=t,a=i/r*100,{label:l,colorPalette:c}=Vm(a);return o.jsxs(hr,{align:"flex-end",gap:"1",ref:n,...s,children:[o.jsx(Rt,{width:"full",ref:n,...s,children:Array.from({length:r}).map((u,d)=>o.jsx(m,{height:"1",flex:"1",rounded:"sm","data-selected":d<i?"":void 0,layerStyle:"fill.subtle",colorPalette:"gray",_selected:{colorPalette:c,layerStyle:"fill.solid"}},d))}),l&&o.jsx(Rt,{textStyle:"xs",children:l})]})});function Vm(e){switch(!0){case e<33:return{label:"Low",colorPalette:"red"};case e<66:return{label:"Medium",colorPalette:"orange"};default:return{label:"High",colorPalette:"green"}}}
2class Es extends Error{constructor(n,r,i){super(i);rn(this,"url");rn(this,"status");rn(this,"statusText");rn(this,"body");rn(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=n}}class Zm extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}class Gm{constructor(t){rn(this,"_isResolved");rn(this,"_isRejected");rn(this,"_isCancelled");rn(this,"cancelHandlers");rn(this,"promise");rn(this,"_resolve");rn(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((n,r)=>{this._resolve=n,this._reject=r;const i=l=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(l))},s=l=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(l))},a=l=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(l)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),t(i,s,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,n){return this.promise.then(t,n)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(const t of this.cancelHandlers)t()}catch(t){console.warn("Cancellation threw an error",t);return}this.cancelHandlers.length=0,this._reject&&this._reject(new Zm("Request aborted"))}}get isCancelled(){return this._isCancelled}}class al{constructor(){rn(this,"_fns");this._fns=[]}eject(t){const n=this._fns.indexOf(t);n!==-1&&(this._fns=[...this._fns.slice(0,n),...this._fns.slice(n+1)])}use(t){this._fns=[...this._fns,t]}}const Le={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"0.1.0",WITH_CREDENTIALS:!1,interceptors:{request:new al,response:new al}};function Cu(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ym}=Object.prototype,{getPrototypeOf:da}=Object,{iterator:wo,toStringTag:Eu}=Symbol,ko=(e=>t=>{const n=Ym.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),En=e=>(e=e.toLowerCase(),t=>ko(t)===e),So=e=>t=>typeof t===e,{isArray:Br}=Array,ui=So("undefined");function Km(e){return e!==null&&!ui(e)&&e.constructor!==null&&!ui(e.constructor)&&an(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Au=En("ArrayBuffer");function Jm(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Au(e.buffer),t}const Xm=So("string"),an=So("function"),Iu=So("number"),vo=e=>e!==null&&typeof e=="object",Qm=e=>e===!0||e===!1,Hi=e=>{if(ko(e)!=="object")return!1;const t=da(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Eu in e)&&!(wo in e)},eg=En("Date"),tg=En("File"),ng=En("Blob"),rg=En("FileList"),ig=e=>vo(e)&&an(e.pipe),og=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||an(e.append)&&((t=ko(e))==="formdata"||t==="object"&&an(e.toString)&&e.toString()==="[object FormData]"))},sg=En("URLSearchParams"),[ag,lg,cg,ug]=["ReadableStream","Request","Response","Headers"].map(En),dg=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wi(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Br(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),a=s.length;let l;for(r=0;r<a;r++)l=s[r],t.call(null,e[l],l,e)}}function Ru(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Tu=e=>!ui(e)&&e!==lr;function As(){const{caseless:e}=Tu(this)&&this||{},t={},n=(r,i)=>{const s=e&&Ru(t,i)||i;Hi(t[s])&&Hi(r)?t[s]=As(t[s],r):Hi(r)?t[s]=As({},r):Br(r)?t[s]=r.slice():t[s]=r};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&wi(arguments[r],n);return t}const fg=(e,t,n,{allOwnKeys:r}={})=>(wi(t,(i,s)=>{n&&an(i)?e[s]=Cu(i,n):e[s]=i},{allOwnKeys:r}),e),hg=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pg=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},mg=(e,t,n,r)=>{let i,s,a;const l={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)a=i[s],(!r||r(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=n!==!1&&da(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},gg=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},xg=e=>{if(!e)return null;if(Br(e))return e;let t=e.length;if(!Iu(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},bg=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&da(Uint8Array)),yg=(e,t)=>
2{const r=(e&&e[wo]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},wg=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},kg=En("HTMLFormElement"),Sg=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),ll=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vg=En("RegExp"),zu=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};wi(n,(i,s)=>{let a;(a=t(i,s,e))!==!1&&(r[s]=a||i)}),Object.defineProperties(e,r)},jg=e=>{zu(e,(t,n)=>{if(an(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(an(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},_g=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Br(e)?r(e):r(String(e).split(t)),n},Cg=()=>{},Eg=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Ag(e){return!!(e&&an(e.append)&&e[Eu]==="FormData"&&e[wo])}const Ig=e=>{const t=new Array(10),n=(r,i)=>{if(vo(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[i]=r;const s=Br(r)?[]:{};return wi(r,(a,l)=>{const c=n(a,i+1);!ui(c)&&(s[l]=c)}),t[i]=void 0,s}}return r};return n(e,0)},Rg=En("AsyncFunction"),Tg=e=>e&&(vo(e)||an(e))&&an(e.then)&&an(e.catch),Fu=((e,t)=>e?setImmediate:t?((n,r)=>(lr.addEventListener("message",({source:i,data:s})=>{i===lr&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),lr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",an(lr.postMessage)),zg=typeof queueMicrotask<"u"?queueMicrotask.bind(lr):typeof process<"u"&&process.nextTick||Fu,Fg=e=>e!=null&&an(e[wo]),V={isArray:Br,isArrayBuffer:Au,isBuffer:Km,isFormData:og,isArrayBufferView:Jm,isString:Xm,isNumber:Iu,isBoolean:Qm,isObject:vo,isPlainObject:Hi,isReadableStream:ag,isRequest:lg,isResponse:cg,isHeaders:ug,isUndefined:ui,isDate:eg,isFile:tg,isBlob:ng,isRegExp:vg,isFunction:an,isStream:ig,isURLSearchParams:sg,isTypedArray:bg,isFileList:rg,forEach:wi,merge:As,extend:fg,trim:dg,stripBOM:hg,inherits:pg,toFlatObject:mg,kindOf:ko,kindOfTest:En,endsWith:gg,toArray:xg,forEachEntry:yg,matchAll:wg,isHTMLForm:kg,hasOwnProperty:ll,hasOwnProp:ll,reduceDescriptors:zu,freezeMethods:jg,toObjectSet:_g,toCamelCase:Sg,noop:Cg,toFiniteNumber:Eg,findKey:Ru,global:lr,isContextDefined:Tu,isSpecCompliantForm:Ag,toJSONObject:Ig,isAsyncFn:Rg,isThenable:Tg,setImmediate:Fu,asap:zg,isIterable:Fg};function Ye(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}V.inherits(Ye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}});const Pu=Ye.prototype,Lu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Lu[e]={value:e}});Object.defineProperties(Ye,Lu);Object.defineProperty(Pu,"isAxiosError",{value:!0});Ye.from=(e,t,n,r,i,s)=>{const a=Object.create(Pu);return V.toFlatObject(e,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),Ye.call(a,e.message,t,n,r,i),a.cause=e,a.name=e.name,s&&Object.assign(a,s),a};const Pg=null;function Is(e){return V.isPlainObject(e)||V.isArray(e)}function Mu(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function cl(e,t,n){return e?e.concat(t).map(function(i,s){return i=Mu(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function Lg(e){return V.isArray(e)&&!e.some(Is)}const Mg=V.toFlatObject(V,{},null,function(t){return/^is[A-Z]/.test(t)});function jo(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,b){return!V.isUndefined(b[k])});const r=n.metaTokens,i=n.visitor||d,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(V.isDate(g))return g.toISOString();if(!c&&V.isBlob(g))throw new Ye("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(g)||V.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,k,b){let S=g;if(g&&!b&&typeof g=="object"){if(V.endsWith(k,"{}"))k=r?k:k.slice(0,-2),g=JSON.stringify(g);else if(V.isArray(g)&&Lg(g)||(V.isFileList(g)||V.endsWith(k,"[]"))&&(S=V.toArray(g)))return k=Mu(k),S.forEac
vendor: 4,237 bytes, line 2
2h(function(R,L){!(V.isUndefined(R)||R===null)&&t.append(a===!0?cl([k],L,s):a===null?k:k+"[]",u(R))}),!1}return Is(g)?!0:(t.append(cl(b,k,s),u(g)),!1)}const f=[],p=Object.assign(Mg,{defaultVisitor:d,convertValue:u,isVisitable:Is});function h(g,k){if(!V.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+k.join("."));f.push(g),V.forEach(g,function(S,y){(!(V.isUndefined(S)||S===null)&&i.call(t,S,V.isString(y)?y.trim():y,k,p))===!0&&h(S,k?k.concat(y):[y])}),f.pop()}}if(!V.isObject(e))throw new TypeError("data must be an object");return h(e),t}function ul(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function fa(e,t){this._pairs=[],e&&jo(e,this,t)}const Du=fa.prototype;Du.append=function(t,n){this._pairs.push([t,n])};Du.toString=function(t){const n=t?function(r){return t.call(this,r,ul)}:ul;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Dg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ou(e,t,n){if(!t)return e;const r=n&&n.encode||Dg;V.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(t,n):s=V.isURLSearchParams(t)?t.toString():new fa(t,n).toString(r),s){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class dl{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){V.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Bu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Og=typeof URLSearchParams<"u"?URLSearchParams:fa,Bg=typeof FormData<"u"?FormData:null,Ng=typeof Blob<"u"?Blob:null,$g={isBrowser:!0,classes:{URLSearchParams:Og,FormData:Bg,Blob:Ng},protocols:["http","https","file","blob","url","data"]},ha=typeof window<"u"&&typeof document<"u",Rs=typeof navigator=="object"&&navigator||void 0,Wg=ha&&(!Rs||["ReactNative","NativeScript","NS"].indexOf(Rs.product)<0),Ug=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hg=ha&&window.location.href||"http://localhost",qg=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ha,hasStandardBrowserEnv:Wg,hasStandardBrowserWebWorkerEnv:Ug,navigator:Rs,origin:Hg},Symbol.toStringTag,{value:"Module"})),qt={...qg,...$g};function Vg(e,t){return jo(e,new qt.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return qt.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Zg(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gg(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}function Nu(e){function t(n,r,i,s){let a=n[s++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),c=s>=n.length;return a=!a&&V.isArray(i)?i.length:a,c?(V.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!l):((!i[a]||!V.isObject(i[a]))&&(i[a]=[]),t(n,r,i[a],s)&&V.isArray(i[a])&&(i[a]=Gg(i[a])),!l)}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(r,i)=>{t(Zg(r),i,n,0)}),n}return null}function Yg(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ki={transitional:Bu,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=V.isObject(t);if(s&&V.isHTMLForm(t)&&(t=new FormData(t)),V.isFormData(t))return i?JSON.stringify(Nu(t)):t;if(V.isArrayBuffer(t)||V.isBuffer(t)||V.isStream(t)||V.isFile(t)||V.isBlob(t)||V.isReadableStream(t))return t;if(V.isArrayBufferView(t))return t.buffer;if(V.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>
vendor: 4,409 bytes, lines 2-4
2-1)return Vg(t,this.formSerializer).toString();if((l=V.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return jo(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),Yg(t)):t}],transformResponse:[function(t){const n=this.transitional||ki.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(V.isResponse(t)||V.isReadableStream(t))return t;if(t&&V.isString(t)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?Ye.from(l,Ye.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{ki.headers[e]={}});const Kg=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Jg=e=>{const t={};let n,r,i;return e&&e.split(` 3`).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),r=a.substring(i+1).trim(),!(!n||t[n]&&Kg[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},fl=Symbol("internals");function Zr(e){return e&&String(e).trim().toLowerCase()}function qi(e){return e===!1||e==null?e:V.isArray(e)?e.map(qi):String(e)}function Xg(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Qg=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ko(e,t,n,r,i){if(V.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!V.isString(t)){if(V.isString(r))return t.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(t)}}function ex(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function tx(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,a){return this[r].call(this,t,i,s,a)},configurable:!0})})}let ln=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(l,c,u){const d=Zr(c);if(!d)throw new Error("header name must be a non-empty string");const f=V.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=qi(l))}const a=(l,c)=>V.forEach(l,(u,d)=>s(u,d,c));if(V.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(V.isString(t)&&(t=t.trim())&&!Qg(t))a(Jg(t),n);else if(V.isObject(t)&&V.isIterable(t)){let l={},c,u;for(const d of t){if(!V.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?V.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}a(l,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Zr(t),t){const r=V.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return Xg(i);if(V.isFunction(n))return n.call(this,i,r);if(V.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Zr(t),t){const r=V.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Ko(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(a){if(a=Zr(a),a){const l=V.findKey(r,a);l&&(!n||Ko(r,r[l],l,n))&&(delete r[l],i=!0)}}return V.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||Ko(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return V.forEach(this,(i,s)=>{const a=V.findKey(r,s);if(a){n[a]=qi(i),delete n[s];return}const l=t?ex(s):String(s).trim();l!==s&&delete n[s],n[l]=qi(i),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return V.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` 4`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);
4return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[fl]=this[fl]={accessors:{}}).accessors,i=this.prototype;function s(a){const l=Zr(a);r[l]||(tx(i,a),r[l]=!0)}return V.isArray(t)?t.forEach(s):s(t),this}};ln.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(ln.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});V.freezeMethods(ln);function Jo(e,t){const n=this||ki,r=t||n,i=ln.from(r.headers);let s=r.data;return V.forEach(e,function(l){s=l.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function $u(e){return!!(e&&e.__CANCEL__)}function Nr(e,t,n){Ye.call(this,e??"canceled",Ye.ERR_CANCELED,t,n),this.name="CanceledError"}V.inherits(Nr,Ye,{__CANCEL__:!0});function Wu(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ye("Request failed with status code "+n.status,[Ye.ERR_BAD_REQUEST,Ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function nx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rx(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[s];a||(a=u),n[i]=c,r[i]=u;let f=s,p=0;for(;f!==i;)p+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-a<t)return;const h=d&&u-d;return h?Math.round(p*1e3/h):void 0}}function ix(e,t){let n=0,r=1e3/t,i,s;const a=(u,d=Date.now())=>{n=d,i=null,s&&(clearTimeout(s),s=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?a(u,d):(i=u,s||(s=setTimeout(()=>{s=null,a(i)},r-f)))},()=>i&&a(i)]}const io=(e,t,n=3)=>{let r=0;const i=rx(50,250);return ix(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,c=a-r,u=i(c),d=a<=l;r=a;const f={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},hl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},pl=e=>(...t)=>V.asap(()=>e(...t)),ox=qt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,qt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,sx=qt.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const a=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),V.isString(r)&&a.push("path="+r),V.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ax(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Uu(e,t,n){let r=!ax(t);return e&&(r||n==!1)?lx(e,t):t}const ml=e=>e instanceof ln?{...e}:e;function mr(e,t){t=t||{};const n={};function r(u,d,f,p){return V.isPlainObject(u)&&V.isPlainObject(d)?V.merge.call({caseless:p},u,d):V.isPlainObject(d)?V.merge({},d):V.isArray(d)?d.slice():d}function i(u,d,f,p){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function s(u,d){if(!V.isUndefined(d))return r(void 0,d)}function a(u,d){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d,f)=>i(ml(u),ml(d),f,!0)};return V.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||i,p=f(e[d],t[d],d);V.isUndefined(p)&&f!==l||(n[d]=p)}),n}const Hu=e=>{const t=mr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;t.headers=a=ln.from(a),t.url=Ou(Uu(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(V.isFormData(n)){if(qt.hasStandardBrowserEnv||qt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>
4f.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(qt.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||r!==!1&&ox(t.url))){const u=i&&s&&sx.read(s);u&&a.set(i,u)}return t},cx=typeof XMLHttpRequest<"u",ux=cx&&function(e){return new Promise(function(n,r){const i=Hu(e);let s=i.data;const a=ln.from(i.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=i,d,f,p,h,g;function k(){h&&h(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function S(){if(!b)return;const R=ln.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),O={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:R,config:e,request:b};Wu(function(Z){n(Z),k()},function(Z){r(Z),k()},O),b=null}"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(S)},b.onabort=function(){b&&(r(new Ye("Request aborted",Ye.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new Ye("Network Error",Ye.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let L=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const O=i.transitional||Bu;i.timeoutErrorMessage&&(L=i.timeoutErrorMessage),r(new Ye(L,O.clarifyTimeoutError?Ye.ETIMEDOUT:Ye.ECONNABORTED,e,b)),b=null},s===void 0&&a.setContentType(null),"setRequestHeader"in b&&V.forEach(a.toJSON(),function(L,O){b.setRequestHeader(O,L)}),V.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),l&&l!=="json"&&(b.responseType=i.responseType),u&&([p,g]=io(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,h]=io(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(d=R=>{b&&(r(!R||R.type?new Nr(null,e,b):R),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const y=nx(i.url);if(y&&qt.protocols.indexOf(y)===-1){r(new Ye("Unsupported protocol "+y+":",Ye.ERR_BAD_REQUEST,e));return}b.send(s||null)})},dx=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof Ye?d:new Nr(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,s(new Ye(`timeout ${t} of ms exceeded`,Ye.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>V.asap(l),c}},fx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},hx=async function*(e,t){for await(const n of px(e))yield*fx(n,t)},px=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},gl=(e,t,n,r)=>{const i=hx(e,t);let s=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await i.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=s+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},_o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",qu=_o&&typeof ReadableStream=="function",mx=_o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Vu=(e,...t)=>{try{return!!e(...t)}catch{return!1}},gx=qu&&Vu(()=>{let e=!1;const t=new Request(qt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),xl=64*1024,Ts=qu&&Vu(()=>V.isReadableStream(new Response("").body)),oo={stream:Ts&&(e=>e.body)};_o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!oo[t]&&(oo[t]=V.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Ye(`Response type '${t}' is not supported`,Ye.ERR_NOT_SUPPORT,r)})})})(new Response);const xx=async e=>{if(e==null)return 0;if(V.isBlob(e))return e.size;
vendor: 8,045 bytes, lines 4-7
4if(V.isSpecCompliantForm(e))return(await new Request(qt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(V.isArrayBufferView(e)||V.isArrayBuffer(e))return e.byteLength;if(V.isURLSearchParams(e)&&(e=e+""),V.isString(e))return(await mx(e)).byteLength},bx=async(e,t)=>{const n=V.toFiniteNumber(e.getContentLength());return n??xx(t)},yx=_o&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:p}=Hu(e);u=u?(u+"").toLowerCase():"text";let h=dx([i,s&&s.toAbortSignal()],a),g;const k=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let b;try{if(c&&gx&&n!=="get"&&n!=="head"&&(b=await bx(d,r))!==0){let O=new Request(t,{method:"POST",body:r,duplex:"half"}),T;if(V.isFormData(r)&&(T=O.headers.get("content-type"))&&d.setContentType(T),O.body){const[Z,j]=hl(b,io(pl(c)));r=gl(O.body,xl,Z,j)}}V.isString(f)||(f=f?"include":"omit");const S="credentials"in Request.prototype;g=new Request(t,{...p,signal:h,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:S?f:void 0});let y=await fetch(g);const R=Ts&&(u==="stream"||u==="response");if(Ts&&(l||R&&k)){const O={};["status","statusText","headers"].forEach(E=>{O[E]=y[E]});const T=V.toFiniteNumber(y.headers.get("content-length")),[Z,j]=l&&hl(T,io(pl(l),!0))||[];y=new Response(gl(y.body,xl,Z,()=>{j&&j(),k&&k()}),O)}u=u||"text";let L=await oo[V.findKey(oo,u)||"text"](y,e);return!R&&k&&k(),await new Promise((O,T)=>{Wu(O,T,{data:L,headers:ln.from(y.headers),status:y.status,statusText:y.statusText,config:e,request:g})})}catch(S){throw k&&k(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new Ye("Network Error",Ye.ERR_NETWORK,e,g),{cause:S.cause||S}):Ye.from(S,S&&S.code,e,g)}}),zs={http:Pg,xhr:ux,fetch:yx};V.forEach(zs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const bl=e=>`- ${e}`,wx=e=>V.isFunction(e)||e===null||e===!1,Zu={getAdapter:e=>{e=V.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s<t;s++){n=e[s];let a;if(r=n,!wx(n)&&(r=zs[(a=String(n)).toLowerCase()],r===void 0))throw new Ye(`Unknown adapter '${a}'`);if(r)break;i[a||"#"+s]=r}if(!r){const s=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since : 5`+s.map(bl).join(` 6`):" "+bl(s[0]):"as no adapter specified";throw new Ye("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:zs};function Xo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Nr(null,e)}function yl(e){return Xo(e),e.headers=ln.from(e.headers),e.data=Jo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zu.getAdapter(e.adapter||ki.adapter)(e).then(function(r){return Xo(e),r.data=Jo.call(e,e.transformResponse,r),r.headers=ln.from(r.headers),r},function(r){return $u(r)||(Xo(e),r&&r.response&&(r.response.data=Jo.call(e,e.transformResponse,r.response),r.response.headers=ln.from(r.response.headers))),Promise.reject(r)})}const Gu="1.9.0",Co={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Co[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const wl={};Co.transitional=function(t,n,r){function i(s,a){return"[Axios v"+Gu+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(t===!1)throw new Ye(i(a," has been removed"+(n?" in "+n:"")),Ye.ERR_DEPRECATED);return n&&!wl[a]&&(wl[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,l):!0}};Co.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function kx(e,t,n){if(typeof e!="object")throw new Ye("options must be an object",Ye.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],a=t[s];if(a){const l=e[s],c=l===void 0||a(l,s,e);if(c!==!0)throw new Ye("option "+s+" must be "+c,Ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ye("Unknown option "+s,Ye.ERR_BAD_OPTION)}}const Vi={assertOptions:kx,validators:Co},An=Vi.validators;let fr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new dl,response:new dl}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` 7`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=mr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Vi.assertOptions(r,{silentJSONParsing:An.transitional(An.boolean),forcedJSONParsing:An.transitional(An.boolean),clarifyTimeoutError:An.transitional(An.boolean)},!1),i!=null&&(V.isFunction(i)?n.paramsSerializer={serialize:i}:Vi.assertOptions(i,{encode:An.function,serialize:An.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Vi.assertOptions(n,{baseUrl:An.spelling("baseURL"),withXsrfToken:An.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&V.merge(s.common,s[n.method]);s&&V.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=ln.concat(a,s);const l=[];let c=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(c=c&&k.synchronous,l.unshift(k.fulfilled,k.rejected))});const u=[];this.interceptors.response.forEach(function(k){u.push(k.fulfilled,k.rejected)});let d,f=0,p;if(!c){const g=[yl.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),p=g.length,d=Promise.resolve(n);f<p;)d=d.then(g[f++],g[f++]);return d}p=l.length;let h=n;for(f=0;f<p;){const g=l[f++],k=l[f++];try{h=g(h)}catch(b){k.call(this,b);break}}try{d=yl.call(this,h)}catch(g){return Promise.reject(g)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=mr(this.defaults,t);const n=Uu(t.baseURL,t.url,t.allowAbsoluteUrls);return Ou(n,t.params,t.paramsSerializer)}};V.forEach(["delete","get","head","options"],function(t){fr.prototype[t]=function(n,r){return this.request(mr(r||{},{method:t,url:n,data:(r||{}).data}))}});V.forEach(["post","put","patch"],function(t){function n(r){return function(s,a,l){return this.request(mr(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}fr.prototype[t]=n(),fr.prototype[t+"Form"]=n(!0)});let Sx=class Yu{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,l){r.reason||(r.reason=new Nr(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Yu(function(i){t=i}),cancel:t}}};function vx(e){return function(n){return e.apply(null,n)}}function jx(e){return V.isObject(e)&&e.isAxiosError===!0}const Fs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
7alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fs).forEach(([e,t])=>{Fs[t]=e});function Ku(e){const t=new fr(e),n=Cu(fr.prototype.request,t);return V.extend(n,fr.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Ku(mr(e,i))},n}const kt=Ku(ki);kt.Axios=fr;kt.CanceledError=Nr;kt.CancelToken=Sx;kt.isCancel=$u;kt.VERSION=Gu;kt.toFormData=jo;kt.AxiosError=Ye;kt.Cancel=kt.CanceledError;kt.all=function(t){return Promise.all(t)};kt.spread=vx;kt.isAxiosError=jx;kt.mergeConfig=mr;kt.AxiosHeaders=ln;kt.formToJSON=e=>Nu(V.isHTMLForm(e)?new FormData(e):e);kt.getAdapter=Zu.getAdapter;kt.HttpStatusCode=Fs;kt.default=kt;const{Axios:fE,AxiosError:hE,CanceledError:pE,isCancel:mE,CancelToken:gE,VERSION:xE,all:bE,Cancel:yE,isAxiosError:wE,spread:kE,toFormData:SE,AxiosHeaders:vE,HttpStatusCode:jE,formToJSON:_E,getAdapter:CE,mergeConfig:EE}=kt,Eo=e=>typeof e=="string",Qo=e=>Eo(e)&&e!=="",Ju=e=>e instanceof Blob,_x=e=>e instanceof FormData,kl=e=>e>=200&&e<300,Cx=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},Ex=e=>{const t=[],n=(i,s)=>{t.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(s))}`)},r=(i,s)=>{s!=null&&(s instanceof Date?n(i,s.toISOString()):Array.isArray(s)?s.forEach(a=>r(i,a)):typeof s=="object"?Object.entries(s).forEach(([a,l])=>r(`${i}[${a}]`,l)):n(i,s))};return Object.entries(e).forEach(([i,s])=>r(i,s)),t.length?`?${t.join("&")}`:""},Ax=(e,t)=>{const n=encodeURI,r=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(s,a)=>{var l;return(l=t.path)!=null&&l.hasOwnProperty(a)?n(String(t.path[a])):s}),i=e.BASE+r;return t.query?i+Ex(t.query):i},Ix=e=>{if(e.formData){const t=new FormData,n=(r,i)=>{Eo(i)||Ju(i)?t.append(r,i):t.append(r,JSON.stringify(i))};return Object.entries(e.formData).filter(([,r])=>r!=null).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n(r,s)):n(r,i)}),t}},Ri=async(e,t)=>typeof t=="function"?t(e):t,Rx=async(e,t)=>{const[n,r,i,s]=await Promise.all([Ri(t,e.TOKEN),Ri(t,e.USERNAME),Ri(t,e.PASSWORD),Ri(t,e.HEADERS)]),a=Object.entries({Accept:"application/json",...s,...t.headers}).filter(([,l])=>l!=null).reduce((l,[c,u])=>({...l,[c]:String(u)}),{});if(Qo(n)&&(a.Authorization=`Bearer ${n}`),Qo(r)&&Qo(i)){const l=Cx(`${r}:${i}`);a.Authorization=`Basic ${l}`}return t.body!==void 0?t.mediaType?a["Content-Type"]=t.mediaType:Ju(t.body)?a["Content-Type"]=t.body.type||"application/octet-stream":Eo(t.body)?a["Content-Type"]="text/plain":_x(t.body)||(a["Content-Type"]="application/json"):t.formData!==void 0&&t.mediaType&&(a["Content-Type"]=t.mediaType),a},Tx=e=>{if(e.body)return e.body},zx=async(e,t,n,r,i,s,a,l)=>{const c=new AbortController;let u={data:r??i,headers:s,method:t.method,signal:c.signal,url:n,withCredentials:e.WITH_CREDENTIALS};a(()=>c.abort());for(const d of e.interceptors.request._fns)u=await d(u);try{return await l.request(u)}catch(d){const f=d;if(f.response)return f.response;throw d}},Fx=(e,t)=>{if(t){const n=e.headers[t];if(Eo(n))return n}},Px=e=>{if(e.status!==204)return e.data},Lx=(e,t)=>{const r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Depen
7dency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...e.errors}[t.status];if(r)throw new Es(e,t,r);if(!t.ok){const i=t.status??"unknown",s=t.statusText??"unknown",a=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new Es(e,t,`Generic Error: status: ${i}; status text: ${s}; body: ${a}`)}},lt=(e,t,n=kt)=>new Gm(async(r,i,s)=>{try{const a=Ax(e,t),l=Ix(t),c=Tx(t),u=await Rx(e,t);if(!s.isCancelled){let d=await zx(e,t,a,c,l,u,s,n);for(const k of e.interceptors.response._fns)d=await k(d);const f=Px(d),p=Fx(d,t.responseHeader);let h=f;t.responseTransformer&&kl(d.status)&&(h=await t.responseTransformer(f));const g={url:a,ok:kl(d.status),status:d.status,statusText:d.statusText,body:p??h};Lx(t,g),r(g.body)}}catch(a){i(a)}});class Ao{static readItems(t={}){return lt(Le,{method:"GET",url:"/api/v1/items/",query:{skip:t.skip,limit:t.limit},errors:{422:"Validation Error"}})}static createItem(t){return lt(Le,{method:"POST",url:"/api/v1/items/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static readItem(t){return lt(Le,{method:"GET",url:"/api/v1/items/{id}",path:{id:t.id},errors:{422:"Validation Error"}})}static updateItem(t){return lt(Le,{method:"PUT",url:"/api/v1/items/{id}",path:{id:t.id},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteItem(t){return lt(Le,{method:"DELETE",url:"/api/v1/items/{id}",path:{id:t.id},errors:{422:"Validation Error"}})}}class pa{static loginAccessToken(t){return lt(Le,{method:"POST",url:"/api/v1/login/access-token",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static testToken(){return lt(Le,{method:"POST",url:"/api/v1/login/test-token"})}static logout(){return lt(Le,{method:"POST",url:"/api/v1/logout"})}static recoverPassword(t){return lt(Le,{method:"POST",url:"/api/v1/password-recovery/{email}",path:{email:t.email},errors:{422:"Validation Error"}})}static resetPassword(t){return lt(Le,{method:"POST",url:"/api/v1/reset-password/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static recoverPasswordHtmlContent(t){return lt(Le,{method:"POST",url:"/api/v1/password-recovery-html-content/{email}",path:{email:t.email},errors:{422:"Validation Error"}})}}class er{static readUsers(t={}){return lt(Le,{method:"GET",url:"/api/v1/users/",query:{skip:t.skip,limit:t.limit},errors:{422:"Validation Error"}})}static createUser(t){return lt(Le,{method:"POST",url:"/api/v1/users/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static readUserMe(){return lt(Le,{method:"GET",url:"/api/v1/users/me"})}static deleteUserMe(){return lt(Le,{method:"DELETE",url:"/api/v1/users/me"})}static updateUserMe(t){return lt(Le,{method:"PATCH",url:"/api/v1/users/me",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static updatePasswordMe(t){return lt(Le,{method:"PATCH",url:"/api/v1/users/me/password",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static acceptTermsMe(){return lt(Le,{method:"PATCH",url:"/api/v1/users/me/accept-terms"})}static getTermsStatusMe(){return lt(Le,{method:"GET",url:"/api/v1/users/me/terms-status"})}static registerUser(t){return lt(Le,{method:"POST",url:"/api/v1/users/signup",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static getOrCreateGuestUser(t){return lt(Le,{method:"POST",url:"/api/v1/users/guest",query:{fingerprint_hash:t.fingerprintHash},errors:{422:"Validation Error"}})}static readUserById(t){return lt(Le,{method:"GET",url:"/api/v1/users/{user_id}",path:{user_id:t.userId},errors:{422:"Validation Error"}})}static updateUser(t){return lt(Le,{method:"PATCH",url:"/api/v1/users/{user_id}",path:{user_id:t.userId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteUser(t){return lt(Le,{method:"DELETE",url:"/api/v1/users/{user_id}",path:{user_id:t.userId},errors:{422:"Validation Error"}})}static acceptTerms(t={}){return lt(Le,{method:"POST",url:"/api/v1/users/accept-terms",query:{fingerprint_hash:t.fingerprintHash},errors:{422:"Validation Error"}})}static getTermsStatus(t={}){return lt(Le,{method:"GET",url:"/api/v1/users/terms-status",query:{fingerprint_hash:t.fingerprintHash},errors:{422:"Validation Error"}})}}const Mx=()=>{typeof window<"u"&&(window.dataLayer=window.dataLayer||[])},Xu=(e,t)=>{if(typeof window>"u")return;window.dataLayer=window.dataLayer||[];const n={event:e};t&&typeof t=="object"&&Object.assign(n,t),window.dataLayer.push(n)},Qu=(e,t)=>{Xu("page_view",{page_title:typeof document<"u"?document.title:void 0,page_location:typeof window<"u"?window.location.href:void 0,page_path:e})},Io=(e,t)=>{Xu(e,t)},gr=(e,t)=>{Io("chat_interaction",{chat_action:e,...t})},or=(e,t)=>
7{Io("battle_interaction",{battle_action:e,...t})},Mr=(e,t)=>{Io("auth_interaction",{auth_action:e,auth_method:t})},Ps=lh({placement:"top-end",pauseOnPageIdle:!0}),Dx=()=>o.jsx(Jt,{children:o.jsx(ch,{toaster:Ps,insetInline:{mdDown:"4"},children:e=>{var t,n;return o.jsxs(uh,{width:{md:"sm"},color:(t=e.meta)==null?void 0:t.color,children:[e.type==="loading"?o.jsx(cn,{size:"sm",color:"blue.solid"}):o.jsx(dh,{}),o.jsxs(hr,{gap:"1",flex:"1",maxWidth:"100%",children:[e.title&&o.jsx(fh,{children:e.title}),e.description&&o.jsx(hh,{children:e.description})]}),e.action&&o.jsx(ph,{children:e.action.label}),((n=e.meta)==null?void 0:n.closable)&&o.jsx(mh,{})]})}})}),Ln=()=>({showSuccessToast:n=>{Ps.create({title:"Success!",description:n,type:"success"})},showErrorToast:n=>{Ps.create({title:"Something went wrong!",description:n,type:"error"})}}),$r={value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"},ma=(e=!0)=>{const t={minLength:{value:8,message:"Password must be at least 8 characters"}};return e&&(t.required="Password is required"),t},ed=(e,t=!0)=>{const n={validate:r=>{const i=e().password||e().new_password;return r===i?!0:"The passwords do not match"}};return t&&(n.required="Password confirmation is required"),n},Wn=e=>{var i;const{showErrorToast:t}=Ln(),n=(i=e.body)==null?void 0:i.detail;let r=n||"Something went wrong.";Array.isArray(n)&&n.length>0&&(r=n[0].msg),t(r)},Ox=()=>{const e=Object.keys(localStorage);for(const t of e)t.startsWith("chat_history_")&&localStorage.removeItem(t)},so=e=>`chat_history_${e}`,Bx=(e,t)=>{try{localStorage.setItem(so(e),JSON.stringify(t))}catch{}},Nx=e=>{try{const t=localStorage.getItem(so(e));return t?JSON.parse(t):[]}catch{return[]}},ga="guest_fingerprint_hash",Ls=()=>{const e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("");return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20,32)}`},$x=()=>`guest_${Ls()}`,Wx=e=>{localStorage.setItem(ga,e)},xa=()=>localStorage.getItem(ga),Fn=()=>{let e=xa();return e||(e=$x(),Wx(e)),e},td=()=>{localStorage.removeItem(ga)},zn=()=>{let e=null;try{e=JSON.parse(localStorage.getItem("user")||"null")}catch(n){console.error("Error accessing localStorage for user identification:",n),e=null}const t=Fn();if(e!=null&&e.id)return{user_id:e.id,fingerprint_hash:t};if(t)return{fingerprint_hash:t};throw new Error("No user identification available - user must be logged in or have a guest fingerprint")},nr=()=>localStorage.getItem("access_token")!==null,xr=()=>!nr()&&!!xa(),dn=()=>{const[e,t]=x.useState(null),n=un(),r=Ht(),{data:i}=pr({queryKey:["currentUser"],queryFn:async()=>{const p=await er.readUserMe();return p&&localStorage.setItem("user",JSON.stringify(p)),p},enabled:nr()}),[s,a]=x.useState(()=>xa());x.useEffect(()=>{if(!nr()){const p=Fn();a(p)}},[]);const l=xn({mutationFn:p=>er.registerUser({requestBody:p}),onSuccess:()=>{n({to:"/login"})},onError:p=>{Wn(p)},onSettled:()=>{r.invalidateQueries({queryKey:["users"]})}}),u=xn({mutationFn:async p=>{let h=s;h||(h=Fn(),a(h));const g=await pa.loginAccessToken({requestBody:{...p,fingerprint_hash:h}});localStorage.setItem("access_token",g.access_token);try{const k=await er.readUserMe();localStorage.setItem("user",JSON.stringify(k))}catch(k){console.error("Failed to fetch user data:",k)}td(),a(null)},onSuccess:()=>{n({to:"/"})},onError:p=>{Wn(p)}}),d=async()=>{try{Mr("logout","manual");const p=localStorage.getItem("access_token");p&&await fetch("https://api.biomedarena.ai/api/v1/logout",{method:"POST",headers:{Authorization:`Bearer ${p}`,"Content-Type":"application/json"}})}catch(p){console.warn("Failed to invalidate token on server:",p)}finally{localStorage.removeItem("access_token"),localStorage.removeItem("user"),Ox();const p=Fn();a(p),n({to:"/login"})}},f=i;return{signUpMutation:l,loginMutation:u,logout:d,user:i,error:e,resetError:()=>t(null),guestFingerprint:s,isGuest:xr(),isAdmin:!!(i!=null&&i.is_superuser),currentUser:f}},Ux=Qt("/signup")({component:Hx,beforeLoad:async()=>
7{if(nr())throw $n({to:"/"})}});function Hx(){var l,c;const{signUpMutation:e}=dn(),{register:t,handleSubmit:n,getValues:r,formState:{errors:i,isSubmitting:s}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{email:"",full_name:"",password:"",confirm_password:""}}),a=u=>{Mr("signup","email"),e.mutate(u)};return o.jsx(o.Fragment,{children:o.jsx(Me,{flexDir:{base:"column",md:"row"},justify:"center",h:"100vh",children:o.jsxs(Pn,{as:"form",onSubmit:n(a),h:"100vh",maxW:"sm",alignItems:"stretch",justifyContent:"center",gap:4,centerContent:!0,children:[o.jsx(Me,{w:"45",h:"45",display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:4,position:"relative",children:o.jsx("img",{src:"/assets/images/bmarena.svg",alt:"BiomedArena",style:{width:"9rem",height:"9rem",objectFit:"contain",filter:le("invert(1)","none")}})}),o.jsx(N,{fontSize:"4xl",fontWeight:"400",color:"ui.text",mb:2,letterSpacing:"tight",textShadow:"0 2px 8px rgba(0,0,0,0.18)",fontFamily:"'Geomanist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",lineHeight:"1.1",position:"relative",zIndex:5,textAlign:"center",children:"BiomedArena"}),o.jsx(_t,{invalid:!!i.full_name,errorText:(l=i.full_name)==null?void 0:l.message,children:o.jsx(li,{w:"100%",startElement:o.jsx(Cs,{}),children:o.jsx(Mt,{id:"full_name",minLength:3,...t("full_name",{required:"Full Name is required"}),placeholder:"Full Name",type:"text"})})}),o.jsx(_t,{invalid:!!i.email,errorText:(c=i.email)==null?void 0:c.message,children:o.jsx(li,{w:"100%",startElement:o.jsx(Cs,{}),children:o.jsx(Mt,{id:"email",...t("email",{required:"Email is required",pattern:$r}),placeholder:"Email",type:"email"})})}),o.jsx(ci,{type:"password",startElement:o.jsx(ai,{}),...t("password",ma()),placeholder:"Password",errors:i}),o.jsx(ci,{type:"confirm_password",startElement:o.jsx(ai,{}),...t("confirm_password",ed(r)),placeholder:"Confirm Password",errors:i}),o.jsx(bo,{variant:"solid",type:"submit",loading:s,children:"Sign Up"}),o.jsxs(N,{children:["Already have an account?"," ",o.jsx(Lr,{to:"/login",className:"main-link",children:"Log In"})]})]})})})}const qx=Qt("/reset-password")({component:Vx,beforeLoad:async()=>{if(nr())throw $n({to:"/"})}});function Vx(){const{register:e,handleSubmit:t,getValues:n,reset:r,formState:{errors:i}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{new_password:""}}),{showSuccessToast:s}=Ln(),a=un(),c=xn({mutationFn:async d=>{const f=new URLSearchParams(window.location.search).get("token");f&&await pa.resetPassword({requestBody:{new_password:d.new_password,token:f}})},onSuccess:()=>{s("Password updated successfully."),r(),a({to:"/login"})},onError:d=>{Wn(d)}}),u=async d=>{c.mutate(d)};return o.jsxs(Pn,{as:"form",onSubmit:t(u),h:"100vh",maxW:"sm",alignItems:"stretch",justifyContent:"center",gap:4,centerContent:!0,children:[o.jsx(Te,{size:"xl",color:"ui.main",textAlign:"center",mb:2,children:"Reset Password"}),o.jsx(N,{textAlign:"center",children:"Please enter your new password and confirm it to reset your password."}),o.jsx(ci,{startElement:o.jsx(ai,{}),type:"new_password",errors:i,...e("new_password",ma()),placeholder:"New Password"}),o.jsx(ci,{startElement:o.jsx(ai,{}),type:"confirm_password",errors:i,...e("confirm_password",ed(n)),placeholder:"Confirm Password"}),o.jsx(bo,{variant:"solid",type:"submit",children:"Reset Password"})]})}const Zx=Qt("/recover-password")({component:Gx,beforeLoad:async()=>{if(nr())throw $n({to:"/"})}});function Gx(){var u;const{register:e,handleSubmit:t,reset:n,formState:{errors:r,isSubmitting:i}}=Cn(),{showSuccessToast:s}=Ln(),l=xn({mutationFn:async d=>{await pa.recoverPassword({email:d.email})},onSuccess:()=>{s("Password recovery email sent successfully."),n()},onError:d=>{Wn(d)}}),c=async d=>{l.mutate(d)};return o.jsxs(Pn,{as:"form",onSubmit:t(c),h:"100vh",maxW:"sm",alignItems:"stretch",justifyContent:"center",gap:4,centerContent:!0,children:[o.jsx(Te,{size:"xl",color:"ui.main",textAlign:"center",mb:2,children:"Password Recovery"}),o.jsx(N,{textAlign:"center",children:"A password recovery email will be sent to the registered account."}),o.jsx(_t,{invalid:!!r.email,errorText:(u=r.email)==null?void 0:u.message,children:o.jsx(li,{w:"100%",startElement:o.jsx(ro,{}),children:o.jsx(Mt,{id:"email",...e("email",{required:"Email is required",pattern:$r}),placeholder:"Email",type:"email"})})}),o.jsx(bo,{variant:"solid",type:"submit",loading:i,children:"Continue"})]})}function Yx(e){return Ue({attr:{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackgroun
7d:"new 0 0 48 48"},child:[{tag:"path",attr:{fill:"#FFC107",d:`M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12\r 8 c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24\r 9 c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z`},child:[]},{tag:"path",attr:{fill:"#FF3D00",d:`M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657\r 10 C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z`},child:[]},{tag:"path",attr:{fill:"#4CAF50",d:`M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36\r 11 c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z`},child:[]},{tag:"path",attr:{fill:"#1976D2",d:`M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571\r 12 c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z`},child:[]}]})(e)}const Kx=Qt("/login")({component:Jx,beforeLoad:async()=>{if(nr())throw $n({to:"/"})}});function Jx(){var k;const{loginMutation:e,error:t,resetError:n}=dn(),r=un(),{register:i,handleSubmit:s,formState:{errors:a,isSubmitting:l}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{username:"",password:""}}),c=async b=>{if(!l){n();try{await e.mutateAsync(b),Mr("login","email")}catch{}}},[u,d]=x.useState(!1),f="809832168532-patjfmbd2rrijgnjgc76b73eo5kkr28s.apps.googleusercontent.com",p=`${window.location.origin}/auth/callback`,h=()=>{if(u)return;d(!0),Mr("login","google");const b=`https://accounts.google.com/o/oauth2/v2/auth?client_id=${f}&redirect_uri=${encodeURIComponent(p)}&response_type=code&scope=${encodeURIComponent("openid email profile")}&prompt=select_account`;window.location.href=b},g="ui.textSecondary";return o.jsx(m,{minH:"100vh",bg:"ui.background",display:"flex",alignItems:"center",justifyContent:"center",p:4,fontFamily:"'Geomanist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",position:"relative",overflow:"hidden",_before:{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,background:le("radial-gradient(circle at 40% 70%, rgba(20,184,166,0.05) 0%, transparent 60%), radial-gradient(circle at 80% 20%, rgba(20,184,166,0.03) 0%, transparent 60%)","radial-gradient(circle at 40% 70%, rgba(180,180,200,0.10) 0%, transparent 60%), radial-gradient(circle at 80% 20%, rgba(180,180,200,0.08) 0%, transparent 60%)"),pointerEvents:"none",zIndex:0},children:o.jsx(Pn,{maxW:"lg",w:"full",position:"relative",zIndex:2,children:o.jsxs(m,{bg:"ui.loginBg",border:"1.5px solid",borderColor:"ui.border",borderRadius:"2xl",boxShadow:"lg",p:{base:4,md:8},position:"relative",zIndex:3,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",children:[o.jsxs(hr,{gap:6,mb:8,textAlign:"center",position:"relative",zIndex:4,children:[o.jsx(Me,{w:"45",h:"45",display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:-3,position:"relative",zIndex:5,cursor:"pointer",onClick:()=>r({to:"/"}),_hover:{transform:"scale(1.05)",transition:"all 0.2s ease-in-out"},transition:"all 0.2s ease-in-out",children:o.jsx("img",{src:le("/assets/images/bmarena-dark.svg","/assets/images/bmarena.svg"),alt:"BiomedArena",style:{width:"9rem",height:"9rem",objectFit:"contain"}})}),o.jsxs(m,{position:"relative",zIndex:4,children:[o.jsx(N,{fontSize:"4xl",fontWeight:"400",color:"ui.text",mb:2,letterSpacing:"tight",textShadow:"0 2px 8px rgba(0,0,0,0.18)",fontFamily:"'Geomanist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",lineHeight:"1.1",position:"relative",zIndex:5,children:"BiomedArena"}),o.jsx(N,{color:g,fontSize:"md",fontWeight:"400",opacity:.9,fontFamily:"'Geomanist', 'Inter', sans-serif",letterSpacing:"0.5px",position:"relative",zIndex:5,children:"Biomedical Research Assistant Chatbot"})]})]}),o.jsxs(hr,{gap:6,as:"form",onSubmit:s(c),position:"relative",zIndex:4,w:"100%",maxW:"md",bg:"none",boxShadow:"none",p:0,children:[o.jsx(_t,{invalid:!!a.username,errorText:((k=a.username)==null?void 0:k.message)||!!t,w:"100%",position:"relative",zIndex:5,children:o.jsx(li,{w:"100%",startElement:o.jsx(ro,{}),children:o.jsx(Mt,{id:"username",...i("username",{required:"Email is required",pattern:$r}),placeholder:"Email",type:"email",borderRadius:"xl",border:"2px s
12olid",borderColor:"ui.border",bg:"ui.surface",color:"ui.text",fontFamily:"'Geomanist', 'Inter', sans-serif",fontWeight:"500",_placeholder:{color:g},_focus:{borderColor:"ui.border",bg:"ui.surface",transform:"scale(1.02)",transition:"all 0.2s ease-in-out"},_hover:{bg:"ui.surface",borderColor:"ui.border"},transition:"all 0.2s ease-in-out"})})}),o.jsx(ci,{type:"password",startElement:o.jsx(ai,{}),...i("password",ma()),placeholder:"Password",errors:a,w:"100%"}),t&&o.jsx(m,{bg:"ui.surface",border:"1px solid",borderColor:"ui.border",borderRadius:"xl",p:4,position:"relative",zIndex:5,children:o.jsxs(Rt,{gap:3,position:"relative",zIndex:6,children:[o.jsx(m,{p:1,borderRadius:"md",bg:"ui.muted",children:o.jsx(cm,{color:"red.500",size:16})}),o.jsx(N,{fontSize:"sm",color:"red.500",fontWeight:"600",fontFamily:"'Geomanist', 'Inter', sans-serif",children:t})]})}),o.jsx(We,{w:"full",px:6,py:4,borderRadius:"xl",shadow:"xl",bg:"ui.surface",color:"ui.text",fontWeight:"700",fontSize:"md",fontFamily:"'Geomanist', 'Inter', sans-serif",letterSpacing:"0.5px",position:"relative",zIndex:5,_hover:{transform:"translateY(-2px)",shadow:"2xl",bg:"ui.muted",color:"ui.text"},_active:{transform:"translateY(0px)",bg:"ui.surface"},_focus:{borderColor:"ui.border"},disabled:l,opacity:l?.7:1,cursor:l?"not-allowed":"pointer",transition:"all 0.3s ease-in-out",type:"submit",children:o.jsxs(Rt,{gap:3,position:"relative",zIndex:6,children:[l?o.jsx(cn,{size:"sm",color:"white"}):o.jsx(ro,{}),o.jsx(N,{fontWeight:"600",children:l?"Signing in...":"Sign in"})]})}),o.jsx(We,{w:"full",px:6,py:4,borderRadius:"xl",shadow:"xl",bg:"ui.surface",border:"1px solid",borderColor:"ui.border",color:"ui.text",fontWeight:"700",fontSize:"md",fontFamily:"'Geomanist', 'Inter', sans-serif",letterSpacing:"0.5px",position:"relative",zIndex:5,_hover:{bg:"ui.muted",color:"ui.text"},_active:{},_focus:{borderColor:"ui.border"},disabled:u,opacity:u?.7:1,cursor:u?"not-allowed":"pointer",transition:"all 0.3s ease-in-out",onClick:h,children:o.jsxs(Rt,{gap:3,children:[u?o.jsx(cn,{size:"sm"}):o.jsx(Yx,{}),o.jsx(N,{fontWeight:"600",children:u?"Signing in...":"Sign in with Google"})]})}),o.jsxs(N,{fontSize:"sm",color:g,textAlign:"center",fontFamily:"'Geomanist', 'Inter', sans-serif",fontWeight:"500",position:"relative",zIndex:5,children:["Don't have an account?"," ",o.jsx(Lr,{to:"/signup",className:"main-link",children:o.jsx(N,{as:"span",color:"ui.textSecondary",fontWeight:"600",_hover:{color:"ui.text",transform:"scale(1.05)"},transition:"all 0.2s ease-in-out",children:"Sign Up"})})]})]})]})})})}const Ro=x.forwardRef(function(t,n){const{portalled:r=!0,portalRef:i,...s}=t;return o.jsx(Jt,{disabled:!r,container:i,children:o.jsx(gh,{children:o.jsx(xh,{ref:n,...s})})})});x.forwardRef(function(t,n){return o.jsx(bh,{ref:n,...t,children:o.jsx(yh,{})})});x.forwardRef(function(t,n){return o.jsxs(wh,{ps:"8",ref:n,...t,children:[o.jsx(ea,{axis:"horizontal",insetStart:"4",asChild:!0,children:o.jsx(Zc,{children:o.jsx(_u,{})})}),t.children]})});x.forwardRef(function(t,n){const{children:r,...i}=t;return o.jsxs(kh,{ps:"8",ref:n,...i,children:[o.jsx(ea,{axis:"horizontal",insetStart:"4",asChild:!0,children:o.jsx(Zc,{children:o.jsx(_u,{})})}),o.jsx(Sh,{children:r})]})});x.forwardRef(function(t,n){const{title:r,children:i,...s}=t;return o.jsxs(vh,{ref:n,...s,children:[r&&o.jsx(jh,{userSelect:"none",children:r}),i]})});x.forwardRef(function(t,n){const{startIcon:r,children:i,...s}=t;return o.jsxs(_h,{ref:n,...s,children:[r,i,o.jsx(Mm,{})]})});const To=Ch,Sl=Ih,zr=Ah,zo=Eh;function Xx(e){return Ue({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"},child:[]}]})(e)}function nd(e){return Ue({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 168v-16c0-13.255 10.745-24 24-24h360V80c0-21.367 25.899-32.042 40.971-16.971l80 80c9.372 9.373 9.372 24.569 0 33.941l-80 80C409.956 271.982 384 261.456 384 240v-48H24c-13.255 0-24-10.745-24-24zm488 152H128v-48c0-21.314-25.862-32.08-40.971-16.971l-80 80c-9.372 9.373-9.372 24.569 0 33.941l80 80C102.057 463.997 128 453.437 128 432v-48h360c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24z"},child:[]}]})(e)}function rd(e){return Ue({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(e)}function id(e){return Ue({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M552 64H448V24c0-13.3-10.7-24-24-24H152c-13.3 0-24 10.7-24 24v40H24C10.7 64 0 74.7 0 88v56c0 35.7 22.5 72.4 61.9 100.7 31.5 22.7 69.8 37.1 110 41.7C203.3 338.5 240 360 240 360v72h-48c-35.3 0-64 20.7-64 56v12c0 6.6 5.4 12 12 12h296c6.6 0 12-5.4 12-12v-12c0-35.3-28.7-56-64-56h-48v-72s36.7-21.5 68.1-73.6c40.3-4.6 78.6-19 110-41.7 39.3-28.3 61.9-65 61.9-100.7V88c0-13.3-10.7-24-24-24zM99.3 192.8C74.9 175.2 64 155.6 64 144v-16h64.2c1 32.6 5.8 61.2 12.8 86.2-15.1-5.2-29.2-12.4-41.7-21.4zM512 144c0 16.1-17.7 36.1-35.3 48.8-12.5 9-26.7 16.2-41.8 21.4 7-25 11.8-53.6 12.8-86.2H512v16z"},child:[]}]})(e)}function Qx(e){return Ue({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M64 224h13.5c24.7 56.5 80.9 96 146.5 96s121.8-39.5 146.5-96H384c8.8 0 16-7.2 16-16v-96c0-8.8-7.2-16-16-16h-13.5C345.8 39.5 289.6 0 224
120S102.2 39.5 77.5 96H64c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16zm40-88c0-22.1 21.5-40 48-40h144c26.5 0 48 17.9 48 40v24c0 53-43 96-96 96h-48c-53 0-96-43-96-96v-24zm72 72l12-36 36-12-36-12-12-36-12 36-36 12 36 12 12 36zm151.6 113.4C297.7 340.7 262.2 352 224 352s-73.7-11.3-103.6-30.6C52.9 328.5 0 385 0 454.4v9.6c0 26.5 21.5 48 48 48h80v-64c0-17.7 14.3-32 32-32h128c17.7 0 32 14.3 32 32v64h80c26.5 0 48-21.5 48-48v-9.6c0-69.4-52.9-125.9-120.4-133zM272 448c-8.8 0-16 7.2-16 16s7.2 16 16 16 16-7.2 16-16-7.2-16-16-16zm-96 0c-8.8 0-16 7.2-16 16v48h32v-48c0-8.8-7.2-16-16-16z"},child:[]}]})(e)}const{withContext:eb}=Rh({key:"button"}),Fo=eb("a"),tb=()=>{const{user:e,logout:t,isGuest:n}=dn(),r=e!=null&&e.is_superuser?"Admin":(e==null?void 0:e.full_name)||"User",i=async()=>{t()};return n?o.jsx(Fo,{href:"/login",maxW:"sm",bg:"ui.accent",color:"white",_hover:{bg:"ui.secondaryHover"},"data-testid":"sign-in-button",fontFamily:"Geomanist",style:{textDecoration:"none"},children:"Sign In"}):o.jsx(o.Fragment,{children:o.jsx(Me,{children:o.jsxs(To,{children:[o.jsx(zo,{asChild:!0,p:2,children:o.jsxs(bo,{"data-testid":"user-menu",variant:"solid",maxW:"sm",truncate:!0,bg:"ui.accent",color:"white",children:[o.jsx(Qx,{fontSize:"18",color:"white"}),o.jsx(N,{color:"white",fontFamily:"Geomanist",ml:-1,children:r})]})}),o.jsxs(Ro,{children:[!n&&o.jsx(Lr,{to:"settings",children:o.jsxs(zr,{closeOnSelect:!0,value:"user-settings",gap:2,py:2,style:{cursor:"pointer"},children:[o.jsx(Cs,{fontSize:"18px",color:"ui.muted"}),o.jsx(m,{flex:"1",children:o.jsx(N,{color:"ui.text",children:"My Profile"})})]})}),o.jsxs(zr,{value:"logout",gap:2,py:2,onClick:i,style:{cursor:"pointer"},children:[o.jsx(yu,{color:"ui.muted"}),o.jsx(N,{color:"ui.text",children:"Log Out"})]})]})]})})})};function nb(){const e=Fr({base:"none",md:"flex"}),{colorMode:t,setColorMode:n}=yo(),r=le("gray.900","whiteAlpha.900"),[i,s]=x.useState(!1),a=x.useRef(null),l=un();x.useEffect(()=>{const u=a.current;if(!u)return;const d=()=>s(u.getAttribute("aria-expanded")==="true");d();const f=new MutationObserver(()=>d());return f.observe(u,{attributes:!0,attributeFilter:["aria-expanded"]}),()=>f.disconnect()},[]);const c="'Geomanist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial";return o.jsxs(Me,{display:e,justify:"space-between",position:"fixed",color:"ui.mainText",bg:"ui.main",w:"100%",top:0,h:"64px",px:6,zIndex:100,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(To,{children:[o.jsx(zo,{asChild:!0,children:o.jsx(m,{cursor:"pointer",_hover:{opacity:.85},h:"64px",display:"flex",alignItems:"center","aria-label":"Open site menu",ref:a,children:o.jsxs(Me,{alignItems:"center",gap:2,height:"64px",w:"95%",children:[o.jsx("img",{src:"/assets/images/bmarena.svg",alt:"BiomedArena - Collective insight shaping trustworthy biomedical AI",style:{height:"60px",width:"auto",maxWidth:"90%",objectFit:"contain"}}),o.jsx(N,{fontSize:"2xl",fontWeight:"normal",color:"ui.mainText",fontFamily:c,lineHeight:"1",display:"flex",alignItems:"center",height:"64px",whiteSpace:"nowrap",children:"BiomedArena"}),o.jsx(Ut,{as:fm,boxSize:4,ml:1,transform:i?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms ease"})]})})}),o.jsxs(Ro,{bg:"ui.main",borderColor:"ui.border",borderWidth:"1px",borderStyle:"solid",borderRadius:"6px",fontFamily:c,minW:"280px",py:2,ml:-6,mt:-2,children:[o.jsxs(zr,{value:"about-us",fontFamily:c,fontSize:"md",onClick:u=>{u.preventDefault(),u.stopPropagation(),l({to:"/about-us"})},children:[o.jsx(Ut,{as:bu,boxSize:4,mr:3,color:r}),"About Us"]}),o.jsxs(zr,{value:"how-it-works",fontFamily:c,fontSize:"md",onClick:u=>{u.preventDefault(),u.stopPropagation(),l({to:"/how-it-works"})},children:[o.jsx(Ut,{as:bm,boxSize:4,mr:3,color:r}),"How it works"]}),o.jsx(Sl,{borderColor:"ui.border"}),o.jsxs(zr,{value:"contact-us",fontFamily:c,fontSize:"md",onClick:u=>{u.preventDefault(),u.stopPropagation(),window.open("https://docs.google.com/forms/d/e/1FAIpQLSf6NX_WemTS_97SgsQGKl1x_zygllEGHsyI90_R90VaR98igA/viewform","_blank","noopener,noreferrer")},children:[o.jsx(Ut,{as:ro,boxSize:4,mr:3,color:r}),"Contact Us"]}),o.jsxs(zr,{value:"blog",fontFamily:c,fontSize:"md",onClick:u=>{u.preventDefault(),u.stopPropagation(),window.open("https://www.datatecnica.com/blog/tag/BiomedArena.AI","_blank","noopener,noreferrer")},children:[o.jsx(Ut,{as:dm,boxSize:4,mr:3,color:r}),"Blog"]}),o.jsx(Sl,{borderColor:"ui.border"}),o.jsx(m,{fontFamily:c,px:2,py:1,tabIndex:0,"aria-label":"Theme toggle",onClick:()=>n(t==="light"?"dark":"light"),onMouseDown:u=>u.preventDefault(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(t==="light"?"dark":"light"))},_focus:{boxShadow:"none",outline:"none"},_focusVisible:{boxShadow:"outline"},children:o.jsxs(Me,{alignItems:"center",justifyContent:"space-between",w:"100%",children:[o.jsx(N,{fontFamily:c,color:r,fontSize:"sm",children:"Theme"}),o.jsx(m,{display:"flex",alignItems:"center",justifyContent:t==="light"?"flex-start":"flex-end",bg:t==="light"?"gray.200":"gray.700",borderRadius:"999px",px:1,py:.5,minW:"56px",cursor:"pointer",children:o.jsx(m,{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"50%",bg:t==="light"?"yellow.300":"gray.800",transition:"transform 200ms ease, background 200ms ease",children:o.jsx(Ut,{as:t==="light"?vm:ym,color:r})})})]})})]})]}),o.jsx(Me,{gap:2,alignItems:"center",children:o.jsx(tb,{})})]})}const od=x.forwardRef(function(t,n){return o.jsx(_n,{variant:"ghost","aria-label":"Close",ref:n,...t,children:t.children??o.jsx(Wm,{})})}),rb=x.forwardRef(function(t,n){const{children:r,portalled:i=!0,portalRef:s,offset:a,...l}=t;return o.jsx(Jt,{disabled:!i,container:s,children:o.jsx(Th,{padding:a,children:o.jsx(zh,{ref:n,...l,asChild:!1,children:r})})})}),vl=x.forwardRef(function(t,n){return o.jsx(Fh,{position:"absolute",top:"2",insetEnd:"2",...t,asChild:!0,children:o.jsx(od,{size:"sm",ref:n})})}),ib=Mh,ob=Ph,sb=Dh,ab=Lh,lb=()=>{const e=Ht(),t=xr(),n=t?Fn():null;return xn({mutationFn:async r=>{const i={};t&&n&&(i.fingerprint_hash=n),await lt(Le,{method:"DELETE",url:`/api/v1/threads/${r}`,query:i})},onSuccess:()=>
12{e.invalidateQueries({queryKey:["threads"]})}})},cb=e=>{const t=xr(),n=t?Fn():null;return pr({queryKey:["threads",e,n],queryFn:async()=>{if(t&&n)try{const i=await lt(Le,{method:"POST",url:"/api/v1/users/guest",query:{fingerprint_hash:n}});return(await lt(Le,{method:"GET",url:"/api/v1/threads/",query:{user_id:i.id}})).filter(a=>a.is_active)}catch(i){return console.warn("Failed to fetch guest threads:",i),[]}return e?(await lt(Le,{method:"GET",url:"/api/v1/threads/",query:{user_id:e}})).filter(i=>i.is_active):[]},enabled:!!e||t})},jl=[{icon:xu,title:"New Chat",path:"/"},{icon:id,title:"Leaderboard",path:"/leaderboard"},{icon:km,title:"User Settings",path:"/settings"}],ub="/login",_l=({onClose:e,collapsed:t=!1})=>{const n=Ht(),r=n.getQueryData(["currentUser"]),{isGuest:i}=dn(),s=un(),{data:a=[],isLoading:l}=cb(r==null?void 0:r.id),c=lb(),u=b=>{switch(b){case"battle":return o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"Battle",boxSize:4,filter:le("none","invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)"),opacity:.7});case"dual":return o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"Side by Side",boxSize:4,filter:le("none","invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)"),opacity:.7});default:return o.jsx(Ut,{as:wu,boxSize:4,color:"ui.textSecondary"})}},d=(b,S)=>{s(i?{to:"/battle",search:{threadId:b}}:S==="battle"?{to:"/battle",search:{threadId:b}}:S==="dual"?{to:"/",search:{mode:"dual",threadId:b}}:{to:"/",search:{mode:"single",threadId:b}}),e==null||e()},f=()=>{if(i)s({to:"/battle",search:{clear:"true"}});else{const b=typeof window<"u",S=b?window.location.pathname:"/",y=b?new URLSearchParams(window.location.search):null,R=(y==null?void 0:y.get("mode"))??void 0;if(S.startsWith("/battle"))s({to:"/battle",search:{clear:"true"}});else{const L={clear:"true"};R&&(L.mode=R),s({to:"/",search:L})}}n.invalidateQueries({queryKey:["threads"]})},p=(b,S)=>{S.stopPropagation(),c.mutate(b)};let h=jl;if(i?(h=h.filter(b=>b.title==="New Chat"||b.title==="Leaderboard"||b.title==="User Settings"),h=h.map(b=>b.title==="New Chat"?{...b,onClick:f}:b)):r!=null&&r.is_superuser&&(h=[...h,{icon:um,title:"Analytics",path:"/analytics"},{icon:jm,title:"Admin",path:"/admin"}]),h=h.map(b=>b.title==="New Chat"?{...b,onClick:f}:b),t){const b=jl.map(S=>S.title);r!=null&&r.is_superuser&&b.push("Analytics","Admin"),h=h.filter(S=>b.includes(S.title)).map(S=>S.title==="New Chat"?{...S,onClick:f}:S)}const g=h.map(({icon:b,title:S,path:y,onClick:R})=>{const L=o.jsxs(Me,{gap:t?0:4,px:t?0:4,py:3,_hover:{bg:"rgba(255, 255, 255, 0.1)",cursor:"pointer"},borderRadius:"md",alignItems:"center",justify:t?"center":"flex-start",w:"100%",children:[o.jsx(Ut,{as:b,boxSize:5,color:"ui.text"}),!t&&o.jsx(N,{color:"ui.text",fontWeight:"400",children:S})]});return R?o.jsx(m,{onClick:O=>{R(O),e==null||e()},children:L},S):o.jsx(Lr,{to:y,onClick:e,style:{textDecoration:"none"},children:L},S)}),k=t?null:o.jsxs(m,{mt:6,children:[o.jsx(Me,{alignItems:"center",px:4,py:2,position:"relative",children:!t&&o.jsx(N,{fontSize:"md",color:"ui.textSecondary",children:"HISTORY"})}),o.jsx(m,{h:"1px",bg:"ui.border",my:2}),i&&!t&&o.jsx(Lr,{to:ub,style:{textDecoration:"none"},onClick:e,children:o.jsx(Me,{mx:"auto",mb:3,px:1,py:2,align:"center",gap:2,borderRadius:"md",bg:"ui.surface",_hover:{bg:"ui.muted"},transition:"background 0.15s ease",justify:"center",w:"100%",children:o.jsx(N,{color:"ui.text",fontWeight:"400",fontSize:"xs",px:1,children:"Sign in to save chats â"})})}),l?o.jsx(m,{px:4,py:2,color:"ui.textSecondary",children:"Loading..."}):a.length>0?o.jsx(m,{mx:0,mt:1,mb:2,p:0,borderRadius:"md",bg:"ui.sidebar",fontSize:t?"xs":"sm",children:a.map(b=>o.jsx(m,{px:1,py:1,"data-group":"",_hover:{bg:"ui.surface",cursor:"pointer","& .delete-btn:not(:hover)":{color:"ui.textSecondary",opacity:1}},borderRadius:"md",onClick:()=>d(b.id,b.mode),position:"relative",children:o.jsxs(Me,{gap:2,alignItems:"center",justify:"space-between",children:[o.jsxs(Me,{gap:2,alignItems:"center",flex:1,minW:0,children:[u(b.mode),!t&&o.jsx(N,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",title:b.title||"Untitled Chat",color:"ui.text",children:b.title||"Untitled Chat"})]}),!t&&o.jsx(_n,{"aria-label":"Delete thread",size:"xs",variant:"ghost",className:"delete-btn",color:le("ui.textSecondary","gray.400"),opacity:.7,_hover:{color:"red.400",opacity:1},onClick:S=>p(b.id,S),loading:c.isPending,children:o.jsx(Ut,{as:_m,boxSize:4})})]})},b.id))}):i?null:o.jsx(m,{px:4,py:3,color:le("ui.textSecondary","gray.500"),children:"No recent chats"})]});return o.jsxs(m,{children:[o.jsx(m,{h:"1px",bg:"ui.border",my:2}),o.jsx(m,{bg:"ui.sidebar",borderRadius:"md",p:1,mb:4,children:g}),k]})},Un=x.forwardRef(function(t,n){const{children:r,portalled:i=!0,portalRef:s,backdrop:a=!0,...l}=t;return o.jsxs(Jt,{disabled:!i,container:s,children:[a&&o.jsx(Oh,{}),o.jsx(Bh,{children:o.jsx(Nh,{ref:n,...l,asChild:!1,children:r})})]})}),Wr=x.forwardRef(function(t,n){return o.jsx($h,{position:"absolute",top:"2",insetEnd:"2",...t,asChild:!0,children:o.jsx(od,{size:"sm",ref:n,children:t.children})})}),rr=Gc,Hn=Hh,qn=Wh,Vn=Uh,Si=gi,vi=Yc,sd=xi,db=({isOpen:e,onClose:t})=>o.jsx(rr,{open:e,onOpenChange:()=>{},children:o.jsxs(Un,{maxWidth:"3xl",mx:4,maxH:"90vh",overflowY:"auto",children:[o.jsx(qn,{pb:2,children:o.jsx(Si,{asChild:!0,children:o.jsx(Te,{as:"h2",size:"lg",color:"chat.assistantText",textAlign:"center",w:"full",children:"Privacy Policy"})})}
12),o.jsx(Vn,{children:o.jsxs(ut,{alignItems:"flex-start",gap:4,children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"Effective & last updated: August 18, 2025"}),o.jsx(m,{children:o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"California Notice at Collection / State Law Privacy Rights:"})," ","See State privacy rights notice below for information about rights under applicable U.S. state privacy laws."]})}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Who we are"}),o.jsx(N,{fontSize:"sm",children:"Datatecnica d/b/a BiomedArena (âBiomedArena,â âwe,â âus,â or âourâ) provides a platform for using, comparing, rating, testing, evaluating, and ranking third-party AI models and related tools (the âServiceâ). This Privacy Policy explains how we collect, use, share, and protect personal information in connection with the Service. We may provide additional notices for specific products, features, or events."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Personal information we collect"}),o.jsxs(ut,{alignItems:"flex-start",gap:2,pl:2,children:[o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Information you provide."})," Contact & account data: name, email, phone, username, password, preferences. Profile & demographic data: city/state/country, age, bio, links to social profiles. Communications & transactional data: messages to us, support requests, contest entries. Marketing preferences and engagement details. User content data: prompts/inputs, images, votes/ratings, AI outputs, and related metadata (e.g., timestamps, interaction data)."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Automatic data (via the Service, emails, and SDKs)."})," ","Device/online activity data: IP, device/browser info, OS, screen size, general location (city/state), pages viewed, time on page, referrers, email opens/clicks. See Tracking & other technologies below and our Cookie Policy."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"From third parties."})," Public sources; data providers; partners (e.g., event co-sponsors); service providers (hosting, analytics, support); Linked services you connect (e.g., social sign-in), which may provide account info and content per your settings."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Data about others."})," If you invite contacts, provide only with permission."]})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Tracking & other technologies"}),o.jsx(N,{fontSize:"sm",children:"We use cookies, pixels, SDKs, and similar technologies to run and improve the Service, personalize experiences, measure effectiveness, and for security. See our Cookie Policy (including how to manage consent). We currently do not respond to âDo Not Trackâ signals."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Artificial intelligence technologies"}),o.jsx(N,{fontSize:"sm",children:"We use third-party AI models and tools (âAI Servicesâ) to process your inputs and generate outputs. By using AI features, you direct us to share relevant data (including personal information) with AI Services. Their own terms and privacy policies may apply; they may use data for model improvement per their policies. We are not responsible for third-party AI providersâ practices."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"How we use personal information"}),o.jsx(N,{fontSize:"sm",children:"Service delivery & operations; Personalization; Improvement & analytics; Marketing; Events, promotions & contests; Compliance & protection; Aggregated/de-identified data; Further uses with notice/consent where required."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"How we share personal information"}),o.jsx(N,{fontSize:"sm",children:"Service providers; Third parties you designate; Partners; AI technology providers; Linked services; Professional advisors; Authorities & others;
12 Business transferees. We do not âsellâ or âshareâ personal information as those terms are defined under certain U.S. state privacy laws, and we do not use personal information for targeted advertising or for automated decision-making/profiling that produces significant effects."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Your choices"}),o.jsx(N,{fontSize:"sm",children:"Access/update certain account info in your settings. Opt out of marketing emails via the unsubscribe link or by contacting us. Cookies & tracking: manage via our Cookie Policy and browser settings. Linked services: adjust what data is shared or disconnect the integration. Declining to provide data may limit certain features."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Security"}),o.jsx(N,{fontSize:"sm",children:"We use technical, organizational, and physical safeguards designed to protect personal information. No system is 100% secure, and we cannot guarantee absolute security."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"International data transfer"}),o.jsx(N,{fontSize:"sm",children:"We are based in the United States and work with providers worldwide. Your information may be transferred to countries with different data protection laws."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Children"}),o.jsx(N,{fontSize:"sm",children:"The Service is not intended for individuals under 18. If we learn we collected personal information from a child contrary to law, we will delete it as required."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Changes to this Privacy Policy"}),o.jsx(N,{fontSize:"sm",children:"We may update this Policy. Material changes will be posted (and if you have an account, we may email you). Your continued use after the effective date means you accept the updated Policy."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"How to contact us"}),o.jsx(N,{fontSize:"sm",children:"Email: [email protected]"})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"State privacy rights notice (U.S.)"}),o.jsx(N,{fontSize:"sm",children:"Depending on your state, you may have rights to know/access, correct, delete, appeal a denial, and obtain a portable copy of certain personal information. You also may have rights to opt out of âsales,â targeted advertising, or profiling (we do not engage in these practices). Submitting requests: Email [email protected] with your request and sufficient information to verify your identity. We will not discriminate against you for exercising legal rights."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Notice to European users (EEA/UK)"}),o.jsx(N,{fontSize:"sm",children:"Controller. Datatecnica is the controller for processing covered by this Policy. Contact: [email protected]. Legal bases: Contractual necessity, Legitimate interests, Consent, and Legal obligations. Your rights and transfers described above. Retention: We keep personal data as needed for the purposes described, legal requirements, and to protect our rights; then we delete or de-identify it."})]})]})}),o.jsx(Hn,{children:o.jsx(We,{size:"md",onClick:t,width:"full",bg:"button.primary",border:"none",_hover:{bg:"button.primaryHover"},color:"button.primaryText",children:"Close"})})]})}),fb=({isOpen:e,onClose:t})=>o.jsx(rr,{open:e,onOpenChange:()=>{},children:o.jsxs(Un,{maxWidth:"3xl",mx:4,maxH:"90vh",overflowY:"auto",children:[o.jsx(qn,{pb:2,children:o.jsx(Si,{asChild:!0,children:o.jsx(Te,{as:"h2",size:"lg",color:"chat.assistantText",textAlign:"center",w:"full",children:"Terms of Use"})})}),o.jsx(Vn,{children:o.jsxs(ut,{alignItems:"flex-start",gap:4,children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"Last Updated: August 18, 2025"}),o.jsxs(m,{children:[o.jsx(N,{fontSize:"sm",children:"Welcome! These Terms of Use (the âTermsâ) are a legal agreement between you and Datatecnica (âCompany,â âwe,â âus,â or âourâ) governing your access to and use of BiomedArena and related websites, apps, APIs, and services (collectively, the âServiceâ)."}),o.jsx(N,{fontSize:"sm",mt:2,children:"By accessing or using the Service, you agree to these Terms. If you do not agree, do not use the Service. If you use the Service for an organization, you represent that you have authority to bind that organization, and âyouâ includes that organization."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"1) The Service"}),o.jsx(N,{fontSize:"sm",children:"We provide tools and content, including AI-enabled features that generate output (âOutputâ) from your input prompts, uploads, and other content (âInputâ). We may update or change the Service at any time."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"2) Accounts & Eligibility"}
12),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsx(N,{fontSize:"sm",children:"You must be of legal age and not barred by applicable law from using the Service."}),o.jsx(N,{fontSize:"sm",children:"Keep your registration info accurate and your credentials confidential. Youâre responsible for activity under your account."}),o.jsx(N,{fontSize:"sm",children:"We may suspend or terminate accounts for violations or risks to the Service."})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"3) Your Content; Input & Output"}),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Ownership."})," As between you and us, you own your Input and the Output generated for you (together, âYour Contentâ). Output may be similar or identical to Output generated for others."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"License to Company."})," You grant Company a worldwide, royalty-free, sublicensable license to use, host, reproduce, modify, and display Your Content to operate, protect, improve, and provide the Service (including quality, safety, and model/tool improvement)."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Your Responsibility."})," You are responsible for Your Content and for ensuring you have all rights needed (e.g., no infringement, no privacy violations). Do not include sensitive personal data unless the feature expressly permits it."]})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"4) AI Services & Third Parties"}),o.jsx(N,{fontSize:"sm",children:"The Service may route Your Content to third-party AI models, tools, and platforms (âAI Servicesâ). Their terms may apply, and they may store or use Your Content per their policies. We are not responsible for AI Servicesâ acts, omissions, availability, or results."}),o.jsx(N,{fontSize:"sm",mt:2,children:"Links, integrations, or ads for third-party services are provided âas isâ; use them at your own risk."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"5) Acceptable Use"}),o.jsx(N,{fontSize:"sm",children:"You agree not to: (a) break laws; (b) infringe IP or privacy rights; (c) submit unlawful, harassing, hateful, sexually explicit, or harmful content; (d) attempt to exploit minors; (e) introduce malware or interfere with security; (f) scrape or harvest data; (g) manipulate rankings or votes; (h) access the Service via automated means without permission; (i) reverse engineer or bypass technical limits. We may monitor, remove content, and enforce these Terms."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"6) Fees"}),o.jsx(N,{fontSize:"sm",children:"We may introduce paid features and applicable taxes in the future. Prices and billing terms will be posted or presented at purchase."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"7) Term; Termination"}),o.jsx(N,{fontSize:"sm",children:"These Terms apply while you use the Service. You may stop using the Service at any time. We may suspend or terminate the Service or your access at any time (e.g., for violations, risk, or legal reasons). We may delete Your Content upon termination. Sections that by nature should survive will do so."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"8) Disclaimers"}),o.jsx(N,{fontSize:"sm",children:"THE SERVICE, INCLUDING ALL OUTPUT, IS PROVIDED âAS ISâ AND âAS AVAILABLE.â TO THE MAXIMUM EXTENT PERMITTED BY LAW, WE AND OUR SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED (INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ACCURACY, OR RELIABILITY). AI features may generate inaccurate or inappropriate content; use judgment."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"9) Limitation of Liability"}),o.jsx(N,{fontSize:"sm",children:"TO THE MAXIMUM EXTENT PERMITTED BY LAW: (a) WE WILL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS, REVENUE, DATA, OR GOODWILL; and (b) OUR TOTAL LIABILITY FOR ALL CLAIMS IN THE AGGREGATE WILL NOT EXCEED THE GREATER OF (i) USD $100 OR (ii) AMOUNTS YOU PAID US FOR THE SERVICE IN THE 3 MONTHS BEFORE THE EVENT GIVING RISE TO LIABILITY. Some jurisdictions do not allow certain limitations; some rights may not apply to you."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"10) Indemnification"}),o.jsx(N,{fontSize:"sm",children:"You will defend, indemnify, and hold harmless Datatecnica and its affiliates, officers, directors, employees, and agents from claims, losses, and expenses (including reasonable attorneysâ fees) arising from Your Content, your use of the Service, or your breach of these Terms, to the extent permitted by law."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"11) Dispute Resolution; Arbitration; Class Waiver"}),o.jsx(N,{fontSize:"sm",children:"PLEASE READ CAREFULLY."}
12),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Informal Resolution."})," Before filing a claim, you and Company will attempt to resolve disputes informally by emailing [email protected] and allowing 30 days to respond."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Binding Arbitration."})," Except for small-claims matters or IP/Equitable relief, all disputes will be resolved by final, binding arbitration under the AAA Consumer Arbitration Rules. The Federal Arbitration Act governs."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"No Class Actions."})," You may bring claims only on an individual basis, not as a class or representative action."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Opt-Out."})," You may opt out of arbitration within 30 days of first accepting these Terms by emailing [email protected] with subject âArbitration Opt-Outâ and your account email and full name."]}),o.jsxs(N,{fontSize:"sm",children:[o.jsx("strong",{children:"Venue & Law."})," Where litigation is permitted, exclusive venue is the state or federal courts in New Castle County, Delaware. Delaware law governs, consistent with the FAA. The U.N. Convention on Contracts for the International Sale of Goods does not apply."]})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"12) Privacy"}),o.jsx(N,{fontSize:"sm",children:"Our collection and use of personal data are described in our Privacy Policy (as updated from time to time)."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"13) Export & Sanctions"}),o.jsx(N,{fontSize:"sm",children:"You may not use or export the Service in violation of U.S. export and sanctions laws, or to prohibited countries or parties."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"14) Changes to the Terms"}),o.jsx(N,{fontSize:"sm",children:"We may update these Terms. Material changes will be posted (and, if you have an account, we may email you). Continued use after changes means you accept the updated Terms."})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"15) Miscellaneous"}),o.jsx(N,{fontSize:"sm",children:"Entire Agreement. These Terms are the entire agreement between you and Datatecnica regarding the Service. Severability; Waiver. If a term is unenforceable, the rest remains effective. Failure to enforce is not a waiver. Assignment. You may not assign these Terms without our consent; we may assign freely. Notices. We may notify you via the Service or email. You can contact us at [email protected]."})]})]})}),o.jsx(Hn,{children:o.jsx(We,{size:"md",onClick:t,width:"full",bg:"button.primary",border:"none",_hover:{bg:"button.primaryHover"},color:"button.primaryText",children:"Close"})})]})}),hb=()=>{const t=Ht().getQueryData(["currentUser"]),{logout:n}=dn(),[r,i]=x.useState(!1),[s,a]=x.useState(()=>{try{return localStorage.getItem("sidebar.collapsed")==="true"}catch{return!1}}),[l,c]=x.useState(!1),[u,d]=x.useState(!1),f=un(),p=()=>{a(h=>{const g=!h;try{localStorage.setItem("sidebar.collapsed",String(g));try{window.dispatchEvent(new CustomEvent("sidebar:changed",{detail:{collapsed:g}}))}catch{}}catch{}return g})};return o.jsxs(o.Fragment,{children:[o.jsxs(ob,{placement:"start",open:r,onOpenChange:h=>i(h.open),children:[o.jsx(ab,{}),o.jsx(ib,{asChild:!0,children:o.jsx(_n,{variant:"ghost",color:"white",bg:"ui.main",display:{base:"flex",md:"none"},"aria-label":"Open Menu",position:"fixed",top:"16px",left:"16px",zIndex:"100",_hover:{bg:"ui.accent"},_active:{bg:"ui.accent"},children:o.jsx(Xx,{})})}),o.jsxs(rb,{maxW:"240px",h:"calc(100vh - 64px)",mt:"64px",bg:"ui.sidebar",children:[o.jsx(vl,{}),o.jsx(sb,{overflowY:"auto",children:o.jsxs(Me,{flexDir:"column",justify:"space-between",h:"full",children:[o.jsxs(m,{children:[o.jsx(_l,{onClose:()=>i(!1)}),o.jsxs(Me,{as:"button",onClick:()=>{n()},alignItems:"center",gap:4,px:4,py:2,color:"ui.textSecondary",_hover:{color:"ui.text",bg:"ui.accent"},_active:{bg:"ui.accent"},children:[o.jsx(yu,{}),o.jsx(N,{children:"Log Out"})]})]}),(t==null?void 0:t.email)&&o.jsxs(N,{fontSize:"sm",p:2,color:"ui.textSecondary",truncate:!0,maxW:"sm",children:["Logged in as: ",t.email]}),o.jsx(m,{px:2,py:1,children:o.jsxs(Me,{gap:3,justify:"center",align:"center",children:[o.jsx(Bn,{color:"ui.textSecondary",fontSize:"3xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>{h.preventDefault(),c(!0)},"aria-label":"Terms of Use",children:"Terms of Use"}),o.jsx(N,{fontSize:"3xs",color:"ui.textSecondary",children:"â¢"}),o.jsx(Bn,{color:"ui.textSecondary",fontSize:"3xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>{h.preventDefault(),d(!0)},"aria-label":"Privacy Policy",children:"Privacy Policy"})]})})]})}),o.jsx(vl,{})]})]}),o.jsxs(m,{display:{base:"none",md:"flex"},w:s?"64px":"240px",h:"calc(100vh - 64px)",bg:"ui.sidebar",px:s?2:4,py:4,flexDir:"column",justifyContent:"space-between",position:"fixed",top:"64px",left:"0",overflowY:"auto",fontFamily:"'Geomanist', 'Inter', sans-serif",color:"ui.text",children:[o.jsxs(m,{w:"100%",children:[o.jsxs(Me,{align:"center",justify:"space-between",px:s?2:4,py:2,children:[!s&&o.jsx(N,{fontSize:"md",fontWeight:"500",color:"ui.textSecondary",children:"MENU"}),o.jsx(_n,{"aria-label":s?"Expand sidebar":"Collapse sidebar",variant:"ghost",size:"sm",onClick:p,color:"ui.text",_hover:{bg:"ui.muted"},children:s?o.jsx(pm,{}):o.jsx(hm,{})})]}),o.jsx(_l,{collapsed:s})]}),!s&&o.jsx(m,{children:o.jsxs(Me,{direction:"column",align:"center",p:1,gap:0,children:[o.jsxs(Me,{gap:3,align:"center",mb:1,children:[o.jsx(Bn,{color:"ui.textSecondary",fontSize:"xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>{h.preventDefault(),f({to:"/about-us"})},"aria-label":"About BiomedArena",children:"About Us"}),o.jsx(N,{fontSize:"xs",color:"ui.textSecondary",children:"â¢"}),o.jsx(Bn,{color:"ui.textSecondary",fontSize:"xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>
12{h.preventDefault(),f({to:"/how-it-works"})},"aria-label":"How it works",children:"How it Works"})]}),o.jsxs(Me,{gap:4,justify:"center",align:"center",mt:0,children:[o.jsx(Bn,{color:"ui.textSecondary",fontSize:"xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>{h.preventDefault(),c(!0)},"aria-label":"Terms of Use",children:"Terms of Use"}),o.jsx(N,{fontSize:"xs",color:"ui.textSecondary",children:"â¢"}),o.jsx(Bn,{color:"ui.textSecondary",fontSize:"xs",textDecoration:"none",_hover:{textDecoration:"none",color:"ui.text"},onClick:h=>{h.preventDefault(),d(!0)},"aria-label":"Privacy Policy",children:"Privacy Policy"})]})]})}),o.jsx(fb,{isOpen:l,onClose:()=>c(!1)}),o.jsx(db,{isOpen:u,onClose:()=>d(!1)})]})]})},pb=Qt("/_layout")({component:mb,beforeLoad:async()=>{if(!nr()&&!xr())throw $n({to:"/login"})}});function mb(){const[e,t]=x.useState(()=>{try{return localStorage.getItem("sidebar.collapsed")==="true"}catch{return!1}});return x.useEffect(()=>{const n=i=>{i.key==="sidebar.collapsed"&&t(i.newValue==="true")},r=i=>{const s=i.detail;s&&typeof s.collapsed=="boolean"&&t(s.collapsed)};return window.addEventListener("storage",n),window.addEventListener("sidebar:changed",r),()=>{window.removeEventListener("storage",n),window.removeEventListener("sidebar:changed",r)}},[]),o.jsxs(Me,{direction:"column",h:"100vh",w:"100vw",children:[o.jsx(nb,{}),o.jsxs(Me,{flex:"1",minH:0,children:[o.jsx(hb,{}),o.jsx(Me,{as:"main",flex:"1",direction:"column",overflowY:"auto",pt:"64px",ml:{base:0,md:e?"64px":"240px"},bg:"ui.background",children:o.jsx(Kc,{})})]})]})}const ad=({isOpen:e,onClose:t})=>e?o.jsx(Jt,{children:o.jsx(m,{position:"fixed",top:4,right:4,zIndex:1400,maxW:"sm",w:"full",children:o.jsxs(m,{bg:"ui.muted",border:"1px",borderColor:"ui.mainText",borderRadius:"md",boxShadow:"lg",p:4,pr:8,position:"relative",display:"flex",alignItems:"start",gap:3,children:[o.jsx(bu,{size:16,color:"ui.mainText"}),o.jsx(m,{flex:"1",children:o.jsx(N,{fontFamily:"Geomanist",fontSize:"sm",color:"ui.mainText",children:"Sign in to save your chats! Your conversation will be lost when you clear cookies."})}),o.jsx(vs,{position:"absolute",right:1,top:1,onClick:t,size:"sm",color:"ui.mainText"})]})})}):null,Po=({isOpen:e,onAccept:t,onError:n})=>{const[r,i]=x.useState(!1);x.useEffect(()=>{e||i(!1)},[e]);const s=async()=>{i(!0);try{t()}catch(a){console.error("Error accepting terms:",a);const l=a instanceof Error?a.message:"Failed to accept terms";n&&n(l),i(!1)}};return o.jsx(rr,{open:e,onOpenChange:()=>{},children:o.jsxs(Un,{maxWidth:"2xl",mx:4,maxH:"90vh",overflowY:"auto",children:[o.jsx(qn,{pb:2,children:o.jsx(Si,{asChild:!0,children:o.jsx(Te,{as:"h2",size:"lg",color:"chat.assistantText",textAlign:"center",w:"full",children:"BiomedArena â Terms & Conditions"})})}),o.jsx(Vn,{children:o.jsxs(ut,{alignItems:"flex-start",gap:4,children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"By using BiomedArena, you agree to the following:"}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Research Preview"}),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsx(N,{fontSize:"sm",children:"⢠BiomedArena is an experimental research service, provided as is."}),o.jsx(N,{fontSize:"sm",children:"⢠It may produce inaccurate, incomplete, or offensive outputs."}),o.jsx(N,{fontSize:"sm",children:"⢠Not for clinical use or medical decision-making."})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Responsible Use"}),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsx(N,{fontSize:"sm",children:"⢠No illegal, harmful, violent, racist, or sexually explicit content."}),o.jsx(N,{fontSize:"sm",children:"⢠Do not submit personal, sensitive, or confidential information."}),o.jsx(N,{fontSize:"sm",children:"⢠You are responsible for ensuring compliance with applicable laws."})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Data Use"}),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsx(N,{fontSize:"sm",children:"⢠Conversations (text/images) may be stored to improve the service."}),o.jsx(N,{fontSize:"sm",children:"⢠Data may be anonymized and shared for research under a CC-BY license."}),o.jsx(N,{fontSize:"sm",children:"⢠Avoid submitting any information you would not want made public."})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Liability"}
12),o.jsxs(ut,{alignItems:"flex-start",gap:1,pl:2,children:[o.jsx(N,{fontSize:"sm",children:"⢠BiomedArena, its developers, and affiliates are not liable for damages from use."}),o.jsx(N,{fontSize:"sm",children:"⢠Use at your own risk."})]})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Updates"}),o.jsx(ut,{alignItems:"flex-start",gap:1,pl:2,children:o.jsx(N,{fontSize:"sm",children:"⢠Terms may change; continued use means you accept the latest version."})})]}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"md",color:"ui.text",mb:2,children:"Acceptance"}),o.jsx(ut,{alignItems:"flex-start",gap:1,pl:2,children:o.jsx(N,{fontSize:"sm",children:"By using this chat, you agree to let us store information that helps our service work and improves your experience. This allows us to remember your settings, understand how the chat is used so we can make it better, personalize your conversation, and keep things secure. We will not use your data for advertising. By using BiomedArena, you confirm you have read and agree to these terms."})})]})]})}),o.jsx(Hn,{children:o.jsx(We,{backgroundColor:"button.primary",color:"button.primaryText",_hover:{backgroundColor:"button.primaryHover"},size:"lg",onClick:s,loading:r,loadingText:"Accepting...",width:"100%",border:"none",boxShadow:"none",_focus:{boxShadow:"none",outline:"none"},_active:{boxShadow:"none"},children:"I Agree to Terms & Conditions"})})]})})};function ba(e={}){const{enabled:t=!0,debounceMs:n=500,minLength:r=6,chatHistory:i}=e,[s,a]=x.useState(""),[l,c]=x.useState([]),[u,d]=x.useState(!1),[f,p]=x.useState(null),h=x.useRef(null),g=x.useRef(null),k=x.useRef(null),b=x.useRef(""),S=x.useCallback(()=>{if(t){if(h.current){const j=h.current.readyState;if(j===WebSocket.OPEN||j===WebSocket.CONNECTING||j===WebSocket.CLOSING)return}try{const j=window.location.protocol==="https:"?"wss:":"ws:",E=Le.BASE.replace(/^https?:\/\//,""),w=`${j}//${E}/api/v1/chat/ws_autocomplete`,M=new WebSocket(w);M.onopen=()=>{const z=g.current;g.current=null,z&&z()},M.onmessage=z=>{try{const I=JSON.parse(z.data);I.event==="token"&&I.token?a($=>$+I.token):I.event==="done"?(I.suggestions&&Array.isArray(I.suggestions)?(c(I.suggestions),a("")):I.suggestion&&(a(I.suggestion),c([])),d(!1)):I.event==="error"?(console.error("Autocomplete error:",I.detail),p(I.detail||"Unknown error"),d(!1),a(""),c([])):I.event==="skip"&&(d(!1),c([]))}catch(I){console.error("Error parsing autocomplete message:",I),p("Failed to parse suggestion"),d(!1)}},M.onerror=z=>{console.error("Autocomplete WebSocket error:",z),p("Connection error"),d(!1),g.current=null},M.onclose=()=>{g.current=null,h.current=null},h.current=M}catch(j){console.error("Failed to create autocomplete WebSocket:",j),p("Failed to connect")}}},[t]),y=x.useCallback((j,E=!1,w=1)=>{a(""),c([]),p(null);const M=i&&i.length>0;if(!(E||M&&!j.trim())&&w<=1&&(!j||j.trim().length<r)){d(!1);return}if(!h.current||h.current.readyState!==WebSocket.OPEN){g.current=()=>y(j,E,w),S(),d(!0);return}try{d(!0),b.current=j;const I={partial_input:j,max_tokens:100,temperature:.3};w>1&&(I.num_suggestions=w),i&&i.length>0&&(I.chat_history=i),h.current.send(JSON.stringify(I))}catch(I){console.error("Failed to send autocomplete request:",I),p("Failed to request suggestion"),d(!1)}},[r,i,S]),R=x.useCallback((j,E=!1)=>{k.current&&clearTimeout(k.current);const w=i&&i.length>0;if(!(E||w&&!j.trim())&&(!j||j.trim().length===0)){a(""),d(!1);return}k.current=setTimeout(()=>{y(j,E)},n)},[n,y,i]),L=x.useCallback(()=>{a(""),c([]),p(null),d(!1),k.current&&clearTimeout(k.current)},[]),O=x.useCallback(j=>{y(j??"",!1,3)},[y]),T=x.useCallback(()=>{i&&i.length>0&&R("",!0)},[i,R]),Z=x.useCallback(j=>{if(!h.current||h.current.readyState!==WebSocket.OPEN){g.current=()=>Z(j),S(),d(!0);return}try{d(!0),a(""),p(null);const E={partial_input:"",max_tokens:100,temperature:.3,chat_history:j};h.current.send(JSON.stringify(E))}catch(E){console.error("Failed to send proactive autocomplete request:",E),p("Failed to request suggestion"),d(!1)}},[S]);return x.useEffect(()=>(t&&S(),()=>{k.current&&clearTimeout(k.current),g.current=null,h.current&&(h.current.close(),h.current=null)}),[t,S]),{suggestion:s,suggestions:l,isLoading:u,error:f,getSuggestion:R,clearSuggestion:L,requestProactiveSuggestion:T,requestProactiveSuggestionWithHistory:Z,requestInitialSuggestions:O}}const ld=()=>{const e=le("ui.background","ui.surface"),t=le("ui.text","white"),n=le("ui.muted","ui.border"),r=le("ui.background","white"),i=le("ui.main","ui.surface"),s=le("ui.text","white"),a=le("ui.muted","ui.surface"),l=le("none","invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)"),c=le("ui.text","white"),u=le("ui.muted","ui.surface");return x.useMemo(()=>({modeBg:"ui.surface",modeBorder:"ui.border",modeText:"ui.text",modeHover:"ui.muted",modeHoverBorder:"ui.main",modeActive:"ui.main",modeDropdownArrow:"ui.textSecondary",modeOptionHover:"ui.muted",modeActiveColor:c,modeHoverBg:u,buttonBg:"ui.surface",buttonText:"ui.text",buttonBorder:"ui.border",buttonHover:"ui.muted",buttonHoverBorder:"ui.borderHover",feedbackBg:e,feedbackText:t,feedbackBorder:n,sendButtonBg:"ui.main",sendButtonText:r,sendButtonHover:i,battleBg:"ui.surface",battleText:s,battleHover:a,iconFilter:l,background:"ui.background",surface:"ui.surface",text:"ui.text",textSecondary:"ui.textSecondary"}),[e,t,n,r,i,s,a,l,c,u])},Cl={async getTermsStatus(){try{const e=zn();if(e.user_id){const t=`${Le.BASE}/api/v1/users/me/terms-status`,n={"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access_token")}`},r=await fetch(t,{method:"GET",headers:n});if(!r.ok)throw new Error(`Failed to get terms status: ${r.statusText}`);return await r.json()}if(e.fingerprint_hash){const t=`${Le.BASE}/api/v1/chat/guest-terms-status?fingerprint_hash=${e.fingerprint_hash}`,r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to get terms status: ${r.statusText}`);return await r.json()}throw new Error("No user identification available")}catch(e){throw console.error("Error getting terms status:",e),e}},async acceptTerms(){try{const e=zn();if(e.user_id){const t=`${Le.BASE}/api/v1/users/me/accept-terms`,n={"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access_token")}`},r=await fetch(t,{method:"PATCH",headers:n});if(!r.ok){const s=await r.text();throw console.error("â termsService.acceptTerms: API Error:",r.status,s),new Error(`Failed to accept terms: ${r.status} ${r.statusText} - ${s}`)}return await r.json()}if(e.fingerprint_hash){const t=`${Le.BASE}/api/v1/chat/guest-accept-terms?fingerprint_hash=${e.fingerprint_hash}`,r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"}});if(!r.ok){const s=await r.text();throw console.error("â termsService.acceptTerms: API Error:",r.status,s),new Error(`Failed to accept terms: ${r.status} ${r.statusText} - ${s}`)}return await r.json()}throw new Error("No user identification available")}catch(e){throw console.error("termsService.acceptTerms: Error:",e),e}}},Cr="terms_accepted_cache",gb=300*1e3,ya=()=>
12{const[e,t]=x.useState(!1),[n,r]=x.useState(!1),[i,s]=x.useState(null),[a,l]=x.useState(null),c=x.useCallback(()=>{try{const k=localStorage.getItem(Cr);if(!k)return null;const b=JSON.parse(k),S=zn();return Date.now()-b.timestamp>gb||b.user_id!==S.user_id||b.fingerprint_hash!==S.fingerprint_hash?(localStorage.removeItem(Cr),null):b.terms_accepted}catch(k){return console.error("Error reading terms cache:",k),localStorage.removeItem(Cr),null}},[]),u=x.useCallback(k=>{try{const b=zn(),S={terms_accepted:k,user_id:b.user_id,fingerprint_hash:b.fingerprint_hash,timestamp:Date.now()};localStorage.setItem(Cr,JSON.stringify(S))}catch(b){console.error("Error caching terms status:",b)}},[]),d=x.useCallback(async()=>{const k=zn();if(!k.user_id){const S=c();if(S!==null)return l(S),S}r(!0),s(null);try{const S=await Cl.getTermsStatus();return k.user_id||u(S.terms_accepted),l(S.terms_accepted),S.terms_accepted}catch(S){return console.error("Error checking terms status:",S),s(S instanceof Error?S.message:"Failed to check terms status"),k.user_id?(l(!0),!0):(l(!1),!1)}finally{r(!1)}},[c,u]),f=x.useCallback(async()=>a===!0||await d()?!0:(t(!0),!1),[d,a]);x.useEffect(()=>{d()},[d]);const p=x.useCallback(async()=>{try{const k=zn();await Cl.acceptTerms(),k.user_id?localStorage.removeItem(Cr):u(!0),l(!0),t(!1),s(null);try{Io("consent_update",{consent_status:"accepted",consent_scope:"terms_of_use",user_type:k.user_id?"authenticated":"guest"})}catch{}}catch(k){console.error("Error accepting terms:",k),s(k instanceof Error?k.message:"Failed to accept terms")}},[u]),h=x.useCallback(k=>{s(k)},[]),g=x.useCallback(()=>{t(!1),s(null)},[]);return{isModalOpen:e,isCheckingTerms:n,termsError:i,termsAccepted:a,checkAndShowModal:f,checkTermsStatus:d,handleAcceptTerms:p,handleTermsError:h,closeModal:g}},cd=e=>{const t=xr(),n=t?Fn():null;return pr({queryKey:["threadHistory",e,n],queryFn:async()=>{if(!e)throw new Error("Thread ID is required");const r={};return t&&n&&(r.fingerprint_hash=n),await lt(Le,{method:"GET",url:`/api/v1/threads/${e}/history`,query:r})},enabled:!!e})},ud=()=>{const e=Ht();return xn({mutationFn:async t=>{const n={...t};return xr()&&(n.fingerprint_hash=Fn()),await lt(Le,{method:"POST",url:(()=>{const i=new URLSearchParams({turn_id:n.turn_id,outcome:n.outcome});return n.feedback_text&&i.append("feedback_text",n.feedback_text),n.fingerprint_hash&&i.append("fingerprint_hash",n.fingerprint_hash),`/api/v1/votes/?${i.toString()}`})()})},onSuccess:(t,n)=>{gr("vote_cast",{outcome:n.outcome,has_feedback:!!n.feedback_text,user_type:xr()?"guest":"authenticated"}),e.invalidateQueries({queryKey:["threadHistory"]}),e.invalidateQueries({queryKey:["vote",n.turn_id]})}})},Yn={DEFAULT_MAX_TOKENS:1e3,DEFAULT_TEMPERATURE:1,WEBSOCKET_RETRY_DELAY:1e3,WEBSOCKET_MAX_RETRIES:3},wa={async sendMessage(e,t,n,r,i,s,a=!0,l){try{const c=window.location.protocol==="https:"?"wss:":"ws:",u=Le.BASE.replace(/^https?:\/\//,""),d=`${c}//${u}/api/v1/chat/ws_single_chat`,f=new WebSocket(d);let p=s;return f.onopen=()=>{const h=e[e.length-1],g={model:t,messages:[{role:h.role,content:h.content}],stream:!0,temperature:Yn.DEFAULT_TEMPERATURE,max_tokens:Yn.DEFAULT_MAX_TOKENS,mode:"single",thinking_mode:a};l&&l.length>0&&(g.knowledge_agents=l),p&&(g.thread_id=p);try{const k=zn();Object.assign(g,k)}catch(k){console.error("Failed to get user identification:",k)}f.send(JSON.stringify(g))},f.onmessage=h=>{try{const g=JSON.parse(h.data);g.event==="thread_created"&&g.thread_id&&(p=g.thread_id);const k={...g,thread_id:g.thread_id||p};n(k)}catch(g){console.error("Error parsing WebSocket message:",g),r(g instanceof Error?g:new Error("Failed to parse WebSocket message"))}},f.onerror=h=>{console.error("WebSocket error:",h),r(new Error("WebSocket connection error"))},f.onclose=()=>{i(p)},()=>{f.readyState===WebSocket.OPEN&&f.close()}}catch(c){return console.error("Error creating WebSocket:",c),r(c instanceof Error?c:new Error("Failed to create WebSocket connection")),()=>{}}},processWebSocketStream(e,t,n){const r=a=>{if(a.event==="token"&&a.token){const l=a.token;e(l)}else a.event==="metrics"||(a.event==="error"?t(new Error(a.detail||"Unknown error")):a.event==="done"&&n())},i=a=>{t(a)},s=()=>{n()};return(a,l)=>this.sendMessage(a,l,r,i,s)},singleTurnDualChat({useRandomModels:e=!0,leftModel:t,rightModel:n,messages:r,threadId:i,thinking_mode:s=!0,onSetup:a,onToken:l,onDone:c,onError:u,onClose:d,onThreadCreated:f,onTurnCreated:p,onTurnCompleted:h}){const g=window.location.protocol==="https:"?"wss:":"ws:",k=Le.BASE.replace(/^https?:\/\//,""),b=`${g}//${k}/api/v1/chat/ws_double_chat`,S=new WebSocket(b);let y=[];const R=new Set;return S.onopen=()=>{const L=r[r.length-1],O={messages:[{role:L.role,content:L.content}],stream:!0,temperature:Yn.DEFAULT_TEMPERATURE,max_tokens:Yn.DEFAULT_MAX_TOKENS,use_random_models:e,mode:"dual",thinking_mode:s};if(i&&(O.thread_id=i),!e){if(!t||!n){u&&u("Both left and right models must be specified when not using random models");return}O.left_model=t,O.right_model=n}try{const T=zn();Object.assign(O,T)}catch(T){console.error("Failed to get user identification:",T)}S.send(JSON.stringify(O))},S.onmessage=L=>{try{const O=JSON.parse(L.data);O.event==="setup"&&Array.isArray(O.llms)?(y=O.llms,a&&a(y)):O.event==="token"&&O.llm_name&&O.token?l&&l(O.llm_name,O.token):(O.event==="done"||O.event==="llm_done")&&O.llm_name?(R.add(O.llm_name),c&&c(O.llm_name)):O.event==="done"&&O.thread_id?(f&&f(O.thread_id),O.turn_id&&O.turn_idx!==void 0&&(p&&p(O.turn_id,O.turn_idx),h&&h(O.turn_id,O.thread_id)),S.close()):O.event==="metrics"||O.event==="error"&&u&&u(O.detail||"Unknown error")}catch{u&&u("Failed to parse WebSocket message")}},S.onerror=L=>{u&&u("WebSocket connection error")}
12,S.onclose=()=>{d&&d()},()=>{(S.readyState===WebSocket.OPEN||S.readyState===WebSocket.CONNECTING)&&S.close()}},sideBySideDualChatWebSocket({useRandomModels:e=!0,leftModel:t,rightModel:n,onSetup:r,onToken:i,onDone:s,onError:a,onClose:l,onThreadCreated:c,onTurnCreated:u}){return(d,f)=>{const p=window.location.protocol==="https:"?"wss:":"ws:",h=Le.BASE.replace(/^https?:\/\//,""),g=`${p}//${h}/api/v1/chat/ws_double_chat`,k=new WebSocket(g);let b=[];const S=new Set;let y=f;return k.onopen=()=>{const R=d[d.length-1],L={messages:[{role:R.role,content:R.content}],stream:!0,temperature:Yn.DEFAULT_TEMPERATURE,max_tokens:Yn.DEFAULT_MAX_TOKENS,use_random_models:e};if(!e){if(!t||!n){a&&a("Both left and right models must be specified when not using random models");return}L.left_model=t,L.right_model=n}y&&(L.thread_id=y);try{const O=zn();Object.assign(L,O)}catch(O){console.error("Failed to get user identification:",O)}k.send(JSON.stringify(L))},k.onmessage=R=>{try{const L=JSON.parse(R.data);L.event==="setup"&&Array.isArray(L.llms)?(b=L.llms,r&&r(b)):L.event==="thread_created"&&L.thread_id?(y=L.thread_id,c&&c(L.thread_id)):L.event==="token"&&L.llm_name&&L.token?i&&i(L.llm_name,L.token):(L.event==="done"||L.event==="llm_done")&&L.llm_name?(S.add(L.llm_name),s&&s(L.llm_name)):L.event==="done"&&L.turn_id&&L.turn_idx!==void 0?u&&u(L.turn_id,L.turn_idx):L.event==="metrics"||L.event==="error"&&a&&a(L.detail||"Unknown error")}catch{a&&a("Failed to parse WebSocket message")}},k.onerror=R=>{a&&a("WebSocket connection error")},k.onclose=()=>{l&&l()},()=>{(k.readyState===WebSocket.OPEN||k.readyState===WebSocket.CONNECTING)&&k.close()}}},battleDualChatWebSocket({onSetup:e,onToken:t,onDone:n,onError:r,onClose:i,onThreadCreated:s,onTurnCreated:a,thinking_mode:l=!0,knowledge_operators:c=null}){return(u,d)=>{const f=window.location.protocol==="https:"?"wss:":"ws:",p=Le.BASE.replace(/^https?:\/\//,""),h=`${f}//${p}/api/v1/chat/ws_double_chat`,g=new WebSocket(h);let k=[];const b=new Set;let S=d;return g.onopen=()=>{const y=u[u.length-1],R={messages:[{role:y.role,content:y.content}],stream:!0,temperature:Yn.DEFAULT_TEMPERATURE,max_tokens:Yn.DEFAULT_MAX_TOKENS,use_random_models:!0,mode:"battle",thinking_mode:l};c&&(R.knowledge_operators=c),S&&(R.thread_id=S);try{const L=zn();Object.assign(R,L)}catch(L){console.error("Failed to get user identification for battle chat:",L)}g.send(JSON.stringify(R))},g.onmessage=y=>{try{const R=JSON.parse(y.data);R.event==="setup"&&Array.isArray(R.llms)?(k=R.llms,e&&e(k)):R.event==="thread_created"&&R.thread_id?(S=R.thread_id,s&&s(R.thread_id)):R.event==="token"&&R.llm_name&&R.token?t&&t(R.llm_name,R.token):(R.event==="done"||R.event==="llm_done")&&R.llm_name?(b.add(R.llm_name),n&&n(R.llm_name)):R.event==="done"&&R.turn_id&&R.turn_idx!==void 0?a&&a(R.turn_id,R.turn_idx):R.event==="metrics"||R.event==="error"&&r&&r(R.detail||"Unknown error",R.llm_name)}catch{r&&r("Failed to parse WebSocket message",void 0)}},g.onerror=y=>{r&&r("WebSocket connection error",void 0)},g.onclose=()=>{i&&i()},()=>{(g.readyState===WebSocket.OPEN||g.readyState===WebSocket.CONNECTING)&&g.close()}}}};async function xb(e){const t=await fetch(`${Le.BASE}/api/v1/chat/guest/start?fingerprint_hash=${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to start guest chat");return await t.json()}async function bb(e){const t=await fetch(`${Le.BASE}/api/v1/chat/guest/history/${e}`);if(!t.ok)throw new Error("Failed to fetch guest chat history");return await t.json()}const Lt=e=>{const t=(e||"").toLowerCase();return t.includes("+")?"/assets/images/agentic.svg":t.includes("deepseek")?"/assets/images/deepseek.svg":t.includes("grok")?"/assets/images/grok.svg":t.includes("mistral")?"/assets/images/mistral.svg":t.includes("llama")?"/assets/images/llama.svg":t.includes("gemini")?"/assets/images/gemini.svg":t.includes("gpt")||t.includes("openai")?"/assets/images/openai.svg":t.includes("claude")?"/assets/images/claude.svg":t.includes("sonar")?"/assets/images/perplexity.svg":"/assets/images/openai.svg"},di=x.forwardRef(function(t,n){const{icon:r,children:i,inputProps:s,rootRef:a,...l}=t;return o.jsxs(qh,{ref:a,...l,children:[o.jsx(Vh,{ref:n,...s}),o.jsx(Zh,{children:r||o.jsx(Gh,{})}),i!=null&&o.jsx(Yh,{children:i})]})}),es=140,Ti="chat:knowledgeToggleEnabled",Ms="chat:knowledgeSourcesSelection",El="chat:crisprToggleEnabled",ka=["sql","ncbi","varpub","totbot","google"],yb={sql:"SQL (GWAS)",ncbi:"NCBI",varpub:"Variant Publications",totbot:"Pubtator",google:"Google Search (NIH)"};function dd(){const e={};for(const t of ka)e[t]=!1;return e}function wb(){if(typeof window<"u")try{const e=window.localStorage.getItem(Ms);if(e){const t=JSON.parse(e);if(ka.every(r=>typeof t[r]=="boolean"))return t}}catch{}return dd()}const Dr=x.forwardRef(function({value:t,onChange:n,onSend:r,isLoading:i,autoFocus:s=!0,disableCaret:a=!1,showSpinnerWhenLoading:l=!0,isCentered:c=!1,onThinkingModeChange:u,thinkingModeEnabled:d=!1,showKnowledgeToggle:f=!0,onKnowledgeAgentsChange:p,onKnowledgeEnabledChange:h,knowledgeOperator:g=null,onKnowledgeOperatorChange:k,messages:b=[],onCrisprModeChange:S,crisprModeEnabled:y,showCrisprToggle:R=!0,onStarterSuggestionsChange:L},O){const[T,Z]=x.useState(!1),[j,E]=x.useState(d),[w,M]=x.useState(()=>{if(typeof window>"u")return!!y;try{const P=window.localStorage.getItem(El);return P!=null?P==="true":y!==void 0?y:!1}catch{return!!y}}),[z,I]=x.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ti)==="true"}catch{return!1}}
12),[$,X]=x.useState(null),[xe,K]=x.useState(()=>wb()),[U,ie]=x.useState(null),C=x.useRef(null),ne=x.useRef(null),ue=x.useRef(null),v=x.useMemo(()=>b.slice(-4).map(G=>({role:G.role,content:G.content})),[b]),{suggestion:ze,suggestions:he,getSuggestion:Pe,clearSuggestion:et,requestProactiveSuggestion:Se,requestProactiveSuggestionWithHistory:Ie,requestInitialSuggestions:Ve}=ba({enabled:!i,debounceMs:500,minLength:6,chatHistory:v}),ve=b.length===0,Ae=t.trim(),je=/[.?!]$/.test(Ae),Ce=he.length>0&&ve&&Ae.length>=6&&Ae.length<=50&&!je,Ee=x.useMemo(()=>{if(!ze)return"";if(!t||!t.trim())return ze;const P=t.toLowerCase().trim();return ze.toLowerCase().trim().startsWith(P)?ze.substring(t.trim().length):ze},[ze,t]),[De,pt]=x.useState(!1),Fe=x.useRef(null),[A,W]=x.useState(null),[H,se]=x.useState(!1),re=x.useRef(null),[Q,me]=x.useState(null),[D,q]=x.useState(!1),fe=x.useRef(null),[ke,$e]=x.useState(null),Ke=x.useCallback(()=>{const P=dd();I(!1),K(P),X(null);try{window.localStorage.setItem(Ti,"false"),window.localStorage.setItem(Ms,JSON.stringify(P))}catch{}p&&p(w?["crispr"]:[])},[p,w]);x.useEffect(()=>(typeof window<"u"&&(window.resetChatInputKnowledgeState=Ke),()=>{typeof window<"u"&&(window.resetChatInputKnowledgeState=void 0)}),[Ke]),x.useEffect(()=>{E(P=>P===d?P:d)},[d]),x.useEffect(()=>{y!==void 0&&M(P=>P===y?P:y)},[y]),x.useEffect(()=>{if(!(typeof window>"u"))try{const P=window.localStorage.getItem(Ti);P!=null&&I(P==="true")}catch{}},[]),x.useEffect(()=>{if(!(typeof window>"u")){try{window.localStorage.setItem(El,w?"true":"false")}catch{}S==null||S(w)}},[w,S]);function nt(P,G){const ee=P.getBoundingClientRect(),J=Math.max(8,Math.min(ee.left,window.innerWidth-280));return G!=null&&G.forceBelow?{left:J,top:ee.bottom+8}:window.innerHeight-ee.bottom<es?{left:J,bottom:window.innerHeight-ee.top+8}:{left:J,top:ee.bottom+8}}const at=x.useCallback(P=>{const G=ne.current;if(!G)return;const ee=G.getBoundingClientRect(),J=8,ge=window.innerWidth-J*2,Oe=Math.min(ee.width,ge),pe=Math.max(J,Math.min(ee.left,window.innerWidth-Oe-J)),qe=window.innerHeight-ee.bottom-J,He=ee.top-J,_=B=>{const Y=Math.max(window.innerHeight*.7,240);return B>0?B<200?B:Math.min(B,Y):Y};if(P!=null&&P.forceBelow){X({left:pe,top:ee.bottom+J,width:Oe,maxHeight:_(qe)});return}if(qe<es){X({left:pe,bottom:window.innerHeight-ee.top+J,width:Oe,maxHeight:_(He)});return}X({left:pe,top:ee.bottom+J,width:Oe,maxHeight:_(qe)})},[]),vt=x.useCallback(P=>{const G=ne.current;if(!G)return;const ee=G.getBoundingClientRect(),J=8,ge=window.innerWidth-J*2,Oe=Math.min(ee.width,ge),pe=Math.max(J,Math.min(ee.left,window.innerWidth-Oe-J)),qe=window.innerHeight-ee.bottom-J,He=ee.top-J,_=B=>{const Y=Math.max(window.innerHeight*.3,180);return B>0?Math.min(B-20,Y):Y};if(P!=null&&P.forceBelow){ie({left:pe,top:ee.bottom+J,width:Oe,maxHeight:_(qe)});return}if(qe<es){ie({left:pe,bottom:window.innerHeight-ee.top+J,width:Oe,maxHeight:_(He)});return}ie({left:pe,top:ee.bottom+J,width:Oe,maxHeight:_(qe)})},[]),Et=x.useCallback(()=>{at(c?{forceBelow:!0}:void 0)},[c,at]);x.useEffect(()=>{if(!f){X(null);return}if(!$)return;const P=()=>Et();return window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),()=>{window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}},[$,Et,f]);const ht=()=>{if(k){!U?(se(!1),me(null),vt(c?{forceBelow:!0}:void 0)):ie(null);return}if(!f)return;!$?(se(!1),me(null),at(c?{forceBelow:!0}:void 0)):X(null)},Ze=(P,G)=>{K(ee=>({...ee,[P]:G}))};x.useEffect(()=>{if(!(typeof window>"u")){try{window.localStorage.setItem(Ti,z?"true":"false")}catch{}try{h==null||h(z)}catch{}}},[z,h]),x.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Ms,JSON.stringify(xe))}catch{}},[xe]),x.useEffect(()=>{if(!p)return;let P=[];z&&(P=Object.entries(xe).filter(([,G])=>G).map(([G])=>G)),w&&P.push("crispr"),p(P)},[z,xe,w,p]),x.useEffect(()=>{f||X(null)},[f]),x.useEffect(()=>{const P=G=>{const ee=G.target;if(U){const J=re.current;if(J!=null&&J.contains(ee))return;const ge=document.querySelectorAll("[data-portal]");let Oe=!1;for(const pe of ge)if(pe.contains(ee)){Oe=!0;break}Oe||ie(null)}if($){const J=re.current;if(J!=null&&J.contains(ee))return;const ge=document.querySelectorAll("[data-portal]");let Oe=!1;for(const pe of ge)if(pe.contains(ee)){Oe=!0;break}Oe||X(null)}};if(U||$)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[U,$]);const Xe=x.useCallback(()=>{const P=C.current;if(P)try{P.style.height="auto";const G=P.scrollHeight;ue.current==null&&(ue.current=Math.max(G,P.clientHeight||0)||48);const ee=(ue.current||48)*2,J=Math.min(G,ee);P.style.height=`${J}px`,P.style.overflowY=G>ee?"auto":"hidden"}catch{}},[]);x.useEffect(()=>{Xe();const P=()=>Xe();return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[Xe]),x.useEffect(()=>{requestAnimationFrame(()=>Xe())},[Xe]);const jt=x.useRef(Xe);x.useEffect(()=>{jt.current=Xe},[Xe]);const Gt=x.useRef(t);x.useEffect(()=>{let P=null;const G=()=>{const ee=C.current;if(ee){const J=ee.value;J!==Gt.current&&(Gt.current=J,requestAnimationFrame(()=>jt.current()))}P=requestAnimationFrame(G)};return P=requestAnimationFrame(G),()=>{P!=null&&cancelAnimationFrame(P)}},[]),x.useEffect(()=>{var G;if(!s)return;const P=C.current;if(P&&!i)try{P.focus();const ee=((G=P.value)==null?void 0:G.length)??0;P.setSelectionRange(ee,ee),Z(!0)}catch{}},[s,i]);const Yt=Fr({base:b.length===0?"Your query":"",md:b.length===0?"Type your question here...":""}),en=Fr({base:"sm",md:"md"}),bn=Fr({base:"2.25rem",md:"3rem"}),tn=x.useRef(!1),At=x.useRef(!1),pn=x.useRef(!1),gt=x.useRef(null),Bt=x.useRef(""),nn=x.useCallback(()=>{gt.current&&(clearTimeout(gt.current),gt.current=null)},[]),dt=x.useCallback(P=>{nn(),tn.current=!1,At.current=!1,pn.current=!1,Bt.current="",P!=null&&P.clearButtons&&et(),L==null||L({suggestions:[],seed:"",visible:!1,loading:!1})},[nn,et,L]);x.useEffect(()=>{ve||dt({clearButtons:!0})},[ve,dt]),x.useEffect(()=>{if(!ve)return;const P=t.trim(),G=/[.?!]$/.test(P),ee=P.length>50;(P.length<6||G||ee)&&!tn.current&&!gt.current&&dt({clearButtons:!0})},[ve,t,dt]),x.useEffect(()=>()=>{nn()},[nn]);const kn=x.useCallback(()=>{dt({clearButtons:!0})},[dt]);x.useImperativeHandle(O,()=>({triggerProactiveSuggestion:P=>{Ie(P)},dismissStarterSuggestions:kn,focusInput:()=>{var G;const P=C.current;if(P){P.focus();const ee=((G=P.value)==null?void 0:G.length)??0;P.setSelectionRange(ee,ee)}}}),[Ie,kn]);const F=x.useRef(i),ae=x.useRef(0);x.useEffect(()=>{const P=F.current&&!i,ee=Date.now()-ae.current>2e3;if(P&&b.length>0&&!t.trim()&&ee){ae.current=Date.now();const J=setTimeout(()=>{Se()},300);return()=>clearTimeout(J)}F.current=i},[i,b.length,t,Se]);const _e=x.useRef(!1);return x.useEffect(()=>{if(!_e.current&&!ve&&b.length>0&&!t.trim()&&!i){_e.current=!0,ae.current=Date.now();const P=setTimeout(()=>{Se()},500);return()=>clearTimeout(P)}},[ve,b.length,t,i,Se]),x.useEffect(()=>{he.length>0&&(pn.current=!0)},[he.length]),x.useEffect(()=>{if(L)if(Ce){const P=Bt.current;L({suggestions:he,seed:P,visible:!0,loading:!1})}else!At.current&&!tn.current&&L({suggestions:[],seed:"",visible:!1,loading:!1})},[L,Ce,he]),x.useEffect(()=>{!tn.current&&!At.current||!i&&he.length===0&&!gt.current&&pn.current&&dt()},[i,he.length,dt]),o.jsxs(Me,{as:"form",ref:ne,onSubmit:P=>{P.preventDefault(),r()}
12,align:"center",gap:2,px:0,pt:2,pb:8,w:"100%",bg:"ui.sidebar",m:0,borderRadius:"xl",flexDirection:"column",children:[o.jsxs(m,{position:"relative",w:"100%",display:"flex",alignItems:"center",children:[o.jsx("style",{children:"@keyframes blink { 0% { opacity: 1 } 50% { opacity: 0 } 100% { opacity: 1 } }"}),o.jsx(m,{position:"absolute",left:"0.5rem",pointerEvents:"none",display:a||t.trim()||T?"none":"block",top:"0.2rem",w:"1px",h:"1.25rem",bg:"input.text",borderRadius:"1px",style:{animation:"blink 1s step-end infinite"}}),Ee&&o.jsxs(m,{position:"absolute",left:"0.5rem",top:"0",pointerEvents:"none",color:"input.placeholder",opacity:.5,fontSize:en,lineHeight:"1.5rem",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",px:0,py:0,children:[t&&o.jsx(m,{as:"span",opacity:0,children:t}),o.jsx(m,{as:"span",color:"ui.textSecondary",opacity:.6,children:Ee})]}),o.jsx(ra,{ref:C,value:t,onChange:P=>{const G=P.target.value,ee=G.trim().length;if(ve){const J=G.trim(),ge=/[.?!]$/.test(J),Oe=ee>50;if(ge||Oe)dt({clearButtons:!0});else if(ee>=6){if(J.length===0){dt({clearButtons:!0});return}const pe=Bt.current;(!pe||J!==pe)&&(At.current=!0,nn(),L==null||L({suggestions:[],seed:J,visible:!0,loading:!0}),gt.current=setTimeout(()=>{gt.current=null,tn.current=!0,pn.current=!1,Ve(J)},300),Bt.current=J)}else ee<6&&dt({clearButtons:!0})}if(n(G),requestAnimationFrame(()=>Xe()),!ve){const J=G.trim(),ge=/[.?!]$/.test(J),Oe=ee>50;ge||Oe?et():ee>=6?Pe(G):et()}},onFocus:()=>{Z(!0),$&&X(null),U&&ie(null)},onBlur:()=>Z(!1),onKeyDown:P=>{if(P.key==="Tab"&&Ee){P.preventDefault(),n(t+Ee),et(),requestAnimationFrame(()=>Xe());return}if(P.key==="Escape"&&Ee){P.preventDefault(),et();return}P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),t.trim()&&(et(),r()))},placeholder:Yt,rows:1,minH:bn,resize:"none",borderRadius:"xl",border:"none",bg:"transparent",color:"input.text",fontSize:en,disabled:i,py:0,pl:"0.5rem",pr:3,_hover:{boxShadow:"none",bg:"transparent"},_placeholder:{color:"input.placeholder",lineHeight:{base:"1.25rem",md:"1.5rem"}},_focus:{boxShadow:"none",outline:"none",bg:"transparent"},style:a?{caretColor:"transparent"}:void 0,css:{"&::placeholder":{color:"var(--chakra-colors-input-placeholder)",opacity:1},"&":{lineHeight:"1.5rem",borderRadius:"1rem",overflow:"auto"},"::webkitScrollbar":{width:"4px",borderRadius:"8px",background:"transparent"},"::webkitScrollbarThumb":{background:"rgba(180,180,200,0.18)",borderRadius:"8px",minHeight:"24px"},"::webkitScrollbarThumb:hover":{background:"rgba(180,180,200,0.28)"},"::webkitScrollbarCorner":{background:"transparent"},scrollbarWidth:"thin",scrollbarColor:"var(--chakra-colors-input-border) transparent"}}),o.jsxs(m,{position:"absolute",top:"calc(100%)",left:"0rem",right:"0rem",display:"flex",alignItems:"center",justifyContent:"space-between",px:"0.25rem",py:"0.25rem",bg:"ui.sidebar",borderRadius:"md",children:[o.jsxs(m,{display:"flex",gap:"0.75rem",alignItems:"center",children:[o.jsxs(m,{display:"flex",alignItems:"center",gap:"0.375rem",cursor:"pointer",onClick:()=>{const P=!j;E(P),u==null||u(P)},ref:Fe,onMouseEnter:()=>{if($||U)return;const P=Fe.current;P&&W(nt(P,{forceBelow:c})),pt(!0)},onMouseLeave:()=>{pt(!1),W(null)},children:[o.jsx(m,{h:"1.40rem",w:"1.40rem",minW:"1.40rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"md",bg:"ui.sidebar",color:j?"teal.500":"input.placeholder",border:"0.5px solid",borderColor:j?"teal.500":"input.border",_hover:j?{bg:"rgba(45,212,191,0.10)",color:"teal.300",borderColor:"teal.300"}:{bg:"rgba(107,70,193,0.08)",color:"ui.text",borderColor:"ui.text"},children:o.jsx(Ut,{as:j?Bm:Dm,boxSize:"1.0rem"})}),o.jsx(m,{fontSize:"xs",color:j?"teal.500":"input.placeholder",fontWeight:"medium",children:"Thinking Models"})]}),(f||k)&&o.jsxs(m,{display:"flex",alignItems:"center",gap:"0.375rem",cursor:"pointer",onClick:P=>{P.preventDefault(),ht()},ref:re,onMouseEnter:()=>{if($||U)return;const P=re.current;P&&me(nt(P,{forceBelow:c})),se(!0)},onMouseLeave:()=>{se(!1),me(null)},"aria-pressed":!!($||U),children:[o.jsx(m,{h:"1.40rem",w:"1.40rem",minW:"1.40rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"md",bg:"ui.sidebar",color:k?g?"purple.400":"ui.textSecondary":z?"purple.400":"ui.textSecondary",border:"0.5px solid",borderColor:k?g?"purple.400":"ui.border":z?"purple.400":"ui.border",_hover:z||g?{bg:"rgba(159,122,234,0.10)",color:"purple.300",borderColor:"purple.300"}:{bg:"rgba(107,70,193,0.08)",color:"ui.text",borderColor:"ui.text"},children:o.jsx(Ut,{as:Lm,boxSize:"1.0rem"})}),o.jsx(m,{fontSize:"xs",color:k?g?"purple.400":"ui.textSecondary":z?"purple.400":"ui.textSecondary",fontWeight:"medium",children:"Knowledge"})]}),R&&!k&&o.jsxs(m,{display:"flex",alignItems:"center",gap:"0.375rem",cursor:"pointer",onClick:()=>{M(!w)},ref:fe,onMouseEnter:()=>{if($||U)return;const P=fe.current;P&&$e(nt(P,{forceBelow:c})),q(!0)},onMouseLeave:()=>{q(!1),$e(null)},children:[o.jsx(m,{h:"1.40rem",w:"1.40rem",minW:"1.40rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"md",bg:"ui.sidebar",color:w?"orange.500":"input.placeholder",border:"0.5px solid",borderColor:w?"orange.500":"input.border",_hover:w?{bg:"rgba(251,146,60,0.10)",color:"orange.300",borderColor:"orange.300"}:{bg:"rgba(107,70,193,0.08)",color:"ui.text",borderColor:"ui.text"},children:o.jsx(m,{w:"1.0rem",h:"1.0rem",bg:"currentColor",css:{mask:'url("/assets/images/crispr.svg") no-repeat center',maskSize:"contain",WebkitMask:'url("/assets/images/crispr.svg") no-repeat center',WebkitMaskSize:"contain"}})}),o.jsx(m,{fontSize:"xs",color:w?"orange.500":"input.placeholder",fontWeight:"medium",children:"CRISPR"})]}),H&&Q&&o.jsx(Jt,{children:o.jsx(m,{position:"fixed",...Q.top!=null?{top:`${Q.top}px`}:{bottom:`${Q.bottom}px`},...Q.left!=null?{left:`${Q.left}px`}:{right:`${Q.right}px`},bg:"ui.background",color:"ui.text",borderWidth:"0.5px",borderColor:"ui.border",borderRadius:"md",px:4,py:3,fontSize:"xs",minW:"260px",maxW:"340p
12x",boxShadow:"lg",zIndex:9999999,children:o.jsxs(m,{children:[o.jsx(m,{fontWeight:"bold",mb:1,color:"ui.textSecondary",children:"Knowledge Sources"}),o.jsx(m,{fontSize:"xs",children:k?"Includes external knowledge sources (NIH Google, Pubtator, NCBI, GWAS tables) to augment the model's response.":"Select external knowledge sources to include in the response (Pubtator, NCBI, GWAS tables, Google). These will be combined with the model output."})]})})})]}),o.jsx(m,{display:"flex",gap:"0.25rem",alignItems:"center",children:o.jsx(_n,{"aria-label":"Send",colorScheme:"blue",type:"submit",disabled:!t.trim()||i,borderRadius:"md",h:"2rem",w:"2rem",minW:"2rem",bg:"ui.main",color:"button.primaryText",_hover:{bg:"button.primaryHover"},children:i&&l?o.jsx(cn,{size:"sm"}):o.jsx(Ut,{as:Nm,boxSize:"1.0rem"})})})]})]}),De&&A&&o.jsx(Jt,{children:o.jsx(m,{position:"fixed",...A.top!=null?{top:`${A.top}px`}:{bottom:`${A.bottom}px`},...A.left!=null?{left:`${A.left}px`}:{right:`${A.right}px`},bg:"ui.background",color:"ui.text",borderWidth:"0.5px",borderColor:"ui.border",borderRadius:"md",px:4,py:3,fontSize:"xs",minW:"260px",maxW:"340px",boxShadow:"lg",zIndex:9999999,children:o.jsxs(m,{children:[o.jsx(m,{fontWeight:"bold",mb:1,color:"ui.textSecondary",children:"Thinking Models"}),o.jsx(m,{fontSize:"xs",children:"Includes models designed for deeper reasoning and multi-step problem solving. Responses may take longer but can handle more complex tasks."})]})})}),D&&ke&&o.jsx(Jt,{children:o.jsx(m,{position:"fixed",...ke.top!=null?{top:`${ke.top}px`}:{bottom:`${ke.bottom}px`},...ke.left!=null?{left:`${ke.left}px`}:{right:`${ke.right}px`},bg:"ui.background",color:"ui.text",borderWidth:"0.5px",borderColor:"ui.border",borderRadius:"md",px:4,py:3,fontSize:"xs",minW:"260px",maxW:"340px",boxShadow:"lg",zIndex:9999999,children:o.jsxs(m,{children:[o.jsx(m,{fontWeight:"bold",mb:1,color:"ui.textSecondary",children:"CRISPR Screens"}),o.jsx(m,{fontSize:"xs",children:"Access curated CRISPR screening data and analysis results. Enables queries about gene essentiality, screening hits, and functional genomics insights from large-scale CRISPR experiments."})]})})}),f&&$&&o.jsx(Jt,{children:o.jsxs(m,{"data-portal":!0,position:"fixed",...$.top!=null?{top:`${$.top}px`}:{bottom:`${$.bottom}px`},left:`${$.left}px`,width:`${$.width}px`,bg:"ui.background",color:"ui.text",borderWidth:"0.5px",borderColor:"ui.border",borderRadius:"md",px:4,py:4,fontSize:"sm",maxH:`${$.maxHeight}px`,display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"xl",zIndex:9999999,children:[o.jsxs(m,{display:"flex",justifyContent:"space-between",alignItems:"center",mt:0,mb:2,children:[o.jsx(m,{fontWeight:"semibold",color:"ui.text",fontSize:{base:"xs",md:"sm"},children:"External Knowledge Sources"}),o.jsxs(m,{display:"flex",alignItems:"center",gap:3,children:[o.jsx(m,{as:"button",onClick:()=>I(!z),w:"44px",h:"24px",bg:z?"purple.400":"gray.300",borderRadius:"12px",position:"relative",transition:"all 0.2s",_hover:{bg:z?"purple.500":"gray.400"},cursor:"pointer",children:o.jsx(m,{w:"20px",h:"20px",bg:"white",borderRadius:"10px",position:"absolute",top:"2px",left:z?"22px":"2px",transition:"all 0.2s",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.2)"})}),o.jsx(vs,{size:"sm",onClick:()=>{X(null)}})]})]}),o.jsx(m,{fontSize:"xs",color:"ui.textSecondary",mb:4,mt:-2,children:"Select external knowledge sources to query and aggregate with your response. These will be combined with the model output for a richer answer."}),o.jsx(hr,{gap:2,mt:0,fontSize:"sm",flex:1,overflowY:"auto",minH:0,pr:1,opacity:z?1:.5,pointerEvents:z?"auto":"none",children:ka.map(P=>o.jsx(di,{checked:xe[P],onCheckedChange:({checked:G})=>Ze(P,G===!0),colorPalette:"purple",size:"sm",gap:2,disabled:!z,children:o.jsx(m,{as:"span",color:"ui.text",fontSize:{base:"xx-small",md:"xs"},children:yb[P]})},P))})]})}),k&&U&&o.jsx(Jt,{children:o.jsxs(m,{"data-portal":!0,position:"fixed",...U.top!=null?{top:`${U.top}px`}:{bottom:`${U.bottom}px`},left:`${U.left}px`,width:`${U.width}px`,bg:"ui.background",color:"ui.text",borderWidth:"0.5px",borderColor:"ui.border",borderRadius:"md",fontSize:"sm",maxH:`${U.maxHeight}px`,display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"xl",zIndex:9999999,children:[o.jsx(m,{px:3,pt:2.5,pb:1.5,flexShrink:0,children:o.jsxs(m,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0,children:[o.jsx(m,{fontWeight:"semibold",color:"ui.text",fontSize:{base:"2xs",md:"xs"},children:"Knowledge Sources"}),o.jsx(vs,{size:"sm",onClick:()=>{ie(null)}})]})}),o.jsx(m,{px:3,pb:3,flex:1,overflowY:"auto",minH:0,css:{"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(159,122,234,0.3)",borderRadius:"3px"},"&::-webkit-scrollbar-thumb:hover":{background:"rgba(159,122,234,0.5)"}},children:o.jsxs(Me,{gap:{base:2,md:3},children:[o.jsxs(m,{flex:1,p:{base:2,md:3},borderRadius:"md",borderWidth:"1px",borderColor:g==="genbio"||g==="genomics"?"purple.400":"ui.border",bg:g==="genbio"||g==="genomics"?"rgba(159,122,234,0.05)":"transparent",transition:"all 0.2s",opacity:g==="genomics"?.6:1,pointerEvents:g==="genomics"?"n
12one":"auto",children:[o.jsxs(m,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:{base:1.5,md:2},children:[o.jsxs(m,{display:"flex",alignItems:"center",gap:1,children:[o.jsx(m,{fontWeight:"semibold",color:g==="genbio"||g==="genomics"?"purple.400":"ui.text",fontSize:{base:"xs",md:"sm"},children:"Gen Bio"}),g==="genomics"&&o.jsx(m,{fontSize:"2xs",color:"ui.textSecondary",fontStyle:"italic",children:"(req)"})]}),o.jsx(tr.button,{type:"button",onClick:P=>{if(P.preventDefault(),P.stopPropagation(),g==="genomics")return;const G=g==="genbio"?null:"genbio";k==null||k(G)},position:"relative",w:{base:"2rem",md:"2.5rem"},h:{base:"1.1rem",md:"1.35rem"},borderRadius:"full",bg:g==="genbio"||g==="genomics"?"purple.400":"ui.border",transition:"background-color 0.2s",cursor:g==="genomics"?"not-allowed":"pointer",border:"none",outline:"none",_hover:{bg:g==="genomics"?"purple.400":g==="genbio"?"purple.500":"ui.muted"},_focus:{outline:"none"},"aria-label":"Toggle Gen Bio mode",children:o.jsx(m,{position:"absolute",top:{base:"0.1rem",md:"0.15rem"},left:g==="genbio"||g==="genomics"?{base:"1rem",md:"1.25rem"}:{base:"0.1rem",md:"0.15rem"},w:{base:"0.9rem",md:"1.05rem"},h:{base:"0.9rem",md:"1.05rem"},borderRadius:"full",bg:"white",transition:"left 0.2s",boxShadow:"sm"})})]}),o.jsx(N,{fontSize:{base:"2xs",md:"xs"},color:"ui.textSecondary",lineHeight:"1.4",children:"General Biomed leverages knowledge from web search and PubMed to identify relevant biomedical literature and provide evidence-based insights."})]}),o.jsxs(m,{flex:1,p:{base:2,md:3},borderRadius:"md",borderWidth:"1px",borderColor:g==="genomics"?"purple.400":"ui.border",bg:g==="genomics"?"rgba(159,122,234,0.05)":"transparent",transition:"all 0.2s",children:[o.jsxs(m,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:{base:1.5,md:2},children:[o.jsx(m,{fontWeight:"semibold",color:g==="genomics"?"purple.400":"ui.text",fontSize:{base:"xs",md:"sm"},children:"Genomics"}),o.jsx(tr.button,{type:"button",onClick:P=>{P.preventDefault(),P.stopPropagation();const G=g==="genomics"?"genbio":"genomics";k==null||k(G)},position:"relative",w:{base:"2rem",md:"2.5rem"},h:{base:"1.1rem",md:"1.35rem"},borderRadius:"full",bg:g==="genomics"?"purple.400":"ui.border",transition:"background-color 0.2s",cursor:"pointer",border:"none",outline:"none",_hover:{bg:g==="genomics"?"purple.500":"ui.muted"},_focus:{outline:"none"},"aria-label":"Toggle Genomics mode",children:o.jsx(m,{position:"absolute",top:{base:"0.1rem",md:"0.15rem"},left:g==="genomics"?{base:"1rem",md:"1.25rem"}:{base:"0.1rem",md:"0.15rem"},w:{base:"0.9rem",md:"1.05rem"},h:{base:"0.9rem",md:"1.05rem"},borderRadius:"full",bg:"white",transition:"left 0.2s",boxShadow:"sm"})})]}),o.jsx(N,{fontSize:{base:"2xs",md:"xs"},color:"ui.textSecondary",lineHeight:"1.4",children:"Genomics includes everything in General Biomed and additionally leverages NCBI resources, GWAS summary stats, pharmacogenomics databases, and other datasets to provide in-depth genomics-driven answers."})]})]})})]})})]})});function Al(e,t){if(!t||t.length===0)return e;const n=t.filter(r=>r&&typeof r=="string"&&r.trim().length>0);return n.length===0?e:`${e} + ${n.join(" + ")}`}function kb(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Sb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jb={};function Il(e,t){return(jb.jsx?vb:Sb).test(e)}const _b=/[ \t\n\f\r]/g;function Cb(e){return typeof e=="object"?e.type==="text"?Rl(e.value):!1:Rl(e)}function Rl(e){return e.replace(_b,"")===""}class ji{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ji.prototype.normal={};ji.prototype.property={};ji.prototype.space=void 0;function fd(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ji(n,r,t)}function Ds(e){return e.toLowerCase()}class fn{constructor(t,n){this.attribute=n,this.property=t}}fn.prototype.attribute="";fn.prototype.booleanish=!1;fn.prototype.boolean=!1;fn.prototype.commaOrSpaceSeparated=!1;fn.prototype.commaSeparated=!1;fn.prototype.defined=!1;fn.prototype.mustUseProperty=!1;fn.prototype.number=!1;fn.prototype.overloadedBoolean=!1;fn.prototype.property="";fn.prototype.spaceSeparated=!1;fn.prototype.space=void 0;let Eb=0;const Je=Sr(),zt=Sr(),Os=Sr(),ce=Sr(),yt=Sr(),Pr=Sr(),mn=Sr();function Sr(){return 2**++Eb}const Bs=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:zt,commaOrSpaceSeparated:mn,commaSeparated:Pr,number:ce,overloadedBoolean:Os,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),ts=Object.keys(Bs);class Sa extends fn{constructor(t,n,r,i){let s=-1;if(super(t,n),Tl(this,"space",i),typeof r=="number")for(;++s<ts.length;){const a=ts[s];Tl(this,ts[s],(r&Bs[a])===Bs[a])}}}Sa.prototype.defined=!0;function Tl(e,t,n){n&&(e[t]=n)}function Ur(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Sa(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Ds(r)]=r,n[Ds(s.attribute)]=r}return new ji(t,n,e.space)}const hd=Ur({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControl
vendor: 5,434 bytes, line 12
12s:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:yt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:ce,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:yt,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:zt,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function pd(e,t){return t in e?e[t]:t}function md(e,t){return pd(e,t.toLowerCase())}const Ab=Ur({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pr,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:yt,autoFocus:Je,autoPlay:Je,blocking:yt,capture:null,charSet:null,checked:Je,cite:null,className:yt,cols:ce,colSpan:null,content:null,contentEditable:zt,controls:Je,controlsList:yt,coords:ce|Pr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:Os,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:yt,height:ce,hidden:Os,high:ce,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:yt,itemRef:yt,itemScope:Je,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Je,optimum:ce,pattern:null,ping:yt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:yt,required:Je,reversed:Je,rows:ce,rowSpan:ce,sandbox:yt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:zt,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:md}),Ib=Ur({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRen
12dering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:mn,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRen
12dering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pr,g2:Pr,glyphName:Pr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:mn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mn,rev:mn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mn,requiredFeatures:mn,requiredFonts:mn,requiredFormats:mn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:mn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mn,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:pd}),gd=Ur({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}
vendor: 4,081 bytes, lines 12-13
12,space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xd=Ur({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:md}),bd=Ur({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Rb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Tb=/[A-Z]/g,zl=/-[a-z]/g,zb=/^data[-\w.:]+$/i;function Fb(e,t){const n=Ds(t);let r=t,i=fn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(zl,Lb);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!zl.test(s)){let a=s.replace(Tb,Pb);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Sa}return new i(r,t)}function Pb(e){return"-"+e.toLowerCase()}function Lb(e){return e.charAt(1).toUpperCase()}const Mb=fd([hd,Ab,gd,xd,bd],"html"),va=fd([hd,Ib,gd,xd,bd],"svg");function Db(e){return e.join(" ").trim()}var Er={},ns,Fl;function Ob(){if(Fl)return ns;Fl=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=` 13`,u="/",d="*",f="",p="comment",h="declaration";ns=function(k,b){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];b=b||{};var S=1,y=1;function R(I){var $=I.match(t);$&&(S+=$.length);var X=I.lastIndexOf(c);y=~X?I.length-X:y+I.length}function L(){var I={line:S,column:y};return function($){return $.position=new O(I),j(),$}}function O(I){this.start=I,this.end={line:S,column:y},this.source=b.source}O.prototype.content=k;function T(I){var $=new Error(b.source+":"+S+":"+y+": "+I);if($.reason=I,$.filename=b.source,$.line=S,$.column=y,$.source=k,!b.silent)throw $}function Z(I){var $=I.exec(k);if($){var X=$[0];return R(X),k=k.slice(X.length),$}}function j(){Z(n)}function E(I){var $;for(I=I||[];$=w();)$!==!1&&I.push($);return I}function w(){var I=L();if(!(u!=k.charAt(0)||d!=k.charAt(1))){for(var $=2;f!=k.charAt($)&&(d!=k.charAt($)||u!=k.charAt($+1));)++$;if($+=2,f===k.charAt($-1))return T("End of comment missing");var X=k.slice(2,$-2);return y+=2,R(X),k=k.slice($),y+=2,I({type:p,comment:X})}}function M(){var I=L(),$=Z(r);if($){if(w(),!Z(i))return T("property missing ':'");var X=Z(s),xe=I({type:h,property:g($[0].replace(e,f)),value:X?g(X[0].replace(e,f)):f});return Z(a),xe}}function z(){var I=[];E(I);for(var $;$=M();)$!==!1&&(I.push($),E(I));return I}return j(),z()};function g(k){return k?k.replace(l,f):f}return ns}var Pl;function Bb(){if(Pl)return Er;Pl=1;var e=Er&&Er.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Er,"__esModule",{value:!0}),Er.default=n;var t=e(Ob());function n(r,i){var s=null;if(!r||typeof r!="string")return s;var a=(0,t.default)(r),l=typeof i=="function";return a.forEach(function(c){if(c.type==="declaration"){var u=c.property,d=c.value;l?i(u,d,c):d&&(s=s||{},s[u]=d)}}),s}return Er}var Gr={},Ll;function Nb(){if(Ll)return Gr;Ll=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},a=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(i,l):u=u.replace(r,l),u.replace(t,a))};return Gr.camelCase=c,Gr}var Yr,Ml;function $b(){if(Ml)return Yr;Ml=1;var e=Yr&&Yr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Bb()),n=Nb();function r(i,s){var a={};
vendor: 2,733 bytes, line 13
13return!i||typeof i!="string"||(0,t.default)(i,function(l,c){l&&c&&(a[(0,n.camelCase)(l,s)]=c)}),a}return r.default=r,Yr=r,Yr}var Wb=$b();const Ub=xo(Wb),yd=wd("end"),ja=wd("start");function wd(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Hb(e){const t=ja(e),n=yd(e);if(t&&n)return{start:t,end:n}}function ni(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Dl(e.position):"start"in e||"end"in e?Dl(e):"line"in e||"column"in e?Ns(e):""}function Ns(e){return Ol(e&&e.line)+":"+Ol(e&&e.column)}function Dl(e){return Ns(e&&e.start)+"-"+Ns(e&&e.end)}function Ol(e){return e&&typeof e=="number"?e:1}class Zt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=ni(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Zt.prototype.file="";Zt.prototype.name="";Zt.prototype.reason="";Zt.prototype.message="";Zt.prototype.stack="";Zt.prototype.column=void 0;Zt.prototype.line=void 0;Zt.prototype.ancestors=void 0;Zt.prototype.cause=void 0;Zt.prototype.fatal=void 0;Zt.prototype.place=void 0;Zt.prototype.ruleId=void 0;Zt.prototype.source=void 0;const _a={}.hasOwnProperty,qb=new Map,Vb=/[A-Z]/g,Zb=new Set(["table","tbody","thead","tfoot","tr"]),Gb=new Set(["td","th"]),kd="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Yb(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ry(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 8,526 bytes, line 13
13if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ny(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?va:Mb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Sd(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Sd(e,t,n){if(t.type==="element")return Kb(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Jb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Qb(e,t,n);if(t.type==="mdxjsEsm")return Xb(e,t);if(t.type==="root")return ey(e,t,n);if(t.type==="text")return ty(e,t)}function Kb(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=va,e.schema=i),e.ancestors.push(t);const s=jd(e,t.tagName,!1),a=iy(e,t);let l=Ea(e,t);return Zb.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Cb(c):!0})),vd(e,a,s,t),Ca(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Jb(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}fi(e,t.position)}function Xb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fi(e,t.position)}function Qb(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=va,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:jd(e,t.name,!0),a=oy(e,t),l=Ea(e,t);return vd(e,a,s,t),Ca(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function ey(e,t,n){const r={};return Ca(r,Ea(e,t)),e.create(t,e.Fragment,r,n)}function ty(e,t){return t.value}function vd(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ca(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ny(e,t,n){return r;function r(i,s,a,l){const u=Array.isArray(a.children)?n:t;return l?u(s,a,l):u(s,a)}}function ry(e,t){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=ja(r);return t(i,s,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function iy(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&_a.call(t.properties,i)){const s=sy(e,i,t.properties[i]);if(s){const[a,l]=s;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Gb.has(t.tagName)?r=l:n[a]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function oy(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else fi(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else fi(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Ea(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:qb;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=i.get(c)||0;a=c+"-"+u,i.set(c,u+1)}}const l=Sd(e,s,a);l!==void 0&&n.push(l)}return n}function sy(e,t,n){const r=Fb(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?kb(n):Db(n)),r.property==="style"){let i=typeof n=="object"?n:ay(e,String(n));return e.stylePropertyNameCase==="css"&&(i=ly(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Rb[r.property]||r.property:r.attribute,n]}}function ay(e,t){try{return Ub(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Zt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=kd+"#cannot-parse-style-attribute",i}}function jd(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const l=Il(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=a}else r=Il(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return _a.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);fi(e)}function fi(e,t){const n=new Zt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=kd+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ly(e){const t={};let n;for(n in e)_a.call(e,n)&&(t[cy(n)]=e[n]);return t}function cy(e){let t=e.replace(Vb,uy);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function uy(e){return"-"+e.toLowerCase()}const rs={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},dy={};function Aa(e,t){const n=dy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _d(e,r,i)}function _d(e,t,n){if(fy(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Bl(e.children,t,n)}return Array.isArray(e)?Bl(e,t,n):""}function Bl(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=_d(e[i],t,n);return r.join("")}function fy(e){return!!(e&&typeof e=="object")}const Nl=document.createElement("i");function Ia(e){const t="&"+e+";";Nl.innerHTML=t;const n=Nl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gn(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function wn(e,t){return e.length>0?(gn(e,e.length,0,t),e):t}const $l={}.hasOwnProperty;function Cd(e){const t={};let n=-1;for(;++n<e.length;)hy(t,e[n]);return t}function hy(e,t){let n;for(n in t){const i=($l.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){$l.call(i,a)||(i[a]=[]);const l=s[a];py(i[a],Array.isArray(l)?l:l?[l]:[])}}}function py(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);gn(e,0,0,r)}function Ed(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xt=ir(/[A-Za-z]/),Vt=ir(/[\dA-Za-z]/),my=ir(/[#-'*+\--9=?A-Z^-~]/);function ao(e){return e!==null&&(e<32||e===127)}const $s=ir(/\d/),gy=ir(/[\dA-Fa-f]/),xy=ir(/[!-/:-@[-`{-~]/);function Ne(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const Lo=ir(new RegExp("\\p{P}|\\p{S}","u")),br=ir(/\s/);function ir(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Hr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&Vt(e.charCodeAt(n+1))&&Vt(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(a=String.fromCharCode(s,l),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function st(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return it(c)?(e.enter(n),l(c)):t(c)}function l(c){return it(c)&&s++<i?(e.consume(c),l):(e.exit(n),t(c))}}
vendor: 9,774 bytes, line 13
13const by={tokenize:yy};function yy(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),st(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ne(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),a)}}const wy={tokenize:ky},Wl={tokenize:Sy};function ky(e){const t=this,n=[];let r=0,i,s,a;return l;function l(R){if(r<n.length){const L=n[r];return t.containerState=L[1],e.attempt(L[0].continuation,c,u)(R)}return u(R)}function c(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const L=t.events.length;let O=L,T;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){T=t.events[O][1].end;break}S(r);let Z=L;for(;Z<t.events.length;)t.events[Z][1].end={...T},Z++;return gn(t.events,O+1,0,t.events.slice(L)),t.events.length=Z,u(R)}return l(R)}function u(R){if(r===n.length){if(!i)return p(R);if(i.currentConstruct&&i.currentConstruct.concrete)return g(R);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wl,d,f)(R)}function d(R){return i&&y(),S(r),p(R)}function f(R){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(R)}function p(R){return t.containerState={},e.attempt(Wl,h,g)(R)}function h(R){return r++,n.push([t.currentConstruct,t.containerState]),p(R)}function g(R){if(R===null){i&&y(),S(0),e.consume(R);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),k(R)}function k(R){if(R===null){b(e.exit("chunkFlow"),!0),S(0),e.consume(R);return}return Ne(R)?(e.consume(R),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(R),k)}function b(R,L){const O=t.sliceStream(R);if(L&&O.push(null),R.previous=s,s&&(s.next=R),s=R,i.defineSkip(R.start),i.write(O),t.parser.lazy[R.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<a&&(!i.events[T][1].end||i.events[T][1].end.offset>a))return;const Z=t.events.length;let j=Z,E,w;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){if(E){w=t.events[j][1].end;break}E=!0}for(S(r),T=Z;T<t.events.length;)t.events[T][1].end={...w},T++;gn(t.events,j+1,0,t.events.slice(Z)),t.events.length=T}}function S(R){let L=n.length;for(;L-- >R;){const O=n[L];t.containerState=O[1],O[0].exit.call(t,e)}n.length=R}function y(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Sy(e,t,n){return st(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Or(e){if(e===null||xt(e)||br(e))return 1;if(Lo(e))return 2}function Mo(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Ws={name:"attention",resolveAll:vy,tokenize:jy};function vy(e,t){let n=-1,r,i,s,a,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},p={...e[n][1].start};Ul(f,-c),Ul(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=wn(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=wn(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=wn(u,Mo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=wn(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=wn(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,gn(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function jy(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Or(r);let s;return a;function a(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Or(c),f=!d||d===2&&i||n.includes(c),p=!i||i===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(i||!p)),u._close=!!(s===42?p:p&&(d||!f)),t(c)}}function Ul(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _y={name:"autolink",tokenize:Cy};function Cy(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return Xt(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||Vt(h)?(r=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||Vt(h))&&r++<32?(e.consume(h),l):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||ao(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):my(h)?(e.consume(h),u):n(h)}function d(h){return Vt(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||Vt(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const _i={partial:!0,tokenize:Ey};function Ey(e,t,n){return r;function r(s){return it(s)?st(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ne(s)?t(s):n(s)}}const Ad={continuation:{tokenize:Iy},exit:Ry,name:"blockQuote",tokenize:Ay};function Ay(e,t,n){const r=this;return i;function i(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return it(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Iy(e,t,n){const r=this;return i;function i(a){return it(a)?st(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(Ad,t,n)(a)}}function Ry(e){e.exit("blockQuote")}const Id={name:"characterEscape",tokenize:Ty};function Ty(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return xy(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Rd={name:"characterReference",tokenize:zy};function zy(e,t,n){const r=this;let i=0,s,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,a=Vt,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=gy,d):(e.enter("characterReferenceValue"),s=7,a=$s,d(f))}function d(f){if(f===59&&i){const p=e.exit("characterReferenceValue");return a===Vt&&!Ia(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&i++<s?(e.consume(f),d):n(f)}}const Hl={partial:!0,tokenize:Py},ql={concrete:!0,name:"codeFenced",tokenize:Fy};function Fy(e,t,n){const r=this,i={partial:!0,tokenize:O};let s=0,a=0,l;return c;function c(T){return u(T)}function u(T){const Z=r.events[r.events.length-1];return s=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(a++,e.consume(T),d):a<3?n(T):(e.exit("codeFencedFenceSequence"),it(T)?st(e,f,"whitespace")(T):f(T))}function f(T){return T===null||Ne(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Hl,k,L)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||Ne(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):it(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),st(e,h,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),p)}function h(T){return T===null||Ne(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||Ne(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(e.consume(T),g)}function k(T){return e.attempt(i,L,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),S}function S(T){return s>0&&it(T)?st(e,y,"linePrefix",s+1)(T):y(T)}function y(T){return T===null||Ne(T)?e.check(Hl,k,L)(T):(e.enter("co
13deFlowValue"),R(T))}function R(T){return T===null||Ne(T)?(e.exit("codeFlowValue"),y(T)):(e.consume(T),R)}function L(T){return e.exit("codeFenced"),t(T)}function O(T,Z,j){let E=0;return w;function w(X){return T.enter("lineEnding"),T.consume(X),T.exit("lineEnding"),M}function M(X){return T.enter("codeFencedFence"),it(X)?st(T,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):z(X)}function z(X){return X===l?(T.enter("codeFencedFenceSequence"),I(X)):j(X)}function I(X){return X===l?(E++,T.consume(X),I):E>=a?(T.exit("codeFencedFenceSequence"),it(X)?st(T,$,"whitespace")(X):$(X)):j(X)}function $(X){return X===null||Ne(X)?(T.exit("codeFencedFence"),Z(X)):j(X)}}}function Py(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const is={name:"codeIndented",tokenize:My},Ly={partial:!0,tokenize:Dy};function My(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),st(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):Ne(u)?e.attempt(Ly,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ne(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function Dy(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Ne(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):st(e,s,"linePrefix",5)(a)}function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):Ne(a)?i(a):n(a)}}const Oy={name:"codeText",previous:Ny,resolve:By,tokenize:$y};function By(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Ny(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $y(e,t,n){let r=0,i,s;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(s=e.enter("codeTextSequence"),i=0,d(f)):Ne(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ne(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class Wy{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Kr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Kr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Kr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kr(this.left,n.reverse())}}}function Kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Td(e){const t={};let n=-1,r,i,s,a,l,c,u;const d=new Wy(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Uy(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return gn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Uy(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let d,f,p=-1,h=n,g=0,k=0;const b=[k];for(;h;){for(;e.get(++i)[1]!==h;);s.push(i),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&a.defineSki
vendor: 18,587 bytes, line 13
13p(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(k=p+1,b.push(k),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const S=l.slice(b[p],b[p+1]),y=s.pop();c.push([y,y+S.length-1]),e.splice(y,2,S)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const Hy={resolve:Vy,tokenize:Zy},qy={partial:!0,tokenize:Gy};function Vy(e){return Td(e),e}function Zy(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):Ne(l)?e.check(qy,a,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Gy(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),st(e,s,"linePrefix")}function s(a){if(a===null||Ne(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function zd(e,t,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(S){return S===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(S),e.exit(s),p):S===null||S===32||S===41||ao(S)?n(S):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(S))}function p(S){return S===62?(e.enter(s),e.consume(S),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===62?(e.exit("chunkString"),e.exit(l),p(S)):S===null||S===60||Ne(S)?n(S):(e.consume(S),S===92?g:h)}function g(S){return S===60||S===62||S===92?(e.consume(S),h):h(S)}function k(S){return!d&&(S===null||S===41||xt(S))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(S)):d<u&&S===40?(e.consume(S),d++,k):S===41?(e.consume(S),d--,k):S===null||S===32||S===40||ao(S)?n(S):(e.consume(S),S===92?b:k)}function b(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function Fd(e,t,n,r,i,s){const a=this;let l=0,c;return u;function u(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(s),d}function d(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):Ne(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||Ne(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!it(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function Pd(e,t,n,r,i,s){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===a?(e.exit(s),c(a)):p===null?n(p):Ne(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),st(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===a||p===null||Ne(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===a||p===92?(e.consume(p),d):d(p)}}function ri(e,t){let n;return r;function r(i){return Ne(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):it(i)?st(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Yy={name:"definition",tokenize:Jy},Ky={partial:!0,tokenize:Xy};function Jy(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),a(h)}function a(h){return Fd.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return i=jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return xt(h)?ri(e,u)(h):u(h)}function u(h){return zd(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(Ky,f,f)(h)}function f(h){return it(h)?st(e,p,"whitespace")(h):p(h)}function p(h){return h===null||Ne(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function Xy(e,t,n){return r;function r(l){return xt(l)?ri(e,i)(l):n(l)}function i(l){return Pd(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return it(l)?st(e,a,"whitespace")(l):a(l)}function a(l){return l===null||Ne(l)?t(l):n(l)}}const Qy={name:"hardBreakEscape",tokenize:e0};function e0(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ne(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const t0={name:"headingAtx",resolve:n0,tokenize:r0};function n0(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},gn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function r0(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||xt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ne(d)?(e.exit("atxHeading"),t(d)):it(d)?st(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||xt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const i0=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Vl=["pre","script","style","textarea"],o0={concrete:!0,name:"htmlFlow",resolveTo:l0,tokenize:c0},s0={partial:!0,tokenize:d0},a0={partial:!0,tokenize:u0};function l0(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function c0(e,t,n){const r=this;let i,s,a,l,c;return u;function u(v){return d(v)}function d(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),f}function f(v){return v===33?(e.consume(v),p):v===47?(e.consume(v),s=!0,k):v===63?(e.consume(v),i=3,r.interrupt?t:C):Xt(v)?(e.consume(v),a=String.fromCharCode(v),b):n(v)}function p(v){return v===45?(e.consume(v),i=2,h):v===91?(e.consume(v),i=5,l=0,g):Xt(v)?(e.consume(v),i=4,r.interrupt?t:C):n(v)}function h(v){return v===45?(e.consume(v),r.interrupt?t:C):n(v)}function g(v){const ze="CDATA[";return v===ze.charCodeAt(l++)?(e.consume(v),l===ze.length?r.interrupt?t:z:g):n(v)}function k(v){return Xt(v)?(e.consume(v),a=String.fromCharCode(v),b):n(v)}function b(v){if(v===null||v===47||v===62||xt(v)){const ze=v===47,he=a.toLowerCase();return!ze&&!s&&Vl.includes(he)?(i=1,r.interrupt?t(v):z(v)):i0.includes(a.toLowerCase())?(i=6,ze?(e.consume(v),S):r.interrupt?t(v):z(v)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(v):s?y(v):R(v))}return v===45||Vt(v)?(e.consume(v),a+=String.fromCharCode(v),b):n(v)}function S(v){return v===62?(e.consume(v),r.interrupt?t:z):n(v)}function y(v){return it(v)?(e.consume(v),y):w(v)}function R(v){return v===47?(e.consume(v),w):v===58||v===95||Xt(v)?(e.consume(v),L):it(v)?(e.consume(v),R):w(v)}function L(v){return v===45||v===46||v===58||v===95||Vt(v)?(e.consume(v),L):O(v)}function O(v){return v===61?(e.consume(v),T):it(v)?(e.consume(v),O):R(v)}function T(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),c=v,Z):it(v)?(e.consume(v),T):j(v)}function Z(v){return v===c?(e.consume(v),c=null,E):v===null||Ne(v)?n(v):(e.consume(v),Z)}function j(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||xt(v)?O(v):(e.consume(v),j)}function E(v){return v===47||v===62||it(v)?R(v):n(v)}function w(v){return v===62?(e.consume(v),M):n(v)}function M(v){return v===null||Ne(v)?z(v):it(v)?(e.consume(v),M):n(v)}function z(v){return v===45&&i===2?(e.consume(v),xe):v===60&&i===1?(e.consume(v),K):v===62&&i===4?(e.consume(v),ne):v===63&&i===3?(e.consume(v),C):v===93&&i===5?(e.consume(v),ie):Ne(v)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(s0,ue,I)(v)):v===null||Ne(v)?(e.exit("htmlFlowData"),I(v)):(e.consume(v),z)}function I(v){return e.check(a0,$,ue)(v)}function $(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),X}function X(v){return v===null||Ne(v)?I(v):(e.enter("htmlFlowData"),z(v))}function xe(v){return v===45?(e.consume(v),C):z(v)}function K(v){return v===47?(e.consume(v),a="",U):z(v)}function U(v){if(v===62){const ze=a.toLowerCase();return Vl.includes(ze)?(e.consume(v),ne):z(v)}return Xt(v)&&a.length<8?(e.consume(v),a+=String.fromCharCode(v),U):z(v)}function ie(v){return v===93?(e.consume(v),C):z(v)}function C(v){return v===62?(e.consume(v),ne):v===45&&i===2?(e.consume(v),C):z(v)}function ne(v){return v===null||Ne(v)?(e.exit("htmlFlowData"),ue(v)):(e.consume(v),ne)}function ue(v){return e.exit("htmlFlow"),t(v)}}function u0(e,t,n){const r=this;return i;function i(a){return Ne(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function d0(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(_i,t,n)}}const f0={name:"htmlText",tokenize:h0};function h0(e,t,n){const r=this;let i,s,a;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),O):C===63?(e.consume(C),R):Xt(C)?(e.consume(C),j):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),s=0,g):Xt(C)?(e.consume(C),y):n(C)}function d(C){return C===45?(e.consume(C),h):n(C)}function f(C){return C===null?n(C):C===45?(e.consume(C),p):Ne(C)?(a=f,K(C)):(e.consume(C),f)}function p(C){return C===45?(e.consume(C),h):f(C)}function h(C){return C===62?xe(C):C===45?p(C):f(C)}function g(C){const ne="CDATA[";return C===ne.charCodeAt(s++)?(e.consume(C),s===ne.length?k:g):n(C)}function k(C){return C===null?n(C):C===93?(e.consume(C),b):Ne(C)?(a=k,K(C)):(e.consume(C),k)}function b(C){return C===93?(e.consume(C),S):k(C)}function S(C){return C===62?xe(C):C===93?(e.consume(C),S):k(C)}function y(C){return C===null||C===62?xe(C):Ne(C)?(a=y,K(C)):(e.consume(C),y)}function R(C){return C===null?n(C):C===63?(e.consume(C),L):Ne(C)?(a=R,K(C)):(e.consume(C),R)}function L(C){return C===62?xe(C):R(C)}function O(C){return Xt(C)?(e.consume(C),T):n(C)}function T(C){return C===45||Vt(C)?(e.consume(C),T):Z(C)}function Z(C){return Ne(C)?(a=Z,K(C)):it(C)?(e.consume(C),Z):xe(C)}function j(C){return C===45||Vt(C)?(e.consume(C),j):C===47||C===62||xt(C)?E(C):n(C)}function E(C){return C===47?(e.consume(C),xe):C===58||C===95||Xt(C)?(e.consume(C),w):Ne(C)?(a=E,K(C)):it(C)?(e.consume(C),E):xe(C)}function w(C){return C===45||C===46||C===58||C===95||Vt(C)?(e.consume(C),w):M(C)}function M(C){return C===61?(e.consume(C),z):Ne(C)?(a=M,K(C)):it(C)?(e.consume(C),M):E(C)}function z(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,I):Ne(C)?(a=z,K(C)):it(C)?(e.consume(C),z):(e.consume(C),$)}function I(C){return C===i?(e.consume(C),i=void 0,X):C===null?n(C):Ne(C)?(a=I,K(C)):(e.consume(C),I)}function $(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||xt(C)?E(C):(e.consume(C),$)}function X(C){return C===47||C===62||xt(C)?E(C):n(C)}function xe(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function K(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),U}function U(C){return it(C)?st(e,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ie(C)}function ie(C){return e.enter("htmlTextData"),a(C)}}const Ra={name:"labelEnd",resolveAll:x0,resolveTo:b0,tokenize:y0},p0={tokenize:w0},m0={tokenize:k0},g0={tokenize:S0};function x0(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&gn(e,0,e.length,n),e}function b0(e,t){let n=e.length,r=0,i,s,a,l;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=wn(l,e.slice(s+1,s+r+3)),l=wn(l,[["enter",d,t]]),l=wn(l,Mo(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),l=wn(l,[["exit",d,t],e[a-2],e[a-1],["exit",u,t]]),l=wn(l,e.slice(a+1)),l=wn(l,[["exit",c,t]]),gn(e,s,e.length,l),e}function y0(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(p){return s?s._inactive?f(p):(a=r.parser.defined.includes(jn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(p0,d,a?d:f)(p):p===91?e.attempt(m0,d,a?u:f)(p):a?d(p):f(p)}function u(p){return e.attempt(g0,d,f)(p)}function d(p){return t(p)}function f(p){return s._balanced=!0,n(p)}}function w0(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return xt(f)?ri(e,s)(f):s(f)}function s(f){return f===41?d(f):zd(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return xt(f)?ri(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Pd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return xt(f)?ri(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function k0(e,t,n){const r=this;return i;function i(l){return Fd.call(r,e,s,a,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function S0(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const v0={name:"labelStartImage",resolveAll:Ra.resolveAll,tokenize:j0};function j0(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const _0={name:"labelStartLink",resolveAll:Ra.resolveAll,tokenize:C0};function C0(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const os={name:"lineEnding",tokenize:E0};function E0(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),st(e,t,"linePrefix")}}const Zi={name:"thematicBreak",tokenize:A0};function A0(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,l(u)}function l(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ne(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),it(u)?st(e,l,"whitespace")(u):l(u))}}const on={continuation:{tokenize:z0},exit:P0,name:"list",tokenize:T0},I0={partial:!0,tokenize:L0},R0={partial:!0,tokenize:F0};function T0(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:$s(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Zi,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return $s(h)&&++a<10?(e.consume(h),c):(!r.interrupt||a<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(_i,r.interrupt?n:d,e.attempt(I0,p,f))}
vendor: 5,359 bytes, line 13
13function d(h){return r.containerState.initialBlankLine=!0,s++,p(h)}function f(h){return it(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function z0(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_i,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,st(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!it(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(R0,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,st(e,e.attempt(on,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function F0(e,t,n){const r=this;return st(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function P0(e){e.exit(this.containerState.type)}function L0(e,t,n){const r=this;return st(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!it(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Zl={name:"setextUnderline",resolveTo:M0,tokenize:D0};function M0(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function D0(e,t,n){const r=this;let i;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),it(u)?st(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ne(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const O0={tokenize:B0};function B0(e){const t=this,n=e.attempt(_i,r,e.attempt(this.parser.constructs.flowInitial,i,st(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Hy,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const N0={resolveAll:Md()},$0=Ld("string"),W0=Ld("text");function Ld(e){return{resolveAll:Md(e==="text"?U0:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,l);return a;function a(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Md(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function U0(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,a=-1,l=0,c;for(;s--;){const u=i[s];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const H0={42:on,43:on,45:on,48:on,49:on,50:on,51:on,52:on,53:on,54:on,55:on,56:on,57:on,62:Ad},q0={91:Yy},V0={[-2]:is,[-1]:is,32:is},Z0={35:t0,42:Zi,45:[Zl,Zi],60:o0,61:Zl,95:Zi,96:ql,126:ql},G0={38:Rd,92:Id},Y0={[-5]:os,[-4]:os,[-3]:os,33:v0,38:Rd,42:Ws,60:[_y,f0],91:_0,92:[Qy,Id],93:Ra,95:Ws,96:Oy},K0={null:[Ws,N0]},J0={null:[42,95]},X0={null:[]},Q0=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:J0,contentInitial:q0,disable:X0,document:H0,flow:Z0,flowInitial:V0,insideSpan:K0,string:G0,text:Y0},Symbol.toStringTag,{value:"Module"}));function e1(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,c
vendor: 19,106 bytes, lines 13-19
13olumn:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],l=[];const c={attempt:Z(O),check:Z(T),consume:y,enter:R,exit:L,interrupt:Z(T,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function f(M){return a=wn(a,M),b(),a[a.length-1]!==null?[]:(j(t,0),u.events=Mo(s,u.events,u),u.events)}function p(M,z){return n1(h(M),z)}function h(M){return t1(a,M)}function g(){const{_bufferIndex:M,_index:z,line:I,column:$,offset:X}=r;return{_bufferIndex:M,_index:z,line:I,column:$,offset:X}}function k(M){i[M.line]=M.column,w()}function b(){let M;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<z.length;)S(z.charCodeAt(r._bufferIndex));else S(z)}}function S(M){d=d(M)}function y(M){Ne(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,w()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function R(M,z){const I=z||{};return I.type=M,I.start=g(),u.events.push(["enter",I,u]),l.push(I),I}function L(M){const z=l.pop();return z.end=g(),u.events.push(["exit",z,u]),z}function O(M,z){j(M,z.from)}function T(M,z){z.restore()}function Z(M,z){return I;function I($,X,xe){let K,U,ie,C;return Array.isArray($)?ue($):"tokenize"in $?ue([$]):ne($);function ne(Pe){return et;function et(Se){const Ie=Se!==null&&Pe[Se],Ve=Se!==null&&Pe.null,ve=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(Ve)?Ve:Ve?[Ve]:[]];return ue(ve)(Se)}}function ue(Pe){return K=Pe,U=0,Pe.length===0?xe:v(Pe[U])}function v(Pe){return et;function et(Se){return C=E(),ie=Pe,Pe.partial||(u.currentConstruct=Pe),Pe.name&&u.parser.constructs.disable.null.includes(Pe.name)?he():Pe.tokenize.call(z?Object.assign(Object.create(u),z):u,c,ze,he)(Se)}}function ze(Pe){return M(ie,C),X}function he(Pe){return C.restore(),++U<K.length?v(K[U]):xe}}}function j(M,z){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&gn(u.events,z,u.events.length-z,M.resolve(u.events.slice(z),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function E(){const M=g(),z=u.previous,I=u.currentConstruct,$=u.events.length,X=Array.from(l);return{from:$,restore:xe};function xe(){r=M,u.previous=z,u.currentConstruct=I,u.events.length=$,l=X,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function t1(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function n1(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=` 14`;break}case-3:{a=`\r 15`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function r1(e){const r={constructs:Cd([Q0,...(e||{}).extensions||[]]),content:i(by),defined:[],document:i(wy),flow:i(O0),lazy:{},string:i($0),text:i(W0)};return r;function i(s){return a;function a(l){return e1(r,s,l)}}}function i1(e){for(;!Td(e););return e}const Gl=/[\0\t\n\r]/g;function o1(){let e=1,t="",n=!0,r;return i;function i(s,a,l){const c=[];let u,d,f,p,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Gl.lastIndex=f,u=Gl.exec(s),p=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(p),!u){t=s.slice(f);break}if(h===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(s.slice(f,p)),e+=p-f),h){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const s1=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function a1(e){return e.replace(s1,l1)}function l1(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Ed(n.slice(s?2:1),s?16:10)}return Ia(n)||e}const Dd={}.hasOwnProperty;function c1(e,t,n){return typeof t!="string"&&(n=t,t=void 0),u1(n)(i1(r1(n).document().write(o1()(e,t,!0))))}function u1(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(A),autolinkProtocol:E,autolinkEmail:E,atxHeading:s(Ee),blockQuote:s(Ve),characterEscape:E,characterReference:E,codeFenced:s(ve),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(ve,a),codeText:s(Ae,a),codeTextData:E,data:E,codeFlowValue:E,definition:s(je),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(Ce),hardBreakEscape:s(De),hardBreakTrailing:s(De),htmlFlow:s(pt,a),htmlFlowData:E,htmlText:s(pt,a),htmlTextData:E,image:s(Fe),label:a,link:s(A),listItem:s(H),listItemValue:p,listOrdered:s(W,f),listUnordered:s(W),paragraph:s(se),reference:v,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Ee),strong:s(re),thematicBreak:s(me)},exit:{atxHeading:c(),atxHeadingSequence:O,autolink:c(),autolinkEmail:Ie,autolinkProtocol:Se,blockQuote:c(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:Pe,characterReference:et,codeFenced:c(b),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:w,codeIndented:c(S),codeText:c(X),codeTextData:w,data:w,definition:c(),definitionDestinationString:L,definitionLabelString:y,definitionTitleString:R,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(I),htmlFlowData:w,htmlText:c($),htmlTextData:w,image:c(K),label:ie,labelText:U,lineEnding:M,link:c(xe),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ze,resourceDestinationString:C,resourceTitleString:ne,resource:ue,setextHeading:c(j),setextHeadingLineSequence:Z,setextHeadingText:T,strong:c(),thematicBreak:c()}};Od(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let q={type:"root",children:[]};const fe={stack:[q],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:d,data:n},ke=[];let $e=-1;for(;++$e<D.length;)if(D[$e][1].type==="listOrdered"||D[$e][1].type==="listUnordered")if(D[$e][0]==="enter")ke.push($e);else{const Ke=ke.pop();$e=i(D,Ke,$e)}for($e=-1;++$e<D.length;){const Ke=t[D[$e][0]];Dd.call(Ke,D[$e][1].type)&&Ke[D[$e][1].type].call(Object.assign({sliceSerialize:D[$e][2].sliceSerialize},fe),D[$e][1])}if(fe.tokenStack.length>0){const Ke=fe.tokenStack[fe.tokenStack.length-1];(Ke[1]||Yl).call(fe,void 0,Ke[0])}for(q.position={start:Kn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Kn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)q=t.transforms[$e](q)||q;return q}function i(D,q,fe){let ke=q-1,$e=-1,Ke=!1,nt,at,vt,Et;for(;++ke<=fe;){const ht=D[ke];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?$e++:$e--,Et=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(nt&&!Et&&!$e&&!vt&&(vt=ke),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!$e&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||$e===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(nt){let Ze=ke;for(at=void 0;Ze--;){const Xe=D[Ze];if(Xe[1].type==="lineEnding"||Xe[1].type==="lineEndingBlank"){if(Xe[0]==="exit")continue;at&&(D[at][1].type="lineEndingBlank",Ke=!0),Xe[1].type="lineEnding",at=Ze}else if(!(Xe[1].type==="linePrefix"||Xe[1].type==="blockQuotePrefix"||Xe[1].type==="blockQuotePrefixWhitespace"||Xe[1].type==="blockQuoteMarker"||Xe[1].type==="listItemIndent"))break}vt&&(!at||vt<at)&&(nt._spread=!0),nt.end=Object.assign({},at?D[at][1].start:ht[1].end),D.splice(at||ke,0,["exit",nt,ht[2]]),ke++,fe++}if(ht[1].type==="listItemPrefix"){const Ze={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};nt=Ze,D.splice(ke,0,["enter",Ze,ht[2]]),ke++,fe++,vt=void 0,Et=!0}}}return D[q][1]._spread=Ke,fe}function s(D,q){return fe;function fe(ke){l.call(this,D(ke),ke),q&&q.call(this,ke)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(D,q,fe){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([q,fe||void 0]),D.position={start:Kn(q.start),end:void 0}}function c(D){return q;function q(fe){D&&D.call(this,fe),u.call(this,fe)}}function u(D,q){const fe=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==D.type&&(q?q.call(this,D,ke[0]):(ke[1]||Yl).call(this,D,ke[0]));else throw new Error("Cannot close `"+D.type+"` ("+ni({start:D.start,end:D.end})+"): itâs not open");fe.position.end=Kn(D.end)}function d(){return Aa(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(D){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function h(){const D=this.resume(),q=this.stack[this.stack.length-1];q.lang=D}function g(){const D=this.resume(),q=this.stack[this.stack.length-1];q.meta=D}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/(\r?\n|\r)$/g,"")}function y(D){const q=this.resume(),fe=this.stack[this.stack.length-1];fe.label=q,fe.identifier=jn(this.sliceSerialize(D)).toLowerCase()}function R(){const D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function L(){const D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function O(D){const q=this.stack[this.stack.length-1];if(!q.depth){const fe=this.sliceSerialize(D).length;q.depth=fe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function Z(D){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function E(D){const fe=this.stack[this.stack.length-1].children;let ke=fe[fe.length-1];(!ke||ke.type!=="text")&&(ke=Q(),ke.position={start:Kn(D.start),end:void 0},fe.push(ke)),this.stack.push(ke)}function w(D){const q=this.stack.pop();q.value+=this.sliceSerialize(D),q.position.end=Kn(D.end)}function M(D){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=q.children[q.children.length-1];fe.position.end=Kn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(E.call(this,D),w.call(this,D))}function z(){this.data.atHardBreak=!0}function I(){const D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function $(){const D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function X(){const D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function xe(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function K(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function U(D){const q=this.sliceSerialize(D),fe=this.stack[this.stack.length-2];fe.label=a1(q),fe.identifier=jn(q).toLowerCase()}function ie(){const D=this.stack[this.stack.length-1],q=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ke=D.children;fe.children=ke}else fe.alt=q}function C(){const D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function ne(){const D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function ue(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function ze(D){const q=this.resume(),fe=this.stack[this.stack.length-1];fe.label=q,fe.identifier=jn(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function he(D){this.data.characterReferenceType=D.type}function Pe(D){const q=this.sliceSerialize(D),fe=this.data.characterReferenceType;let ke;fe?(ke=Ed(q,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Ia(q);const $e=this.stack[this.stack.length-1];$e.value+=ke}function et(D){const q=this.stack.pop();q.position.end=Kn(D.end)}function Se(D){w.call(this,D);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(D)}function Ie(D){w.call(this,D);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(D)}function Ve(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function Ae(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function Ee(){return{type:"heading",depth:0,children:[]}}function De(){return{type:"break"}}function pt(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function A(){return{type:"link",title:null,url:"",children:[]}}function W(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function H(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function se(){return{type:"paragraph",children:[]}}function re(){return{type:"strong",children:[]}}function Q(){return{type:"text",value:""}}function me(){return{type:"thematicBreak"}}}function Kn(e){return{line:e.line,column:e.column,offset:e.offset}}function Od(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Od(e,r):d1(e,r)}}function d1(e,t){let n;for(n in t)if(Dd.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Yl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ni({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ni({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ni({start:t.start,end:t.end})+") is still open")}function f1(e){const t=this;t.parser=n;function n(r){return c1(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function h1(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function p1(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:` 16`}]}function m1(e,t){const n=t.value?t.value+` 17`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function g1(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x1(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b1(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Hr(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function y1(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w1(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Bd(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function k1(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Bd(e,t);const i={src:Hr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function S1(e,t){const n={src:Hr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function v1(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function j1(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Bd(e,t);const i={href:Hr(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function _1(e,t){const n={href:Hr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function C1(e,t,n){const r=e.all(t),i=n?E1(n):Nd(t),s={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:` 18`}),d.type==="element"&&d.tagName==="p"&&!i?a.push(...d.children):a.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:` 19`});const u={type:"element",tagName:"li",properties:s,children:a};
vendor: 4,561 bytes, line 19
19return e.patch(t,u),e.applyData(t,u)}function E1(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Nd(n[r])}return t}function Nd(e){const t=e.spread;return t??e.children.length>1}function A1(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function I1(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R1(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function T1(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function z1(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ja(t.children[1]),c=yd(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function F1(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],p={},h=a?a[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:s,properties:p,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function P1(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Kl=9,Jl=32;function L1(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Xl(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Xl(t.slice(i),i>0,!1)),s.join("")}function Xl(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Kl||s===Jl;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Kl||s===Jl;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function M1(e,t){const n={type:"text",value:L1(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function D1(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const O1={blockquote:h1,break:p1,code:m1,delete:g1,emphasis:x1,footnoteReference:b1,heading:y1,html:w1,imageReference:k1,image:S1,inlineCode:v1,linkReference:j1,link:_1,listItem:C1,list:A1,paragraph:I1,root:R1,strong:T1,table:z1,tableCell:P1,tableRow:F1,text:M1,thematicBreak:D1,toml:zi,yaml:zi,definition:zi,footnoteDefinition:zi};function zi(){}const $d=-1,Do=0,ii=1,lo=2,Ta=3,za=4,Fa=5,Pa=6,Wd=7,Ud=8,Ql=typeof self=="object"?self:globalThis,B1=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Do:case $d:return n(a,i);case ii:{const l=n([],i);for(const c of a)l.push(r(c));return l}case lo:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case Ta:return n(new Date(a),i);case za:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case Fa:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case Pa:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Wd:{const{name:l,message:c}=a;return n(new Ql[l](c),i)}case Ud:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new Ql[s](a),i)};return r},ec=e=>B1(new Map,e)(0),Ar="",{toString:N1}={},{keys:$1}=Object,Jr=e=>{const t=typeof e;if(t!=="object"||!e)return[Do,t];const n=N1.call(e).slice(8,-1);switch(n){case"Array":return[ii,Ar];case"Object":return[lo,Ar];case"Date":return[Ta,Ar];case"RegExp":return[za,Ar];case"Map":return[Fa,Ar];case"Set":return[Pa,Ar];case"DataView":return[ii,n]}return n.includes("Array")?[ii,n]:n.includes("Error")?[Wd,n]:[lo,n]},Fi=([e,t])=>e===Do&&(t==="function"||t==="symbol"),W1=(e,t,n,r)=>{const i=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},s=a=>
vendor: 5,451 bytes, lines 19-21
19{if(n.has(a))return n.get(a);let[l,c]=Jr(a);switch(l){case Do:{let d=a;switch(c){case"bigint":l=Ud,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([$d],a)}return i([l,d],a)}case ii:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),i([c,[...p]],a)}const d=[],f=i([l,d],a);for(const p of a)d.push(s(p));return f}case lo:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([l,d],a);for(const p of $1(a))(e||!Fi(Jr(a[p])))&&d.push([s(p),s(a[p])]);return f}case Ta:return i([l,a.toISOString()],a);case za:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case Fa:{const d=[],f=i([l,d],a);for(const[p,h]of a)(e||!(Fi(Jr(p))||Fi(Jr(h))))&&d.push([s(p),s(h)]);return f}case Pa:{const d=[],f=i([l,d],a);for(const p of a)(e||!Fi(Jr(p)))&&d.push(s(p));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},tc=(e,{json:t,lossy:n}={})=>{const r=[];return W1(!(t||n),!!t,new Map,r)(e),r},co=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ec(tc(e,t)):structuredClone(e):(e,t)=>ec(tc(e,t));function U1(e,t){const n=[{type:"text",value:"â©"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function H1(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function q1(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||U1,r=e.options.footnoteBackLabel||H1,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),p=Hr(f.toLowerCase());let h=0;const g=[],k=e.footnoteCounts.get(f);for(;k!==void 0&&++h<=k;){g.length>0&&g.push({type:"text",value:" "});let y=typeof n=="string"?n:n(c,h);typeof y=="string"&&(y={type:"text",value:y}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const y=b.children[b.children.length-1];y&&y.type==="text"?y.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,S),l.push(S)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...co(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` 20`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` 21`}]}}const Oo=(function(e){if(e==null)return Y1;if(typeof e=="function")return Bo(e);if(typeof e=="object")return Array.isArray(e)?V1(e):Z1(e);if(typeof e=="string")return G1(e);throw new Error("Expected function, string, or object as test")});function V1(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Oo(e[n]);return Bo(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function Z1(e){const t=e;return Bo(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function G1(e){return Bo(t);function t(n){return n&&n.type===e}}function Bo(e){return t;function t(n,r,i){return!!(K1(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Y1(){return!0}function K1(e){return e!==null&&typeof e=="object"&&"type"in e}const Hd=[],J1=!0,Us=!1,X1="skip";function qd(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Oo(i),a=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=Hd,g,k,b;if((!t||s(c,u,d[d.length-1]||void 0))&&(h=Q1(n(c,d)),h[0]===Us))return h;if("children"in c&&c.children){const S=c;if(S.children&&h[0]!==X1)for(k=(r?S.children.length:-1)+a,b=d.concat(S);k>-1&&k<S.children.length;){const y=S.children[k];if(g=l(y,k,b)(),g[0]===Us)return g;k=typeof g[1]=="number"?g[1]:k+a}}return h}}}function Q1(e){return Array.isArray(e)?e:typeof e=="number"?[J1,e]:e==null?Hd:[e]}function La(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),qd(e,s,l,i);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return a(c,f,d)}}const Hs={}.hasOwnProperty,ew={};function tw(e,t){const n=t||ew,r=new Map,i=new Map,s=new Map,a={...O1,...n.handlers},l={all:u,applyData:rw,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:c,options:n,patch:nw,wrap:ow};return La(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:i,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),l;function c(d,f){const p=d.type,h=l.handlers[p];if(Hs.call(l.handlers,p)&&h)return h(l,d,f);
vendor: 13,009 bytes, lines 21-25
21if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in d){const{children:k,...b}=d,S=co(b);return S.children=l.all(d),S}return co(d)}return(l.options.unknownHandler||iw)(l,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const g=l.one(p[h],d);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=nc(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=nc(k.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function nw(e,t){e.position&&(t.position=Hb(e))}function rw(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,co(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function iw(e,t){const n=t.data||{},r="value"in t&&!(Hs.call(n,"hProperties")||Hs.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ow(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:` 22`});++r<e.length;)r&&n.push({type:"text",value:` 23`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:` 24`}),n}function nc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function rc(e,t){const n=tw(e,t),r=n.one(e,void 0),i=q1(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` 25`},i),s}function sw(e,t){return e&&"run"in e?async function(n,r){const i=rc(n,{file:r,...t});await e.run(i,r)}:function(n,r){return rc(n,{file:r,...e||t})}}function ic(e){if(e)throw e}var ss,oc;function aw(){if(oc)return ss;oc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},a=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return ss=function c(){var u,d,f,p,h,g,k=arguments[0],b=1,S=arguments.length,y=!1;for(typeof k=="boolean"&&(y=k,k=arguments[1]||{},b=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});b<S;++b)if(u=arguments[b],u!=null)for(d in u)f=l(k,d),p=l(u,d),k!==p&&(y&&p&&(s(p)||(h=i(p)))?(h?(h=!1,g=f&&i(f)?f:[]):g=f&&s(f)?f:{},a(k,{name:d,newValue:c(y,g,p)})):typeof p<"u"&&a(k,{name:d,newValue:p}));return k},ss}var lw=aw();const as=xo(lw);function qs(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function cw(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...i);function l(c,...u){const d=e[++s];let f=-1;if(c){a(c);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,d?uw(d,l)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function uw(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(a,...l){n||(n=!0,t(a,...l))}function s(a){i(null,a)}}const In={basename:dw,dirname:fw,extname:hw,join:pw,sep:"/"};function dw(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ci(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function fw(e){if(Ci(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function hw(e){Ci(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function pw(...e){let t=-1,n;for(;++t<e.length;)Ci(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":mw(n)}function mw(e){Ci(e);const t=e.codePointAt(0)===47;let n=gw(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gw(e,t){let n="",r=0,i=-1,s=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else l===46&&s>-1?s++:s=-1}return n}function Ci(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const xw={cwd:bw};function bw(){return"/"}function Vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function yw(e){if(typeof e=="string")e=new URL(e);else if(!Vs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return ww(e)}function ww(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const ls=["history","path","basename","stem","extname","dirname"];class Vd{constructor(t){let n;t?Vs(t)?n={path:t}:typeof t=="string"||kw(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":xw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ls.length;){const s=ls[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)ls.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?In.basename(this.path):void 0}set basename(t){us(t,"basename"),cs(t,"basename"),this.path=In.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?In.dirname(this.path):void 0}set dirname(t){sc(this.basename,"dirname"),this.path=In.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?In.extname(this.path):void 0}set extname(t){if(cs(t,"extname"),sc(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=In.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Vs(t)&&(t=yw(t)),us(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?In.basename(this.path,this.extname):void 0}set stem(t){us(t,"stem"),cs(t,"stem"),this.path=In.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Zt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function cs(e,t){if(e&&e.includes(In.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+In.sep+"`")}function us(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kw(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Sw=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),vw={}.hasOwnProperty;class Ma extends Sw{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=cw()}copy(){const t=new Ma;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(as(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(hs("data",this.frozen),this.namespace[t]=n,this):vw.call(this.namespace,t)&&this.namespace[t]||void 0:t?(hs("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Pi(t),r=this.parser||this.Parser;return ds("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ds("process",this.parser||this.Parser),fs("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const l=Pi(t),c=r.parse(l);r.run(c,l,function(d,f,p){if(d||!f||!p)return u(d);const h=f,g=r.stringify(h,p);Cw(g)?p.value=g:p.result=g,u(d,p)});function u(d,f){d||!f?a(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),ds("processSync",this.parser||this.Parser),fs("processSync",this.compiler||this.Compiler),this.process(t,i),lc("processSync","process",n),r;function i(s,a){n=!0,ic(s),r=a}}run(t,n,r){ac(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,l){const c=Pi(n);i.run(t,c,u);function u(d,f,p){const h=f||t;d?l(d):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),lc("runSync","run",r),i;function s(a,l){ic(a),i=l,r=!0}}stringify(t,n){this.freeze();const r=Pi(n),i=this.compiler||this.Compiler;return fs("stringify",i),ac(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(hs("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(i.settings=as(!0,i.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const k=r[p][1];qs(k)&&qs(h)&&(h=as(!0,k,h)),r[p]=[u,h,...g]}}}}const jw=new Ma().freeze();function ds(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function hs(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}
vendor: 5,827 bytes, line 25
25function ac(e){if(!qs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pi(e){return _w(e)?e:new Vd(e)}function _w(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Cw(e){return typeof e=="string"||Ew(e)}function Ew(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Aw="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",cc=[],uc={allowDangerousHtml:!0},Iw=/^(https?|ircs?|mailto|xmpp)$/i,Rw=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Tw(e){const t=zw(e),n=Fw(e);return Pw(t.runSync(t.parse(n),n),e)}function zw(e){const t=e.rehypePlugins||cc,n=e.remarkPlugins||cc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...uc}:uc;return jw().use(f1).use(n).use(sw,r).use(t)}function Fw(e){const t=e.children||"",n=new Vd;return typeof t=="string"&&(n.value=t),n}function Pw(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Lw;for(const d of Rw)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Aw+d.id,void 0);return La(e,u),Yb(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return a?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in rs)if(Object.hasOwn(rs,h)&&Object.hasOwn(d.properties,h)){const g=d.properties[h],k=rs[h];(k===null||k.includes(d.tagName))&&(d.properties[h]=c(String(g||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return l&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function Lw(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Iw.test(e.slice(0,t))?e:""}function dc(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Mw(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Dw(e,t,n){const i=Oo((n||{}).ignore||[]),s=Ow(t);let a=-1;for(;++a<s.length;)qd(e,"text",l);function l(u,d){let f=-1,p;for(;++f<d.length;){const h=d[f],g=p?p.children:void 0;if(i(h,g?g.indexOf(h):void 0,p))return;p=h}if(p)return c(u,d)}function c(u,d){const f=d[d.length-1],p=s[a][0],h=s[a][1];let g=0;const b=f.children.indexOf(u);let S=!1,y=[];p.lastIndex=0;let R=p.exec(u.value);for(;R;){const L=R.index,O={index:R.index,input:R.input,stack:[...d,u]};let T=h(...R,O);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?p.lastIndex=L+1:(g!==L&&y.push({type:"text",value:u.value.slice(g,L)}),Array.isArray(T)?y.push(...T):T&&y.push(T),g=L+R[0].length,S=!0),!p.global)break;R=p.exec(u.value)}return S?(g<u.value.length&&y.push({type:"text",value:u.value.slice(g)}),f.children.splice(b,1,...y)):y=[u],b+y.length}}function Ow(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Bw(i[0]),Nw(i[1])])}return t}function Bw(e){return typeof e=="string"?new RegExp(Mw(e),"g"):e}function Nw(e){return typeof e=="function"?e:function(){return e}}const ps="phrasing",ms=["autolink","link","image","label"];function $w(){return{transforms:[Gw],enter:{literalAutolink:Uw,literalAutolinkEmail:gs,literalAutolinkHttp:gs,literalAutolinkWww:gs},exit:{literalAutolink:Zw,literalAutolinkEmail:Vw,literalAutolinkHttp:Hw,literalAutolinkWww:qw}}}function Ww(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ps,notInConstruct:ms},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ps,notInConstruct:ms},{character:":",before:"[ps]",after:"\\/",inConstruct:ps,notInConstruct:ms}]}}function Uw(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function gs(e){this.config.enter.autolinkProtocol.call(this,e)}function Hw(e){this.config.exit.autolinkProtocol.call(this,e)}function qw(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Vw(e){this.config.exit.autolinkEmail.call(this,e)}function Zw(e){this.exit(e)}function Gw(e){Dw(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Yw],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S}
25)([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Kw]],{ignore:["link","linkReference"]})}function Yw(e,t,n,r,i){let s="";if(!Zd(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Jw(n)))return!1;const a=Xw(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function Kw(e,t,n,r){return!Zd(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Jw(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Xw(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=dc(e,"(");let s=dc(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Zd(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||br(n)||Lo(n))&&(!t||n!==47)}Gd.peek=ak;function Qw(){this.buffer()}function ek(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tk(){this.buffer()}function nk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rk(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ik(e){this.exit(e)}function ok(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sk(e){this.exit(e)}function ak(){return"["}function Gd(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),a(),s+=i.move("]"),s}function lk(){return{enter:{gfmFootnoteCallString:Qw,gfmFootnoteCall:ek,gfmFootnoteDefinitionLabelString:tk,gfmFootnoteDefinition:nk},exit:{gfmFootnoteCallString:rk,gfmFootnoteCall:ik,gfmFootnoteDefinitionLabelString:ok,gfmFootnoteDefinition:sk}}}function ck(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Gd},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const l=s.createTracker(a);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` 26`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?Yd:uk))),u(),c}}function uk(e,t,n){return t===0?e:Yd(e,t,n)}function Yd(e,t,n){return(n?"":" ")+e}const dk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Kd.peek=gk;function fk(){return{canContainEols:["delete"],enter:{strikethrough:pk},exit:{strikethrough:mk}}}function hk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:dk}],handlers:{delete:Kd}}}function pk(e){this.enter({type:"delete",children:[]},e)}function mk(e){this.exit(e)}function Kd(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function gk(){return"~"}function xk(e){return e.length}function bk(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||xk,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const k=[],b=[];let S=-1;for(e[d].length>u&&(u=e[d].length);++S<e[d].length;){const y=yk(e[d][S]);if(n.alignDelimiters!==!1){const R=i(y);b[S]=R,(c[S]===void 0||R>c[S])&&(c[S]=R)}k.push(y)}a[d]=k,l[d]=b}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=fc(r[f]);
vendor: 7,898 bytes, lines 26-38
26else{const k=fc(r);for(;++f<u;)s[f]=k}f=-1;const p=[],h=[];for(;++f<u;){const k=s[f];let b="",S="";k===99?(b=":",S=":"):k===108?b=":":k===114&&(S=":");let y=n.alignDelimiters===!1?1:Math.max(1,c[f]-b.length-S.length);const R=b+"-".repeat(y)+S;n.alignDelimiters!==!1&&(y=b.length+y+S.length,y>c[f]&&(c[f]=y),h[f]=y),p[f]=R}a.splice(1,0,p),l.splice(1,0,h),d=-1;const g=[];for(;++d<a.length;){const k=a[d],b=l[d];f=-1;const S=[];for(;++f<u;){const y=k[f]||"";let R="",L="";if(n.alignDelimiters!==!1){const O=c[f]-(b[f]||0),T=s[f];T===114?R=" ".repeat(O):T===99?O%2?(R=" ".repeat(O/2+.5),L=" ".repeat(O/2-.5)):(R=" ".repeat(O/2),L=R):L=" ".repeat(O)}n.delimiterStart!==!1&&!f&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||f)&&S.push(" "),n.alignDelimiters!==!1&&S.push(R),S.push(y),n.alignDelimiters!==!1&&S.push(L),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&S.push("|")}g.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return g.join(` 27`)}function yk(e){return e==null?"":String(e)}function fc(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function wk(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),kk);return i(),a}function kk(e,t,n){return">"+(n?"":" ")+e}function Sk(e,t){return hc(e,t.inConstruct,!0)&&!hc(e,t.notInConstruct,!1)}function hc(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function pc(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===` 28`&&Sk(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\ 29`}function vk(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function jk(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function _k(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Ck(e,t,n,r){const i=_k(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(jk(e,n)){const f=n.enter("codeIndented"),p=n.indentLines(s,Ek);return f(),p}const l=n.createTracker(r),c=i.repeat(Math.max(vk(s,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` 30`,encode:["`"],...l.current()})),f()}return d+=l.move(` 31`),s&&(d+=l.move(s+` 32`)),d+=l.move(c),u(),d}function Ek(e,t,n){return(n?"":" ")+e}function Da(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ak(e,t,n,r){const i=Da(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` 33`,...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Ik(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function hi(e){return"&#x"+e.toString(16).toUpperCase()+";"}function uo(e,t,n){const r=Or(e),i=Or(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Jd.peek=Rk;function Jd(e,t,n,r){const i=Ik(n),s=n.enter("emphasis"),a=n.createTracker(r),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=uo(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=hi(u)+c.slice(1));const f=c.charCodeAt(c.length-1),p=uo(r.after.charCodeAt(0),f,i);p.inside&&(c=c.slice(0,-1)+hi(f));const h=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+h}function Rk(e,t,n){return n.options.emphasis||"*"}function Tk(e,t){let n=!1;return La(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Us}),!!((!e.depth||e.depth<3)&&Aa(e)&&(t.options.setext||n))}function zk(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Tk(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),p=n.containerPhrasing(e,{...s.current(),before:` 34`,after:` 35`});return f(),d(),p+` 36`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(` 37`))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");s.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` 38`,...s.current()});return/^[\t ]/.test(u)&&(u=hi(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Xd.peek=Fk;function Xd(e){return e.value||""}function Fk(){return"<"}Qd.peek=Pk;function Qd(e,t,n,r){const i=Da(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function Pk(){return"!"}ef.peek=Lk;function ef(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Lk(){return"!"}tf.peek=Mk;function tf(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return i+r+i}function Mk(){return"`"}function nf(e,t){const n=Aa(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}rf.peek=Dk;function rf(e,t,n,r){const i=Da(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(nf(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">
38"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function Dk(e,t,n){return nf(e,n)?"<":"["}of.peek=Ok;function of(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Ok(){return"["}function Oa(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Bk(e){const t=Oa(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Nk(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function sf(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function $k(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?Nk(n):Oa(n);const l=e.ordered?a==="."?")":".":Bk(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),sf(n)===a&&d){let f=-1;for(;++f<e.children.length;){const p=e.children[f];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),u}function Wk(e){const t=e.options.listItemIndent||"one";
vendor: 6,574 bytes, lines 38-40
38if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Uk(e,t,n,r){const i=Wk(n);let s=n.bulletCurrent||Oa(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(a-s.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,p,h){return p?(h?"":" ".repeat(a))+f:(h?s:s+" ".repeat(a-s.length))+f}}function Hk(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const qk=Oo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Vk(e,t,n,r){return(e.children.some(function(a){return qk(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Zk(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}af.peek=Gk;function af(e,t,n,r){const i=Zk(n),s=n.enter("strong"),a=n.createTracker(r),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=uo(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=hi(u)+c.slice(1));const f=c.charCodeAt(c.length-1),p=uo(r.after.charCodeAt(0),f,i);p.inside&&(c=c.slice(0,-1)+hi(f));const h=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},l+c+h}function Gk(e,t,n){return n.options.strong||"*"}function Yk(e,t,n,r){return n.safe(e.value,r)}function Kk(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Jk(e,t,n){const r=(sf(n)+(n.options.ruleSpaces?" ":"")).repeat(Kk(n));return n.options.ruleSpaces?r.slice(0,-1):r}const lf={blockquote:wk,break:pc,code:Ck,definition:Ak,emphasis:Jd,hardBreak:pc,heading:zk,html:Xd,image:Qd,imageReference:ef,inlineCode:tf,link:rf,linkReference:of,list:$k,listItem:Uk,paragraph:Hk,root:Vk,strong:af,text:Yk,thematicBreak:Jk};function Xk(){return{enter:{table:Qk,tableData:mc,tableHeader:mc,tableRow:tS},exit:{codeText:nS,table:eS,tableData:xs,tableHeader:xs,tableRow:xs}}}function Qk(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function eS(e){this.exit(e),this.data.inTable=void 0}function tS(e){this.enter({type:"tableRow",children:[]},e)}function xs(e){this.exit(e)}function mc(e){this.enter({type:"tableCell",children:[]},e)}function nS(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,rS));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function rS(e,t){return t==="|"?t:e}function iS(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` 39`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:c,tableRow:l}};function a(h,g,k,b){return u(d(h,k,b),h.align)}function l(h,g,k,b){const S=f(h,k,b),y=u([S]);return y.slice(0,y.indexOf(` 40`))}function c(h,g,k,b){const S=k.enter("tableCell"),y=k.enter("phrasing"),R=k.containerPhrasing(h,{...b,before:s,after:s});return y(),S(),R}function u(h,g){return bk(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(h,g,k){const b=h.children;let S=-1;const y=[],R=g.enter("table");for(;++S<b.length;)y[S]=f(b[S],g,k);return R(),y}function f(h,g,k){const b=h.children;let S=-1;const y=[],R=g.enter("tableRow");for(;++S<b.length;)y[S]=c(b[S],h,g,k);return R(),y}function p(h,g,k){let b=lf.inlineCode(h,g,k);return k.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function oS(){return{exit:{taskListCheckValueChecked:gc,taskListCheckValueUnchecked:gc,paragraph:aS}}}function sS(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:lS}}}function gc(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function aS(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,a;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function lS(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);s&&l.move(a);let c=lf.listItem(e,t,n,{...r,...l.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+a}}function cS(){return[$w(),lk(),fk(),Xk(),oS()]}function uS(e){return{extensions:[Ww(),ck(e),hk(),iS(e),sS()]}}const dS={tokenize:xS,partial:!0},cf={tokenize:bS,partial:!0},uf={tokenize:yS,partial:!0},df={tokenize:wS,partial:!0},fS={tokenize:kS,partial:!0},ff={name:"wwwAutolink",tokenize:mS,previous:pf},hf={name:"protocolAutolink",tokenize:gS,previous:mf},Zn={name:"emailAutolink",tokenize:pS,previous:gf},Mn={};function hS(){return{text:Mn}}let sr=48;for(;sr<123;)Mn[sr]=Zn,sr++,sr===58?sr=65:sr===91&&(sr=97);Mn[43]=Zn;Mn[45]=Zn;Mn[46]=Zn;Mn[95]=Zn;Mn[72]=[Zn,hf];Mn[104]=[Zn,hf];Mn[87]=[Zn,ff];Mn[119]=[Zn,ff];function pS(e,t,n){const r=this;let i,s;return a;function a(f){return!Zs(f)||!gf.call(r,r.previous)||Ba(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return Zs(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(fS,d,u)(f):f===45||f===95||Vt(f)?(s=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),i=!0,c}function d(f){return s&&i&&Xt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}
vendor: 8,221 bytes, line 40
40function mS(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!pf.call(r,r.previous)||Ba(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(dS,e.attempt(cf,e.attempt(uf,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function gS(e,t,n){const r=this;let i="",s=!1;return a;function a(f){return(f===72||f===104)&&mf.call(r,r.previous)&&!Ba(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(Xt(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),s?u:(s=!0,c)):n(f)}function u(f){return f===null||ao(f)||xt(f)||br(f)||Lo(f)?n(f):e.attempt(cf,e.attempt(uf,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function xS(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),s):n(a)}function s(a){return a===null?n(a):t(a)}}function bS(e,t,n){let r,i,s;return a;function a(u){return u===46||u===95?e.check(df,c,l)(u):u===null||xt(u)||br(u)||u!==45&&Lo(u)?c(u):(s=!0,e.consume(u),a)}function l(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function c(u){return i||r||!s?n(u):t(u)}}function yS(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(df,t,s)(a):a===null||xt(a)||br(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function wS(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||xt(l)||br(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||xt(l)||br(l)?t(l):r(l)}function s(l){return Xt(l)?a(l):n(l)}function a(l){return l===59?(e.consume(l),r):Xt(l)?(e.consume(l),a):n(l)}}function kS(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Vt(s)?n(s):t(s)}}function pf(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||xt(e)}function mf(e){return!Xt(e)}function gf(e){return!(e===47||Zs(e))}function Zs(e){return e===43||e===45||e===46||e===95||Vt(e)}function Ba(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const SS={tokenize:RS,partial:!0};function vS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ES,continuation:{tokenize:AS},exit:IS}},text:{91:{name:"gfmFootnoteCall",tokenize:CS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jS,resolveTo:_S}}}}function jS(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=jn(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function _S(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function CS(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!a||f===null||f===91||xt(f))return n(f);if(f===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(jn(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return xt(f)||(a=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function ES(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(a>999||g===93&&!l||g===null||g===91||xt(g))return n(g);if(g===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return s=jn(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return xt(g)||(l=!0),a++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),a++,d):d(g)}function p(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),st(e,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return t(g)}}function AS(e,t,n){return e.check(_i,t,e.attempt(SS,t,n))}function IS(e){e.exit("gfmFootnoteDefinition")}function RS(e,t,n){const r=this;return st(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function TS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let u=c;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[c][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[c][1].start)},p=[["enter",d,l],["enter",a[u][1],l],["exit",a[u][1],l],["enter",f,l]],h=l.parser.constructs.insideSpan.null;h&&gn(p,p.length,0,Mo(h,a.slice(u+1,c),l)),gn(p,p.length,0,[["exit",f,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",d,l]]),gn(a,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function s(a,l,c){const u=this.previous,d=this.events;let f=0;return p;function p(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(a.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const k=Or(u);
vendor: 4,082 bytes, line 40
40if(g===126)return f>1?c(g):(a.consume(g),f++,h);if(f<2&&!n)return c(g);const b=a.exit("strikethroughSequenceTemporary"),S=Or(g);return b._open=!S||S===2&&!!k,b._close=!k||k===2&&!!S,l(g)}}}class zS{constructor(){this.map=[]}add(t,n,r){FS(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function FS(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function PS(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function LS(){return{flow:{null:{name:"table",tokenize:MS,resolveAll:DS}}}}function MS(e,t,n){const r=this;let i=0,s=0,a;return l;function l(w){let M=r.events.length-1;for(;M>-1;){const $=r.events[M][1].type;if($==="lineEnding"||$==="linePrefix")M--;else break}const z=M>-1?r.events[M][1].type:null,I=z==="tableHead"||z==="tableRow"?T:c;return I===T&&r.parser.lazy[r.now().line]?n(w):I(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),u(w)}function u(w){return w===124||(a=!0,s+=1),d(w)}function d(w){return w===null?n(w):Ne(w)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),h):n(w):it(w)?st(e,d,"whitespace")(w):(s+=1,a&&(a=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(w)))}function f(w){return w===null||w===124||xt(w)?(e.exit("data"),d(w)):(e.consume(w),w===92?p:f)}function p(w){return w===92||w===124?(e.consume(w),f):f(w)}function h(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),a=!1,it(w)?st(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):g(w))}function g(w){return w===45||w===58?b(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),k):O(w)}function k(w){return it(w)?st(e,b,"whitespace")(w):b(w)}function b(w){return w===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),S):w===45?(s+=1,S(w)):w===null||Ne(w)?L(w):O(w)}function S(w){return w===45?(e.enter("tableDelimiterFiller"),y(w)):O(w)}function y(w){return w===45?(e.consume(w),y):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(w))}function R(w){return it(w)?st(e,L,"whitespace")(w):L(w)}function L(w){return w===124?g(w):w===null||Ne(w)?!a||i!==s?O(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):O(w)}function O(w){return n(w)}function T(w){return e.enter("tableRow"),Z(w)}function Z(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),Z):w===null||Ne(w)?(e.exit("tableRow"),t(w)):it(w)?st(e,Z,"whitespace")(w):(e.enter("data"),j(w))}function j(w){return w===null||w===124||xt(w)?(e.exit("data"),Z(w)):(e.consume(w),w===92?E:j)}function E(w){return w===92||w===124?(e.consume(w),j):j(w)}}function DS(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const p=new zS;for(;++n<e.length;){const h=e[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(xc(p,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,s=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)}
40,p.add(n,0,[["enter",d,t]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],f=Li(p,t,s,i,void 0,f),s=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],f=Li(p,t,s,i,void 0,f)),s=a,a=[s[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,s[1]!==0?(a[0]=a[1],f=Li(p,t,s,i,n,f)):a[1]!==0&&(f=Li(p,t,a,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&xc(p,t,c,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=PS(t.events,n))}return e}function Li(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(s.end=Object.assign({},Ir(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const c=Ir(t.events,n[1]);if(s={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Ir(t.events,n[2]),d=Ir(t.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const p=t.events[n[2]],h=t.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,k=n[3]-n[2]-1;e.add(g,k,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},Ir(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function xc(e,t,n,r,i){const s=[],a=Ir(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function Ir(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const OS={name:"tasklistCheck",tokenize:NS};function BS(){return{text:{91:OS}}}function NS(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return xt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ne(c)?t(c):it(c)?e.check({tokenize:$S},t,n)(c):n(c)}}function $S(e,t,n){return st(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function WS(e){return Cd([hS(),vS(),TS(e),LS(),BS()])}const US={};function HS(e){const t=this,n=e||US,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(WS(n)),s.push(cS()),a.push(uS(n))}const qS=x.lazy(()=>Xc(()=>import("./react-plotly-Ce3vN96O.js").then(e=>e.r),__vite__mapDeps([0,1])));function Rn({message:e,modelName:t,showModelInfo:n=!1}){const r=e.role==="user",[i,s]=x.useState(null),[a,l]=x.useState(!1),[c,u]=x.useState(null),d=x.useRef(null),f=le("#1F2937","#F9FAFB"),p=le("#4B5563","#E5E7EB"),h=le("#E5E7EB","#4B5563"),g=le("#FFFFFF","#1F2937"),k=le("#FFFFFF","#1F2937"),b=x.useMemo(()=>{if(r)return null;try{const y=e.visualization;if(y&&y.ready===!0&&(y.screenId||y.screenName))return{plotType:(y.plotType||"volcano").toLowerCase(),screenId:y.screenId,screenName:y.screenName,geneHighlight:y.geneHighlight,ready:y.ready}}catch{}return null},[r,e]);x.useEffect(()=>{let y=!1;if(!b){s(null),u(null);return}const R=Array.isArray(b.geneHighlight)?b.geneHighlight.join(","):b.geneHighlight||"",L=b.screenId?`id:${b.screenId}:${b.plotType}:${R}`:`name:${b.screenName}:${b.plotType}:${R}`;return d.current===L?void 0:((async()=>{var T;try{l(!0),s(null),u(null);const Z=`${Le.BASE}/api/v1/crispr/visualize`,j=new URLSearchParams;if(b.screenId&&j.set("screen_id",String(b.screenId)),b.screenName&&j.set("screen_name",b.screenName),j.set("plot_type",b.plotType),Array.isArray(b.geneHighlight))for(const z of b.geneHighlight)z!=null&&z.trim()&&j.append("gene_highlight",z.trim());else(T=b.geneHighlight)!=null&&T.trim()&&j.set("gene_highlight",b.geneHighlight.trim());const E=`${Z}?${j.toString()}`,w=await fetch(E);if(!w.ok)throw new Error(`Failed to fetch visualization: ${w.status}`);const M=await w.json();!y&&(M!=null&&M.success)&&(M!=null&&M.figure)&&(s(M.figure),d.current=L)}catch(Z){y||u((Z==null?void 0:Z.message)||"Failed to load visualization")}finally{y||l(!1)}})(),()=>{y=!0})},[b]);const S=x.useMemo(()=>
40{if(!(i!=null&&i.layout))return{autosize:!0,margin:{l:60,r:30,t:50,b:60},plot_bgcolor:g,paper_bgcolor:k,font:{color:p}};const y=i.layout,R=y.title;let L;typeof R=="string"?L={text:R}:R&&typeof R=="object"&&(L={...R}),L&&(L.font={...L.font??{},color:f});const O=Array.isArray(y.annotations)&&y.annotations.length>0?y.annotations.map(Z=>({...Z,font:{color:p,...Z.font??{}}})):void 0,T=Z=>{const j=Z?{...Z}:{},E=j.title;let w;return typeof E=="string"?w={text:E}:E&&typeof E=="object"&&(w={...E}),w&&(w.font={...w.font??{},color:f}),{...j,...w?{title:w}:{},automargin:!0,color:p,linecolor:j.linecolor??p,tickcolor:j.tickcolor??p,gridcolor:j.gridcolor??h,tickfont:{color:p,...j.tickfont??{}}}};return{...y,autosize:!0,margin:{l:60,r:30,t:50,b:60,...y.margin??{}},xaxis:T(y.xaxis),yaxis:T(y.yaxis),plot_bgcolor:y.plot_bgcolor??g,paper_bgcolor:y.paper_bgcolor??k,font:{...y.font??{},color:p},title:L??y.title,...O?{annotations:O}:{},legend:y.legend?{...y.legend,font:{color:p,...y.legend.font??{}}}:void 0}},[i,h,p,f,k,g]);return r?o.jsx(m,{alignSelf:"flex-end",bg:"chat.userBg",color:"chat.userText",borderRadius:"xl",px:4,py:3,maxW:"70%",mt:3,mb:2,fontFamily:"'Geomanist', Inter, system-ui, sans-serif",_hover:{bg:"chat.userHover"},children:o.jsx(m,{fontSize:"md",style:{whiteSpace:"pre-line"},children:e.content})}):o.jsxs(m,{alignSelf:"flex-start",mb:2,children:[n&&t&&o.jsxs(Me,{align:"center",gap:1,mb:1,color:"ui.textSecondary",children:[o.jsx(m,{as:"span","aria-hidden":!0,pointerEvents:"none",width:"14px",height:"14px",display:"inline-block",css:{WebkitMaskImage:`url(${Lt(t)})`,WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",maskImage:`url(${Lt(t)})`,maskRepeat:"no-repeat",maskSize:"contain",backgroundColor:"currentColor"}}),o.jsx(m,{fontSize:"xs",children:t})]}),o.jsx(m,{bg:"chat.assistantBg",color:"chat.assistantText",borderRadius:"xl",px:4,py:3,maxW:"100%",fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",_hover:{bg:"chat.assistantHover"},children:o.jsxs(m,{fontSize:"md",css:{"& table":{borderCollapse:"collapse",width:"100%",margin:"1rem 0","& th, & td":{border:"1px solid ui.border",padding:"0.5rem",textAlign:"left",backgroundColor:"ui.background",color:"ui.text"},"& th":{backgroundColor:"ui.surface",fontWeight:"bold"},"& tr:nth-of-type(even)":{backgroundColor:"ui.background"}},"& pre":{backgroundColor:"ui.surface",padding:"1rem",borderRadius:"0.375rem",overflowX:"auto",color:"ui.text"},"& code":{backgroundColor:"ui.surface",padding:"0.125rem 0.25rem",borderRadius:"0.125rem",fontFamily:"monospace",fontSize:"0.9em",color:"ui.textSecondary"},"& ol":{listStyleType:"decimal",paddingLeft:"1.5rem",margin:"0.5rem 0"},"& ul":{listStyleType:"disc",paddingLeft:"1.5rem",margin:"0.5rem 0"},"& li":{margin:"0.25rem 0"}},children:[o.jsx(Tw,{remarkPlugins:[HS],components:{table:({node:y,...R})=>o.jsx(m,{overflowX:"auto",children:o.jsx("table",{style:{width:"100%"},...R})}),a:({node:y,...R})=>o.jsx(m,{as:"a",color:"chat.link",textDecoration:"underline",fontWeight:"400",transition:"color 0.2s",_hover:{opacity:.8},...R})},children:e.content}),b&&o.jsxs(m,{mt:4,children:[a&&o.jsx(m,{fontSize:"sm",color:"ui.textSecondary",children:"Loading visualizationâ¦"}),c&&o.jsx(m,{fontSize:"sm",color:"red.400",children:c}),i&&o.jsx(x.Suspense,{fallback:o.jsx(m,{fontSize:"sm",children:"Loading plotâ¦"}),children:o.jsx(m,{width:"100%",height:"500px",minHeight:"400px",children:o.jsx(qS,{data:i.data,layout:S,config:i.config||{displaylogo:!1,responsive:!0},style:{width:"100%",height:"100%"},useResizeHandler:!0})})})]})]})})]})}function Xn(){const e=Kh` 41 0%, 100% { opacity: 0.6; } 42 50% { opacity: 1; } 43 `;return o.jsx(m,{display:"flex",gap:2,alignItems:"flex-start",justifyContent:"flex-start",mb:2,ml:2,minH:"48px",children:o.jsx(m,{mt:"16px",display:"flex",gap:2,children:[0,1,2].map(t=>o.jsx(m,{w:"8px",h:"8px",borderRadius:"full",bg:"ui.muted",animation:`${e} 1.5s ease-in-out ${t*.2}s infinite`},t))})})}function Na({isAdmin:e=!1}){return o.jsxs(ut,{w:"100%",maxW:"760px",px:4,textAlign:"center",gap:{base:4,md:6},children:[o.jsx(m,{w:"100%",display:"flex",justifyContent:"center",children:o.jsxs(m,{display:"flex",alignItems:"center",gap:{base:2,md:4},children:[o.jsx(tt,{src:le("/assets/images/bmarena-dark.svg","/assets/images/bmarena.svg"),alt:"BiomedArena Battle Mode - Compare AI models side by side",boxSize:{base:"56px",sm:"80px",md:"120px"}}),o.jsxs(ut,{gap:0,align:"center",children:[o.jsx(N,{fontFamily:"'Geomanist', sans-serif",fontSize:{base:"2xl",sm:"3xl",md:"5xl"},fontWeight:"400",color:"ui.text",children:"BiomedArena"}),e&&o.jsx(N,{fontFamily:"'Geomanist', sans-serif",fontSize:{base:"l",sm:"xl",md:"2xl"},fontWeight:300,color:le("teal.600","teal.300"),mt:-2,children:"Admin"})]})]})}),o.jsxs(m,{children:[o.jsx(N,{fontFamily:"'Geomanist', sans-serif",fontSize:{base:"md",sm:"lg",md:"2xl"},fontWeight:400,color:"ui.text",textAlign:"center",mt:-3,children:"Challenge. Appraise. Shape Biomedical AI."}),o.jsx(N,{fontFamily:"'Geomanist', sans-serif",fontSize:{base:"sm",md:"md"},color:"ui.textSecondary",textAlign:"center",mt:2,maxW:"640px",mx:"auto",children:"Collective insight shaping trustworthy biomedical AI."})]})]})}const VS="chat:knowledgeToggleEnabled",ZS=x.forwardRef(function({defaultModel:t="",onModelChange:n,showModelSelector:r=!0,showInput:i=!0,availableModels:s=[],hideWelcomeMessage:a=!1,threadId:l,threadHistory:c,onThreadIdChange:u,onThreadClear:d,externalKnowledgeAgents:f,onThinkingModeChange:p,onKnowledgeAgentsChange:h,onKnowledgeEnabledChange:g},k){const b=le("gray.200","rgba(255,255,255,0.18)"),S=le("gray.50","rgba(255,255,255,0.06)"),y=le("gray.600","rgba(255,255,255,0.65)"),R=Ht(),[L,O]=x.use
43State(l),[T,Z]=x.useState(t),[j,E]=x.useState(""),[w,M]=x.useState(!1),[z,I]=x.useState(null),[$,X]=x.useState([]),[xe,K]=x.useState(()=>!l),U=x.useRef(null),ie=x.useRef(null),C=x.useRef(!1),ne=x.useRef(null),[ue,v]=x.useState(!1),[ze,he]=x.useState([]);x.useEffect(()=>{f!==void 0&&he(f)},[f]);const Pe=x.useCallback(_=>{he(_),h==null||h(_)},[h]),et=x.useCallback(_=>{v(_),p==null||p(_)},[p]);x.useEffect(()=>{l&&c?c.mode==="single"?O(l):O(void 0):O(l)},[l,c]);const[Se,Ie]=x.useState(s),[Ve,ve]=x.useState(()=>{try{return typeof window<"u"&&window.localStorage.getItem(VS)==="true"}catch{return!1}}),{currentUser:Ae,isGuest:je,guestFingerprint:Ce}=dn(),Ee=x.useMemo(()=>{const _=!!(Ae!=null&&Ae.is_superuser&&!je);return Se.filter(B=>!(!ue&&B.is_thinking||_&&(ze.length>0||Ve)&&(B.api_type||"").toLowerCase()==="openai"))},[Se,ue,ze,Ve,Ae==null?void 0:Ae.is_superuser,je]),[De,pt]=x.useState(!1),[Fe,A]=x.useState(!0),[W,H]=x.useState([]),[,se]=x.useState(""),[re,Q]=x.useState(!1),[me,D]=x.useState(!1),q=x.useCallback(_=>{if(ve(_),g==null||g(_),!!!(Ae!=null&&Ae.is_superuser&&!je)||!_)return;const Y=Se.find(de=>de.llm_name===T);if(((Y==null?void 0:Y.api_type)||"").toLowerCase()==="openai"){const de=Se.filter(oe=>(oe.api_type||"").toLowerCase()!=="openai"),we=ue?de[0]:de.find(oe=>!oe.is_thinking)||de[0];we&&(Z(we.llm_name),K(!0),X([]),C.current=!1,ne.current=null,I(null),E(""))}},[Se,T,Ae==null?void 0:Ae.is_superuser,je,ue,g]),fe=x.useCallback(({suggestions:_,seed:B,visible:Y,loading:de})=>{H(_),se(B),Q(Y&&_.length>0),D(de)},[]),ke=x.useCallback(_=>{var B,Y,de,we,oe,Qe,ye,rt;E(_),(Y=(B=U.current)==null?void 0:B.dismissStarterSuggestions)==null||Y.call(B),(we=(de=ie.current)==null?void 0:de.dismissStarterSuggestions)==null||we.call(de),(Qe=(oe=U.current)==null?void 0:oe.focusInput)==null||Qe.call(oe),(rt=(ye=ie.current)==null?void 0:ye.focusInput)==null||rt.call(ye),H([]),se(""),Q(!1),D(!1)},[]);x.useEffect(()=>{if(!!!(Ae!=null&&Ae.is_superuser&&!je)||!Ve)return;const B=Se.find(Y=>Y.llm_name===T);if(((B==null?void 0:B.api_type)||"").toLowerCase()==="openai"){const Y=Se.filter(we=>(we.api_type||"").toLowerCase()!=="openai"),de=ue?Y[0]:Y.find(we=>!we.is_thinking)||Y[0];de&&de.llm_name!==T&&(Z(de.llm_name),K(!0),X([]),C.current=!1,ne.current=null,I(null),E(""))}},[Se,Ve,ue,T,Ae==null?void 0:Ae.is_superuser,je]);const{isModalOpen:$e,checkAndShowModal:Ke,handleAcceptTerms:nt,handleTermsError:at}=ya(),[vt,Et]=x.useState(null);x.useEffect(()=>{var _,B,Y;if(c!=null&&c.messages){const de=c.messages.map(ye=>{const rt=ye.visualization?{plotType:typeof ye.visualization.plotType=="string"?ye.visualization.plotType.toLowerCase():"volcano",screenId:typeof ye.visualization.screenId=="number"?ye.visualization.screenId:void 0,screenName:typeof ye.visualization.screenName=="string"?ye.visualization.screenName:void 0,geneHighlight:typeof ye.visualization.geneHighlight=="string"||Array.isArray(ye.visualization.geneHighlight)?ye.visualization.geneHighlight:void 0,ready:typeof ye.visualization.ready=="boolean"?ye.visualization.ready:!0,screenMeta:ye.visualization.screenMeta}:void 0;return{id:ye.id,role:ye.role,content:ye.content,timestamp:new Date(ye.timestamp).getTime(),modelId:ye.model_id||void 0,modelName:ye.model_name||void 0,side:ye.side,turn_idx:ye.turn_idx,visualization:rt}}),we=(c==null?void 0:c.thread_id)??l??null,oe=we!=null?`thread:${we}`:de.length>0?`local:${((_=de[0])==null?void 0:_.id)??((B=de[0])==null?void 0:B.timestamp)??((Y=de[0])==null?void 0:Y.content)??de.length}`:null,Qe=de.length>0&&oe!==ne.current;X(de),C.current=Qe,oe?ne.current=oe:de.length===0&&(ne.current=null)}},[c,l]);const ht=x.useCallback(_=>{if(!(c!=null&&c.turns))return;const B=c.turns.find(Y=>Y.idx===_);return B==null?void 0:B.knowledge_agents},[c==null?void 0:c.turns]);x.useEffect(()=>{L===void 0&&l===void 0&&(X([]),C.current=!1,ne.current=null)},[L,l]);const Ze=!a&&$.length===0,Xe=Ze&&i;x.useEffect(()=>{if(s&&s.length>0){Ie(s),A(!1);return}(async()=>{try{const B=await fetch(`${Le.BASE}/api/v1/llms/?only_active=true`);if(B.ok){const Y=await B.json();Ie(Y),Y.length>0&&Z(de=>de||Y[0].llm_name)}else console.error("Failed to fetch models")}catch(B){console.error("Error fetching models:",B)}finally{A(!1)}})()},[s]);const jt=x.useRef(!1);x.useEffect(()=>{n?Z(t):!jt.current&&t&&(Z(t),jt.current=!0)},[t,n]);const Gt=x.useRef(null);x.useEffect(()=>{if(n||!c)return;const _=c.thread_id??l;c.mode==="single"&&c.model_name&&_&&Gt.current!==_&&(Z(c.model_name),Gt.current=_)},[c,n,l]),x.useEffect(()=>{r&&n&&T!==t&&n(T)},[T,n,t,r]);const Yt=x.useRef(l);x.useEffect(()=>{Yt.current&&l===void 0&&(K(!0),X([]),C.current=!1,ne.current=null),Yt.current=l},[l]),x.useEffect(()=>{var de,we,oe;if(!T||c!=null&&c.messages&&c.messages.length>0||L||$.length>0||xe)return;const _=Nx(T),B=_.length>0?`local:${T}:${((de=_[0])==null?void 0:de.id)??((we=_[0])==null?void 0:we.timestamp)??((oe=_[0])==null?void 0:oe.content)??_.length}`:null,Y=_.length>0&&B!==ne.current;X(_),C.current=Y,B?ne.current=B:_.length===0&&(ne.current=null),Ce&&xb(Ce).catch(()=>{}).finally(()=>{bb(Ce).then(Qe=>{var rt,ft,Re;const ye=Qe.filter(ot=>ot.title===T).flatMap(ot=>ot.messages||[]);if(ye.length>0){const ot=[..._];for(const $t of ye)ot.some(Gn=>Gn.id===$t.id)||ot.push({id:$t.id||`${$t.role}-${Math.random()}`,role:$t.role,content:$t.content});const Tt=ot.length>0?`local:${T}:${((rt=ot[0])==null?void 0:rt.id)??((ft=ot[0])==null?void 0:ft.timestamp)??((Re=ot[0])==null?void 0:Re.content)??ot.length}`:null,Nt=ot.length>0&&Tt!==ne.current;X(ot),C.current=Nt,Tt?ne.current=Tt:ot.length===0&&(ne.current=null)}}).catch(()=>{})})},[T,Ce,c,L,xe,$.length]),x.useEffect(()=>{if(!C.current||!i)return;if($.length===0){C.current=!1;return}if(w||j.trim().length>0)return;const _=$.slice(-4).map(Y=>({role:Y.role,content:Y.content||""}));if(_.length===0){C.current=!1;return}C.current=!1;const B=setTimeout(()=>{var Y,de;(Y=U.current)==null||Y.triggerProactiveSuggestion(_),(de=ie.current)==null||de.triggerProactiveSuggestion(_)},300);return()=>clearTimeout(B)},[$,w,j,i]),x.useEffect(()=>{T&&(c!=null&&c.messages&&c.messages.length>0||Bx(T,$))},[$,T,c]);const en=un(),bn=x.useRef(null),tn=x.useRef(null),At=x.useRef(null),pn=x.useRef(null),gt=x.useRef(null),Bt=x.useRef(null),[nn,dt]=x.useState(!1),[kn,F]=x.useState(null),ae=x.useCallback(()=>!re||W.length===0?me?o.jsxs(m,{mt:3,px:2,display:"flex",alignItems:"center",gap:2,children:[o.jsx(cn,{size:"xs"}),o.jsx(N,{fontSize:"xs",color:"ui.textSecondary",children:"Loading suggestionsâ¦"})]}):null:o.jsx(m,{mt:3,pointerEvents:"auto",children:W.map((_,B)=>o.jsx(tr.button,{type:"button",onClick:()=>ke(_),w:"100%",textAlign:"left",py:2,px:2,bg:"transparent",color:"ui.text",fontSize:"sm",borderRadius:"none",border:"none",borderBottomWidth:B===W.length-1?"0":"0.5px",borderBottomColor:b,borderBottomStyle:"solid",display:"flex",gap:1,_hover:{bg:S},_active:{bg:S},_focus:{outline:"none"},cursor:"pointer",children:o.jsx(tr.span,{color:y,children:_})},`${_}-${B}`))}),[re,W,me,ke,b,S,y]);x.useEffect(()=>{if(nn&>.current&&!kn){const _=gt.current.getBoundingClientRect();F({top:_.bottom+window.scrollY,left:_.left+window.scrollX,width:_.width})}},[nn,kn]);
43const[_e,P]=x.useState(null);x.useEffect(()=>{const _=B=>{var de,we;const Y=B.target;At.current&&!At.current.contains(Y)&&!((de=pn.current)!=null&&de.contains(Y))&&pt(!1),gt.current&&!gt.current.contains(Y)&&!((we=Bt.current)!=null&&we.contains(Y))&&dt(!1)};return document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[]);const G=({modelName:_,onClick:B})=>{const Y=_||"Select model";return o.jsxs(Me,{align:"center",gap:2,title:Y,onClick:B,w:"100%",children:[o.jsx(tt,{src:Lt(_),alt:"",boxSize:"16px",filter:"invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)",opacity:.9,pointerEvents:"none"}),o.jsx("span",{children:Y})]})},ee=x.useCallback(()=>{},[]);x.useEffect(()=>{var _;($||w!==void 0)&&((_=bn.current)==null||_.scrollIntoView({behavior:"smooth"}))},[$,w]);const[J,ge]=x.useState(()=>{try{return localStorage.getItem("sidebar.collapsed")==="true"}catch{return!1}});x.useEffect(()=>{const _=Y=>{Y.key==="sidebar.collapsed"&&ge(Y.newValue==="true")},B=Y=>{const de=Y.detail;de&&typeof de.collapsed=="boolean"&&ge(de.collapsed)};return window.addEventListener("storage",_),window.addEventListener("sidebar:changed",B),()=>{window.removeEventListener("storage",_),window.removeEventListener("sidebar:changed",B)}},[]);const Oe=async _=>{if(!_.trim()||!T){console.error("Error: Please select a model and enter a message");return}Et(_.trim()),await Ke()&&(qe(_.trim()),E(""),Et(null))},pe=x.useCallback(async()=>{await nt(),vt&&(qe(vt),E(""),Et(null))},[vt,nt]),qe=_=>{if(!_.trim()||!T)return;xe&&K(!1);const B={id:`user-${Date.now()}`,role:"user",content:_};X(Re=>[...Re,B]),M(!0),I(null);try{gr("message_sent",{message_length:_.trim().length})}catch{}const Y=`assistant-${Date.now()}`,de=Se.find(Re=>Re.llm_name===T),we={id:Y,role:"assistant",content:"",modelId:de==null?void 0:de.id,modelName:Al(T||"",ze)};X(Re=>[...Re,we]);let oe="";const Qe=Re=>{Re.event==="thread_created"&&Re.thread_id&&O(Re.thread_id),Re.event==="visualization"&&X(ot=>{const Tt=ot.findIndex(Gn=>Gn.id===Y);if(Tt===-1)return ot;const Nt=[...ot],$t={plotType:Re.plot_type||"volcano",screenId:typeof Re.screen_id=="number"?Re.screen_id:void 0,screenName:typeof Re.screen_name=="string"?Re.screen_name:void 0,geneHighlight:Array.isArray(Re.gene_highlight)?Re.gene_highlight:typeof Re.gene_highlight=="string"&&Re.gene_highlight.trim()!==""?Re.gene_highlight.trim():void 0,screenMeta:Re.screen_meta||void 0,ready:!1};return Nt[Tt]={...Nt[Tt],visualization:$t,content:Nt[Tt].content||oe},Nt}),Re.event==="llm_done"&&X(ot=>{const Tt=ot.findIndex(Ai=>Ai.id===Y);if(Tt===-1)return ot;const Nt=[...ot],$t=Nt[Tt];$t.visualization&&$t.visualization.ready===!1&&(Nt[Tt]={...$t,visualization:{...$t.visualization,ready:!0},content:$t.content||oe});const Gn=Nt.slice(-4).map(Ai=>({role:Ai.role,content:Ai.content||""}));return setTimeout(()=>{U.current&&U.current.triggerProactiveSuggestion(Gn),ie.current&&ie.current.triggerProactiveSuggestion(Gn)},300),Nt}),Re.event==="token"&&Re.token&&(oe+=Re.token,X(ot=>{const Tt=ot.findIndex(Gn=>Gn.id===Y);if(Tt===-1)return ot;const Nt=[...ot],$t=Nt[Tt];return Nt[Tt]={...$t,content:oe},Nt}))},ye=Re=>{console.error(Re),M(!1),I("Error sending message")},rt=()=>{M(!1),X(Re=>{const ot=Re.findIndex($t=>$t.id===Y);if(ot===-1)return Re;const Tt=[...Re],Nt=Tt[ot];return Tt[ot]={...Nt,content:oe},Tt});try{localStorage.setItem(so(T),JSON.stringify([...$,B,{...we,content:oe}]))}catch{}};return wa.sendMessage([...$,B],T,Qe,ye,Re=>{Re&&Re!==L&&(O(Re),u&&u(Re)),rt()},L,ue,ze)};x.useImperativeHandle(k,()=>({sendExternalMessage:qe,clearMessages:He}));const He=x.useCallback(()=>{K(!0),X([]),C.current=!1,ne.current=null,E(""),I(null),O(void 0);try{localStorage.removeItem(so(T))}catch{}he([]),h==null||h([]),g==null||g(!1),typeof window<"u"&&window.resetChatInputKnowledgeState&&window.resetChatInputKnowledgeState(),R.invalidateQueries({queryKey:["threads"]}),d==null||d()},[T,R,d,h,g]);return o.jsxs(Me,{direction:"column",h:"100%",minH:0,fontFamily:"'Geomanist', 'Inter', sans-serif",bg:"ui.background",overflow:"hidden",position:"relative",children:[r&&o.jsxs(Me,{justify:"flex-end",px:4,pt:2,overflow:"visible",gap:2,children:[(Ae==null?void 0:Ae.is_superuser)&&!je&&o.jsxs(m,{position:"relative",ref:gt,children:[o.jsxs(m,{onClick:()=>{const _=!nn;if(dt(_),_&>.current){const B=gt.current.getBoundingClientRect();F({top:B.bottom+window.scrollY,left:B.left+window.scrollX,width:B.width})}else F(null)},fontFamily:"'IBM Plex Mono', monospace",minW:"120px",h:"36px",border:"1px solid",borderColor:"rgba(255, 255, 255, 0.16)",borderRadius:"0.375rem",bgColor:"rgba(0, 0, 0, 0.3)",p:"0 2.5rem 0 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",_hover:{borderColor:"rgba(255, 255, 255, 0.3)"},children:[o.jsx(m,{position:"absolute",right:"0.75rem",color:"gray.400",children:"â¡"}),"Mode"]}),nn&&o.jsx(Jt,{children:(()=>{let _=kn;if(!_&>.current){const B=gt.current.getBoundingClientRect();_={top:B.bottom+window.scrollY,left:B.left+window.scrollX,width:B.width}}return _?o.jsxs(m,{ref:Bt,position:"absolute",top:`${_.top}px`,left:`${_.left}px`,width:`${_.width}px`,mt:1,bg:"rgba(0, 0, 0, 0.9)",border:"1px solid",borderColor:"rgba(255, 255, 255, 0.16)",borderRadius:"0.375rem",zIndex:12e3,py:1,children:[o.jsx(m,{onMouseDown:()=>{dt(!1),en({to:"/"})},p:"0.5rem 0.75rem",cursor:"pointer",children:"Single Chat"}),o.jsx(m,{onMouseDown:()=>{dt(!1),en({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",children:"Side by Side"}),o.jsx(m,{onMouseDown:()=>{dt(!1),en({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",children:"Battle"})]}):null})()})]}),o.jsxs(m,{position:"relative",ref:At,className:"model-selector",children:[o.jsxs(m,{onClick:()=>{const _=!De;if(pt(_),_&&At.current){const B=At.current.getBoundingClientRect();P({top:B.bottom+window.scrollY,left:B.left+window.scrollX,width:B.width})}else P(null)},position:"relative",minW:"140px",h:"36px",border:"1px solid",borderColor:"rgba(255, 255, 255, 0.16)",borderRadius:"0.375rem",bgColor:"rgba(0, 0, 0, 0.3)",p:"0 2.5rem 0 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",_hover:{borderColor:"rgba(255, 255, 255, 0.3)"},_focus:{outline:"none",boxShadow:"0 0 0 2px rgba(255, 255, 255, 0.1)"},children:[Fe?o.jsx("span",{children:"Loading..."}):o.jsx(G,{modelName:T}),o.jsx(m,{position:"absolute",right:"0.75rem",color:"gray.400",children:"â¼"})]}),De&&Ee.length>0&&o.jsx(Jt,{children:(()=>
43{if(!_e&&At.current){const B=At.current.getBoundingClientRect();P({top:B.bottom+window.scrollY,left:B.left+window.scrollX,width:B.width})}const _=_e;return _?o.jsx(m,{ref:pn,position:"absolute",top:`${_.top}px`,left:`${_.left}px`,width:`${_.width}px`,mt:1,bg:"rgba(0, 0, 0, 0.9)",border:"1px solid",borderColor:"rgba(255, 255, 255, 0.16)",borderRadius:"0.375rem",zIndex:12e3,py:1,children:Ee.map(B=>o.jsx(m,{onMouseDown:()=>{gr("model_selected",{model_name:B.llm_name}),K(!0),Z(B.llm_name),pt(!1),X([]),C.current=!1,ne.current=null,I(null),E("")},p:"0.5rem 0.75rem",cursor:"pointer",bgColor:T===B.llm_name?"rgba(255, 255, 255, 0.1)":"transparent",children:o.jsx(G,{modelName:B.llm_name})},B.id))}):null})()})]})]}),o.jsxs(m,{flex:1,position:"relative",overflowY:"auto",onScroll:ee,ref:tn,children:[Ze&&o.jsx(m,{position:"absolute",top:"32%",left:"50%",transform:"translate(-50%, -50%)",w:"100%",maxW:"760px",px:4,textAlign:"center",zIndex:40,children:o.jsx(Na,{isAdmin:!!(Ae!=null&&Ae.is_superuser&&!je)})}),o.jsx(m,{p:4,display:"flex",flexDirection:"column",gap:4,children:o.jsx(m,{w:"100%",display:"flex",justifyContent:J?"center":"flex-start",children:o.jsxs(m,{w:"100%",maxW:J?"900px":"100%",display:"flex",flexDirection:"column",children:[$.map(_=>{var de;if(_.role==="assistant"&&!_.content&&((de=_.id)!=null&&de.startsWith("assistant-")))return null;const B=()=>{const we=_.modelName;let oe;if(we)oe=we;else if(_.modelId){const ye=Se.find(rt=>rt.id===_.modelId);ye&&(oe=ye.llm_name)}if(!oe)return;const Qe=_.turn_idx!==void 0?ht(_.turn_idx):void 0;return Al(oe,Qe)},Y=_.role==="assistant"?B():void 0;return o.jsx(Rn,{message:_,modelName:Y,showModelInfo:!!(_.role==="assistant"&&Y)},_.id||`msg-${_.role}-${_.content.substring(0,20)}`)}),w&&$.filter(_=>_.role==="user").length>0&&o.jsx(Xn,{},"loading-indicator"),o.jsx("div",{ref:bn})]})})})]}),(i||z)&&(Xe?o.jsxs(m,{position:"absolute",top:"49%",left:"50%",transform:"translateX(-50%)",zIndex:30,w:"100%",maxW:{base:"95%",md:"760px"},px:4,pointerEvents:w?"none":"auto",children:[o.jsxs(m,{bg:"ui.sidebar",w:"100%",px:4,pb:4,pt:0,borderRadius:"xl",p:2,children:[i&&o.jsx(Dr,{ref:U,value:j,onChange:E,onSend:()=>Oe(j),isLoading:w,thinkingModeEnabled:ue,onThinkingModeChange:et,onKnowledgeAgentsChange:Pe,onKnowledgeEnabledChange:q,messages:$.map(_=>({role:_.role,content:_.content})),onStarterSuggestionsChange:fe},"chatinput-instance-1"),z&&o.jsx(m,{color:"red.500",mt:2,fontSize:"sm",children:z})]}),ae()]}):o.jsx(m,{position:"sticky",bottom:0,zIndex:10,bg:"transparent",p:0,m:0,w:"100%",children:o.jsxs(m,{px:4,pb:4,pt:0,children:[o.jsxs(m,{bg:"ui.sidebar",w:"100%",borderRadius:"xl",p:2,style:w?{pointerEvents:"none",opacity:.6}:{},children:[i&&o.jsx(Dr,{ref:ie,value:j,onChange:E,onSend:()=>Oe(j),isLoading:w,thinkingModeEnabled:ue,onThinkingModeChange:et,onKnowledgeAgentsChange:Pe,onKnowledgeEnabledChange:q,messages:$.map(_=>({role:_.role,content:_.content})),onStarterSuggestionsChange:fe},"chatinput-instance-2"),z&&o.jsx(m,{color:"red.500",mt:2,fontSize:"sm",children:z})]}),ae(),o.jsx(m,{display:"flex",justifyContent:"center",pointerEvents:"none",mt:2,children:o.jsx(m,{as:"small",color:"ui.textSecondary",children:"Inputs are processed by third-party AI and responses may be inaccurate."})})]})})),o.jsx(Po,{isOpen:$e,onAccept:pe,onError:at})]})});
43function Jn({model:e,onChange:t,availableModels:n}){const[r,i]=x.useState(!1),s=x.useRef(null),a=x.useRef(null),[l,c]=x.useState(null);return x.useEffect(()=>{const u=d=>{var p;const f=d.target;s.current&&!s.current.contains(f)&&!((p=a.current)!=null&&p.contains(f))&&i(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]),o.jsxs(m,{position:"relative",ref:s,fontFamily:"'Geomanist', 'Inter', sans-serif",children:[o.jsxs(m,{onClick:()=>{const u=!r;if(i(u),u&&s.current){const d=s.current.getBoundingClientRect();c({top:d.bottom+window.scrollY,left:d.left+window.scrollX,width:d.width})}else c(null)},minW:{base:0,md:"150px"},h:"36px",border:"1px solid",borderColor:"ui.border",borderRadius:"0.375rem",bg:"transparent",p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",_hover:{borderColor:"ui.borderHover"},maxW:{base:"100%",md:"240px"},children:[o.jsx(tt,{src:Lt(e),alt:"",boxSize:"16px",filter:le("none","invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)"),opacity:.9,mr:2}),o.jsx(m,{color:"ui.text",flex:"1",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),o.jsx(m,{position:"absolute",right:"0.75rem",color:"ui.textSecondary",transform:r?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),r&&o.jsx(Jt,{children:l&&o.jsx(m,{ref:a,position:"absolute",top:`${l.top}px`,left:`${l.left}px`,width:`${l.width}px`,mt:1,bg:"ui.sidebar",border:"1px solid",borderColor:"ui.border",borderRadius:"0.375rem",zIndex:12e3,py:1,children:n.map(u=>o.jsxs(m,{onMouseDown:()=>{gr("model_selected",{model_name:u.llm_name}),t(u.llm_name),i(!1)},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,bg:e===u.llm_name?"ui.muted":"transparent",_hover:{backgroundColor:"ui.muted"},color:"ui.text",children:[o.jsx(tt,{src:Lt(u.llm_name),alt:"",boxSize:"16px",filter:le("none","invert(100%) sepia(100%) saturate(0%) brightness(200%) contrast(200%)"),opacity:.9}),o.jsx(m,{as:"span",flex:"1",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:u.llm_name})]},u.id))})})]})}function GS(){const t=un(),n=Ht(),{isGuest:r,currentUser:i}=dn();x.useEffect(()=>{r&&t({to:"/battle",replace:!0})},[r,t]);const s=ud(),[a,l]=x.useState(!1),[c,u]=x.useState([]),[d,f]=x.useState(""),[p,h]=x.useState(""),[g,k]=x.useState(!1),b=x.useRef(!1),S=x.useRef(void 0),[y,R]=x.useState(""),[L,O]=x.useState(null),[T,Z]=x.useState(!1),j=x.useRef(!1),E=x.useRef(!1),[w,M]=x.useState(!1),[z,I]=x.useState([]),[$,X]=x.useState(!1),xe=x.useMemo(()=>{const _=!!(i!=null&&i.is_superuser&&!r);return c.filter(B=>!(!w&&B.is_thinking||_&&(z.length>0||$)&&(B.api_type||"").toLowerCase()==="openai"))},[c,w,z,$,i==null?void 0:i.is_superuser,r]),[K,U]=x.useState(null),[ie,C]=x.useState({}),[ne,ue]=x.useState({}),[v,ze]=x.useState({}),{isModalOpen:he,checkAndShowModal:Pe,handleAcceptTerms:et,handleTermsError:Se}=ya(),[Ie,Ve]=x.useState(null),[ve,Ae]=x.useState({}),je=ld(),[Ce,Ee]=x.useState(!1),[De,pt]=x.useState(!1),Fe=x.useRef(null),A=x.useRef(null),W=x.useRef(null),[H,se]=x.useState(null),re=x.useRef(null),Q=x.useRef(null),me=x.useRef(null),D=x.useRef(null),q=Jc({from:"/_layout/"}),fe=q==null?void 0:q.threadId;x.useEffect(()=>{const _=q==null?void 0:q.clear;if(_===void 0)return;if((typeof _=="string"?_.replace(/^"+|"+$/g,""):String(_))==="true"){G();const Y=q==null?void 0:q.mode;t({to:"/",search:Y?{mode:Y}:{},replace:!0})}},[q==null?void 0:q.clear,q==null?void 0:q.mode,t]);const ke="ui.sidebar",$e="ui.border",Ke="ui.text",nt="ui.muted",at="ui.main",vt="ui.main",Et="ui.textSecondary",ht="ui.muted",{data:Ze}=cd(fe);x.useEffect(()=>{(async()=>{try{const B=await fetch(`${Le.BASE}/api/v1/llms/?only_active=true`);if(B.ok){const Y=await B.json();u(Y);const de=Y.find(oe=>oe.llm_name==="gpt-4o")||Y[0],we=Y.find(oe=>oe.llm_name==="gpt-4o + GenBio")||Y.find(oe=>oe.llm_name!==(de==null?void 0:de.llm_name))||Y[0];de&&f(oe=>oe||de.llm_name),we&&h(oe=>oe||we.llm_name)}else console.error("Failed to fetch models")}catch(B){console.error("Error fetching models:",B)}finally{}})()},[]),x.useEffect(()=>{q.mode==="dual"?l(!0):l(!1)},[q.mode]),x.useEffect(()=>{!Ze||!(S.current!==fe)||(S.current=fe,b.current=!1,Ze.mode==="dual"?(l(!0),t({to:"/",search:{mode:"dual",threadId:fe},replace:!0})):(l(!1),Ze.model_name&&!g&&(f(Ze.model_name),b.current=!0)))},[fe,Ze,g,t]),x.useEffect(()=>{k(!1)},[fe]);const[Xe,jt]=x.useState([]),Gt=x.useMemo(()=>{const _=[];for(const B of Xe)B.user&&_.push({role:"user",content:B.user}),B.left&&_.push({role:"assistant",content:B.left});return _.slice(-4)}
43,[Xe]),Yt=Xe.some(_=>!v[_.id]&&_.left&&_.right),{suggestions:en,requestInitialSuggestions:bn,clearSuggestion:tn,isLoading:At}=ba({enabled:!Yt&&a,debounceMs:300,minLength:6,chatHistory:Gt}),[pn,gt]=x.useState([]);x.useEffect(()=>{en&&en.length>0&>(en)},[en]);const Bt=x.useRef(null),[nn,dt]=x.useState(!1),kn=x.useCallback(_=>{if(R(_),!a)return;const B=_.trim(),Y=Xe.length===0;Bt.current&&(clearTimeout(Bt.current),Bt.current=null,dt(!1)),Y&&B.length>=6&&B.length<=50?/[.?!]$/.test(B)||(dt(!0),Bt.current=setTimeout(()=>{bn(B),dt(!1),Bt.current=null},300)):Y&&B.length<6?(gt([]),dt(!1),tn()):B.length===0&&(gt([]),dt(!1),tn())},[Xe.length,bn,tn,a]);x.useEffect(()=>()=>{Bt.current&&clearTimeout(Bt.current)},[]);const F=x.useRef(null),ae=x.useRef(null),_e=a?Xe.length===0:!T&&(!Ze||Ze.messages&&Ze.messages.length===0);x.useEffect(()=>{if(Ze!=null&&Ze.turns&&Ze.mode==="dual"){const _={};for(const oe of Ze.messages)_[oe.turn_idx]||(_[oe.turn_idx]={}),oe.role==="user"?_[oe.turn_idx].user=oe.content:oe.side==="left"?(_[oe.turn_idx].left=oe.content,_[oe.turn_idx].leftModelId=oe.model_id):oe.side==="right"&&(_[oe.turn_idx].right=oe.content,_[oe.turn_idx].rightModelId=oe.model_id);const B=oe=>{if(!oe)return"Unknown";const Qe=c.find(ye=>ye.id===oe);return Qe?Qe.llm_name:"Unknown"},Y={},de={};if(Ze.turns)for(const oe of Ze.turns)Y[oe.idx]=oe.vote,de[oe.idx]=oe.id;const we=Object.keys(_).map(Number).sort((oe,Qe)=>oe-Qe).map(oe=>{const Qe=_[oe],ye=Y[oe],rt=de[oe];let ft=null;if(ye!=null&&ye.outcome)switch(ye.outcome){case"left_better":ft="left";break;case"right_better":ft="right";break;case"tie":ft="tie";break;case"both_bad":ft="bad";break;default:ft=null}return{id:rt||`turn-${oe}`,backendTurnId:rt,user:Qe.user||"",left:Qe.left||"",right:Qe.right||"",leftModel:B(Qe.leftModelId),rightModel:B(Qe.rightModelId),decision:ft,showModels:!!ft}});jt(we),ze(oe=>{const Qe={...oe};for(const ye of we)ye.decision&&(Qe[ye.id]=!0);return Qe})}},[Ze,c]),x.useEffect(()=>{var _;Xe&&((_=ae.current)==null||_.scrollIntoView({behavior:"smooth"}))},[Xe]),x.useEffect(()=>{fe&&n.invalidateQueries({queryKey:["threads"]})},[fe,n]),x.useEffect(()=>{const _=B=>{var de,we,oe;const Y=B.target;!((de=W.current)!=null&&de.contains(Y))&&!((we=Fe.current)!=null&&we.contains(Y))&&!((oe=A.current)!=null&&oe.contains(Y))&&Ee(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]),x.useEffect(()=>()=>{L&&L()},[L]);const P="transparent",G=()=>{var _,B;gr("conversation_started",{action:"clear_chat"}),r&&pt(!0),jt([]),R(""),(_=re.current)==null||_.clearMessages(),(B=Q.current)==null||B.clearMessages(),L&&(L(),O(null)),U(null),C({}),ue({}),ze({}),Ae({}),Z(!1),j.current=!1,I([]),X(!1),typeof window<"u"&&window.resetChatInputKnowledgeState&&window.resetChatInputKnowledgeState(),n.invalidateQueries({queryKey:["threads"]})},ee=async _=>{var de;const B=Xe.find(we=>we.id===_),Y=((de=ie[_])==null?void 0:de.trim())||"";if(!(B!=null&&B.decision)){ue(we=>({...we,[_]:"Please select a choice before sending feedback."}));return}if(B.backendTurnId){let we;switch(B.decision){case"left":we="left_better";break;case"right":we="right_better";break;case"tie":we="tie";break;case"bad":we="both_bad";break}try{await s.mutateAsync({turn_id:B.backendTurnId,outcome:we,feedback_text:Y})}catch(oe){console.error("Failed to submit vote:",oe)}}else console.error("Cannot submit vote: turn.backendTurnId is missing for turn",_,B);ue(we=>({...we,[_]:""})),ze(we=>({...we,[_]:!0})),jt(we=>we.map(oe=>oe.id===_?{...oe,showModels:!0}:oe)),L&&(L(),O(null)),a&&setTimeout(()=>{var we;(we=D.current)==null||we.triggerProactiveSuggestion(Gt.slice(-4))},300)},J=_=>{jt(B=>{const Y=[...B].reverse().find(de=>de.left&&de.right&&!v[de.id]);return Y?B.map(de=>de.id===Y.id?{...de,decision:_}:de):B}),Ae(B=>{const Y={...B},de=[...Xe].reverse().find(we=>we.left&&we.right&&!v[we.id]);return de&&(Y[de.id]=null),Y})},ge=(_,B)=>{if(_.decision){if(_.decision==="tie")return"green.500";if(_.decision==="bad")return"red.500";if(_.decision===B)return"green.500";if(_.decision==="left"||_.decision==="right")return"ui.muted"}if(K&&K.turnId===_.id){if(K.pick==="tie")return"green.500";if(K.pick==="bad")return"red.500";if(K.pick===B)return"green.500";if(K.pick&&(K.pick==="left"||K.pick==="right"))return"ui.muted"}return"ui.sidebar"};function Oe(_,B){const Y=oe=>oe==="left"?_.leftModel:_.rightModel,de=oe=>oe==="left"?_.left:_.right,we=!_.decision||_.decision==="tie"||_.decision==="bad"||!v[_.id];return!we&&(_.decision==="left"||_.decision==="right")&&!B[_.id]?o.jsxs(m,{gridColumn:"1 / -1",flex:1,width:"100%",minW:0,maxW:"100%",overflowX:"hidden",bg:"ui.sidebar",p:2,borderRadius:"xl",position:"relative",border:"2px s
43olid",borderColor:ge(_,_.decision),children:[o.jsxs(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:[o.jsx(tt,{src:Lt(Y(_.decision)),alt:"",boxSize:"10px",filter:je.iconFilter}),Y(_.decision)]}),de(_.decision).length>0?o.jsx(m,{mt:"1.25rem",whiteSpace:"pre-wrap",wordBreak:"break-word",children:o.jsx(Rn,{message:{role:"assistant",content:de(_.decision)}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})}),o.jsx(m,{mt:2,display:"flex",justifyContent:"flex-start",children:o.jsx(We,{size:"xs",variant:"outline",colorScheme:"gray",bg:"ui.sidebar",color:"ui.text",borderColor:"ui.border",_hover:{bg:"ui.muted",borderColor:"ui.borderHover"},onClick:()=>Ae(oe=>({...oe,[_.id]:_.decision==="left"?"right":"left"})),children:"Show other response"})})]}):!we&&(_.decision==="left"||_.decision==="right")&&B[_.id]?o.jsxs(o.Fragment,{children:[o.jsxs(m,{w:"100%",minW:0,maxW:"100%",overflowX:"hidden",bg:"ui.sidebar",p:2,borderRadius:"xl",position:"relative",border:"2px solid",borderColor:ge(_,"left"),children:[o.jsxs(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:[o.jsx(tt,{src:Lt(Y("left")),alt:"",boxSize:"10px",filter:je.iconFilter}),Y("left")]}),de("left").length>0?o.jsx(m,{mt:"1.25rem",whiteSpace:"pre-wrap",wordBreak:"break-word",children:o.jsx(Rn,{message:{role:"assistant",content:de("left")}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})})]}),o.jsxs(m,{w:"100%",minW:0,maxW:"100%",overflowX:"hidden",bg:"ui.sidebar",p:2,borderRadius:"xl",position:"relative",border:"2px solid",borderColor:ge(_,"right"),children:[o.jsxs(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:[o.jsx(tt,{src:Lt(Y("right")),alt:"",boxSize:"10px",filter:je.iconFilter}),Y("right")]}),de("right").length>0?o.jsx(m,{mt:"1.25rem",whiteSpace:"pre-wrap",wordBreak:"break-word",children:o.jsx(Rn,{message:{role:"assistant",content:de("right")}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})}),o.jsx(m,{mt:2,display:"flex",justifyContent:"flex-start",children:o.jsx(We,{size:"xs",variant:"outline",colorScheme:"gray",bg:"ui.sidebar",color:"ui.text",borderColor:"ui.border",_hover:{bg:"ui.muted",borderColor:"ui.borderHover"},onClick:()=>Ae(oe=>({...oe,[_.id]:null})),children:"Hide other response"})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(m,{w:"100%",minW:0,maxW:"100%",overflowX:"hidden",bg:"ui.sidebar",p:2,borderRadius:"xl",position:"relative",border:"2px solid",borderColor:ge(_,"left"),children:[o.jsxs(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"ui.textSecondary",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:[o.jsx(tt,{src:Lt(_.leftModel),alt:"",boxSize:"10px",filter:je.iconFilter}),_.leftModel]}),_.left?o.jsx(m,{mt:"1.25rem",whiteSpace:"pre-wrap",wordBreak:"break-word",children:o.jsx(Rn,{message:{role:"assistant",content:_.left}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})})]}),o.jsxs(m,{w:"100%",minW:0,maxW:"100%",overflowX:"hidden",bg:"ui.sidebar",p:2,borderRadius:"xl",position:"relative",border:"2px solid",borderColor:ge(_,"right"),children:[o.jsxs(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"ui.textSecondary",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:[o.jsx(tt,{src:Lt(_.rightModel),alt:"",boxSize:"10px",filter:je.iconFilter}),_.rightModel]}),_.right?o.jsx(m,{mt:"1.25rem",whiteSpace:"pre-wrap",wordBreak:"break-word",children:o.jsx(Rn,{message:{role:"assistant",content:_.right}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})})]})]})}const pe=async()=>{!y.trim()||E.current||(Ve(y.trim()),!await Pe())||(Z(!0),await qe())},qe=x.useCallback(async()=>{var _;if(!E.current){E.current=!0,j.current=!1;try{const B=Ie||y.trim();if(!B){E.current=!1;return}if(!a){(_=re.current)==null||_.sendExternalMessage(B),R(""),Ve(null),E.current=!1;return}try{gr("message_sent",{message_length:B.length})}catch{}const Y=Date.now().toString(),de={id:Y,user:B,left:"",right:"",leftModel:d,rightModel:p,backendTurnId:void 0},we=[...Xe,de],oe=we.flatMap(ye=>{const rt=[{role:"user",content:ye.user}];return ye.left&&rt.push({role:"assistant",content:ye.left}),rt});jt(we),L&&(L(),O(null));const Qe=wa.singleTurnDualChat({useRandomModels:!1,leftModel:d,rightModel:p,messages:oe,threadId:fe,thinking_mode:w,onSetup:ye=>{Z(!0),jt(rt=>rt.map(ft=>{var Re,ot;return ft.id===Y?{...ft,leftModel:((Re=ye[0])==null?void 0:Re.name)||d,rightModel:((ot=ye[1])==null?void 0:ot.name)||p}:ft}))},onThreadCreated:ye=>{j.current||(j.current=!0,!fe&&ye&&t({to:"/",search:{mode:"dual",threadId:ye},replace:!0}))},onTurnCreated:(ye,rt)=>{jt(ft=>ft.map((Re,ot)=>ot===rt?{...Re,backendTurnId:ye}:Re))},onToken:(ye,rt)=>{Z(!0),jt(ft=>ft.map(Re=>Re.id!==Y?Re:ye===Re.leftModel?{...Re,left:Re.left+rt}:ye===Re.rightModel?{...Re,right:Re.right+rt}:Re))},onDone:()=>{if(!a&&me.current&&(Ze!=null&&Ze.messages)){const ye=Ze.messages.slice(-4).map(rt=>({role:rt.role,content:rt.content||""}));setTimeout(()=>{var rt;(rt=me.current)==null||rt.triggerProactiveSuggestion(ye)},300)}},onError:ye=>{console.error("Dual chat error:",ye),jt(rt=>rt.map(ft=>ft.id===Y?{...ft,left:`${ft.left} 44[Error: ${ye}]`,right:`${ft.right} 45[Error: ${ye}]`}:ft))},onClose:()=>{O(null),E.current=!1}});O(()=>Qe),R(""),Ve(null)}catch(B){console.error("sendMessage error:",B),E.current=!1}}},[y,d,p,a,L,Ie,t,fe,Ze,Xe,w]),He=x.useCallback(async()=>{await et(),Ie&&(Z(!0),qe())},[Ie,et,qe]);return o.jsxs(Me,{direction:"column",w:"100%",h:"100vh",minH:0,overflow:"hidden",bg:"ui.background",children:[!a&&(i!=null&&i.is_superuser)&&!r?o.jsxs(m,{w:"100%",children:[o.jsxs(m,{display:{base:"block",md:"none"},px:4,mt:4,children:[o.jsxs(m,{position:"relative",ref:Fe,fontFamily:"'Geomanist', 'Inter', sans-serif",zIndex:9,children:[o.jsxs(m,{onClick:_=>{const B=!Ce;if(Ee(B),B){const Y=_.currentTarget.getBoundingClientRect();se({top:Y.bottom+window.scrollY,left:Y.left+window.scrollX,width:Y.width})}else se(null)},minW:"100%",h:"36px",border:"1.5px solid",borderColor:$e,borderRadius:"xl",bg:ke,p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",color:Ke,_hover:{borderColor:at,bg:nt},boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsx(tt,{src:window.location.pathname==="/battle"?"/assets/images/battle.svg":"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter,mr:2}),window.location.pathname==="/battle"?"Battle":"Single Chat",o.jsx(m,{position:"absolute",right:"0.75rem",color:Et,transform:Ce?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),Ce&&H&&o.jsx(Jt,{children:o.jsxs(m,{ref:W,position:"absolute",top:`${H.top}px`,left:`${H.left}px`,width:`${H.width}px`,mt:1,bg:ke,fontFamily:"'IBM Plex Mono', monospace",border:"1.5px solid",borderColor:$e,borderRadius:"xl",zIndex:12e3,py:1,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(m,{onPointerDown:()=>{G(),l(!1),Ee(!1),t({to:"/",search:{}}
45)},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Single Chat"]}),o.jsxs(m,{onPointerDown:()=>{G(),l(!0),Ee(!1),t({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Side by Side"]}),o.jsxs(m,{onPointerDown:()=>{G(),Ee(!1),t({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/battle.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Battle"]})]})})]}),a?o.jsx(m,{mt:2,children:o.jsxs(Me,{gap:2,children:[o.jsx(m,{flex:"1",minW:0,children:o.jsx(Jn,{model:d,onChange:_=>{k(!0),f(_)},availableModels:xe})}),o.jsx(m,{flex:"1",minW:0,children:o.jsx(Jn,{model:p,onChange:h,availableModels:xe})})]})}):o.jsx(m,{mt:2,children:o.jsx(Jn,{model:d,onChange:_=>{k(!0),f(_)},availableModels:xe})})]}),o.jsxs(Me,{display:{base:"none",md:"flex"},alignItems:"center",justifyContent:"space-between",px:4,mt:4,borderBottomWidth:"0",borderColor:P,w:"100%",children:[o.jsx(m,{flex:1}),o.jsxs(m,{position:"relative",ref:A,fontFamily:"'Geomanist', 'Inter', sans-serif",mx:"auto",zIndex:9,children:[o.jsxs(m,{onClick:_=>{const B=!Ce;if(Ee(B),B){const Y=_.currentTarget.getBoundingClientRect();se({top:Y.bottom+window.scrollY,left:Y.left+window.scrollX,width:Y.width})}else se(null)},minW:"200px",h:"36px",border:"1.5px solid",borderColor:$e,borderRadius:"xl",bg:ke,p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",color:Ke,_hover:{borderColor:at,bg:nt},boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsx(tt,{src:window.location.pathname==="/battle"?"/assets/images/battle.svg":"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter,mr:2}),window.location.pathname==="/battle"?"Battle":"Single Chat",o.jsx(m,{position:"absolute",right:"0.75rem",color:Et,transform:Ce?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),Ce&&o.jsx(Jt,{children:H&&o.jsxs(m,{ref:W,position:"absolute",top:`${H.top}px`,left:`${H.left}px`,width:`${H.width}px`,mt:1,bg:ke,fontFamily:"'IBM Plex Mono', monospace",border:"1.5px solid",borderColor:$e,borderRadius:"xl",zIndex:12e3,py:1,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(m,{onPointerDown:()=>{G(),l(!1),Ee(!1),t({to:"/",search:{}})},p:"0.5rem 0.75rem",cursor:"pointer",bg:window.location.pathname!=="/battle"?vt:"transparent",color:Ke,borderRadius:"xl",_hover:{backgroundColor:ht},display:"flex",alignItems:"center",gap:2,fontWeight:window.location.pathname!=="/battle"?600:400,children:[o.jsx(tt,{src:"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Single Chat"]}),o.jsxs(m,{onPointerDown:()=>{G(),l(!0),Ee(!1),t({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",bg:"transparent",color:Ke,borderRadius:"xl",_hover:{backgroundColor:ht},display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Side by Side"]}),o.jsxs(m,{onPointerDown:()=>{G(),Ee(!1),t({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",bg:window.location.pathname==="/battle"?"ui.main":"transparent",color:le("ui.text","white"),borderRadius:"xl",_hover:{backgroundColor:le("ui.muted","ui.sidebar")},display:"flex",alignItems:"center",gap:2,fontWeight:window.location.pathname==="/battle"?600:400,children:[o.jsx(tt,{src:"/assets/images/battle.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Battle"]})]})})]}),o.jsx(m,{flex:1,display:"flex",justifyContent:"flex-end",children:o.jsx(Jn,{model:d,onChange:_=>{k(!0),f(_)},availableModels:xe})})]})]}):!r&&(i==null?void 0:i.is_superuser)&&o.jsxs(m,{w:"100%",children:[o.jsxs(m,{display:{base:"block",md:"none"},px:4,mt:4,children:[o.jsxs(m,{position:"relative",ref:Fe,fontFamily:"'Geomanist', 'Inter', sans-serif",zIndex:9,children:[o.jsxs(m,{onClick:_=>{const B=!Ce;if(Ee(B),B){const Y=_.currentTarget.getBoundingClientRect();se({top:Y.bottom+window.scrollY,left:Y.left+window.scrollX,width:Y.width})}else se(null)},minW:"100%",h:"36px",border:"1.5px solid",borderColor:$e,borderRadius:"xl",bg:ke,p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",color:Ke,_hover:{borderColor:at,bg:nt},boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsx(tt,{src:a?"/assets/images/sbs.svg":window.location.pathname==="/battle"?"/assets/images/battle.svg":"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter,mr:2}),window.location.pathname==="/battle"?"Battle":a?"Side by Side":"Single Chat",o.jsx(m,{position:"absolute",right:"0.75rem",color:Et,transform:Ce?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),Ce&&o.jsxs(m,{position:"absolute",top:"100%",left:0,right:0,mt:1,bg:ke,fontFamily:"'IBM Plex Mono', monospace",border:"1.5px solid",borderColor:$e,borderRadius:"xl",zIndex:10,py:1,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(m,{onPointerDown:()=>{G(),l(!1),Ee(!1),t({to:"/",search:{}}
45)},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Single Chat"]}),o.jsxs(m,{onPointerDown:()=>{G(),l(!0),Ee(!1),t({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Side by Side"]}),o.jsxs(m,{onPointerDown:()=>{G(),Ee(!1),t({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/battle.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Battle"]})]})]}),o.jsx(m,{mt:2,children:o.jsxs(Me,{gap:2,children:[o.jsx(m,{flex:1,minW:0,children:o.jsx(Jn,{model:d,onChange:_=>{k(!0),f(_)},availableModels:xe})}),o.jsx(m,{flex:1,minW:0,children:o.jsx(Jn,{model:p,onChange:h,availableModels:xe})})]})})]}),o.jsxs(Me,{display:{base:"none",md:"flex"},alignItems:"center",justifyContent:"flex-end",px:4,mt:4,borderBottomWidth:"0",borderColor:P,gap:2,children:[o.jsxs(m,{position:"relative",ref:A,fontFamily:"'Geomanist', 'Inter', sans-serif",zIndex:9,children:[o.jsxs(m,{onClick:_=>{const B=!Ce;if(Ee(B),B){const Y=_.currentTarget.getBoundingClientRect();se({top:Y.bottom+window.scrollY,left:Y.left+window.scrollX,width:Y.width})}else se(null)},minW:"200px",h:"36px",border:"1.5px solid",borderColor:$e,borderRadius:"xl",bg:ke,p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",color:Ke,_hover:{borderColor:at,bg:nt},boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsx(tt,{src:a?"/assets/images/sbs.svg":window.location.pathname==="/battle"?"/assets/images/battle.svg":"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter,mr:2}),window.location.pathname==="/battle"?"Battle":a?"Side by Side":"Single Chat",o.jsx(m,{position:"absolute",right:"0.75rem",color:Et,transform:Ce?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),Ce&&o.jsxs(m,{position:"absolute",top:"100%",left:0,right:0,mt:1,bg:ke,fontFamily:"'IBM Plex Mono', monospace",border:"1.5px solid",borderColor:$e,borderRadius:"xl",zIndex:10,py:1,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(m,{onPointerDown:()=>{G(),l(!1),Ee(!1),t({to:"/",search:{}})},p:"0.5rem 0.75rem",cursor:"pointer",bg:!a&&window.location.pathname!=="/battle"?vt:"transparent",color:Ke,borderRadius:"xl",_hover:{backgroundColor:ht},display:"flex",alignItems:"center",gap:2,fontWeight:!a&&window.location.pathname!=="/battle"?600:400,children:[o.jsx(tt,{src:"/assets/images/send.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Single Chat"]}),o.jsxs(m,{onPointerDown:()=>{G(),l(!0),Ee(!1),t({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",bg:a&&window.location.pathname!=="/battle"?vt:"transparent",color:Ke,borderRadius:"xl",_hover:{backgroundColor:ht},display:"flex",alignItems:"center",gap:2,fontWeight:a&&window.location.pathname!=="/battle"?600:400,children:[o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Side by Side"]}),o.jsxs(m,{onPointerDown:()=>{G(),Ee(!1),t({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",bg:window.location.pathname==="/battle"?"ui.main":"transparent",color:le("ui.text","white"),borderRadius:"xl",_hover:{backgroundColor:le("ui.muted","ui.sidebar")},display:"flex",alignItems:"center",gap:2,fontWeight:window.location.pathname==="/battle"?600:400,children:[o.jsx(tt,{src:"/assets/images/battle.svg",alt:"",boxSize:"16px",filter:je.iconFilter}),"Battle"]})]})]}),o.jsxs(Me,{flex:1,justify:"center",align:"center",gap:2,ml:0,children:[o.jsx(Jn,{model:d,onChange:_=>{k(!0),f(_)},availableModels:xe}),o.jsx(m,{color:"ui.textSecondary",children:"vs"}),o.jsx(Jn,{model:p,onChange:h,availableModels:xe})]})]})]}),o.jsxs(m,{flex:1,minH:0,px:a?4:0,py:2,display:"flex",flexDirection:"column",bg:"ui.background",position:"relative",children:[_e&&a&&o.jsx(Me,{position:"absolute",top:0,left:0,right:0,bottom:0,px:{base:2,md:4},justifyContent:"center",alignItems:"center",pointerEvents:"none",children:o.jsxs(m,{w:"100%",maxW:{base
45:"95%",md:"760px"},mx:"auto",display:"flex",flexDirection:"column",alignItems:"center",gap:4,zIndex:30,pointerEvents:"auto",transform:"translateY(-5vh)",children:[o.jsx(Na,{isAdmin:!!(i!=null&&i.is_superuser&&!r)}),o.jsx(m,{w:"100%",bg:"ui.sidebar",borderRadius:"xl",p:2,style:Yt?{opacity:.2,pointerEvents:"none"}:{},children:o.jsx(Dr,{ref:me,value:y,onChange:kn,onSend:pe,isLoading:Yt,thinkingModeEnabled:w,onThinkingModeChange:M,showKnowledgeToggle:!1,showCrisprToggle:!1,messages:Gt})}),Xe.length===0&&(()=>{const _=nn||At,B=pn.length>0&&y.trim().length>=6;if(_&&y.trim().length>=6&&!B)return o.jsxs(m,{mt:-1,px:2,display:"flex",alignItems:"center",gap:2,w:"100%",maxW:"760px",mx:"auto",children:[o.jsx(cn,{size:"xs"}),o.jsx(N,{fontSize:"xs",color:"ui.textSecondary",children:"Loading suggestionsâ¦"})]});if(B){const Y=le("gray.200","gray.700"),de=le("gray.50","whiteAlpha.50"),we=le("gray.600","gray.400");return o.jsx(m,{mt:-2,pointerEvents:"auto",w:"100%",maxW:"760px",mx:"auto",children:pn.map((oe,Qe)=>o.jsx(tr.button,{type:"button",onClick:()=>{R(oe),tn()},w:"100%",textAlign:"left",py:2,px:2,bg:"transparent",color:"ui.text",fontSize:"sm",borderRadius:"none",border:"none",borderBottomWidth:Qe===pn.length-1?"0":"0.5px",borderBottomColor:Y,borderBottomStyle:"solid",display:"flex",gap:1,_hover:{bg:de},_active:{bg:de},_focus:{outline:"none"},cursor:"pointer",children:o.jsx(tr.span,{color:we,children:oe})},`${oe}-${Qe}`))})}return null})()]})}),a?o.jsx(m,{ref:F,flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column",gap:4,minH:0,children:Xe.length===0?o.jsx(o.Fragment,{}):o.jsxs(o.Fragment,{children:[Xe.map(_=>o.jsxs(m,{display:"flex",flexDirection:"column",gap:2,children:[o.jsx(Rn,{message:{role:"user",content:_.user}}),o.jsx(Jh,{columns:2,gap:{base:2,sm:3,md:4},w:"100%",px:{base:1,md:0},alignItems:"stretch",children:Oe(_,ve)}),!v[_.id]&&_.left&&_.right&&o.jsxs(m,{w:"100%",maxW:"none",mx:0,display:"flex",flexDirection:"column",alignItems:"stretch",mt:4,children:[o.jsxs(Me,{justify:"center",gap:4,flexWrap:"wrap",w:"100%",children:[o.jsxs(We,{bg:"ui.sidebar",color:"ui.text",borderRadius:"1rem",border:"1px solid",fontWeight:"500",fontSize:"md",px:4,py:3,_hover:{bg:"ui.muted",borderColor:(K==null?void 0:K.pick)==="left"?"green.500":"ui.border"},_active:{bg:"ui.muted"},borderColor:_.decision==="left"||(K==null?void 0:K.pick)==="left"?"green.500":"ui.border",onMouseEnter:()=>U({turnId:_.id,pick:"left"}),onMouseLeave:()=>U(null),onClick:()=>J("left"),children:[o.jsx(m,{as:mu,mr:2,fontSize:"1.1em"}),"Left is Better"]}),o.jsxs(We,{bg:"ui.sidebar",color:"ui.text",borderRadius:"1rem",border:"1px solid",fontWeight:"500",fontSize:"md",px:4,py:3,_hover:{bg:"ui.muted",borderColor:(K==null?void 0:K.pick)==="tie"?"green.500":"ui.border"},_active:{bg:"ui.muted"},borderColor:_.decision==="tie"||(K==null?void 0:K.pick)==="tie"?"green.500":"ui.border",onMouseEnter:()=>U({turnId:_.id,pick:"tie"}),onMouseLeave:()=>U(null),onClick:()=>J("tie"),children:[o.jsx(m,{as:"span",mr:2,fontSize:"1.1em",children:"ð¤"}),"It's a tie"]}),o.jsxs(We,{bg:"ui.sidebar",color:je.battleText,borderRadius:"1rem",border:"1px solid",fontWeight:"500",fontSize:"md",px:4,py:3,_hover:{bg:je.battleHover,borderColor:(K==null?void 0:K.pick)==="bad"?"red.500":"ui.border"},_active:{bg:je.battleHover},borderColor:_.decision==="bad"||(K==null?void 0:K.pick)==="bad"?"red.500":"ui.border",onMouseEnter:()=>U({turnId:_.id,pick:"bad"}),onMouseLeave:()=>U(null),onClick:()=>J("bad"),children:[o.jsx(m,{as:ku,mr:2,fontSize:"1.1em"}),"Both are bad"]}),o.jsxs(We,{bg:"ui.sidebar",color:je.battleText,borderRadius:"1rem",border:"1px solid",fontWeight:"500",fontSize:"md",px:4,py:3,_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:(K==null?void 0:K.pick)==="right"?"green.500":le("ui.textSecondary","ui.border")},_active:{bg:le("ui.muted","ui.sidebar")},borderColor:_.decision==="right"||(K==null?void 0:K.pick)==="right"?"green.500":"ui.border",onMouseEnter:()=>U({turnId:_.id,pick:"right"}),onMouseLeave:()=>U(null),onClick:()=>J("right"),children:["Right is Better",o.jsx(m,{as:gu,ml:2,fontSize:"1.1em"})]})]}),o.jsxs(Me,{gap:4,alignItems:"start",mt:4,w:"100%",children:[o.jsxs(m,{flex:1,display:"flex",flexDirection:"column",children:[o.jsx(ra,{value:ie[_.id]??"",onChange:B=>{C(Y=>({...Y,[_.id]:B.target.value})),ue(Y=>({...Y,[_.id]:""}))},placeholder:"Please provide your feedback and submit it by pressing Enter or clicking Send.",bg:je.feedbackBg,color:je.feedbackText,borderRadius:"xl",border:"1px solid",borderColor:je.feedbackBorder,resize:"vertical",h:"5rem",minH:"5rem",onKeyDown:B=>
45{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),ee(_.id))}}),ne[_.id]!==void 0&&o.jsx(m,{color:"red.400",fontSize:"sm",mt:1,textAlign:"left",w:"100%",minHeight:"20px",visibility:ne[_.id]?"visible":"hidden",children:ne[_.id]||" "})]}),o.jsx(We,{size:"sm",bg:"ui.main",color:je.sendButtonText,borderRadius:"xl",_hover:{bg:je.sendButtonHover},onClick:()=>ee(_.id),disabled:!(_.decision||ie[_.id]&&ie[_.id].trim()),h:"5rem",minH:"5rem",children:"Send"})]})]})]},_.id)),o.jsx("div",{ref:ae})]})}):o.jsx(m,{flex:1,overflowY:"auto",position:"relative",children:o.jsx(m,{w:"100%",h:"100%",children:o.jsx(ZS,{ref:re,defaultModel:d,onModelChange:_=>{k(!0),f(_)},onThinkingModeChange:M,onKnowledgeAgentsChange:I,onKnowledgeEnabledChange:X,showModelSelector:!1,showInput:!0,availableModels:c,hideWelcomeMessage:!1,threadId:fe,threadHistory:Ze,externalKnowledgeAgents:z,onThreadClear:()=>{t({to:"/",search:{},replace:!0}),n.invalidateQueries({queryKey:["threadHistory"]})}})})})]}),!_e&&a&&o.jsx(m,{w:"100%",px:0,pb:0,pt:0,bg:"transparent",children:o.jsx(m,{position:"sticky",bottom:0,zIndex:5,bg:"ui.background",children:o.jsxs(m,{px:4,pb:4,pt:0,children:[o.jsx(m,{w:"100%",bg:"ui.sidebar",borderRadius:"xl",p:2,overflowX:"hidden",style:Yt?{opacity:.35,pointerEvents:"none"}:{},children:o.jsx(Dr,{ref:D,value:y,onChange:kn,onSend:pe,isLoading:Yt,thinkingModeEnabled:w,onThinkingModeChange:M,showKnowledgeToggle:!1,showCrisprToggle:!1,messages:Gt})}),o.jsx(m,{display:"flex",justifyContent:"center",pointerEvents:"none",mt:2,children:o.jsx(m,{as:"small",color:"ui.textSecondary",children:"Inputs are processed by third-party AI and responses may be inaccurate."})})]})})}),o.jsx(ad,{isOpen:De,onClose:()=>pt(!1)}),o.jsx(Po,{isOpen:he,onAccept:He,onError:Se})]})}const bc="terms_accepted",yc="user_terms_accepted_",bs="1.0",YS=(e=!0)=>{const[t,n]=x.useState(!1),[r,i]=x.useState(!0),s=x.useCallback(()=>{try{const d=localStorage.getItem("user");return d?JSON.parse(d):null}catch{return null}},[]),a=x.useCallback(()=>!!localStorage.getItem("access_token"),[]),l=x.useCallback(()=>{if(!e){n(!1),i(!1);return}try{const d=s();if(a()&&d){const p=`${yc}${d.id}`,h=localStorage.getItem(p);if(h){const g=JSON.parse(h);g.accepted&&g.version===bs?n(!1):n(!0)}else n(!0)}else{const p=localStorage.getItem(bc);if(p){const h=JSON.parse(p);h.accepted&&h.version===bs?n(!1):n(!0)}else n(!0)}}catch(d){console.error("Error checking terms acceptance:",d),n(!0)}finally{i(!1)}},[s,a,e]);x.useEffect(()=>{l()},[l]);const c=x.useCallback(()=>{const d={accepted:!0,version:bs,timestamp:new Date().toISOString()};try{const f=s();if(a()&&f){const h=`${yc}${f.id}`;localStorage.setItem(h,JSON.stringify(d))}else localStorage.setItem(bc,JSON.stringify(d));n(!1)}catch(f){console.error("Error saving terms acceptance:",f)}},[s,a]),u=()=>e&&t&&!r;return x.useEffect(()=>{const d=()=>{l()};window.addEventListener("storage",d);const f=setInterval(d,1e3);return()=>{window.removeEventListener("storage",d),clearInterval(f)}},[l]),{showTerms:u(),acceptTerms:c,isLoading:r}},xf=({children:e,enabled:t=!0})=>{const{showTerms:n,acceptTerms:r}=YS(t);return o.jsxs(o.Fragment,{children:[e,o.jsx(Po,{isOpen:n,onAccept:r})]})};function te(e,t,n){function r(l,c){var u;Object.defineProperty(l,"_zod",{value:l._zod??{},enumerable:!1}),(u=l._zod).traits??(u.traits=new Set),l._zod.traits.add(e),t(l,c);for(const d in a.prototype)d in l||Object.defineProperty(l,d,{value:a.prototype[d].bind(l)});l._zod.constr=a,l._zod.def=c}const i=(n==null?void 0:n.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function a(l){var c;const u=n!=null&&n.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var c,u;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class pi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const bf={};function yr(e){return bf}function KS(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function Gs(e,t){return typeof t=="bigint"?t.toString():t}function yf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $a(e){return e==null}function Wa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function JS(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=n>i?n:i,a=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return a%l/10**s}const wc=Symbol("evaluating");function wt(e,t,n){let r;
vendor: 5,166 bytes, line 45
45Object.defineProperty(e,t,{get(){if(r!==wc)return r===void 0&&(r=wc,r=n()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function XS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function vr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function qr(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function kc(e){return JSON.stringify(e)}const wf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ys(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const QS=yf(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function fo(e){if(Ys(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Ys(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function kf(e){return fo(e)?{...e}:e}const ev=new Set(["string","number","symbol"]);function No(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jr(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function Be(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new 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 tv(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const nv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function rv(e,t){const n=e._zod.def,r=qr(e._zod.def,{get shape(){const i={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(i[s]=n.shape[s])}return vr(this,"shape",i),i},checks:[]});return jr(e,r)}function iv(e,t){const n=e._zod.def,r=qr(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete i[s]}return vr(this,"shape",i),i},checks:[]});return jr(e,r)}function ov(e,t){if(!fo(t))throw new Error("Invalid input to extend: expected a plain object");const n=qr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vr(this,"shape",r),r},checks:[]});return jr(e,n)}function sv(e,t){const n=qr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return jr(e,n)}function av(e,t,n){const r=qr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=e?new e({type:"optional",innerType:i[a]}):i[a])}else for(const a in i)s[a]=e?new e({type:"optional",innerType:i[a]}):i[a];return vr(this,"shape",s),s},checks:[]});return jr(t,r)}function lv(e,t,n){const r=qr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(const a in i)s[a]=new e({type:"nonoptional",innerType:i[a]});return vr(this,"shape",s),s},checks:[]});return jr(t,r)}function oi(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Sf(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Mi(e){return typeof e=="string"?e:e==null?void 0:e.message}function wr(e,t,n){var i,s,a,l,c,u;const r={...e,path:e.path??[]};if(!e.message){const d=Mi((a=(s=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??Mi((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??Mi((c=n.customError)==null?void 0:c.call(n,e))??Mi((u=n.localeError)==null?void 0:u.call(n,e))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ua(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function mi(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const vf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Gs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},jf=te("$ZodError",vf),_f=te("$ZodError",vf,{Parent:Error});function cv(e,t=n=>n.message){const n={},r=[];for(const 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 uv(e,t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l
vendor: 19,021 bytes, lines 45-62
45=>i({issues:l}));else if(a.code==="invalid_key")i({issues:a.issues});else if(a.code==="invalid_element")i({issues:a.issues});else if(a.path.length===0)r._errors.push(n(a));else{let l=r,c=0;for(;c<a.path.length;){const u=a.path[c];c===a.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(a))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return i(e),r}const dv=e=>(t,n,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new pi;if(a.issues.length){const l=new((i==null?void 0:i.Err)??e)(a.issues.map(c=>wr(c,s,yr())));throw wf(l,i==null?void 0:i.callee),l}return a.value},fv=e=>async(t,n,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new((i==null?void 0:i.Err)??e)(a.issues.map(c=>wr(c,s,yr())));throw wf(l,i==null?void 0:i.callee),l}return a.value},Cf=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new pi;return s.issues.length?{success:!1,error:new(e??jf)(s.issues.map(a=>wr(a,i,yr())))}:{success:!0,data:s.value}},hv=Cf(_f),Ef=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>wr(a,i,yr())))}:{success:!0,data:s.value}},pv=Ef(_f),mv=/^[cC][^\s-]{8,}$/,gv=/^[0-9a-z]+$/,xv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bv=/^[0-9a-vA-V]{20}$/,yv=/^[A-Za-z0-9]{27}$/,wv=/^[a-zA-Z0-9_-]{21}$/,kv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sv=/^([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})$/,Sc=e=>e?new 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)$/,vv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _v(){return new RegExp(jv,"u")}const Cv=/^(?:(?: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])$/,Ev=/^(([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})$/,Av=/^((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])$/,Iv=/^(([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])$/,Rv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Af=/^[A-Za-z0-9_-]*$/,Tv=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,zv=/^\+(?:[0-9]){6,14}[0-9]$/,If="(?:(?:\\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])))",Fv=new RegExp(`^${If}$`);function Rf(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return 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+)?)?`}function Pv(e){return new RegExp(`^${Rf(e)}$`)}function Lv(e){const t=Rf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${If}T(?:${r})$`)}const Mv=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Dv=/^\d+$/,Ov=/^-?\d+(?:\.\d+)?/i,Bv=/^[^A-Z]*$/,Nv=/^[^a-z]*$/,hn=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tf={number:"number",bigint:"bigint",object:"date"},zf=te("$ZodCheckLessThan",(e,t)=>{hn.init(e,t);const n=Tf[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.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})}}),Ff=te("$ZodCheckGreaterThan",(e,t)=>{hn.init(e,t);const n=Tf[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.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})}}),$v=te("$ZodCheckMultipleOf",(e,t)=>{hn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):JS(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wv=te("$ZodCheckNumberFormat",(e,t)=>{var a;hn.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[i,s]=nv[t.format];e._zod.onattach.push(l=>{const c=l._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,n&&(c.pattern=Dv)}),e._zod.check=l=>{const c=l.value;if(n){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}c<i&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),c>s&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:e})}}),Uv=te("$ZodCheckMaxLength",(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!$a(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const a=Ua(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Hv=te("$ZodCheckMinLength",(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!$a(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const a=Ua(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),qv=te("$ZodCheckLengthEquals",(e,t)=>{var n;hn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!$a(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,s=i.length;if(s===t.length)return;const a=Ua(i),l=s>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),$o=te("$ZodCheckStringFormat",(e,t)=>{var n,r;hn.init(e,t),e._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Vv=te("$ZodCheckRegex",(e,t)=>{$o.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})}}),Zv=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bv),$o.init(e,t)}),Gv=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Nv),$o.init(e,t)}),Yv=te("$ZodCheckIncludes",(e,t)=>{hn.init(e,t);const n=No(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Kv=te("$ZodCheckStartsWith",(e,t)=>{hn.init(e,t);const n=new RegExp(`^${No(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Jv=te("$ZodCheckEndsWith",(e,t)=>{hn.init(e,t);const n=new RegExp(`.*${No(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Xv=te("$ZodCheckOverwrite",(e,t)=>{hn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Qv{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(` 46`).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,i.join(` 47`))}}const ej={major:4,minor:0,patch:17},Ft=te("$ZodType",(e,t)=>{var i;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ej;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const a of s._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(i=e._zod.deferred)==null||i.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,l,c)=>{let u=oi(a),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(u)continue;const p=a.issues.length,h=f._zod.check(a);if(h instanceof Promise&&(c==null?void 0:c.async)===!1)throw new pi;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==p&&(u||(u=oi(a,p)))});else{if(a.issues.length===p)continue;u||(u=oi(a,p))}}return d?d.then(()=>a):a};e._zod.run=(a,l)=>{const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new pi;return c.then(u=>s(u,r,l))}return s(c,r,l)}}e["~standard"]={validate:s=>{var a;try{const l=hv(e,s);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return pv(e,s).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Ha=te("$ZodString",(e,t)=>{var n;Ft.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Mv(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),St=te("$ZodStringFormat",(e,t)=>{$o.init(e,t),Ha.init(e,t)}),tj=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sv),St.init(e,t)}),nj=te("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Sc(r))}else t.pattern??(t.pattern=Sc());St.init(e,t)}),rj=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vv),St.init(e,t)}),ij=te("$ZodURL",(e,t)=>{St.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Tv.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})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),oj=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=_v()),St.init(e,t)}),sj=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=wv),St.init(e,t)}),aj=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mv),St.init(e,t)}),lj=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gv),St.init(e,t)}),cj=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xv),St.init(e,t)}),uj=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bv),St.init(e,t)}),dj=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yv),St.init(e,t)}),fj=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Lv(t)),St.init(e,t)}),hj=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Fv),St.init(e,t)}),pj=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Pv(t)),St.init(e,t)}),mj=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=kv),St.init(e,t)}),gj=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Cv),St.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),xj=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ev),St.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.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})}}}),bj=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Av),St.init(e,t)}),yj=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Iv),St.init(e,t),e._zod.check=n=>{const[r,i]=n.value.split("/");try{if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Pf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const wj=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Rv),St.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Pf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function kj(e){if(!Af.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pf(n)}const Sj=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Af),St.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{kj(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),vj=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=zv),St.init(e,t)});function jj(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const _j=te("$ZodJWT",(e,t)=>{St.init(e,t),e._zod.check=n=>{jj(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Lf=te("$ZodNumber",(e,t)=>{Ft.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ov,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=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,...s?{received:s}:{}}),n}}),Cj=te("$ZodNumber",(e,t)=>{Wv.init(e,t),Lf.init(e,t)}),Ej=te("$ZodUnknown",(e,t)=>{Ft.init(e,t),e._zod.parse=n=>n}),Aj=te("$ZodNever",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function vc(e,t,n){e.issues.length&&t.issues.push(...Sf(n,e.issues)),t.value[n]=e.value}const Ij=te("$ZodArray",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,r)=>{const 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);const s=[];for(let a=0;a<i.length;a++){const l=i[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>vc(u,n,a))):vc(c,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function Di(e,t,n,r){e.issues.length&&t.issues.push(...Sf(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const Rj=te("$ZodObject",(e,t)=>{Ft.init(e,t);const n=yf(()=>{const f=Object.keys(t.shape);for(const h of f)if(!t.shape[h]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const p=tv(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(p)}});wt(e._zod,"propValues",()=>{const f=t.shape,p={};for(const h in f){const g=f[h]._zod;if(g.values){p[h]??(p[h]=new Set);for(const k of g.values)p[h].add(k)}}return p});const r=f=>{const p=new Qv(["shape","payload","ctx"]),h=n.value,g=y=>{const R=kc(y);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};p.write("const input = payload.value;");const k=Object.create(null);let b=0;for(const y of h.keys)k[y]=`key_${b++}`;p.write("const newResult = {}");for(const y of h.keys){const R=k[y],L=kc(y);p.write(`const ${R} = ${g(y)};`),p.write(` 48 if (${R}.issues.length) { 49 payload.issues = payload.issues.concat(${R}.issues.map(iss => ({ 50 ...iss, 51 path: iss.path ? [${L}, ...iss.path] : [${L}] 52 }))); 53 } 54 55 if (${R}.value === undefined) { 56 if (${L} in input) { 57 newResult[${L}] = undefined; 58 } 59 } else { 60 newResult[${L}] = ${R}.value; 61 } 62 `)}p.write("payload.value = newResult;"),p.write("return payload;");const S=p.compile();return(y,R)=>S(f,y,R)};let i;const s=Ys,a=!bf.jitless,c=a&&QS.value,u=t.catchall;let d;e._zod.parse=(f,p)=>{d??(d=n.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;const g=[];
vendor: 4,434 bytes, line 62
62if(a&&c&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)i||(i=r(t.shape)),f=i(f,p);else{f.value={};const R=d.shape;for(const L of d.keys){const T=R[L]._zod.run({value:h[L],issues:[]},p);T instanceof Promise?g.push(T.then(Z=>Di(Z,f,L,h))):Di(T,f,L,h)}}if(!u)return g.length?Promise.all(g).then(()=>f):f;const k=[],b=d.keySet,S=u._zod,y=S.def.type;for(const R of Object.keys(h)){if(b.has(R))continue;if(y==="never"){k.push(R);continue}const L=S.run({value:h[R],issues:[]},p);L instanceof Promise?g.push(L.then(O=>Di(O,f,R,h))):Di(L,f,R,h)}return k.length&&f.issues.push({code:"unrecognized_keys",keys:k,input:h,inst:e}),g.length?Promise.all(g).then(()=>f):f}});function jc(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!oi(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>wr(a,r,yr())))}),t)}const Tj=te("$ZodUnion",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),wt(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),wt(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),wt(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Wa(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,s)=>{if(n)return r(i,s);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)l.push(u),a=!0;else{if(u.issues.length===0)return u;l.push(u)}}return a?Promise.all(l).then(c=>jc(c,i,e,s)):jc(l,i,e,s)}}),zj=te("$ZodIntersection",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,s=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,u])=>_c(n,c,u)):_c(n,s,a)}});function Ks(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fo(e)&&fo(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),i={...e,...t};for(const s of r){const a=Ks(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};i[s]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r],a=Ks(i,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _c(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),oi(e))return e;const r=Ks(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Fj=te("$ZodEnum",(e,t)=>{Ft.init(e,t);const n=KS(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>ev.has(typeof i)).map(i=>typeof i=="string"?No(i):i.toString()).join("|")})$`),e._zod.parse=(i,s)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:n,input:a,inst:e}),i}}),Pj=te("$ZodTransform",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,r)=>{const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(n.value=a,n));if(i instanceof Promise)throw new pi;return n.value=i,n}});function Cc(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Lj=te("$ZodOptional",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",e._zod.optout="optional",wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),wt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wa(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Cc(s,n.value)):Cc(i,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Mj=te("$ZodNullable",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.innerType._zod.optin),wt(e._zod,"optout",()=>t.innerType._zod.optout),wt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wa(n.source)}|null)$`):void 0}
vendor: 7,418 bytes, line 62
62),wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Dj=te("$ZodDefault",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Ec(s,t)):Ec(i,t)}});function Ec(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Oj=te("$ZodPrefault",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Bj=te("$ZodNonOptional",(e,t)=>{Ft.init(e,t),wt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Ac(s,e)):Ac(i,e)}});function Ac(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nj=te("$ZodCatch",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.innerType._zod.optin),wt(e._zod,"optout",()=>t.innerType._zod.optout),wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>wr(a,r,yr()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>wr(s,r,yr()))},input:n.value}),n.issues=[]),n)}}),$j=te("$ZodPipe",(e,t)=>{Ft.init(e,t),wt(e._zod,"values",()=>t.in._zod.values),wt(e._zod,"optin",()=>t.in._zod.optin),wt(e._zod,"optout",()=>t.out._zod.optout),wt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Ic(s,t,r)):Ic(i,t,r)}});function Ic(e,t,n){return e.issues.length?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const Wj=te("$ZodReadonly",(e,t)=>{Ft.init(e,t),wt(e._zod,"propValues",()=>t.innerType._zod.propValues),wt(e._zod,"values",()=>t.innerType._zod.values),wt(e._zod,"optin",()=>t.innerType._zod.optin),wt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(Rc):Rc(i)}});function Rc(e){return e.value=Object.freeze(e.value),e}const Uj=te("$ZodCustom",(e,t)=>{hn.init(e,t),Ft.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>Tc(s,n,r,e));Tc(i,n,r,e)}});function Tc(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(mi(i))}}class Hj{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qj(){return new Hj}const Oi=qj();function Vj(e,t){return new e({type:"string",...Be(t)})}function Zj(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Be(t)})}function zc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Be(t)})}function Gj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Be(t)})}function Yj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Be(t)})}function Kj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Be(t)})}function Jj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Be(t)})}function Xj(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Be(t)})}function Qj(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Be(t)})}function e_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Be(t)})}function t_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Be(t)})}function n_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Be(t)})}function r_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Be(t)})}function i_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Be(t)})}function o_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Be(t)})}function s_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Be(t)})}function a_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Be(t)})}function l_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Be(t)})}function c_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Be(t)})}function u_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Be(t)})}function d_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Be(t)})}function f_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Be(t)})}function h_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Be(t)})}function p_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Be(t)})}function m_(e,t){return new e({type:"string",format:"date",check:"string_format",...Be(t)})}function g_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Be(t)})}function x_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Be(t)})}function b_(e,t){return new e({type:"number",checks:[],...Be(t)})}function y_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Be(t)})}function w_(e){return new e({type:"unknown"})}function k_(e,t){return new e({type:"never",...Be(t)})}function Fc(e,t){return new zf({check:"less_than",...Be(t),value:e,inclusive:!1})}function ys(e,t){return new zf({check:"less_than",...Be(t),value:e,inclusive:!0})}function Pc(e,t){return new Ff({check:"greater_than",...Be(t),value:e,inclusive:!1})}function ws(e,t){return new Ff({check:"greater_than",...Be(t),value:e,inclusive:!0})}function Lc(e,t){return new $v({check:"multiple_of",...Be(t),value:e})}function Mf(e,t){return new Uv({check:"max_length",...Be(t),maximum:e})}function ho(e,t){return new Hv({check:"min_length",...Be(t),minimum:e})}function Df(e,t){return new qv({check:"length_equals",...Be(t),length:e})}function S_(e,t){return new Vv({check:"string_format",format:"regex",...Be(t),pattern:e})}function v_(e){return new Zv({check:"string_format",format:"lowercase",...Be(e)})}
vendor: 4,580 bytes, line 62
62function j_(e){return new Gv({check:"string_format",format:"uppercase",...Be(e)})}function __(e,t){return new Yv({check:"string_format",format:"includes",...Be(t),includes:e})}function C_(e,t){return new Kv({check:"string_format",format:"starts_with",...Be(t),prefix:e})}function E_(e,t){return new Jv({check:"string_format",format:"ends_with",...Be(t),suffix:e})}function Ei(e){return new Xv({check:"overwrite",tx:e})}function A_(e){return Ei(t=>t.normalize(e))}function I_(){return Ei(e=>e.trim())}function R_(){return Ei(e=>e.toLowerCase())}function T_(){return Ei(e=>e.toUpperCase())}function z_(e,t,n){return new e({type:"array",element:t,...Be(n)})}function F_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Be(n)})}function P_(e){const t=L_(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(mi(r,n.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(mi(i))}},e(n.value,n)));return t}function L_(e,t){const n=new hn({check:"custom",...Be(t)});return n._zod.check=e,n}const M_=te("ZodISODateTime",(e,t)=>{fj.init(e,t),Ct.init(e,t)});function D_(e){return p_(M_,e)}const O_=te("ZodISODate",(e,t)=>{hj.init(e,t),Ct.init(e,t)});function B_(e){return m_(O_,e)}const N_=te("ZodISOTime",(e,t)=>{pj.init(e,t),Ct.init(e,t)});function $_(e){return g_(N_,e)}const W_=te("ZodISODuration",(e,t)=>{mj.init(e,t),Ct.init(e,t)});function U_(e){return x_(W_,e)}const H_=(e,t)=>{jf.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>uv(e,n)},flatten:{value:n=>cv(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Gs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Gs,2)}},isEmpty:{get(){return e.issues.length===0}}})},Wo=te("ZodError",H_,{Parent:Error}),q_=dv(Wo),V_=fv(Wo),Z_=Cf(Wo),G_=Ef(Wo),Ot=te("ZodType",(e,t)=>(Ft.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>jr(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>q_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Z_(e,n,r),e.parseAsync=async(n,r)=>V_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>G_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(B2(n,r)),e.superRefine=n=>e.check(N2(n)),e.overwrite=n=>e.check(Ei(n)),e.optional=()=>Bc(e),e.nullable=()=>Nc(e),e.nullish=()=>Bc(Nc(e)),e.nonoptional=n=>z2(e,n),e.array=()=>b2(e),e.or=n=>k2([e,n]),e.and=n=>v2(e,n),e.transform=n=>$c(e,C2(n)),e.default=n=>I2(e,n),e.prefault=n=>T2(e,n),e.catch=n=>P2(e,n),e.pipe=n=>$c(e,n),e.readonly=()=>D2(e),e.describe=n=>{const r=e.clone();return Oi.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Oi.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Oi.get(e);const r=e.clone();return Oi.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Of=te("_ZodString",(e,t)=>{Ha.init(e,t),Ot.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(S_(...r)),e.includes=(...r)=>e.check(__(...r)),e.startsWith=(...r)=>e.check(C_(...r)),e.endsWith=(...r)=>e.check(E_(...r)),e.min=(...r)=>e.check(ho(...r)),e.max=(...r)=>e.check(Mf(...r)),e.length=(...r)=>e.check(Df(...r)),e.nonempty=(...r)=>e.check(ho(1,...r)),e.lowercase=r=>e.check(v_(r)),e.uppercase=r=>e.check(j_(r)),e.trim=()=>e.check(I_()),e.normalize=(...r)=>e.check(A_(...r)),e.toLowerCase=()=>e.check(R_()),e.toUpperCase=()=>e.check(T_())}),Y_=te("ZodString",(e,t)=>{Ha.init(e,t),Of.init(e,t),e.email=n=>e.check(Zj(K_,n)),e.url=n=>e.check(Xj(J_,n)),e.jwt=n=>e.check(h_(f2,n)),e.emoji=n=>e.check(Qj(X_,n)),e.guid=n=>e.check(zc(Mc,n)),e.uuid=n=>e.check(Gj(Bi,n)),e.uuidv4=n=>e.check(Yj(Bi,n)),e.uuidv6=n=>e.check(Kj(Bi,n)),e.uuidv7=n=>e.check(Jj(Bi,n)),e.nanoid=n=>e.check(e_(Q_,n)),e.guid=n=>e.check(zc(Mc,n)),e.cuid=n=>e.check(t_(e2,n)),e.cuid2=n=>e.check(n_(t2,n)),e.ulid=n=>e.check(r_(n2,n)),e.base64=n=>e.check(u_(c2,n)),e.base64url=n=>e.check(d_(u2,n)),e.xid=n=>e.check(i_(r2,n)),e.ksuid=n=>e.check(o_(i2,n)),e.ipv4=n=>e.check(s_(o2,n)),e.ipv6=n=>e.check(a_(s2,n)),e.cidrv4=n=>e.check(l_(a2,n)),e.cidrv6=n=>e.check(c_(l2,n)),e.e164=n=>e.check(f_(d2,n)),e.datetime=n=>e.check(D_(n)),e.date=n=>e.check(B_(n)),e.time=n=>e.check($_(n)),e.duration=n=>
vendor: 4,398 bytes, line 62
62e.check(U_(n))});function si(e){return Vj(Y_,e)}const Ct=te("ZodStringFormat",(e,t)=>{St.init(e,t),Of.init(e,t)}),K_=te("ZodEmail",(e,t)=>{rj.init(e,t),Ct.init(e,t)}),Mc=te("ZodGUID",(e,t)=>{tj.init(e,t),Ct.init(e,t)}),Bi=te("ZodUUID",(e,t)=>{nj.init(e,t),Ct.init(e,t)}),J_=te("ZodURL",(e,t)=>{ij.init(e,t),Ct.init(e,t)}),X_=te("ZodEmoji",(e,t)=>{oj.init(e,t),Ct.init(e,t)}),Q_=te("ZodNanoID",(e,t)=>{sj.init(e,t),Ct.init(e,t)}),e2=te("ZodCUID",(e,t)=>{aj.init(e,t),Ct.init(e,t)}),t2=te("ZodCUID2",(e,t)=>{lj.init(e,t),Ct.init(e,t)}),n2=te("ZodULID",(e,t)=>{cj.init(e,t),Ct.init(e,t)}),r2=te("ZodXID",(e,t)=>{uj.init(e,t),Ct.init(e,t)}),i2=te("ZodKSUID",(e,t)=>{dj.init(e,t),Ct.init(e,t)}),o2=te("ZodIPv4",(e,t)=>{gj.init(e,t),Ct.init(e,t)}),s2=te("ZodIPv6",(e,t)=>{xj.init(e,t),Ct.init(e,t)}),a2=te("ZodCIDRv4",(e,t)=>{bj.init(e,t),Ct.init(e,t)}),l2=te("ZodCIDRv6",(e,t)=>{yj.init(e,t),Ct.init(e,t)}),c2=te("ZodBase64",(e,t)=>{wj.init(e,t),Ct.init(e,t)}),u2=te("ZodBase64URL",(e,t)=>{Sj.init(e,t),Ct.init(e,t)}),d2=te("ZodE164",(e,t)=>{vj.init(e,t),Ct.init(e,t)}),f2=te("ZodJWT",(e,t)=>{_j.init(e,t),Ct.init(e,t)}),Bf=te("ZodNumber",(e,t)=>{Lf.init(e,t),Ot.init(e,t),e.gt=(r,i)=>e.check(Pc(r,i)),e.gte=(r,i)=>e.check(ws(r,i)),e.min=(r,i)=>e.check(ws(r,i)),e.lt=(r,i)=>e.check(Fc(r,i)),e.lte=(r,i)=>e.check(ys(r,i)),e.max=(r,i)=>e.check(ys(r,i)),e.int=r=>e.check(Dc(r)),e.safe=r=>e.check(Dc(r)),e.positive=r=>e.check(Pc(0,r)),e.nonnegative=r=>e.check(ws(0,r)),e.negative=r=>e.check(Fc(0,r)),e.nonpositive=r=>e.check(ys(0,r)),e.multipleOf=(r,i)=>e.check(Lc(r,i)),e.step=(r,i)=>e.check(Lc(r,i)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Nf(e){return b_(Bf,e)}const h2=te("ZodNumberFormat",(e,t)=>{Cj.init(e,t),Bf.init(e,t)});function Dc(e){return y_(h2,e)}const p2=te("ZodUnknown",(e,t)=>{Ej.init(e,t),Ot.init(e,t)});function Oc(){return w_(p2)}const m2=te("ZodNever",(e,t)=>{Aj.init(e,t),Ot.init(e,t)});function g2(e){return k_(m2,e)}const x2=te("ZodArray",(e,t)=>{Ij.init(e,t),Ot.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ho(n,r)),e.nonempty=n=>e.check(ho(1,n)),e.max=(n,r)=>e.check(Mf(n,r)),e.length=(n,r)=>e.check(Df(n,r)),e.unwrap=()=>e.element});function b2(e,t){return z_(x2,e,t)}const y2=te("ZodObject",(e,t)=>{Rj.init(e,t),Ot.init(e,t),wt(e,"shape",()=>t.shape),e.keyof=()=>j2(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Oc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Oc()}),e.strict=()=>e.clone({...e._zod.def,catchall:g2()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ov(e,n),e.merge=n=>sv(e,n),e.pick=n=>rv(e,n),e.omit=n=>iv(e,n),e.partial=(...n)=>av($f,e,n[0]),e.required=(...n)=>lv(Wf,e,n[0])});function Uo(e,t){const n={type:"object",get shape(){return vr(this,"shape",e?XS(e):{}),this.shape},...Be(t)};return new y2(n)}const w2=te("ZodUnion",(e,t)=>{Tj.init(e,t),Ot.init(e,t),e.options=t.options});function k2(e,t){return new w2({type:"union",options:e,...Be(t)})}const S2=te("ZodIntersection",(e,t)=>{zj.init(e,t),Ot.init(e,t)});function v2(e,t){return new S2({type:"intersection",left:e,right:t})}const Js=te("ZodEnum",(e,t)=>{Fj.init(e,t),Ot.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Js({...t,checks:[],...Be(i),entries:s})},e.exclude=(r,i)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Js({...t,checks:[],...Be(i),entries:s})}});function j2(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Js({type:"enum",entries:n,...Be(t)})}const _2=te("ZodTransform",(e,t)=>{Pj.init(e,t),Ot.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=s=>{if(typeof s=="string")n.issues.push(mi(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(mi(a))}};
62const i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function C2(e){return new _2({type:"transform",transform:e})}const $f=te("ZodOptional",(e,t)=>{Lj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bc(e){return new $f({type:"optional",innerType:e})}const E2=te("ZodNullable",(e,t)=>{Mj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new E2({type:"nullable",innerType:e})}const A2=te("ZodDefault",(e,t)=>{Dj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function I2(e,t){return new A2({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():kf(t)}})}const R2=te("ZodPrefault",(e,t)=>{Oj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function T2(e,t){return new R2({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():kf(t)}})}const Wf=te("ZodNonOptional",(e,t)=>{Bj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function z2(e,t){return new Wf({type:"nonoptional",innerType:e,...Be(t)})}const F2=te("ZodCatch",(e,t)=>{Nj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function P2(e,t){return new F2({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const L2=te("ZodPipe",(e,t)=>{$j.init(e,t),Ot.init(e,t),e.in=t.in,e.out=t.out});function $c(e,t){return new L2({type:"pipe",in:e,out:t})}const M2=te("ZodReadonly",(e,t)=>{Wj.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function D2(e){return new M2({type:"readonly",innerType:e})}const O2=te("ZodCustom",(e,t)=>{Uj.init(e,t),Ot.init(e,t)});function B2(e,t={}){return F_(O2,e,t)}function N2(e){return P_(e)}const $2=Uo({mode:si().optional(),threadId:si().optional(),clear:si().optional()}),W2=Qt("/_layout/")({component:U2,validateSearch:e=>$2.parse(e),beforeLoad:async()=>{if(!localStorage.getItem("access_token")&&!!localStorage.getItem("guest_fingerprint"))throw $n({to:"/battle"});if(localStorage.getItem("access_token"))try{const n=localStorage.getItem("user");if(n){if(!JSON.parse(n).is_superuser)throw $n({to:"/battle"})}else throw $n({to:"/battle"})}catch{throw $n({to:"/battle"})}}});function U2(){return o.jsx(xf,{enabled:!1,children:o.jsx(GS,{})})}const H2=Qt("/auth/callback")({component:q2});function q2(){const e=un(),t=Ht(),[n,r]=x.useState("Authenticatingâ¦");x.useEffect(()=>{const s=new URLSearchParams(window.location.search),a=s.get("code"),l=s.get("error"),c=`${window.location.origin}/auth/callback`;if(l){r("Authentication was cancelled or failed");return}if(!a){r("No authorization code received");return}(async()=>{try{const d=Fn(),f=await fetch("https://api.biomedarena.ai/api/v1/oauth/google/callback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirect_uri:c,fingerprint_hash:d})});if(!f.ok){const h=await f.json().catch(()=>null);throw new Error((h==null?void 0:h.detail)||"Authentication failed")}const p=await f.json();localStorage.setItem("access_token",p.access_token),Mr("login","google_oauth"),td(),t.invalidateQueries({queryKey:["currentUser"]}),r("Success! Redirectingâ¦"),setTimeout(()=>{e({to:"/"})},1200)}catch(d){Mr("login","google_oauth_failed"),r(d.message||"An unexpected error occurred")}})()},[e,t]);const i=n.startsWith("Authenticating")||n.startsWith("Success");return o.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",fontFamily:"Inter, system-ui, sans-serif",bg:"ui.background",color:"ui.text",children:o.jsx(m,{textAlign:"center",p:8,borderRadius:"xl",bg:"ui.surface",border:"1px solid",borderColor:"ui.border",maxWidth:"400px",width:"100%",children:o.jsxs(ut,{gap:4,children:[o.jsx(m,{children:i?o.jsx(cn,{size:"lg",color:"ui.main"}):o.jsx(m,{width:"2rem",height:"2rem",borderRadius:"50%",bg:"red.500",mx:"auto"})}),o.jsx(N,{fontSize:"xl",fontWeight:"600",color:"ui.text",children:i?"Authenticating...":"Authentication Failed"}),o.jsx(N,{color:"ui.textSecondary",fontSize:"sm",children:n})]})})})}const ks=x.forwardRef(function(t,n){const{children:r,inputProps:i,rootRef:s,...a}=t;return o.jsxs(Xh,{ref:s,...a,children:[o.jsx(Qh,{ref:n,...i}),o.jsx(ep,{}),r&&o.jsx(tp,{children:r})]})}),V2=np,Z2=()=>{const{theme:e,setTheme:t}=ju(),{isGuest:n}=dn();return o.jsx(o.Fragment,{children:o.jsxs(Pn,{maxW:"full",children:[o.jsx(Te,{size:"sm",py:4,children:"Theme"}),n&&o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",mb:4,children:"Change the appearance theme. Your preference will be saved locally."}),o.jsx(V2,{onValueChange:r=>{(r.value==="system"||r.value==="light"||r.value==="dark")&&t(r.value)},value:e||"system",colorPalette:"teal",children:o.jsxs(hr,{children:[o.jsx(ks,{value:"system",children:"System"}),o.jsx(ks,{value:"light",children:"Light Mode"}),o.jsx(ks,{value:"dark",children:"Dark Mode"})]})})]})})},G2=()=>{var b;const e=Ht(),{showSuccessToast:t}
62=Ln(),[n,r]=x.useState(!1),{user:i}=dn(),{register:s,handleSubmit:a,reset:l,getValues:c,formState:{isSubmitting:u,errors:d,isDirty:f}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{full_name:i==null?void 0:i.full_name,email:i==null?void 0:i.email}}),p=()=>{r(!n)},h=xn({mutationFn:S=>er.updateUserMe({requestBody:S}),onSuccess:S=>{t("User updated successfully."),l({full_name:S.full_name,email:S.email}),r(!1)},onError:S=>{Wn(S)},onSettled:()=>{e.invalidateQueries()}}),g=async S=>{h.mutate(S)},k=()=>{l(),p()};return o.jsx(o.Fragment,{children:o.jsxs(Pn,{maxW:"full",children:[o.jsx(Te,{size:"sm",py:4,children:"User Information"}),o.jsxs(m,{w:{sm:"full",md:"sm"},as:"form",onSubmit:a(g),children:[o.jsx(_t,{label:"Full name",children:n?o.jsx(Mt,{...s("full_name",{maxLength:30}),type:"text",size:"md"}):o.jsx(N,{fontSize:"md",py:2,color:i!=null&&i.full_name?"inherit":"gray",truncate:!0,maxW:"sm",children:(i==null?void 0:i.full_name)||"N/A"})}),o.jsx(_t,{mt:4,label:"Email",invalid:!!d.email,errorText:(b=d.email)==null?void 0:b.message,children:n?o.jsx(Mt,{...s("email",{required:"Email is required",pattern:$r}),type:"email",size:"md"}):o.jsx(N,{fontSize:"md",py:2,truncate:!0,maxW:"sm",children:i==null?void 0:i.email})}),o.jsxs(Me,{mt:4,gap:3,children:[o.jsx(We,{variant:"solid",onClick:n?void 0:()=>r(!0),type:n?"submit":"button",loading:n?u:!1,disabled:n?!f||!c("email")||u:!1,children:n?"Save":"Edit"}),n&&o.jsx(We,{variant:"subtle",colorPalette:"gray",onClick:k,disabled:u,children:"Cancel"})]})]})]})})},Ss=[{value:"my-profile",title:"My profile",component:G2},{value:"appearance",title:"Appearance",component:Z2}],Y2=Qt("/_layout/settings")({component:K2});function K2(){const{user:e,isGuest:t}=dn();let n;return t?n=Ss.filter(r=>r.value==="appearance"):e!=null&&e.is_superuser?n=Ss.slice(0,3):n=Ss,o.jsxs(Pn,{maxW:"full",children:[o.jsx(Te,{size:"lg",textAlign:{base:"center",md:"left"},py:12,children:t?"Guest User Settings":"User Settings"}),o.jsxs(js,{defaultValue:t?"appearance":"my-profile",variant:"subtle",children:[o.jsx(_s,{children:n.map(r=>o.jsx(Xr,{value:r.value,children:r.title},r.value))}),n.map(r=>o.jsx(Qr,{value:r.value,children:o.jsx(r.component,{})},r.value))]})]})}const ei=x.forwardRef(function(t,n){const{children:r,rootRef:i,...s}=t;return o.jsx("select",{ref:n||i,...s,children:r})});var Gi={exports:{}};/* @license
63Papa Parse 64v5.5.3 65https://github.com/mholt/PapaParse 66License: MIT 67*/var J2=Gi.exports,Wc;function X2(){return Wc||(Wc=1,(function(e,t){((n,r)=>{e.exports=r()})(J2,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},i,s=!r.document&&!!r.postMessage,a=r.IS_PAPA_WORKER||!1,l={},c=0,u={};function d(j){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var w=O(E);w.chunkSize=parseInt(w.chunkSize),E.step||E.chunk||(w.chunkSize=null),this._handle=new k(w),(this._handle.streamer=this)._config=w}).call(this,j),this.parseChunk=function(E,w){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let I=this._config.newline;I||(z=this._config.quoteChar||'"',I=this._handle.guessLineEndings(E,z)),E=[...E.split(I).slice(M)].join(I)}this.isFirstChunk&&Z(this._config.beforeFirstChunk)&&(z=this._config.beforeFirstChunk(E))!==void 0&&(E=z),this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+E,z=(this._partialLine="",this._handle.parse(M,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=z.meta.cursor,M=(this._finished||(this._partialLine=M.substring(E-this._baseIndex),this._baseIndex=E),z&&z.data&&(this._rowCount+=z.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),a)r.postMessage({results:z,workerId:u.WORKER_ID,finished:M});else if(Z(this._config.chunk)&&!w){if(this._config.chunk(z,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=z=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(z.data),this._completeResults.errors=this._completeResults.errors.concat(z.errors),this._completeResults.meta=z.meta),this._completed||!M||!Z(this._config.complete)||z&&z.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),M||z&&z.meta.paused||this._nextChunk(),z}this._halted=!0},this._sendError=function(E){Z(this._config.error)?this._config.error(E):a&&this._config.error&&r.postMessage({workerId:u.WORKER_ID,error:E,finished:!1})}}function f(j){var E;(j=j||{}).chunkSize||(j.chunkSize=u.RemoteChunkSize),d.call(this,j),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(w){this._input=w,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),s||(E.onload=T(this._chunkLoaded,this),E.onerror=T(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var w,M=this._config.downloadRequestHeaders;for(w in M)E.setRequestHeader(w,M[w])}var z;this._config.chunkSize&&(z=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+z));try{E.send(this._config.downloadRequestBody)}catch(I){this._chunkError(I.message)}s&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(w=>(w=w.getResponseHeader("Content-Range"))!==null?parseInt(w.substring(w.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(w){w=E.statusText||w,this._sendError(new Error(w))}}function p(j){(j=j||{}).chunkSize||(j.chunkSize=u.LocalChunkSize),d.call(this,j);var E,w,M=typeof FileReader<"u";this.stream=function(z){this._input=z,w=z.slice||z.webkitSlice||z.mozSlice,M?((E=new FileReader).onload=T(this._chunkLoaded,this),E.onerror=T(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var z=this._input,I=(this._config.chunkSize&&(I=Math.min(this._start+this._config.chunkSize,this._input.size),z=w.call(z,this._start,I)),E.readAsText(z,this._config.encoding));M||this._chunkLoaded({target:{result:I}})},this._chunkLoaded=function(z){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(z.target.result)},this._chunkError=function(){this._sendError(E.error)}}function h(j){var E;d.call(this,j=j||{}),this.stream=function(w){return E=w,this._nextChunk()},this._nextChunk=function(){var w,M;if(!this._finished)return w=this._config.chunkSize,E=w?(M=E.substring(0,w),E.substring(w)):(M=E,""),this._finished=!E,this.parseChunk(M)}}function g(j){d.call(this,j=j||{});var E=[],w=!0,M=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(z){this._input=z,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){M&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):w=!0},this._streamData=T(function(z){try{E.push(typeof z=="string"?z:z.toString(this._config.encoding)),w&&(w=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(I){this._streamError(I)}},this),this._streamError=T(function(z){this._streamCleanUp(),this._sendError(z)},this),this._streamEnd=T(function(){this._streamCleanUp(),M=!0,this._streamData("")},this),this._streamCleanUp=T(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function k(j){var E,w,M,z,I=Math.pow(2,53),$=-I,X=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,xe=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,K=this,U=0,ie=0,C=!1,ne=!1,ue=[],v={data:[],errors:[],meta:{}};function ze(Se){return j.skipEmptyLines==="greedy"?Se.join("").trim()==="":Se.length===1&&Se[0].length===0}function he(){if(v&&M&&(et("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),M=!1),j.skipEmptyLines&&(v.data=v.data.filter(function(ve){return!ze(ve)})),Pe()){let ve=function(Ae,je){Z(j.transformHeader)&&(Ae=j.transformHeader(Ae,je)),ue.push(Ae)};if(v)if(Array.isArray(v.data[0])){for(var Se=0;Pe()&&Se<v.data.length;Se++)v.data[Se].forEach(ve);v.data.splice(0,1)}else v.data.forEach(ve)}function Ie(ve,Ae){for(var je=j.header?{}:[],Ce=0;Ce<ve.length;
vendor: 9,370 bytes, lines 67-75
67Ce++){var Ee=Ce,De=ve[Ce],De=((pt,Fe)=>(A=>(j.dynamicTypingFunction&&j.dynamicTyping[A]===void 0&&(j.dynamicTyping[A]=j.dynamicTypingFunction(A)),(j.dynamicTyping[A]||j.dynamicTyping)===!0))(pt)?Fe==="true"||Fe==="TRUE"||Fe!=="false"&&Fe!=="FALSE"&&((A=>{if(X.test(A)&&(A=parseFloat(A),$<A&&A<I))return 1})(Fe)?parseFloat(Fe):xe.test(Fe)?new Date(Fe):Fe===""?null:Fe):Fe)(Ee=j.header?Ce>=ue.length?"__parsed_extra":ue[Ce]:Ee,De=j.transform?j.transform(De,Ee):De);Ee==="__parsed_extra"?(je[Ee]=je[Ee]||[],je[Ee].push(De)):je[Ee]=De}return j.header&&(Ce>ue.length?et("FieldMismatch","TooManyFields","Too many fields: expected "+ue.length+" fields but parsed "+Ce,ie+Ae):Ce<ue.length&&et("FieldMismatch","TooFewFields","Too few fields: expected "+ue.length+" fields but parsed "+Ce,ie+Ae)),je}var Ve;v&&(j.header||j.dynamicTyping||j.transform)&&(Ve=1,!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(Ie),Ve=v.data.length):v.data=Ie(v.data,0),j.header&&v.meta&&(v.meta.fields=ue),ie+=Ve)}function Pe(){return j.header&&ue.length===0}function et(Se,Ie,Ve,ve){Se={type:Se,code:Ie,message:Ve},ve!==void 0&&(Se.row=ve),v.errors.push(Se)}Z(j.step)&&(z=j.step,j.step=function(Se){v=Se,Pe()?he():(he(),v.data.length!==0&&(U+=Se.data.length,j.preview&&U>j.preview?w.abort():(v.data=v.data[0],z(v,K))))}),this.parse=function(Se,Ie,Ve){var ve=j.quoteChar||'"',ve=(j.newline||(j.newline=this.guessLineEndings(Se,ve)),M=!1,j.delimiter?Z(j.delimiter)&&(j.delimiter=j.delimiter(Se),v.meta.delimiter=j.delimiter):((ve=((Ae,je,Ce,Ee,De)=>{var pt,Fe,A,W;De=De||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var H=0;H<De.length;H++){for(var se,re=De[H],Q=0,me=0,D=0,q=(A=void 0,new S({comments:Ee,delimiter:re,newline:je,preview:10}).parse(Ae)),fe=0;fe<q.data.length;fe++)Ce&&ze(q.data[fe])?D++:(se=q.data[fe].length,me+=se,A===void 0?A=se:0<se&&(Q+=Math.abs(se-A),A=se));0<q.data.length&&(me/=q.data.length-D),(Fe===void 0||Q<=Fe)&&(W===void 0||W<me)&&1.99<me&&(Fe=Q,pt=re,W=me)}return{successful:!!(j.delimiter=pt),bestDelimiter:pt}})(Se,j.newline,j.skipEmptyLines,j.comments,j.delimitersToGuess)).successful?j.delimiter=ve.bestDelimiter:(M=!0,j.delimiter=u.DefaultDelimiter),v.meta.delimiter=j.delimiter),O(j));return j.preview&&j.header&&ve.preview++,E=Se,w=new S(ve),v=w.parse(E,Ie,Ve),he(),C?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return C},this.pause=function(){C=!0,w.abort(),E=Z(j.chunk)?"":E.substring(w.getCharIndex())},this.resume=function(){K.streamer._halted?(C=!1,K.streamer.parseChunk(E,!0)):setTimeout(K.resume,3)},this.aborted=function(){return ne},this.abort=function(){ne=!0,w.abort(),v.meta.aborted=!0,Z(j.complete)&&j.complete(v),E=""},this.guessLineEndings=function(Ae,ve){Ae=Ae.substring(0,1048576);var ve=new RegExp(b(ve)+"([^]*?)"+b(ve),"gm"),Ve=(Ae=Ae.replace(ve,"")).split("\r"),ve=Ae.split(` 68`),Ae=1<ve.length&&ve[0].length<Ve[0].length;if(Ve.length===1||Ae)return` 69`;for(var je=0,Ce=0;Ce<Ve.length;Ce++)Ve[Ce][0]===` 70`&&je++;return je>=Ve.length/2?`\r 71`:"\r"}}function b(j){return j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(j){var E=(j=j||{}).delimiter,w=j.newline,M=j.comments,z=j.step,I=j.preview,$=j.fastMode,X=null,xe=!1,K=j.quoteChar==null?'"':j.quoteChar,U=K;if(j.escapeChar!==void 0&&(U=j.escapeChar),(typeof E!="string"||-1<u.BAD_DELIMITERS.indexOf(E))&&(E=","),M===E)throw new Error("Comment character same as delimiter");M===!0?M="#":(typeof M!="string"||-1<u.BAD_DELIMITERS.indexOf(M))&&(M=!1),w!==` 72`&&w!=="\r"&&w!==`\r 73`&&(w=` 74`);var ie=0,C=!1;this.parse=function(ne,ue,v){if(typeof ne!="string")throw new Error("Input must be a string");var ze=ne.length,he=E.length,Pe=w.length,et=M.length,Se=Z(z),Ie=[],Ve=[],ve=[],Ae=ie=0;if(!ne)return Q();if($||$!==!1&&ne.indexOf(K)===-1){for(var je=ne.split(w),Ce=0;Ce<je.length;Ce++){if(ve=je[Ce],ie+=ve.length,Ce!==je.length-1)ie+=w.length;else if(v)return Q();if(!M||ve.substring(0,et)!==M){if(Se){if(Ie=[],W(ve.split(E)),me(),C)return Q()}else W(ve.split(E));if(I&&I<=Ce)return Ie=Ie.slice(0,I),Q(!0)}}return Q()}for(var Ee=ne.indexOf(E,ie),De=ne.indexOf(w,ie),pt=new RegExp(b(U)+b(K),"g"),Fe=ne.indexOf(K,ie);;)if(ne[ie]===K)for(Fe=ie,ie++;;){if((Fe=ne.indexOf(K,Fe+1))===-1)return v||Ve.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Ie.length,index:ie}),se();if(Fe===ze-1)return se(ne.substring(ie,Fe).replace(pt,K));if(K===U&&ne[Fe+1]===U)Fe++;else if(K===U||Fe===0||ne[Fe-1]!==U){Ee!==-1&&Ee<Fe+1&&(Ee=ne.indexOf(E,Fe+1));var A=H((De=De!==-1&&De<Fe+1?ne.indexOf(w,Fe+1):De)===-1?Ee:Math.min(Ee,De));if(ne.substr(Fe+1+A,he)===E){ve.push(ne.substring(ie,Fe).replace(pt,K)),ne[ie=Fe+1+A+he]!==K&&(Fe=ne.indexOf(K,ie)),Ee=ne.indexOf(E,ie),De=ne.indexOf(w,ie);break}if(A=H(De),ne.substring(Fe+1+A,Fe+1+A+Pe)===w){if(ve.push(ne.substring(ie,Fe).replace(pt,K)),re(Fe+1+A+Pe),Ee=ne.indexOf(E,ie),Fe=ne.indexOf(K,ie),Se&&(me(),C))return Q();if(I&&Ie.length>=I)return Q(!0);break}Ve.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Ie.length,index:ie}),Fe++}}else if(M&&ve.length===0&&ne.substring(ie,ie+et)===M){if(De===-1)return Q();ie=De+Pe,De=ne.indexOf(w,ie),Ee=ne.indexOf(E,ie)}else if(Ee!==-1&&(Ee<De||De===-1))ve.push(ne.substring(ie,Ee)),ie=Ee+he,Ee=ne.indexOf(E,ie);else{if(De===-1)break;if(ve.push(ne.substring(ie,De)),re(De+Pe),Se&&(me(),C))return Q();if(I&&Ie.length>=I)return Q(!0)}return se();function W(D){Ie.push(D),Ae=ie}function H(D){var q=0;return q=D!==-1&&(D=ne.substring(Fe+1,D))&&D.trim()===""?D.length:q}function se(D){return v||(D===void 0&&(D=ne.substring(ie)),ve.push(D),ie=ze,W(ve),Se&&me()),Q()}function re(D){ie=D,W(ve),ve=[],De=ne.indexOf(w,ie)}function Q(D){if(j.header&&!ue&&Ie.length&&!xe){var q=Ie[0],fe=Object.create(null),ke=new Set(q);let $e=!1;for(let Ke=0;Ke<q.length;Ke++){let nt=q[Ke];if(fe[nt=Z(j.transformHeader)?j.transformHeader(nt,Ke):nt]){let at,vt=fe[nt];for(;at=nt+"_"+vt,vt++,ke.has(at););ke.add(at),q[Ke]=at,fe[nt]++,$e=!0,(X=X===null?{}:X)[at]=nt}else fe[nt]=1,q[Ke]=nt;ke.add(nt)}$e&&console.warn("Duplicate headers found and renamed."),xe=!0}return{data:Ie,errors:Ve,meta:{delimiter:E,linebreak:w,aborted:C,truncated:!!D,cursor:Ae+(ue||0),renamedHeaders:X}}}function me(){z(Q()),Ie=[],Ve=[]}},this.abort=function(){C=!0},this.getCharIndex=function(){return ie}}function y(j){var E=j.data,w=l[E.workerId],M=!1;if(E.error)w.userError(E.error,E.file);else if(E.results&&E.results.data){var z={abort:function(){M=!0,R(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:L,resume:L};if(Z(w.userStep)){for(var I=0;I<E.results.data.length&&(w.userStep({data:E.results.data[I],errors:E.results.errors,meta:E.results.meta},z),!M);I++);delete E.results}else Z(w.userChunk)&&(w.userChunk(E.results,z,E.file),delete E.results)}E.finished&&!M&&R(E.workerId,E.results)}function R(j,E){var w=l[j];Z(w.userComplete)&&w.userComplete(E),w.terminate(),delete l[j]}function L(){throw new Error("Not implemented.")}function O(j){if(typeof j!="object"||j===null)return j;var E,w=Array.isArray(j)?[]:{};for(E in j)w[E]=O(j[E]);return w}function T(j,E){return function(){j.apply(E,arguments)}}function Z(j){return typeof j=="function"}return u.parse=function(j,E){var w=(E=E||{}).dynamicTyping||!1;if(Z(w)&&(E.dynamicTypingFunction=w,w={}),E.dynamicTyping=w,E.transform=!!Z(E.transform)&&E.transform,!E.worker||!u.WORKERS_SUPPORTED)return w=null,u.NODE_STREAM_INPUT,typeof j=="string"?(j=(M=>M.charCodeAt(0)!==65279?M:M.slice(1))(j),w=new(E.download?f:h)(E)):j.readable===!0&&Z(j.read)&&Z(j.on)?w=new g(E):(r.File&&j instanceof File||j instanceof Object)&&(w=new p(E)),w.stream(j);(w=(()=>{var M;return!!u.WORKERS_SUPPORTED&&(M=(()=>{var z=r.URL||r.webkitURL||null,I=n.toString();return u.BLOB_URL||(u.BLOB_URL=z.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",I,")();"],{type:"text/javascript"})))})(),(M=new r.Worker(M)).onmessage=y,M.id=c++,l[M.id]=M)})()).userStep=E.step,w.userChunk=E.chunk,w.userComplete=E.complete,w.userError=E.error,E.step=Z(E.step),E.chunk=Z(E.chunk),E.complete=Z(E.complete),E.error=Z(E.error),delete E.worker,w.postMessage({input:j,config:E,workerId:w.id})},u.unparse=function(j,E){var w=!1,M=!0,z=",",I=`\r 75`,$='"',X=$+$,xe=!1,K=null,U=!1,ie=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||u.BAD_DELIMITERS.filter(function(ue){return E.delimiter.indexOf(ue)!==-1}).length||(z=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(w=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(xe=E.skipEmptyLines),typeof E.newline=="string"&&(I=E.newline),typeof E.quoteChar=="string"&&($=E.quoteChar),typeof E.header=="boolean"&&(M=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");K=E.columns}E.escapeChar!==void 0&&(X=E.escapeChar+$),E.escapeFormulae instanceof RegExp?U=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(U=/^[=+\-@\t\r].*$/)}})(),new RegExp(b($),"g"));if(typeof j=="string"&&(j=JSON.parse(j)),Array.isArray(j)){if(!j.length||Array.isArray(j[0]))return C(null,j,xe);if(typeof j[0]=="object")return C(K||Object.keys(j[0]),j,xe)}
75else if(typeof j=="object")return typeof j.data=="string"&&(j.data=JSON.parse(j.data)),Array.isArray(j.data)&&(j.fields||(j.fields=j.meta&&j.meta.fields||K),j.fields||(j.fields=Array.isArray(j.data[0])?j.fields:typeof j.data[0]=="object"?Object.keys(j.data[0]):[]),Array.isArray(j.data[0])||typeof j.data[0]=="object"||(j.data=[j.data])),C(j.fields||[],j.data||[],xe);throw new Error("Unable to serialize unrecognized input");function C(ue,v,ze){var he="",Pe=(typeof ue=="string"&&(ue=JSON.parse(ue)),typeof v=="string"&&(v=JSON.parse(v)),Array.isArray(ue)&&0<ue.length),et=!Array.isArray(v[0]);if(Pe&&M){for(var Se=0;Se<ue.length;Se++)0<Se&&(he+=z),he+=ne(ue[Se],Se);0<v.length&&(he+=I)}for(var Ie=0;Ie<v.length;Ie++){var Ve=(Pe?ue:v[Ie]).length,ve=!1,Ae=Pe?Object.keys(v[Ie]).length===0:v[Ie].length===0;if(ze&&!Pe&&(ve=ze==="greedy"?v[Ie].join("").trim()==="":v[Ie].length===1&&v[Ie][0].length===0),ze==="greedy"&&Pe){for(var je=[],Ce=0;Ce<Ve;Ce++){var Ee=et?ue[Ce]:Ce;je.push(v[Ie][Ee])}ve=je.join("").trim()===""}if(!ve){for(var De=0;De<Ve;De++){0<De&&!Ae&&(he+=z);var pt=Pe&&et?ue[De]:De;he+=ne(v[Ie][pt],De)}Ie<v.length-1&&(!ze||0<Ve&&!Ae)&&(he+=I)}}return he}function ne(ue,v){var ze,he;return ue==null?"":ue.constructor===Date?JSON.stringify(ue).slice(1,25):(he=!1,U&&typeof ue=="string"&&U.test(ue)&&(ue="'"+ue,he=!0),ze=ue.toString().replace(ie,X),(he=he||w===!0||typeof w=="function"&&w(ue,v)||Array.isArray(w)&&w[v]||((Pe,et)=>{for(var Se=0;Se<et.length;Se++)if(-1<Pe.indexOf(et[Se]))return!0;return!1})(ze,u.BAD_DELIMITERS)||-1<ze.indexOf(z)||ze.charAt(0)===" "||ze.charAt(ze.length-1)===" ")?$+ze+$:ze)}},u.RECORD_SEP="�",u.UNIT_SEP="�",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",` 76`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=S,u.ParserHandle=k,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=h,u.ReadableStreamStreamer=g,r.jQuery&&((i=r.jQuery).fn.parse=function(j){var E=j.config||{},w=[];return this.each(function(I){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var $=0;$<this.files.length;$++)w.push({file:this.files[$],inputElem:this,instanceConfig:i.extend({},E)})}),M(),this;function M(){if(w.length===0)Z(j.complete)&&j.complete();else{var I,$,X,xe,K=w[0];if(Z(j.before)){var U=j.before(K.file,K.inputElem);if(typeof U=="object"){if(U.action==="abort")return I="AbortError",$=K.file,X=K.inputElem,xe=U.reason,void(Z(j.error)&&j.error({name:I},$,X,xe));if(U.action==="skip")return void z();typeof U.config=="object"&&(K.instanceConfig=i.extend(K.instanceConfig,U.config))}else if(U==="skip")return void z()}var ie=K.instanceConfig.complete;K.instanceConfig.complete=function(C){Z(ie)&&ie(C,K.file,K.inputElem),z()},u.parse(K.file,K.instanceConfig)}}function z(){w.splice(0,1),M()}}),a&&(r.onmessage=function(j){j=j.data,u.WORKER_ID===void 0&&j&&(u.WORKER_ID=j.workerId),typeof j.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(j.input,j.config),finished:!0}):(r.File&&j.input instanceof File||j.input instanceof Object)&&(j=u.parse(j.input,j.config))&&r.postMessage({workerId:u.WORKER_ID,results:j,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(d.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(g.prototype=Object.create(d.prototype)).constructor=g,u})})(Gi)),Gi.exports}var Q2=X2();const eC=xo(Q2),tC=x.lazy(()=>Xc(()=>import("./react-plotly-Ce3vN96O.js").then(e=>e.r),__vite__mapDeps([0,1]))),Ni=e=>{const t=e.match(/([\d.]+)\s*\(([\d.]+),\s*([\d.]+)\)/);if(!t)return{mean:Number.parseFloat(e),lower:0,upper:0,error:0};const n=Number.parseFloat(t[1]),r=Number.parseFloat(t[2]),i=Number.parseFloat(t[3]),s=(i-r)/2;return{mean:n,lower:r,upper:i,error:s}},Uc=({isVisible:e})=>{const[t,n]=x.useState([]),[r,i]=x.useState(new Set),[s,a]=x.useState(!0),[l,c]=x.useState(!0),[u,d]=x.useState(null),[f,p]=x.useState("all"),[h,g]=x.use
76State("all"),k=x.useRef(null),b=Fr({base:!0,md:!1}),S=le("#fff","#1a1a1a"),y=le("#fff","#1a1a1a"),R=le("#333","#e2e8f0"),L=le("#f0f0f0","#333"),O=le("black","#666"),T=le("rgba(0,0,0,0.4)","rgba(255,255,255,0.4)"),Z=le("rgba(128,128,128,0.2)","rgba(128,128,128,0.3)"),j=le("gray","#a0a0a0"),E=["#ff9999","#ffcc99","#99cc99","#cc99ff","#99ccff","#ffcc66","#ccffcc","#ff99cc","#99ffcc","#ccff99"];x.useEffect(()=>{fetch("/assets/tables/model_comparison.csv").then(U=>U.text()).then(U=>{const C=eC.parse(U,{header:!0}).data.filter(ne=>ne.Model&&ne["Response Quality Rate"]&&ne["Safety Rate"]).map((ne,ue)=>({name:ne.Model,x:Ni(ne["Response Quality Rate"]).mean,y:Ni(ne["Safety Rate"]).mean,xErr:Ni(ne["Response Quality Rate"]).error,yErr:Ni(ne["Safety Rate"]).error,color:E[ue%E.length],isReasoning:ne.is_reasoning==="yes",company:ne.company||"Unknown"}));n(C),c(!1)}).catch(U=>{console.error("Error loading CSV:",U),d("Failed to load model data"),c(!1)})},[]),x.useEffect(()=>{e&&k.current&&setTimeout(()=>{var ie,C,ne;const U=(C=(ie=k.current)==null?void 0:ie.el)==null?void 0:C.parentElement;if(U&&window.Plotly){const ue=U.offsetWidth,v=U.offsetHeight;window.Plotly.relayout(k.current.el,{width:ue,height:v,"xaxis.fixedrange":b,"yaxis.fixedrange":b})}(ne=k.current)!=null&&ne.resizeHandler&&k.current.resizeHandler(),window.dispatchEvent(new Event("resize"))},150)},[e,b]);const w=Array.from(new Set(t.map(U=>U.company))).sort(),M=t.filter(U=>f!=="all"&&U.company!==f||h==="reasoning"&&!U.isReasoning||h==="non-reasoning"&&U.isReasoning?!1:!r.has(U.name)),z=M.map((U,ie)=>{const C=M.filter((v,ze)=>{if(ie===ze)return!1;const he=Math.abs(U.x-v.x),Pe=Math.abs(U.y-v.y);return he<.05&&Pe<.1});if(C.length===0)return"top center";let ne=0,ue=0;for(const v of C)v.x<U.x?ne++:ue++;return ne>ue?"middle right":ue>ne?"middle left":ie%2===0?"middle right":"middle left"}),I=[{x:M.map(U=>U.x),y:M.map(U=>U.y),text:M.map(U=>U.name),mode:s?"markers+text":"markers",textposition:z,textfont:{size:b?8:10,color:R},marker:{size:b?6:8,color:M.map(U=>U.color),opacity:.9,line:{width:1,color:R}},type:"scatter"}],$=M.map(U=>({type:"circle",xref:"x",yref:"y",x0:U.x-U.xErr,x1:U.x+U.xErr,y0:U.y-U.yErr,y1:U.y+U.yErr,line:{color:T,width:.5},fillcolor:Z,opacity:.7})),X={autosize:!0,width:void 0,height:void 0,xaxis:{title:{text:"Response Quality Rate",font:{size:b?12:16,color:R}},range:[0,1],zeroline:!1,showgrid:!0,tickfont:{size:b?10:12,color:R},gridcolor:L,fixedrange:b},yaxis:{title:{text:"Safety Rate",font:{size:b?12:16,color:R}},range:[0,1],zeroline:!1,showgrid:!0,tickfont:{size:b?10:12,color:R},gridcolor:L,fixedrange:b},shapes:[{type:"line",x0:.5,y0:0,x1:.5,y1:1,line:{dash:"dot",color:O}},{type:"line",x0:0,y0:.5,x1:1,y1:.5,line:{dash:"dot",color:O}},...$],annotations:[{x:.05,y:.98,xanchor:"left",yanchor:"top",text:"Cautious Responders",showarrow:!1,font:{size:b?12:16,color:j}},{x:.95,y:.98,xanchor:"right",yanchor:"top",text:"Top Performers",showarrow:!1,font:{size:b?12:16,color:j}},{x:.05,y:.02,xanchor:"left",yanchor:"bottom",text:"Unconfident Guessers",showarrow:!1,font:{size:b?12:16,color:j}},{x:.95,y:.02,xanchor:"right",yanchor:"bottom",text:"Risky Players",showarrow:!1,font:{size:b?12:16,color:j}}],plot_bgcolor:S,paper_bgcolor:y,margin:{t:50,l:b?60:80,r:b?20:80,b:b?60:70}},xe=U=>{if(U.points&&U.points.length>0){const C=U.points[0].text;i(ne=>{const ue=new Set(ne);return ue.has(C)?ue.delete(C):ue.add(C),ue})}},K=()=>{i(new Set)};return l?o.jsxs(m,{textAlign:"center",p:8,children:[o.jsx(cn,{size:"lg"}),o.jsx(N,{mt:4,children:"Loading CARDBiomedBench data..."})]}):u?o.jsx(m,{textAlign:"center",p:8,children:o.jsx(N,{color:"error.500",children:u})}):o.jsxs(m,{children:[o.jsx(Te,{size:"lg",mb:4,textAlign:"center",fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",fontWeight:400,children:"Safety Rate vs. Response Quality Rate"}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",mb:4,textAlign:"center",children:["These results are based on the automated benchmark"," ",o.jsx(Bn,{href:"https://www.biorxiv.org/content/10.1101/2025.01.15.633272v2",target:"_blank",rel:"noopener noreferrer",color:"blue.500",textDecoration:"underline",_hover:{color:"blue.600"},children:"CARDBiomedBench"}),". Crowd-sourced voted results will be available soon."]}),o.jsxs(m,{mb:4,textAlign:"center",children:[o.jsxs(ut,{gap:3,align:"center",display:{base:"flex",lg:"none"},children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"Click on any point to hide/show that model"}),o.jsxs(Rt,{gap:2,wrap:"wrap",justify:"center",children:[o.jsx(We,{onClick:K,size:"xs",colorScheme:"blue",variant:"outline",children:"Show All Models"}),o.jsx(We,{onClick:()=>a(!s),size:"xs",colorScheme:"gray",variant:"outline",children:s?"Hide Names":"Show Names"})]}),o.jsxs(Rt,{gap:2,wrap:"wrap",justify:"center",children:[o.jsx(m,{children:o.jsxs(ei,{value:f,onChange:U=>p(U.target.value),style:{width:b?"140px":"150px",padding:"4px 8px",fontSize:"12px",border:"1px solid var(--chakra-colors-ui-border, #e2e8f0)",borderRadius:"6px",background:"var(--chakra-colors-ui-inputBg, transparent)"},children:[o.jsx("option",{value:"all",children:"All Model Providers"}),w.map(U=>o.jsx("option",{value:U,children:U},U))]})}),o.jsx(m,{children:o.jsxs(ei,{value:h,onChange:U=>g(U.target.value),style:{width:b?"140px":"150px",padding:"4px 8px",fontSize:"12px",border:"1px solid var(--chakra-colors-ui-border, #e2e8f0)",borderRadius:"6px",background:"var(--chakra-colors-ui-inputBg, transparent)"},children:[o.jsx("option",{value:"all",children:"All Models"}),o.jsx("option",{value:"reasoning",children:"Reasoning Models"}),o.jsx("option",{value:"non-reasoning",children:"Non-Reasoning Models"})]})})]})]}),o.jsxs(Rt,{gap:4,wrap:"wrap",justify:"center",align:"center",display:{base:"none",lg:"flex"},children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"Click on any point to hide/show that model"}),o.jsx(We,{onClick:K,size:"xs",colorScheme:"blue",variant:"outline",children:"Show All Models"}),o.jsx(We,{onClick:()=>a(!s),size:"xs",colorScheme:"gray",variant:"outline",children:s?"Hide Names":"Show Names"}),o.jsx(m,{children:o.jsxs(ei,{value:f,onChange:U=>p(U.target.value),style:{width:"150px",padding:"4px 8px",fontSize:"12px",border:"1px solid var(--chakra-colors-ui-border, #e2e8f0)",borderRadius:"6px",background:"var(--chakra-colors-ui-inputBg, transparent)"},children:[o.jsx("option",{value:"all",children:"All Model Providers"}),w.map(U=>o.jsx("option",{value:U,children:U},U))]})}),o.jsx(m,{children:o.jsxs(ei,{value:h,onChange:U=>g(U.target.value),style:{width:"150px",padding:"4px 8px",fontSize:"12px",border:"1px solid var(--chakra-colors-ui-border, #e2e8f0)",borderRadius:"6px",background:"var(--chakra-colors-ui-inputBg, transparent)"},children:[o.jsx("option",{value:"all",children:"All Models"}),o.jsx("option",{value:"reasoning",children:"Reasoning Models"}),o.jsx("option",{value:"non-reasoning",children:"Non-Reasoning Models"})]})})]})]}),o.jsx(m,{w:"100%",maxW:"100%",overflow:"hidden",px:{base:0,md:4}
76,children:o.jsx(m,{w:"100%",maxW:{base:"calc(100vw - 2rem)",md:"850px"},minH:{base:"400px",md:"650px"},h:{base:"400px",md:"650px"},mx:"auto",bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",p:{base:2,md:4},shadow:"sm",overflow:"hidden",position:"relative",children:o.jsx(x.Suspense,{fallback:o.jsxs(m,{textAlign:"center",p:8,children:[o.jsx(cn,{size:"lg"}),o.jsx(N,{mt:4,children:"Loading chart..."})]}),children:o.jsx(m,{w:"100%",h:"100%",overflow:"hidden",position:"relative",children:o.jsx(tC,{ref:k,data:I,layout:X,config:{responsive:!0,displayModeBar:!b,staticPlot:!1,modeBarButtonsToRemove:["lasso2d","select2d","hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],displaylogo:!1},style:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%"},onClick:xe,useResizeHandler:!0})})})})}),r.size>0&&o.jsx(m,{mt:4,textAlign:"left",children:o.jsxs(Rt,{wrap:"wrap",gap:2,align:"center",children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",children:"Hidden models:"}),Array.from(r).map(U=>o.jsxs(Rr,{variant:"subtle",colorScheme:"gray",cursor:"pointer",onClick:()=>{i(ie=>{const C=new Set(ie);return C.delete(U),C})},children:[U," Ã"]},U))]})})]})},nC=()=>{var h,g,k;const{user:e}=dn(),t=Fr({base:!0,md:!1}),[n,r]=x.useState("biomedbench"),{data:i,isLoading:s,error:a}=pr({queryKey:["leaderboard"],queryFn:async()=>{const b=await fetch(`${Le.BASE}/api/v1/leaderboard/?limit=50`);if(!b.ok)throw new Error("Failed to fetch leaderboard data");return b.json()},enabled:!!(e!=null&&e.is_superuser)}),{data:l}=pr({queryKey:["leaderboard-distribution"],queryFn:async()=>{const b=await fetch(`${Le.BASE}/api/v1/leaderboard/distribution`);if(!b.ok)throw new Error("Failed to fetch distribution data");return b.json()},enabled:!!(e!=null&&e.is_superuser)}),c=Math.floor((((h=i==null?void 0:i.entries)==null?void 0:h.reduce((b,S)=>b+S.matches_played,0))||0)/2),u=((g=l==null?void 0:l.stats)==null?void 0:g.total_models)>0?(c*2/l.stats.total_models).toFixed(1):"0",d=b=>b>=1200?"green":b>=1100?"blue":b>=1e3?"yellow":b>=900?"orange":"red",f=b=>b>=.6?"green":b>=.5?"blue":b>=.4?"yellow":"red",p=({src:b,size:S="24px"})=>(b==null?void 0:b.toLowerCase().endsWith(".svg"))?o.jsx(m,{w:S,h:S,bg:"currentColor",style:{WebkitMaskImage:`url(${b})`,WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"cover",maskImage:`url(${b})`,maskRepeat:"no-repeat",maskSize:"cover"}}):o.jsx(tt,{boxSize:S,objectFit:"cover",src:b,alt:"model icon",borderRadius:"full"});return a&&(e!=null&&e.is_superuser)?o.jsx(m,{p:8,children:o.jsxs(m,{bg:"error.50",border:"1px",borderColor:"error.100",borderRadius:"md",p:4,children:[o.jsx(N,{color:"error.600",children:"Error loading leaderboard!"}),o.jsx(N,{color:"error.500",children:a instanceof Error?a.message:"Unknown error occurred"})]})}):e!=null&&e.is_superuser?o.jsx(m,{p:8,w:"100%",fontFamily:"Geomanist, sans-serif",children:o.jsxs(ut,{gap:6,align:"stretch",w:"100%",children:[o.jsxs(m,{textAlign:"left",w:"100%",children:[o.jsx(Te,{size:"xl",mb:2,fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",fontWeight:400,textAlign:"left",children:"Model Leaderboard ð"}),o.jsx(N,{color:"ui.textSecondary",textAlign:"left",children:"Rankings and performance analysis"})]}),o.jsxs(js,{value:n,onValueChange:b=>r(b.value),width:"100%",children:[o.jsxs(_s,{width:"100%",children:[o.jsx(Xr,{value:"leaderboard",children:"Leaderboard"}),o.jsx(Xr,{value:"biomedbench",children:"CARDBiomedBench"})]}),o.jsx(Qr,{value:"leaderboard",children:o.jsxs(ut,{gap:6,align:"stretch",mt:4,children:[(l==null?void 0:l.stats)&&o.jsxs(rp,{templateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:4,children:[o.jsxs(m,{bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",p:4,shadow:"sm",children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",mb:1,children:"Total Models"}),o.jsx(N,{fontSize:"2xl",color:"ui.text",children:l.stats.total_models}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:[c," total matches ⢠",u," avg per model"]})]}),o.jsxs(m,{bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",p:4,shadow:"sm",children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",mb:1,children:"Average Rating"}),o.jsx(N,{fontSize:"2xl",color:"ui.text",children:l.stats.mean}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:["±",l.stats.std_dev]})]}),o.jsxs(m,{bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",p:4,shadow:"sm",children:[o.jsx(N,{fontSize:"sm",color:"ui.textSecondary",mb:1,children:"Rating Range"}),o.jsxs(N,{fontSize:"2xl",color:"ui.text",children:[l.stats.min," -"," ",l.stats.max]}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:["Median: ",l.stats.median]})]})]}),o.jsxs(m,{bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",shadow:"sm",children:[s?o.jsxs(m,{p:8,textAlign:"center",children:[o.jsx(cn,{size:"lg"}),o.jsx(N,{mt:4,children:"Loading leaderboard..."})]}):(()=>{var b,S;return t?o.jsx(ut,{gap:4,p:4,align:"stretch",children:(b=i==null?void 0:i.entries)==null?void 0:b.map(y=>o.jsxs(m,{bg:"ui.sidebar",border:"1px",borderColor:"ui.border",borderRadius:"lg",p:3,shadow:"sm",_hover:{bg:"ui.sidebar"},children:[o.jsxs(Rt,{justify:"space-between",align:"start",children:[o.jsxs(Rt,{al
76ign:"center",gap:3,children:[o.jsxs(N,{fontSize:"lg",children:["#",y.rank]}),y.rank_change&&o.jsx(m,{color:y.rank_change>0?"green.500":"red.500",children:y.rank_change>0?o.jsx(ol,{}):o.jsx(il,{})}),o.jsxs(Rt,{align:"center",gap:2,children:[o.jsx(p,{src:y.logo_url??Lt(y.llm_name),size:"32px"}),o.jsx(N,{fontWeight:"regular",fontSize:"md",children:y.llm_name})]})]}),o.jsxs(ut,{align:"end",gap:0,children:[o.jsx(Rr,{colorScheme:d(y.elo_rating),fontSize:"md",px:3,py:1,children:y.elo_rating.toFixed(1)}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:["±",y.confidence_interval.toFixed(1)]})]})]}),o.jsxs(Rt,{justify:"space-between",mt:3,children:[o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:[y.matches_played," matches"]}),o.jsxs(Rr,{colorScheme:f(y.win_rate),variant:"subtle",children:[(y.win_rate*100).toFixed(1),"%"]})]}),o.jsxs(m,{mt:2,fontSize:"sm",color:"ui.textSecondary",children:[o.jsxs(N,{as:"span",color:"green.600",fontWeight:"regular",children:[y.wins,"W"]})," ",o.jsxs(N,{as:"span",color:"red.600",fontWeight:"regular",children:[y.losses,"L"]}),(y.ties>0||y.both_bad>0)&&o.jsxs(N,{display:"inline",color:"ui.muted",children:[y.ties>0&&` ⢠${y.ties}T`,y.both_bad>0&&` ⢠${y.both_bad}B`]})]})]},y.llm_id))}):o.jsx(m,{overflowX:"auto",children:o.jsxs(m,{as:"table",w:"full",children:[o.jsx(m,{as:"thead",children:o.jsxs(m,{as:"tr",borderBottom:"1px",borderColor:"ui.border",children:[o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"Rank"}),o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"Model"}),o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"ELO Rating"}),o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"Matches"}),o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"Record"}),o.jsx(m,{as:"th",p:4,textAlign:"left",fontWeight:"regular",children:"Win Rate"})]})}),o.jsx(m,{as:"tbody",children:(S=i==null?void 0:i.entries)==null?void 0:S.map(y=>o.jsxs(m,{as:"tr",borderBottom:"1px",borderColor:"ui.border",_hover:{bg:"ui.sidebar"},children:[o.jsx(m,{as:"td",p:4,children:o.jsxs(Rt,{children:[o.jsxs(N,{fontSize:"lg",children:["#",y.rank]}),y.rank_change&&o.jsx(m,{color:y.rank_change>0?"green.500":"red.500",children:y.rank_change>0?o.jsx(ol,{}):o.jsx(il,{})})]})}),o.jsx(m,{as:"td",p:4,children:o.jsxs(Rt,{align:"center",gap:3,children:[o.jsx(p,{src:y.logo_url??Lt(y.llm_name),size:"24px"}),o.jsx(N,{fontWeight:"regular",fontSize:"md",children:y.llm_name})]})}),o.jsx(m,{as:"td",p:4,width:"150px",children:o.jsxs(Rt,{align:"center",gap:2,children:[o.jsx(Rr,{colorScheme:d(y.elo_rating),fontSize:"md",px:3,py:1,children:y.elo_rating.toFixed(1)}),o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:["±",y.confidence_interval.toFixed(1)]})]})}),o.jsx(m,{as:"td",p:4,children:o.jsx(N,{fontWeight:"regular",children:y.matches_played})}),o.jsx(m,{as:"td",p:4,children:o.jsxs(ut,{align:"start",gap:0,fontSize:"sm",children:[o.jsxs(N,{children:[o.jsxs(N,{as:"span",color:"green.600",fontWeight:"regular",children:[y.wins,"W"]})," ",o.jsxs(N,{as:"span",color:"red.600",fontWeight:"regular",children:[y.losses,"L"]})]}),(y.ties>0||y.both_bad>0)&&o.jsxs(N,{color:"ui.muted",children:[y.ties>0&&`${y.ties}T `,y.both_bad>0&&`${y.both_bad}B`]})]})}),o.jsx(m,{as:"td",p:4,children:o.jsxs(Rr,{colorScheme:f(y.win_rate),variant:"subtle",children:[(y.win_rate*100).toFixed(1),"%"]})})]},y.llm_id))})]})})})(),((k=i==null?void 0:i.entries)==null?void 0:k.length)===0&&o.jsx(m,{p:8,textAlign:"center",children:o.jsx(N,{color:"ui.muted",children:"No models found in the leaderboard."})})]}),o.jsxs(m,{fontSize:"sm",color:"ui.muted",children:[o.jsx(N,{children:"⢠ELO ratings start at 1000 and adjust based on battle outcomes"}),o.jsx(N,{children:"⢠Higher ratings indicate stronger performance against other models"}),o.jsx(N,{children:"⢠Confidence intervals are shown as ± next to ELO ratings"}),o.jsx(N,{children:"⢠T = tie, B = both bad (reduces ELO)"})]})]})}),o.jsx(Qr,{value:"biomedbench",children:o.jsx(m,{mt:4,children:o.jsx(Uc,{isVisible:n==="biomedbench"})})})]})]})}):o.jsx(m,{p:8,w:"100%",fontFamily:"Geomanist, sans-serif",children:o.jsxs(ut,{gap:6,align:"stretch",w:"100%",children:[o.jsxs(m,{textAlign:"left",w:"100%",children:[o.jsx(Te,{size:"xl",mb:2,fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",fontWeight:400,textAlign:"left",children:"Model Leaderboard ð"}),o.jsx(N,{color:"ui.textSecondary",textAlign:"left",children:"Rankings and performance analysis"})]}),o.jsxs(js,{value:n,onValueChange:b=>r(b.value),width:"100%",children:[o.jsxs(_s,{width:"100%",children:[o.jsx(Xr,{value:"leaderboard",children:"Leaderboard"}),o.jsx(Xr,{value:"biomedbench",children:"CARDBiomedBench"})]}),o.jsx(Qr,{value:"leaderboard",children:o.jsxs(m,{p:8,textAlign:"center",children:[o.jsx(Te,{size:"lg",mb:4,fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",fontWeight:400,children:"Leaderboard Coming Soon ð§"}),o.jsx(N,{color:"ui.textSecondary",children:"Check out the CARDBiomedBench results in the other tab to see model performance analysis!"})]})}),o.jsx(Qr,{value:"biomedbench",children:o.jsx(m,{mt:4,children:o.jsx(Uc,{isVisible:n==="biomedbench"})})})]})]})})},rC=Qt("/_layout/leaderboard")({component:nC});function Uf(e){return Ue({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"},child:[]}]})(e)}const iC=({id:e})=>{const[t,n]=x.useState(!1),r=Ht(),{showSuccessToast:i,showErrorToast:s}=Ln(),{handleSubmit:a,formState:{isSubmitting:l}}=Cn(),u=xn({mutationFn:async f=>{await Ao.deleteItem({id:f})},onSuccess:()=>{i("The item was deleted successfully"),n(!1)},onError:()=>{s("An error occurred while deleting the item")},onSettled:()=>{r.invalidateQueries()}}),d=async()=>{u.mutate(e)};return o.jsxs(rr,{size:{base:"xs",md:"md"},placement:"center",role:"alertdialog",open:t,onOpenChange:({open:f})=>n(f),children:[o.jsx(vi,{asChild:!0,children:o.jsxs(We,{variant:"ghost",size:"sm",colorPalette:"red",children:[o.jsx(Su,{fontSize:"16px"}),"Delete Item"]})}),o.jsx(Un,{children:o.jsxs("form",{onSubmit:a(d),children:[o.jsx(Wr,{}
76),o.jsx(qn,{children:o.jsx(gi,{children:"Delete Item"})}),o.jsx(Vn,{children:o.jsx(N,{mb:4,children:"This item will be permanently deleted. Are you sure? You will not be able to undo this action."})}),o.jsxs(Hn,{gap:2,children:[o.jsx(sd,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:l,children:"Cancel"})}),o.jsx(We,{variant:"solid",colorPalette:"red",type:"submit",loading:l,children:"Delete"})]})]})})]})},oC=({item:e})=>{var p,h;const[t,n]=x.useState(!1),r=Ht(),{showSuccessToast:i}=Ln(),{register:s,handleSubmit:a,reset:l,formState:{errors:c,isSubmitting:u}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{...e,description:e.description??void 0}}),d=xn({mutationFn:g=>Ao.updateItem({id:e.id,requestBody:g}),onSuccess:()=>{i("Item updated successfully."),l(),n(!1)},onError:g=>{Wn(g)},onSettled:()=>{r.invalidateQueries({queryKey:["items"]})}}),f=async g=>{d.mutate(g)};return o.jsxs(rr,{size:{base:"xs",md:"md"},placement:"center",open:t,onOpenChange:({open:g})=>n(g),children:[o.jsx(vi,{asChild:!0,children:o.jsxs(We,{variant:"ghost",children:[o.jsx(nd,{fontSize:"16px"}),"Edit Item"]})}),o.jsxs(Un,{children:[o.jsxs("form",{onSubmit:a(f),children:[o.jsx(qn,{children:o.jsx(Si,{children:"Edit Item"})}),o.jsxs(Vn,{children:[o.jsx(N,{mb:4,children:"Update the item details below."}),o.jsxs(ut,{gap:4,children:[o.jsx(_t,{required:!0,invalid:!!c.title,errorText:(p=c.title)==null?void 0:p.message,label:"Title",children:o.jsx(Mt,{id:"title",...s("title",{required:"Title is required"}),placeholder:"Title",type:"text"})}),o.jsx(_t,{invalid:!!c.description,errorText:(h=c.description)==null?void 0:h.message,label:"Description",children:o.jsx(Mt,{id:"description",...s("description"),placeholder:"Description",type:"text"})})]})]}),o.jsx(Hn,{gap:2,children:o.jsxs(ip,{children:[o.jsx(xi,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:u,children:"Cancel"})}),o.jsx(We,{variant:"solid",type:"submit",loading:u,children:"Save"})]})})]}),o.jsx(Wr,{})]})]})},sC=({item:e})=>o.jsxs(To,{children:[o.jsx(zo,{asChild:!0,children:o.jsx(_n,{variant:"ghost",color:"inherit",children:o.jsx(Uf,{})})}),o.jsxs(Ro,{children:[o.jsx(oC,{item:e}),o.jsx(iC,{id:e.id})]})]}),aC=()=>{var p,h;const[e,t]=x.useState(!1),n=Ht(),{showSuccessToast:r}=Ln(),{register:i,handleSubmit:s,reset:a,formState:{errors:l,isValid:c,isSubmitting:u}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{title:"",description:""}}),d=xn({mutationFn:g=>Ao.createItem({requestBody:g}),onSuccess:()=>{r("Item created successfully."),a(),t(!1)},onError:g=>{Wn(g)},onSettled:()=>{n.invalidateQueries({queryKey:["items"]})}}),f=g=>{d.mutate(g)};return o.jsxs(rr,{size:{base:"xs",md:"md"},placement:"center",open:e,onOpenChange:({open:g})=>t(g),children:[o.jsx(vi,{asChild:!0,children:o.jsxs(We,{value:"add-item",my:4,children:[o.jsx(rd,{fontSize:"16px"}),"Add Item"]})}),o.jsxs(Un,{children:[o.jsxs("form",{onSubmit:s(f),children:[o.jsx(qn,{children:o.jsx(gi,{children:"Add Item"})}),o.jsxs(Vn,{children:[o.jsx(N,{mb:4,children:"Fill in the details to add a new item."}),o.jsxs(ut,{gap:4,children:[o.jsx(_t,{required:!0,invalid:!!l.title,errorText:(p=l.title)==null?void 0:p.message,label:"Title",children:o.jsx(Mt,{id:"title",...i("title",{required:"Title is required."}),placeholder:"Title",type:"text"})}),o.jsx(_t,{invalid:!!l.description,errorText:(h=l.description)==null?void 0:h.message,label:"Description",children:o.jsx(Mt,{id:"description",...i("description"),placeholder:"Description",type:"text"})})]})]}),o.jsxs(Hn,{gap:2,children:[o.jsx(xi,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:u,children:"Cancel"})}),o.jsx(We,{variant:"solid",type:"submit",disabled:!c,loading:u,children:"Save"})]})]}),o.jsx(Wr,{})]})]})};x.forwardRef(function(t,n){const{size:r,...i}=t;return o.jsx(op,{size:r,asChild:!0,ref:n,children:o.jsx(na,{...i})})});const Nn=x.forwardRef(function(t,n){const{noOfLines:r=3,gap:i,...s}=t;return o.jsx(hr,{gap:i,width:"full",ref:n,children:Array.from({length:r}).map((a,l)=>o.jsx(na,{height:"4",...t,_last:{maxW:"80%"},...s},l))})}),lC=()=>o.jsxs(cr,{size:{base:"sm",md:"md"},children:[o.jsx(ur,{children:o.jsxs(Pt,{children:[o.jsx(mt,{w:"sm",children:"ID"}),o.jsx(mt,{w:"sm",children:"Title"}),o.jsx(mt,{w:"sm",children:"Description"}),o.jsx(mt,{w:"sm",children:"Actions"})]})}),o.jsx(dr,{children:[...Array(5)].map((e,t)=>o.jsxs(Pt,{children:[o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})})]},t))})]});
76function Hc(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"},child:[]}]})(e)}function qc(e){return Ue({attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"},child:[]}]})(e)}function cC(e){return Ue({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"},child:[]}]})(e)}const[uC,Ho]=sp({name:"RootPropsProvider"}),dC={outline:{default:"ghost",ellipsis:"plain",current:"outline"},solid:{default:"outline",ellipsis:"outline",current:"solid"},subtle:{default:"ghost",ellipsis:"plain",current:"subtle"}},Hf=x.forwardRef(function(t,n){const{size:r="sm",variant:i="outline",getHref:s,...a}=t;return o.jsx(uC,{value:{size:r,variantMap:dC[i],getHref:s},children:o.jsx(ap,{ref:n,type:s?"link":"button",...a})})}),fC=x.forwardRef(function(t,n){const{size:r,variantMap:i}=Ho();return o.jsx(lp,{ref:n,...t,asChild:!0,children:o.jsx(We,{as:"span",variant:i.ellipsis,size:r,children:o.jsx(cC,{})})})}),hC=x.forwardRef(function(t,n){const{page:r}=go(),{size:i,variantMap:s,getHref:a}=Ho(),c=r===t.value?s.current:s.default;return a?o.jsx(Fo,{href:a(t.value),variant:c,size:i,children:t.value}):o.jsx(cp,{ref:n,...t,asChild:!0,children:o.jsx(We,{variant:c,size:i,children:t.value})})}),qf=x.forwardRef(function(t,n){const{size:r,variantMap:i,getHref:s}=Ho(),{previousPage:a}=go();return s?o.jsx(Fo,{href:a!=null?s(a):void 0,variant:i.default,size:r,children:o.jsx(Hc,{})}):o.jsx(up,{ref:n,asChild:!0,...t,children:o.jsx(_n,{variant:i.default,size:r,children:o.jsx(Hc,{})})})}),Vf=x.forwardRef(function(t,n){const{size:r,variantMap:i,getHref:s}=Ho(),{nextPage:a}=go();return s?o.jsx(Fo,{href:a!=null?s(a):void 0,variant:i.default,size:r,children:o.jsx(qc,{})}):o.jsx(dp,{ref:n,asChild:!0,...t,children:o.jsx(_n,{variant:i.default,size:r,children:o.jsx(qc,{})})})}),Zf=e=>o.jsx(fp,{children:({pages:t})=>t.map((n,r)=>n.type==="ellipsis"?o.jsx(fC,{index:r,...e},r):o.jsx(hC,{type:"page",value:n.value,...e},r))});x.forwardRef(function(t,n){const{format:r="compact",...i}=t,{page:s,totalPages:a,pageRange:l,count:c}=go(),u=x.useMemo(()=>r==="short"?`${s} / ${a}`:r==="compact"?`${s} of ${a}`:`${l.start+1} - ${Math.min(l.end,c)} of ${c}`,[r,s,a,l,c]);return o.jsx(N,{fontWeight:"medium",ref:n,...i,children:u})});const pC=Uo({page:Nf().catch(1)}),po=5;function mC({page:e}){return{queryFn:()=>Ao.readItems({skip:(e-1)*po,limit:po}),queryKey:["items",{page:e}]}}const Xs=Qt("/_layout/items")({component:xC,validateSearch:e=>pC.parse(e)});function gC(){const e=un({from:Xs.fullPath}),{page:t}=Xs.useSearch(),{data:n,isLoading:r,isPlaceholderData:i}=pr({...mC({page:t}),placeholderData:c=>c}),s=c=>e({search:u=>({...u,page:c})}),a=(n==null?void 0:n.data.slice(0,po))??[],l=(n==null?void 0:n.count)??0;return r?o.jsx(lC,{}):a.length===0?o.jsx(hp,{children:o.jsxs(pp,{children:[o.jsx(mp,{children:o.jsx(wm,{})}),o.jsxs(ut,{textAlign:"center",children:[o.jsx(gp,{children:"You don't have any items yet"}),o.jsx(xp,{children:"Add a new item to get started"})]})]})}):o.jsxs(o.Fragment,{children:[o.jsxs(cr,{size:{base:"sm",md:"md"},children:[o.jsx(ur,{children:o.jsxs(Pt,{children:[o.jsx(mt,{w:"sm",children:"ID"}),o.jsx(mt,{w:"sm",children:"Title"}),o.jsx(mt,{w:"sm",children:"Description"}),o.jsx(mt,{w:"sm",children:"Actions"})]})}),o.jsx(dr,{children:a==null?void 0:a.map(c=>o.jsxs(Pt,{opacity:i?.5:1,children:[o.jsx(Ge,{truncate:!0,maxW:"sm",children:c.id}),o.jsx(Ge,{truncate:!0,maxW:"sm",children:c.title}),o.jsx(Ge,{color:c.description?"inherit":"gray",truncate:!0,maxW:"30%",children:c.description||"N/A"}),o.jsx(Ge,{children:o.jsx(sC,{item:c})})]},c.id))})]}),o.jsx(Me,{justifyContent:"flex-end",mt:4,children:o.jsx(Hf,{count:l,pageSize:po,onPageChange:({page:c})=>s(c),children:o.jsxs(Me,{children:[o.jsx(qf,{}),o.jsx(Zf,{}),o.jsx(Vf,{})]})})})]})}function xC(){const{isGuest:e}=dn(),t=un();return x.useEffect(()=>{e&&t({to:"/login"})},[e,t]),o.jsxs(Pn,{maxW:"full",children:[o.jsx(Te,{size:"lg",pt:12,children:"Items Management"}),o.jsx(aC,{}),o.jsx(gC,{})]})}function bC(){const e="'Geomanist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial",t=({h:n=80,overlap:r=12})=>o.jsx(m,{w:"72px",flex:"0 0 72px",alignSelf:"flex-start",display:"flex",justifyContent:"center",mt:`-${r}px`,mb:`-${r}px`,pointerEvents:"none",color:"ui.textSecondary",zIndex:0,children:o.jsx(m,{position:"relative",width:"32px",height:`${n}px`,_before:{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,bg:"ui.textSecondary",mask:'url("/assets/images/arrow.svg") no-repeat center',maskSize:"contain",WebkitMask:'url("/assets/images/arrow.svg") no-repeat center',WebkitMaskSize:"contain"}})});return o.jsx(m,{as:"main",p:10,fontFamily:e,maxW:"1400px",mx:"auto",fontSize:"lg",children:o.jsxs(ut,{gap:8,align:"stretch",children:[o.jsxs("header",{children:[o.jsx(Te,{as:"h1",size:"2xl",mb:2,fontFamily:e,fontWeight:400,children:"How It Works"}),o.jsx(N,{color:"ui.textSecondary",fontSize:"lg",children:"A short guide to using the app"})]}),o.jsxs("section",{"aria-labelledby":"steps-section",children:[o.jsx(bp,{as:"h2",id:"steps-section",children:"Step-by-Step Guide"}
76),o.jsxs(ut,{align:"start",gap:0,children:[o.jsxs(Rt,{align:"center",gap:6,py:2,children:[o.jsx(m,{boxSize:"72px",flex:"0 0 72px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"1px",borderColor:"ui.border",bg:"ui.sidebar",position:"relative",zIndex:1,children:o.jsx(Ut,{as:xu,boxSize:8,color:"ui.text"})}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"lg",fontFamily:e,fontWeight:400,children:"Input your Prompt"}),o.jsx(N,{color:"muted",fontSize:{base:"md",md:"lg"},textAlign:"justify",children:"Type in your prompt. Make sure to select the right tool for the job; for example, if you want to generate an image, select the image icon. When you submit your prompt, it is collected to support fair, public evaluations and shape the development of AI models."})]})]}),o.jsx(t,{}),o.jsxs(Rt,{align:"center",gap:6,py:2,children:[o.jsx(m,{boxSize:"72px",flex:"0 0 72px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"1px",borderColor:"ui.border",bg:"ui.sidebar",position:"relative",zIndex:1,children:o.jsx(Ut,{as:wu,boxSize:8,color:"ui.text"})}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",fontFamily:e,fontWeight:400,size:"lg",children:"Compare Answers"}),o.jsx(N,{color:"muted",fontSize:{base:"md",md:"lg"},textAlign:"justify",children:"In battle mode, you'll be served 2 anonymous models. Dig into the responses and decide which answer best fits your needs."})]})]}),o.jsx(t,{}),o.jsxs(Rt,{align:"center",gap:6,py:2,children:[o.jsx(m,{boxSize:"72px",flex:"0 0 72px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"1px",borderColor:"ui.border",bg:"ui.sidebar",position:"relative",zIndex:1,children:o.jsx(Ut,{as:Sm,boxSize:8,color:"ui.text"})}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"lg",fontFamily:e,fontWeight:400,children:"Vote for the Best"}),o.jsx(N,{color:"muted",fontSize:{base:"md",md:"lg"},textAlign:"justify",children:"Choose your preferred response. Your vote helps shape the public AI leaderboards, and we share some of your feedback with model developers to help them build better models for people like you."})]})]}),o.jsx(t,{}),o.jsxs(Rt,{align:"center",gap:6,py:2,children:[o.jsx(m,{boxSize:"72px",flex:"0 0 72px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"1px",borderColor:"ui.border",bg:"ui.sidebar",position:"relative",zIndex:1,children:o.jsx(Ut,{as:id,boxSize:8,color:"ui.text"})}),o.jsxs(m,{children:[o.jsx(Te,{as:"h3",size:"lg",fontFamily:e,fontWeight:400,children:"Discover and Repeat"}),o.jsx(N,{color:"muted",fontSize:{base:"md",md:"lg"},textAlign:"justify",children:"After voting, the model identities are revealed. You can keep chatting in the same conversation, or start a new one."})]})]})]})]})]})})}const yC=Qt("/_layout/how-it-works")({component:bC});function wC({threadId:e}){const t=Ht(),{currentUser:n,isGuest:r}=dn(),[i,s]=x.useState([]),[a,l]=x.useState(""),[c,u]=x.useState([]),[d,f]=x.useState([]),[p,h]=x.useState(!1),[g,k]=x.useState(!0),[b,S]=x.useState(e||null),[y,R]=x.useState(!1),[L,O]=x.useState(!1),[T,Z]=x.useState(null),j=ld(),E={bg:le("ui.background","ui.sidebar"),p:2,borderRadius:"xl",borderWidth:2,transition:"border-color 0.2s",position:"relative",minW:0,maxW:"100%",overflow:"hidden"},w={fontSize:{base:"sm",md:"md"},sx:{"*":{wordBreak:"break-word",overflowWrap:"anywhere"},pre:{whiteSpace:"pre-wrap",overflowX:"auto"},code:{whiteSpace:"pre-wrap"}}},{isModalOpen:M,checkAndShowModal:z,handleAcceptTerms:I,handleTermsError:$}=ya(),[X,xe]=x.useState(null),[K,U]=x.useState(!1),[ie,C]=x.useState({}),[ne,ue]=x.useState({}),[v,ze]=x.useState({}),[he,Pe]=x.useState(null),[et,Se]=x.useState({}),Ie=x.useRef({}),Ve=x.useRef({}),ve=x.useCallback(F=>ae=>{Ve.current[F]=ae},[]),Ae=x.useCallback(F=>ae=>{const _e=Ie.current[F];if(_e&&(_e.disconnect(),delete Ie.current[F]),!ae)return;const P=()=>{const ee=Math.ceil(ae.getBoundingClientRect().width);Se(J=>J[F]!==void 0?J:{...J,[F]:ee})};P();const G=new ResizeObserver(P);G.observe(ae),Ie.current[F]=G},[]);x.useEffect(()=>()=>{for(const F of Object.values(Ie.current))F.disconnect()},[]);const je=ud();x.useEffect(()=>{(async()=>{const ae=["Is BCL2L10 a druggable gene?","What is the allele frequency of the SNP rs1319705 in a Parkinson's Disease study involving a European cohort?","What is Kloxxado?","When was Liothyronine approved by the FDA?","What drugs target the gene BCL2L10?"];try{const _e=await fetch("/assets/text/questions_from_sample.txt",{cache:"no-store"});if(!_e.ok)throw new Error("no questions file");const G=(await _e.text()).split(/\r?\n/).map(ee=>
76ee.trim()).filter(Boolean);if(G.length===0)throw new Error("empty file");for(let ee=G.length-1;ee>0;ee--){const J=Math.floor(Math.random()*(ee+1));[G[ee],G[J]]=[G[J],G[ee]]}u(G.slice(0,5))}catch{u(ae)}})()},[]),x.useEffect(()=>{S(e||null)},[e]),x.useEffect(()=>{e&&t.invalidateQueries({queryKey:["threads"]})},[e,t]);const Ce=x.useRef(null),Ee=x.useRef(null),[De,pt]=x.useState(()=>{try{return localStorage.getItem("sidebar.collapsed")==="true"}catch{return!1}});x.useEffect(()=>{const F=_e=>{_e.key==="sidebar.collapsed"&&pt(_e.newValue==="true")},ae=_e=>{const P=_e.detail;P&&typeof P.collapsed=="boolean"&&pt(P.collapsed)};return window.addEventListener("storage",F),window.addEventListener("sidebar:changed",ae),()=>{window.removeEventListener("storage",F),window.removeEventListener("sidebar:changed",ae)}},[]);const[Fe,A]=x.useState(!1),W=x.useRef(null),H=un(),se=Jc({from:"/_layout/battle"});x.useEffect(()=>{const F=se==null?void 0:se.clear;if((typeof F=="string"?F.replace(/^"+|"+$/g,""):String(F))==="true"){s([]),l(""),f([]),h(!1),bn();try{C==null||C({}),ue==null||ue({}),ze==null||ze({})}catch{}S(null),xe(null),U(!1),Z(null),typeof window<"u"&&window.resetChatInputKnowledgeState&&window.resetChatInputKnowledgeState(),H({to:window.location.pathname,search:{},replace:!0})}},[se,H]),x.useEffect(()=>{if(!Ce.current||i.length===0)return;const F=i[i.length-1];!!(F!=null&&F.leftDone&&(F!=null&&F.rightDone))&&Ce.current.scrollTo({top:Ce.current.scrollHeight,behavior:"smooth"})},[i[i.length-1]]);const[re,Q]=x.useState(null),[me,D]=x.useState({});x.useEffect(()=>{const F=ae=>{W.current&&!W.current.contains(ae.target)&&A(!1)};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]),x.useEffect(()=>{if(i.length>1){const F=i[i.length-2];F&&F.decision===null&&!ne[F.id]&&ue(ae=>({...ae,[F.id]:!0}))}},[i,ne]);const q=760,fe=q+56,ke=240,$e=56;x.useEffect(()=>{(async()=>{try{(await fetch(`${Le.BASE}/api/v1/llms/?only_active=true`)).ok}catch(ae){console.error(ae)}finally{k(!1)}})()},[]);const Ke=cd(b||void 0);x.useEffect(()=>{const F=Ke.data;if(F)try{const ae=Array.isArray(F.messages)?F.messages:[],_e=G=>{if(!G)return"";const ee=ae.find(J=>J.id===G);return ee?ee.content??"":""},P=Array.isArray(F.turns)?F.turns.map(G=>{const ee=G.vote??null;let J=null;if(ee!=null&&ee.outcome)switch(ee.outcome){case"left_better":J="left";break;case"right_better":J="right";break;case"tie":J="tie";break;case"both_bad":J="bad";break;default:J=null}return{id:G.id??Ls(),turnId:G.id??void 0,user:_e(G.user_msg_id)||"",left:_e(G.left_msg_id),right:_e(G.right_msg_id),leftModel:G.left_model_name??G.leftModel??"",rightModel:G.right_model_name??G.rightModel??"",decision:J,leftDone:!0,rightDone:!0,showModels:!!J,isHistorical:!0,awaitingFeedback:!1,leftStarted:!0,rightStarted:!0,leftBuffer:"",rightBuffer:""}}):[];s(G=>{const ee=new Map;for(const Oe of G)Oe.turnId&&ee.set(Oe.turnId,Oe);const J=[];for(const Oe of P){const pe=Oe.turnId?ee.get(Oe.turnId):void 0;pe?J.push({...pe,...Oe,id:pe.id,isHistorical:!0,leftStarted:!0,rightStarted:!0,leftBuffer:"",rightBuffer:"",leftDone:!0,rightDone:!0,showModels:!!Oe.decision}):J.push(Oe)}const ge=new Set(P.map(Oe=>Oe.turnId));for(const Oe of G)!(!!Oe.turnId&&ge.has(Oe.turnId))&&!Oe.isHistorical&&J.push(Oe);return J})}catch(ae){console.error("Failed to map thread history:",ae)}},[Ke.data]),x.useEffect(()=>{Ke.data&&s(F=>F.map(ae=>ae.isHistorical&&!ae.decision&&ae.showModels?{...ae,showModels:!1}:ae))},[Ke.data]);const nt=async()=>{if(!a.trim()||g)return;const F=a.trim();if(xe(F),await z()){try{gr("message_sent",{message_length:F.length})}catch{}at(F)}},at=x.useCallback(async F=>{const ae=F||X||a.trim();if(!ae)return;l(""),xe(null),U(!0);try{const ee=Date.now();let J;for(let ge=i.length-1;ge>=0;ge--){const Oe=i[ge];if(Oe.feedbackSubmittedAt){J=Oe;break}}if(J!=null&&J.feedbackSubmittedAt){const ge=ee-J.feedbackSubmittedAt,Oe=qe=>qe.leftDone&&qe.rightDone&&(qe.decision===null||qe.awaitingFeedback===!0),pe=i.some(qe=>!qe.isHistorical&&Oe(qe));or("battle_next_message_after_feedback",{thread_id_before:b||null,turn_id_before:J.turnId||null,feedback_to_next_message_ms:ge,flow:b?"continue":"new_chat",has_pending_undecided_turn:pe})}}catch{}C(ee=>{const J={...ee};if(i.length>0){const ge=i[i.length-1];
76(ge.decision==="left"||ge.decision==="right")&&(J[ge.id]=null)}return J}),re&&re();const _e=Ls(),P=[{role:"user",content:ae}];s(ee=>[...ee,{id:_e,turnId:"",user:P[0].content,left:"",right:"",leftModel:"",rightModel:"",decision:null,leftDone:!1,rightDone:!1,showModels:!1,isHistorical:!1,awaitingFeedback:!1,leftStarted:!1,rightStarted:!1,leftBuffer:"",rightBuffer:"",userMessageSentAt:Date.now()}]),setTimeout(()=>{Ce.current&&Ce.current.scrollTo({top:Ce.current.scrollHeight,behavior:"smooth"})},0);const G=wa.battleDualChatWebSocket({thinking_mode:L,knowledge_operators:T,onSetup:ee=>{s(J=>J.map(ge=>ge.id===_e?{...ge,leftModel:ee[0].name,rightModel:ee[1].name}:ge))},onToken:(ee,J)=>{let ge=!1;s(Oe=>Oe.map(pe=>{if(pe.id!==_e)return pe;const qe=pe.leftModel&&pe.leftModel===pe.rightModel&&ee===pe.leftModel,He=ee===pe.leftModel||qe,_=ee===pe.rightModel||qe,B=pe.leftStarted||He,Y=pe.rightStarted||_;if(!(B&&Y))return He?{...pe,leftStarted:!!B,rightStarted:!!Y,leftBuffer:pe.leftBuffer+J,leftStreamStartAt:pe.leftStreamStartAt||(He?Date.now():pe.leftStreamStartAt)}:_?{...pe,leftStarted:!!B,rightStarted:!!Y,rightBuffer:pe.rightBuffer+J,rightStreamStartAt:pe.rightStreamStartAt||(_?Date.now():pe.rightStreamStartAt)}:pe;let we=pe.left,oe=pe.right;pe.leftBuffer&&(we+=pe.leftBuffer),pe.rightBuffer&&(oe+=pe.rightBuffer),He&&(we+=J),_&&!qe&&(oe+=J),qe&&(oe+=J);const Qe={...pe,left:we,right:oe,leftBuffer:"",rightBuffer:"",leftStarted:!!B,rightStarted:!!Y,leftStreamStartAt:pe.leftStreamStartAt||(He?Date.now():pe.leftStreamStartAt),rightStreamStartAt:pe.rightStreamStartAt||(_||qe?Date.now():pe.rightStreamStartAt),bothStartedAt:pe.bothStartedAt||Date.now()};try{const ye=Qe.leftStreamStartAt??Number.POSITIVE_INFINITY,rt=Qe.rightStreamStartAt??Number.POSITIVE_INFINITY,ft=ye>rt?"left":"right";(ft==="left"&&He||ft==="right"&&_)&&(ge=!0)}catch{}return Qe})),ge&&setTimeout(()=>{Ce.current&&Ce.current.scrollTo({top:Ce.current.scrollHeight,behavior:"smooth"})},0)},onDone:ee=>{s(J=>J.map(ge=>{var ye;if(ge.id!==_e)return ge;let{left:Oe,right:pe,leftBuffer:qe,rightBuffer:He,leftDone:_,rightDone:B}=ge;const Y=ee===ge.leftModel,de=ee===ge.rightModel,we=ge.leftModel&&ge.leftModel===ge.rightModel&&Y,oe=!!(ge.leftStarted&&ge.rightStarted);Y&&(_=!0),de&&(B=!0),we&&(_=!0,B=!0),oe&&(qe&&(Oe+=qe,qe=""),He&&(pe+=He,He="")),_&&B&&U(!1);const Qe={...ge,left:Oe,right:pe,leftBuffer:qe,rightBuffer:He,leftDone:_,rightDone:B};if(_&&B&&!ge.responsesCompletedAt){const rt=Date.now();Qe.responsesCompletedAt=rt;try{const ft=ge.userMessageSentAt?rt-ge.userMessageSentAt:void 0,Re=ge.leftStreamStartAt&&ge.rightStreamStartAt?Math.abs(ge.rightStreamStartAt-ge.leftStreamStartAt):void 0;or("battle_turn_ready",{thread_id:b||null,turn_id:ge.turnId||null,left_model:Qe.leftModel,right_model:Qe.rightModel,user_msg_length:((ye=ge.user)==null?void 0:ye.length)??0,response_time_ms:ft,both_started_delta_ms:Re,same_model_names:Qe.leftModel===Qe.rightModel})}catch{}}return Qe}))},onError:(ee,J)=>{U(!1),console.error("Battle websocket error:",ee);const ge=` 77[Error: We couldn't complete this assistant's response. Please try again. If this keeps happening, clear cache/cookies, check your connection, or try later.]`;s(Oe=>Oe.map(pe=>{if(pe.id!==_e)return pe;let qe=null;J&&(J===pe.leftModel?qe="left":J===pe.rightModel&&(qe="right")),qe||(pe.leftStarted&&!pe.rightStarted?qe="right":pe.rightStarted&&!pe.leftStarted||pe.left.length===0&&pe.right.length>0?qe="left":pe.right.length===0&&pe.left.length>0?qe="right":qe=pe.left.length<=pe.right.length?"left":"right");const He={...pe};return qe==="left"?(He.left=`${pe.left}${ge}`,He.leftDone=!0,He.rightBuffer&&(He.right=He.right+He.rightBuffer,He.rightBuffer=""),He.leftStarted=!0,He.rightStarted=!0,He.bothStartedAt||(He.bothStartedAt=Date.now())):(He.right=`${pe.right}${ge}`,He.rightDone=!0,He.leftBuffer&&(He.left=He.left+He.leftBuffer,He.leftBuffer=""),He.leftStarted=!0,He.rightStarted=!0,He.bothStartedAt||(He.bothStartedAt=Date.now())),He.leftDone&&He.rightDone&&!He.responsesCompletedAt&&(He.responsesCompletedAt=Date.now()),He}))},onClose:()=>{Q(null)},onThreadCreated:ee=>{S(ee)},onTurnCreated:ee=>{s(J=>J.map(ge=>ge.id===_e?{...ge,turnId:ee}:ge))}})(P,b||void 0);Q(()=>G)},[X,a,i,re,b,L,T]),vt=x.useCallback(async()=>{await I(),X&&at(X)},[X,I,at]),Et=async F=>{const ae=i.find(P=>P.id===F);if(!ae)return;if(!ae.decision){D(P=>({...P,[F]:"Please select a choice before sending feedback."}));return}const _e=(v[ae.id]??"").trim();if(ae.turnId&&ae.decision)try{try{const G=Date.now(),ee=ae.responsesCompletedAt?G-ae.responsesCompletedAt:void 0,J=ae.decisionMadeAt?G-ae.decisionMadeAt:void 0,ge={left:"left_better",right:"right_better",tie:"tie",bad:"both_bad"};or("battle_feedback_submitted",{thread_id:b||null,turn_id:ae.turnId,outcome:ge[ae.decision],feedback_length:_e.length,time_since_ready_ms:ee,t
77ime_since_decision_ms:J})}catch{}let P;switch(ae.decision){case"left":P="left_better";break;case"right":P="right_better";break;case"tie":P="tie";break;case"bad":P="both_bad";break;default:P="tie"}await je.mutateAsync({turn_id:ae.turnId,outcome:P,feedback_text:_e})}catch(P){console.error("Failed to submit vote:",P)}D(P=>({...P,[F]:""})),ue(P=>({...P,[F]:!0})),s(P=>P.map(G=>G.id===F?{...G,showModels:!0,awaitingFeedback:!1,feedbackSubmittedAt:Date.now()}:G)),re&&(re(),Q(null)),setTimeout(()=>{const P=Gt.slice(-4);P.length>0&&Ee.current&&Ee.current.triggerProactiveSuggestion(P)},300)},ht=x.useCallback((F,ae)=>{const _e=i.find(ee=>ee.id===F),P=!!ie[F],G=Date.now();if(_e)try{const ee=_e.responsesCompletedAt?G-_e.responsesCompletedAt:void 0;or("battle_decision_made",{thread_id:b||null,turn_id:_e.turnId||null,decision:ae,revealed_other_before_decision:P,time_since_ready_ms:ee}),or("battle_feedback_opened",{thread_id:b||null,turn_id:_e.turnId||null,decision:ae,time_since_ready_ms:ee})}catch{}s(ee=>ee.map(J=>J.id===F?{...J,decision:ae,awaitingFeedback:!0,decisionMadeAt:J.decisionMadeAt||G,feedbackOpenedAt:J.feedbackOpenedAt||G}:J)),D(ee=>({...ee,[F]:""}))},[i,ie,b]),Ze=(F,ae)=>{if(F.decision){if(F.decision==="tie")return"green.500";if(F.decision==="bad")return"red.500";if(F.decision===ae)return"green.500";if(F.decision==="left"||F.decision==="right")return le("ui.textSecondary","ui.border")}if(he&&he.turnId===F.id){if(he.pick==="tie")return"green.500";if(he.pick==="bad")return"red.500";if(he.pick===ae)return"green.500";if(he.pick&&(he.pick==="left"||he.pick==="right"))return le("ui.textSecondary","ui.border")}return le("ui.muted","ui.border")},Xe=F=>F.leftDone&&F.rightDone&&(F.decision===null||F.awaitingFeedback===!0),jt=i.some(Xe),Gt=x.useMemo(()=>{const F=[];for(const ae of i){ae.user&&F.push({role:"user",content:ae.user});let _e="";ae.decision==="left"||ae.decision===null?_e=ae.left:ae.decision==="right"?_e=ae.right:ae.decision==="tie"?_e=`${ae.left} 78 79${ae.right}`:ae.decision==="bad"&&(_e=ae.left),_e&&F.push({role:"assistant",content:_e})}return F.slice(-4)},[i]),{suggestions:Yt,requestInitialSuggestions:en,clearSuggestion:bn,isLoading:tn}=ba({enabled:!K&&!jt,debounceMs:300,minLength:6,chatHistory:Gt});x.useEffect(()=>{Yt&&Yt.length>0&&(f(Yt),h(!0))},[Yt]);const At=x.useRef(null),[pn,gt]=x.useState(!1),Bt=x.useCallback(F=>{l(F);const ae=F.trim(),_e=i.length===0;At.current&&(clearTimeout(At.current),At.current=null,gt(!1));const P=/[.?!]$/.test(ae),G=ae.length>50;_e&&ae.length>=6&&ae.length<=50&&!P?(gt(!0),f([]),h(!0),At.current=setTimeout(()=>{en(ae),gt(!1),At.current=null},300)):_e&&(ae.length<6||P||G)?(h(!1),gt(!1),f([]),bn()):ae.length===0&&(h(!1),gt(!1),f([]),bn())},[i.length,en,bn]);x.useEffect(()=>()=>{At.current&&clearTimeout(At.current)},[]);const nn=i.length===0,dt=(F,ae)=>{const _e=ae==="left"?F.left:F.right,P=!!(F.leftStarted&&F.rightStarted),G=!!_e&&_e.trim().length>0;if(!P)return o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})});if(G)return o.jsx(m,{mt:"1.25rem",...w,children:o.jsx(Rn,{message:{role:"assistant",content:_e}})});const ee=!!(F.showModels||F.feedbackSubmittedAt),J=F.leftDone&&F.rightDone;return(F.isHistorical||ee||J)&&!G?o.jsx(m,{mt:"1.25rem",...w,children:o.jsx(Rn,{message:{role:"assistant",content:"Error: No Response returned by the model"}})}):o.jsx(m,{mt:"1.25rem",children:o.jsx(Xn,{})})};function kn(F,ae,_e){const P=G=>G==="left"?F.leftModel:F.rightModel;return!_e&&(F.decision==="left"||F.decision==="right")&&!ae[F.id]?o.jsxs(m,{flex:"1 1 0%",width:"100%",...E,borderColor:Ze(F,F.decision==="left"?"left":"right"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(P(F.decision==="left"?"left":"right")),alt:"",boxSize:"10px",filter:j.iconFilter}),P(F.decision==="left"?"left":"right")]}):o.jsxs(o.Fragment,{children:["Assistant ",F.decision==="left"?"A":"B"]})}
79),dt(F,F.decision==="left"?"left":"right"),o.jsx(m,{mt:2,display:"flex",justifyContent:"flex-start",children:o.jsx(We,{size:"xs",variant:"outline",colorScheme:"gray",bg:"ui.sidebar",color:le("ui.text","ui.textSecondary"),borderColor:le("ui.muted","ui.textSecondary"),_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:le("ui.textSecondary","ui.border")},onClick:()=>{try{or("battle_reveal_other_response",{thread_id:b||null,turn_id:F.turnId||null,action:"show",time_since_ready_ms:F.responsesCompletedAt?Date.now()-F.responsesCompletedAt:void 0,decision_set:!!F.decision})}catch{}C(G=>({...G,[F.id]:F.decision==="left"?"right":"left"}))},children:"Show both responses"})})]}):!_e&&(F.decision==="left"||F.decision==="right")&&ae[F.id]?o.jsxs(o.Fragment,{children:[o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"left"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(P("left")),alt:"",boxSize:"10px",filter:j.iconFilter}),P("left")]}):o.jsx(o.Fragment,{children:"Assistant A"})}),dt(F,"left")]}),o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"right"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(P("right")),alt:"",boxSize:"10px",filter:j.iconFilter}),P("right")]}):o.jsx(o.Fragment,{children:"Assistant B"})}),dt(F,"right"),o.jsx(m,{mt:2,display:"flex",justifyContent:"flex-start",children:o.jsx(We,{size:"xs",variant:"outline",colorScheme:"gray",bg:"ui.sidebar",color:le("ui.text","ui.textSecondary"),borderColor:le("ui.muted","ui.textSecondary"),_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:le("ui.textSecondary","ui.border")},onClick:()=>{try{or("battle_reveal_other_response",{thread_id:b||null,turn_id:F.turnId||null,action:"hide",time_since_ready_ms:F.responsesCompletedAt?Date.now()-F.responsesCompletedAt:void 0,decision_set:!!F.decision})}catch{}C(G=>({...G,[F.id]:null}))},children:"Hide this response"})})]})]}):F.decision==="left"&&ae[F.id]!=="right"&&!_e||F.decision==="right"&&ae[F.id]!=="left"&&!_e||F.decision==="left"&&ae[F.id]==="right"&&!_e||F.decision==="right"&&ae[F.id]==="left"&&!_e?null:(F.decision==="left"||F.decision==="right")&&_e?o.jsxs(o.Fragment,{children:[o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"left"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(F.leftModel),alt:"",boxSize:"10px",filter:j.iconFilter}),F.leftModel]}):o.jsx(o.Fragment,{children:"Assistant A"})}),dt(F,"left")]}),o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"right"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(F.rightModel),alt:"",boxSize:"10px",filter:j.iconFilter}),F.rightModel]}):o.jsx(o.Fragment,{children:"Assistant B"})}),dt(F,"right")]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"left"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(F.leftModel),alt:"",boxSize:"10px",filter:j.iconFilter}),F.leftModel]}):o.jsx(o.Fragment,{children:"Assistant A"})}),dt(F,"left")]}),o.jsxs(m,{flex:"1 1 0%",...E,borderColor:Ze(F,"right"),children:[o.jsx(m,{position:"absolute",top:"0.3rem",left:"0.3rem",fontSize:"xs",fontFamily:"'IBM Plex Mono', monospace",color:"var(--chakra-colors-palette-gray)",bg:"transparent",px:2,py:1,borderRadius:"md",display:"inline-flex",alignItems:"center",gap:1,children:F.showModels?o.jsxs(o.Fragment,{children:[o.jsx(tt,{src:Lt(F.rightModel),alt:"",boxSize:"10px",filter:j.iconFilter}),F.rightModel]}):o.jsx(o.Fragment,{children:"Assistant B"})}),dt(F,"right")]})]})}return o.jsxs(Me,{direction:"column",flex:1,minH:2,height:"100%",fontFamily:"'Geomanist', 'Inter', sans-serif",children:[(n==null?void 0:n.is_superuser)&&!r&&o.jsx(Me,{alignItems:"center",justifyContent:"center",borderBottomWidth:"0",borderColor:"transparent",mt:4,children:o.jsxs(m,{position:"relative",ref:W,fontFamily:"'Geomanist', 'Inter', sans-serif",children:[o.jsxs(m,{onClick:()=>A(!Fe),fontFamily:"'IBM Plex Mono', monospace",minW:"200px",h:"36px",border:"1.5px solid",borderColor:le("ui.muted","ui.textSecondary"),borderRadius:"xl",bg:le("ui.background","ui.sidebar"),p:"0 2.5rem 0 0.75rem",display:"flex",alignItems:"center",cursor:"pointer",color:j.modeActiveColor,_hover:{borderColor:"ui.main",bg:j.modeHoverBg},boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsx(tt,{src:window.location.pathname==="/battle"?"/assets/images/battle.svg":"/assets/images/send.svg",alt:"",boxSize:"16px",filter:j.iconFilter,mr:2}),window.location.pathname==="/battle"?"Battle":"Single Chat",o.jsx(m,{position:"absolute",right:"0.75rem",color:"ui.textSecondary",transform:Fe?"rotate(180deg)":"none",transition:"transform 0.2s",children:"â¼"})]}),Fe&&o.jsxs(m,{position:"absolute",top:"100%",left:0,right:0,mt:1,bg:le("ui.background","ui.sidebar"),fontFamily:"'IBM Plex Mono', monospace",border:`1.5px solid ${le("ui.muted","ui.textSecondary")}`,borderRadius:"xl",zIndex:12e3,py:1,boxShadow:"0 2px 8px 0 rgba(16,20,24,0.12)",children:[o.jsxs(m,{onClick:()=>{A(!1),window.location.pathname==="/battle"&&H({to:"/"})},p:"0.5rem 0.75rem",cursor:"pointer",bg:window.location.pathname!=="/battle"?"ui.main":"transparent",color:le("ui.text","white"),borderRadius:"xl",_hover:{backgroundColor:le("ui.muted","ui.sidebar")},display:"flex",alignItems:"center",gap:2,fontWeight:(window.location.pathname!=="/battle",400),children:[o.jsx(tt,{src:"/assets/images/send.svg",alt:"",boxSize:"16px",filter:j.iconFilter}),"Single Chat"]}),o.jsxs(m,{onClick:()=>{A(!1),window.location.pathname==="/battle"&&H({to:"/",search:{mode:"dual"}})},p:"0.5rem 0.75rem",cursor:"pointer",bg:"transparent",color:le("ui.text","white"),borderRadius:"xl",_hover:{backgroundColor:le("ui.muted","ui.sidebar")},display:"flex",alignItems:"center",gap:2,children:[o.jsx(tt,{src:"/assets/images/sbs.svg",alt:"",boxSize:"16px",filter:j.iconFilter}),"Side by Side"]}),o.jsxs(m,{onClick:()=>{A(!1),window.location.pathname!=="/battle"&&H({to:"/battle"})},p:"0.5rem 0.75rem",cursor:"pointer",bg:window.location.pathname==="/battle"?"ui.main":"transparent",color:le("ui.text","white"),borderRadius:"xl",_hover:{backgroundColor:le("ui.muted","ui.sidebar")},display:"flex",alignItems:"center",gap:2,fontWeight:(window.location.pathname==="/battle",400),children:[o.jsx(tt,{src:"/assets/images/battle.svg",alt:"",boxSize:"16px",filter:j.iconFilter}),"Battle"]})]})]})}),o.jsx(m,{ref:Ce,flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:4,minH:0,px:{base:2,md:4},py:2,children:o.jsx(m,{w:"100%",display:"flex",justifyContent:De?"center":"flex-start",children:o.jsx(m,{w:"100%",maxW:{base
79:De?"98%":"100%",md:De?"90%":"100%"},display:"flex",flexDirection:"column",children:i.length>0&&i.map((F,ae)=>{const _e=ae===i.length-1;return o.jsxs(m,{display:"flex",flexDirection:"column",gap:2,children:[o.jsx(Rn,{message:{role:"user",content:F.user}}),o.jsx(Me,{gap:{base:2,md:4},direction:"row",w:"100%",align:"stretch",flexWrap:"nowrap",children:kn(F,ie,_e)}),(F.decision===null||F.awaitingFeedback)&&!ne[F.id]&&F.leftDone&&F.rightDone&&o.jsxs(m,{maxW:"700px",w:"100%",mx:"auto",display:"flex",flexDirection:"column",alignItems:"center",mt:4,children:[o.jsxs(Me,{ref:Ae(F.id),justify:"center",gap:4,flexWrap:"wrap",w:"max-content",maxW:"100%",mx:"auto",children:[o.jsxs(We,{bg:"ui.sidebar",color:le("ui.text","white"),borderRadius:"1rem",border:"1px solid",fontWeight:"400",fontSize:{base:"sm",md:"md"},px:{base:3,md:4},py:{base:2.5,md:3},_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:(he==null?void 0:he.pick)==="left"?"green.500":le("ui.textSecondary","ui.border")},_active:{bg:le("ui.muted","ui.sidebar")},borderColor:F.decision==="left"||(he==null?void 0:he.pick)==="left"?"green.500":le("ui.muted","ui.border"),onMouseEnter:()=>Pe({turnId:F.id,pick:"left"}),onMouseLeave:()=>Pe(null),onClick:()=>ht(F.id,"left"),children:[o.jsx(m,{as:mu,mr:2,fontSize:"1.1em"}),"Left is Better"]}),o.jsxs(We,{bg:"ui.sidebar",color:le("ui.text","white"),borderRadius:"1rem",border:"1px solid",fontWeight:"400",fontSize:{base:"sm",md:"md"},px:{base:3,md:4},py:{base:2.5,md:3},_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:(he==null?void 0:he.pick)==="tie"?"green.500":le("ui.textSecondary","ui.border")},_active:{bg:le("ui.muted","ui.sidebar")},borderColor:F.decision==="tie"||(he==null?void 0:he.pick)==="tie"?"green.500":le("ui.muted","ui.border"),onMouseEnter:()=>Pe({turnId:F.id,pick:"tie"}),onMouseLeave:()=>Pe(null),onClick:()=>ht(F.id,"tie"),children:[o.jsx(m,{as:"span",mr:2,fontSize:"1.1em",children:"ð¤"}),"It's a tie"]}),o.jsxs(We,{bg:"ui.sidebar",color:le("ui.text","white"),borderRadius:"1rem",border:"1px solid",fontWeight:"400",fontSize:{base:"sm",md:"md"},px:{base:3,md:4},py:{base:2.5,md:3},_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:(he==null?void 0:he.pick)==="bad"?"red.500":le("ui.textSecondary","ui.border")},_active:{bg:le("ui.muted","ui.sidebar")},borderColor:F.decision==="bad"||(he==null?void 0:he.pick)==="bad"?"red.500":le("ui.muted","ui.border"),onMouseEnter:()=>Pe({turnId:F.id,pick:"bad"}),onMouseLeave:()=>Pe(null),onClick:()=>ht(F.id,"bad"),children:[o.jsx(m,{as:ku,mr:2,fontSize:"1.1em"}),"Both are bad"]}),o.jsxs(We,{bg:"ui.sidebar",color:le("ui.text","white"),borderRadius:"1rem",border:"1px solid",fontWeight:"400",fontSize:{base:"sm",md:"md"},px:{base:3,md:4},py:{base:2.5,md:3},_hover:{bg:le("ui.muted","ui.sidebar"),borderColor:(he==null?void 0:he.pick)==="right"?"green.500":le("ui.textSecondary","ui.border")},_active:{bg:le("ui.muted","ui.sidebar")},borderColor:F.decision==="right"||(he==null?void 0:he.pick)==="right"?"green.500":le("ui.muted","ui.border"),onMouseEnter:()=>Pe({turnId:F.id,pick:"right"}),onMouseLeave:()=>Pe(null),onClick:()=>ht(F.id,"right"),children:["Right is Better",o.jsx(m,{as:gu,ml:2,fontSize:"1.1em"})]})]}),o.jsx(m,{mt:4,mx:"auto",w:et[F.id]?`${et[F.id]}px`:"auto",maxW:"100%",children:o.jsxs(m,{bg:"transparent",borderRadius:"xl",p:0,children:[o.jsxs(m,{display:"grid",gridTemplateColumns:"1fr auto",columnGap:0,alignItems:"stretch",children:[o.jsx(ra,{ref:ve(F.id),value:v[F.id]??"",onChange:P=>ze(G=>({...G,[F.id]:P.target.value})),placeholder:"Share a reason? (Optional)",bg:"ui.sidebar",color:j.feedbackText,borderTopLeftRadius:"xl",borderBottomLeftRadius:"xl",borderTopRightRadius:0,borderBottomRightRadius:0,border:"none",resize:"vertical",minH:"5rem",onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),Et(F.id))}}),o.jsx(We,{bg:"button.primary",fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif",color:"white",borderTopRightRadius:"xl",borderBottomRightRadius:"xl",borderTopLeftRadius:0,borderBottomLeftRadius:0,border:"none",_hover:{bg:"button.primaryHover"},onClick:()=>Et(F.id),height:"100%",minH:"5rem",children:"Continue"})]}),o.jsx(m,{color:"red.400",fontSize:"sm",mt:2,minH:"20px",visibility:me[F.id]?"visible":"hidden",children:me[F.id]||" "})]})})]})]},F.id)})})})}),nn?o.jsx(Me,{flex:100,position:"relative",px:{base:2,md:4}
79,children:o.jsx(m,{w:"100%",maxW:{base:"95%",md:`${q}px`},position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",children:o.jsxs(m,{display:"flex",flexDirection:"column",alignItems:"center",gap:6,children:[i.length===0&&o.jsx(Na,{isAdmin:!!(n!=null&&n.is_superuser&&!r)}),!1,o.jsx(m,{w:"100%",bg:"ui.sidebar",borderRadius:"xl",p:2,style:K||jt?{opacity:.6,pointerEvents:"none"}:{},children:o.jsx(Dr,{ref:Ee,isLoading:K||jt,disableCaret:K||jt,showSpinnerWhenLoading:K,value:a,onChange:Bt,onSend:nt,thinkingModeEnabled:L,onThinkingModeChange:O,showKnowledgeToggle:!(n!=null&&n.is_superuser)&&!r,knowledgeOperator:T,onKnowledgeOperatorChange:Z,messages:Gt})}),i.length===0&&o.jsx(m,{w:"100%",h:{base:"320px",md:"200px"},overflowY:"auto",children:(()=>{const F=p&&d.length>0,ae=!F&&a.trim().length<6;if((pn||tn)&&a.trim().length>=6&&!F)return o.jsxs(m,{mt:-1,px:2,display:"flex",alignItems:"center",gap:2,w:"100%",maxW:`${q}px`,mx:"auto",children:[o.jsx(cn,{size:"xs"}),o.jsx(N,{fontSize:"xs",color:"ui.textSecondary",children:"Loading suggestionsâ¦"})]});if(ae){const P=c,G=P.slice(0,3),ee=P.slice(3);return o.jsxs(m,{mt:0,px:2,w:"100%",maxW:`${fe}px`,mx:"auto",children:[o.jsx(Me,{gap:2,justify:"center",flexWrap:"wrap",direction:{base:"column",md:"row"},children:G.map((J,ge)=>o.jsx(We,{size:"sm",borderRadius:"md",bg:"transparent",borderWidth:"0.5px",borderColor:"ui.mutedBorder",color:"ui.textSecondary",fontWeight:"400",fontSize:"xs",whiteSpace:"normal",textAlign:"center",px:1.5,py:1.5,w:{base:"100%",md:`${ke}px`},h:"auto",minH:`${$e}px`,display:"flex",alignItems:"center",justifyContent:"center",_hover:{bg:"ui.buttonHover",color:"ui.text"},_active:{bg:"ui.buttonHover",color:"ui.text"},onClick:()=>l(J),children:o.jsx(N,{as:"span",noOfLines:2,lineHeight:"short",wordBreak:"break-word",display:"block",children:J})},`suggestion-1-${ge}`))}),ee.length>0&&o.jsx(Me,{gap:2,justify:"center",mt:2,direction:{base:"column",md:"row"},children:ee.map((J,ge)=>o.jsx(We,{size:"sm",borderRadius:"md",bg:"transparent",borderWidth:"0.5px",borderColor:"ui.mutedBorder",color:"ui.textSecondary",fontWeight:"400",fontSize:"xs",whiteSpace:"normal",textAlign:"center",px:1.5,py:1.5,w:{base:"100%",md:`${ke}px`},h:"auto",minH:`${$e}px`,display:"flex",alignItems:"center",justifyContent:"center",_hover:{bg:"ui.buttonHover",color:"ui.text"},_active:{bg:"ui.buttonHover",color:"ui.text"},onClick:()=>l(J),children:o.jsx(N,{as:"span",noOfLines:2,lineHeight:"short",wordBreak:"break-word",display:"block",children:J})},`suggestion-2-${ge}`))})]})}if(F){const P=le("gray.200","gray.700"),G=le("gray.50","whiteAlpha.50"),ee=le("gray.600","gray.400");return o.jsx(m,{mt:-2,pointerEvents:"auto",w:"100%",maxW:`${q}px`,mx:"auto",children:d.map((J,ge)=>o.jsx(tr.button,{type:"button",onClick:()=>{l(J),h(!1)},w:"100%",textAlign:"left",py:2,px:2,bg:"transparent",color:"ui.text",fontSize:"sm",borderRadius:"none",border:"none",borderBottomWidth:ge===d.length-1?"0":"0.5px",borderBottomColor:P,borderBottomStyle:"solid",display:"flex",gap:1,_hover:{bg:G},_active:{bg:G},_focus:{outline:"none"},cursor:"pointer",children:o.jsx(tr.span,{color:ee,children:J})},`${J}-${ge}`))})}return null})()})]})})}):o.jsx(m,{as:"footer",w:"100%",px:{base:2,md:4},pb:"calc(1rem + env(safe-area-inset-bottom))",pt:0,bg:"transparent",position:"sticky",bottom:0,display:"flex",justifyContent:De?"center":"flex-start",children:o.jsxs(m,{w:"100%",maxW:De?"90%":"100%",display:"flex",flexDirection:"column",children:[!1,o.jsx(m,{w:"100%",bg:"ui.sidebar",borderRadius:"xl",p:2,style:K||jt?{opacity:.6,pointerEvents:"none"}:{},children:o.jsx(Dr,{ref:Ee,isLoading:K||jt,disableCaret:K||jt,showSpinnerWhenLoading:K,value:a,onChange:Bt,onSend:nt,thinkingModeEnabled:L,onThinkingModeChange:O,showKnowledgeToggle:!(n!=null&&n.is_superuser)&&!r,knowledgeOperator:T,onKnowledgeOperatorChange:Z,messages:Gt})}),o.jsx(m,{display:"flex",justifyContent:"center",pointerEvents:"none",mt:2,children:o.jsx(m,{as:"small",color:"ui.textSecondary",children:"Inputs are processed by third-party AI and responses may be inaccurate."})})]})}),o.jsx(ad,{isOpen:y,onClose:()=>R(!1)}),o.jsx(Po,{isOpen:M,onAccept:vt,onError:$})]})}const kC=Uo({threadId:si().optional(),clear:si().optional()}),Gf=Qt("/_layout/battle")({component:SC,validateSearch:e=>kC.parse(e)});function SC(){const{threadId:e}=Gf.useSearch();return o.jsx(xf,{enabled:!1,children:o.jsx(wC,{threadId:e})})}async function vC(){const e=`${Le.BASE}/api/v1/analytics`,t=localStorage.getItem("access_token");return(await kt.get(e,{withCredentials:!0,headers:t?{Authorization:`Bearer ${t}`}:{}})).data}async function jC(e=!1){const t=`${Le.BASE}/api/v1/analytics/users`,n=localStorage.getItem("access_token");return(await kt.get(t,{withCredentials:!0,headers:n?{Authorization:`Bearer ${n}`}:{},params:{is_guest:e}})).data}async function _C(e){const t=`${Le.BASE}/api/v1/threads/`,n=localStorage.getItem("access_token");return(await kt.get(t,{withCredentials:!0,headers:n?{Authorization:`Bearer ${n}`}:{},params:{user_id:e}})).data}async function CC(e){const t=`${Le.BASE}/api/v1/threads/${e}/history`,n=localStorage.getItem("access_token");return(await kt.get(t,{withCredentials:!0,headers:n?{Authorization:`Bearer ${n}`}:{}})).data}const EC=Qt("/_layout/analytics")({component:AC});
79function AC(){const[e,t]=x.useState(null),[n,r]=x.useState([]),[i,s]=x.useState(""),[a,l]=x.useState([]),[c,u]=x.useState(null),[d,f]=x.useState(null),[p,h]=x.useState(null),[g,k]=x.useState(!0),[b,S]=x.useState(null),[y,R]=x.useState(!1);x.useEffect(()=>{vC().then(t).catch(I=>S((I==null?void 0:I.message)||"Failed to load analytics")).finally(()=>k(!1))},[]),x.useEffect(()=>{jC(y).then(I=>{r((I==null?void 0:I.data)||[])}).catch(I=>S((I==null?void 0:I.message)||"Failed to load users for analytics"))},[y]);const[L,O]=x.useState(""),[T,Z]=x.useState(!1);x.useEffect(()=>{if(!i){l([]);return}_C(i).then(I=>{l((I||[]).filter(X=>X.mode==="dual"||X.mode==="battle"))}).catch(I=>S((I==null?void 0:I.message)||"Failed to load threads for user"))},[i]),x.useEffect(()=>{if(!c){f(null),h(null);return}CC(c).then(I=>{f(I),I!=null&&I.turns&&I.turns.length>0&&h(I.turns[0].idx)}).catch(I=>S((I==null?void 0:I.message)||"Failed to load thread history"))},[c]);const[j,E,w,M]=yp("colors",["table.cellBg","table.border","table.headerBg","ui.surface"]),z="Geomanist, sans-serif";return o.jsxs(m,{maxW:"1100px",mx:"auto",py:10,px:4,fontFamily:z,children:[o.jsx(Te,{mb:8,fontFamily:z,fontWeight:"400",fontSize:{base:"2xl",md:"3xl"},letterSpacing:"tight",children:"Analytics"}),g&&o.jsx(cn,{size:"lg",color:"blue.400"}),b&&o.jsx(m,{color:"red.500",mb:4,children:b}),e&&o.jsxs(o.Fragment,{children:[e.user_counts&&o.jsxs(m,{mb:4,display:"flex",gap:6,alignItems:"center",children:[o.jsxs(m,{children:[o.jsx(m,{fontSize:"sm",color:"ui.textSecondary",children:"Total users"}),o.jsx(m,{fontSize:"xl",children:e.user_counts.total})]}),o.jsxs(m,{children:[o.jsx(m,{fontSize:"sm",color:"ui.textSecondary",children:"Signed-up users"}),o.jsx(m,{fontSize:"xl",children:e.user_counts.signed_up})]}),o.jsxs(m,{children:[o.jsx(m,{fontSize:"sm",color:"ui.textSecondary",children:"Guest users"}),o.jsx(m,{fontSize:"xl",children:e.user_counts.guest})]})]}),o.jsx(m,{borderRadius:"xl",boxShadow:"md",overflow:"hidden",bg:j,border:"1px solid",borderColor:E,children:o.jsxs(cr,{style:{tableLayout:"fixed",width:"100%"},children:[o.jsx(ur,{children:o.jsxs(Pt,{style:{background:w},children:[o.jsx(mt,{style:{fontWeight:400,fontSize:"1rem",padding:"1rem 1.5rem",letterSpacing:"0.03em"},children:"Type"}),o.jsx(mt,{style:{fontWeight:400,fontSize:"1rem",padding:"1rem 1.5rem",letterSpacing:"0.03em"},children:"Total"}),o.jsx(mt,{style:{fontWeight:400,fontSize:"1rem",padding:"1rem 1.5rem",letterSpacing:"0.03em"},children:"Present in Sample Questions"}),o.jsx(mt,{style:{fontWeight:400,fontSize:"1rem",padding:"1rem 1.5rem",letterSpacing:"0.03em"},children:"Not Present in Sample Questions"})]})}),o.jsxs(dr,{children:[o.jsxs(Pt,{style:{transition:"background 0.2s"},_hover:{background:M},children:[o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:"User Messages"}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.user_message_stats.total}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.user_message_stats.present_in_sample_questions}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.user_message_stats.not_present_in_sample_questions})]}),o.jsxs(Pt,{style:{transition:"background 0.2s"},_hover:{background:M},children:[o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:"First Messages"}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.first_message_stats.total}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.first_message_stats.present_in_sample_questions}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.first_message_stats.not_present_in_sample_questions})]}),o.jsxs(Pt,{style:{transition:"background 0.2s"},_hover:{background:M},children:[o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:"Follow Up Messages"}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.follow_up_message_stats.total}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.follow_up_message_stats.present_in_sample_questions}),o.jsx(Ge,{style:{padding:"0.75rem 1.5rem"},children:e.follow_up_message_stats.not_present_in_sample_questions})]})]})]})}),o.jsxs(m,{display:"flex",alignItems:"center",gap:4,mt:4,children:[o.jsxs(m,{position:"relative",width:340,children:[o.jsx("input",{"aria-label":"Select user",value:L,onChange:I=>{O(I.target.value),Z(!0)},onFocus:()=>Z(!0),onBlur:()=>setTimeout(()=>Z(!1),150),placeholder:"Type to search users",style:{fontFamily:z,fontSize:"1rem",padding:"0.5rem 1rem",borderRadius:8,border:`1px solid ${E}`,width:"100%"}}),T&&o.jsxs(m,{position:"absolute",top:"calc(100% + 6px)",left:0,right:0,zIndex:20,bg:j,border:`1px solid ${E}`,borderRadius:"md",maxH:"200px",overflowY:"auto",children:[n.filter(I=>{const $=I.is_guest?`guest: ${I.id}`:`${I.full_name||"(no name)"} â ${I.email}`;return L.trim()===""||$.toLowerCase().includes(L.toLowerCase())}).map(I=>{const $=I.is_guest?`guest: ${I.id}`:`${I.full_name||"(no name)"} â ${I.email}`;return o.jsx(m,{onMouseDown:()=>{s(I.id),O($),Z(!1)},px:3,py:2,_hover:{bg:"ui.muted"},style:{cursor:"pointer"},title:$,children:$},I.id)}),n.length===0&&o.jsx(m,{px:3,py:2,color:"ui.textSecondary",children:"No users"})]})]}),o.jsxs("label",{style:{display:"flex",alignItems:"center",fontFamily:z,fontSize:"1rem",gap:6},children:[o.jsx("input",{type:"checkbox",checked:y,onChange:I=>R(I.target.checked),style:{marginRight:6}}),"Include guest users"]})]}),a.length>0&&o.jsx(m,{mt:6,borderRadius:"md",overflow:"hidden",border:`1px solid ${E}`,children:o.jsxs(cr,{style:{width:"100%"},children:[o.jsx(ur,{children:o.jsxs(Pt,{style:{background:w},children:[o.jsx(mt,{children:"Title"}),o.jsx(mt,{children:"ID"}),o.jsx(mt,{children:"Mode"}),o.jsx(mt,{children:"Last Message"})]})}),o.jsx(dr,{children:a.map(I=>o.jsxs(Pt,{onClick:()=>u(I.id),style:{cursor:"pointer"},children:[o.jsx(Ge,{style:{padding:"0.5rem 1rem"},children:I.title}),o.jsx(Ge,{style:{padding:"0.5rem 1rem"},children:I.id}),o.jsx(Ge,{style:{padding:"0.5rem 1rem"},children:I.mode}),o.jsx(Ge,{style:{padding:"0.5rem 1rem"},children:I.last_message_at})]},I.id))})]})}),d&&o.jsxs(m,{mt:6,children:[o.jsxs(m,{display:"flex",gap:4,alignItems:"center",children:[o.jsx("label",{htmlFor:"turns-select",style:{fontFamily:z},children:"Turns"}),o.jsx(ei,{id:"turns-select",value:p??"",onChange:I=>h(Number(I.target.value)),children:d.turns.map(I=>{const $=d.messages.find(xe=>xe.id===I.user_msg_id),X=$!=null&&$.content?String($.content).slice(0,60):"(no message)";return o.jsx("option",{value:I.idx,children:`#${I.idx} â ${X}`},I.id)})})]}),p!==null&&(()=>{var C,ne,ue;const I=d.turns.find(v=>v.idx===p);if(!I)return null;const $=d.messages.find(v=>v.id===I.user_msg_id),X=d.messages.find(v=>v.id===I.left_msg_id),xe=d.messages.find(v=>v.id===I.right_msg_id),K=(C=I.vote)==null?void 0:C.outcome;let U="ui.surface",ie="ui.sidebar";return K==="left_better"?(U="success.600",ie="ui.sidebar"):K==="right_better"?(U="ui.sidebar",ie="success.600"):K==="tie"?(U="success.600",ie="success.600"):K==="both_bad"&&(U="error.500",ie="error.500"),o.jsx(m,{mt:4,borderRadius:"md",overflow:"hidden",border:`1px solid ${E}`,children:o.jsxs(cr,{style:{width:"100%"},children:[o.jsx(ur,{children:o.jsxs(Pt,{style:{background:w},children:[o.jsx(mt,{children:"Part"}),o.jsx(mt,{children:"Content"})]})}),o.jsxs(dr,{children:[o.jsxs(Pt,{children:[o.jsx(Ge,{children:"User Message"}),o.jsx(Ge,{children:$==null?void 0:$.content})]}),o.jsxs(Pt,{children:[o.jsx(Ge,{children:"LLM Responses"}),o.jsx(Ge,{children:o.jsxs(m,{display:"flex",gap:4,children:[o.jsxs(m,{flex:1,bg:U,p:3,borderRadius:"md",children:[o.jsxs(m,{fontSize:"sm",fontWeight:400,mb:2,children:["Left LLM (",d.left_model_name||I.left_model_name,")"]}),o.jsx(m,{whiteSpace:"pre-wrap",children:X==null?void 0:X.content})]}),o.jsxs(m,{flex:1,bg:ie,p:3,borderRadius:"md",children:[o.jsxs(m,{fontSize:"sm",fontWeight:400,mb:2,children:["Right LLM (",d.right_model_name||I.right_model_name,")"]}),o.jsx(m,{whiteSpace:"pre-wrap",children:xe==null?void 0:xe.content})]})]})})]}),o.jsxs(Pt,{children:[o.jsx(Ge,{children:"Vote Outcome"}),o.jsx(Ge,{children:(ne=I.vote)==null?void 0:ne.outcome})]}),o.jsxs(Pt,{children:[o.jsx(Ge,{children:"Feedback"}),o.jsx(Ge,{children:((ue=I.vote)==null?void 0:ue.feedback_text)||""})]})]})]})})})()]})]})]})}const IC=()=>{var g,k,b,S;
79const[e,t]=x.useState(!1),n=Ht(),{showSuccessToast:r}=Ln(),{control:i,register:s,handleSubmit:a,reset:l,getValues:c,formState:{errors:u,isValid:d,isSubmitting:f}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:{email:"",full_name:"",password:"",confirm_password:"",is_superuser:!1,is_active:!1}}),p=xn({mutationFn:y=>er.createUser({requestBody:y}),onSuccess:()=>{r("User created successfully."),l(),t(!1)},onError:y=>{Wn(y)},onSettled:()=>{n.invalidateQueries({queryKey:["users"]})}}),h=y=>{p.mutate(y)};return o.jsxs(rr,{size:{base:"xs",md:"md"},placement:"center",open:e,onOpenChange:({open:y})=>t(y),children:[o.jsx(vi,{asChild:!0,children:o.jsxs(We,{value:"add-user",my:4,children:[o.jsx(rd,{fontSize:"16px"}),"Add User"]})}),o.jsxs(Un,{children:[o.jsxs("form",{onSubmit:a(h),children:[o.jsx(qn,{children:o.jsx(gi,{children:"Add User"})}),o.jsxs(Vn,{children:[o.jsx(N,{mb:4,children:"Fill in the form below to add a new user to the system."}),o.jsxs(ut,{gap:4,children:[o.jsx(_t,{required:!0,invalid:!!u.email,errorText:(g=u.email)==null?void 0:g.message,label:"Email",children:o.jsx(Mt,{id:"email",...s("email",{required:"Email is required",pattern:$r}),placeholder:"Email",type:"email"})}),o.jsx(_t,{invalid:!!u.full_name,errorText:(k=u.full_name)==null?void 0:k.message,label:"Full Name",children:o.jsx(Mt,{id:"name",...s("full_name"),placeholder:"Full name",type:"text"})}),o.jsx(_t,{required:!0,invalid:!!u.password,errorText:(b=u.password)==null?void 0:b.message,label:"Set Password",children:o.jsx(Mt,{id:"password",...s("password",{required:"Password is required",minLength:{value:8,message:"Password must be at least 8 characters"}}),placeholder:"Password",type:"password"})}),o.jsx(_t,{required:!0,invalid:!!u.confirm_password,errorText:(S=u.confirm_password)==null?void 0:S.message,label:"Confirm Password",children:o.jsx(Mt,{id:"confirm_password",...s("confirm_password",{required:"Please confirm your password",validate:y=>y===c().password||"The passwords do not match"}),placeholder:"Password",type:"password"})})]}),o.jsxs(Me,{mt:4,direction:"column",gap:4,children:[o.jsx(Ki,{control:i,name:"is_superuser",render:({field:y})=>o.jsx(_t,{disabled:y.disabled,colorPalette:"teal",children:o.jsx(di,{checked:y.value,onCheckedChange:({checked:R})=>y.onChange(R),children:"Is superuser?"})})}),o.jsx(Ki,{control:i,name:"is_active",render:({field:y})=>o.jsx(_t,{disabled:y.disabled,colorPalette:"teal",children:o.jsx(di,{checked:y.value,onCheckedChange:({checked:R})=>y.onChange(R),children:"Is active?"})})})]})]}),o.jsxs(Hn,{gap:2,children:[o.jsx(xi,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:f,children:"Cancel"})}),o.jsx(We,{variant:"solid",type:"submit",disabled:!d,loading:f,children:"Save"})]})]}),o.jsx(Wr,{})]})]})},RC=({id:e})=>{const[t,n]=x.useState(!1),r=Ht(),{showSuccessToast:i,showErrorToast:s}=Ln(),{handleSubmit:a,formState:{isSubmitting:l}}=Cn(),u=xn({mutationFn:async f=>{await er.deleteUser({userId:f})},onSuccess:()=>{i("The user was deleted successfully"),n(!1)},onError:()=>{s("An error occurred while deleting the user")},onSettled:()=>{r.invalidateQueries()}}),d=async()=>{u.mutate(e)};return o.jsxs(rr,{size:{base:"xs",md:"md"},placement:"center",role:"alertdialog",open:t,onOpenChange:({open:f})=>n(f),children:[o.jsx(vi,{asChild:!0,children:o.jsxs(We,{variant:"ghost",size:"sm",colorPalette:"red",children:[o.jsx(Su,{fontSize:"16px"}),"Delete User"]})}),o.jsx(Un,{children:o.jsxs("form",{onSubmit:a(d),children:[o.jsx(qn,{children:o.jsx(gi,{children:"Delete User"})}),o.jsx(Vn,{children:o.jsxs(N,{mb:4,children:["All items associated with this user will also be"," ",o.jsx("strong",{children:"permanently deleted."})," Are you sure? You will not be able to undo this action."]})}),o.jsxs(Hn,{gap:2,children:[o.jsx(sd,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:l,children:"Cancel"})}),o.jsx(We,{variant:"solid",colorPalette:"red",type:"submit",loading:l,children:"Delete"})]}),o.jsx(Wr,{})]})})]})},TC=({user:e})=>{var g,k,b,S;const[t,n]=x.useState(!1),r=Ht(),{showSuccessToast:i}=Ln(),{control:s,register:a,handleSubmit:l,reset:c,getValues:u,formState:{errors:d,isSubmitting:f}}=Cn({mode:"onBlur",criteriaMode:"all",defaultValues:e}),p=xn({mutationFn:y=>er.updateUser({userId:e.id,requestBody:y}),onSuccess:()=>{i("User updated successfully."),c(),n(!1)},onError:y=>{Wn(y)},onSettled:()=>{r.invalidateQueries({queryKey:["users"]})}}),h=async y=>{y.password===""&&(y.password=void 0),p.mutate(y)};return o.jsxs(Gc,{size:{base:"xs",md:"md"},placement:"center",open:t,onOpenChange:({open:y})=>n(y),children:[o.jsx(Yc,{asChild:!0,children:o.jsxs(We,{variant:"ghost",size:"sm",children:[o.jsx(nd,{fontSize:"16px"}),"Edit User"]})}),o.jsx(Un,{children:o.jsxs("form",{onSubmit:l(h),children:[o.jsx(qn,{
79children:o.jsx(Si,{children:"Edit User"})}),o.jsxs(Vn,{children:[o.jsx(N,{mb:4,children:"Update the user details below."}),o.jsxs(ut,{gap:4,children:[o.jsx(_t,{required:!0,invalid:!!d.email,errorText:(g=d.email)==null?void 0:g.message,label:"Email",children:o.jsx(Mt,{id:"email",...a("email",{required:"Email is required",pattern:$r}),placeholder:"Email",type:"email"})}),o.jsx(_t,{invalid:!!d.full_name,errorText:(k=d.full_name)==null?void 0:k.message,label:"Full Name",children:o.jsx(Mt,{id:"name",...a("full_name"),placeholder:"Full name",type:"text"})}),o.jsx(_t,{invalid:!!d.password,errorText:(b=d.password)==null?void 0:b.message,label:"Set Password",children:o.jsx(Mt,{id:"password",...a("password",{minLength:{value:8,message:"Password must be at least 8 characters"}}),placeholder:"Password",type:"password"})}),o.jsx(_t,{invalid:!!d.confirm_password,errorText:(S=d.confirm_password)==null?void 0:S.message,label:"Confirm Password",children:o.jsx(Mt,{id:"confirm_password",...a("confirm_password",{validate:y=>y===u().password||"The passwords do not match"}),placeholder:"Password",type:"password"})})]}),o.jsxs(Me,{mt:4,direction:"column",gap:4,children:[o.jsx(Ki,{control:s,name:"is_superuser",render:({field:y})=>o.jsx(_t,{disabled:y.disabled,colorPalette:"teal",children:o.jsx(di,{checked:y.value,onCheckedChange:({checked:R})=>y.onChange(R),children:"Is superuser?"})})}),o.jsx(Ki,{control:s,name:"is_active",render:({field:y})=>o.jsx(_t,{disabled:y.disabled,colorPalette:"teal",children:o.jsx(di,{checked:y.value,onCheckedChange:({checked:R})=>y.onChange(R),children:"Is active?"})})})]})]}),o.jsxs(Hn,{gap:2,children:[o.jsx(xi,{asChild:!0,children:o.jsx(We,{variant:"subtle",colorPalette:"gray",disabled:f,children:"Cancel"})}),o.jsx(We,{variant:"solid",type:"submit",loading:f,children:"Save"})]}),o.jsx(Wr,{})]})})]})},zC=({user:e,disabled:t})=>o.jsxs(To,{children:[o.jsx(zo,{asChild:!0,children:o.jsx(_n,{variant:"ghost",color:"inherit",disabled:t,children:o.jsx(Uf,{})})}),o.jsxs(Ro,{children:[o.jsx(TC,{user:e}),o.jsx(RC,{id:e.id})]})]}),FC=()=>o.jsxs(cr,{size:{base:"sm",md:"md"},children:[o.jsx(ur,{children:o.jsxs(Pt,{children:[o.jsx(mt,{w:"sm",children:"Full name"}),o.jsx(mt,{w:"sm",children:"Email"}),o.jsx(mt,{w:"sm",children:"Role"}),o.jsx(mt,{w:"sm",children:"Status"}),o.jsx(mt,{w:"sm",children:"Actions"})]})}),o.jsx(dr,{children:[...Array(5)].map((e,t)=>o.jsxs(Pt,{children:[o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})}),o.jsx(Ge,{children:o.jsx(Nn,{noOfLines:1})})]},t))})]}),PC=Uo({page:Nf().catch(1)}),mo=5;function LC({page:e}){return{queryFn:()=>er.readUsers({skip:(e-1)*mo,limit:mo}),queryKey:["users",{page:e}]}}const Qs=Qt("/_layout/admin")({component:DC,validateSearch:e=>PC.parse(e)});function MC(){const t=Ht().getQueryData(["currentUser"]),n=un({from:Qs.fullPath}),{page:r}=Qs.useSearch(),{data:i,isLoading:s,isPlaceholderData:a}=pr({...LC({page:r}),placeholderData:d=>d}),l=d=>n({search:f=>({...f,page:d})}),c=(i==null?void 0:i.data.slice(0,mo))??[],u=(i==null?void 0:i.count)??0;return s?o.jsx(FC,{}):o.jsxs(o.Fragment,{children:[o.jsxs(cr,{size:{base:"sm",md:"md"},children:[o.jsx(ur,{children:o.jsxs(Pt,{children:[o.jsx(mt,{w:"sm",children:"Full name"}),o.jsx(mt,{w:"sm",children:"Email"}),o.jsx(mt,{w:"sm",children:"Role"}),o.jsx(mt,{w:"sm",children:"Status"}),o.jsx(mt,{w:"sm",children:"Actions"})]})}),o.jsx(dr,{children:c==null?void 0:c.map(d=>o.jsxs(Pt,{opacity:a?.5:1,children:[o.jsxs(Ge,{color:d.full_name?"inherit":"gray",children:[d.full_name||"N/A",(t==null?void 0:t.id)===d.id&&o.jsx(Rr,{ml:"1",colorScheme:"teal",children:"You"})]}),o.jsx(Ge,{truncate:!0,maxW:"sm",children:d.email}),o.jsx(Ge,{children:d.is_superuser?"Superuser":"User"}),o.jsx(Ge,{children:d.is_active?"Active":"Inactive"}),o.jsx(Ge,{children:o.jsx(zC,{user:d,disabled:(t==null?void 0:t.id)===d.id})})]},d.id))})]}),o.jsx(Me,{justifyContent:"flex-end",mt:4,children:o.jsx(Hf,{count:u,pageSize:mo,onPageChange:({page:d})=>l(d),children:o.jsxs(Me,{children:[o.jsx(qf,{}),o.jsx(Zf,{}),o.jsx(Vf,{})]})})})]})}function DC(){const{isGuest:e}=dn(),t=un();return x.useEffect(()=>{e&&t({to:"/login"})},[e,t]),o.jsxs(Pn,{maxW:"full",children:[o.jsx(Te,{size:"lg",pt:12,children:"Users Management"}),o.jsx(IC,{}),o.jsx(MC,{})]})}const $i="'Geomanist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial";function OC(){return o.jsx(Pn,{maxW:"4xl",py:{base:8,md:12},fontFamily:$i,as:"main",children:o.jsxs(ut,{align:"stretch",gap:8,children:[o.jsxs("header",{children:[o.jsx(Te,{as:"h1",size:"xl",color:"chat.assistantText",lineHeight:"shorter",fontFamily:$i,fontWeight:400,children:"About BiomedArena"}),o.jsx(N,{mt:2,color:"ui.textSecondary",children:"Transparent evaluation of AI models through community comparisons"})]}),o.jsx(m,{borderTopWidth:"1px",borderColor:"ui.border"}),o.jsx("section",{children:o.jsxs(N,{fontSize:"md",color:"ui.text",children:["BiomedArena is developed by the scientists and engineers at"," ",o.jsx(Bn,{href:"https://datatecnica.com",color:"chat.link",target:"_blank",rel:"noopener noreferrer",fontWeight:"semibold",children:"Datatecnica"}),"."]})}),o.jsxs(m,{as:"section","aria-labelledby":"what-is-biomedarena",bg:"ui.sidebar",border:"1px solid",borderColor:"ui.border",borderRadius:"lg",p:{base:4,md:6},children:[o.jsx(Te,{id:"what-is-biomedarena",as:"h2",size:"md",color:"chat.assistantText",mb:3,fontFamily:$i,fontWeight:400,children:"What is BiomedArena?"}),o.jsx(N,{fontSize:"md",color:"ui.text",children:"BiomedArena is an open platform where everyone can easily access, explore, and interact with the world's leading AI models. By comparing them side by side and casting votes for the better response, the community helps shape a public leaderboard, making AI progress more transparent and grounded in real-world usage."})]}),o.jsxs(m,{as:"section","aria-labelledby":"feedback-contributions",bg:"ui.sidebar",border:"1px solid",borderColor:"ui.border",borderRadius:"lg",p:{base:4,md:6},children:[o.jsx(Te,{id:"feedback-contributions",as:"h2",size:"md",color:"chat.assistantText",mb:3,fontFamily:$i,fontWeight:400,children:"Feedback & Contributions"}),o.jsxs(ut,{align:"stretch",gap:3,children:[o.jsx(N,{fontSize:"md",color:"ui.text",children:"To grow and improve BiomedArena, we encourage the scientific community to share feedback and contribute datasets."}),o.jsxs(Rt,{gap:2,children:[o.jsx(Bn,{href:"https://docs.google.com/forms/d/e/1FAIpQLSf6NX_WemTS_97SgsQGKl1x_zygllEGHsyI90_R90VaR98igA/viewform",target:"_blank",rel:"noopener noreferrer",color:"chat.link",fontWeight:"semibold","aria-label":"Leave feedback form (opens in new tab)",children:"Leave feedback"}),o.jsx(Ut,{as:mm,color:"chat.link","aria-hidden":"true"})]})]})]}),o.jsx("footer",{children:o.jsxs(N,{fontSize:"sm",color:"ui.textSecondary",children:["© ",new Date().getFullYear()," BiomedArena"]})})]})})}const BC=Qt("/_layout/about-us")({component:OC}),NC=Ux.update({path:"/signup",getParentRoute:()=>kr}),$C=qx.update({path:"/reset-password",getParentRoute:()=>kr}),WC=Zx.update({path:"/recover-password",getParentRoute:()=>kr}),UC=Kx.update({path:"/login",getParentRoute:()=>kr}),Dn=pb.update({id:"/_layout",getParentRoute:()=>kr}),HC=W2.update({path:"/",getParentRoute:()=>Dn}),qC=H2.update({path:"/auth/callback",getParentRoute:()=>kr}),VC=Y2.update({path:"/settings",getParentRoute:()=>Dn}),ZC=rC.update({path:"/leaderboard",getParentRoute:()=>Dn}),GC=Xs.update({path:"/items",getParentRoute:()=>Dn}),YC=yC.update({path:"/how-it-works",getParentRoute:()=>Dn}),KC=Gf.update({path:"/battle",getParentRoute:()=>Dn}),JC=EC.update({path:"/analytics",getParentRoute:()=>Dn}),XC=Qs.update({path:"/admin",getParentRoute:()=>Dn}),QC=BC.update({path:"/about-us",getParentRoute:()=>Dn}),eE=kr.addChildren([Dn.addChildren([QC,XC,JC,KC,YC,GC,ZC,VC,HC]),UC,WC,$C,NC,qC]),tE=wp({base:{fontWeight:"regular",display:"flex",alignItems:"center",justifyContent:"center",colorPalette:"teal"},variants:{variant:{ghost:{bg:"transparent",_hover:{bg:"gray.100"}}}}}),nE=kp(Sp,{globalCss:{html:{fontSize:"16px",background:{_light:"#FFFFFF",_dark:"#101418"}},body:{fontSize:"0.95rem",margin:0,padding:0,background:{_light:"#FFFFFF",_dark:"#101418"},color:{_light:"#1A202C",_dark:"#fff"},minHeight:"100vh",fontFamily:"'Geomanist', 'Inter', system-ui, sans-serif"},a:{color:{_light:"#48b0ecff",_dark:"#2D3B8D"},textDecoration:"underline",fontWeight:400,transition:"color 0.2s",_hover:{color:{_light:"#0f4976ff",_dark:"#8797AF"}}},h1:{color:{_light:"#374151",_dark:"#fff"},fontWeight:400},h2:{color:{_light:"#48b0ecff",_dark:"#ccd1d8ff"},fontWeight:400},h3:{color:{_light:"#6B7280",_dark:"#8797AF"},fontWeight:400},".main-link":{color:{_light:"#171fb0ff",_dark:"#5ba5f4ff"},fontWeight:"400"}}
79,theme:{tokens:{fontSizes:{"2xs":{value:"0.625rem"},"3xs":{value:"0.5rem"},"2xl":{value:"1.5rem"}},colors:{palette:{lightAzure:{value:"#48b0ecff"},lightAzureDark:{value:"#0f4976ff"},lightBg:{value:"#FFFFFF"},lightSurface:{value:"#F9FAFB"},lightSidebar:{value:"#F3F4F6"},lightBorder:{value:"#E5E7EB"},lightMuted:{value:"#6B7280"},lightText:{value:"#374151"},lightTextSecondary:{value:"#9CA3AF"},marian:{value:"#2D3B8D"},space:{value:"#18204E"},black:{value:"#101418"},gunmetal:{value:"#212731"},gray:{value:"#8797AF"}},primary:{50:{value:"#F0FDFA"},100:{value:"#CCFBF1"},200:{value:"#99F6E4"},300:{value:"#5EEAD4"},400:{value:"#2DD4BF"},500:{value:"#48b0ecff"},600:{value:"#0f4976ff"},700:{value:"#0D9488"},800:{value:"#115E59"},900:{value:"#134E4A"}},neutral:{50:{value:"#F9FAFB"},100:{value:"#F3F4F6"},200:{value:"#E5E7EB"},300:{value:"#D1D5DB"},400:{value:"#9CA3AF"},500:{value:"#6B7280"},600:{value:"#4B5563"},700:{value:"#374151"},800:{value:"#1F2937"},900:{value:"#111827"}},success:{50:{value:"#ECFDF5"},100:{value:"#D1FAE5"},500:{value:"#10B981"},600:{value:"#059669"}},error:{50:{value:"#FEF2F2"},100:{value:"#FEE2E2"},500:{value:"#EF4444"},600:{value:"#DC2626"}},warning:{50:{value:"#FFFBEB"},100:{value:"#FEF3C7"},500:{value:"#F59E0B"},600:{value:"#D97706"}}}},semanticTokens:{colors:{"ui.main":{value:{base:"#48b0ecff",_dark:"#18204E"}},"ui.mainText":{value:{base:"#FFFFFF",_dark:"#FFFFFF"}},"ui.accent":{value:{base:"#0f4976ff",_dark:"#2D3B8D"}},"ui.background":{value:{base:"#FFFFFF",_dark:"#101418"}},"ui.surface":{value:{base:"#dcdcddff",_dark:"#424851ff"}},"ui.sidebar":{value:{base:"#F3F4F6",_dark:"#212731"}},"ui.border":{value:{base:"#E5E7EB",_dark:"#4B5563"}},"ui.buttonHover":{value:{base:"#b9c0cfff",_dark:"#8797AF"}},"ui.muted":{value:{base:"#6B7280",_dark:"#8797AF"}},"ui.mutedBorder":{value:{base:"#a3adc3ff",_dark:"#717e93ff"}},"ui.text":{value:{base:"#374151",_dark:"#FFFFFF"}},"ui.textSecondary":{value:{base:"#6B7280",_dark:"#9CA3AF"}},"chat.userBg":{value:{base:"#48b0ecff",_dark:"#2D3B8D"}},"chat.userText":{value:{base:"#FFFFFF",_dark:"#FFFFFF"}},"chat.userHover":{value:{base:"#0f4976ff",_dark:"#18204E"}},"chat.assistantBg":{value:{base:"#F3F4F6",_dark:"#374151"}},"chat.assistantText":{value:{base:"#1F2937",_dark:"#F9FAFB"}},"chat.assistantHover":{value:{base:"#E5E7EB",_dark:"#4B5563"}},"chat.link":{value:{base:"#171fb0ff",_dark:"#5ba5f4ff"}},"table.border":{value:{base:"#D1D5DB",_dark:"#4B5563"}},"table.cellBg":{value:{base:"#FFFFFF",_dark:"#1F2937"}},"table.headerBg":{value:{base:"#F3F4F6",_dark:"#374151"}},"code.bg":{value:{base:"#F3F4F6",_dark:"#374151"}},"code.inlineBg":{value:{base:"#F3F4F6",_dark:"#374151"}},"code.text":{value:{base:"#6B7280",_dark:"#9CA3AF"}},"input.bg":{value:{base:"#F9FAFB",_dark:"#212731"}},"input.text":{value:{base:"#000000",_dark:"#FFFFFF"}},"input.border":{value:{base:"#E5E7EB",_dark:"#8797AF"}},"input.placeholder":{value:{base:"#6B7280",_dark:"#8797AF"}},"input.focus":{value:{base:"#48b0ecff",_dark:"#2D3B8D"}},"button.primary":{value:{base:"#53c4fdff",_dark:"#2D3B8D"}},"button.primaryHover":{value:{base:"#0f4976ff",_dark:"#18204E"}},"button.secondary":{value:{base:"#44a2d1ff",_dark:"#212c69ff"}},"button.secondaryHover":{value:{base:"#0c3a5eff",_dark:"#0f1432ff"}},"button.primaryText":{value:{base:"#FFFFFF",_dark:"#FFFFFF"}}}},recipes:{button:tE}}});function rE(e){return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:` 80 html, body { 81 font-family: Inter, system-ui, sans-serif; 82 min-height: 100vh; 83 } 84 /* Light mode colors */ 85 html.light, html.light body { 86 background: #FFFFFF; 87 color: #1A202C; 88 } 89 /* Dark mode colors */ 90 html.dark, html.dark body { 91 background: #18181b; 92 color: #f3f4f6; 93 } 94 `}),o.jsxs(vp,{value:nE,children:[o.jsx(Um,{defaultTheme:"system",children:e.children}),o.jsx(Dx,{})]})]})}Le.BASE="https://api.biomedarena.ai";Le.TOKEN=async()=>localStorage.getItem("access_token")||"";const Vc=e=>{e instanceof Es&&[401,403].includes(e.status)&&(!!localStorage.getItem("access_token")?(localStorage.removeItem("access_token"),window.location.href="/login"):console.warn("API authentication error for guest user:",e))},iE=new _p({queryCache:new Ep({onError:Vc}),mutationCache:new Cp({onError:Vc})}),Yf=Ap({routeTree:eE});Yf.subscribe("onLoad",e=>{const t=e.location;if(!t)return;const n=t.pathname??"",r=t.search??"";Qu(`${n}${r}`)});function oE({children:e}){return x.useEffect(()=>{Mx(),Qu(window.location.pathname+window.location.search),(()=>{if(!!!localStorage.getItem("access_token"))try{Fn()}catch(r){console.error("Failed to ensure guest fingerprint:",r)}})()},[]),o.jsx(o.Fragment,{children:e})}Pp.createRoot(document.getElementById("root")).render(o.jsx(x.StrictMode,{children:o.jsx(rE,{children:o.jsx(Ip,{client:iE,children:o.jsx(oE,{children:o.jsx(Rp,{router:Yf})})})})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.