cctally 1.112.0 → 1.114.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +4 -5
  3. package/bin/_cctally_cache.py +1683 -485
  4. package/bin/_cctally_core.py +223 -1
  5. package/bin/_cctally_dashboard.py +96 -18
  6. package/bin/_cctally_dashboard_perf.py +128 -9
  7. package/bin/_cctally_dashboard_sources.py +267 -204
  8. package/bin/_cctally_db.py +861 -18
  9. package/bin/_cctally_diagnosis_sources.py +22 -4
  10. package/bin/_cctally_doctor.py +136 -18
  11. package/bin/_cctally_five_hour.py +2 -2
  12. package/bin/_cctally_forecast.py +27 -6
  13. package/bin/_cctally_journal.py +67 -5
  14. package/bin/_cctally_milestone_history.py +82 -9
  15. package/bin/_cctally_percent_breakdown.py +3 -2
  16. package/bin/_cctally_quota.py +201 -33
  17. package/bin/_cctally_record.py +14 -0
  18. package/bin/_cctally_rederive.py +23 -9
  19. package/bin/_cctally_source_analytics.py +60 -15
  20. package/bin/_cctally_statusline.py +17 -0
  21. package/bin/_cctally_store.py +80 -5
  22. package/bin/_cctally_tui.py +4 -3
  23. package/bin/_cctally_weekrefs.py +128 -21
  24. package/bin/_lib_cache_report.py +35 -6
  25. package/bin/_lib_codex_conversation.py +32 -0
  26. package/bin/_lib_codex_conversation_query.py +164 -30
  27. package/bin/_lib_conversation_query.py +95 -56
  28. package/bin/_lib_conversation_retention.py +1605 -640
  29. package/bin/_lib_cost_provenance.py +53 -2
  30. package/bin/_lib_doctor.py +263 -69
  31. package/bin/_lib_fmt.py +11 -0
  32. package/bin/_lib_merge_gate.py +469 -51
  33. package/bin/_lib_perf.py +27 -1
  34. package/bin/_lib_pricing.py +209 -8
  35. package/bin/_lib_pricing_check.py +20 -4
  36. package/bin/_lib_reclaim_planner.py +792 -0
  37. package/bin/_lib_rederive.py +225 -77
  38. package/bin/_lib_snapshot_cache.py +21 -0
  39. package/bin/_lib_sqlite_close.py +81 -0
  40. package/bin/_lib_subscription_weeks.py +100 -17
  41. package/bin/_lib_tick_stats.py +217 -17
  42. package/bin/_lib_wal_checkpoint.py +1077 -0
  43. package/bin/_lib_write_budget.py +483 -0
  44. package/bin/_lib_write_io.py +703 -0
  45. package/bin/cctally +8 -0
  46. package/dashboard/static/assets/{ConversationsView-CEZ-BUyi.js → ConversationsView-Bc8LCOAZ.js} +1 -1
  47. package/dashboard/static/assets/{DoctorModal-CE1oH_Zy.js → DoctorModal-D--qVBwe.js} +1 -1
  48. package/dashboard/static/assets/ModalRoot-DLPgyAM_.js +1 -0
  49. package/dashboard/static/assets/{ProjectsDrillPanel-B3DZoCeD.js → ProjectsDrillPanel-z53a4v4M.js} +1 -1
  50. package/dashboard/static/assets/{SourceDetailModal-CHp9EgLP.js → SourceDetailModal-Bw0T8W-W.js} +1 -1
  51. package/dashboard/static/assets/{UpdateModal-5iKST6jo.js → UpdateModal-D5AKx4Yw.js} +1 -1
  52. package/dashboard/static/assets/index-BKITk1CT.css +1 -0
  53. package/dashboard/static/assets/{index-Cm0VTxJC.js → index-BXDOzSng.js} +3 -3
  54. package/dashboard/static/assets/{outlineNavigation-DkXGL8J6.js → outlineNavigation-JObY7cUY.js} +1 -1
  55. package/dashboard/static/dashboard.html +2 -2
  56. package/package.json +6 -1
  57. package/dashboard/static/assets/ModalRoot-D5Y8IFUG.js +0 -1
  58. package/dashboard/static/assets/index-Dt4tqf43.css +0 -1
@@ -1,4 +1,4 @@
1
- import{Ft as e,It as t,Lt as n,P as r,Rt as i,_t as a,a as o,at as s,b as c,c as l,ct as u,dt as d,f,ft as p,g as m,gt as h,ht as g,it as _,lt as v,pt as y,t as b,ut as x,v as S,vt as C,y as w,yt as T}from"./useKeymap-CW7Up0Ay.js";import{Ct as E,Dt as D,Ft as O,It as k,P as A,St as j,at as M,b as ee,bt as N,ct as te,i as P,it as F,n as ne,ot as re,r as ie,t as ae,xt as oe}from"./index-Cm0VTxJC.js";import{A as se,C as ce,D as le,E as ue,F as de,I as fe,M as pe,N as me,O as he,P as ge,S as _e,T as ve,_ as ye,a as be,b as xe,c as Se,d as Ce,f as we,g as Te,h as Ee,i as De,j as Oe,k as ke,l as Ae,m as je,n as Me,o as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re,v as ze,w as Be,x as Ve,y as He}from"./outlineNavigation-DkXGL8J6.js";var I=i(e(),1);function Ue(){let[e,t]=(0,I.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(j).matches);return(0,I.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(j),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}function We(){let[e,t]=(0,I.useState)(()=>typeof window>`u`||!window.matchMedia?!0:window.matchMedia(E).matches);return(0,I.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(E),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}function Ge(e){let t=e?a(e):null,n=t?p(t):null,[r,i]=(0,I.useState)(0),[o,s]=(0,I.useState)(!1),l=O()?.transcriptsEnabled??!1,u=(0,I.useSyncExternalStore)(c,()=>S(f()));return(0,I.useEffect)(()=>{if(s(!1),!t||!l||!u||typeof EventSource>`u`)return;let e=new EventSource(ke(t,`events`));return e.addEventListener(`ready`,()=>{s(!0),i(e=>e+1)}),e.addEventListener(`tail`,()=>{i(e=>e+1)}),e.addEventListener(`error`,()=>{s(!1)}),()=>{e.close()}},[n,l,u]),{growthNonce:r,live:o}}function Ke(){(0,I.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`f`)return;let t=f();if(t.view===`conversations`&&ae())if(e.preventDefault(),t.selectedConversationRef)l({type:`OPEN_CONV_FIND`}),requestAnimationFrame(()=>{document.querySelector(`.conv-findbar-input`)?.focus()});else{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[])}function qe(e){let t=new URLSearchParams;e.dateFrom&&t.set(`date_from`,e.dateFrom),e.dateTo&&t.set(`date_to`,e.dateTo);for(let n of e.projects)t.append(`projects`,n);e.costMin!=null&&t.set(`cost_min`,String(e.costMin)),e.costMax!=null&&t.set(`cost_max`,String(e.costMax)),e.rebuildMin!=null&&t.set(`rebuild_min`,String(e.rebuildMin));for(let n of e.models)t.append(`models`,n);let n=t.toString();return n?`&${n}`:``}var Je=50;function Ye(e=`claude`,t={}){let n=t.qualified===!0||e===`codex`,r=t.accountKey,i=t.selectedRef?.source===e&&!Object.values(f().conversationFilters).some(e=>Array.isArray(e)?e.length>0:e!=null)?t.selectedRef.key:void 0,[a,o]=(0,I.useState)([]),[s,u]=(0,I.useState)(!0),[d,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(0),[g,_]=(0,I.useState)(!1),[v,b]=(0,I.useState)(null),x=(0,I.useRef)(e);x.current=e;let S=(0,I.useRef)(n);S.current=n;let C=(0,I.useRef)(r);C.current=r;let w=(0,I.useRef)(i);w.current=i;let[T,E]=(0,I.useState)(!1),[D,k]=(0,I.useState)(!1),A=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),j=(0,I.useRef)(A);j.current=A;let M=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),ee=(0,I.useRef)(M);ee.current=M;let N=me(O()),te=(0,I.useRef)(!1),[P,F]=(0,I.useState)(!1),ne=(0,I.useRef)(!1),re=(0,I.useRef)(null),ie=(0,I.useRef)(0),ae=(0,I.useCallback)(()=>{if(te.current||ne.current)return;re.current?.abort();let e=new AbortController;re.current=e;let t=x.current,n=S.current,r=C.current,i=w.current;de(n?se(t,{accountKey:r,projectKey:j.current.projects[0],model:j.current.models[0],limit:Je,selected:i}):`/api/conversations?sort=${ee.current}&limit=${Je}&offset=0${qe(j.current)}${r?`&account=${encodeURIComponent(r)}`:``}${i?`&selected=${encodeURIComponent(i)}`:``}`,e.signal).then(e=>{if(x.current!==t||S.current!==n||C.current!==r)return;let i=he(e);if(i!=null){o([]),h(null),_(!1),E(!1),k(!1),b(le(i)),p(null),u(!1);return}if(b(null),n){let n=Ce(t,e,r);o(Xe(n.rows,n.selected)),h(n.cursor),_(n.pending),E(!1),k(!1)}else{let n=e;o(Xe(r?n.conversations.map(e=>({...e,conversation_ref:{source:t,key:e.session_id,account_key:r}})):n.conversations,n.selected?r?{...n.selected,conversation_ref:{source:t,key:n.selected.session_id,account_key:r}}:n.selected:void 0)),h(n.page.next_offset),E(n.page.filter_degraded===!0),k(n.page.sort_degraded===!0),_(!1)}p(null),u(!1)}).catch(e=>{fe(e)||(p(`Couldn't load conversations.`),u(!1))})},[]),oe=(0,I.useCallback)(()=>{p(null),b(null),u(!0),ae()},[ae]),ce=JSON.stringify({source:e,qualified:n,accountKey:r,selectedKey:i,filters:A,sort:M}),ue=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(ue.current===null){ue.current=ce;return}ue.current!==ce&&(ue.current=ce,ie.current+=1,te.current=!1,F(!1),o([]),h(0),ne.current=!1,ae())},[ce]),(0,I.useEffect)(()=>{if(!(typeof document<`u`&&document.hidden))return ae(),()=>re.current?.abort()},[N,e,ae]),(0,I.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{document.hidden||ae()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[ae]);let pe=(0,I.useCallback)(async()=>{if(m==null||te.current)return;te.current=!0,F(!0);let e=ie.current;try{let t=x.current,n=S.current,r=C.current,i=await de(n?se(t,{accountKey:r,projectKey:j.current.projects[0],model:j.current.models[0],limit:Je,cursor:String(m)}):`/api/conversations?sort=${ee.current}&limit=${Je}&offset=${m}${qe(j.current)}${r?`&account=${encodeURIComponent(r)}`:``}`);if(ie.current!==e||x.current!==t||S.current!==n||C.current!==r)return;let a=he(i);if(a!=null){h(null),b(le(a));return}if(n){let e=Ce(t,i,r);o(t=>Ze(t,e.rows)),h(e.cursor),_(e.pending)}else{let e=i,n=r?e.conversations.map(e=>({...e,conversation_ref:{source:t,key:e.session_id,account_key:r}})):e.conversations;o(e=>Ze(e,n)),h(e.page.next_offset),E(e.page.filter_degraded===!0),k(e.page.sort_degraded===!0)}ne.current=!0}catch{}finally{te.current=!1,F(!1)}},[m]);return(0,I.useEffect)(()=>{a.length!==0&&l({type:`CACHE_CONVERSATION_TITLES`,titles:a.map(e=>[y(e),e.title])})},[a]),{rows:a,loading:s,error:d,hasMore:m!=null,loadMore:pe,loadingMore:P,filterDegraded:T,sortDegraded:D,retry:oe,pending:g,degraded:v}}function Xe(e,t){return!t||e.some(e=>C(y(e),y(t)))?e:[t,...e]}function Ze(e,t){let n=new Set(e.map(e=>p(y(e))));return[...e,...t.filter(e=>{let t=p(y(e));return n.has(t)?!1:(n.add(t),!0)})]}function Qe(e,t,n=e){let[r,i]=(0,I.useState)(n);return(0,I.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[e,t]),r}var $e=200;function et(e,t=`all`,n=`claude`,r={}){let i=r.qualified===!0||n===`codex`,a=r.accountKey,[o,s]=(0,I.useState)([]),[l,u]=(0,I.useState)(null),[d,p]=(0,I.useState)(0),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(null),[w,T]=(0,I.useState)(null),[E,D]=(0,I.useState)(!1),[O,k]=(0,I.useState)(null),A=e.trim(),j=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),M=JSON.stringify(j),ee=(0,I.useRef)(j);ee.current=j;let N=Qe(A,$e,``),te=(0,I.useRef)(null),P=(0,I.useRef)(!1),F=(0,I.useRef)(0);F.current=o.length;let ne=(0,I.useRef)(0);ne.current=d;let re=(0,I.useRef)(!1);re.current=b;let ie=(0,I.useCallback)((e,r)=>i?pe(n,{accountKey:a,query:N,kind:t,limit:50,cursor:r??void 0}):`/api/conversation/search?q=${encodeURIComponent(N)}&limit=50&offset=${e}&kind=${t}${qe(ee.current)}${a?`&account=${encodeURIComponent(a)}`:``}`,[N,t,M,n,i,a]);(0,I.useEffect)(()=>(A||(s([]),u(null),p(0),h(null),_(!1),C(null),k(null)),()=>{te.current?.abort()}),[A,t,M,n,i,a]),(0,I.useEffect)(()=>{if(!N){y(!1),x(!1);return}let e=new AbortController;return te.current=e,s([]),p(0),T(null),P.current=!1,k(null),y(!0),x(!1),de(ie(0),e.signal).then(t=>{if(te.current!==e||e.signal.aborted)return;let r=he(t);if(r!=null){s([]),p(0),T(null),D(!1),_(!1),P.current=!0,k(le(r)),C(null),y(!1);return}k(null);let o=i?Te(n,t,a):{...t,hits:a?t.hits.map(e=>({...e,conversation_ref:{source:n,key:e.session_id,account_key:a}})):t.hits,cursor:null,pending:!1};s(o.hits),u(o.mode),p(o.total),h(o.search_depth??`full`),_(o.filter_degraded===!0),T(o.cursor),D(o.pending),C(null),y(!1)}).catch(t=>{fe(t)||te.current!==e||e.signal.aborted||(C(`Search failed.`),y(!1))}),()=>e.abort()},[N,t,ie]);let ae=(0,I.useCallback)(()=>{if(P.current||re.current||F.current>=ne.current)return;let e=F.current,t=new AbortController;te.current=t,x(!0);let r=()=>te.current===t&&!t.signal.aborted;de(ie(e,w),t.signal).then(e=>{if(!r())return;let t=he(e);if(t!=null){P.current=!0,T(null),D(!1),k(le(t)),C(null),x(!1);return}k(null);let o=i?Te(n,e,a):{...e,hits:a?e.hits.map(e=>({...e,conversation_ref:{source:n,key:e.session_id,account_key:a}})):e.hits,cursor:null,pending:!1};s(e=>[...e,...o.hits]),p(o.total),u(o.mode),h(o.search_depth??`full`),_(o.filter_degraded===!0),T(o.cursor),D(o.pending),C(null),x(!1)}).catch(e=>{fe(e)||!r()||(C(`Search failed.`),x(!1))})},[ie,w,n,i,a]);return{hits:o,mode:l,total:d,loading:A!==``&&(A!==N||v),loadingMore:b,searchDepth:m,filterDegraded:g,error:S,loadMore:ae,pending:E,degraded:O}}var L=o();function tt(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,L.jsx)(I.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,L.jsx)(I.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,L.jsx)(I.Fragment,{children:e.slice(n,i)},r++)),t.push((0,L.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,L.jsx)(L.Fragment,{children:t})}var nt=864e5;function rt(e,t){let[n,r,i]=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e)).split(`-`).map(Number);return{y:n,m:r,d:i}}function it(e,t,n){let r=Date.parse(e),i=rt(r,t),a=rt(n,t),o=Date.UTC(i.y,i.m-1,i.d),s=Date.UTC(a.y,a.m-1,a.d),c=Math.round((s-o)/nt);return c<=0?`Today`:c===1?`Yesterday`:c<7?`This Week`:i.y===a.y&&i.m===a.m?`This Month`:new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,year:`numeric`}).format(new Date(r))}function at(e,t,n,r){return e===`recent`||e===`oldest`?it(t.last_activity_utc,n,r):e===`project`?t.project_label||`—`:null}var ot=700;function st(e=`claude`,t){let[n,r]=(0,I.useState)({projects:[],models:[]});return(0,I.useEffect)(()=>{let n=new AbortController,i;r({projects:[],models:[]});let a=o=>{de(e===`codex`?Oe(`codex`,t):`/api/conversations/facets${t?`?account=${encodeURIComponent(t)}`:``}`,n.signal).then(t=>{if(e===`codex`){let e=t;r({projects:e.facets.projects.map(e=>({project_label:e.project_label??`Unnamed project`,count:e.count,filter_value:e.project_key})),models:e.facets.models.map(e=>({family:e.model,count:e.count,filter_value:e.model})),...e.filter_degraded?{filter_degraded:!0}:{}})}else{let e=t;r({projects:e.projects??[],models:e.models??[],...e.filter_degraded?{filter_degraded:!0}:{}})}}).catch(e=>{if(!fe(e)){if(o===0){i=setTimeout(()=>a(1),ot);return}r({projects:[],models:[]})}})};return a(0),()=>{n.abort(),i&&clearTimeout(i)}},[e,t]),n}function ct(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function lt(e){let[t,n,r]=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date).split(`-`).map(Number);return{y:t,m:n,d:r}}var ut=[{key:`this-month`,label:`This month`,bounds:e=>{let{y:t,m:n}=lt(e);return{from:ct(new Date(Date.UTC(t,n-1,1))),to:ct(new Date(Date.UTC(t,n,0)))}}},{key:`last-month`,label:`Last month`,bounds:e=>{let{y:t,m:n}=lt(e);return{from:ct(new Date(Date.UTC(t,n-2,1))),to:ct(new Date(Date.UTC(t,n-1,0)))}}},{key:`last-7d`,label:`Last 7d`,bounds:e=>{let{y:t,m:n,d:r}=lt(e),i=new Date(Date.UTC(t,n-1,r));return{from:ct(new Date(i.getTime()-6*864e5)),to:ct(i)}}}],dt=[1,5,10],ft=[1,3,5];function pt(e){l({type:`SET_CONVERSATION_FILTERS`,patch:e})}function mt({source:e=`claude`,accountKey:t}){let n=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),r=st(e,t),{resolvedTz:i}=N(),[a,o]=(0,I.useState)(n.costMin?.toString()??``),[s,u]=(0,I.useState)(n.costMax?.toString()??``),[d,p]=(0,I.useState)(n.rebuildMin?.toString()??``);(0,I.useEffect)(()=>{o(n.costMin?.toString()??``)},[n.costMin]),(0,I.useEffect)(()=>{u(n.costMax?.toString()??``)},[n.costMax]),(0,I.useEffect)(()=>{p(n.rebuildMin?.toString()??``)},[n.rebuildMin]);let m=(0,I.useRef)({});(0,I.useEffect)(()=>{let e=m.current;return()=>{for(let t in e)clearTimeout(e[t])}},[]);let h=(e,t)=>{let n=m.current[e];n&&clearTimeout(n),m.current[e]=setTimeout(t,300)},g=e=>{if(e.trim()===``)return null;let t=Number(e);return Number.isFinite(t)?t:void 0},_=()=>l({type:`SET_INPUT_MODE`,mode:`filter`}),v=()=>l({type:`SET_INPUT_MODE`,mode:null});(0,I.useEffect)(()=>()=>{l({type:`SET_INPUT_MODE`,mode:null})},[]);let y=t=>{pt({projects:n.projects.includes(t)?n.projects.filter(e=>e!==t):e===`codex`?[t]:[...n.projects,t]})},b=t=>{pt({models:n.models.includes(t)?n.models.filter(e=>e!==t):e===`codex`?[t]:[...n.models,t]})};return(0,L.jsxs)(`div`,{className:`conv-rail-filters`,role:`dialog`,"aria-label":`Conversation filters`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),l({type:`SET_CONV_FILTERS_OPEN`,open:!1}))},children:[e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Date (last activity)`}),(0,L.jsx)(`div`,{className:`conv-rail-filters-chips`,children:ut.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.datePreset===e.key?` is-on`:``}`,onClick:()=>{let t=e.bounds(i);pt({dateFrom:t.from,dateTo:t.to,datePreset:e.key})},children:e.label},e.key))}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`From`}),(0,L.jsx)(`input`,{type:`date`,value:n.dateFrom??``,"aria-label":`Date from`,onFocus:_,onBlur:v,onChange:e=>pt({dateFrom:e.target.value||null,datePreset:null})})]}),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`To`}),(0,L.jsx)(`input`,{type:`date`,value:n.dateTo??``,"aria-label":`Date to`,onFocus:_,onBlur:v,onChange:e=>pt({dateTo:e.target.value||null,datePreset:null})})]})]})]}),(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Project`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-projects`,children:[r.projects.length===0&&(0,L.jsx)(`div`,{className:`conv-rail-filters-empty`,children:r.filter_degraded?`Projects appear once indexing finishes.`:`No projects.`}),r.projects.map(e=>{let t=e.filter_value??e.project_label;return(0,L.jsxs)(`label`,{className:`conv-rail-filters-proj`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:n.projects.includes(t),"aria-label":e.project_label,onChange:()=>y(t)}),(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-name`,children:e.project_label}),(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:e.count})]},t)})]})]}),(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Model`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[r.models.length===0&&(0,L.jsx)(`div`,{className:`conv-rail-filters-empty`,children:`No models.`}),r.models.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip chip ${F(e.family)}${n.models.includes(e.filter_value??e.family)?` is-on`:``}`,"aria-pressed":n.models.includes(e.filter_value??e.family),onClick:()=>b(e.filter_value??e.family),children:[e.family,` `,(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:e.count})]},e.filter_value??e.family))]})]}),e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cost (USD)`}),(0,L.jsx)(`div`,{className:`conv-rail-filters-chips`,children:dt.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.costMin===e?` is-on`:``}`,onClick:()=>pt({costMin:e}),children:[`≥$`,e]},e))}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`Min`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:a,"aria-label":`Min cost`,placeholder:`0`,onFocus:_,onBlur:v,onChange:e=>{o(e.target.value);let t=g(e.target.value);t!==void 0&&h(`costMin`,()=>pt({costMin:t}))}})]}),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`Max`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:s,"aria-label":`Max cost`,placeholder:`∞`,onFocus:_,onBlur:v,onChange:e=>{u(e.target.value);let t=g(e.target.value);t!==void 0&&h(`costMax`,()=>pt({costMax:t}))}})]})]})]}),e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cache rebuilds`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[ft.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.rebuildMin===e?` is-on`:``}`,onClick:()=>pt({rebuildMin:e}),children:[`≥`,e]},e)),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field conv-rail-filters-field--inline`,children:[(0,L.jsx)(`span`,{children:`≥`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:`0`,step:`1`,value:d,"aria-label":`Min cache rebuilds`,placeholder:`N`,onFocus:_,onBlur:v,onChange:e=>{p(e.target.value);let t=g(e.target.value);if(t!==void 0){let e=t===null?null:Math.floor(t);h(`rebuildMin`,()=>pt({rebuildMin:e}))}}})]})]})]}),e===`codex`&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Codex browse supports one project and one native model filter. Search remains corpus-wide.`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-footer`,children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clear`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-done`,onClick:()=>l({type:`SET_CONV_FILTERS_OPEN`,open:!1}),children:`Done`})]})]})}var ht=48;function gt(e,t){let n=a(e),r=t[p(n)]?.trim()??(typeof e==`string`?t[e]?.trim():void 0);return r?{kind:`title`,text:r.length>ht?`${r.slice(0,ht-1)}…`:r}:{kind:`hash`,text:n.key.slice(0,8)}}function _t(e){let t=new Set;for(let n of e)if(t.add(n.project_label),t.size>1)return!1;return!0}var vt={tools:`tool`,thinking:`thinking`,title:`title`,files:`file`};function yt(e,t){let n=vt[t];return n?e.filter(e=>e!==n):e}function bt(e,t){return(t??``).localeCompare(e??``)}function xt(e,t){let n=new Map;for(let r of[...e,...t]){let e=p(y(r));n.has(e)||n.set(e,r)}return[...n.values()].sort((e,t)=>bt(e.last_activity_utc,t.last_activity_utc)||p(y(e)).localeCompare(p(y(t))))}function St(e,t){let n=new Map;for(let r of[...e,...t]){let e=JSON.stringify([p(T(r)),r.uuid]);n.has(e)||n.set(e,r)}return[...n.values()].sort((e,t)=>bt(e.ts,t.ts)||p(T(e)).localeCompare(p(T(t)))||e.uuid.localeCompare(t.uuid))}var Ct=[{key:`recent`,label:`Recent`},{key:`oldest`,label:`Oldest`},{key:`cost`,label:`Cost`},{key:`messages`,label:`Messages`},{key:`project`,label:`Project`}],wt=[{kind:`all`,label:`All`,needsSplit:!1,group:`content`},{kind:`prompts`,label:`Prompts`,needsSplit:!1,group:`content`},{kind:`assistant`,label:`Assistant`,needsSplit:!1,group:`content`},{kind:`tools`,label:`Tools`,needsSplit:!0,group:`content`},{kind:`thinking`,label:`Thinking`,needsSplit:!0,group:`content`},{kind:`title`,label:`Title`,needsSplit:!1,group:`structural`},{kind:`files`,label:`Files`,needsSplit:!1,group:`structural`}],Tt={tool:`tool`,thinking:`thinking`,title:`title`,file:`file`},Et={"this-month":`This month`,"last-month":`Last month`,"last-7d":`Last 7d`};function Dt(e){return e.dateFrom!=null||e.dateTo!=null||e.projects.length>0||e.models.length>0||e.costMin!=null||e.costMax!=null||e.rebuildMin!=null}function Ot(e,t){let n=[];if(e.dateFrom||e.dateTo){let t=e.datePreset?Et[e.datePreset]??e.datePreset:e.dateFrom&&e.dateTo?`${e.dateFrom} → ${e.dateTo}`:e.dateFrom?`from ${e.dateFrom}`:`to ${e.dateTo}`;n.push({key:`date`,label:t,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{dateFrom:null,dateTo:null,datePreset:null}})})}for(let r of e.projects)n.push({key:`proj:${r}`,label:t===`codex`?`Project`:r,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{projects:e.projects.filter(e=>e!==r)}})});for(let t of e.models)n.push({key:`model:${t}`,label:t,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{models:e.models.filter(e=>e!==t)}})});return e.costMin!=null&&n.push({key:`costMin`,label:`≥$${e.costMin}`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{costMin:null}})}),e.costMax!=null&&n.push({key:`costMax`,label:`≤$${e.costMax}`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{costMax:null}})}),e.rebuildMin!=null&&n.push({key:`rebuildMin`,label:`≥${e.rebuildMin} ♻`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{rebuildMin:null}})}),n}function kt(){let e=(0,I.useSyncExternalStore)(c,()=>f().activeSource),t=r((0,I.useSyncExternalStore)(c,()=>f().snapshot),e,(0,I.useSyncExternalStore)(c,()=>e===`all`?`all`:f().accountFocus.provider[e])),n=(0,I.useSyncExternalStore)(c,()=>f().conversationSearch),i=(0,I.useSyncExternalStore)(c,()=>f().conversationSearchKind),a=(0,I.useSyncExternalStore)(c,()=>f().selectedConversationRef),o=(0,I.useSyncExternalStore)(c,()=>f().convFiltersOpen),s=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),u=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),d=(0,I.useSyncExternalStore)(c,()=>f().comparePick),p=(0,I.useSyncExternalStore)(c,()=>f().conversationTitles),m=N(),h={tz:m.resolvedTz,offsetLabel:m.offsetLabel},g=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!d)return;let e=e=>{if(e.key!==`Escape`)return;let t=f();t.inputMode!==null||t.convFiltersOpen||(e.stopPropagation(),l({type:`CANCEL_COMPARE_PICK`}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[d]),(0,I.useEffect)(()=>{if(!d)return;let e=document.activeElement;(e===null||e===document.body)&&document.querySelector(`.conv-rail-pickcancel`)?.focus()},[d]);let _=n.trim()!==``,v=e===`all`?[]:Ot(s,e),y=d?gt(d.anchor,p):null,b=t=>{t!==e&&(l({type:`SET_ACTIVE_SOURCE`,source:t}),d||l({type:`SELECT_CONVERSATION`,conversationRef:null}),l({type:`CLEAR_CONVERSATION_FILTERS`}),l({type:`SET_CONVERSATION_SEARCH`,text:``}))};return(0,L.jsxs)(`aside`,{className:`conv-rail${d?` conv-rail--picking`:``}`,children:[d&&(0,L.jsxs)(`div`,{className:`conv-rail-pickbanner`,role:`status`,"aria-live":`polite`,children:[(0,L.jsxs)(`span`,{className:`conv-rail-pickbanner-text`,children:[`Comparing with`,` `,y?.kind===`title`?(0,L.jsxs)(`strong`,{className:`conv-rail-pickbanner-title`,children:[`“`,y.text,`”`]}):(0,L.jsx)(`code`,{children:y?.text}),` `,`— pick a session`]}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-pickcancel`,"aria-label":`Cancel comparison pick`,onClick:()=>l({type:`CANCEL_COMPARE_PICK`}),children:`Cancel`})]}),(0,L.jsxs)(`div`,{className:`conv-rail-search`,children:[(0,L.jsx)(`div`,{className:`conv-rail-source`,role:`group`,"aria-label":`Conversation source`,children:[`claude`,`codex`,`all`].map(t=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":e===t,className:`conv-rail-source-btn${e===t?` is-on`:``}`,onClick:()=>b(t),children:t===`claude`?`Claude`:t===`codex`?`Codex`:`All`},t))}),(0,L.jsxs)(`div`,{className:`conv-rail-search-bar`,children:[(0,L.jsxs)(`div`,{className:`conv-rail-search-inputwrap`,children:[(0,L.jsx)(`span`,{className:`conv-rail-search-mag`,"aria-hidden":`true`,children:`⌕`}),(0,L.jsx)(`input`,{ref:g,type:`search`,className:`conv-rail-search-input`,placeholder:`search ${e===`all`?`all`:e===`codex`?`Codex`:`Claude`} conversations…`,value:n,onChange:e=>l({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>l({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>l({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),l({type:`SET_CONVERSATION_SEARCH`,text:``}),g.current?.blur())}})]}),(0,L.jsxs)(`div`,{className:`conv-rail-search-controls`,children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-btn${o?` is-on`:``}`,"aria-expanded":o,disabled:e===`all`,title:e===`all`?`Filters are source-specific`:`Filter conversations`,onClick:()=>l({type:`TOGGLE_CONV_FILTERS`}),onKeyDown:e=>{o&&e.key===`Escape`&&(e.stopPropagation(),l({type:`TOGGLE_CONV_FILTERS`}))},children:`Filters ▾`}),(0,L.jsxs)(`label`,{className:`conv-rail-sort`,children:[(0,L.jsx)(`span`,{className:`conv-rail-sort-label`,children:`Sort`}),(0,L.jsx)(`select`,{className:`conv-rail-sort-select`,"aria-label":`Sort conversations`,value:e===`claude`?u:`recent`,disabled:e!==`claude`,onChange:e=>l({type:`SET_CONVERSATION_RAIL_SORT`,sort:e.target.value}),children:Ct.map(e=>(0,L.jsx)(`option`,{value:e.key,children:e.label},e.key))})]})]})]}),o&&e!==`all`&&(0,L.jsx)(mt,{source:e,accountKey:t??void 0},`${e}:${t??`all`}`),e===`all`&&(0,L.jsx)(`div`,{className:`conv-rail-composed-note`,children:`Merged locally · source-specific filters and sort`}),t&&(0,L.jsx)(`div`,{className:`conv-rail-composed-note`,children:`Scoped to the selected account`}),(0,L.jsx)(`div`,{className:`conv-rail-composed-note conv-rail-population-note`,children:`Message counts include subagent sidechains.`}),v.length>0&&(0,L.jsxs)(`div`,{className:`conv-rail-filters-active`,children:[v.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-activechip`,title:`Remove ${e.label}`,"aria-label":`Remove ${e.label}`,onClick:e.remove,children:[e.label,(0,L.jsx)(`span`,{className:`conv-rail-filters-x`,"aria-hidden":`true`,children:`✕`})]},e.key)),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clearall`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`})]})]}),_?e===`all`?(0,L.jsx)(Rt,{needle:n,kind:i,ctx:h,selectedId:a,pickAnchor:d?.anchor??null}):(0,L.jsx)(Lt,{source:e,accountKey:t??void 0,needle:n,kind:i,ctx:h,selectedId:a,pickAnchor:d?.anchor??null},`${e}:${t??`all`}`):e===`all`?(0,L.jsx)(Nt,{selectedId:a,ctx:h,pickAnchor:d?.anchor??null}):(0,L.jsx)(Mt,{source:e,accountKey:t??void 0,selectedId:a,ctx:h,pickAnchor:d?.anchor??null},`${e}:${t??`all`}`)]})}function At(e,t,n){return e&&!C(e,t)?()=>l({type:`OPEN_COMPARE`,aRef:e,bRef:t}):n}function jt({notice:e,onRetry:t}){return(0,L.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--degraded`,role:`status`,"data-testid":`conv-rail-degraded`,"data-degraded-reason":e.reason,children:[(0,L.jsx)(`div`,{children:e.message}),e.retryable&&t&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>t(),children:`Retry`})]})}function Mt({source:e,accountKey:t,selectedId:n,ctx:r,pickAnchor:i}){return(0,L.jsx)(Pt,{data:Ye(e,{accountKey:t,selectedRef:n}),selectedId:n,ctx:r,pickAnchor:i})}function Nt({selectedId:e,ctx:t,pickAnchor:n}){let r=Ye(`claude`,{qualified:!0,selectedRef:e}),i=Ye(`codex`,{qualified:!0,selectedRef:e}),a={rows:xt(r.rows,i.rows),loading:r.loading||i.loading,error:r.error&&i.error?`Couldn't load either conversation source.`:null,hasMore:r.hasMore||i.hasMore,loadMore:async()=>{await Promise.all([r.hasMore?r.loadMore():void 0,i.hasMore?i.loadMore():void 0])},loadingMore:r.loadingMore||i.loadingMore,filterDegraded:!1,sortDegraded:!1,retry:()=>{r.retry(),i.retry()},pending:r.pending&&i.pending,degraded:r.degraded&&i.degraded?r.degraded:null},o=r.degraded==null!=(i.degraded==null);return(0,L.jsx)(Pt,{data:a,selectedId:e,ctx:t,pickAnchor:n,forcedRecent:!0,partialNote:r.error||i.error?`One source is temporarily unavailable.`:o?(r.degraded??i.degraded).message:r.pending||i.pending?`One source is still indexing.`:null})}function Pt({data:e,selectedId:t,ctx:n,pickAnchor:r,forcedRecent:i=!1,partialNote:a=null}){let{rows:o,loading:s,error:u,hasMore:d,loadMore:m,loadingMore:h,filterDegraded:g,sortDegraded:_,retry:v,pending:b,degraded:x}=e,S=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),w=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),T=(0,L.jsxs)(L.Fragment,{children:[a&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:a}),g&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Project/cost/rebuild filters apply once indexing finishes.`}),_&&(0,L.jsx)(`div`,{className:`conv-rail-sort-degraded`,children:`Cost/Project sort unavailable while indexing — showing recent order.`})]});if(x)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(jt,{notice:x,onRetry:v})]});if(u)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsxs)(`div`,{className:`conv-rail-empty`,children:[u,(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>v(),children:`Retry`})]})]});if(b)return(0,L.jsx)(`div`,{className:`conv-rail-list`,children:(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Codex conversations are still indexing.`})});if(s&&o.length===0)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})]});if(o.length===0)return Dt(S)?(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--filtered`,children:[(0,L.jsx)(`div`,{children:`No conversations match these filters.`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-empty-clear`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear filters`})]})]}):(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})]});let E=i||_?`recent`:w,D=E===`project`,O=null,k=Date.now(),A=_t(o)||D;return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,o.map(e=>{let i=at(E,e,n.tz,k),a=i===null?null:i.toLowerCase(),o=i!==null&&a!==O;return a!==null&&(O=a),(0,L.jsxs)(I.Fragment,{children:[o&&(0,L.jsx)(`div`,{className:`conv-rail-sec${D?` conv-rail-sec--project`:``}`,title:D?i??void 0:void 0,children:i}),(0,L.jsx)(Ft,{row:e,ctx:n,active:C(y(e),t),pickAnchor:r,hideProject:A})]},p(y(e)))}),d&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-more`,disabled:h,onClick:()=>void m(),children:h?`Loading…`:`Load more`})]})}function Ft({row:e,ctx:t,active:n,pickAnchor:r,hideProject:i}){let a=y(e),o=C(r,a),s=re(e.models,1);return(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-row${n?` is-active`:``}${r?` conv-rail-row--pick`:``}${o?` conv-rail-row--anchor`:``}`,disabled:o,"aria-disabled":o||void 0,title:o?`This is the anchor session`:void 0,onClick:At(r,a,()=>l({type:`SELECT_CONVERSATION`,conversationRef:a})),children:[(0,L.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${a.source}`,children:a.source===`codex`?`Codex`:`Claude`}),(0,L.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,L.jsxs)(`span`,{className:`conv-rail-row-metaleft`,children:[!i&&(0,L.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,L.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`})]}),(0,L.jsx)(`span`,{className:`conv-rail-row-when`,children:_.startedShort(e.last_activity_utc,t,{noSuffix:!0})})]}),(0,L.jsxs)(`div`,{className:`conv-rail-row-stats`,children:[s.chips.length>0&&(0,L.jsxs)(`span`,{className:`conv-rail-row-model`,children:[s.chips.map(e=>(0,L.jsx)(`span`,{className:`chip ${e.cls}`,style:M(e.model),title:e.full===e.label?void 0:e.full,"aria-label":e.full===e.label?void 0:e.full,children:e.label},e.model)),s.extra>0&&(0,L.jsxs)(`span`,{className:`conv-rail-row-model-more`,children:[`+`,s.extra]})]}),(0,L.jsxs)(`span`,{className:`conv-rail-row-cluster`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-cost`,children:_.usd2(e.cost_usd)}),(0,L.jsx)(`span`,{className:`conv-rail-row-msgs`,children:e.msg_count})]})]})]})}function It({kind:e,proseOnly:t}){let n=null;return(0,L.jsx)(`div`,{className:`conv-rail-chips`,role:`radiogroup`,"aria-label":`Search kind`,children:wt.map(r=>{let i=r.needsSplit&&t,a=e===r.kind,o=n!==null&&r.group!==n;return n=r.group,(0,L.jsxs)(I.Fragment,{children:[o&&(0,L.jsx)(`span`,{className:`conv-rail-chips-break`,"aria-hidden":`true`}),(0,L.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,disabled:i,title:i?`indexing…`:void 0,className:`conv-rail-chip${a?` is-on`:``}`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH_KIND`,kind:r.kind}),children:r.label})]},r.kind)})})}function Lt({source:e,accountKey:t,needle:n,kind:r,ctx:i,selectedId:a,pickAnchor:o}){return(0,L.jsx)(zt,{data:et(n,r,e,{accountKey:t}),needle:n,kind:r,ctx:i,selectedId:a,pickAnchor:o})}function Rt({needle:e,kind:t,ctx:n,selectedId:r,pickAnchor:i}){let a=et(e,t,`claude`,{qualified:!0}),o=et(e,t,`codex`,{qualified:!0}),s={hits:St(a.hits,o.hits),mode:a.mode===`like`||o.mode===`like`?`like`:a.mode??o.mode,total:a.total+o.total,loading:a.loading||o.loading,loadingMore:a.loadingMore||o.loadingMore,searchDepth:a.searchDepth===`prose-only`||o.searchDepth===`prose-only`?`prose-only`:a.searchDepth??o.searchDepth,filterDegraded:!1,error:a.error&&o.error?`Search failed for both sources.`:null,loadMore:()=>{a.hits.length<a.total&&a.loadMore(),o.hits.length<o.total&&o.loadMore()},pending:a.pending&&o.pending,degraded:a.degraded&&o.degraded?a.degraded:null},c=a.degraded==null!=(o.degraded==null);return(0,L.jsx)(zt,{data:s,needle:e,kind:t,ctx:n,selectedId:r,pickAnchor:i,partialNote:a.error||o.error?`One source search is temporarily unavailable.`:c?(a.degraded??o.degraded).message:a.pending||o.pending?`One source is still indexing.`:null})}function zt({data:e,needle:t,kind:n,ctx:r,selectedId:i,pickAnchor:a,partialNote:o=null}){let{hits:s,mode:c,total:u,loading:d,loadingMore:f,searchDepth:m,filterDegraded:h,error:g,loadMore:_,pending:v,degraded:y}=e,b=m===`prose-only`,x=u-s.length,S=b&&(n===`tools`||n===`thinking`),C=(u===0?`No results`:`${u} results${c===`like`?` · basic search`:``}`)+(S?` · indexing…`:``),w=u===0&&!d&&!g;return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[(0,L.jsx)(It,{kind:n,proseOnly:b}),h&&(0,L.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:`Some filters unavailable while indexing.`}),o&&(0,L.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:o}),y&&s.length===0?(0,L.jsx)(jt,{notice:y}):g?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`alert`,children:g}):v?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Codex conversations are still indexing.`}):d&&s.length===0?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Searching…`}):w?(0,L.jsxs)(`div`,{className:`conv-rail-noresults`,role:`status`,children:[(0,L.jsxs)(`div`,{className:`conv-rail-noresults-q`,children:[`No results for “`,t.length>40?t.slice(0,40)+`…`:t,`”`,S?` · indexing…`:``]}),n!==`all`&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH_KIND`,kind:`all`}),children:`Search all conversations`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH`,text:``}),children:`Clear search`})]}):(0,L.jsxs)(L.Fragment,{children:[y&&(0,L.jsx)(jt,{notice:y}),(0,L.jsx)(`div`,{className:`conv-rail-count`,"aria-live":`polite`,children:C}),s.map((e,t)=>(0,L.jsx)(Bt,{hit:e,ctx:r,kind:n,selectedId:i,pickAnchor:a},`${p(T(e))}-${e.uuid}-${t}`)),!y&&s.length<u&&(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-more`,disabled:f,onClick:()=>_(),children:[`Load `,Math.min(50,x),` more (`,x,` remaining)`]})]})]})}function Bt({hit:e,ctx:t,kind:n,selectedId:r,pickAnchor:i}){let a=e.match_kinds??[],o=a.includes(`file`),s=yt(a,n),c=T(e),u=C(i,c);return(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-row conv-rail-row--hit${C(c,r)?` is-active`:``}${o?` conv-rail-row--filehit`:``}${i?` conv-rail-row--pick`:``}${u?` conv-rail-row--anchor`:``}`,disabled:u,"aria-disabled":u||void 0,title:u?`This is the anchor session`:void 0,onClick:At(i,c,()=>l({type:`OPEN_CONVERSATION`,conversationRef:c,jump:x(c,e.uuid,!0)})),children:[o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-filepath conv-rail-row-title-text`,children:e.snippet}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${c.source}`,children:c.source===`codex`?`Codex`:`Claude`}),s.length>0&&(0,L.jsx)(Vt,{badges:s})]}),(0,L.jsx)(`div`,{className:`conv-rail-row-filetitle`,children:e.title})]}):(0,L.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-title-text`,children:e.title}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${c.source}`,children:c.source===`codex`?`Codex`:`Claude`}),s.length>0&&(0,L.jsx)(Vt,{badges:s})]}),(0,L.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-metaleft`,children:(0,L.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`})}),(0,L.jsx)(`span`,{className:`conv-rail-row-when`,children:_.startedShort(e.ts,t,{noSuffix:!0})})]}),!o&&(0,L.jsx)(`div`,{className:`conv-rail-row-snippet`,children:tt(e.snippet)})]})}function Vt({badges:e}){return(0,L.jsx)(`span`,{className:`conv-rail-kindbs`,children:e.map(e=>(0,L.jsx)(`span`,{className:`conv-rail-kindb`,children:Tt[e]??e},e))})}var Ht=i(k(),1),Ut=0,Wt=1,Gt=2,Kt=4;function qt(e){return()=>e}function Jt(e){e()}function Yt(e,t){return n=>e(t(n))}function Xt(e,t){return()=>e(t)}function Zt(e,t){return n=>e(t,n)}function Qt(e){return e!==void 0}function $t(...e){return()=>{e.map(Jt)}}function en(){}function tn(e,t){return t(e),e}function nn(e,t){return t(e)}function R(...e){return e}function rn(e,t){return e(Wt,t)}function z(e,t){e(Ut,t)}function an(e){e(Gt)}function on(e){return e(Kt)}function B(e,t){return rn(e,Zt(t,Ut))}function sn(e,t){let n=e(Wt,e=>{n(),t(e)});return n}function cn(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function ln(e,t){return e===t}function un(e=ln){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function V(e){return t=>n=>{e(n)&&t(n)}}function H(e){return t=>Yt(t,e)}function dn(e){return t=>()=>{t(e)}}function U(e,...t){let n=hn(...t);return((t,r)=>{switch(t){case Gt:an(e);return;case Wt:return rn(e,n(r))}})}function fn(e,t){return n=>r=>{n(t=e(t,r))}}function pn(e){return t=>n=>{e>0?e--:t(n)}}function mn(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function W(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;rn(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function hn(...e){return t=>e.reduceRight(nn,t)}function gn(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case Wt:return a?n===a?void 0:(r(),n=a,t=rn(e,a),t):(r(),en);case Gt:r(),n=null;return}}}function G(e){let t=e,n=K();return((e,r)=>{switch(e){case Ut:t=r;break;case Wt:r(t);break;case Kt:return t}return n(e,r)})}function _n(e,t){return tn(G(t),t=>B(e,t))}function K(){let e=[];return((t,n)=>{switch(t){case Ut:e.slice().forEach(e=>{e(n)});return;case Gt:e.splice(0,e.length);return;case Wt:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function vn(e){return tn(K(),t=>B(e,t))}function yn(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:bn(),singleton:n}}var bn=()=>Symbol();function xn(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function Sn(...e){let t=K(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;rn(e,e=>{n[a]=e,r|=o,r===i&&z(t,n)})}),function(e,a){switch(e){case Gt:an(t);return;case Wt:return r===i&&a(n),rn(t,a)}}}function q(e,t=ln){return U(e,un(t))}function Cn(...e){return function(t,n){switch(t){case Gt:return;case Wt:return $t(...e.map(e=>rn(e,n)))}}}var wn={DEBUG:0,INFO:1,WARN:2,ERROR:3},Tn={[wn.DEBUG]:`debug`,[wn.ERROR]:`error`,[wn.INFO]:`log`,[wn.WARN]:`warn`},En=()=>typeof globalThis>`u`?window:globalThis,Dn=yn(()=>{let e=G(wn.ERROR);return{log:G((t,n,r=wn.INFO)=>{r>=(En().VIRTUOSO_LOG_LEVEL??on(e))&&console[Tn[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),On=new WeakMap;function kn(e){return`self`in e?e.document.documentElement:e}function An(e){let t=kn(e),n=On.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return On.set(t,r),r}function jn(e){On.delete(kn(e))}function Mn(e,t){return An(e)?-t:t}var Nn=Mn;function Pn(e,t){return Mn(e,t)}function Fn(e,t,n){return In(e,t,n).callbackRef}function In(e,t,n){let r=I.useRef(null),i=e=>{},a=I.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function Ln(e,t,n,r,i,a,o,s,c){return In(I.useCallback(n=>{let c=Rn(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?Nn(o,o.scrollLeft):o.scrollTop:u?s?Nn(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?Nn(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?zn(`column-gap`,getComputedStyle(n).columnGap,i):zn(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function Rn(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},wn.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function zn(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,wn.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Bn(e,t,n){let r=I.useRef(null),i=I.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=In(i,!0,n),s=I.useCallback(()=>{i(o.current)},[i,o]);return I.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var Vn=yn(()=>{let e=K(),t=K(),n=G(0),r=K(),i=G(0),a=K(),o=K(),s=G(0),c=G(0),l=G(0),u=G(0),d=K(),f=K(),p=G(!1),m=G(!1),h=G(!1);return B(U(e,H(({scrollTop:e})=>e)),t),B(U(e,H(({scrollHeight:e})=>e)),o),B(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),Hn={lvl:0};function Un(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function Wn(e){return e===Hn}function Gn(e,t){if(!Wn(e))return t===e.k?e.v:t<e.k?Gn(e.l,t):Gn(e.r,t)}function Kn(e,t,n=`k`){if(Wn(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=Kn(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Kn(e.l,t,n)}function qn(e,t,n){return Wn(e)?ir(t,n,1):t===e.k?er(e,{k:t,v:n}):t<e.k?ar(er(e,{l:qn(e.l,t,n)})):ar(er(e,{r:qn(e.r,t,n)}))}function Jn(){return Hn}function Yn(e,t,n){if(Wn(e))return[];let r=Kn(e,t)[0];return cr(Qn(e,r,n))}function Xn(e,t){if(Wn(e))return Hn;let{k:n,l:r,r:i}=e;if(t===n){if(Wn(r))return i;if(Wn(i))return r;let[t,n]=rr(r);return $n(er(e,{k:t,l:tr(r),v:n}))}return $n(t<n?er(e,{l:Xn(r,t)}):er(e,{r:Xn(i,t)}))}function Zn(e){return Wn(e)?[]:[...Zn(e.l),{k:e.k,v:e.v},...Zn(e.r)]}function Qn(e,t,n){if(Wn(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(Qn(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(Qn(a,t,n))),s}function $n(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(nr(t))return or(er(e,{lvl:n-1}));if(!Wn(t)&&!Wn(t.r))return er(t.r,{l:er(t,{r:t.r.l}),lvl:n,r:er(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(nr(e))return sr(er(e,{lvl:n-1}));if(!Wn(r)&&!Wn(r.l)){let t=r.l,i=nr(t)?r.lvl-1:r.lvl;return er(t,{l:er(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:sr(er(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function er(e,t){return ir(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function tr(e){return Wn(e.r)?e.l:$n(er(e,{r:tr(e.r)}))}function nr(e){return Wn(e)||e.lvl>e.r.lvl}function rr(e){return Wn(e.r)?[e.k,e.v]:rr(e.r)}function ir(e,t,n,r=Hn,i=Hn){return{k:e,l:r,lvl:n,r:i,v:t}}function ar(e){return sr(or(e))}function or(e){let{l:t}=e;return!Wn(t)&&t.lvl===e.lvl?er(t,{r:er(e,{l:t.r})}):e}function sr(e){let{lvl:t,r:n}=e;return!Wn(n)&&!Wn(n.r)&&n.lvl===t&&n.r.lvl===t?er(n,{l:er(e,{r:n.l}),lvl:t+1}):e}function cr(e){return Un(e,({k:e,v:t})=>({index:e,value:t}))}function lr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ur(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var dr=yn(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function fr(e,t,n){return e[pr(e,t,n)]}function pr(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function mr(e,t,n,r){let i=pr(e,t,r),a=pr(e,n,r,i);return e.slice(i,a+1)}function hr(e,t){return Math.round(e.getBoundingClientRect()[t])}function gr(e){return!Wn(e.groupOffsetTree)}function _r({index:e},t){return t===e?0:t<e?-1:1}function vr(){return{groupIndices:[],groupOffsetTree:Jn(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Jn()}}function yr(e,t){let n=Wn(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),Wn(e)){e=qn(e,0,i);continue}let o=Yn(e,a-1,t+1);if(o.some(jr(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Xn(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=qn(e,t+1,a));c&&(e=qn(e,a,i))}return[e,n]}function br(e){return typeof e.groupIndex<`u`}function xr({offset:e},t){return t===e?0:t<e?-1:1}function Sr(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=fr(t,e,_r),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function Cr(e,t){if(!gr(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function wr(e,t,n){if(br(e))return t.groupIndices[e.groupIndex]+1;let r=Cr(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function Tr(e,t,n,r=0){return r>0&&(t=Math.max(t,fr(e,r,_r).offset)),Un(mr(e,t,n,xr),Ar)}function Er(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,wn.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Wn(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>qn(qn(t,n,e),n+1,r),o)}else [o,s]=yr(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=kr(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>qn(e,t,Sr(t,d,i)),Jn()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function Dr(e){return Zn(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function Or(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function kr(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=pr(i,t-1,_r),s=i[c].offset;let e=Kn(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===Kn(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of Yn(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function Ar(e){return{index:e.index,value:e}}function jr(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var Mr={offsetHeight:`height`,offsetWidth:`width`},Nr=yn(([{log:e},{recalcInProgress:t}])=>{let n=K(),r=K(),i=_n(r,0),a=K(),o=K(),s=G(0),c=G([]),l=G(void 0),u=G(void 0),d=G(void 0),f=G(void 0),p=G((e,t)=>hr(e,Mr[t])),m=G(void 0),h=G(0),g=vr(),_=_n(U(n,W(c,e,h),fn(Er,g),un()),g),v=_n(U(c,un(),fn((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),H(({prev:e})=>e)),[]);B(U(c,V(e=>e.length>0),W(_,h),H(([e,t,n])=>{let r=e.reduce((e,r,i)=>qn(e,r,Sr(r,t.offsetTree,n)||i),Jn());return{...t,groupIndices:e,groupOffsetTree:r}})),_),B(U(r,W(_),V(([e,{lastIndex:t}])=>e<t),H(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),B(l,u);let y=_n(U(l,H(e=>e===void 0)),!0);B(U(u,V(e=>e!==void 0&&Wn(on(_).sizeTree)),H(e=>{let t=on(d),n=on(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),B(U(f,V(e=>e!==void 0&&e.length>0&&Wn(on(_).sizeTree)),H(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),B(U(c,W(d,u),V(([,e,t])=>e!==void 0&&t!==void 0),H(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=vn(U(n,W(_),fn(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),H(e=>e.changed)));rn(U(s,fn((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),H(e=>e.diff)),e=>{let{groupIndices:n}=on(_);if(e>0)z(t,!0),z(a,e+Or(e,n));else if(e<0){let t=on(v);t.length>0&&(e-=Or(-e,t)),z(o,e)}}),rn(U(s,W(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},wn.ERROR)});let x=vn(a);B(U(a,W(_),H(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Gn(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=Zn(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Zn(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=vn(U(o,W(_,h),H(([e,{offsetTree:t},n])=>Sr(-e,t,n))));return B(U(o,W(_,h),H(([e,t,n])=>{if(t.groupIndices.length>0){if(Wn(t.sizeTree))return t;let r=Jn(),i=on(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=Zn(t.sizeTree).reduce((t,{k:n,v:r})=>qn(t,Math.max(0,n+e),r),r),a!==-e){let n=Gn(t.sizeTree,s);r=qn(r,0,n);let i=Kn(t.sizeTree,-e+1)[1];r=qn(r,1,i)}return{...t,sizeTree:r,...kr(t.offsetTree,0,r,n)}}let r=Zn(t.sizeTree).reduce((t,{k:n,v:r})=>qn(t,Math.max(0,n+e),r),Jn());return{...t,sizeTree:r,...kr(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},R(Dn,dr),{singleton:!0});function Pr(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var Fr=yn(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=K(),o=K(),s=vn(U(a,H(Pr)));return B(U(s,H(e=>e.totalCount)),n),B(U(s,H(e=>e.groupIndices)),e),B(U(Sn(i,t,r),V(([e,t])=>gr(t)),H(([e,t,n])=>Kn(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),un(),H(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},R(Nr,Vn)),Ir=yn(([{log:e}])=>{let t=G(!1),n=vn(U(t,V(e=>e),un()));return rn(t,t=>{t&&on(e)(`props updated`,{},wn.DEBUG)}),{didMount:n,propsReady:t}},R(Dn),{singleton:!0}),Lr=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function Rr(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!Lr)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var zr=yn(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=K(),m=K(),h=G(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),z(c,!1)}return B(U(p,W(n,d,r,h,s,o,f),W(e,a,i),H(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=Rr(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=wr(b,n,w),E=Sr(T,n.offsetTree,d)+o;x===`end`?(E+=f+Kn(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+Kn(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},wn.DEBUG),z(p,e)):(z(m,!0),l(`list did not change, scroll successful`,{},wn.DEBUG))};if(y(),S===`smooth`){let e=!1;v=rn(t,t=>{e||=t}),g=sn(u,()=>{D(e)})}else g=sn(U(t,Br(150)),D);return _=setTimeout(()=>{y()},1200),z(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},wn.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},R(Nr,Vn,Dn),{singleton:!0});function Br(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Vr(e,t){e===0?t():requestAnimationFrame(()=>{Vr(e-1,t)})}function Hr(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Ur=yn(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=G(!0),c=G(0),l=G(!0);return B(U(o,W(c),V(([e,t])=>t!==0),dn(!1)),s),B(U(o,W(c),V(([e,t])=>t!==0),dn(!1)),l),rn(U(Sn(t,o),W(s,n,e,l),V(([[,e],t,{sizeTree:n},r,i])=>e&&(!Wn(n)||Qt(r))&&!t&&!i),W(c)),([,e])=>{sn(i,()=>{z(l,!0)}),Vr(4,()=>{sn(r,()=>{z(s,!0)}),z(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},R(Nr,Vn,zr,Ir),{singleton:!0});function Wr(e,t){return Math.abs(e-t)<1.01}var Gr=`up`,Kr=`down`,qr=`none`,Jr={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Yr=0,Xr=yn(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=G(!1),s=G(!0),c=K(),l=K(),u=G(4),d=G(Yr),f=_n(U(Cn(U(q(i),pn(1),dn(!0)),U(q(i),pn(1),dn(!1),cn(100))),un()),!1),p=_n(U(Cn(U(n,dn(!0)),U(n,dn(!1),cn(200))),un()),!1);B(U(Sn(q(i),q(d)),H(([e,t])=>e<=t),un()),s),B(U(s,mn(50)),l);let m=vn(U(Sn(r,q(a),q(t),q(e),q(u)),fn((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},Jr),un((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=_n(U(r,fn((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Wr(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),V(e=>e.changed),H(e=>e.jump)),0);B(U(m,H(e=>e.atBottom)),o),B(U(o,mn(50)),c);let g=G(Kr);B(U(r,H(({scrollTop:e})=>e),un(),fn((e,t)=>on(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Gr:Kr,prevScrollTop:t},{direction:Kr,prevScrollTop:0}),H(e=>e.direction)),g),B(U(r,mn(50),dn(qr)),g);let _=G(0);return B(U(f,V(e=>!e),dn(0)),_),B(U(i,mn(100),W(f),V(([e,t])=>t),fn(([e,t],[n])=>[t,n],[0,0]),H(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},R(Vn)),Zr=`top`,Qr=`bottom`,$r=`none`;function ei(e,t,n){return typeof e==`number`?n===Gr&&t===Zr||n===Kr&&t===Qr?e:0:n===Gr?t===Zr?e.main:e.reverse:t===Qr?e.main:e.reverse}function ti(e,t){return typeof e==`number`?e:e[t]??0}var ni=yn(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=K(),o=G(0),s=G(0),c=G(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:_n(U(Sn(q(r),q(i),q(n),q(a,ur),q(c),q(o),q(t),q(e),q(s)),H(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=$r,m=ti(l,Zr),h=ti(l,Qr);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=Gr),i<e-f+t+h&&(p=Kr),p===$r?null:[Math.max(u-n-ei(a,Zr,p)-m,0),u-f-s+t+ei(a,Qr,p)+h]}),V(e=>e!==null),un(ur)),[0,0])}},R(Vn),{singleton:!0});function ri(e,t,n){if(gr(t)){let r=Cr(e,t);return[{index:Kn(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var ii={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ai(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:si(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:si(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function oi(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=Hr(t,s);return ai(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function si(e,t,n){if(e.length===0)return[];if(!gr(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=Yn(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function ci(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var li=yn(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=G([]),g=G(0),_=K(),v=G(0);B(a.topItemsIndexes,h);let y=_n(U(Sn(p,m,q(c,ur),q(i),q(r),q(l),u,q(h),q(t),q(n),q(v),e),V(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),H(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=on(g);if(n===0)return{...ii,totalCount:n};if(e===0&&t===0)return m===0?{...ii,totalCount:n}:oi(m,i,r,s,c,u||[]);if(Wn(p))return m>0?null:ai(ri(Hr(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of Yn(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return ai([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=Tr(f,e,t,_);if(v.length===0)return null;let y=n-1,b=tn([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=ci(l,Zr),S=ci(l,Qr);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=Yn(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=Yn(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return ai(b,h,n,c,d,s)}),V(e=>e!==null),un()),ii);B(U(e,V(Qt),H(e=>e?.length)),i),B(U(y,H(e=>e.topListHeight)),d),B(d,s),B(U(y,H(e=>[e.top,e.bottom])),o),B(U(y,H(e=>e.items)),_);let b=vn(U(y,V(({items:e})=>e.length>0),W(i,e),V(([{items:e},t])=>e[e.length-1].originalIndex===t-1),H(([,e,t])=>[e-1,t]),un(ur),H(([e])=>e))),x=vn(U(y,mn(200),V(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),H(({items:e})=>e[0].index),un()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:vn(U(y,V(({items:e})=>e.length>0),H(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),un(lr))),startReached:x,topItemsIndexes:h,...f}},R(Nr,Fr,ni,Ur,zr,Xr,Ir,dr),{singleton:!0}),ui=yn(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=K(),o=_n(U(Sn(n,e,r,t,i),H(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return B(q(o),a),{totalListHeight:o,totalListHeightChanged:a}},R(Vn,li),{singleton:!0}),di=yn(([{viewportHeight:e},{totalListHeight:t}])=>{let n=G(!1);return{alignToBottom:n,paddingTopAddition:_n(U(Sn(n,e,t),V(([e])=>e),H(([,e,t])=>Math.max(0,e-t)),mn(0),un()),0)}},R(Vn,ui),{singleton:!0}),fi=yn(()=>({context:G(null)})),pi=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,mi=yn(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=K();return B(U(u,W(t,c,n,a,i,r,s),W(e),H(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=pi,done:d,...f}=e,p=wr(e,t,r-1),m=Sr(p,t.offsetTree,l)+i+a,h=m+Kn(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&sn(U(o,V(e=>!e),pn(on(o)?1:2)),d),_}),V(e=>e!==null)),l),{scrollIntoView:u}},R(Nr,Vn,zr,li,Dn),{singleton:!0});function hi(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var gi=(e,t)=>typeof e==`function`?hi(e(t)):t&&hi(e),_i=yn(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=G(!1),h=K(),g=null;function _(e){z(o,{align:`end`,behavior:e,index:`LAST`})}rn(U(Sn(U(q(t),pn(1)),c),W(q(m),a,s,d),H(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=gi(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),V(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),on(n)===void 0?g=sn(e,()=>{on(u)(`following output to `,{totalCount:r},wn.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{on(u)(`following output to `,{totalCount:r},wn.DEBUG),_(t)})});function v(e){let t=sn(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(on(u)(`scrolling to bottom due to increased size`,{},wn.DEBUG),_(`auto`))});setTimeout(t,100)}rn(U(Sn(q(m),t,l),V(([e,,t])=>e!==!1&&t),fn(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),V(({refreshed:e})=>e),W(m,t)),([,e])=>{on(s)&&v(e!==!1)}),rn(h,()=>{v(on(m)!==!1)}),rn(Sn(q(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=G(null),b=K();return B(Cn(U(q(r),H(e=>e?.length??0)),U(q(t))),b),rn(U(Sn(U(b,pn(1)),c),W(q(y),s,d,f),H(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),V(e=>!!e),mn(0)),t=>{g!==null&&(g(),g=null),on(n)===void 0?g=sn(e,()=>{on(u)(`scrolling into view`,{}),z(p,t),g=null}):requestAnimationFrame(()=>{on(u)(`scrolling into view`,{}),z(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},R(Nr,Xr,zr,Ur,Ir,Dn,Vn,fi,mi)),vi=yn(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(B(U(s,W(a),V(([,e])=>e!==0),W(i,r,t,n,e),H(([[,e],t,n,r,i,a=[]])=>oi(e,t,n,r,i,a))),o),{}),R(Nr,Ur,li,Ir),{singleton:!0}),yi=yn(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=G(0);return rn(U(e,W(r),V(([,e])=>e!==0),H(([,e])=>({top:e}))),e=>{sn(U(n,pn(1),V(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{z(t,e)})})}),{initialScrollTop:r}},R(Ir,Vn,li),{singleton:!0}),bi=yn(([{scrollVelocity:e}])=>{let t=G(!1),n=K(),r=G(!1);return B(U(e,W(r,t,n),V(([e,t])=>t!==!1&&t!==void 0),H(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),un()),t),rn(U(Sn(t,e,n),W(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},R(Xr),{singleton:!0}),xi=yn(([{scrollContainerState:e,scrollTo:t}])=>{let n=K(),r=K(),i=K(),a=G(!1),o=G(void 0);return B(U(Sn(n,r),H(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),B(U(t,W(r),H(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},R(Vn)),Si=yn(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=K(),u=G(void 0),d=G(null),f=G(null);return B(s,d),B(c,f),rn(U(l,W(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=Dr(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),B(U(u,V(Qt),H(Ci)),i),B(U(a,W(u),V(([,e])=>e!==void 0),un(),H(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},R(Nr,Vn,Ur,Ir,xi));function Ci(e){return{align:`start`,index:0,offset:e.scrollTop}}var wi=yn(([{topItemsIndexes:e}])=>{let t=G(0);return B(U(t,V(e=>e>=0),H(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},R(li));function Ti(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var Ei=Ti(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Di=yn(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return B(k,T.scrollSeekRangeChanged),B(U(T.windowViewportRect,H(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},R(Nr,Ur,Vn,Si,_i,li,zr,yn(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=vn(U(c,W(o),fn(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),V(([e])=>e!==0),W(r,s,n,i,p,m),V(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===Gr),H(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},wn.DEBUG),e))));function g(n){n>0?(z(t,{behavior:`auto`,top:-n}),z(e,0)):(z(e,0),z(t,{behavior:`auto`,top:-n}))}return rn(U(h,W(e,a)),([t,n,r])=>{r&&Ei()?z(e,n-t):g(-t)}),rn(U(Sn(_n(a,!1),e,m),V(([e,t,n])=>!e&&!n&&t!==0),H(([e,t])=>t),mn(1)),g),B(U(d,H(e=>({top:-e}))),t),rn(U(l,W(f,u),H(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=Gn(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{z(e,n),requestAnimationFrame(()=>{z(t,{top:n}),requestAnimationFrame(()=>{z(e,0),z(m,!1)})})}),{deviation:e}},R(Vn,Xr,li,Nr,Dn,dr)),wi,Fr,yn(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),R(ni,vi,Ir,bi,ui,yi,di,xi,mi,Dn,fi))));function Oi(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var ki=typeof document<`u`?I.useLayoutEffect:I.useEffect;function Ai(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=I.createContext({});function c(e,n){e.propsReady!==void 0&&z(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];z(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];z(i,n[r])}e.propsReady!==void 0&&z(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];z(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=gn(e[t.events[r]]),n),{})}return{Component:I.forwardRef(function(t,a){let{children:d,...f}=t,[p]=I.useState(()=>tn(xn(e),e=>{c(e,f)})),[m]=I.useState(Xt(u,p));ki(()=>{for(let e of o)e in f&&rn(m[e],f[e]);return()=>{Object.values(m).map(an)}},[f,m,p]),ki(()=>{c(p,f)}),I.useImperativeHandle(a,qt(l(p)));let h=n;return(0,L.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,L.jsx)(h,{...Oi([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=I.useContext(s)[e];ki(()=>rn(n,t),[t,n])},useEmitterValue:e=>{let t=I.useContext(s)[e],n=I.useCallback(e=>rn(t,e),[t]);return I.useSyncExternalStore(n,()=>on(t),()=>on(t))},usePublisher:e=>{let t=I.useContext(s);return I.useCallback(n=>{z(t[e],n)},[t,e])}}}var ji=I.createContext(void 0),Mi=I.createContext(void 0),Ni=`-webkit-sticky`,Pi=`sticky`,Fi=Ti(()=>{if(typeof document>`u`)return Pi;let e=document.createElement(`div`);return e.style.position=Ni,e.style.position===Ni?Ni:Pi}),Ii=typeof document<`u`?I.useLayoutEffect:I.useEffect;function Li(e){return`self`in e}function Ri(e){return`body`in e}function zi(e,t,n,r=en,i,a){let o=I.useRef(null),s=I.useRef(null),c=I.useRef(null),l=I.useCallback(n=>{let r,i,o,l=n.target;if(Ri(l)||Li(l)){let e=Li(l)?l:l.defaultView;o=a===!0?Nn(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?Nn(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Ht.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);I.useEffect(()=>{let e=i||o.current;return jn(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{jn(e),r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;Li(r)?(u=Math.max(hr(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?Nn(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=hr(r,a===!0?`width`:`height`),d=a===!0?Nn(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,Wr(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:Pn(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:Pn(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Bi(e){return e}var Vi=yn(([e,t])=>({...e,...t}),R(Di,yn(()=>{let e=G(e=>`Item ${e}`),t=G(e=>`Group ${e}`),n=G({}),r=G(Bi),i=G(`div`),a=G(en),o=(e,t=null)=>_n(U(n,H(t=>t[e]),un()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),Hi=({height:e})=>(0,L.jsx)(`div`,{style:{height:e}}),Ui={overflowAnchor:`none`,position:Fi(),zIndex:1},Wi={overflowAnchor:`none`},Gi={...Wi,display:`inline-block`,height:`100%`},Ki=I.memo(function({showTopList:e=!1}){let t=J(`listState`),n=la(`sizeRanges`),r=J(`useWindowScroll`),i=J(`customScrollParent`),a=la(`windowScrollContainerState`),o=la(`scrollContainerState`),s=i||r?a:o,c=J(`itemContent`),l=J(`context`),u=J(`groupContent`),d=J(`trackItemSizes`),f=J(`itemSize`),p=J(`log`),m=la(`gap`),h=J(`horizontalDirection`),{callbackRef:g}=Ln(n,f,d,e?en:s,p,m,i,h,J(`skipAnimationFrameInResizeObserver`)),[_,v]=I.useState(0);ca(`deviation`,e=>{_!==e&&v(e)});let y=J(`EmptyPlaceholder`),b=J(`ScrollSeekPlaceholder`)??Hi,x=J(`ListComponent`),S=J(`ItemComponent`),C=J(`GroupComponent`),w=J(`computeItemKey`),T=J(`isSeeking`),E=J(`groupIndices`).length>0,D=J(`alignToBottom`),O=J(`initialItemFinalLocationReached`),k=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?D?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,L.jsx)(y,{...Qi(y,l)}):(0,L.jsx)(x,{...Qi(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:k,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,I.createElement)(b,{...Qi(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,I.createElement)(C,{...Qi(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Ui},u(e.index,l)):(0,I.createElement)(S,{...Qi(S,l),...$i(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?Gi:Wi},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),qi={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Ji={outline:`none`,overflowX:`auto`,position:`relative`},Yi=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),Xi=(e,t,n=0)=>({...Yi(e),position:t?`relative`:`absolute`,top:t?-n:0}),Zi={position:Fi(),top:0,width:`100%`,zIndex:1};function Qi(e,t){if(typeof e!=`string`)return{context:t}}function $i(e,t){return{item:typeof e==`string`?void 0:t}}var ea=I.memo(function(){let e=J(`HeaderComponent`),t=la(`headerHeight`),n=J(`HeaderFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,J(`skipAnimationFrameInResizeObserver`)),i=J(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),ta=I.memo(function(){let e=J(`FooterComponent`),t=la(`footerHeight`),n=J(`HeaderFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,J(`skipAnimationFrameInResizeObserver`)),i=J(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})});function na({useEmitter:e,useEmitterValue:t,usePublisher:n}){return I.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=zi(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,L.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Ji:qi,...i},tabIndex:0,...o,...Qi(c,a),children:r})})}function ra({useEmitter:e,useEmitterValue:t,usePublisher:n}){return I.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=I.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=zi(s,l,c,t(`scrollerRef`),f);return Ii(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,L.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...Qi(c,a),children:r})})}var ia=({children:e})=>{let t=I.useContext(ji),n=la(`viewportHeight`),r=la(`fixedItemHeight`),i=J(`alignToBottom`),a=J(`horizontalDirection`),o=Fn(I.useMemo(()=>Yt(n,e=>hr(e,a?`width`:`height`)),[n,a]),!0,J(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:Yi(i),children:e})},aa=({children:e})=>{let t=I.useContext(ji),n=la(`windowViewportRect`),r=la(`fixedItemHeight`),i=J(`customScrollParent`),a=J(`useWindowScroll`),o=J(`topListHeight`),s=Bn(n,i,J(`skipAnimationFrameInResizeObserver`)),c=J(`alignToBottom`);return I.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:Xi(c,a,o),children:e})},oa=({children:e})=>{let t=J(`TopItemListComponent`)??`div`,n=J(`headerHeight`);return(0,L.jsx)(t,{style:{...Zi,marginTop:`${n}px`},...Qi(t,J(`context`)),children:e})},{Component:sa,useEmitter:ca,useEmitterValue:J,usePublisher:la}=Ai(Vi,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},I.memo(function(e){let t=J(`useWindowScroll`),n=J(`topItemsIndexes`).length>0,r=J(`customScrollParent`),i=J(`context`);return(0,L.jsxs)(r||t?da:ua,{...e,context:i,children:[n&&(0,L.jsx)(oa,{children:(0,L.jsx)(Ki,{showTopList:!0})}),(0,L.jsxs)(r||t?aa:ia,{children:[(0,L.jsx)(ea,{}),(0,L.jsx)(Ki,{}),(0,L.jsx)(ta,{})]})]})})),ua=na({useEmitter:ca,useEmitterValue:J,usePublisher:la}),da=ra({useEmitter:ca,useEmitterValue:J,usePublisher:la}),fa=sa,pa=yn(([e,t])=>({...e,...t}),R(Di,yn(()=>{let e=G(e=>(0,L.jsxs)(`td`,{children:[`Item $`,e]})),t=G(null),n=G(e=>(0,L.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=G(null),i=G(null),a=G({}),o=G(Bi),s=G(en),c=(e,t=null)=>_n(U(a,H(t=>t[e]),un()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),ma=({height:e})=>(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{style:{height:e}})}),ha=({height:e})=>(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),ga={overflowAnchor:`none`},_a={position:Fi(),zIndex:2,overflowAnchor:`none`},va=I.memo(function({showTopList:e=!1}){let t=Y(`listState`),n=Y(`computeItemKey`),r=Y(`firstItemIndex`),i=Y(`context`),a=Y(`isSeeking`),o=Y(`fixedHeaderHeight`),s=Y(`groupIndices`).length>0,c=Y(`itemContent`),l=Y(`groupContent`),u=Y(`ScrollSeekPlaceholder`)??ma,d=Y(`GroupComponent`),f=Y(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,I.createElement)(u,{...Qi(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,I.createElement)(d,{...Qi(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{..._a,top:o}},l(t.index,i)):(0,I.createElement)(f,{...Qi(f,i),...$i(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{..._a,top:o+g}:ga},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),ya=I.memo(function(){let e=Y(`listState`),t=Y(`topItemsIndexes`).length>0,n=wa(`sizeRanges`),r=Y(`useWindowScroll`),i=Y(`customScrollParent`),a=wa(`windowScrollContainerState`),o=wa(`scrollContainerState`),s=i||r?a:o,c=Y(`trackItemSizes`),{callbackRef:l,ref:u}=Ln(n,Y(`itemSize`),c,s,Y(`log`),void 0,i,!1,Y(`skipAnimationFrameInResizeObserver`)),[d,f]=I.useState(0);Ca(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=Y(`EmptyPlaceholder`),m=Y(`FillerRow`)??ha,h=Y(`TableBodyComponent`),g=Y(`paddingTopAddition`),_=Y(`statefulTotalCount`),v=Y(`context`);if(_===0&&p!=null)return(0,L.jsx)(p,{...Qi(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,L.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,L.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,L.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...Qi(h,v),children:[S,t&&(0,L.jsx)(va,{showTopList:!0}),(0,L.jsx)(va,{}),C]})}),ba=({children:e})=>{let t=I.useContext(ji),n=wa(`viewportHeight`),r=wa(`fixedItemHeight`),i=Fn(I.useMemo(()=>Yt(n,e=>hr(e,`height`)),[n]),!0,Y(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:Yi(!1),children:e})},xa=({children:e})=>{let t=I.useContext(ji),n=wa(`windowViewportRect`),r=wa(`fixedItemHeight`),i=Y(`customScrollParent`),a=Y(`useWindowScroll`),o=Bn(n,i,Y(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:Xi(!1,a),children:e})},{Component:Sa,useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}=Ai(pa,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},I.memo(function(e){let t=Y(`useWindowScroll`),n=Y(`customScrollParent`),r=wa(`fixedHeaderHeight`),i=wa(`fixedFooterHeight`),a=Y(`fixedHeaderContent`),o=Y(`fixedFooterContent`),s=Y(`context`),c=Fn(I.useMemo(()=>Yt(r,e=>hr(e,`height`)),[r]),!0,Y(`skipAnimationFrameInResizeObserver`)),l=Fn(I.useMemo(()=>Yt(i,e=>hr(e,`height`)),[i]),!0,Y(`skipAnimationFrameInResizeObserver`)),u=n||t?Ea:Ta,d=n||t?xa:ba,f=Y(`TableComponent`),p=Y(`TableHeadComponent`),m=Y(`TableFooterComponent`),h=a?(0,L.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...Qi(p,s),children:a()},`TableHead`):null,g=o?(0,L.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...Qi(m,s),children:o()},`TableFoot`):null;return(0,L.jsx)(u,{...e,...Qi(u,s),children:(0,L.jsx)(d,{children:(0,L.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...Qi(f,s),children:[h,(0,L.jsx)(ya,{},`TableBody`),g]})})})})),Ta=na({useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}),Ea=ra({useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}),Da={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Oa={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:ka,floor:Aa,max:ja,min:Ma,round:Na}=Math;function Pa(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Fa(e){return{...Oa,items:e}}function Ia(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function La(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var Ra=yn(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=G(0),C=G(0),w=G(Da),T=G({height:0,width:0}),E=G({height:0,width:0}),D=K(),O=K(),k=G(0),A=G(null),j=G({column:0,row:0}),M=K(),ee=K(),N=G(!1),te=G(0),P=G(!0),F=G(!1),ne=G(!1);rn(U(m,W(te),V(([e,t])=>t!==0)),()=>{z(P,!1)}),rn(U(Sn(m,P,E,T,te,F),V(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{z(F,!0),Vr(1,()=>{z(D,e)}),sn(U(l),()=>{z(t,[0,0]),z(P,!0)})}),B(U(ee,V(e=>e!=null&&e.scrollTop>0),dn(0)),C),rn(U(m,W(ee),V(([,e])=>e!=null)),([,e])=>{e&&(z(T,e.viewport),z(E,e.item),z(j,e.gap),e.scrollTop>0&&(z(N,!0),sn(U(l,pn(1)),e=>{z(N,!1)}),z(c,{top:e.scrollTop})))}),B(U(T,H(({height:e})=>e)),d),B(U(Sn(q(T,Ia),q(E,Ia),q(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),q(l)),H(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),B(U(Sn(q(S),r,q(j,La),q(E,Ia),q(T,Ia),q(A),q(C),q(N),q(P),q(te)),V(([,,,,,,,e])=>!e),H(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return Da;if(p===0){let t=Hr(l,e);return Fa(Pa(t,t+Math.max(s-1,0),o))}let h=za(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Aa((t+d)/(f+d)),_=h*ka((n+d)/(f+d))-1,_=Ma(e-1,ja(_,h-1)),g=Ma(_,ja(0,g))):(g=0,_=-1);let v=Pa(g,_,o),{bottom:y,top:b}=Ba(a,r,i,v),x=ka(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),B(U(A,V(e=>e!==null),H(e=>e.length)),S),B(U(Sn(T,E,w,j),V(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),H(([e,t,{items:n},r])=>{let{bottom:i,top:a}=Ba(e,r,t,n);return[a,i]}),un(ur)),t);let re=G(!1);B(U(l,W(re),H(([e,t])=>t||e!==0)),re);let ie=vn(U(Sn(w,S),V(([{items:e}])=>e.length>0),W(re),V(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),H(([[,e]])=>e-1),un())),ae=vn(U(q(w),V(({items:e})=>e.length>0&&e[0].index===0),dn(0),un())),oe=vn(U(q(w),W(N),V(([{items:e},t])=>e.length>0&&!t),H(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),un(lr),mn(0)));B(oe,p.scrollSeekRangeChanged),B(U(D,W(T,E,S,j),H(([e,t,n,r,i])=>{let a=Rr(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=ja(0,l,Ma(r-1,l));let u=Va(t,i,n,l);return o===`end`?u=Na(u-t.height+n.height):o===`center`&&(u=Na(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let se=_n(U(w,H(e=>e.offsetBottom+e.bottom)),0);return B(U(b,H(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:ee,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:ne,initialTopMostItemIndex:te,totalListHeight:se,...f,endReached:ie,propsReady:h,rangeChanged:oe,startReached:ae,stateChanged:M,stateRestoreInProgress:N,...x}},R(ni,Vn,Xr,bi,Ir,xi,Dn));function za(e,t,n){return ja(1,Aa((e+n)/(Aa(t)+n)))}function Ba(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Va(e,t,n,r[0].index);return{bottom:Va(e,t,n,r[r.length-1].index)+i,top:a}}function Va(e,t,n,r){let i=Aa(r/za(e.width,n.width,t.column)),a=i*n.height+ja(0,i-1)*t.row;return a>0?a+t.row:a}var Ha=yn(([e,t])=>({...e,...t}),R(Ra,yn(()=>{let e=G(e=>`Item ${e}`),t=G({}),n=G(null),r=G(`virtuoso-grid-item`),i=G(`virtuoso-grid-list`),a=G(Bi),o=G(`div`),s=G(en),c=(e,n=null)=>_n(U(t,H(t=>t[e]),un()),n),l=G(!1),u=G(!1);return B(q(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),Ua=I.memo(function(){let e=Xa(`gridState`),t=Xa(`listClassName`),n=Xa(`itemClassName`),r=Xa(`itemContent`),i=Xa(`computeItemKey`),a=Xa(`isSeeking`),o=Za(`scrollHeight`),s=Xa(`ItemComponent`),c=Xa(`ListComponent`),l=Xa(`ScrollSeekPlaceholder`),u=Xa(`context`),d=Za(`itemDimensions`),f=Za(`gap`),p=Xa(`log`),m=Xa(`stateRestoreInProgress`),h=Za(`reportReadyState`),g=Fn(I.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:eo(`column-gap`,getComputedStyle(e).columnGap,p),row:eo(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return Ii(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,L.jsx)(c,{className:t,ref:g,...Qi(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,L.jsx)(l,{...Qi(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,I.createElement)(s,{...Qi(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),Wa=I.memo(function(){let e=Xa(`HeaderComponent`),t=Za(`headerHeight`),n=Xa(`headerFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,!1),i=Xa(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),Ga=I.memo(function(){let e=Xa(`FooterComponent`),t=Za(`footerHeight`),n=Xa(`headerFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,!1),i=Xa(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),Ka=({children:e})=>{let t=I.useContext(Mi),n=Za(`itemDimensions`),r=Za(`viewportDimensions`),i=Fn(I.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return I.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,L.jsx)(`div`,{ref:i,style:Yi(!1),children:e})},qa=({children:e})=>{let t=I.useContext(Mi),n=Za(`windowViewportRect`),r=Za(`itemDimensions`),i=Xa(`customScrollParent`),a=Xa(`useWindowScroll`),o=Bn(n,i,!1);return I.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,L.jsx)(`div`,{ref:o,style:Xi(!1,a),children:e})},{Component:Ja,useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za}=Ai(Ha,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},I.memo(function({...e}){let t=Xa(`useWindowScroll`),n=Xa(`customScrollParent`),r=n||t?$a:Qa,i=n||t?qa:Ka,a=Xa(`context`);return(0,L.jsx)(r,{...e,...Qi(r,a),children:(0,L.jsxs)(i,{children:[(0,L.jsx)(Wa,{}),(0,L.jsx)(Ua,{}),(0,L.jsx)(Ga,{})]})})})),Qa=na({useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za}),$a=ra({useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za});function eo(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,wn.WARN),t===`normal`?0:parseInt(t??`0`,10)}function to(e){return e.blocks?.length??0}function no(e,t){if(t.size===0)return!1;if(t.has(e.anchor.uuid))return!0;for(let n of e.member_uuids)if(t.has(n))return!0;return!1}var ro=e=>({keep:e,droppedTop:0,droppedBottom:0,resetTopCursorTo:null,resetBottomCursorTo:null});function io(e,t,n){let{capBlocks:r,capItems:i}=t,a=0,o=0;for(let t=0;t<e.length;t++){let s=e[n?t:e.length-1-t],c=a+to(s);if(o>0&&(c>r||o+1>i))break;a=c,o+=1}return o}function ao(e){let{items:t,op:n,capBlocks:r,capItems:i,protectedUuids:a,fetchInFlight:o}=e;if(o||n===`reset`)return ro(t);let s=0;for(let e of t)s+=to(e);if(t.length<=i&&s<=r)return ro(t);if(n===`prepend`){let n=io(t,e,!0);for(let e=t.length-1;e>=n;e--)if(no(t[e],a)){n=e+1;break}if(n>=t.length)return ro(t);let r=t.slice(0,n);return{keep:r,droppedTop:0,droppedBottom:t.length-n,resetTopCursorTo:null,resetBottomCursorTo:r[r.length-1].anchor.id}}let c=t.length-io(t,e,!1),l=c;for(let e=0;e<c;e++)if(no(t[e],a)){l=e;break}if(l<=0)return ro(t);let u=t.slice(l);return{keep:u,droppedTop:l,droppedBottom:0,resetTopCursorTo:u[0].anchor.id,resetBottomCursorTo:null}}var oo=1e6;function so(e,t){let n=e-t.addedTop+t.droppedTop;return n<0?0:n}var co=500,lo=[100,250],uo=Symbol(`page-fetch-failed`),fo=10,po=2*co,mo=4e3;async function ho(e,t,n){let r=await de(t,n),i=he(r);if(i!=null)throw new Se(i);return g(e)?we(e,r):r}function go(e,t={}){let n=e?a(e):null,r=n?p(n):null,{outlineTurns:i,outlinePositions:o,openIntent:s,protectedUuids:c,growthNonce:l=0,live:u=!1}=t,d=(0,I.useRef)(c);d.current=c;let[f,m]=(0,I.useState)({detail:null,firstItemIndex:oo}),h=f.detail,[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(0),[T,E]=(0,I.useState)(null),[D,k]=(0,I.useState)(null),A=(0,I.useRef)(0),j=(0,I.useCallback)(e=>{let t={rev:++A.current,...e};return k(t),t},[]),[M,ee]=(0,I.useState)(0),[N,te]=(0,I.useState)(null),P=(0,I.useRef)(null),F=(0,I.useRef)(null),[ne,re]=(0,I.useState)(!1),ie=(0,I.useRef)(!1);ie.current=ne;let ae=(0,I.useRef)(!1),oe=(0,I.useRef)(!1),se=(0,I.useRef)(0),[ce,ue]=(0,I.useState)(!1),de=(0,I.useCallback)(()=>{se.current+=1,se.current===1&&ue(!0)},[]),pe=(0,I.useCallback)(()=>{se.current=Math.max(0,se.current-1),se.current===0&&ue(!1)},[]),he=(0,I.useRef)(null),_e=(0,I.useRef)(()=>Promise.resolve()),ve=(0,I.useRef)(`none`),ye=(0,I.useRef)(!1),be=(0,I.useRef)({found:!1,direction:`none`,exhausted:!0,failed:!1,terminalOpRev:0}),xe=(0,I.useRef)(null),Ce=(0,I.useRef)(n),we=(0,I.useRef)(!1),Te=(0,I.useRef)(!1),Ee=(0,I.useRef)(!1),De=(0,I.useRef)(null),Oe=(0,I.useRef)(i);Oe.current=i;let je=(0,I.useRef)(o);je.current=o;let Me=(0,I.useCallback)(e=>{m(t=>{let n=typeof e==`function`?e(t.detail):e;return De.current=n,{detail:n,firstItemIndex:t.firstItemIndex}})},[]),Pe=(0,I.useCallback)(e=>{m(()=>(De.current=e,{detail:e,firstItemIndex:oo})),P.current=e.page.next_after,F.current=e.page.prev_before??null,re(e.page.has_prev??!1),j({op:`reset`,addedTop:0,addedBottom:0,droppedTop:0,droppedBottom:0})},[j]),Fe=(0,I.useCallback)(()=>{r&&(b(null),S(null),v(!0),w(e=>e+1))},[r]);(0,I.useEffect)(()=>{if(xe.current=r,Ce.current=n,!r){Me(null),te(null),v(!1),b(null),S(null),P.current=null,F.current=null,re(!1),E(null);return}v(!0),b(null),S(null),Me(null),P.current=null,F.current=null,re(!1),E(null);let e=new AbortController,t=s?.kind;return ho(n,ke(n,`detail`,t==null?{limit:co}:{tail:1,limit:co}),e.signal).then(n=>{e.signal.aborted||xe.current!==r||(Pe(n),te(r),v(!1),t===`tail`?E(n.page.has_prev?`bottom`:`top`):t??E(null))}).catch(t=>{if(!(fe(t)||e.signal.aborted||xe.current!==r)){if(t instanceof ge&&t.status===404){b(`Conversation not found.`),v(!1);return}if(t instanceof Se){S(le(t.reason)),b(null),v(!1);return}b(t instanceof Ae?`Conversation indexing is still finishing.`:`Couldn't load the conversation.`),v(!1)}}),()=>e.abort()},[r,s?.kind,s&&`uuid`in s?s.uuid:null,C,Me,Pe]);let Ie=(0,I.useCallback)(async()=>{let e=P.current,t=xe.current,n=Ce.current;if(e==null||t==null||n==null||ae.current)return null;ae.current=!0,de();try{let r;try{r=await ho(n,ke(n,`detail`,{limit:co,after:e}))}catch(e){return e instanceof Se&&xe.current===t&&(S(le(e.reason)),b(null)),uo}return xe.current===t?(Me(e=>e?{...e,items:[...e.items,...r.items],page:{...e.page,next_after:r.page.next_after,has_more:r.page.has_more},subagent_meta:r.subagent_meta??e.subagent_meta,session_index:r.session_index??e.session_index}:r),P.current=r.page.next_after,j({op:`append`,addedTop:0,addedBottom:r.items.length,droppedTop:0,droppedBottom:0})):null}finally{ae.current=!1,pe()}},[Me,j]),Re=(0,I.useCallback)(async()=>{let e=await Ie();return e===uo?null:e},[Ie]),ze=(0,I.useCallback)(async()=>{let e=F.current,t=xe.current,n=Ce.current;if(e==null||t==null||n==null||oe.current)return null;oe.current=!0,de();try{let r;try{r=await ho(n,ke(n,`detail`,{limit:co,before:e}))}catch(e){return e instanceof Se&&xe.current===t&&(S(le(e.reason)),b(null)),uo}if(xe.current!==t)return null;let i=new Set((De.current?.items??[]).map(e=>e.anchor.uuid)),a=r.items.filter(e=>!i.has(e.anchor.uuid));return m(e=>{let t=e.detail,n=t?{...t,items:[...a,...t.items],page:{...t.page,prev_before:r.page.prev_before??null,has_prev:r.page.has_prev??!1},subagent_meta:r.subagent_meta??t.subagent_meta,session_index:r.session_index??t.session_index}:r;return De.current=n,{detail:n,firstItemIndex:so(e.firstItemIndex,{addedTop:a.length,droppedTop:0})}}),F.current=r.page.prev_before??null,re(r.page.has_prev??!1),j({op:`prepend`,addedTop:a.length,addedBottom:0,droppedTop:0,droppedBottom:0})}finally{oe.current=!1,pe()}},[Me,j]),Be=(0,I.useCallback)(async()=>{let e=await ze(),t=e===uo?null:e;return t&&t.addedTop>0?t:null},[ze]),Ve=(0,I.useCallback)(async e=>{let t=xe.current;if(t==null)return{found:!1,direction:`none`,exhausted:!1,failed:!1,terminalOpRev:A.current};let n=he.current;if(n)return await n,be.current;let r=()=>{};he.current=new Promise(e=>{r=e});try{await He(e,t)}finally{he.current=null,r()}let i=ve.current;return be.current={found:De.current?.items.some(t=>t.member_uuids.includes(e))??!1,direction:i,exhausted:i===`backward`?F.current==null:i===`forward`?P.current==null:!0,failed:ye.current,terminalOpRev:A.current},be.current},[]),He=(0,I.useCallback)((e,t)=>_e.current(e,t),[]);_e.current=(0,I.useCallback)(async(e,t)=>{ve.current=`none`,ye.current=!1;let n=()=>{let t=De.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};if(n())return;let r=e=>{m(t=>{let n=t.detail;if(!n)return t;let r=ao({items:n.items,op:e,capBlocks:mo,capItems:po,protectedUuids:d.current??new Set,fetchInFlight:!1});if(r.keep===n.items)return t;if(r.droppedBottom>0){P.current=r.resetBottomCursorTo;let e={...n,items:r.keep,page:{...n.page,next_after:r.resetBottomCursorTo,has_more:!0}};return De.current=e,{detail:e,firstItemIndex:t.firstItemIndex}}F.current=r.resetTopCursorTo,queueMicrotask(()=>re(!0));let i={...n,items:r.keep,page:{...n.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return De.current=i,{detail:i,firstItemIndex:so(t.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}})},i=()=>new Promise(e=>{setTimeout(e,0)}),a=async e=>{for(let n=0;;n++){let r=await e();if(r!==uo)return r;if(n===lo.length)return ye.current=!0,null;if(await new Promise(e=>{setTimeout(e,lo[n])}),xe.current!==t)return null}},o=Oe.current??[],s=je.current,c=s!=null&&s.has(e);if(o.length===0&&!c){ve.current=`forward`;let e=t;for(;;){if(n())return;let t=await a(Ie);if(ye.current)return;if(t&&P.current!=null){if(r(`append`),await i(),xe.current!==e)return;continue}if(P.current==null||xe.current!==e)return;for(;ae.current&&xe.current===e;)await i();if(xe.current!==e)return}}let l=c?null:Le(o),u=e=>c?s.get(e):Ne(l,e),f=u(e);if(f===void 0)return;let p=De.current?.items??[],h=e=>{for(let t of e.member_uuids){let e=u(t);if(e!==void 0)return e}},g,_;for(let e of p){let t=h(e);t!==void 0&&((g===void 0||t<g)&&(g=t),(_===void 0||t>_)&&(_=t))}let v=g!==void 0&&f<g;if(ve.current=v?`backward`:`forward`,v)for(;;){if(n())return;let e=await a(ze);if(ye.current)return;if(e&&F.current!=null){if(r(`prepend`),await i(),xe.current!==t)return;continue}if(F.current==null||xe.current!==t)return;for(;oe.current&&xe.current===t;)await i();if(xe.current!==t)return}else for(;;){if(n())return;let e=await a(Ie);if(ye.current)return;if(e&&P.current!=null){if(r(`append`),await i(),xe.current!==t)return;continue}if(P.current==null||xe.current!==t)return;for(;ae.current&&xe.current===t;)await i();if(xe.current!==t)return}},[Ie,ze]);let Ue=(0,I.useCallback)(async()=>{let e=xe.current,t=Ce.current;if(e==null||t==null)return!1;let n;try{n=await ho(t,ke(t,`detail`,{tail:1,limit:co}))}catch(t){return t instanceof Se&&xe.current===e&&(S(le(t.reason)),b(null)),!1}return xe.current===e?(Pe(n),!0):!1},[Pe]),We=h!=null&&N===r,Ge=We?h:null,Ke=r!=null&&!We&&y==null&&x==null?!0:_,qe=Ge?.page?.next_after!=null;we.current=qe;let Je=Ge?.page?.prev_before??null,Ye=(0,I.useCallback)(async()=>{if(Te.current){Ee.current=!0;return}let e=xe.current,t=Ce.current;if(!(!e||!t||we.current||ae.current)){Te.current=!0;try{for(let n=0;n<50;n++){let n=De.current?.items??[];if(!n.length)break;let r=Math.max(0,n.length-fo),i=r>0?g(t)?n[r-1].anchor.uuid:n[r-1].anchor.id:null,a;try{a=await ho(t,ke(t,`detail`,{limit:co,after:i??void 0}))}catch(t){t instanceof Se&&xe.current===e&&(S(le(t.reason)),b(null));break}if(xe.current!==e)return;let o=a.items,s,c=0,l=!1;if(o.length===0)s=n;else{l=!0;let e=new Map(o.map(e=>[e.anchor.id,e])),t=new Set(n.map(e=>e.anchor.id)),i=n.slice(0,r),a=n.slice(r);s=[...i];for(let t of a){let n=e.get(t.anchor.id);n!==void 0&&s.push(n)}for(let e of o)t.has(e.anchor.id)||(s.push(e),c+=1)}if(Me(e=>e&&{...e,items:s,cost_usd:a.cost_usd,models:a.models,title:a.title??e.title,git_branch:a.git_branch,project_label:a.project_label,last_anchor:a.last_anchor??e.last_anchor,last_activity_utc:a.last_activity_utc??e.last_activity_utc,subagent_meta:a.subagent_meta??e.subagent_meta,session_index:a.session_index??e.session_index,provider_meta:a.provider_meta??e.provider_meta,page:e.page}),l&&ee(e=>e+1),l&&j({op:`append`,addedTop:0,addedBottom:c,droppedTop:0,droppedBottom:0}),c===0||a.page.next_after==null)break}}finally{Te.current=!1,Ee.current&&(Ee.current=!1,Ye())}}},[Me,j]);return(0,I.useEffect)(()=>{u||De.current&&!we.current&&Ye()},[me(O()),u]),(0,I.useEffect)(()=>{l!==0&&De.current&&!we.current&&Ye()},[l]),(0,I.useEffect)(()=>{let e=D;if(!e||e.trim||e.op!==`append`&&e.op!==`prepend`)return;let t=ae.current||oe.current||Te.current,n=De.current?.items;if(!n)return;let r=ao({items:n,op:e.op,capBlocks:mo,capItems:po,protectedUuids:d.current??new Set,fetchInFlight:t});if(r.keep!==n){if(r.droppedBottom>0)P.current=r.resetBottomCursorTo,Me(e=>e&&{...e,items:r.keep,page:{...e.page,next_after:r.resetBottomCursorTo,has_more:!0}});else if(r.droppedTop>0)F.current=r.resetTopCursorTo,re(!0),m(e=>{let t=e.detail;if(!t)return e;let n={...t,items:r.keep,page:{...t.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return De.current=n,{detail:n,firstItemIndex:so(e.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}});else return;j({op:`append`,addedTop:0,addedBottom:0,droppedTop:r.droppedTop,droppedBottom:r.droppedBottom,trim:!0})}},[D?.rev]),{detail:Ge,loading:Ke,error:y,degraded:x,retry:Fe,hasMore:qe,hasPrev:ne,prevBefore:Je,openScrollIntent:T,lastOp:D,loadMore:Re,loadPrev:Be,loadToTarget:Ve,jumpToLatest:Ue,fetching:ce,tailRevision:M,virtualFirstItemIndex:f.firstItemIndex}}function _o(){let[e,t]=(0,I.useState)(`full`),n=(0,I.useRef)(null),r=(0,I.useCallback)(e=>{let n=e.getBoundingClientRect().width;t(n>0&&n<720?`compact`:`full`)},[]),i=(0,I.useCallback)(e=>{if(n.current?.disconnect(),n.current=null,e&&(r(e),typeof ResizeObserver<`u`)){let t=new ResizeObserver(()=>r(e));t.observe(e),n.current=t}},[r]);return(0,I.useEffect)(()=>()=>{n.current?.disconnect()},[]),{density:e,readerRef:i}}function vo(e){let t=[],n=[],r=()=>{n.length>=2?t.push({kind:`tool_result_run`,items:n}):n.length===1&&t.push({kind:`item`,item:n[0]}),n=[]};for(let i of e){if(i.kind===`item`&&i.item.kind===`tool_result`){n.push(i.item);continue}r(),t.push(i)}return r(),t}function yo(e,t){let n=new Map,r=new Map;for(let t of e){let e=t.subagent_key;if(e!=null){let r=n.get(e);r?r.push(t):n.set(e,[t])}else for(let e of t.member_uuids)r.set(e,t)}let i=new Map;for(let e of n.keys()){let a=t?.[e];if(a&&a.parent_subagent_key!==void 0){let t=a.parent_subagent_key??null,o=a.spawn_uuid??null;t!=null&&n.has(t)?i.set(e,{where:`subagent`,parentKey:t,anchorUuid:o}):t==null&&o!=null&&r.has(o)?i.set(e,{where:`main`,anchorUuid:o}):i.set(e,{where:`top`});continue}let o=n.get(e),s=o.find(e=>e.kind!==`meta`)??o[0],c=s.parent_uuid==null?void 0:r.get(s.parent_uuid);i.set(e,c?{where:`main`,anchorUuid:c.anchor.uuid}:{where:`top`})}let a=new Map,o=new Map;for(let[e,t]of i)if(t.where===`subagent`){let n=o.get(t.parentKey);n?n.push(e):o.set(t.parentKey,[e])}let s=(e,t,r)=>{let c=a.get(e);if(c)return c;let l=i.get(e),u={kind:`subagent`,subagentKey:e,items:n.get(e),nested:l.where!==`top`,depth:t,spawnAnchorUuid:l.where===`top`?null:l.anchorUuid??null,children:[]};return a.set(e,u),r.add(e),u.children=(o.get(e)??[]).filter(e=>!r.has(e)).map(e=>s(e,t+1,r)),r.delete(e),u},c=new Map;for(let[e,t]of i)if(t.where===`main`){let n=c.get(t.anchorUuid);n?n.push(e):c.set(t.anchorUuid,[e])}let l=[],u=new Set,d=e=>{if(!u.has(e)){u.add(e);for(let t of o.get(e)??[])d(t)}},f=e=>{l.push(s(e,0,new Set)),d(e)};for(let t of e)if(t.subagent_key==null){l.push({kind:`item`,item:t});for(let e of c.get(t.anchor.uuid)??[])u.has(e)||f(e)}else{let e=t.subagent_key;if(u.has(e))continue;i.get(e).where===`top`&&f(e)}for(let e of n.keys())u.has(e)||f(e);return vo(l)}function bo(e,t){for(let n of e)n.kind===`subagent`&&(t(n),n.children.length&&bo(n.children,t))}function xo(e){let t=[];return bo(e,e=>t.push(e)),t}var So=RegExp(`^\\s*(?:<(${[`command-name`,`command-message`,`command-args`,`local-command-caveat`,`local-command-stdout`,`local-command-stderr`].join(`|`)})>(?:(?!</\\1>)[\\s\\S])*</\\1>\\s*)+$`);function Co(e){return e?So.test(e):!1}var wo=200;function To(e){return e!=null&&`semantics`in e&&e.semantics===`occurrence`}var Eo=class extends Error{notice;constructor(e){let t=le(e);super(t.message),this.name=`ConversationFindDegraded`,this.notice=t}};function Do(e,t,n={}){let r=a(e),i=p(r),{regex:o=!1,case:s=!1,tailRevision:c=0}=n,l=t.trim(),u=Qe(l,wo,``),d=Qe(c,wo,0),f=JSON.stringify([i,u,o,s]),[m,h]=(0,I.useState)(null),[_,v]=(0,I.useState)(0),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useCallback)(e=>g(r)?Pe(e):e,[i]),j=(0,I.useCallback)(e=>{if(h(e),To(e)){v(0);let t=e.page.occurrences[0]??null;return O.current=t?.occurrence_id??null,t}let t=O.current,n=t?Math.max(0,e.anchors.findIndex(e=>e.uuid===t)):0;v(n);let r=e.anchors[n]??null;return O.current=r?.uuid??null,r},[]),M=(0,I.useCallback)(async({cursor:e,direction:t,around:n,signal:i}={})=>{let a=await de(ke(r,`find`,{q:u,regex:o||void 0,case:s||void 0,...g(r)&&r.source===`codex`?{limit:100,cursor:e,direction:t&&(e||t===`previous`)?t:void 0,around:n}:{}}),i),c=he(a);if(c!=null)throw new Eo(c);return A(a)},[i,u,o,s,A]);(0,I.useEffect)(()=>(l||(T.current?.abort(),E.current?.abort(),h(null),v(0),O.current=null,k.current=null,S(null),w(null),b(!1)),()=>{T.current?.abort(),E.current?.abort()}),[l]),(0,I.useEffect)(()=>{if(!u){b(!1);return}let e=new AbortController;return T.current?.abort(),E.current?.abort(),T.current=e,D.current=null,b(!0),M({around:To(m)&&k.current===f?O.current??void 0:void 0,signal:e.signal}).then(t=>{e.signal.aborted||(j(t),k.current=f,w(null),S(null),b(!1))}).catch(t=>{if(!(fe(t)||e.signal.aborted||T.current!==e)){if(t instanceof Eo){h(null),v(0),O.current=null,k.current=null,w(t.notice),S(null),b(!1);return}h(null),O.current=null,k.current=null,w(null),S(t instanceof ge&&t.status===400?`invalid regex`:`find failed`),b(!1)}}),()=>e.abort()},[i,u,o,s,d,f,M,j]);let ee=(0,I.useCallback)(e=>{if(!m||e===0)return null;if(!To(m)){if(m.anchors.length===0)return null;let t=((_+e)%m.anchors.length+m.anchors.length)%m.anchors.length;v(t);let n=m.anchors[t];return O.current=n.uuid,n}if(m.status!==`ready`||m.page.occurrences.length===0)return null;let t=_+(e>0?1:-1);if(t>=0&&t<m.page.occurrences.length){v(t);let e=m.page.occurrences[t];return O.current=e.occurrence_id,e}if(D.current)return D.current;let n=new AbortController;E.current=n;let r=e>0,i=r?m.page.next_cursor:m.page.previous_cursor,a=r?`next`:`previous`,o=(async()=>{try{let e;try{if(e=await M({cursor:i??void 0,direction:a,signal:n.signal}),n.signal.aborted)return null}catch(t){if(n.signal.aborted)return null;if(!(t instanceof ge)||t.status!==409)throw t;if(e=await M({around:O.current??void 0,signal:n.signal}),n.signal.aborted)return null;if(To(e)&&!e.selection_stale){let t=e.page.occurrences.findIndex(e=>e.occurrence_id===O.current),i=t+(r?1:-1);if(t>=0&&i>=0&&i<e.page.occurrences.length){h(e),v(i);let t=e.page.occurrences[i];return O.current=t.occurrence_id,w(null),S(null),t}let o=r?e.page.next_cursor:e.page.previous_cursor;if(t>=0&&o&&(e=await M({cursor:o,direction:a,signal:n.signal}),n.signal.aborted))return null}}if(!To(e))return w(null),j(e);h(e);let t=r?0:Math.max(0,e.page.occurrences.length-1);v(t);let o=e.page.occurrences[t]??null;return O.current=o?.occurrence_id??null,w(null),S(null),o}catch(e){return fe(e)||n.signal.aborted||E.current!==n||(e instanceof Eo?(w(e.notice),S(null)):(w(null),S(`find failed`))),null}finally{E.current===n&&(E.current=null,D.current=null)}})();return D.current=o,o},[m,_,M,j]),N=To(m),te=N||!m?[]:m.anchors,P=N?m.page.occurrences:[],F=(N?P:te)[_]??null,ne=N?m.page.start_index+(F?_:0):F?_:0,re=N?m.total??0:m?.total??0,ie=l!==``&&(l!==u||y);return{anchors:te,occurrences:P,selected:F,selectedIndex:ne,total:re,truncated:!N&&m?m.anchors_truncated:!1,semantics:N?`occurrence`:`section`,status:N?m.status:`ready`,selectionStale:N?m.selection_stale:!1,mode:m?.mode??null,loading:ie,error:x,degraded:C,step:ee}}var Oo=`cctally.conv.find.regex`,ko=`cctally.conv.find.case`;function Ao(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function jo(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function Mo(){return Ao(Oo)}function No(e){jo(Oo,e)}function Po(){return Ao(ko)}function Fo(e){jo(ko,e)}function Io({sessionId:e,onClose:t,onTermsChange:n,onExactFindChange:r,stepRef:i,tailRevision:o=0}){let s=typeof e!=`string`,c=a(e),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(Mo),[m,h]=(0,I.useState)(Po),{selected:g,occurrences:_,selectedIndex:v,total:y,truncated:b,semantics:S,status:C,selectionStale:w,mode:T,loading:E,error:D,degraded:O,step:k}=Do(c,u,{regex:f,case:m,tailRevision:o}),A=(0,I.useRef)(null),j=(0,I.useRef)(null);(0,I.useEffect)(()=>{A.current?.focus()},[]);let M=Qe(u.trim(),200,``);(0,I.useEffect)(()=>{n(S===`occurrence`?``:M,m,f)},[M,f,m,S,n]),(0,I.useEffect)(()=>{if(r)return r(S===`occurrence`?{occurrences:_,selectedOccurrenceId:g&&`occurrence_id`in g?g.occurrence_id:null}:null),()=>r(null)},[S,_,g,r]);let ee=e=>{if(!e)return;let t=`occurrence_id`in e?e:null;l({type:`OPEN_CONVERSATION`,conversationRef:c,jump:x(c,e.uuid,s,{expandDetails:t?t.disclosure.length>0:e.match_kinds.length>0,findOccurrence:t})})},N=e=>{let t=k(e);t instanceof Promise?t.then(ee):ee(t)},te=(0,I.useRef)(null);(0,I.useEffect)(()=>{S!==`occurrence`||!g||!(`occurrence_id`in g)||te.current!==g.occurrence_id&&(te.current=g.occurrence_id,ee(g))},[S,g,c.key]),i&&(i.current=N),(0,I.useEffect)(()=>()=>{i&&(i.current=null)},[i]);let P=()=>{l({type:`CLOSE_CONV_FIND`}),t()},F=()=>p(e=>{let t=!e;return No(t),t}),ne=()=>h(e=>{let t=!e;return Fo(t),t}),re=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),N(e.shiftKey?-1:1))},ie=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),P();return}if(e.key!==`Tab`)return;let t=j.current;if(!t)return;let n=Array.from(t.querySelectorAll(`input, button`)).filter(e=>!e.disabled);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())},ae=g!=null,oe=g,se=C===`indexing`?`indexing exact matches`:S===`occurrence`?`${ae?v+1:0} / ${y} matches`:`${ae?v+1:0} / ${y} containing sections`,ce=[f&&`regex`,m&&`case`].filter(Boolean).join(` · `);return(0,L.jsxs)(`div`,{className:`conv-findbar`,role:`search`,"aria-label":`Find within this conversation`,ref:j,onKeyDown:ie,children:[(0,L.jsx)(`input`,{ref:A,className:`conv-findbar-input`,type:`text`,"aria-label":`Find in conversation`,placeholder:`Find…`,value:u,onChange:e=>d(e.target.value),onKeyDown:re}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":f,"aria-label":`Regular expression`,title:`Regular expression (.*)`,onClick:F,children:`.*`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":m,"aria-label":`Case-sensitive`,title:`Case-sensitive (Aa)`,onClick:ne,children:`Aa`}),ce&&(0,L.jsx)(`span`,{className:`conv-findbar-mode`,"aria-label":`search mode: ${ce}`,children:ce}),(0,L.jsxs)(`span`,{className:`conv-findbar-count`,"aria-live":`polite`,children:[se,b&&(0,L.jsx)(`span`,{className:`conv-findbar-note`,children:` · first 500`}),w&&(0,L.jsx)(`span`,{className:`conv-findbar-note`,children:` · previous match changed`})]}),oe&&oe.match_kinds.length>0&&(0,L.jsx)(`span`,{className:`conv-findbar-kind`,children:oe.match_kinds.join(` `)}),T===`like`&&!D&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,children:`basic search`}),O&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:O.message}),D&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:D}),E&&(0,L.jsx)(`span`,{className:`conv-findbar-spin`,"aria-hidden":`true`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,disabled:!ae,onClick:()=>N(-1),children:`‹`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Next match`,title:`Next match (Enter)`,disabled:!ae,onClick:()=>N(1),children:`›`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-close`,"aria-label":`Close find`,title:`Close (Esc)`,onClick:P,children:`✕`})]})}function Lo(){let[e,t]=(0,I.useState)(!1),n=(0,I.useRef)(null),r=(0,I.useRef)(!0);return(0,I.useEffect)(()=>()=>{r.current=!1,n.current!=null&&window.clearTimeout(n.current)},[]),{copied:e,copy:(0,I.useCallback)(e=>{let i=()=>{r.current&&(t(!0),n.current!=null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t(!1),n.current=null},1100))};if(navigator.clipboard?.writeText){navigator.clipboard.writeText(e).then(i).catch(()=>{});return}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),i()}catch{}},[])}}function Ro(e,t,n){if(n<=0)return null;switch(e){case`ArrowDown`:return(t+1)%n;case`ArrowUp`:return(t-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return null}}function zo(e,t,n){let r=(0,I.useRef)(n);r.current=n,(0,I.useEffect)(()=>{if(!t||typeof document>`u`)return;let n=t=>{let n=e.current;n&&!n.contains(t.target)&&r.current()};return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[t,e])}var Bo=`A-Za-z0-9_.-`,Vo=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Ho(e,t){if(t.tokens.length){let n=t.tokens.map(e=>e.bounded?`(?<![${Bo}])${Vo(e.text)}(?![${Bo}])`:Vo(e.text)).join(`|`),r=new Map(t.tokens.map(e=>[e.text,e.replacement]));e=e.replace(new RegExp(n,`g`),e=>r.get(e)??`(unknown)`)}for(let n of t.patterns){let t=new RegExp(n.source,n.ignoreCase?`gi`:`g`);e=e.replace(t,(e,t)=>`${n.keepGroup1&&typeof t==`string`?t:``}[REDACTED:${n.name}]`)}return e}var Uo=class extends Error{status;undecodableCwdRows;ambiguousCwdRows;constructor(e,t,n){super(`anon request failed: ${e}`),this.name=`AnonRequestError`,this.status=e,this.undecodableCwdRows=t,this.ambiguousCwdRows=n}};function Wo(e){return e.ambiguousCwdRows===null?`Anonymized copy is unavailable: ${e.undecodableCwdRows??0} Codex project path(s) could not be read. Run cctally cache-sync --source codex --rebuild.`:`Anonymized copy is unavailable: ${e.ambiguousCwdRows} Codex project path(s) cannot be safely attributed to this account. Use a raw export or omit the account scope.`}async function Go(e){let t=null,n=null;if(e.status===409&&typeof e.json==`function`)try{let r=await e.json();typeof r?.undecodable_cwd_rows==`number`&&(t=r.undecodable_cwd_rows),r?.reason===`ambiguous_account_provenance`&&typeof r.ambiguous_cwd_rows==`number`&&(n=r.ambiguous_cwd_rows)}catch{}return new Uo(e.status,t,n)}function Ko(e){let t=e;if(!t||!Array.isArray(t.tokens)||!Array.isArray(t.patterns))throw Error(`malformed anon-map`);return t}var qo=new Map;function Jo(e){let t=a(e),n=p(t),r=qo.get(n);if(!r){r=fetch(ke(t,`anon-map`)).then(async e=>{if(!e.ok)throw await Go(e);return Ko(await e.json())});let e=()=>{qo.get(n)===r&&qo.delete(n)};r.then(e,e),qo.set(n,r)}return r}var Yo=[{scope:`all`,label:`Whole transcript`},{scope:`prompts`,label:`Prompts only`},{scope:`chat`,label:`Chat only`},{scope:`recipe`,label:`Replay recipe`}];function Xo(e,t){return(e??``).normalize(`NFKD`).replace(/[^\x20-\x7E]/g,``).replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||t.slice(0,12)}function Zo(e,t,n){return ke(a(e),`export`,{scope:t,anonymize:n||void 0})}async function Qo(e,t,n){let r=await fetch(Zo(e,t,n));if(!r.ok)throw await Go(r);return r.text()}function $o(e,t,n,r){let i=Xo(e,t);return r?`${i}-${n}-anon.md`:`${i}-${n}.md`}function es(e,t){let n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.style.display=`none`,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),0)}function ts({conversationRef:e,sessionId:t,title:n,anonMode:r=!1}){let i=a(e??t),o=i.key,s=p(i),u=i.source===`codex`?Yo.slice(0,1):Yo,[d,f]=(0,I.useState)(!1),[h,g]=(0,I.useState)(null),_=(0,I.useRef)(null),v=(0,I.useRef)(null),y=(0,I.useRef)(null);zo(y,d,(0,I.useCallback)(()=>f(!1),[]));let b=u.length*2,x=(0,I.useRef)([]),[S,C]=(0,I.useState)(0),w=(0,I.useRef)(0),T=(0,I.useCallback)(e=>{w.current=e,C(e)},[]),E=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{E.current=!1},[]);let{copy:D}=Lo(),O=(0,I.useSyncExternalStore)(c,()=>m()),k=r?O:null,A=(0,I.useCallback)((e,t)=>{if(r){if(t===null){l({type:`SET_CONV_ANON_REFUSAL`,conversationRef:e,refused:!1});return}t instanceof Uo&&t.status===409&&l({type:`SET_CONV_ANON_REFUSAL`,conversationRef:e,refused:!0,message:Wo(t)})}},[r]);(0,I.useEffect)(()=>{f(!1)},[s]);let j=(0,I.useCallback)(()=>{f(!1);let e=v.current;e instanceof HTMLElement&&e.focus()},[]),M=(0,I.useCallback)(e=>{v.current=document.activeElement,T(e),f(!0)},[T]),ee=(0,I.useCallback)(()=>{d?f(!1):M(0)},[d,M]);(0,I.useEffect)(()=>{d&&x.current[w.current]?.focus()},[d]);let N=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),j();return}let t=Ro(e.key,w.current,b);t!==null&&(e.preventDefault(),T(t),x.current[t]?.focus())},[j,b,T]),te=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),M(0)):e.key===`ArrowUp`&&(e.preventDefault(),M(b-1))},[M,b]),P=(0,I.useCallback)(async e=>{let t=`${e}:copy`,n=i;g(t);try{let t=await Qo(n,e,r);A(n,null),D(t)}catch(e){A(n,e)}finally{E.current&&g(e=>e===t?null:e)}},[s,D,r,A]),F=(0,I.useCallback)(async e=>{let t=`${e}:download`,a=i;g(t);try{let t=await Qo(a,e,r);A(a,null),es($o(n,o,e,r),t)}catch(e){A(a,e)}finally{E.current&&g(e=>e===t?null:e)}},[s,n,r,A]);return(0,L.jsxs)(`div`,{ref:y,className:`conv-export`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||f(!1)},children:[(0,L.jsx)(`button`,{ref:_,type:`button`,className:`conv-export-toggle`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":`Export transcript`,onClick:ee,onKeyDown:te,children:`Export ▾`}),d&&(0,L.jsxs)(`div`,{className:`conv-export-menu`,role:`menu`,"aria-label":`Export transcript`,tabIndex:-1,onKeyDown:N,children:[r&&(0,L.jsx)(`div`,{className:`conv-export-anon-note${k?` conv-export-anon-unavailable`:``}`,role:`none`,"data-anon-unavailable":k?`1`:void 0,children:k??`Anonymized — project paths, home, username & known secrets redacted`}),u.map(({scope:e,label:t},n)=>{let r=n*2,i=r+1;return(0,L.jsxs)(`div`,{className:`conv-export-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-export-row-label`,children:t}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:r===S?0:-1,ref:e=>{x.current[r]=e},className:`conv-export-action`,"aria-label":`${t} — Copy`,disabled:h===`${e}:copy`,onClick:()=>void P(e),children:h===`${e}:copy`?`…`:`Copy`}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:i===S?0:-1,ref:e=>{x.current[i]=e},className:`conv-export-action`,"aria-label":`${t} — Download`,disabled:h===`${e}:download`,onClick:()=>void F(e),children:h===`${e}:download`?`…`:`Download`})]},e)})]})]})}function ns(e,t){if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?rs(r):n.slice(0,8)}return``}function rs(e){return e.label.trim()||e.key.slice(0,8)}function is({focusMode:e,subagents:t,onSelect:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null);zo(c,r,(0,I.useCallback)(()=>{i(!1),o(!1)},[]));let l=t.length>0,u=2+ +!!l,d=(0,I.useRef)([]),f=(0,I.useRef)([]),[p,m]=(0,I.useState)(0),h=(0,I.useRef)(0),g=(0,I.useCallback)(e=>{h.current=e,m(e)},[]),[_,v]=(0,I.useState)(0),y=(0,I.useRef)(0),b=(0,I.useCallback)(e=>{y.current=e,v(e)},[]),[x,S]=(0,I.useState)(!1),C=(0,I.useRef)(!1),w=(0,I.useCallback)(e=>{C.current=e,S(e)},[]),T=(0,I.useCallback)(()=>{i(!1),o(!1),w(!1);let e=s.current;e instanceof HTMLElement&&e.focus()},[w]),E=(0,I.useCallback)(e=>{s.current=document.activeElement,g(e),w(!1),o(!1),i(!0)},[g,w]),D=(0,I.useCallback)(()=>{r?(i(!1),o(!1),w(!1)):E(0)},[r,E,w]),O=(0,I.useCallback)(()=>{b(0),w(!0),o(!0)},[b,w]),k=(0,I.useCallback)(()=>{o(!1),w(!1),d.current[2]?.focus()},[w]),A=(0,I.useCallback)(e=>{n(e),T()},[n,T]);(0,I.useEffect)(()=>{r&&d.current[h.current]?.focus()},[r]),(0,I.useEffect)(()=>{a&&C.current&&f.current[y.current]?.focus()},[a]);let j=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),T();return}if(!C.current){if(e.key===`ArrowRight`&&l&&h.current===2){e.preventDefault(),O();return}let t=Ro(e.key,h.current,u);t!==null&&(e.preventDefault(),g(t),d.current[t]?.focus());return}if(e.key===`ArrowLeft`){e.preventDefault(),k();return}let n=Ro(e.key,y.current,t.length);n!==null&&(e.preventDefault(),b(n),f.current[n]?.focus())},[T,l,u,O,k,g,b,t.length]),M=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),E(0)):e.key===`ArrowUp`&&(e.preventDefault(),E(u-1))},[E,u]),ee=ns(e,t),N=ee!==``;return(0,L.jsxs)(`div`,{ref:c,className:`conv-focus-more`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(i(!1),o(!1))},children:[(0,L.jsx)(`button`,{type:`button`,className:[`conv-focus-more-toggle`,N?`conv-focus-more-toggle--on`:``].filter(Boolean).join(` `),"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`More focus filters`,onClick:D,onKeyDown:M,children:N?`${ee} ▾`:`More ▾`}),r&&(0,L.jsxs)(`div`,{className:`conv-focus-more-menu`,role:`menu`,"aria-label":`More focus filters`,tabIndex:-1,onKeyDown:j,children:[(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===0?0:-1,ref:e=>{d.current[0]=e},className:[`conv-focus-more-item`,e===`edits`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(`edits`),children:`Edits`}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===1?0:-1,ref:e=>{d.current[1]=e},className:[`conv-focus-more-item`,e===`bash`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(`bash`),children:`Bash`}),l&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===2?0:-1,ref:e=>{d.current[2]=e},className:`conv-focus-more-item conv-focus-more-sub`,"aria-haspopup":`menu`,"aria-expanded":a,onClick:()=>a?k():O(),children:[`Subagent `,a?`▾`:`▸`]}),a&&(0,L.jsx)(`div`,{className:`conv-focus-more-submenu`,role:`menu`,"aria-label":`Focus a subagent`,children:t.map((t,n)=>{let r=`subagent:${t.key}`;return(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:x&&_===n?0:-1,ref:e=>{f.current[n]=e},className:[`conv-focus-more-item`,e===r?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(r),children:rs(t)},t.key)})})]})]})]})}var as=[{mode:`all`,label:`All`},{mode:`chat`,label:`Chat`},{mode:`prompts`,label:`Prompts`},{mode:`errors`,label:`Errors`}],os=[{mode:`edits`,label:`Edits`},{mode:`bash`,label:`Bash`}];function ss(e,t){let n=as.find(t=>t.mode===e);if(n)return n.label;if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?rs(r):n.slice(0,8)}return`All`}function cs({focusMode:e,subagents:t,onSelect:n,errorCount:r=0}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(null);zo(s,i,(0,I.useCallback)(()=>a(!1),[]));let c=[...as.map(e=>e.mode===`errors`&&r>0?{...e,badge:r}:e),...os,...t.map(e=>({mode:`subagent:${e.key}`,label:rs(e)}))],l=c.length,u=(0,I.useRef)([]),[d,f]=(0,I.useState)(0),p=(0,I.useRef)(0),m=(0,I.useCallback)(e=>{p.current=e,f(e)},[]),h=(0,I.useCallback)(()=>{a(!1);let e=o.current;e instanceof HTMLElement&&e.focus()},[]),g=(0,I.useCallback)(e=>{o.current=document.activeElement,m(e),a(!0)},[m]),_=(0,I.useCallback)(()=>{if(i)a(!1);else{let t=c.findIndex(t=>t.mode===e);g(t>=0?t:0)}},[i,g,c,e]);(0,I.useEffect)(()=>{i&&u.current[p.current]?.focus()},[i]);let v=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),h();return}let t=Ro(e.key,p.current,l);t!==null&&(e.preventDefault(),m(t),u.current[t]?.focus())},[h,l,m]),y=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),g(0)):e.key===`ArrowUp`&&(e.preventDefault(),g(l-1))},[g,l]),b=(0,I.useCallback)(e=>{n(e),h()},[n,h]),x=ss(e,t);return(0,L.jsxs)(`div`,{ref:s,className:`conv-focus-compact`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)},children:[(0,L.jsxs)(`button`,{type:`button`,className:`conv-focus-compact-toggle`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-label":`Focus: ${x}`,onClick:_,onKeyDown:y,children:[`Focus: `,x,` ▾`]}),i&&(0,L.jsx)(`div`,{className:`conv-focus-compact-menu`,role:`menu`,"aria-label":`Focus mode`,tabIndex:-1,onKeyDown:v,children:c.map((t,n)=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t.mode,tabIndex:n===d?0:-1,ref:e=>{u.current[n]=e},className:[`conv-focus-compact-item`,e===t.mode?`conv-focus-compact-item--on`:``].filter(Boolean).join(` `),onClick:()=>b(t.mode),children:[t.label,t.badge!=null&&(0,L.jsx)(`span`,{className:`conv-focus-compact-badge`,children:t.badge})]},t.mode))})]})}function ls({sessionId:e,exportTitle:t,anonMode:n,onToggleAnon:r,onCompare:i,onLatest:a,latestBusy:o=!1,onExpandAll:s,onCollapseAll:c,completionTotal:l=null,costCumulative:u=0,costTotal:d=0,costApprox:f=!1,onCompletionJump:m=null}){let[h,g]=(0,I.useState)(!1),v=(0,I.useRef)(null),y=(0,I.useRef)(null);zo(y,h,(0,I.useCallback)(()=>g(!1),[]));let b=[{key:`anon`,kind:`toggle`,label:`Anonymize`,pressed:n},{key:`compare`,kind:`action`,label:`⟷ Compare with…`,run:i},a?{key:`latest`,kind:`action`,label:`${o?`… `:``}Latest ↓`,run:a,busy:o}:null,{key:`expand`,kind:`action`,label:`⤢ Expand all`,run:s},{key:`collapse`,kind:`action`,label:`⤡ Collapse all`,run:c},m!=null&&l!=null?{key:`complete`,kind:`action`,label:`✓ Complete · ${l}`,run:m}:null].filter(Boolean),x=b.length,S=(0,I.useRef)([]),[C,w]=(0,I.useState)(0),T=(0,I.useRef)(0),E=(0,I.useCallback)(e=>{T.current=e,w(e)},[]),D=p(e),O=(0,I.useRef)(D);(0,I.useEffect)(()=>{O.current!==D&&(O.current=D,g(!1))},[D]);let k=(0,I.useCallback)(()=>{g(!1);let e=v.current;e instanceof HTMLElement&&e.focus()},[]),A=(0,I.useCallback)(e=>{v.current=document.activeElement,E(e),g(!0)},[E]),j=(0,I.useCallback)(()=>{h?g(!1):A(0)},[h,A]);(0,I.useEffect)(()=>{h&&S.current[T.current]?.focus()},[h]);let M=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),k();return}let t=Ro(e.key,T.current,x);t!==null&&(e.preventDefault(),E(t),S.current[t]?.focus())},[k,x,E]),ee=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),A(0)):e.key===`ArrowUp`&&(e.preventDefault(),A(x-1))},[A,x]),N=(0,I.useCallback)(e=>{e(),k()},[k]),te=d>0,P=l!=null&&m==null;return(0,L.jsxs)(`div`,{ref:y,className:`conv-overflow`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-overflow-toggle`,"aria-haspopup":`menu`,"aria-expanded":h,"aria-label":`More actions`,title:`More actions`,onClick:j,onKeyDown:ee,children:`⋯`}),h&&(0,L.jsxs)(`div`,{className:`conv-overflow-menu`,role:`menu`,"aria-label":`More actions`,tabIndex:-1,onKeyDown:M,children:[(P||te)&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary`,role:`none`,children:[P&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Completion`}),(0,L.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[`✓ `,l]})]}),te&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Cost`}),(0,L.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[f?`~`:``,_.usd2(u),` / `,_.usd2(d)]})]})]}),(0,L.jsx)(`div`,{className:`conv-overflow-export`,role:`none`,children:(0,L.jsx)(ts,{conversationRef:e,title:t,anonMode:n})}),b.map((e,t)=>(0,L.jsx)(`button`,{type:`button`,role:e.kind===`toggle`?`menuitemcheckbox`:`menuitem`,tabIndex:t===C?0:-1,ref:e=>{S.current[t]=e},className:e.kind===`toggle`?`conv-overflow-item conv-overflow-item--toggle`:`conv-overflow-item`,"aria-checked":e.kind===`toggle`?e.pressed:void 0,disabled:e.kind===`action`?e.busy:void 0,onClick:()=>e.kind===`toggle`?r():N(e.run),children:e.kind===`toggle`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`conv-overflow-item-label`,children:[`🎭 `,e.label]}),(0,L.jsx)(`span`,{className:`conv-overflow-item-state`,"aria-hidden":`true`,children:e.pressed?`On`:`Off`})]}):e.label},e.key))]})]})}var us=(0,I.createContext)(null),ds=(0,I.createContext)(null);function fs(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function ps(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ms=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hs=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gs={};function _s(e,t){return((t||gs).jsx?hs:ms).test(e)}var vs=/[ \t\n\f\r]/g;function ys(e){return typeof e==`object`?e.type===`text`?bs(e.value):!1:bs(e)}function bs(e){return e.replace(vs,``)===``}var xs=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};xs.prototype.normal={},xs.prototype.property={},xs.prototype.space=void 0;function Ss(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new xs(n,r,t)}function Cs(e){return e.toLowerCase()}var ws=class{constructor(e,t){this.attribute=t,this.property=e}};ws.prototype.attribute=``,ws.prototype.booleanish=!1,ws.prototype.boolean=!1,ws.prototype.commaOrSpaceSeparated=!1,ws.prototype.commaSeparated=!1,ws.prototype.defined=!1,ws.prototype.mustUseProperty=!1,ws.prototype.number=!1,ws.prototype.overloadedBoolean=!1,ws.prototype.property=``,ws.prototype.spaceSeparated=!1,ws.prototype.space=void 0;var Ts=n({boolean:()=>X,booleanish:()=>Ds,commaOrSpaceSeparated:()=>js,commaSeparated:()=>As,number:()=>Z,overloadedBoolean:()=>Os,spaceSeparated:()=>ks}),Es=0,X=Ms(),Ds=Ms(),Os=Ms(),Z=Ms(),ks=Ms(),As=Ms(),js=Ms();function Ms(){return 2**++Es}var Ns=Object.keys(Ts),Ps=class extends ws{constructor(e,t,n,r){let i=-1;if(super(e,t),Fs(this,`space`,r),typeof n==`number`)for(;++i<Ns.length;){let e=Ns[i];Fs(this,Ns[i],(n&Ts[e])===Ts[e])}}};Ps.prototype.defined=!0;function Fs(e,t,n){n&&(e[t]=n)}function Is(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ps(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Cs(r)]=r,n[Cs(a.attribute)]=r}return new xs(t,n,e.space)}var Ls=Is({properties:{ariaActiveDescendant:null,ariaAtomic:Ds,ariaAutoComplete:null,ariaBusy:Ds,ariaChecked:Ds,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:ks,ariaCurrent:null,ariaDescribedBy:ks,ariaDetails:null,ariaDisabled:Ds,ariaDropEffect:ks,ariaErrorMessage:null,ariaExpanded:Ds,ariaFlowTo:ks,ariaGrabbed:Ds,ariaHasPopup:null,ariaHidden:Ds,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ks,ariaLevel:Z,ariaLive:null,ariaModal:Ds,ariaMultiLine:Ds,ariaMultiSelectable:Ds,ariaOrientation:null,ariaOwns:ks,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:Ds,ariaReadOnly:Ds,ariaRelevant:null,ariaRequired:Ds,ariaRoleDescription:ks,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:Ds,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Rs(e,t){return t in e?e[t]:t}function zs(e,t){return Rs(e,t.toLowerCase())}var Bs=Is({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:As,acceptCharset:ks,accessKey:ks,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alpha:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:ks,autoFocus:X,autoPlay:X,blocking:ks,capture:null,charSet:null,checked:X,cite:null,className:ks,closedBy:null,colorSpace:null,cols:Z,colSpan:Z,command:null,commandFor:null,content:null,contentEditable:Ds,controls:X,controlsList:ks,coords:Z|As,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:Os,draggable:Ds,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:ks,height:Z,hidden:Os,high:Z,href:null,hrefLang:null,htmlFor:ks,httpEquiv:ks,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:ks,itemRef:ks,itemScope:X,itemType:ks,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:Z,pattern:null,ping:ks,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:ks,required:X,reversed:X,rows:Z,rowSpan:Z,sandbox:ks,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootCustomElementRegistry:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shadowRootSerializable:X,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:Ds,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:Ds,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ks,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:Ds,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:X,disablePictureInPicture:X,disableRemotePlayback:X,exportParts:As,part:ks,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:zs}),Vs=Is({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`,colorRendering:`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`,maskType:`mask-type`,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:js,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:ks,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,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:As,g2:As,glyphName:As,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:js,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,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:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ks,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:js,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:js,rev:js,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:js,requiredFeatures:js,requiredFonts:js,requiredFormats:js,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:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:js,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:js,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:js,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Rs}),Hs=Is({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Us=Is({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:zs}),Ws=Is({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Gs={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`},Ks=/[A-Z]/g,qs=/-[a-z]/g,Js=/^data[-\w.:]+$/i;function Ys(e,t){let n=Cs(t),r=t,i=ws;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Js.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(qs,Zs);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!qs.test(e)){let n=e.replace(Ks,Xs);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ps}return new i(r,t)}function Xs(e){return`-`+e.toLowerCase()}function Zs(e){return e.charAt(1).toUpperCase()}var Qs=Ss([Ls,Bs,Hs,Us,Ws],`html`),$s=Ss([Ls,Vs,Hs,Us,Ws],`svg`);function ec(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tc(e){return e.join(` `).trim()}var nc=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
1
+ import{Ft as e,It as t,Lt as n,P as r,Rt as i,_t as a,a as o,at as s,b as c,c as l,ct as u,dt as d,f,ft as p,g as m,gt as h,ht as g,it as _,lt as v,pt as y,t as b,ut as x,v as S,vt as C,y as w,yt as T}from"./useKeymap-CW7Up0Ay.js";import{Ct as E,Dt as D,Ft as O,It as k,P as A,St as j,at as M,b as ee,bt as N,ct as te,i as P,it as F,n as ne,ot as re,r as ie,t as ae,xt as oe}from"./index-BXDOzSng.js";import{A as se,C as ce,D as le,E as ue,F as de,I as fe,M as pe,N as me,O as he,P as ge,S as _e,T as ve,_ as ye,a as be,b as xe,c as Se,d as Ce,f as we,g as Te,h as Ee,i as De,j as Oe,k as ke,l as Ae,m as je,n as Me,o as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re,v as ze,w as Be,x as Ve,y as He}from"./outlineNavigation-JObY7cUY.js";var I=i(e(),1);function Ue(){let[e,t]=(0,I.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(j).matches);return(0,I.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(j),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}function We(){let[e,t]=(0,I.useState)(()=>typeof window>`u`||!window.matchMedia?!0:window.matchMedia(E).matches);return(0,I.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(E),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}function Ge(e){let t=e?a(e):null,n=t?p(t):null,[r,i]=(0,I.useState)(0),[o,s]=(0,I.useState)(!1),l=O()?.transcriptsEnabled??!1,u=(0,I.useSyncExternalStore)(c,()=>S(f()));return(0,I.useEffect)(()=>{if(s(!1),!t||!l||!u||typeof EventSource>`u`)return;let e=new EventSource(ke(t,`events`));return e.addEventListener(`ready`,()=>{s(!0),i(e=>e+1)}),e.addEventListener(`tail`,()=>{i(e=>e+1)}),e.addEventListener(`error`,()=>{s(!1)}),()=>{e.close()}},[n,l,u]),{growthNonce:r,live:o}}function Ke(){(0,I.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`f`)return;let t=f();if(t.view===`conversations`&&ae())if(e.preventDefault(),t.selectedConversationRef)l({type:`OPEN_CONV_FIND`}),requestAnimationFrame(()=>{document.querySelector(`.conv-findbar-input`)?.focus()});else{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[])}function qe(e){let t=new URLSearchParams;e.dateFrom&&t.set(`date_from`,e.dateFrom),e.dateTo&&t.set(`date_to`,e.dateTo);for(let n of e.projects)t.append(`projects`,n);e.costMin!=null&&t.set(`cost_min`,String(e.costMin)),e.costMax!=null&&t.set(`cost_max`,String(e.costMax)),e.rebuildMin!=null&&t.set(`rebuild_min`,String(e.rebuildMin));for(let n of e.models)t.append(`models`,n);let n=t.toString();return n?`&${n}`:``}var Je=50;function Ye(e=`claude`,t={}){let n=t.qualified===!0||e===`codex`,r=t.accountKey,i=t.selectedRef?.source===e&&!Object.values(f().conversationFilters).some(e=>Array.isArray(e)?e.length>0:e!=null)?t.selectedRef.key:void 0,[a,o]=(0,I.useState)([]),[s,u]=(0,I.useState)(!0),[d,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(0),[g,_]=(0,I.useState)(!1),[v,b]=(0,I.useState)(null),x=(0,I.useRef)(e);x.current=e;let S=(0,I.useRef)(n);S.current=n;let C=(0,I.useRef)(r);C.current=r;let w=(0,I.useRef)(i);w.current=i;let[T,E]=(0,I.useState)(!1),[D,k]=(0,I.useState)(!1),A=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),j=(0,I.useRef)(A);j.current=A;let M=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),ee=(0,I.useRef)(M);ee.current=M;let N=me(O()),te=(0,I.useRef)(!1),[P,F]=(0,I.useState)(!1),ne=(0,I.useRef)(!1),re=(0,I.useRef)(null),ie=(0,I.useRef)(0),ae=(0,I.useCallback)(()=>{if(te.current||ne.current)return;re.current?.abort();let e=new AbortController;re.current=e;let t=x.current,n=S.current,r=C.current,i=w.current;de(n?se(t,{accountKey:r,projectKey:j.current.projects[0],model:j.current.models[0],limit:Je,selected:i}):`/api/conversations?sort=${ee.current}&limit=${Je}&offset=0${qe(j.current)}${r?`&account=${encodeURIComponent(r)}`:``}${i?`&selected=${encodeURIComponent(i)}`:``}`,e.signal).then(e=>{if(x.current!==t||S.current!==n||C.current!==r)return;let i=he(e);if(i!=null){o([]),h(null),_(!1),E(!1),k(!1),b(le(i)),p(null),u(!1);return}if(b(null),n){let n=Ce(t,e,r);o(Xe(n.rows,n.selected)),h(n.cursor),_(n.pending),E(!1),k(!1)}else{let n=e;o(Xe(r?n.conversations.map(e=>({...e,conversation_ref:{source:t,key:e.session_id,account_key:r}})):n.conversations,n.selected?r?{...n.selected,conversation_ref:{source:t,key:n.selected.session_id,account_key:r}}:n.selected:void 0)),h(n.page.next_offset),E(n.page.filter_degraded===!0),k(n.page.sort_degraded===!0),_(!1)}p(null),u(!1)}).catch(e=>{fe(e)||(p(`Couldn't load conversations.`),u(!1))})},[]),oe=(0,I.useCallback)(()=>{p(null),b(null),u(!0),ae()},[ae]),ce=JSON.stringify({source:e,qualified:n,accountKey:r,selectedKey:i,filters:A,sort:M}),ue=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(ue.current===null){ue.current=ce;return}ue.current!==ce&&(ue.current=ce,ie.current+=1,te.current=!1,F(!1),o([]),h(0),ne.current=!1,ae())},[ce]),(0,I.useEffect)(()=>{if(!(typeof document<`u`&&document.hidden))return ae(),()=>re.current?.abort()},[N,e,ae]),(0,I.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{document.hidden||ae()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[ae]);let pe=(0,I.useCallback)(async()=>{if(m==null||te.current)return;te.current=!0,F(!0);let e=ie.current;try{let t=x.current,n=S.current,r=C.current,i=await de(n?se(t,{accountKey:r,projectKey:j.current.projects[0],model:j.current.models[0],limit:Je,cursor:String(m)}):`/api/conversations?sort=${ee.current}&limit=${Je}&offset=${m}${qe(j.current)}${r?`&account=${encodeURIComponent(r)}`:``}`);if(ie.current!==e||x.current!==t||S.current!==n||C.current!==r)return;let a=he(i);if(a!=null){h(null),b(le(a));return}if(n){let e=Ce(t,i,r);o(t=>Ze(t,e.rows)),h(e.cursor),_(e.pending)}else{let e=i,n=r?e.conversations.map(e=>({...e,conversation_ref:{source:t,key:e.session_id,account_key:r}})):e.conversations;o(e=>Ze(e,n)),h(e.page.next_offset),E(e.page.filter_degraded===!0),k(e.page.sort_degraded===!0)}ne.current=!0}catch{}finally{te.current=!1,F(!1)}},[m]);return(0,I.useEffect)(()=>{a.length!==0&&l({type:`CACHE_CONVERSATION_TITLES`,titles:a.map(e=>[y(e),e.title])})},[a]),{rows:a,loading:s,error:d,hasMore:m!=null,loadMore:pe,loadingMore:P,filterDegraded:T,sortDegraded:D,retry:oe,pending:g,degraded:v}}function Xe(e,t){return!t||e.some(e=>C(y(e),y(t)))?e:[t,...e]}function Ze(e,t){let n=new Set(e.map(e=>p(y(e))));return[...e,...t.filter(e=>{let t=p(y(e));return n.has(t)?!1:(n.add(t),!0)})]}function Qe(e,t,n=e){let[r,i]=(0,I.useState)(n);return(0,I.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[e,t]),r}var $e=200;function et(e,t=`all`,n=`claude`,r={}){let i=r.qualified===!0||n===`codex`,a=r.accountKey,[o,s]=(0,I.useState)([]),[l,u]=(0,I.useState)(null),[d,p]=(0,I.useState)(0),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(null),[w,T]=(0,I.useState)(null),[E,D]=(0,I.useState)(!1),[O,k]=(0,I.useState)(null),A=e.trim(),j=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),M=JSON.stringify(j),ee=(0,I.useRef)(j);ee.current=j;let N=Qe(A,$e,``),te=(0,I.useRef)(null),P=(0,I.useRef)(!1),F=(0,I.useRef)(0);F.current=o.length;let ne=(0,I.useRef)(0);ne.current=d;let re=(0,I.useRef)(!1);re.current=b;let ie=(0,I.useCallback)((e,r)=>i?pe(n,{accountKey:a,query:N,kind:t,limit:50,cursor:r??void 0}):`/api/conversation/search?q=${encodeURIComponent(N)}&limit=50&offset=${e}&kind=${t}${qe(ee.current)}${a?`&account=${encodeURIComponent(a)}`:``}`,[N,t,M,n,i,a]);(0,I.useEffect)(()=>(A||(s([]),u(null),p(0),h(null),_(!1),C(null),k(null)),()=>{te.current?.abort()}),[A,t,M,n,i,a]),(0,I.useEffect)(()=>{if(!N){y(!1),x(!1);return}let e=new AbortController;return te.current=e,s([]),p(0),T(null),P.current=!1,k(null),y(!0),x(!1),de(ie(0),e.signal).then(t=>{if(te.current!==e||e.signal.aborted)return;let r=he(t);if(r!=null){s([]),p(0),T(null),D(!1),_(!1),P.current=!0,k(le(r)),C(null),y(!1);return}k(null);let o=i?Te(n,t,a):{...t,hits:a?t.hits.map(e=>({...e,conversation_ref:{source:n,key:e.session_id,account_key:a}})):t.hits,cursor:null,pending:!1};s(o.hits),u(o.mode),p(o.total),h(o.search_depth??`full`),_(o.filter_degraded===!0),T(o.cursor),D(o.pending),C(null),y(!1)}).catch(t=>{fe(t)||te.current!==e||e.signal.aborted||(C(`Search failed.`),y(!1))}),()=>e.abort()},[N,t,ie]);let ae=(0,I.useCallback)(()=>{if(P.current||re.current||F.current>=ne.current)return;let e=F.current,t=new AbortController;te.current=t,x(!0);let r=()=>te.current===t&&!t.signal.aborted;de(ie(e,w),t.signal).then(e=>{if(!r())return;let t=he(e);if(t!=null){P.current=!0,T(null),D(!1),k(le(t)),C(null),x(!1);return}k(null);let o=i?Te(n,e,a):{...e,hits:a?e.hits.map(e=>({...e,conversation_ref:{source:n,key:e.session_id,account_key:a}})):e.hits,cursor:null,pending:!1};s(e=>[...e,...o.hits]),p(o.total),u(o.mode),h(o.search_depth??`full`),_(o.filter_degraded===!0),T(o.cursor),D(o.pending),C(null),x(!1)}).catch(e=>{fe(e)||!r()||(C(`Search failed.`),x(!1))})},[ie,w,n,i,a]);return{hits:o,mode:l,total:d,loading:A!==``&&(A!==N||v),loadingMore:b,searchDepth:m,filterDegraded:g,error:S,loadMore:ae,pending:E,degraded:O}}var L=o();function tt(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,L.jsx)(I.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,L.jsx)(I.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,L.jsx)(I.Fragment,{children:e.slice(n,i)},r++)),t.push((0,L.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,L.jsx)(L.Fragment,{children:t})}var nt=864e5;function rt(e,t){let[n,r,i]=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e)).split(`-`).map(Number);return{y:n,m:r,d:i}}function it(e,t,n){let r=Date.parse(e),i=rt(r,t),a=rt(n,t),o=Date.UTC(i.y,i.m-1,i.d),s=Date.UTC(a.y,a.m-1,a.d),c=Math.round((s-o)/nt);return c<=0?`Today`:c===1?`Yesterday`:c<7?`This Week`:i.y===a.y&&i.m===a.m?`This Month`:new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,year:`numeric`}).format(new Date(r))}function at(e,t,n,r){return e===`recent`||e===`oldest`?it(t.last_activity_utc,n,r):e===`project`?t.project_label||`—`:null}var ot=700;function st(e=`claude`,t){let[n,r]=(0,I.useState)({projects:[],models:[]});return(0,I.useEffect)(()=>{let n=new AbortController,i;r({projects:[],models:[]});let a=o=>{de(e===`codex`?Oe(`codex`,t):`/api/conversations/facets${t?`?account=${encodeURIComponent(t)}`:``}`,n.signal).then(t=>{if(e===`codex`){let e=t;r({projects:e.facets.projects.map(e=>({project_label:e.project_label??`Unnamed project`,count:e.count,filter_value:e.project_key})),models:e.facets.models.map(e=>({family:e.model,count:e.count,filter_value:e.model})),...e.filter_degraded?{filter_degraded:!0}:{}})}else{let e=t;r({projects:e.projects??[],models:e.models??[],...e.filter_degraded?{filter_degraded:!0}:{}})}}).catch(e=>{if(!fe(e)){if(o===0){i=setTimeout(()=>a(1),ot);return}r({projects:[],models:[]})}})};return a(0),()=>{n.abort(),i&&clearTimeout(i)}},[e,t]),n}function ct(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function lt(e){let[t,n,r]=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date).split(`-`).map(Number);return{y:t,m:n,d:r}}var ut=[{key:`this-month`,label:`This month`,bounds:e=>{let{y:t,m:n}=lt(e);return{from:ct(new Date(Date.UTC(t,n-1,1))),to:ct(new Date(Date.UTC(t,n,0)))}}},{key:`last-month`,label:`Last month`,bounds:e=>{let{y:t,m:n}=lt(e);return{from:ct(new Date(Date.UTC(t,n-2,1))),to:ct(new Date(Date.UTC(t,n-1,0)))}}},{key:`last-7d`,label:`Last 7d`,bounds:e=>{let{y:t,m:n,d:r}=lt(e),i=new Date(Date.UTC(t,n-1,r));return{from:ct(new Date(i.getTime()-6*864e5)),to:ct(i)}}}],dt=[1,5,10],ft=[1,3,5];function pt(e){l({type:`SET_CONVERSATION_FILTERS`,patch:e})}function mt({source:e=`claude`,accountKey:t}){let n=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),r=st(e,t),{resolvedTz:i}=N(),[a,o]=(0,I.useState)(n.costMin?.toString()??``),[s,u]=(0,I.useState)(n.costMax?.toString()??``),[d,p]=(0,I.useState)(n.rebuildMin?.toString()??``);(0,I.useEffect)(()=>{o(n.costMin?.toString()??``)},[n.costMin]),(0,I.useEffect)(()=>{u(n.costMax?.toString()??``)},[n.costMax]),(0,I.useEffect)(()=>{p(n.rebuildMin?.toString()??``)},[n.rebuildMin]);let m=(0,I.useRef)({});(0,I.useEffect)(()=>{let e=m.current;return()=>{for(let t in e)clearTimeout(e[t])}},[]);let h=(e,t)=>{let n=m.current[e];n&&clearTimeout(n),m.current[e]=setTimeout(t,300)},g=e=>{if(e.trim()===``)return null;let t=Number(e);return Number.isFinite(t)?t:void 0},_=()=>l({type:`SET_INPUT_MODE`,mode:`filter`}),v=()=>l({type:`SET_INPUT_MODE`,mode:null});(0,I.useEffect)(()=>()=>{l({type:`SET_INPUT_MODE`,mode:null})},[]);let y=t=>{pt({projects:n.projects.includes(t)?n.projects.filter(e=>e!==t):e===`codex`?[t]:[...n.projects,t]})},b=t=>{pt({models:n.models.includes(t)?n.models.filter(e=>e!==t):e===`codex`?[t]:[...n.models,t]})};return(0,L.jsxs)(`div`,{className:`conv-rail-filters`,role:`dialog`,"aria-label":`Conversation filters`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),l({type:`SET_CONV_FILTERS_OPEN`,open:!1}))},children:[e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Date (last activity)`}),(0,L.jsx)(`div`,{className:`conv-rail-filters-chips`,children:ut.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.datePreset===e.key?` is-on`:``}`,onClick:()=>{let t=e.bounds(i);pt({dateFrom:t.from,dateTo:t.to,datePreset:e.key})},children:e.label},e.key))}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`From`}),(0,L.jsx)(`input`,{type:`date`,value:n.dateFrom??``,"aria-label":`Date from`,onFocus:_,onBlur:v,onChange:e=>pt({dateFrom:e.target.value||null,datePreset:null})})]}),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`To`}),(0,L.jsx)(`input`,{type:`date`,value:n.dateTo??``,"aria-label":`Date to`,onFocus:_,onBlur:v,onChange:e=>pt({dateTo:e.target.value||null,datePreset:null})})]})]})]}),(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Project`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-projects`,children:[r.projects.length===0&&(0,L.jsx)(`div`,{className:`conv-rail-filters-empty`,children:r.filter_degraded?`Projects appear once indexing finishes.`:`No projects.`}),r.projects.map(e=>{let t=e.filter_value??e.project_label;return(0,L.jsxs)(`label`,{className:`conv-rail-filters-proj`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:n.projects.includes(t),"aria-label":e.project_label,onChange:()=>y(t)}),(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-name`,children:e.project_label}),(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:e.count})]},t)})]})]}),(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Model`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[r.models.length===0&&(0,L.jsx)(`div`,{className:`conv-rail-filters-empty`,children:`No models.`}),r.models.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip chip ${F(e.family)}${n.models.includes(e.filter_value??e.family)?` is-on`:``}`,"aria-pressed":n.models.includes(e.filter_value??e.family),onClick:()=>b(e.filter_value??e.family),children:[e.family,` `,(0,L.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:e.count})]},e.filter_value??e.family))]})]}),e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cost (USD)`}),(0,L.jsx)(`div`,{className:`conv-rail-filters-chips`,children:dt.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.costMin===e?` is-on`:``}`,onClick:()=>pt({costMin:e}),children:[`≥$`,e]},e))}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`Min`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:a,"aria-label":`Min cost`,placeholder:`0`,onFocus:_,onBlur:v,onChange:e=>{o(e.target.value);let t=g(e.target.value);t!==void 0&&h(`costMin`,()=>pt({costMin:t}))}})]}),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,L.jsx)(`span`,{children:`Max`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:s,"aria-label":`Max cost`,placeholder:`∞`,onFocus:_,onBlur:v,onChange:e=>{u(e.target.value);let t=g(e.target.value);t!==void 0&&h(`costMax`,()=>pt({costMax:t}))}})]})]})]}),e===`claude`&&(0,L.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,L.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cache rebuilds`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[ft.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${n.rebuildMin===e?` is-on`:``}`,onClick:()=>pt({rebuildMin:e}),children:[`≥`,e]},e)),(0,L.jsxs)(`label`,{className:`conv-rail-filters-field conv-rail-filters-field--inline`,children:[(0,L.jsx)(`span`,{children:`≥`}),(0,L.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:`0`,step:`1`,value:d,"aria-label":`Min cache rebuilds`,placeholder:`N`,onFocus:_,onBlur:v,onChange:e=>{p(e.target.value);let t=g(e.target.value);if(t!==void 0){let e=t===null?null:Math.floor(t);h(`rebuildMin`,()=>pt({rebuildMin:e}))}}})]})]})]}),e===`codex`&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Codex browse supports one project and one native model filter. Search remains corpus-wide.`}),(0,L.jsxs)(`div`,{className:`conv-rail-filters-footer`,children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clear`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-done`,onClick:()=>l({type:`SET_CONV_FILTERS_OPEN`,open:!1}),children:`Done`})]})]})}var ht=48;function gt(e,t){let n=a(e),r=t[p(n)]?.trim()??(typeof e==`string`?t[e]?.trim():void 0);return r?{kind:`title`,text:r.length>ht?`${r.slice(0,ht-1)}…`:r}:{kind:`hash`,text:n.key.slice(0,8)}}function _t(e){let t=new Set;for(let n of e)if(t.add(n.project_label),t.size>1)return!1;return!0}var vt={tools:`tool`,thinking:`thinking`,title:`title`,files:`file`};function yt(e,t){let n=vt[t];return n?e.filter(e=>e!==n):e}function bt(e,t){return(t??``).localeCompare(e??``)}function xt(e,t){let n=new Map;for(let r of[...e,...t]){let e=p(y(r));n.has(e)||n.set(e,r)}return[...n.values()].sort((e,t)=>bt(e.last_activity_utc,t.last_activity_utc)||p(y(e)).localeCompare(p(y(t))))}function St(e,t){let n=new Map;for(let r of[...e,...t]){let e=JSON.stringify([p(T(r)),r.uuid]);n.has(e)||n.set(e,r)}return[...n.values()].sort((e,t)=>bt(e.ts,t.ts)||p(T(e)).localeCompare(p(T(t)))||e.uuid.localeCompare(t.uuid))}var Ct=[{key:`recent`,label:`Recent`},{key:`oldest`,label:`Oldest`},{key:`cost`,label:`Cost`},{key:`messages`,label:`Messages`},{key:`project`,label:`Project`}],wt=[{kind:`all`,label:`All`,needsSplit:!1,group:`content`},{kind:`prompts`,label:`Prompts`,needsSplit:!1,group:`content`},{kind:`assistant`,label:`Assistant`,needsSplit:!1,group:`content`},{kind:`tools`,label:`Tools`,needsSplit:!0,group:`content`},{kind:`thinking`,label:`Thinking`,needsSplit:!0,group:`content`},{kind:`title`,label:`Title`,needsSplit:!1,group:`structural`},{kind:`files`,label:`Files`,needsSplit:!1,group:`structural`}],Tt={tool:`tool`,thinking:`thinking`,title:`title`,file:`file`},Et={"this-month":`This month`,"last-month":`Last month`,"last-7d":`Last 7d`};function Dt(e){return e.dateFrom!=null||e.dateTo!=null||e.projects.length>0||e.models.length>0||e.costMin!=null||e.costMax!=null||e.rebuildMin!=null}function Ot(e,t){let n=[];if(e.dateFrom||e.dateTo){let t=e.datePreset?Et[e.datePreset]??e.datePreset:e.dateFrom&&e.dateTo?`${e.dateFrom} → ${e.dateTo}`:e.dateFrom?`from ${e.dateFrom}`:`to ${e.dateTo}`;n.push({key:`date`,label:t,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{dateFrom:null,dateTo:null,datePreset:null}})})}for(let r of e.projects)n.push({key:`proj:${r}`,label:t===`codex`?`Project`:r,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{projects:e.projects.filter(e=>e!==r)}})});for(let t of e.models)n.push({key:`model:${t}`,label:t,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{models:e.models.filter(e=>e!==t)}})});return e.costMin!=null&&n.push({key:`costMin`,label:`≥$${e.costMin}`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{costMin:null}})}),e.costMax!=null&&n.push({key:`costMax`,label:`≤$${e.costMax}`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{costMax:null}})}),e.rebuildMin!=null&&n.push({key:`rebuildMin`,label:`≥${e.rebuildMin} ♻`,remove:()=>l({type:`SET_CONVERSATION_FILTERS`,patch:{rebuildMin:null}})}),n}function kt(){let e=(0,I.useSyncExternalStore)(c,()=>f().activeSource),t=r((0,I.useSyncExternalStore)(c,()=>f().snapshot),e,(0,I.useSyncExternalStore)(c,()=>e===`all`?`all`:f().accountFocus.provider[e])),n=(0,I.useSyncExternalStore)(c,()=>f().conversationSearch),i=(0,I.useSyncExternalStore)(c,()=>f().conversationSearchKind),a=(0,I.useSyncExternalStore)(c,()=>f().selectedConversationRef),o=(0,I.useSyncExternalStore)(c,()=>f().convFiltersOpen),s=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),u=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),d=(0,I.useSyncExternalStore)(c,()=>f().comparePick),p=(0,I.useSyncExternalStore)(c,()=>f().conversationTitles),m=N(),h={tz:m.resolvedTz,offsetLabel:m.offsetLabel},g=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!d)return;let e=e=>{if(e.key!==`Escape`)return;let t=f();t.inputMode!==null||t.convFiltersOpen||(e.stopPropagation(),l({type:`CANCEL_COMPARE_PICK`}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[d]),(0,I.useEffect)(()=>{if(!d)return;let e=document.activeElement;(e===null||e===document.body)&&document.querySelector(`.conv-rail-pickcancel`)?.focus()},[d]);let _=n.trim()!==``,v=e===`all`?[]:Ot(s,e),y=d?gt(d.anchor,p):null,b=t=>{t!==e&&(l({type:`SET_ACTIVE_SOURCE`,source:t}),d||l({type:`SELECT_CONVERSATION`,conversationRef:null}),l({type:`CLEAR_CONVERSATION_FILTERS`}),l({type:`SET_CONVERSATION_SEARCH`,text:``}))};return(0,L.jsxs)(`aside`,{className:`conv-rail${d?` conv-rail--picking`:``}`,children:[d&&(0,L.jsxs)(`div`,{className:`conv-rail-pickbanner`,role:`status`,"aria-live":`polite`,children:[(0,L.jsxs)(`span`,{className:`conv-rail-pickbanner-text`,children:[`Comparing with`,` `,y?.kind===`title`?(0,L.jsxs)(`strong`,{className:`conv-rail-pickbanner-title`,children:[`“`,y.text,`”`]}):(0,L.jsx)(`code`,{children:y?.text}),` `,`— pick a session`]}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-pickcancel`,"aria-label":`Cancel comparison pick`,onClick:()=>l({type:`CANCEL_COMPARE_PICK`}),children:`Cancel`})]}),(0,L.jsxs)(`div`,{className:`conv-rail-search`,children:[(0,L.jsx)(`div`,{className:`conv-rail-source`,role:`group`,"aria-label":`Conversation source`,children:[`claude`,`codex`,`all`].map(t=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":e===t,className:`conv-rail-source-btn${e===t?` is-on`:``}`,onClick:()=>b(t),children:t===`claude`?`Claude`:t===`codex`?`Codex`:`All`},t))}),(0,L.jsxs)(`div`,{className:`conv-rail-search-bar`,children:[(0,L.jsxs)(`div`,{className:`conv-rail-search-inputwrap`,children:[(0,L.jsx)(`span`,{className:`conv-rail-search-mag`,"aria-hidden":`true`,children:`⌕`}),(0,L.jsx)(`input`,{ref:g,type:`search`,className:`conv-rail-search-input`,placeholder:`search ${e===`all`?`all`:e===`codex`?`Codex`:`Claude`} conversations…`,value:n,onChange:e=>l({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>l({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>l({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),l({type:`SET_CONVERSATION_SEARCH`,text:``}),g.current?.blur())}})]}),(0,L.jsxs)(`div`,{className:`conv-rail-search-controls`,children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-btn${o?` is-on`:``}`,"aria-expanded":o,disabled:e===`all`,title:e===`all`?`Filters are source-specific`:`Filter conversations`,onClick:()=>l({type:`TOGGLE_CONV_FILTERS`}),onKeyDown:e=>{o&&e.key===`Escape`&&(e.stopPropagation(),l({type:`TOGGLE_CONV_FILTERS`}))},children:`Filters ▾`}),(0,L.jsxs)(`label`,{className:`conv-rail-sort`,children:[(0,L.jsx)(`span`,{className:`conv-rail-sort-label`,children:`Sort`}),(0,L.jsx)(`select`,{className:`conv-rail-sort-select`,"aria-label":`Sort conversations`,value:e===`claude`?u:`recent`,disabled:e!==`claude`,onChange:e=>l({type:`SET_CONVERSATION_RAIL_SORT`,sort:e.target.value}),children:Ct.map(e=>(0,L.jsx)(`option`,{value:e.key,children:e.label},e.key))})]})]})]}),o&&e!==`all`&&(0,L.jsx)(mt,{source:e,accountKey:t??void 0},`${e}:${t??`all`}`),e===`all`&&(0,L.jsx)(`div`,{className:`conv-rail-composed-note`,children:`Merged locally · source-specific filters and sort`}),t&&(0,L.jsx)(`div`,{className:`conv-rail-composed-note`,children:`Scoped to the selected account`}),(0,L.jsx)(`div`,{className:`conv-rail-composed-note conv-rail-population-note`,children:`Message counts include subagent sidechains.`}),v.length>0&&(0,L.jsxs)(`div`,{className:`conv-rail-filters-active`,children:[v.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-activechip`,title:`Remove ${e.label}`,"aria-label":`Remove ${e.label}`,onClick:e.remove,children:[e.label,(0,L.jsx)(`span`,{className:`conv-rail-filters-x`,"aria-hidden":`true`,children:`✕`})]},e.key)),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clearall`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`})]})]}),_?e===`all`?(0,L.jsx)(Rt,{needle:n,kind:i,ctx:h,selectedId:a,pickAnchor:d?.anchor??null}):(0,L.jsx)(Lt,{source:e,accountKey:t??void 0,needle:n,kind:i,ctx:h,selectedId:a,pickAnchor:d?.anchor??null},`${e}:${t??`all`}`):e===`all`?(0,L.jsx)(Nt,{selectedId:a,ctx:h,pickAnchor:d?.anchor??null}):(0,L.jsx)(Mt,{source:e,accountKey:t??void 0,selectedId:a,ctx:h,pickAnchor:d?.anchor??null},`${e}:${t??`all`}`)]})}function At(e,t,n){return e&&!C(e,t)?()=>l({type:`OPEN_COMPARE`,aRef:e,bRef:t}):n}function jt({notice:e,onRetry:t}){return(0,L.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--degraded`,role:`status`,"data-testid":`conv-rail-degraded`,"data-degraded-reason":e.reason,children:[(0,L.jsx)(`div`,{children:e.message}),e.retryable&&t&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>t(),children:`Retry`})]})}function Mt({source:e,accountKey:t,selectedId:n,ctx:r,pickAnchor:i}){return(0,L.jsx)(Pt,{data:Ye(e,{accountKey:t,selectedRef:n}),selectedId:n,ctx:r,pickAnchor:i})}function Nt({selectedId:e,ctx:t,pickAnchor:n}){let r=Ye(`claude`,{qualified:!0,selectedRef:e}),i=Ye(`codex`,{qualified:!0,selectedRef:e}),a={rows:xt(r.rows,i.rows),loading:r.loading||i.loading,error:r.error&&i.error?`Couldn't load either conversation source.`:null,hasMore:r.hasMore||i.hasMore,loadMore:async()=>{await Promise.all([r.hasMore?r.loadMore():void 0,i.hasMore?i.loadMore():void 0])},loadingMore:r.loadingMore||i.loadingMore,filterDegraded:!1,sortDegraded:!1,retry:()=>{r.retry(),i.retry()},pending:r.pending&&i.pending,degraded:r.degraded&&i.degraded?r.degraded:null},o=r.degraded==null!=(i.degraded==null);return(0,L.jsx)(Pt,{data:a,selectedId:e,ctx:t,pickAnchor:n,forcedRecent:!0,partialNote:r.error||i.error?`One source is temporarily unavailable.`:o?(r.degraded??i.degraded).message:r.pending||i.pending?`One source is still indexing.`:null})}function Pt({data:e,selectedId:t,ctx:n,pickAnchor:r,forcedRecent:i=!1,partialNote:a=null}){let{rows:o,loading:s,error:u,hasMore:d,loadMore:m,loadingMore:h,filterDegraded:g,sortDegraded:_,retry:v,pending:b,degraded:x}=e,S=(0,I.useSyncExternalStore)(c,()=>f().conversationFilters),w=(0,I.useSyncExternalStore)(c,()=>f().conversationRailSort),T=(0,L.jsxs)(L.Fragment,{children:[a&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:a}),g&&(0,L.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Project/cost/rebuild filters apply once indexing finishes.`}),_&&(0,L.jsx)(`div`,{className:`conv-rail-sort-degraded`,children:`Cost/Project sort unavailable while indexing — showing recent order.`})]});if(x)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(jt,{notice:x,onRetry:v})]});if(u)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsxs)(`div`,{className:`conv-rail-empty`,children:[u,(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>v(),children:`Retry`})]})]});if(b)return(0,L.jsx)(`div`,{className:`conv-rail-list`,children:(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Codex conversations are still indexing.`})});if(s&&o.length===0)return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})]});if(o.length===0)return Dt(S)?(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--filtered`,children:[(0,L.jsx)(`div`,{children:`No conversations match these filters.`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-empty-clear`,onClick:()=>l({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear filters`})]})]}):(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,(0,L.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})]});let E=i||_?`recent`:w,D=E===`project`,O=null,k=Date.now(),A=_t(o)||D;return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[T,o.map(e=>{let i=at(E,e,n.tz,k),a=i===null?null:i.toLowerCase(),o=i!==null&&a!==O;return a!==null&&(O=a),(0,L.jsxs)(I.Fragment,{children:[o&&(0,L.jsx)(`div`,{className:`conv-rail-sec${D?` conv-rail-sec--project`:``}`,title:D?i??void 0:void 0,children:i}),(0,L.jsx)(Ft,{row:e,ctx:n,active:C(y(e),t),pickAnchor:r,hideProject:A})]},p(y(e)))}),d&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-more`,disabled:h,onClick:()=>void m(),children:h?`Loading…`:`Load more`})]})}function Ft({row:e,ctx:t,active:n,pickAnchor:r,hideProject:i}){let a=y(e),o=C(r,a),s=re(e.models,1);return(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-row${n?` is-active`:``}${r?` conv-rail-row--pick`:``}${o?` conv-rail-row--anchor`:``}`,disabled:o,"aria-disabled":o||void 0,title:o?`This is the anchor session`:void 0,onClick:At(r,a,()=>l({type:`SELECT_CONVERSATION`,conversationRef:a})),children:[(0,L.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${a.source}`,children:a.source===`codex`?`Codex`:`Claude`}),(0,L.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,L.jsxs)(`span`,{className:`conv-rail-row-metaleft`,children:[!i&&(0,L.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,L.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`})]}),(0,L.jsx)(`span`,{className:`conv-rail-row-when`,children:_.startedShort(e.last_activity_utc,t,{noSuffix:!0})})]}),(0,L.jsxs)(`div`,{className:`conv-rail-row-stats`,children:[s.chips.length>0&&(0,L.jsxs)(`span`,{className:`conv-rail-row-model`,children:[s.chips.map(e=>(0,L.jsx)(`span`,{className:`chip ${e.cls}`,style:M(e.model),title:e.full===e.label?void 0:e.full,"aria-label":e.full===e.label?void 0:e.full,children:e.label},e.model)),s.extra>0&&(0,L.jsxs)(`span`,{className:`conv-rail-row-model-more`,children:[`+`,s.extra]})]}),(0,L.jsxs)(`span`,{className:`conv-rail-row-cluster`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-cost`,children:_.usd2(e.cost_usd)}),(0,L.jsx)(`span`,{className:`conv-rail-row-msgs`,children:e.msg_count})]})]})]})}function It({kind:e,proseOnly:t}){let n=null;return(0,L.jsx)(`div`,{className:`conv-rail-chips`,role:`radiogroup`,"aria-label":`Search kind`,children:wt.map(r=>{let i=r.needsSplit&&t,a=e===r.kind,o=n!==null&&r.group!==n;return n=r.group,(0,L.jsxs)(I.Fragment,{children:[o&&(0,L.jsx)(`span`,{className:`conv-rail-chips-break`,"aria-hidden":`true`}),(0,L.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,disabled:i,title:i?`indexing…`:void 0,className:`conv-rail-chip${a?` is-on`:``}`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH_KIND`,kind:r.kind}),children:r.label})]},r.kind)})})}function Lt({source:e,accountKey:t,needle:n,kind:r,ctx:i,selectedId:a,pickAnchor:o}){return(0,L.jsx)(zt,{data:et(n,r,e,{accountKey:t}),needle:n,kind:r,ctx:i,selectedId:a,pickAnchor:o})}function Rt({needle:e,kind:t,ctx:n,selectedId:r,pickAnchor:i}){let a=et(e,t,`claude`,{qualified:!0}),o=et(e,t,`codex`,{qualified:!0}),s={hits:St(a.hits,o.hits),mode:a.mode===`like`||o.mode===`like`?`like`:a.mode??o.mode,total:a.total+o.total,loading:a.loading||o.loading,loadingMore:a.loadingMore||o.loadingMore,searchDepth:a.searchDepth===`prose-only`||o.searchDepth===`prose-only`?`prose-only`:a.searchDepth??o.searchDepth,filterDegraded:!1,error:a.error&&o.error?`Search failed for both sources.`:null,loadMore:()=>{a.hits.length<a.total&&a.loadMore(),o.hits.length<o.total&&o.loadMore()},pending:a.pending&&o.pending,degraded:a.degraded&&o.degraded?a.degraded:null},c=a.degraded==null!=(o.degraded==null);return(0,L.jsx)(zt,{data:s,needle:e,kind:t,ctx:n,selectedId:r,pickAnchor:i,partialNote:a.error||o.error?`One source search is temporarily unavailable.`:c?(a.degraded??o.degraded).message:a.pending||o.pending?`One source is still indexing.`:null})}function zt({data:e,needle:t,kind:n,ctx:r,selectedId:i,pickAnchor:a,partialNote:o=null}){let{hits:s,mode:c,total:u,loading:d,loadingMore:f,searchDepth:m,filterDegraded:h,error:g,loadMore:_,pending:v,degraded:y}=e,b=m===`prose-only`,x=u-s.length,S=b&&(n===`tools`||n===`thinking`),C=(u===0?`No results`:`${u} results${c===`like`?` · basic search`:``}`)+(S?` · indexing…`:``),w=u===0&&!d&&!g;return(0,L.jsxs)(`div`,{className:`conv-rail-list`,children:[(0,L.jsx)(It,{kind:n,proseOnly:b}),h&&(0,L.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:`Some filters unavailable while indexing.`}),o&&(0,L.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:o}),y&&s.length===0?(0,L.jsx)(jt,{notice:y}):g?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`alert`,children:g}):v?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Codex conversations are still indexing.`}):d&&s.length===0?(0,L.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Searching…`}):w?(0,L.jsxs)(`div`,{className:`conv-rail-noresults`,role:`status`,children:[(0,L.jsxs)(`div`,{className:`conv-rail-noresults-q`,children:[`No results for “`,t.length>40?t.slice(0,40)+`…`:t,`”`,S?` · indexing…`:``]}),n!==`all`&&(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH_KIND`,kind:`all`}),children:`Search all conversations`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>l({type:`SET_CONVERSATION_SEARCH`,text:``}),children:`Clear search`})]}):(0,L.jsxs)(L.Fragment,{children:[y&&(0,L.jsx)(jt,{notice:y}),(0,L.jsx)(`div`,{className:`conv-rail-count`,"aria-live":`polite`,children:C}),s.map((e,t)=>(0,L.jsx)(Bt,{hit:e,ctx:r,kind:n,selectedId:i,pickAnchor:a},`${p(T(e))}-${e.uuid}-${t}`)),!y&&s.length<u&&(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-more`,disabled:f,onClick:()=>_(),children:[`Load `,Math.min(50,x),` more (`,x,` remaining)`]})]})]})}function Bt({hit:e,ctx:t,kind:n,selectedId:r,pickAnchor:i}){let a=e.match_kinds??[],o=a.includes(`file`),s=yt(a,n),c=T(e),u=C(i,c);return(0,L.jsxs)(`button`,{type:`button`,className:`conv-rail-row conv-rail-row--hit${C(c,r)?` is-active`:``}${o?` conv-rail-row--filehit`:``}${i?` conv-rail-row--pick`:``}${u?` conv-rail-row--anchor`:``}`,disabled:u,"aria-disabled":u||void 0,title:u?`This is the anchor session`:void 0,onClick:At(i,c,()=>l({type:`OPEN_CONVERSATION`,conversationRef:c,jump:x(c,e.uuid,!0)})),children:[o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-filepath conv-rail-row-title-text`,children:e.snippet}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${c.source}`,children:c.source===`codex`?`Codex`:`Claude`}),s.length>0&&(0,L.jsx)(Vt,{badges:s})]}),(0,L.jsx)(`div`,{className:`conv-rail-row-filetitle`,children:e.title})]}):(0,L.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-title-text`,children:e.title}),(0,L.jsx)(`span`,{className:`conv-source-badge conv-source-badge--${c.source}`,children:c.source===`codex`?`Codex`:`Claude`}),s.length>0&&(0,L.jsx)(Vt,{badges:s})]}),(0,L.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,L.jsx)(`span`,{className:`conv-rail-row-metaleft`,children:(0,L.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`})}),(0,L.jsx)(`span`,{className:`conv-rail-row-when`,children:_.startedShort(e.ts,t,{noSuffix:!0})})]}),!o&&(0,L.jsx)(`div`,{className:`conv-rail-row-snippet`,children:tt(e.snippet)})]})}function Vt({badges:e}){return(0,L.jsx)(`span`,{className:`conv-rail-kindbs`,children:e.map(e=>(0,L.jsx)(`span`,{className:`conv-rail-kindb`,children:Tt[e]??e},e))})}var Ht=i(k(),1),Ut=0,Wt=1,Gt=2,Kt=4;function qt(e){return()=>e}function Jt(e){e()}function Yt(e,t){return n=>e(t(n))}function Xt(e,t){return()=>e(t)}function Zt(e,t){return n=>e(t,n)}function Qt(e){return e!==void 0}function $t(...e){return()=>{e.map(Jt)}}function en(){}function tn(e,t){return t(e),e}function nn(e,t){return t(e)}function R(...e){return e}function rn(e,t){return e(Wt,t)}function z(e,t){e(Ut,t)}function an(e){e(Gt)}function on(e){return e(Kt)}function B(e,t){return rn(e,Zt(t,Ut))}function sn(e,t){let n=e(Wt,e=>{n(),t(e)});return n}function cn(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function ln(e,t){return e===t}function un(e=ln){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function V(e){return t=>n=>{e(n)&&t(n)}}function H(e){return t=>Yt(t,e)}function dn(e){return t=>()=>{t(e)}}function U(e,...t){let n=hn(...t);return((t,r)=>{switch(t){case Gt:an(e);return;case Wt:return rn(e,n(r))}})}function fn(e,t){return n=>r=>{n(t=e(t,r))}}function pn(e){return t=>n=>{e>0?e--:t(n)}}function mn(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function W(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;rn(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function hn(...e){return t=>e.reduceRight(nn,t)}function gn(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case Wt:return a?n===a?void 0:(r(),n=a,t=rn(e,a),t):(r(),en);case Gt:r(),n=null;return}}}function G(e){let t=e,n=K();return((e,r)=>{switch(e){case Ut:t=r;break;case Wt:r(t);break;case Kt:return t}return n(e,r)})}function _n(e,t){return tn(G(t),t=>B(e,t))}function K(){let e=[];return((t,n)=>{switch(t){case Ut:e.slice().forEach(e=>{e(n)});return;case Gt:e.splice(0,e.length);return;case Wt:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function vn(e){return tn(K(),t=>B(e,t))}function yn(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:bn(),singleton:n}}var bn=()=>Symbol();function xn(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function Sn(...e){let t=K(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;rn(e,e=>{n[a]=e,r|=o,r===i&&z(t,n)})}),function(e,a){switch(e){case Gt:an(t);return;case Wt:return r===i&&a(n),rn(t,a)}}}function q(e,t=ln){return U(e,un(t))}function Cn(...e){return function(t,n){switch(t){case Gt:return;case Wt:return $t(...e.map(e=>rn(e,n)))}}}var wn={DEBUG:0,INFO:1,WARN:2,ERROR:3},Tn={[wn.DEBUG]:`debug`,[wn.ERROR]:`error`,[wn.INFO]:`log`,[wn.WARN]:`warn`},En=()=>typeof globalThis>`u`?window:globalThis,Dn=yn(()=>{let e=G(wn.ERROR);return{log:G((t,n,r=wn.INFO)=>{r>=(En().VIRTUOSO_LOG_LEVEL??on(e))&&console[Tn[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),On=new WeakMap;function kn(e){return`self`in e?e.document.documentElement:e}function An(e){let t=kn(e),n=On.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return On.set(t,r),r}function jn(e){On.delete(kn(e))}function Mn(e,t){return An(e)?-t:t}var Nn=Mn;function Pn(e,t){return Mn(e,t)}function Fn(e,t,n){return In(e,t,n).callbackRef}function In(e,t,n){let r=I.useRef(null),i=e=>{},a=I.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function Ln(e,t,n,r,i,a,o,s,c){return In(I.useCallback(n=>{let c=Rn(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?Nn(o,o.scrollLeft):o.scrollTop:u?s?Nn(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?Nn(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?zn(`column-gap`,getComputedStyle(n).columnGap,i):zn(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function Rn(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},wn.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function zn(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,wn.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Bn(e,t,n){let r=I.useRef(null),i=I.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=In(i,!0,n),s=I.useCallback(()=>{i(o.current)},[i,o]);return I.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var Vn=yn(()=>{let e=K(),t=K(),n=G(0),r=K(),i=G(0),a=K(),o=K(),s=G(0),c=G(0),l=G(0),u=G(0),d=K(),f=K(),p=G(!1),m=G(!1),h=G(!1);return B(U(e,H(({scrollTop:e})=>e)),t),B(U(e,H(({scrollHeight:e})=>e)),o),B(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),Hn={lvl:0};function Un(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function Wn(e){return e===Hn}function Gn(e,t){if(!Wn(e))return t===e.k?e.v:t<e.k?Gn(e.l,t):Gn(e.r,t)}function Kn(e,t,n=`k`){if(Wn(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=Kn(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Kn(e.l,t,n)}function qn(e,t,n){return Wn(e)?ir(t,n,1):t===e.k?er(e,{k:t,v:n}):t<e.k?ar(er(e,{l:qn(e.l,t,n)})):ar(er(e,{r:qn(e.r,t,n)}))}function Jn(){return Hn}function Yn(e,t,n){if(Wn(e))return[];let r=Kn(e,t)[0];return cr(Qn(e,r,n))}function Xn(e,t){if(Wn(e))return Hn;let{k:n,l:r,r:i}=e;if(t===n){if(Wn(r))return i;if(Wn(i))return r;let[t,n]=rr(r);return $n(er(e,{k:t,l:tr(r),v:n}))}return $n(t<n?er(e,{l:Xn(r,t)}):er(e,{r:Xn(i,t)}))}function Zn(e){return Wn(e)?[]:[...Zn(e.l),{k:e.k,v:e.v},...Zn(e.r)]}function Qn(e,t,n){if(Wn(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(Qn(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(Qn(a,t,n))),s}function $n(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(nr(t))return or(er(e,{lvl:n-1}));if(!Wn(t)&&!Wn(t.r))return er(t.r,{l:er(t,{r:t.r.l}),lvl:n,r:er(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(nr(e))return sr(er(e,{lvl:n-1}));if(!Wn(r)&&!Wn(r.l)){let t=r.l,i=nr(t)?r.lvl-1:r.lvl;return er(t,{l:er(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:sr(er(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function er(e,t){return ir(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function tr(e){return Wn(e.r)?e.l:$n(er(e,{r:tr(e.r)}))}function nr(e){return Wn(e)||e.lvl>e.r.lvl}function rr(e){return Wn(e.r)?[e.k,e.v]:rr(e.r)}function ir(e,t,n,r=Hn,i=Hn){return{k:e,l:r,lvl:n,r:i,v:t}}function ar(e){return sr(or(e))}function or(e){let{l:t}=e;return!Wn(t)&&t.lvl===e.lvl?er(t,{r:er(e,{l:t.r})}):e}function sr(e){let{lvl:t,r:n}=e;return!Wn(n)&&!Wn(n.r)&&n.lvl===t&&n.r.lvl===t?er(n,{l:er(e,{r:n.l}),lvl:t+1}):e}function cr(e){return Un(e,({k:e,v:t})=>({index:e,value:t}))}function lr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ur(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var dr=yn(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function fr(e,t,n){return e[pr(e,t,n)]}function pr(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function mr(e,t,n,r){let i=pr(e,t,r),a=pr(e,n,r,i);return e.slice(i,a+1)}function hr(e,t){return Math.round(e.getBoundingClientRect()[t])}function gr(e){return!Wn(e.groupOffsetTree)}function _r({index:e},t){return t===e?0:t<e?-1:1}function vr(){return{groupIndices:[],groupOffsetTree:Jn(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Jn()}}function yr(e,t){let n=Wn(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),Wn(e)){e=qn(e,0,i);continue}let o=Yn(e,a-1,t+1);if(o.some(jr(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Xn(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=qn(e,t+1,a));c&&(e=qn(e,a,i))}return[e,n]}function br(e){return typeof e.groupIndex<`u`}function xr({offset:e},t){return t===e?0:t<e?-1:1}function Sr(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=fr(t,e,_r),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function Cr(e,t){if(!gr(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function wr(e,t,n){if(br(e))return t.groupIndices[e.groupIndex]+1;let r=Cr(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function Tr(e,t,n,r=0){return r>0&&(t=Math.max(t,fr(e,r,_r).offset)),Un(mr(e,t,n,xr),Ar)}function Er(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,wn.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Wn(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>qn(qn(t,n,e),n+1,r),o)}else [o,s]=yr(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=kr(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>qn(e,t,Sr(t,d,i)),Jn()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function Dr(e){return Zn(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function Or(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function kr(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=pr(i,t-1,_r),s=i[c].offset;let e=Kn(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===Kn(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of Yn(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function Ar(e){return{index:e.index,value:e}}function jr(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var Mr={offsetHeight:`height`,offsetWidth:`width`},Nr=yn(([{log:e},{recalcInProgress:t}])=>{let n=K(),r=K(),i=_n(r,0),a=K(),o=K(),s=G(0),c=G([]),l=G(void 0),u=G(void 0),d=G(void 0),f=G(void 0),p=G((e,t)=>hr(e,Mr[t])),m=G(void 0),h=G(0),g=vr(),_=_n(U(n,W(c,e,h),fn(Er,g),un()),g),v=_n(U(c,un(),fn((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),H(({prev:e})=>e)),[]);B(U(c,V(e=>e.length>0),W(_,h),H(([e,t,n])=>{let r=e.reduce((e,r,i)=>qn(e,r,Sr(r,t.offsetTree,n)||i),Jn());return{...t,groupIndices:e,groupOffsetTree:r}})),_),B(U(r,W(_),V(([e,{lastIndex:t}])=>e<t),H(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),B(l,u);let y=_n(U(l,H(e=>e===void 0)),!0);B(U(u,V(e=>e!==void 0&&Wn(on(_).sizeTree)),H(e=>{let t=on(d),n=on(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),B(U(f,V(e=>e!==void 0&&e.length>0&&Wn(on(_).sizeTree)),H(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),B(U(c,W(d,u),V(([,e,t])=>e!==void 0&&t!==void 0),H(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=vn(U(n,W(_),fn(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),H(e=>e.changed)));rn(U(s,fn((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),H(e=>e.diff)),e=>{let{groupIndices:n}=on(_);if(e>0)z(t,!0),z(a,e+Or(e,n));else if(e<0){let t=on(v);t.length>0&&(e-=Or(-e,t)),z(o,e)}}),rn(U(s,W(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},wn.ERROR)});let x=vn(a);B(U(a,W(_),H(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Gn(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=Zn(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Zn(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=vn(U(o,W(_,h),H(([e,{offsetTree:t},n])=>Sr(-e,t,n))));return B(U(o,W(_,h),H(([e,t,n])=>{if(t.groupIndices.length>0){if(Wn(t.sizeTree))return t;let r=Jn(),i=on(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=Zn(t.sizeTree).reduce((t,{k:n,v:r})=>qn(t,Math.max(0,n+e),r),r),a!==-e){let n=Gn(t.sizeTree,s);r=qn(r,0,n);let i=Kn(t.sizeTree,-e+1)[1];r=qn(r,1,i)}return{...t,sizeTree:r,...kr(t.offsetTree,0,r,n)}}let r=Zn(t.sizeTree).reduce((t,{k:n,v:r})=>qn(t,Math.max(0,n+e),r),Jn());return{...t,sizeTree:r,...kr(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},R(Dn,dr),{singleton:!0});function Pr(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var Fr=yn(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=K(),o=K(),s=vn(U(a,H(Pr)));return B(U(s,H(e=>e.totalCount)),n),B(U(s,H(e=>e.groupIndices)),e),B(U(Sn(i,t,r),V(([e,t])=>gr(t)),H(([e,t,n])=>Kn(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),un(),H(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},R(Nr,Vn)),Ir=yn(([{log:e}])=>{let t=G(!1),n=vn(U(t,V(e=>e),un()));return rn(t,t=>{t&&on(e)(`props updated`,{},wn.DEBUG)}),{didMount:n,propsReady:t}},R(Dn),{singleton:!0}),Lr=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function Rr(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!Lr)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var zr=yn(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=K(),m=K(),h=G(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),z(c,!1)}return B(U(p,W(n,d,r,h,s,o,f),W(e,a,i),H(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=Rr(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=wr(b,n,w),E=Sr(T,n.offsetTree,d)+o;x===`end`?(E+=f+Kn(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+Kn(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},wn.DEBUG),z(p,e)):(z(m,!0),l(`list did not change, scroll successful`,{},wn.DEBUG))};if(y(),S===`smooth`){let e=!1;v=rn(t,t=>{e||=t}),g=sn(u,()=>{D(e)})}else g=sn(U(t,Br(150)),D);return _=setTimeout(()=>{y()},1200),z(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},wn.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},R(Nr,Vn,Dn),{singleton:!0});function Br(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Vr(e,t){e===0?t():requestAnimationFrame(()=>{Vr(e-1,t)})}function Hr(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Ur=yn(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=G(!0),c=G(0),l=G(!0);return B(U(o,W(c),V(([e,t])=>t!==0),dn(!1)),s),B(U(o,W(c),V(([e,t])=>t!==0),dn(!1)),l),rn(U(Sn(t,o),W(s,n,e,l),V(([[,e],t,{sizeTree:n},r,i])=>e&&(!Wn(n)||Qt(r))&&!t&&!i),W(c)),([,e])=>{sn(i,()=>{z(l,!0)}),Vr(4,()=>{sn(r,()=>{z(s,!0)}),z(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},R(Nr,Vn,zr,Ir),{singleton:!0});function Wr(e,t){return Math.abs(e-t)<1.01}var Gr=`up`,Kr=`down`,qr=`none`,Jr={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Yr=0,Xr=yn(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=G(!1),s=G(!0),c=K(),l=K(),u=G(4),d=G(Yr),f=_n(U(Cn(U(q(i),pn(1),dn(!0)),U(q(i),pn(1),dn(!1),cn(100))),un()),!1),p=_n(U(Cn(U(n,dn(!0)),U(n,dn(!1),cn(200))),un()),!1);B(U(Sn(q(i),q(d)),H(([e,t])=>e<=t),un()),s),B(U(s,mn(50)),l);let m=vn(U(Sn(r,q(a),q(t),q(e),q(u)),fn((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},Jr),un((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=_n(U(r,fn((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Wr(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),V(e=>e.changed),H(e=>e.jump)),0);B(U(m,H(e=>e.atBottom)),o),B(U(o,mn(50)),c);let g=G(Kr);B(U(r,H(({scrollTop:e})=>e),un(),fn((e,t)=>on(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Gr:Kr,prevScrollTop:t},{direction:Kr,prevScrollTop:0}),H(e=>e.direction)),g),B(U(r,mn(50),dn(qr)),g);let _=G(0);return B(U(f,V(e=>!e),dn(0)),_),B(U(i,mn(100),W(f),V(([e,t])=>t),fn(([e,t],[n])=>[t,n],[0,0]),H(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},R(Vn)),Zr=`top`,Qr=`bottom`,$r=`none`;function ei(e,t,n){return typeof e==`number`?n===Gr&&t===Zr||n===Kr&&t===Qr?e:0:n===Gr?t===Zr?e.main:e.reverse:t===Qr?e.main:e.reverse}function ti(e,t){return typeof e==`number`?e:e[t]??0}var ni=yn(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=K(),o=G(0),s=G(0),c=G(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:_n(U(Sn(q(r),q(i),q(n),q(a,ur),q(c),q(o),q(t),q(e),q(s)),H(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=$r,m=ti(l,Zr),h=ti(l,Qr);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=Gr),i<e-f+t+h&&(p=Kr),p===$r?null:[Math.max(u-n-ei(a,Zr,p)-m,0),u-f-s+t+ei(a,Qr,p)+h]}),V(e=>e!==null),un(ur)),[0,0])}},R(Vn),{singleton:!0});function ri(e,t,n){if(gr(t)){let r=Cr(e,t);return[{index:Kn(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var ii={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ai(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:si(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:si(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function oi(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=Hr(t,s);return ai(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function si(e,t,n){if(e.length===0)return[];if(!gr(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=Yn(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function ci(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var li=yn(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=G([]),g=G(0),_=K(),v=G(0);B(a.topItemsIndexes,h);let y=_n(U(Sn(p,m,q(c,ur),q(i),q(r),q(l),u,q(h),q(t),q(n),q(v),e),V(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),H(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=on(g);if(n===0)return{...ii,totalCount:n};if(e===0&&t===0)return m===0?{...ii,totalCount:n}:oi(m,i,r,s,c,u||[]);if(Wn(p))return m>0?null:ai(ri(Hr(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of Yn(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return ai([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=Tr(f,e,t,_);if(v.length===0)return null;let y=n-1,b=tn([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=ci(l,Zr),S=ci(l,Qr);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=Yn(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=Yn(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return ai(b,h,n,c,d,s)}),V(e=>e!==null),un()),ii);B(U(e,V(Qt),H(e=>e?.length)),i),B(U(y,H(e=>e.topListHeight)),d),B(d,s),B(U(y,H(e=>[e.top,e.bottom])),o),B(U(y,H(e=>e.items)),_);let b=vn(U(y,V(({items:e})=>e.length>0),W(i,e),V(([{items:e},t])=>e[e.length-1].originalIndex===t-1),H(([,e,t])=>[e-1,t]),un(ur),H(([e])=>e))),x=vn(U(y,mn(200),V(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),H(({items:e})=>e[0].index),un()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:vn(U(y,V(({items:e})=>e.length>0),H(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),un(lr))),startReached:x,topItemsIndexes:h,...f}},R(Nr,Fr,ni,Ur,zr,Xr,Ir,dr),{singleton:!0}),ui=yn(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=K(),o=_n(U(Sn(n,e,r,t,i),H(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return B(q(o),a),{totalListHeight:o,totalListHeightChanged:a}},R(Vn,li),{singleton:!0}),di=yn(([{viewportHeight:e},{totalListHeight:t}])=>{let n=G(!1);return{alignToBottom:n,paddingTopAddition:_n(U(Sn(n,e,t),V(([e])=>e),H(([,e,t])=>Math.max(0,e-t)),mn(0),un()),0)}},R(Vn,ui),{singleton:!0}),fi=yn(()=>({context:G(null)})),pi=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,mi=yn(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=K();return B(U(u,W(t,c,n,a,i,r,s),W(e),H(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=pi,done:d,...f}=e,p=wr(e,t,r-1),m=Sr(p,t.offsetTree,l)+i+a,h=m+Kn(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&sn(U(o,V(e=>!e),pn(on(o)?1:2)),d),_}),V(e=>e!==null)),l),{scrollIntoView:u}},R(Nr,Vn,zr,li,Dn),{singleton:!0});function hi(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var gi=(e,t)=>typeof e==`function`?hi(e(t)):t&&hi(e),_i=yn(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=G(!1),h=K(),g=null;function _(e){z(o,{align:`end`,behavior:e,index:`LAST`})}rn(U(Sn(U(q(t),pn(1)),c),W(q(m),a,s,d),H(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=gi(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),V(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),on(n)===void 0?g=sn(e,()=>{on(u)(`following output to `,{totalCount:r},wn.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{on(u)(`following output to `,{totalCount:r},wn.DEBUG),_(t)})});function v(e){let t=sn(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(on(u)(`scrolling to bottom due to increased size`,{},wn.DEBUG),_(`auto`))});setTimeout(t,100)}rn(U(Sn(q(m),t,l),V(([e,,t])=>e!==!1&&t),fn(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),V(({refreshed:e})=>e),W(m,t)),([,e])=>{on(s)&&v(e!==!1)}),rn(h,()=>{v(on(m)!==!1)}),rn(Sn(q(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=G(null),b=K();return B(Cn(U(q(r),H(e=>e?.length??0)),U(q(t))),b),rn(U(Sn(U(b,pn(1)),c),W(q(y),s,d,f),H(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),V(e=>!!e),mn(0)),t=>{g!==null&&(g(),g=null),on(n)===void 0?g=sn(e,()=>{on(u)(`scrolling into view`,{}),z(p,t),g=null}):requestAnimationFrame(()=>{on(u)(`scrolling into view`,{}),z(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},R(Nr,Xr,zr,Ur,Ir,Dn,Vn,fi,mi)),vi=yn(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(B(U(s,W(a),V(([,e])=>e!==0),W(i,r,t,n,e),H(([[,e],t,n,r,i,a=[]])=>oi(e,t,n,r,i,a))),o),{}),R(Nr,Ur,li,Ir),{singleton:!0}),yi=yn(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=G(0);return rn(U(e,W(r),V(([,e])=>e!==0),H(([,e])=>({top:e}))),e=>{sn(U(n,pn(1),V(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{z(t,e)})})}),{initialScrollTop:r}},R(Ir,Vn,li),{singleton:!0}),bi=yn(([{scrollVelocity:e}])=>{let t=G(!1),n=K(),r=G(!1);return B(U(e,W(r,t,n),V(([e,t])=>t!==!1&&t!==void 0),H(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),un()),t),rn(U(Sn(t,e,n),W(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},R(Xr),{singleton:!0}),xi=yn(([{scrollContainerState:e,scrollTo:t}])=>{let n=K(),r=K(),i=K(),a=G(!1),o=G(void 0);return B(U(Sn(n,r),H(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),B(U(t,W(r),H(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},R(Vn)),Si=yn(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=K(),u=G(void 0),d=G(null),f=G(null);return B(s,d),B(c,f),rn(U(l,W(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=Dr(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),B(U(u,V(Qt),H(Ci)),i),B(U(a,W(u),V(([,e])=>e!==void 0),un(),H(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},R(Nr,Vn,Ur,Ir,xi));function Ci(e){return{align:`start`,index:0,offset:e.scrollTop}}var wi=yn(([{topItemsIndexes:e}])=>{let t=G(0);return B(U(t,V(e=>e>=0),H(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},R(li));function Ti(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var Ei=Ti(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Di=yn(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return B(k,T.scrollSeekRangeChanged),B(U(T.windowViewportRect,H(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},R(Nr,Ur,Vn,Si,_i,li,zr,yn(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=vn(U(c,W(o),fn(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),V(([e])=>e!==0),W(r,s,n,i,p,m),V(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===Gr),H(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},wn.DEBUG),e))));function g(n){n>0?(z(t,{behavior:`auto`,top:-n}),z(e,0)):(z(e,0),z(t,{behavior:`auto`,top:-n}))}return rn(U(h,W(e,a)),([t,n,r])=>{r&&Ei()?z(e,n-t):g(-t)}),rn(U(Sn(_n(a,!1),e,m),V(([e,t,n])=>!e&&!n&&t!==0),H(([e,t])=>t),mn(1)),g),B(U(d,H(e=>({top:-e}))),t),rn(U(l,W(f,u),H(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=Gn(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{z(e,n),requestAnimationFrame(()=>{z(t,{top:n}),requestAnimationFrame(()=>{z(e,0),z(m,!1)})})}),{deviation:e}},R(Vn,Xr,li,Nr,Dn,dr)),wi,Fr,yn(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),R(ni,vi,Ir,bi,ui,yi,di,xi,mi,Dn,fi))));function Oi(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var ki=typeof document<`u`?I.useLayoutEffect:I.useEffect;function Ai(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=I.createContext({});function c(e,n){e.propsReady!==void 0&&z(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];z(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];z(i,n[r])}e.propsReady!==void 0&&z(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];z(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=gn(e[t.events[r]]),n),{})}return{Component:I.forwardRef(function(t,a){let{children:d,...f}=t,[p]=I.useState(()=>tn(xn(e),e=>{c(e,f)})),[m]=I.useState(Xt(u,p));ki(()=>{for(let e of o)e in f&&rn(m[e],f[e]);return()=>{Object.values(m).map(an)}},[f,m,p]),ki(()=>{c(p,f)}),I.useImperativeHandle(a,qt(l(p)));let h=n;return(0,L.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,L.jsx)(h,{...Oi([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=I.useContext(s)[e];ki(()=>rn(n,t),[t,n])},useEmitterValue:e=>{let t=I.useContext(s)[e],n=I.useCallback(e=>rn(t,e),[t]);return I.useSyncExternalStore(n,()=>on(t),()=>on(t))},usePublisher:e=>{let t=I.useContext(s);return I.useCallback(n=>{z(t[e],n)},[t,e])}}}var ji=I.createContext(void 0),Mi=I.createContext(void 0),Ni=`-webkit-sticky`,Pi=`sticky`,Fi=Ti(()=>{if(typeof document>`u`)return Pi;let e=document.createElement(`div`);return e.style.position=Ni,e.style.position===Ni?Ni:Pi}),Ii=typeof document<`u`?I.useLayoutEffect:I.useEffect;function Li(e){return`self`in e}function Ri(e){return`body`in e}function zi(e,t,n,r=en,i,a){let o=I.useRef(null),s=I.useRef(null),c=I.useRef(null),l=I.useCallback(n=>{let r,i,o,l=n.target;if(Ri(l)||Li(l)){let e=Li(l)?l:l.defaultView;o=a===!0?Nn(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?Nn(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Ht.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);I.useEffect(()=>{let e=i||o.current;return jn(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{jn(e),r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;Li(r)?(u=Math.max(hr(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?Nn(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=hr(r,a===!0?`width`:`height`),d=a===!0?Nn(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,Wr(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:Pn(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:Pn(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Bi(e){return e}var Vi=yn(([e,t])=>({...e,...t}),R(Di,yn(()=>{let e=G(e=>`Item ${e}`),t=G(e=>`Group ${e}`),n=G({}),r=G(Bi),i=G(`div`),a=G(en),o=(e,t=null)=>_n(U(n,H(t=>t[e]),un()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),Hi=({height:e})=>(0,L.jsx)(`div`,{style:{height:e}}),Ui={overflowAnchor:`none`,position:Fi(),zIndex:1},Wi={overflowAnchor:`none`},Gi={...Wi,display:`inline-block`,height:`100%`},Ki=I.memo(function({showTopList:e=!1}){let t=J(`listState`),n=la(`sizeRanges`),r=J(`useWindowScroll`),i=J(`customScrollParent`),a=la(`windowScrollContainerState`),o=la(`scrollContainerState`),s=i||r?a:o,c=J(`itemContent`),l=J(`context`),u=J(`groupContent`),d=J(`trackItemSizes`),f=J(`itemSize`),p=J(`log`),m=la(`gap`),h=J(`horizontalDirection`),{callbackRef:g}=Ln(n,f,d,e?en:s,p,m,i,h,J(`skipAnimationFrameInResizeObserver`)),[_,v]=I.useState(0);ca(`deviation`,e=>{_!==e&&v(e)});let y=J(`EmptyPlaceholder`),b=J(`ScrollSeekPlaceholder`)??Hi,x=J(`ListComponent`),S=J(`ItemComponent`),C=J(`GroupComponent`),w=J(`computeItemKey`),T=J(`isSeeking`),E=J(`groupIndices`).length>0,D=J(`alignToBottom`),O=J(`initialItemFinalLocationReached`),k=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?D?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,L.jsx)(y,{...Qi(y,l)}):(0,L.jsx)(x,{...Qi(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:k,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,I.createElement)(b,{...Qi(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,I.createElement)(C,{...Qi(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Ui},u(e.index,l)):(0,I.createElement)(S,{...Qi(S,l),...$i(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?Gi:Wi},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),qi={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Ji={outline:`none`,overflowX:`auto`,position:`relative`},Yi=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),Xi=(e,t,n=0)=>({...Yi(e),position:t?`relative`:`absolute`,top:t?-n:0}),Zi={position:Fi(),top:0,width:`100%`,zIndex:1};function Qi(e,t){if(typeof e!=`string`)return{context:t}}function $i(e,t){return{item:typeof e==`string`?void 0:t}}var ea=I.memo(function(){let e=J(`HeaderComponent`),t=la(`headerHeight`),n=J(`HeaderFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,J(`skipAnimationFrameInResizeObserver`)),i=J(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),ta=I.memo(function(){let e=J(`FooterComponent`),t=la(`footerHeight`),n=J(`HeaderFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,J(`skipAnimationFrameInResizeObserver`)),i=J(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})});function na({useEmitter:e,useEmitterValue:t,usePublisher:n}){return I.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=zi(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,L.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Ji:qi,...i},tabIndex:0,...o,...Qi(c,a),children:r})})}function ra({useEmitter:e,useEmitterValue:t,usePublisher:n}){return I.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=I.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=zi(s,l,c,t(`scrollerRef`),f);return Ii(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,L.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...Qi(c,a),children:r})})}var ia=({children:e})=>{let t=I.useContext(ji),n=la(`viewportHeight`),r=la(`fixedItemHeight`),i=J(`alignToBottom`),a=J(`horizontalDirection`),o=Fn(I.useMemo(()=>Yt(n,e=>hr(e,a?`width`:`height`)),[n,a]),!0,J(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:Yi(i),children:e})},aa=({children:e})=>{let t=I.useContext(ji),n=la(`windowViewportRect`),r=la(`fixedItemHeight`),i=J(`customScrollParent`),a=J(`useWindowScroll`),o=J(`topListHeight`),s=Bn(n,i,J(`skipAnimationFrameInResizeObserver`)),c=J(`alignToBottom`);return I.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:Xi(c,a,o),children:e})},oa=({children:e})=>{let t=J(`TopItemListComponent`)??`div`,n=J(`headerHeight`);return(0,L.jsx)(t,{style:{...Zi,marginTop:`${n}px`},...Qi(t,J(`context`)),children:e})},{Component:sa,useEmitter:ca,useEmitterValue:J,usePublisher:la}=Ai(Vi,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},I.memo(function(e){let t=J(`useWindowScroll`),n=J(`topItemsIndexes`).length>0,r=J(`customScrollParent`),i=J(`context`);return(0,L.jsxs)(r||t?da:ua,{...e,context:i,children:[n&&(0,L.jsx)(oa,{children:(0,L.jsx)(Ki,{showTopList:!0})}),(0,L.jsxs)(r||t?aa:ia,{children:[(0,L.jsx)(ea,{}),(0,L.jsx)(Ki,{}),(0,L.jsx)(ta,{})]})]})})),ua=na({useEmitter:ca,useEmitterValue:J,usePublisher:la}),da=ra({useEmitter:ca,useEmitterValue:J,usePublisher:la}),fa=sa,pa=yn(([e,t])=>({...e,...t}),R(Di,yn(()=>{let e=G(e=>(0,L.jsxs)(`td`,{children:[`Item $`,e]})),t=G(null),n=G(e=>(0,L.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=G(null),i=G(null),a=G({}),o=G(Bi),s=G(en),c=(e,t=null)=>_n(U(a,H(t=>t[e]),un()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),ma=({height:e})=>(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{style:{height:e}})}),ha=({height:e})=>(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),ga={overflowAnchor:`none`},_a={position:Fi(),zIndex:2,overflowAnchor:`none`},va=I.memo(function({showTopList:e=!1}){let t=Y(`listState`),n=Y(`computeItemKey`),r=Y(`firstItemIndex`),i=Y(`context`),a=Y(`isSeeking`),o=Y(`fixedHeaderHeight`),s=Y(`groupIndices`).length>0,c=Y(`itemContent`),l=Y(`groupContent`),u=Y(`ScrollSeekPlaceholder`)??ma,d=Y(`GroupComponent`),f=Y(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,I.createElement)(u,{...Qi(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,I.createElement)(d,{...Qi(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{..._a,top:o}},l(t.index,i)):(0,I.createElement)(f,{...Qi(f,i),...$i(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{..._a,top:o+g}:ga},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),ya=I.memo(function(){let e=Y(`listState`),t=Y(`topItemsIndexes`).length>0,n=wa(`sizeRanges`),r=Y(`useWindowScroll`),i=Y(`customScrollParent`),a=wa(`windowScrollContainerState`),o=wa(`scrollContainerState`),s=i||r?a:o,c=Y(`trackItemSizes`),{callbackRef:l,ref:u}=Ln(n,Y(`itemSize`),c,s,Y(`log`),void 0,i,!1,Y(`skipAnimationFrameInResizeObserver`)),[d,f]=I.useState(0);Ca(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=Y(`EmptyPlaceholder`),m=Y(`FillerRow`)??ha,h=Y(`TableBodyComponent`),g=Y(`paddingTopAddition`),_=Y(`statefulTotalCount`),v=Y(`context`);if(_===0&&p!=null)return(0,L.jsx)(p,{...Qi(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,L.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,L.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,L.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...Qi(h,v),children:[S,t&&(0,L.jsx)(va,{showTopList:!0}),(0,L.jsx)(va,{}),C]})}),ba=({children:e})=>{let t=I.useContext(ji),n=wa(`viewportHeight`),r=wa(`fixedItemHeight`),i=Fn(I.useMemo(()=>Yt(n,e=>hr(e,`height`)),[n]),!0,Y(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:Yi(!1),children:e})},xa=({children:e})=>{let t=I.useContext(ji),n=wa(`windowViewportRect`),r=wa(`fixedItemHeight`),i=Y(`customScrollParent`),a=Y(`useWindowScroll`),o=Bn(n,i,Y(`skipAnimationFrameInResizeObserver`));return I.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,L.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:Xi(!1,a),children:e})},{Component:Sa,useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}=Ai(pa,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},I.memo(function(e){let t=Y(`useWindowScroll`),n=Y(`customScrollParent`),r=wa(`fixedHeaderHeight`),i=wa(`fixedFooterHeight`),a=Y(`fixedHeaderContent`),o=Y(`fixedFooterContent`),s=Y(`context`),c=Fn(I.useMemo(()=>Yt(r,e=>hr(e,`height`)),[r]),!0,Y(`skipAnimationFrameInResizeObserver`)),l=Fn(I.useMemo(()=>Yt(i,e=>hr(e,`height`)),[i]),!0,Y(`skipAnimationFrameInResizeObserver`)),u=n||t?Ea:Ta,d=n||t?xa:ba,f=Y(`TableComponent`),p=Y(`TableHeadComponent`),m=Y(`TableFooterComponent`),h=a?(0,L.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...Qi(p,s),children:a()},`TableHead`):null,g=o?(0,L.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...Qi(m,s),children:o()},`TableFoot`):null;return(0,L.jsx)(u,{...e,...Qi(u,s),children:(0,L.jsx)(d,{children:(0,L.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...Qi(f,s),children:[h,(0,L.jsx)(ya,{},`TableBody`),g]})})})})),Ta=na({useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}),Ea=ra({useEmitter:Ca,useEmitterValue:Y,usePublisher:wa}),Da={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Oa={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:ka,floor:Aa,max:ja,min:Ma,round:Na}=Math;function Pa(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Fa(e){return{...Oa,items:e}}function Ia(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function La(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var Ra=yn(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=G(0),C=G(0),w=G(Da),T=G({height:0,width:0}),E=G({height:0,width:0}),D=K(),O=K(),k=G(0),A=G(null),j=G({column:0,row:0}),M=K(),ee=K(),N=G(!1),te=G(0),P=G(!0),F=G(!1),ne=G(!1);rn(U(m,W(te),V(([e,t])=>t!==0)),()=>{z(P,!1)}),rn(U(Sn(m,P,E,T,te,F),V(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{z(F,!0),Vr(1,()=>{z(D,e)}),sn(U(l),()=>{z(t,[0,0]),z(P,!0)})}),B(U(ee,V(e=>e!=null&&e.scrollTop>0),dn(0)),C),rn(U(m,W(ee),V(([,e])=>e!=null)),([,e])=>{e&&(z(T,e.viewport),z(E,e.item),z(j,e.gap),e.scrollTop>0&&(z(N,!0),sn(U(l,pn(1)),e=>{z(N,!1)}),z(c,{top:e.scrollTop})))}),B(U(T,H(({height:e})=>e)),d),B(U(Sn(q(T,Ia),q(E,Ia),q(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),q(l)),H(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),B(U(Sn(q(S),r,q(j,La),q(E,Ia),q(T,Ia),q(A),q(C),q(N),q(P),q(te)),V(([,,,,,,,e])=>!e),H(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return Da;if(p===0){let t=Hr(l,e);return Fa(Pa(t,t+Math.max(s-1,0),o))}let h=za(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Aa((t+d)/(f+d)),_=h*ka((n+d)/(f+d))-1,_=Ma(e-1,ja(_,h-1)),g=Ma(_,ja(0,g))):(g=0,_=-1);let v=Pa(g,_,o),{bottom:y,top:b}=Ba(a,r,i,v),x=ka(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),B(U(A,V(e=>e!==null),H(e=>e.length)),S),B(U(Sn(T,E,w,j),V(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),H(([e,t,{items:n},r])=>{let{bottom:i,top:a}=Ba(e,r,t,n);return[a,i]}),un(ur)),t);let re=G(!1);B(U(l,W(re),H(([e,t])=>t||e!==0)),re);let ie=vn(U(Sn(w,S),V(([{items:e}])=>e.length>0),W(re),V(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),H(([[,e]])=>e-1),un())),ae=vn(U(q(w),V(({items:e})=>e.length>0&&e[0].index===0),dn(0),un())),oe=vn(U(q(w),W(N),V(([{items:e},t])=>e.length>0&&!t),H(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),un(lr),mn(0)));B(oe,p.scrollSeekRangeChanged),B(U(D,W(T,E,S,j),H(([e,t,n,r,i])=>{let a=Rr(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=ja(0,l,Ma(r-1,l));let u=Va(t,i,n,l);return o===`end`?u=Na(u-t.height+n.height):o===`center`&&(u=Na(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let se=_n(U(w,H(e=>e.offsetBottom+e.bottom)),0);return B(U(b,H(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:ee,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:ne,initialTopMostItemIndex:te,totalListHeight:se,...f,endReached:ie,propsReady:h,rangeChanged:oe,startReached:ae,stateChanged:M,stateRestoreInProgress:N,...x}},R(ni,Vn,Xr,bi,Ir,xi,Dn));function za(e,t,n){return ja(1,Aa((e+n)/(Aa(t)+n)))}function Ba(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Va(e,t,n,r[0].index);return{bottom:Va(e,t,n,r[r.length-1].index)+i,top:a}}function Va(e,t,n,r){let i=Aa(r/za(e.width,n.width,t.column)),a=i*n.height+ja(0,i-1)*t.row;return a>0?a+t.row:a}var Ha=yn(([e,t])=>({...e,...t}),R(Ra,yn(()=>{let e=G(e=>`Item ${e}`),t=G({}),n=G(null),r=G(`virtuoso-grid-item`),i=G(`virtuoso-grid-list`),a=G(Bi),o=G(`div`),s=G(en),c=(e,n=null)=>_n(U(t,H(t=>t[e]),un()),n),l=G(!1),u=G(!1);return B(q(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),Ua=I.memo(function(){let e=Xa(`gridState`),t=Xa(`listClassName`),n=Xa(`itemClassName`),r=Xa(`itemContent`),i=Xa(`computeItemKey`),a=Xa(`isSeeking`),o=Za(`scrollHeight`),s=Xa(`ItemComponent`),c=Xa(`ListComponent`),l=Xa(`ScrollSeekPlaceholder`),u=Xa(`context`),d=Za(`itemDimensions`),f=Za(`gap`),p=Xa(`log`),m=Xa(`stateRestoreInProgress`),h=Za(`reportReadyState`),g=Fn(I.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:eo(`column-gap`,getComputedStyle(e).columnGap,p),row:eo(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return Ii(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,L.jsx)(c,{className:t,ref:g,...Qi(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,L.jsx)(l,{...Qi(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,I.createElement)(s,{...Qi(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),Wa=I.memo(function(){let e=Xa(`HeaderComponent`),t=Za(`headerHeight`),n=Xa(`headerFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,!1),i=Xa(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),Ga=I.memo(function(){let e=Xa(`FooterComponent`),t=Za(`footerHeight`),n=Xa(`headerFooterTag`),r=Fn(I.useMemo(()=>e=>{t(hr(e,`height`))},[t]),!0,!1),i=Xa(`context`);return e==null?null:(0,L.jsx)(n,{ref:r,children:(0,L.jsx)(e,{...Qi(e,i)})})}),Ka=({children:e})=>{let t=I.useContext(Mi),n=Za(`itemDimensions`),r=Za(`viewportDimensions`),i=Fn(I.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return I.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,L.jsx)(`div`,{ref:i,style:Yi(!1),children:e})},qa=({children:e})=>{let t=I.useContext(Mi),n=Za(`windowViewportRect`),r=Za(`itemDimensions`),i=Xa(`customScrollParent`),a=Xa(`useWindowScroll`),o=Bn(n,i,!1);return I.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,L.jsx)(`div`,{ref:o,style:Xi(!1,a),children:e})},{Component:Ja,useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za}=Ai(Ha,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},I.memo(function({...e}){let t=Xa(`useWindowScroll`),n=Xa(`customScrollParent`),r=n||t?$a:Qa,i=n||t?qa:Ka,a=Xa(`context`);return(0,L.jsx)(r,{...e,...Qi(r,a),children:(0,L.jsxs)(i,{children:[(0,L.jsx)(Wa,{}),(0,L.jsx)(Ua,{}),(0,L.jsx)(Ga,{})]})})})),Qa=na({useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za}),$a=ra({useEmitter:Ya,useEmitterValue:Xa,usePublisher:Za});function eo(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,wn.WARN),t===`normal`?0:parseInt(t??`0`,10)}function to(e){return e.blocks?.length??0}function no(e,t){if(t.size===0)return!1;if(t.has(e.anchor.uuid))return!0;for(let n of e.member_uuids)if(t.has(n))return!0;return!1}var ro=e=>({keep:e,droppedTop:0,droppedBottom:0,resetTopCursorTo:null,resetBottomCursorTo:null});function io(e,t,n){let{capBlocks:r,capItems:i}=t,a=0,o=0;for(let t=0;t<e.length;t++){let s=e[n?t:e.length-1-t],c=a+to(s);if(o>0&&(c>r||o+1>i))break;a=c,o+=1}return o}function ao(e){let{items:t,op:n,capBlocks:r,capItems:i,protectedUuids:a,fetchInFlight:o}=e;if(o||n===`reset`)return ro(t);let s=0;for(let e of t)s+=to(e);if(t.length<=i&&s<=r)return ro(t);if(n===`prepend`){let n=io(t,e,!0);for(let e=t.length-1;e>=n;e--)if(no(t[e],a)){n=e+1;break}if(n>=t.length)return ro(t);let r=t.slice(0,n);return{keep:r,droppedTop:0,droppedBottom:t.length-n,resetTopCursorTo:null,resetBottomCursorTo:r[r.length-1].anchor.id}}let c=t.length-io(t,e,!1),l=c;for(let e=0;e<c;e++)if(no(t[e],a)){l=e;break}if(l<=0)return ro(t);let u=t.slice(l);return{keep:u,droppedTop:l,droppedBottom:0,resetTopCursorTo:u[0].anchor.id,resetBottomCursorTo:null}}var oo=1e6;function so(e,t){let n=e-t.addedTop+t.droppedTop;return n<0?0:n}var co=500,lo=[100,250],uo=Symbol(`page-fetch-failed`),fo=10,po=2*co,mo=4e3;async function ho(e,t,n){let r=await de(t,n),i=he(r);if(i!=null)throw new Se(i);return g(e)?we(e,r):r}function go(e,t={}){let n=e?a(e):null,r=n?p(n):null,{outlineTurns:i,outlinePositions:o,openIntent:s,protectedUuids:c,growthNonce:l=0,live:u=!1}=t,d=(0,I.useRef)(c);d.current=c;let[f,m]=(0,I.useState)({detail:null,firstItemIndex:oo}),h=f.detail,[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(0),[T,E]=(0,I.useState)(null),[D,k]=(0,I.useState)(null),A=(0,I.useRef)(0),j=(0,I.useCallback)(e=>{let t={rev:++A.current,...e};return k(t),t},[]),[M,ee]=(0,I.useState)(0),[N,te]=(0,I.useState)(null),P=(0,I.useRef)(null),F=(0,I.useRef)(null),[ne,re]=(0,I.useState)(!1),ie=(0,I.useRef)(!1);ie.current=ne;let ae=(0,I.useRef)(!1),oe=(0,I.useRef)(!1),se=(0,I.useRef)(0),[ce,ue]=(0,I.useState)(!1),de=(0,I.useCallback)(()=>{se.current+=1,se.current===1&&ue(!0)},[]),pe=(0,I.useCallback)(()=>{se.current=Math.max(0,se.current-1),se.current===0&&ue(!1)},[]),he=(0,I.useRef)(null),_e=(0,I.useRef)(()=>Promise.resolve()),ve=(0,I.useRef)(`none`),ye=(0,I.useRef)(!1),be=(0,I.useRef)({found:!1,direction:`none`,exhausted:!0,failed:!1,terminalOpRev:0}),xe=(0,I.useRef)(null),Ce=(0,I.useRef)(n),we=(0,I.useRef)(!1),Te=(0,I.useRef)(!1),Ee=(0,I.useRef)(!1),De=(0,I.useRef)(null),Oe=(0,I.useRef)(i);Oe.current=i;let je=(0,I.useRef)(o);je.current=o;let Me=(0,I.useCallback)(e=>{m(t=>{let n=typeof e==`function`?e(t.detail):e;return De.current=n,{detail:n,firstItemIndex:t.firstItemIndex}})},[]),Pe=(0,I.useCallback)(e=>{m(()=>(De.current=e,{detail:e,firstItemIndex:oo})),P.current=e.page.next_after,F.current=e.page.prev_before??null,re(e.page.has_prev??!1),j({op:`reset`,addedTop:0,addedBottom:0,droppedTop:0,droppedBottom:0})},[j]),Fe=(0,I.useCallback)(()=>{r&&(b(null),S(null),v(!0),w(e=>e+1))},[r]);(0,I.useEffect)(()=>{if(xe.current=r,Ce.current=n,!r){Me(null),te(null),v(!1),b(null),S(null),P.current=null,F.current=null,re(!1),E(null);return}v(!0),b(null),S(null),Me(null),P.current=null,F.current=null,re(!1),E(null);let e=new AbortController,t=s?.kind;return ho(n,ke(n,`detail`,t==null?{limit:co}:{tail:1,limit:co}),e.signal).then(n=>{e.signal.aborted||xe.current!==r||(Pe(n),te(r),v(!1),t===`tail`?E(n.page.has_prev?`bottom`:`top`):t??E(null))}).catch(t=>{if(!(fe(t)||e.signal.aborted||xe.current!==r)){if(t instanceof ge&&t.status===404){b(`Conversation not found.`),v(!1);return}if(t instanceof Se){S(le(t.reason)),b(null),v(!1);return}b(t instanceof Ae?`Conversation indexing is still finishing.`:`Couldn't load the conversation.`),v(!1)}}),()=>e.abort()},[r,s?.kind,s&&`uuid`in s?s.uuid:null,C,Me,Pe]);let Ie=(0,I.useCallback)(async()=>{let e=P.current,t=xe.current,n=Ce.current;if(e==null||t==null||n==null||ae.current)return null;ae.current=!0,de();try{let r;try{r=await ho(n,ke(n,`detail`,{limit:co,after:e}))}catch(e){return e instanceof Se&&xe.current===t&&(S(le(e.reason)),b(null)),uo}return xe.current===t?(Me(e=>e?{...e,items:[...e.items,...r.items],page:{...e.page,next_after:r.page.next_after,has_more:r.page.has_more},subagent_meta:r.subagent_meta??e.subagent_meta,session_index:r.session_index??e.session_index}:r),P.current=r.page.next_after,j({op:`append`,addedTop:0,addedBottom:r.items.length,droppedTop:0,droppedBottom:0})):null}finally{ae.current=!1,pe()}},[Me,j]),Re=(0,I.useCallback)(async()=>{let e=await Ie();return e===uo?null:e},[Ie]),ze=(0,I.useCallback)(async()=>{let e=F.current,t=xe.current,n=Ce.current;if(e==null||t==null||n==null||oe.current)return null;oe.current=!0,de();try{let r;try{r=await ho(n,ke(n,`detail`,{limit:co,before:e}))}catch(e){return e instanceof Se&&xe.current===t&&(S(le(e.reason)),b(null)),uo}if(xe.current!==t)return null;let i=new Set((De.current?.items??[]).map(e=>e.anchor.uuid)),a=r.items.filter(e=>!i.has(e.anchor.uuid));return m(e=>{let t=e.detail,n=t?{...t,items:[...a,...t.items],page:{...t.page,prev_before:r.page.prev_before??null,has_prev:r.page.has_prev??!1},subagent_meta:r.subagent_meta??t.subagent_meta,session_index:r.session_index??t.session_index}:r;return De.current=n,{detail:n,firstItemIndex:so(e.firstItemIndex,{addedTop:a.length,droppedTop:0})}}),F.current=r.page.prev_before??null,re(r.page.has_prev??!1),j({op:`prepend`,addedTop:a.length,addedBottom:0,droppedTop:0,droppedBottom:0})}finally{oe.current=!1,pe()}},[Me,j]),Be=(0,I.useCallback)(async()=>{let e=await ze(),t=e===uo?null:e;return t&&t.addedTop>0?t:null},[ze]),Ve=(0,I.useCallback)(async e=>{let t=xe.current;if(t==null)return{found:!1,direction:`none`,exhausted:!1,failed:!1,terminalOpRev:A.current};let n=he.current;if(n)return await n,be.current;let r=()=>{};he.current=new Promise(e=>{r=e});try{await He(e,t)}finally{he.current=null,r()}let i=ve.current;return be.current={found:De.current?.items.some(t=>t.member_uuids.includes(e))??!1,direction:i,exhausted:i===`backward`?F.current==null:i===`forward`?P.current==null:!0,failed:ye.current,terminalOpRev:A.current},be.current},[]),He=(0,I.useCallback)((e,t)=>_e.current(e,t),[]);_e.current=(0,I.useCallback)(async(e,t)=>{ve.current=`none`,ye.current=!1;let n=()=>{let t=De.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};if(n())return;let r=e=>{m(t=>{let n=t.detail;if(!n)return t;let r=ao({items:n.items,op:e,capBlocks:mo,capItems:po,protectedUuids:d.current??new Set,fetchInFlight:!1});if(r.keep===n.items)return t;if(r.droppedBottom>0){P.current=r.resetBottomCursorTo;let e={...n,items:r.keep,page:{...n.page,next_after:r.resetBottomCursorTo,has_more:!0}};return De.current=e,{detail:e,firstItemIndex:t.firstItemIndex}}F.current=r.resetTopCursorTo,queueMicrotask(()=>re(!0));let i={...n,items:r.keep,page:{...n.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return De.current=i,{detail:i,firstItemIndex:so(t.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}})},i=()=>new Promise(e=>{setTimeout(e,0)}),a=async e=>{for(let n=0;;n++){let r=await e();if(r!==uo)return r;if(n===lo.length)return ye.current=!0,null;if(await new Promise(e=>{setTimeout(e,lo[n])}),xe.current!==t)return null}},o=Oe.current??[],s=je.current,c=s!=null&&s.has(e);if(o.length===0&&!c){ve.current=`forward`;let e=t;for(;;){if(n())return;let t=await a(Ie);if(ye.current)return;if(t&&P.current!=null){if(r(`append`),await i(),xe.current!==e)return;continue}if(P.current==null||xe.current!==e)return;for(;ae.current&&xe.current===e;)await i();if(xe.current!==e)return}}let l=c?null:Le(o),u=e=>c?s.get(e):Ne(l,e),f=u(e);if(f===void 0)return;let p=De.current?.items??[],h=e=>{for(let t of e.member_uuids){let e=u(t);if(e!==void 0)return e}},g,_;for(let e of p){let t=h(e);t!==void 0&&((g===void 0||t<g)&&(g=t),(_===void 0||t>_)&&(_=t))}let v=g!==void 0&&f<g;if(ve.current=v?`backward`:`forward`,v)for(;;){if(n())return;let e=await a(ze);if(ye.current)return;if(e&&F.current!=null){if(r(`prepend`),await i(),xe.current!==t)return;continue}if(F.current==null||xe.current!==t)return;for(;oe.current&&xe.current===t;)await i();if(xe.current!==t)return}else for(;;){if(n())return;let e=await a(Ie);if(ye.current)return;if(e&&P.current!=null){if(r(`append`),await i(),xe.current!==t)return;continue}if(P.current==null||xe.current!==t)return;for(;ae.current&&xe.current===t;)await i();if(xe.current!==t)return}},[Ie,ze]);let Ue=(0,I.useCallback)(async()=>{let e=xe.current,t=Ce.current;if(e==null||t==null)return!1;let n;try{n=await ho(t,ke(t,`detail`,{tail:1,limit:co}))}catch(t){return t instanceof Se&&xe.current===e&&(S(le(t.reason)),b(null)),!1}return xe.current===e?(Pe(n),!0):!1},[Pe]),We=h!=null&&N===r,Ge=We?h:null,Ke=r!=null&&!We&&y==null&&x==null?!0:_,qe=Ge?.page?.next_after!=null;we.current=qe;let Je=Ge?.page?.prev_before??null,Ye=(0,I.useCallback)(async()=>{if(Te.current){Ee.current=!0;return}let e=xe.current,t=Ce.current;if(!(!e||!t||we.current||ae.current)){Te.current=!0;try{for(let n=0;n<50;n++){let n=De.current?.items??[];if(!n.length)break;let r=Math.max(0,n.length-fo),i=r>0?g(t)?n[r-1].anchor.uuid:n[r-1].anchor.id:null,a;try{a=await ho(t,ke(t,`detail`,{limit:co,after:i??void 0}))}catch(t){t instanceof Se&&xe.current===e&&(S(le(t.reason)),b(null));break}if(xe.current!==e)return;let o=a.items,s,c=0,l=!1;if(o.length===0)s=n;else{l=!0;let e=new Map(o.map(e=>[e.anchor.id,e])),t=new Set(n.map(e=>e.anchor.id)),i=n.slice(0,r),a=n.slice(r);s=[...i];for(let t of a){let n=e.get(t.anchor.id);n!==void 0&&s.push(n)}for(let e of o)t.has(e.anchor.id)||(s.push(e),c+=1)}if(Me(e=>e&&{...e,items:s,cost_usd:a.cost_usd,models:a.models,title:a.title??e.title,git_branch:a.git_branch,project_label:a.project_label,last_anchor:a.last_anchor??e.last_anchor,last_activity_utc:a.last_activity_utc??e.last_activity_utc,subagent_meta:a.subagent_meta??e.subagent_meta,session_index:a.session_index??e.session_index,provider_meta:a.provider_meta??e.provider_meta,page:e.page}),l&&ee(e=>e+1),l&&j({op:`append`,addedTop:0,addedBottom:c,droppedTop:0,droppedBottom:0}),c===0||a.page.next_after==null)break}}finally{Te.current=!1,Ee.current&&(Ee.current=!1,Ye())}}},[Me,j]);return(0,I.useEffect)(()=>{u||De.current&&!we.current&&Ye()},[me(O()),u]),(0,I.useEffect)(()=>{l!==0&&De.current&&!we.current&&Ye()},[l]),(0,I.useEffect)(()=>{let e=D;if(!e||e.trim||e.op!==`append`&&e.op!==`prepend`)return;let t=ae.current||oe.current||Te.current,n=De.current?.items;if(!n)return;let r=ao({items:n,op:e.op,capBlocks:mo,capItems:po,protectedUuids:d.current??new Set,fetchInFlight:t});if(r.keep!==n){if(r.droppedBottom>0)P.current=r.resetBottomCursorTo,Me(e=>e&&{...e,items:r.keep,page:{...e.page,next_after:r.resetBottomCursorTo,has_more:!0}});else if(r.droppedTop>0)F.current=r.resetTopCursorTo,re(!0),m(e=>{let t=e.detail;if(!t)return e;let n={...t,items:r.keep,page:{...t.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return De.current=n,{detail:n,firstItemIndex:so(e.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}});else return;j({op:`append`,addedTop:0,addedBottom:0,droppedTop:r.droppedTop,droppedBottom:r.droppedBottom,trim:!0})}},[D?.rev]),{detail:Ge,loading:Ke,error:y,degraded:x,retry:Fe,hasMore:qe,hasPrev:ne,prevBefore:Je,openScrollIntent:T,lastOp:D,loadMore:Re,loadPrev:Be,loadToTarget:Ve,jumpToLatest:Ue,fetching:ce,tailRevision:M,virtualFirstItemIndex:f.firstItemIndex}}function _o(){let[e,t]=(0,I.useState)(`full`),n=(0,I.useRef)(null),r=(0,I.useCallback)(e=>{let n=e.getBoundingClientRect().width;t(n>0&&n<720?`compact`:`full`)},[]),i=(0,I.useCallback)(e=>{if(n.current?.disconnect(),n.current=null,e&&(r(e),typeof ResizeObserver<`u`)){let t=new ResizeObserver(()=>r(e));t.observe(e),n.current=t}},[r]);return(0,I.useEffect)(()=>()=>{n.current?.disconnect()},[]),{density:e,readerRef:i}}function vo(e){let t=[],n=[],r=()=>{n.length>=2?t.push({kind:`tool_result_run`,items:n}):n.length===1&&t.push({kind:`item`,item:n[0]}),n=[]};for(let i of e){if(i.kind===`item`&&i.item.kind===`tool_result`){n.push(i.item);continue}r(),t.push(i)}return r(),t}function yo(e,t){let n=new Map,r=new Map;for(let t of e){let e=t.subagent_key;if(e!=null){let r=n.get(e);r?r.push(t):n.set(e,[t])}else for(let e of t.member_uuids)r.set(e,t)}let i=new Map;for(let e of n.keys()){let a=t?.[e];if(a&&a.parent_subagent_key!==void 0){let t=a.parent_subagent_key??null,o=a.spawn_uuid??null;t!=null&&n.has(t)?i.set(e,{where:`subagent`,parentKey:t,anchorUuid:o}):t==null&&o!=null&&r.has(o)?i.set(e,{where:`main`,anchorUuid:o}):i.set(e,{where:`top`});continue}let o=n.get(e),s=o.find(e=>e.kind!==`meta`)??o[0],c=s.parent_uuid==null?void 0:r.get(s.parent_uuid);i.set(e,c?{where:`main`,anchorUuid:c.anchor.uuid}:{where:`top`})}let a=new Map,o=new Map;for(let[e,t]of i)if(t.where===`subagent`){let n=o.get(t.parentKey);n?n.push(e):o.set(t.parentKey,[e])}let s=(e,t,r)=>{let c=a.get(e);if(c)return c;let l=i.get(e),u={kind:`subagent`,subagentKey:e,items:n.get(e),nested:l.where!==`top`,depth:t,spawnAnchorUuid:l.where===`top`?null:l.anchorUuid??null,children:[]};return a.set(e,u),r.add(e),u.children=(o.get(e)??[]).filter(e=>!r.has(e)).map(e=>s(e,t+1,r)),r.delete(e),u},c=new Map;for(let[e,t]of i)if(t.where===`main`){let n=c.get(t.anchorUuid);n?n.push(e):c.set(t.anchorUuid,[e])}let l=[],u=new Set,d=e=>{if(!u.has(e)){u.add(e);for(let t of o.get(e)??[])d(t)}},f=e=>{l.push(s(e,0,new Set)),d(e)};for(let t of e)if(t.subagent_key==null){l.push({kind:`item`,item:t});for(let e of c.get(t.anchor.uuid)??[])u.has(e)||f(e)}else{let e=t.subagent_key;if(u.has(e))continue;i.get(e).where===`top`&&f(e)}for(let e of n.keys())u.has(e)||f(e);return vo(l)}function bo(e,t){for(let n of e)n.kind===`subagent`&&(t(n),n.children.length&&bo(n.children,t))}function xo(e){let t=[];return bo(e,e=>t.push(e)),t}var So=RegExp(`^\\s*(?:<(${[`command-name`,`command-message`,`command-args`,`local-command-caveat`,`local-command-stdout`,`local-command-stderr`].join(`|`)})>(?:(?!</\\1>)[\\s\\S])*</\\1>\\s*)+$`);function Co(e){return e?So.test(e):!1}var wo=200;function To(e){return e!=null&&`semantics`in e&&e.semantics===`occurrence`}var Eo=class extends Error{notice;constructor(e){let t=le(e);super(t.message),this.name=`ConversationFindDegraded`,this.notice=t}};function Do(e,t,n={}){let r=a(e),i=p(r),{regex:o=!1,case:s=!1,tailRevision:c=0}=n,l=t.trim(),u=Qe(l,wo,``),d=Qe(c,wo,0),f=JSON.stringify([i,u,o,s]),[m,h]=(0,I.useState)(null),[_,v]=(0,I.useState)(0),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(null),[C,w]=(0,I.useState)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useCallback)(e=>g(r)?Pe(e):e,[i]),j=(0,I.useCallback)(e=>{if(h(e),To(e)){v(0);let t=e.page.occurrences[0]??null;return O.current=t?.occurrence_id??null,t}let t=O.current,n=t?Math.max(0,e.anchors.findIndex(e=>e.uuid===t)):0;v(n);let r=e.anchors[n]??null;return O.current=r?.uuid??null,r},[]),M=(0,I.useCallback)(async({cursor:e,direction:t,around:n,signal:i}={})=>{let a=await de(ke(r,`find`,{q:u,regex:o||void 0,case:s||void 0,...g(r)&&r.source===`codex`?{limit:100,cursor:e,direction:t&&(e||t===`previous`)?t:void 0,around:n}:{}}),i),c=he(a);if(c!=null)throw new Eo(c);return A(a)},[i,u,o,s,A]);(0,I.useEffect)(()=>(l||(T.current?.abort(),E.current?.abort(),h(null),v(0),O.current=null,k.current=null,S(null),w(null),b(!1)),()=>{T.current?.abort(),E.current?.abort()}),[l]),(0,I.useEffect)(()=>{if(!u){b(!1);return}let e=new AbortController;return T.current?.abort(),E.current?.abort(),T.current=e,D.current=null,b(!0),M({around:To(m)&&k.current===f?O.current??void 0:void 0,signal:e.signal}).then(t=>{e.signal.aborted||(j(t),k.current=f,w(null),S(null),b(!1))}).catch(t=>{if(!(fe(t)||e.signal.aborted||T.current!==e)){if(t instanceof Eo){h(null),v(0),O.current=null,k.current=null,w(t.notice),S(null),b(!1);return}h(null),O.current=null,k.current=null,w(null),S(t instanceof ge&&t.status===400?`invalid regex`:`find failed`),b(!1)}}),()=>e.abort()},[i,u,o,s,d,f,M,j]);let ee=(0,I.useCallback)(e=>{if(!m||e===0)return null;if(!To(m)){if(m.anchors.length===0)return null;let t=((_+e)%m.anchors.length+m.anchors.length)%m.anchors.length;v(t);let n=m.anchors[t];return O.current=n.uuid,n}if(m.status!==`ready`||m.page.occurrences.length===0)return null;let t=_+(e>0?1:-1);if(t>=0&&t<m.page.occurrences.length){v(t);let e=m.page.occurrences[t];return O.current=e.occurrence_id,e}if(D.current)return D.current;let n=new AbortController;E.current=n;let r=e>0,i=r?m.page.next_cursor:m.page.previous_cursor,a=r?`next`:`previous`,o=(async()=>{try{let e;try{if(e=await M({cursor:i??void 0,direction:a,signal:n.signal}),n.signal.aborted)return null}catch(t){if(n.signal.aborted)return null;if(!(t instanceof ge)||t.status!==409)throw t;if(e=await M({around:O.current??void 0,signal:n.signal}),n.signal.aborted)return null;if(To(e)&&!e.selection_stale){let t=e.page.occurrences.findIndex(e=>e.occurrence_id===O.current),i=t+(r?1:-1);if(t>=0&&i>=0&&i<e.page.occurrences.length){h(e),v(i);let t=e.page.occurrences[i];return O.current=t.occurrence_id,w(null),S(null),t}let o=r?e.page.next_cursor:e.page.previous_cursor;if(t>=0&&o&&(e=await M({cursor:o,direction:a,signal:n.signal}),n.signal.aborted))return null}}if(!To(e))return w(null),j(e);h(e);let t=r?0:Math.max(0,e.page.occurrences.length-1);v(t);let o=e.page.occurrences[t]??null;return O.current=o?.occurrence_id??null,w(null),S(null),o}catch(e){return fe(e)||n.signal.aborted||E.current!==n||(e instanceof Eo?(w(e.notice),S(null)):(w(null),S(`find failed`))),null}finally{E.current===n&&(E.current=null,D.current=null)}})();return D.current=o,o},[m,_,M,j]),N=To(m),te=N||!m?[]:m.anchors,P=N?m.page.occurrences:[],F=(N?P:te)[_]??null,ne=N?m.page.start_index+(F?_:0):F?_:0,re=N?m.total??0:m?.total??0,ie=l!==``&&(l!==u||y);return{anchors:te,occurrences:P,selected:F,selectedIndex:ne,total:re,truncated:!N&&m?m.anchors_truncated:!1,semantics:N?`occurrence`:`section`,status:N?m.status:`ready`,selectionStale:N?m.selection_stale:!1,mode:m?.mode??null,loading:ie,error:x,degraded:C,step:ee}}var Oo=`cctally.conv.find.regex`,ko=`cctally.conv.find.case`;function Ao(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function jo(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function Mo(){return Ao(Oo)}function No(e){jo(Oo,e)}function Po(){return Ao(ko)}function Fo(e){jo(ko,e)}function Io({sessionId:e,onClose:t,onTermsChange:n,onExactFindChange:r,stepRef:i,tailRevision:o=0}){let s=typeof e!=`string`,c=a(e),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(Mo),[m,h]=(0,I.useState)(Po),{selected:g,occurrences:_,selectedIndex:v,total:y,truncated:b,semantics:S,status:C,selectionStale:w,mode:T,loading:E,error:D,degraded:O,step:k}=Do(c,u,{regex:f,case:m,tailRevision:o}),A=(0,I.useRef)(null),j=(0,I.useRef)(null);(0,I.useEffect)(()=>{A.current?.focus()},[]);let M=Qe(u.trim(),200,``);(0,I.useEffect)(()=>{n(S===`occurrence`?``:M,m,f)},[M,f,m,S,n]),(0,I.useEffect)(()=>{if(r)return r(S===`occurrence`?{occurrences:_,selectedOccurrenceId:g&&`occurrence_id`in g?g.occurrence_id:null}:null),()=>r(null)},[S,_,g,r]);let ee=e=>{if(!e)return;let t=`occurrence_id`in e?e:null;l({type:`OPEN_CONVERSATION`,conversationRef:c,jump:x(c,e.uuid,s,{expandDetails:t?t.disclosure.length>0:e.match_kinds.length>0,findOccurrence:t})})},N=e=>{let t=k(e);t instanceof Promise?t.then(ee):ee(t)},te=(0,I.useRef)(null);(0,I.useEffect)(()=>{S!==`occurrence`||!g||!(`occurrence_id`in g)||te.current!==g.occurrence_id&&(te.current=g.occurrence_id,ee(g))},[S,g,c.key]),i&&(i.current=N),(0,I.useEffect)(()=>()=>{i&&(i.current=null)},[i]);let P=()=>{l({type:`CLOSE_CONV_FIND`}),t()},F=()=>p(e=>{let t=!e;return No(t),t}),ne=()=>h(e=>{let t=!e;return Fo(t),t}),re=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),N(e.shiftKey?-1:1))},ie=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),P();return}if(e.key!==`Tab`)return;let t=j.current;if(!t)return;let n=Array.from(t.querySelectorAll(`input, button`)).filter(e=>!e.disabled);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())},ae=g!=null,oe=g,se=C===`indexing`?`indexing exact matches`:S===`occurrence`?`${ae?v+1:0} / ${y} matches`:`${ae?v+1:0} / ${y} containing sections`,ce=[f&&`regex`,m&&`case`].filter(Boolean).join(` · `);return(0,L.jsxs)(`div`,{className:`conv-findbar`,role:`search`,"aria-label":`Find within this conversation`,ref:j,onKeyDown:ie,children:[(0,L.jsx)(`input`,{ref:A,className:`conv-findbar-input`,type:`text`,"aria-label":`Find in conversation`,placeholder:`Find…`,value:u,onChange:e=>d(e.target.value),onKeyDown:re}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":f,"aria-label":`Regular expression`,title:`Regular expression (.*)`,onClick:F,children:`.*`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":m,"aria-label":`Case-sensitive`,title:`Case-sensitive (Aa)`,onClick:ne,children:`Aa`}),ce&&(0,L.jsx)(`span`,{className:`conv-findbar-mode`,"aria-label":`search mode: ${ce}`,children:ce}),(0,L.jsxs)(`span`,{className:`conv-findbar-count`,"aria-live":`polite`,children:[se,b&&(0,L.jsx)(`span`,{className:`conv-findbar-note`,children:` · first 500`}),w&&(0,L.jsx)(`span`,{className:`conv-findbar-note`,children:` · previous match changed`})]}),oe&&oe.match_kinds.length>0&&(0,L.jsx)(`span`,{className:`conv-findbar-kind`,children:oe.match_kinds.join(` `)}),T===`like`&&!D&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,children:`basic search`}),O&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:O.message}),D&&(0,L.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:D}),E&&(0,L.jsx)(`span`,{className:`conv-findbar-spin`,"aria-hidden":`true`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,disabled:!ae,onClick:()=>N(-1),children:`‹`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Next match`,title:`Next match (Enter)`,disabled:!ae,onClick:()=>N(1),children:`›`}),(0,L.jsx)(`button`,{type:`button`,className:`conv-findbar-close`,"aria-label":`Close find`,title:`Close (Esc)`,onClick:P,children:`✕`})]})}function Lo(){let[e,t]=(0,I.useState)(!1),n=(0,I.useRef)(null),r=(0,I.useRef)(!0);return(0,I.useEffect)(()=>()=>{r.current=!1,n.current!=null&&window.clearTimeout(n.current)},[]),{copied:e,copy:(0,I.useCallback)(e=>{let i=()=>{r.current&&(t(!0),n.current!=null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t(!1),n.current=null},1100))};if(navigator.clipboard?.writeText){navigator.clipboard.writeText(e).then(i).catch(()=>{});return}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),i()}catch{}},[])}}function Ro(e,t,n){if(n<=0)return null;switch(e){case`ArrowDown`:return(t+1)%n;case`ArrowUp`:return(t-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return null}}function zo(e,t,n){let r=(0,I.useRef)(n);r.current=n,(0,I.useEffect)(()=>{if(!t||typeof document>`u`)return;let n=t=>{let n=e.current;n&&!n.contains(t.target)&&r.current()};return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[t,e])}var Bo=`A-Za-z0-9_.-`,Vo=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Ho(e,t){if(t.tokens.length){let n=t.tokens.map(e=>e.bounded?`(?<![${Bo}])${Vo(e.text)}(?![${Bo}])`:Vo(e.text)).join(`|`),r=new Map(t.tokens.map(e=>[e.text,e.replacement]));e=e.replace(new RegExp(n,`g`),e=>r.get(e)??`(unknown)`)}for(let n of t.patterns){let t=new RegExp(n.source,n.ignoreCase?`gi`:`g`);e=e.replace(t,(e,t)=>`${n.keepGroup1&&typeof t==`string`?t:``}[REDACTED:${n.name}]`)}return e}var Uo=class extends Error{status;undecodableCwdRows;ambiguousCwdRows;constructor(e,t,n){super(`anon request failed: ${e}`),this.name=`AnonRequestError`,this.status=e,this.undecodableCwdRows=t,this.ambiguousCwdRows=n}};function Wo(e){return e.ambiguousCwdRows===null?`Anonymized copy is unavailable: ${e.undecodableCwdRows??0} Codex project path(s) could not be read. Run cctally cache-sync --source codex --rebuild.`:`Anonymized copy is unavailable: ${e.ambiguousCwdRows} Codex project path(s) cannot be safely attributed to this account. Use a raw export or omit the account scope.`}async function Go(e){let t=null,n=null;if(e.status===409&&typeof e.json==`function`)try{let r=await e.json();typeof r?.undecodable_cwd_rows==`number`&&(t=r.undecodable_cwd_rows),r?.reason===`ambiguous_account_provenance`&&typeof r.ambiguous_cwd_rows==`number`&&(n=r.ambiguous_cwd_rows)}catch{}return new Uo(e.status,t,n)}function Ko(e){let t=e;if(!t||!Array.isArray(t.tokens)||!Array.isArray(t.patterns))throw Error(`malformed anon-map`);return t}var qo=new Map;function Jo(e){let t=a(e),n=p(t),r=qo.get(n);if(!r){r=fetch(ke(t,`anon-map`)).then(async e=>{if(!e.ok)throw await Go(e);return Ko(await e.json())});let e=()=>{qo.get(n)===r&&qo.delete(n)};r.then(e,e),qo.set(n,r)}return r}var Yo=[{scope:`all`,label:`Whole transcript`},{scope:`prompts`,label:`Prompts only`},{scope:`chat`,label:`Chat only`},{scope:`recipe`,label:`Replay recipe`}];function Xo(e,t){return(e??``).normalize(`NFKD`).replace(/[^\x20-\x7E]/g,``).replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||t.slice(0,12)}function Zo(e,t,n){return ke(a(e),`export`,{scope:t,anonymize:n||void 0})}async function Qo(e,t,n){let r=await fetch(Zo(e,t,n));if(!r.ok)throw await Go(r);return r.text()}function $o(e,t,n,r){let i=Xo(e,t);return r?`${i}-${n}-anon.md`:`${i}-${n}.md`}function es(e,t){let n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.style.display=`none`,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),0)}function ts({conversationRef:e,sessionId:t,title:n,anonMode:r=!1}){let i=a(e??t),o=i.key,s=p(i),u=i.source===`codex`?Yo.slice(0,1):Yo,[d,f]=(0,I.useState)(!1),[h,g]=(0,I.useState)(null),_=(0,I.useRef)(null),v=(0,I.useRef)(null),y=(0,I.useRef)(null);zo(y,d,(0,I.useCallback)(()=>f(!1),[]));let b=u.length*2,x=(0,I.useRef)([]),[S,C]=(0,I.useState)(0),w=(0,I.useRef)(0),T=(0,I.useCallback)(e=>{w.current=e,C(e)},[]),E=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{E.current=!1},[]);let{copy:D}=Lo(),O=(0,I.useSyncExternalStore)(c,()=>m()),k=r?O:null,A=(0,I.useCallback)((e,t)=>{if(r){if(t===null){l({type:`SET_CONV_ANON_REFUSAL`,conversationRef:e,refused:!1});return}t instanceof Uo&&t.status===409&&l({type:`SET_CONV_ANON_REFUSAL`,conversationRef:e,refused:!0,message:Wo(t)})}},[r]);(0,I.useEffect)(()=>{f(!1)},[s]);let j=(0,I.useCallback)(()=>{f(!1);let e=v.current;e instanceof HTMLElement&&e.focus()},[]),M=(0,I.useCallback)(e=>{v.current=document.activeElement,T(e),f(!0)},[T]),ee=(0,I.useCallback)(()=>{d?f(!1):M(0)},[d,M]);(0,I.useEffect)(()=>{d&&x.current[w.current]?.focus()},[d]);let N=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),j();return}let t=Ro(e.key,w.current,b);t!==null&&(e.preventDefault(),T(t),x.current[t]?.focus())},[j,b,T]),te=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),M(0)):e.key===`ArrowUp`&&(e.preventDefault(),M(b-1))},[M,b]),P=(0,I.useCallback)(async e=>{let t=`${e}:copy`,n=i;g(t);try{let t=await Qo(n,e,r);A(n,null),D(t)}catch(e){A(n,e)}finally{E.current&&g(e=>e===t?null:e)}},[s,D,r,A]),F=(0,I.useCallback)(async e=>{let t=`${e}:download`,a=i;g(t);try{let t=await Qo(a,e,r);A(a,null),es($o(n,o,e,r),t)}catch(e){A(a,e)}finally{E.current&&g(e=>e===t?null:e)}},[s,n,r,A]);return(0,L.jsxs)(`div`,{ref:y,className:`conv-export`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||f(!1)},children:[(0,L.jsx)(`button`,{ref:_,type:`button`,className:`conv-export-toggle`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":`Export transcript`,onClick:ee,onKeyDown:te,children:`Export ▾`}),d&&(0,L.jsxs)(`div`,{className:`conv-export-menu`,role:`menu`,"aria-label":`Export transcript`,tabIndex:-1,onKeyDown:N,children:[r&&(0,L.jsx)(`div`,{className:`conv-export-anon-note${k?` conv-export-anon-unavailable`:``}`,role:`none`,"data-anon-unavailable":k?`1`:void 0,children:k??`Anonymized — project paths, home, username & known secrets redacted`}),u.map(({scope:e,label:t},n)=>{let r=n*2,i=r+1;return(0,L.jsxs)(`div`,{className:`conv-export-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-export-row-label`,children:t}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:r===S?0:-1,ref:e=>{x.current[r]=e},className:`conv-export-action`,"aria-label":`${t} — Copy`,disabled:h===`${e}:copy`,onClick:()=>void P(e),children:h===`${e}:copy`?`…`:`Copy`}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:i===S?0:-1,ref:e=>{x.current[i]=e},className:`conv-export-action`,"aria-label":`${t} — Download`,disabled:h===`${e}:download`,onClick:()=>void F(e),children:h===`${e}:download`?`…`:`Download`})]},e)})]})]})}function ns(e,t){if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?rs(r):n.slice(0,8)}return``}function rs(e){return e.label.trim()||e.key.slice(0,8)}function is({focusMode:e,subagents:t,onSelect:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null);zo(c,r,(0,I.useCallback)(()=>{i(!1),o(!1)},[]));let l=t.length>0,u=2+ +!!l,d=(0,I.useRef)([]),f=(0,I.useRef)([]),[p,m]=(0,I.useState)(0),h=(0,I.useRef)(0),g=(0,I.useCallback)(e=>{h.current=e,m(e)},[]),[_,v]=(0,I.useState)(0),y=(0,I.useRef)(0),b=(0,I.useCallback)(e=>{y.current=e,v(e)},[]),[x,S]=(0,I.useState)(!1),C=(0,I.useRef)(!1),w=(0,I.useCallback)(e=>{C.current=e,S(e)},[]),T=(0,I.useCallback)(()=>{i(!1),o(!1),w(!1);let e=s.current;e instanceof HTMLElement&&e.focus()},[w]),E=(0,I.useCallback)(e=>{s.current=document.activeElement,g(e),w(!1),o(!1),i(!0)},[g,w]),D=(0,I.useCallback)(()=>{r?(i(!1),o(!1),w(!1)):E(0)},[r,E,w]),O=(0,I.useCallback)(()=>{b(0),w(!0),o(!0)},[b,w]),k=(0,I.useCallback)(()=>{o(!1),w(!1),d.current[2]?.focus()},[w]),A=(0,I.useCallback)(e=>{n(e),T()},[n,T]);(0,I.useEffect)(()=>{r&&d.current[h.current]?.focus()},[r]),(0,I.useEffect)(()=>{a&&C.current&&f.current[y.current]?.focus()},[a]);let j=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),T();return}if(!C.current){if(e.key===`ArrowRight`&&l&&h.current===2){e.preventDefault(),O();return}let t=Ro(e.key,h.current,u);t!==null&&(e.preventDefault(),g(t),d.current[t]?.focus());return}if(e.key===`ArrowLeft`){e.preventDefault(),k();return}let n=Ro(e.key,y.current,t.length);n!==null&&(e.preventDefault(),b(n),f.current[n]?.focus())},[T,l,u,O,k,g,b,t.length]),M=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),E(0)):e.key===`ArrowUp`&&(e.preventDefault(),E(u-1))},[E,u]),ee=ns(e,t),N=ee!==``;return(0,L.jsxs)(`div`,{ref:c,className:`conv-focus-more`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(i(!1),o(!1))},children:[(0,L.jsx)(`button`,{type:`button`,className:[`conv-focus-more-toggle`,N?`conv-focus-more-toggle--on`:``].filter(Boolean).join(` `),"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`More focus filters`,onClick:D,onKeyDown:M,children:N?`${ee} ▾`:`More ▾`}),r&&(0,L.jsxs)(`div`,{className:`conv-focus-more-menu`,role:`menu`,"aria-label":`More focus filters`,tabIndex:-1,onKeyDown:j,children:[(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===0?0:-1,ref:e=>{d.current[0]=e},className:[`conv-focus-more-item`,e===`edits`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(`edits`),children:`Edits`}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===1?0:-1,ref:e=>{d.current[1]=e},className:[`conv-focus-more-item`,e===`bash`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(`bash`),children:`Bash`}),l&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:!x&&p===2?0:-1,ref:e=>{d.current[2]=e},className:`conv-focus-more-item conv-focus-more-sub`,"aria-haspopup":`menu`,"aria-expanded":a,onClick:()=>a?k():O(),children:[`Subagent `,a?`▾`:`▸`]}),a&&(0,L.jsx)(`div`,{className:`conv-focus-more-submenu`,role:`menu`,"aria-label":`Focus a subagent`,children:t.map((t,n)=>{let r=`subagent:${t.key}`;return(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:x&&_===n?0:-1,ref:e=>{f.current[n]=e},className:[`conv-focus-more-item`,e===r?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>A(r),children:rs(t)},t.key)})})]})]})]})}var as=[{mode:`all`,label:`All`},{mode:`chat`,label:`Chat`},{mode:`prompts`,label:`Prompts`},{mode:`errors`,label:`Errors`}],os=[{mode:`edits`,label:`Edits`},{mode:`bash`,label:`Bash`}];function ss(e,t){let n=as.find(t=>t.mode===e);if(n)return n.label;if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?rs(r):n.slice(0,8)}return`All`}function cs({focusMode:e,subagents:t,onSelect:n,errorCount:r=0}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(null);zo(s,i,(0,I.useCallback)(()=>a(!1),[]));let c=[...as.map(e=>e.mode===`errors`&&r>0?{...e,badge:r}:e),...os,...t.map(e=>({mode:`subagent:${e.key}`,label:rs(e)}))],l=c.length,u=(0,I.useRef)([]),[d,f]=(0,I.useState)(0),p=(0,I.useRef)(0),m=(0,I.useCallback)(e=>{p.current=e,f(e)},[]),h=(0,I.useCallback)(()=>{a(!1);let e=o.current;e instanceof HTMLElement&&e.focus()},[]),g=(0,I.useCallback)(e=>{o.current=document.activeElement,m(e),a(!0)},[m]),_=(0,I.useCallback)(()=>{if(i)a(!1);else{let t=c.findIndex(t=>t.mode===e);g(t>=0?t:0)}},[i,g,c,e]);(0,I.useEffect)(()=>{i&&u.current[p.current]?.focus()},[i]);let v=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),h();return}let t=Ro(e.key,p.current,l);t!==null&&(e.preventDefault(),m(t),u.current[t]?.focus())},[h,l,m]),y=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),g(0)):e.key===`ArrowUp`&&(e.preventDefault(),g(l-1))},[g,l]),b=(0,I.useCallback)(e=>{n(e),h()},[n,h]),x=ss(e,t);return(0,L.jsxs)(`div`,{ref:s,className:`conv-focus-compact`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)},children:[(0,L.jsxs)(`button`,{type:`button`,className:`conv-focus-compact-toggle`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-label":`Focus: ${x}`,onClick:_,onKeyDown:y,children:[`Focus: `,x,` ▾`]}),i&&(0,L.jsx)(`div`,{className:`conv-focus-compact-menu`,role:`menu`,"aria-label":`Focus mode`,tabIndex:-1,onKeyDown:v,children:c.map((t,n)=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t.mode,tabIndex:n===d?0:-1,ref:e=>{u.current[n]=e},className:[`conv-focus-compact-item`,e===t.mode?`conv-focus-compact-item--on`:``].filter(Boolean).join(` `),onClick:()=>b(t.mode),children:[t.label,t.badge!=null&&(0,L.jsx)(`span`,{className:`conv-focus-compact-badge`,children:t.badge})]},t.mode))})]})}function ls({sessionId:e,exportTitle:t,anonMode:n,onToggleAnon:r,onCompare:i,onLatest:a,latestBusy:o=!1,onExpandAll:s,onCollapseAll:c,completionTotal:l=null,costCumulative:u=0,costTotal:d=0,costApprox:f=!1,onCompletionJump:m=null}){let[h,g]=(0,I.useState)(!1),v=(0,I.useRef)(null),y=(0,I.useRef)(null);zo(y,h,(0,I.useCallback)(()=>g(!1),[]));let b=[{key:`anon`,kind:`toggle`,label:`Anonymize`,pressed:n},{key:`compare`,kind:`action`,label:`⟷ Compare with…`,run:i},a?{key:`latest`,kind:`action`,label:`${o?`… `:``}Latest ↓`,run:a,busy:o}:null,{key:`expand`,kind:`action`,label:`⤢ Expand all`,run:s},{key:`collapse`,kind:`action`,label:`⤡ Collapse all`,run:c},m!=null&&l!=null?{key:`complete`,kind:`action`,label:`✓ Complete · ${l}`,run:m}:null].filter(Boolean),x=b.length,S=(0,I.useRef)([]),[C,w]=(0,I.useState)(0),T=(0,I.useRef)(0),E=(0,I.useCallback)(e=>{T.current=e,w(e)},[]),D=p(e),O=(0,I.useRef)(D);(0,I.useEffect)(()=>{O.current!==D&&(O.current=D,g(!1))},[D]);let k=(0,I.useCallback)(()=>{g(!1);let e=v.current;e instanceof HTMLElement&&e.focus()},[]),A=(0,I.useCallback)(e=>{v.current=document.activeElement,E(e),g(!0)},[E]),j=(0,I.useCallback)(()=>{h?g(!1):A(0)},[h,A]);(0,I.useEffect)(()=>{h&&S.current[T.current]?.focus()},[h]);let M=(0,I.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),k();return}let t=Ro(e.key,T.current,x);t!==null&&(e.preventDefault(),E(t),S.current[t]?.focus())},[k,x,E]),ee=(0,I.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),A(0)):e.key===`ArrowUp`&&(e.preventDefault(),A(x-1))},[A,x]),N=(0,I.useCallback)(e=>{e(),k()},[k]),te=d>0,P=l!=null&&m==null;return(0,L.jsxs)(`div`,{ref:y,className:`conv-overflow`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[(0,L.jsx)(`button`,{type:`button`,className:`conv-overflow-toggle`,"aria-haspopup":`menu`,"aria-expanded":h,"aria-label":`More actions`,title:`More actions`,onClick:j,onKeyDown:ee,children:`⋯`}),h&&(0,L.jsxs)(`div`,{className:`conv-overflow-menu`,role:`menu`,"aria-label":`More actions`,tabIndex:-1,onKeyDown:M,children:[(P||te)&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary`,role:`none`,children:[P&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Completion`}),(0,L.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[`✓ `,l]})]}),te&&(0,L.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,L.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Cost`}),(0,L.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[f?`~`:``,_.usd2(u),` / `,_.usd2(d)]})]})]}),(0,L.jsx)(`div`,{className:`conv-overflow-export`,role:`none`,children:(0,L.jsx)(ts,{conversationRef:e,title:t,anonMode:n})}),b.map((e,t)=>(0,L.jsx)(`button`,{type:`button`,role:e.kind===`toggle`?`menuitemcheckbox`:`menuitem`,tabIndex:t===C?0:-1,ref:e=>{S.current[t]=e},className:e.kind===`toggle`?`conv-overflow-item conv-overflow-item--toggle`:`conv-overflow-item`,"aria-checked":e.kind===`toggle`?e.pressed:void 0,disabled:e.kind===`action`?e.busy:void 0,onClick:()=>e.kind===`toggle`?r():N(e.run),children:e.kind===`toggle`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`conv-overflow-item-label`,children:[`🎭 `,e.label]}),(0,L.jsx)(`span`,{className:`conv-overflow-item-state`,"aria-hidden":`true`,children:e.pressed?`On`:`Off`})]}):e.label},e.key))]})]})}var us=(0,I.createContext)(null),ds=(0,I.createContext)(null);function fs(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function ps(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ms=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hs=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gs={};function _s(e,t){return((t||gs).jsx?hs:ms).test(e)}var vs=/[ \t\n\f\r]/g;function ys(e){return typeof e==`object`?e.type===`text`?bs(e.value):!1:bs(e)}function bs(e){return e.replace(vs,``)===``}var xs=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};xs.prototype.normal={},xs.prototype.property={},xs.prototype.space=void 0;function Ss(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new xs(n,r,t)}function Cs(e){return e.toLowerCase()}var ws=class{constructor(e,t){this.attribute=t,this.property=e}};ws.prototype.attribute=``,ws.prototype.booleanish=!1,ws.prototype.boolean=!1,ws.prototype.commaOrSpaceSeparated=!1,ws.prototype.commaSeparated=!1,ws.prototype.defined=!1,ws.prototype.mustUseProperty=!1,ws.prototype.number=!1,ws.prototype.overloadedBoolean=!1,ws.prototype.property=``,ws.prototype.spaceSeparated=!1,ws.prototype.space=void 0;var Ts=n({boolean:()=>X,booleanish:()=>Ds,commaOrSpaceSeparated:()=>js,commaSeparated:()=>As,number:()=>Z,overloadedBoolean:()=>Os,spaceSeparated:()=>ks}),Es=0,X=Ms(),Ds=Ms(),Os=Ms(),Z=Ms(),ks=Ms(),As=Ms(),js=Ms();function Ms(){return 2**++Es}var Ns=Object.keys(Ts),Ps=class extends ws{constructor(e,t,n,r){let i=-1;if(super(e,t),Fs(this,`space`,r),typeof n==`number`)for(;++i<Ns.length;){let e=Ns[i];Fs(this,Ns[i],(n&Ts[e])===Ts[e])}}};Ps.prototype.defined=!0;function Fs(e,t,n){n&&(e[t]=n)}function Is(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ps(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Cs(r)]=r,n[Cs(a.attribute)]=r}return new xs(t,n,e.space)}var Ls=Is({properties:{ariaActiveDescendant:null,ariaAtomic:Ds,ariaAutoComplete:null,ariaBusy:Ds,ariaChecked:Ds,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:ks,ariaCurrent:null,ariaDescribedBy:ks,ariaDetails:null,ariaDisabled:Ds,ariaDropEffect:ks,ariaErrorMessage:null,ariaExpanded:Ds,ariaFlowTo:ks,ariaGrabbed:Ds,ariaHasPopup:null,ariaHidden:Ds,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ks,ariaLevel:Z,ariaLive:null,ariaModal:Ds,ariaMultiLine:Ds,ariaMultiSelectable:Ds,ariaOrientation:null,ariaOwns:ks,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:Ds,ariaReadOnly:Ds,ariaRelevant:null,ariaRequired:Ds,ariaRoleDescription:ks,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:Ds,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Rs(e,t){return t in e?e[t]:t}function zs(e,t){return Rs(e,t.toLowerCase())}var Bs=Is({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:As,acceptCharset:ks,accessKey:ks,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alpha:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:ks,autoFocus:X,autoPlay:X,blocking:ks,capture:null,charSet:null,checked:X,cite:null,className:ks,closedBy:null,colorSpace:null,cols:Z,colSpan:Z,command:null,commandFor:null,content:null,contentEditable:Ds,controls:X,controlsList:ks,coords:Z|As,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:Os,draggable:Ds,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:ks,height:Z,hidden:Os,high:Z,href:null,hrefLang:null,htmlFor:ks,httpEquiv:ks,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:ks,itemRef:ks,itemScope:X,itemType:ks,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:Z,pattern:null,ping:ks,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:ks,required:X,reversed:X,rows:Z,rowSpan:Z,sandbox:ks,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootCustomElementRegistry:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shadowRootSerializable:X,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:Ds,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:Ds,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ks,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:Ds,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:X,disablePictureInPicture:X,disableRemotePlayback:X,exportParts:As,part:ks,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:zs}),Vs=Is({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`,colorRendering:`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`,maskType:`mask-type`,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:js,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:ks,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,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:As,g2:As,glyphName:As,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:js,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,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:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ks,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:js,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:js,rev:js,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:js,requiredFeatures:js,requiredFonts:js,requiredFormats:js,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:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:js,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:js,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:js,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Rs}),Hs=Is({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Us=Is({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:zs}),Ws=Is({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Gs={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`},Ks=/[A-Z]/g,qs=/-[a-z]/g,Js=/^data[-\w.:]+$/i;function Ys(e,t){let n=Cs(t),r=t,i=ws;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Js.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(qs,Zs);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!qs.test(e)){let n=e.replace(Ks,Xs);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ps}return new i(r,t)}function Xs(e){return`-`+e.toLowerCase()}function Zs(e){return e.charAt(1).toUpperCase()}var Qs=Ss([Ls,Bs,Hs,Us,Ws],`html`),$s=Ss([Ls,Vs,Hs,Us,Ws],`svg`);function ec(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tc(e){return e.join(` `).trim()}var nc=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
2
2
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),rc=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(nc());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),ic=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),ac=t(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(rc()),r=ic();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),oc=cc(`end`),sc=cc(`start`);function cc(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function lc(e){let t=sc(e),n=oc(e);if(t&&n)return{start:t,end:n}}function uc(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?fc(e.position):`start`in e||`end`in e?fc(e):`line`in e||`column`in e?dc(e):``}function dc(e){return pc(e&&e.line)+`:`+pc(e&&e.column)}function fc(e){return dc(e&&e.start)+`-`+dc(e&&e.end)}function pc(e){return e&&typeof e==`number`?e:1}var mc=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=uc(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};mc.prototype.file=``,mc.prototype.name=``,mc.prototype.reason=``,mc.prototype.message=``,mc.prototype.stack=``,mc.prototype.column=void 0,mc.prototype.line=void 0,mc.prototype.ancestors=void 0,mc.prototype.cause=void 0,mc.prototype.fatal=void 0,mc.prototype.place=void 0,mc.prototype.ruleId=void 0,mc.prototype.source=void 0;var hc=i(ac(),1),gc={}.hasOwnProperty,_c=new Map,vc=/[A-Z]/g,yc=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),bc=new Set([`td`,`th`]);function xc(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Mc(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=jc(n,t.jsx,t.jsxs)}let 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`?$s:Qs,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Sc(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Sc(e,t,n){if(t.type===`element`)return Cc(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return wc(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ec(e,t,n);if(t.type===`mdxjsEsm`)return Tc(e,t);if(t.type===`root`)return Dc(e,t,n);if(t.type===`text`)return Oc(e,t)}function Cc(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=$s,e.schema=i),e.ancestors.push(t);let a=Rc(e,t.tagName,!1),o=Nc(e,t),s=Fc(e,t);return yc.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ys(e):!0})),kc(e,o,a,t),Ac(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function wc(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}zc(e,t.position)}function Tc(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zc(e,t.position)}function Ec(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=$s,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Rc(e,t.name,!0),o=Pc(e,t),s=Fc(e,t);return kc(e,o,a,t),Ac(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Dc(e,t,n){let r={};return Ac(r,Fc(e,t)),e.create(t,e.Fragment,r,n)}function Oc(e,t){return t.value}function kc(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ac(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function jc(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Mc(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=sc(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Nc(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&gc.call(t.properties,i)){let a=Ic(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&bc.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Pc(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else zc(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else zc(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Fc(e,t){let n=[],r=-1,i=e.passKeys?new Map:_c;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Sc(e,a,o);s!==void 0&&n.push(s)}return n}function Ic(e,t,n){let r=Ys(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ps(n):tc(n)),r.property===`style`){let t=typeof n==`object`?n:Lc(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Bc(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Gs[r.property]||r.property:r.attribute,n]}}function Lc(e,t){try{return(0,hc.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new mc("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Rc(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=_s(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=_s(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return gc.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);zc(e)}function zc(e,t){let n=new mc("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Bc(e){let t={},n;for(n in e)gc.call(e,n)&&(t[Vc(n)]=e[n]);return t}function Vc(e){let t=e.replace(vc,Hc);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Hc(e){return`-`+e.toLowerCase()}var Uc={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`]},Wc={};function Gc(e,t){let n=t||Wc;return Kc(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Kc(e,t,n){if(Jc(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 qc(e.children,t,n)}return Array.isArray(e)?qc(e,t,n):``}function qc(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Kc(e[i],t,n);return r.join(``)}function Jc(e){return!!(e&&typeof e==`object`)}var Yc=document.createElement(`i`);function Xc(e){let t=`&`+e+`;`;Yc.innerHTML=t;let n=Yc.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Zc(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Qc(e,t){return e.length>0?(Zc(e,e.length,0,t),e):t}var $c={}.hasOwnProperty;function el(e){let t={},n=-1;for(;++n<e.length;)tl(t,e[n]);return t}function tl(e,t){let n;for(n in t){let r=($c.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){$c.call(r,a)||(r[a]=[]);let e=i[a];nl(r[a],Array.isArray(e)?e:e?[e]:[])}}}function nl(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Zc(e,0,0,r)}function rl(e,t){let 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 il(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var al=hl(/[A-Za-z]/),ol=hl(/[\dA-Za-z]/),sl=hl(/[#-'*+\--9=?A-Z^-~]/);function cl(e){return e!==null&&(e<32||e===127)}var ll=hl(/\d/),ul=hl(/[\dA-Fa-f]/),dl=hl(/[!-/:-@[-`{-~]/);function Q(e){return e!==null&&e<-2}function fl(e){return e!==null&&(e<0||e===32)}function $(e){return e===-2||e===-1||e===32}var pl=hl(/\p{P}|\p{S}/u),ml=hl(/\s/);function hl(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function gl(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&ol(e.charCodeAt(n+1))&&ol(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function _l(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $(r)?(e.enter(n),s(r)):t(r)}function s(r){return $(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var vl={tokenize:yl};function yl(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),_l(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var bl={tokenize:Sl},xl={tokenize:Cl};function Sl(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Zc(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(xl,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(xl,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Zc(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Cl(e,t,n){return _l(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function wl(e){if(e===null||fl(e)||ml(e))return 1;if(pl(e))return 2}function Tl(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var El={name:`attention`,resolveAll:Dl,tokenize:Ol};function Dl(e,t){let n=-1,r,i,a,o,s,c,l,u;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;let d={...e[r][1].end},f={...e[n][1].start};kl(d,-c),kl(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Qc(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Qc(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Qc(l,Tl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Qc(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Qc(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Zc(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Ol(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=wl(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=wl(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function kl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Al={name:`autolink`,tokenize:jl};function jl(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return al(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||ol(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||ol(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||cl(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):sl(t)?(e.consume(t),l):n(t)}function u(e){return ol(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||ol(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ml={partial:!0,tokenize:Nl};function Nl(e,t,n){return r;function r(t){return $(t)?_l(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}var Pl={continuation:{tokenize:Il},exit:Ll,name:`blockQuote`,tokenize:Fl};function Fl(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return $(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Il(e,t,n){let r=this;return i;function i(t){return $(t)?_l(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Pl,t,n)(r)}}function Ll(e){e.exit(`blockQuote`)}var Rl={name:`characterEscape`,tokenize:zl};function zl(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return dl(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Bl={name:`characterReference`,tokenize:Vl};function Vl(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=ol,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=ul,u):(e.enter(`characterReferenceValue`),a=7,o=ll,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===ol&&!Xc(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Hl={partial:!0,tokenize:Gl},Ul={concrete:!0,name:`codeFenced`,tokenize:Wl};function Wl(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),$(t)?_l(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Hl,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),_l(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&$(t)?_l(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(Hl,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),$(t)?_l(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),$(t)?_l(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Gl(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Kl={name:`codeIndented`,tokenize:Jl},ql={partial:!0,tokenize:Yl};function Jl(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),_l(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Q(t)?e.attempt(ql,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Yl(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):_l(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Q(e)?i(e):n(e)}}var Xl={name:`codeText`,previous:Ql,resolve:Zl,tokenize:$l};function Zl(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 Ql(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function $l(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var eu=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&tu(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),tu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),tu(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);tu(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);tu(this.left,t.reverse())}}};function tu(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 nu(e){let t={},n=-1,r,i,a,o,s,c,l,u=new eu(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ru(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Zc(e,0,1/0,u.slice(0)),!l}function ru(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var iu={resolve:ou,tokenize:su},au={partial:!0,tokenize:cu};function ou(e){return nu(e),e}function su(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Q(t)?e.check(au,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function cu(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_l(e,a,`linePrefix`)}function a(i){if(i===null||Q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function lu(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||cl(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||fl(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||cl(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function uu(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function du(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_l(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function fu(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$(i)?_l(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var pu={name:`definition`,tokenize:hu},mu={partial:!0,tokenize:gu};function hu(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return uu.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=il(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return fl(t)?fu(e,l)(t):l(t)}function l(t){return lu(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(mu,d,d)(t)}function d(t){return $(t)?_l(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function gu(e,t,n){return r;function r(t){return fl(t)?fu(e,i)(t):n(t)}function i(t){return du(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $(t)?_l(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}var _u={name:`hardBreakEscape`,tokenize:vu};function vu(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var yu={name:`headingAtx`,resolve:bu,tokenize:xu};function bu(e,t){let n=e.length-2,r=3,i,a;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},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Zc(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function xu(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||fl(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):$(n)?_l(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||fl(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Su=`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`.split(`.`),Cu=[`pre`,`script`,`style`,`textarea`],wu={concrete:!0,name:`htmlFlow`,resolveTo:Du,tokenize:Ou},Tu={partial:!0,tokenize:Au},Eu={partial:!0,tokenize:ku};function Du(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 Ou(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:P):al(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):al(a)?(e.consume(a),i=4,r.interrupt?t:P):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:P):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return al(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||fl(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Cu.includes(l)?(i=1,r.interrupt?t(s):O(s)):Su.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||ol(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return $(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||al(t)?(e.consume(t),b):$(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||ol(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):$(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||fl(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||$(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Q(t)?O(t):$(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),ee):t===62&&i===4?(e.consume(t),F):t===63&&i===3?(e.consume(t),P):t===93&&i===5?(e.consume(t),te):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Tu,ne,k)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Eu,A,ne)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),P):O(t)}function ee(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return Cu.includes(n)?(e.consume(t),F):O(t)}return al(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function te(t){return t===93?(e.consume(t),P):O(t)}function P(t){return t===62?(e.consume(t),F):t===45&&i===2?(e.consume(t),P):O(t)}function F(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),F)}function ne(n){return e.exit(`htmlFlow`),t(n)}}function ku(e,t,n){let r=this;return i;function i(t){return Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Au(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ml,t,n)}}var ju={name:`htmlText`,tokenize:Mu};function Mu(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):al(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):al(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Q(t)?(o=d,ee(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Q(t)?(o=h,ee(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Q(t)?(o=v,ee(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,ee(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return al(t)?(e.consume(t),S):n(t)}function S(t){return t===45||ol(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,ee(t)):$(t)?(e.consume(t),C):M(t)}function w(t){return t===45||ol(t)?(e.consume(t),w):t===47||t===62||fl(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||al(t)?(e.consume(t),E):Q(t)?(o=T,ee(t)):$(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||ol(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Q(t)?(o=D,ee(t)):$(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Q(t)?(o=O,ee(t)):$(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Q(t)?(o=k,ee(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||fl(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||fl(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ee(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return $(t)?_l(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var Nu={name:`labelEnd`,resolveAll:Lu,resolveTo:Ru,tokenize:zu},Pu={tokenize:Bu},Fu={tokenize:Vu},Iu={tokenize:Hu};function Lu(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Zc(e,0,e.length,n),e}function Ru(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Qc(s,e.slice(a+1,a+r+3)),s=Qc(s,[[`enter`,u,t]]),s=Qc(s,Tl(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Qc(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Qc(s,e.slice(o+1)),s=Qc(s,[[`exit`,c,t]]),Zc(e,a,e.length,s),e}function zu(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(il(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Pu,u,o?u:d)(t):t===91?e.attempt(Fu,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Iu,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Bu(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return fl(t)?fu(e,a)(t):a(t)}function a(t){return t===41?u(t):lu(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return fl(t)?fu(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?du(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return fl(t)?fu(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Vu(e,t,n){let r=this;return i;function i(t){return uu.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(il(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Hu(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Uu={name:`labelStartImage`,resolveAll:Nu.resolveAll,tokenize:Wu};function Wu(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Gu={name:`labelStartLink`,resolveAll:Nu.resolveAll,tokenize:Ku};function Ku(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var qu={name:`lineEnding`,tokenize:Ju};function Ju(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),_l(e,t,`linePrefix`)}}var Yu={name:`thematicBreak`,tokenize:Xu};function Xu(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$(t)?_l(e,s,`whitespace`)(t):s(t))}}var Zu={continuation:{tokenize:td},exit:rd,name:`list`,tokenize:ed},Qu={partial:!0,tokenize:id},$u={partial:!0,tokenize:nd};function ed(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:ll(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Yu,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return ll(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ml,r.interrupt?n:u,e.attempt(Qu,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function td(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ml,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_l(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($u,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,_l(e,e.attempt(Zu,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function nd(e,t,n){let r=this;return _l(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function rd(e){e.exit(this.containerState.type)}function id(e,t,n){let r=this;return _l(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!$(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ad={name:`setextUnderline`,resolveTo:od,tokenize:sd};function od(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function sd(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),$(t)?_l(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var cd={tokenize:ld};function ld(e){let t=this,n=e.attempt(Ml,r,e.attempt(this.parser.constructs.flowInitial,i,_l(e,e.attempt(this.parser.constructs.flow,i,e.attempt(iu,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ud={resolveAll:md()},dd=pd(`string`),fd=pd(`text`);function pd(e){return{resolveAll:md(e===`text`?hd:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function md(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function hd(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var gd=n({attentionMarkers:()=>wd,contentInitial:()=>vd,disable:()=>Td,document:()=>_d,flow:()=>bd,flowInitial:()=>yd,insideSpan:()=>Cd,string:()=>xd,text:()=>Sd}),_d={42:Zu,43:Zu,45:Zu,48:Zu,49:Zu,50:Zu,51:Zu,52:Zu,53:Zu,54:Zu,55:Zu,56:Zu,57:Zu,62:Pl},vd={91:pu},yd={[-2]:Kl,[-1]:Kl,32:Kl},bd={35:yu,42:Yu,45:[ad,Yu],60:wu,61:ad,95:Yu,96:Ul,126:Ul},xd={38:Bl,92:Rl},Sd={[-5]:qu,[-4]:qu,[-3]:qu,33:Uu,38:Bl,42:El,60:[Al,ju],91:Gu,92:[_u,Rl],93:Nu,95:El,96:Xl},Cd={null:[El,ud]},wd={null:[42,95]},Td={null:[]};function Ed(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Qc(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Tl(a,l.events,l),l.events):[]}function f(e,t){return Od(p(e),t)}function p(e){return Dd(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Zc(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Dd(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Od(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
3
3
  `;break;case-3:o=`\r
4
4
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function kd(e){let t={constructs:el([gd,...(e||{}).extensions||[]]),content:n(vl),defined:[],document:n(bl),flow:n(cd),lazy:{},string:n(dd),text:n(fd)};return t;function n(e){return n;function n(n){return Ed(t,e,n)}}}function Ad(e){for(;!nu(e););return e}var jd=/[\0\t\n\r]/g;function Md(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(jd.lastIndex=u,c=jd.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Nd=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pd(e){return e.replace(Nd,Fd)}function Fd(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return rl(n.slice(t?2:1),t?16:10)}return Xc(n)||e}var Id={}.hasOwnProperty;function Ld(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Rd(n)(Ad(kd(n).document().write(Md()(e,t,!0))))}function Rd(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(xe),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(Se),reference:re,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Ce),thematicBreak:a(Te)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(ee),label:te,labelText:N,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:P,resourceTitleString:F,resource:ne,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Bd(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Id.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Hd).call(a,void 0,e[0])}for(r.position={start:zd(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:zd(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:zd(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Hd).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+uc({start:e.start,end:e.end})+`): it’s not open`);n.position.end=zd(e.end)}function u(){return Gc(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=il(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=we(),n.position={start:zd(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=zd(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=zd(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Pd(t),n.identifier=il(t).toLowerCase()}function te(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=il(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=rl(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Xc(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=zd(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function de(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function xe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Se(){return{type:`paragraph`,children:[]}}function Ce(){return{type:`strong`,children:[]}}function we(){return{type:`text`,value:``}}function Te(){return{type:`thematicBreak`}}}function zd(e){return{line:e.line,column:e.column,offset:e.offset}}function Bd(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Bd(e,r):Vd(e,r)}}function Vd(e,t){let n;for(n in t)if(Id.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Hd(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+uc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+uc({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+uc({start:t.start,end:t.end})+`) is still open`)}function Ud(e){let t=this;t.parser=n;function n(n){return Ld(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Wd(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Gd(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`