@remit/web-client-dist 0.0.524 → 0.0.526

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 (148) hide show
  1. package/assets/{BriefPane-BFt6V6kp.js → BriefPane-ChrsOiI5.js} +1 -1
  2. package/assets/{CalendarComposePane-DAcupn2s.js → CalendarComposePane-BeSqVd3E.js} +1 -1
  3. package/assets/{CalendarComposeSeed-C1QkHXLM.js → CalendarComposeSeed-DqmTyao9.js} +1 -1
  4. package/assets/{CalendarShell-oqKF2eTp.js → CalendarShell-DoOVsgTA.js} +1 -1
  5. package/assets/{EmptyState-B5l4DUW4.js → EmptyState-si-DpWBi.js} +1 -1
  6. package/assets/{ErrorState--2p5I6wj.js → ErrorState-DksyoH5X.js} +1 -1
  7. package/assets/{FlaggedPane-DB-AxQh4.js → FlaggedPane-BMj3QRRB.js} +1 -1
  8. package/assets/{FullCompose-B4d9WZ6T.js → FullCompose-vuKBlugc.js} +1 -1
  9. package/assets/{MailListHeader-kD_OYiqE.js → MailListHeader-k_H6Nj4H.js} +1 -1
  10. package/assets/{MailNav-CjAVXeIh.js → MailNav-DN_Kc3Bn.js} +1 -1
  11. package/assets/{MailShell-C6gzPUuw.js → MailShell-DliaPrFT.js} +1 -1
  12. package/assets/{MailViewChrome-B6yFR2VU.js → MailViewChrome-DFEXKgDU.js} +1 -1
  13. package/assets/MailboxPane-DPGGYCIj.js +1 -0
  14. package/assets/{NavMenuButton-xOndgihg.js → NavMenuButton-BpJdTOUd.js} +1 -1
  15. package/assets/{OnboardingWizard--zWbuuZO.js → OnboardingWizard-D7paFnVr.js} +1 -1
  16. package/assets/{OpenCalendarEvent-hZfI9rcX.js → OpenCalendarEvent-LsXgRmZT.js} +1 -1
  17. package/assets/{OutboxPane-CmsB8bhV.js → OutboxPane-BFi1SiwR.js} +1 -1
  18. package/assets/_calendarObjectId-C8bi_6xj.js +1 -0
  19. package/assets/_mailboxId-DcquwoLW.js +1 -0
  20. package/assets/_messageId-BSPud1pw.js +1 -0
  21. package/assets/_messageId-Clm1QwiK.js +1 -0
  22. package/assets/_messageId-PlyimwIj.js +1 -0
  23. package/assets/_outboxMessageId-CirCf91-.js +1 -0
  24. package/assets/_recurrenceId-DcLNEidj.js +1 -0
  25. package/assets/_threadId-B5zTua86.js +1 -0
  26. package/assets/_threadId-CBuHxmpZ.js +1 -0
  27. package/assets/_threadId-DBcDTZRs.js +1 -0
  28. package/assets/{_view._date-Dxjb8BoQ.js → _view._date-UGVUqfVs.js} +1 -1
  29. package/assets/{accounts-DM22VN8r.js → accounts-CB0Wq5Wv.js} +1 -1
  30. package/assets/{advanced-j3PIafmB.js → advanced-Btvv2L8D.js} +1 -1
  31. package/assets/{appearance-D4ZyQxSJ.js → appearance-Ws6uLE80.js} +1 -1
  32. package/assets/{attachment-file-BKW1LvYE.js → attachment-file-C21uro77.js} +1 -1
  33. package/assets/{attendee-row-CaFcq0Dc.js → attendee-row-CSEOC_rC.js} +1 -1
  34. package/assets/{avatar-CMlohog8.js → avatar-DyyOeiDP.js} +1 -1
  35. package/assets/{bottom-sheet-FUNFJG28.js → bottom-sheet-BH7YA8BV.js} +1 -1
  36. package/assets/brief-D4o1cvk0.js +1 -0
  37. package/assets/{brief-oohldKpq.js → brief-DMFRGq3F.js} +1 -1
  38. package/assets/{browser-ponyfill-RH8G0PY5.js → browser-ponyfill-CGd4CVCY.js} +1 -1
  39. package/assets/{bug-BOAkHOob.js → bug-dN__8N63.js} +1 -1
  40. package/assets/{calendar-BCz_kEKP.js → calendar-DohMaine.js} +1 -1
  41. package/assets/{calendar-color-BjjneYsQ.js → calendar-color-BqkJ6lSl.js} +1 -1
  42. package/assets/{calendar-event-chip-MdQdmgJv.js → calendar-event-chip-CEV8NQqe.js} +1 -1
  43. package/assets/{calendars-k1Woz5Nm.js → calendars-BDzX8RkF.js} +1 -1
  44. package/assets/{card-IQFeqGVt.js → card-CU7p0QLH.js} +1 -1
  45. package/assets/chevron-left-B48FZfHn.js +1 -0
  46. package/assets/{circle-check-B73TBv-p.js → circle-check-DVyiwjVR.js} +1 -1
  47. package/assets/{circle-check-big-PApHOS4Q.js → circle-check-big-DdkGJGpC.js} +1 -1
  48. package/assets/{circle-help-W-bok798.js → circle-help-E11sse6u.js} +1 -1
  49. package/assets/{clock-C5E9t_wY.js → clock-DOYtgwmf.js} +1 -1
  50. package/assets/compose._-_outboxMessageId_-Cpj8vVxV.js +1 -0
  51. package/assets/compose._-_outboxMessageId_-Cuo6gGxJ.js +1 -0
  52. package/assets/compose._-_outboxMessageId_-DruwEntQ.js +1 -0
  53. package/assets/compose._-_outboxMessageId_-fv1A_7QR.js +1 -0
  54. package/assets/{config-import-j6Ex6rUg.js → config-import-DH0Mxjkj.js} +1 -1
  55. package/assets/{confirm-dialog-BTkV4N2t.js → confirm-dialog-CQKNczRE.js} +1 -1
  56. package/assets/{copy-htJcDYRm.js → copy-B2nKdyli.js} +1 -1
  57. package/assets/{credential-steps-SdAyOxLX.js → credential-steps-oIENxJFq.js} +1 -1
  58. package/assets/{download-iYbfvVSU.js → download-DCVWa6kB.js} +1 -1
  59. package/assets/{file-json-C19C1p7d.js → file-json-BL8FH43L.js} +1 -1
  60. package/assets/{filters-DGbq9Iiw.js → filters-BeCKmrpN.js} +1 -1
  61. package/assets/flagged-Ca1YCtQu.js +1 -0
  62. package/assets/{flagged-1F2_cRcu.js → flagged-D5JsLld2.js} +1 -1
  63. package/assets/{folders-BnesYLu2.js → folders-DOHqWxvg.js} +1 -1
  64. package/assets/{format-Cc3aS3ot.js → format-C9mypfPa.js} +1 -1
  65. package/assets/{help-copy-qqkMLJGu.js → help-copy-B85h1hLf.js} +1 -1
  66. package/assets/{import-Az3vjKU0.js → import-YSl5V1oz.js} +1 -1
  67. package/assets/index-BZK-F8Tc.js +1 -0
  68. package/assets/{index-86n4-j8G.js → index-C1CX0WpK.js} +4 -4
  69. package/assets/index-C7j5GQ1T.js +1 -0
  70. package/assets/index-CPXvRjvN.js +1 -0
  71. package/assets/index-Clm1QwiK.js +1 -0
  72. package/assets/index-Cq3Hu9_3.js +1 -0
  73. package/assets/index-D2HN1YCc.js +1 -0
  74. package/assets/{index-CCWDwdgT.js → index-DKQKVA9q.js} +1 -1
  75. package/assets/index-Ddj_5mDi.js +1 -0
  76. package/assets/{index-D855R0Fw.js → index-Dx85_wSY.js} +4 -4
  77. package/assets/index-DzohWosO.js +1 -0
  78. package/assets/index-PlyimwIj.js +1 -0
  79. package/assets/{kbd-Cfms0Oys.js → kbd-C52Xn_j4.js} +1 -1
  80. package/assets/{labels-CN0UpXfN.js → labels-BAdbLOt7.js} +1 -1
  81. package/assets/{mail-D8ExCCOr.js → mail-DGVfjm9r.js} +1 -1
  82. package/assets/{mail-CvvXmucI.js → mail-DuUKZxET.js} +1 -1
  83. package/assets/{map-pin-BqQOdN8M.js → map-pin-CGDPnrFh.js} +1 -1
  84. package/assets/{menu-BHyCi7rW.js → menu-mBksCdgx.js} +1 -1
  85. package/assets/{new-vVhGLr7X.js → new-CmTZgDYD.js} +1 -1
  86. package/assets/onboarding-BGRUkyi8.js +1 -0
  87. package/assets/{onboarding-completion-CZcSJIaU.js → onboarding-completion-CzkuNREJ.js} +1 -1
  88. package/assets/outbox-C17bRnc0.js +1 -0
  89. package/assets/{pencil-BcFzbpXu.js → pencil-D4xiQ_Vc.js} +1 -1
  90. package/assets/{refresh-cw-BzxgnCmO.js → refresh-cw-COcsl_Af.js} +1 -1
  91. package/assets/{rich-text-BwW7zU6h.js → rich-text-WCyToD6v.js} +1 -1
  92. package/assets/{rich-text-spellcheck-worker-provider-BQcgIDy1.js → rich-text-spellcheck-worker-provider-CbWUh336.js} +1 -1
  93. package/assets/{rotate-ccw-CShnXVol.js → rotate-ccw-C7qpdlSG.js} +1 -1
  94. package/assets/{row-actions-9TTs03mH.js → row-actions-B2DOiD0i.js} +1 -1
  95. package/assets/{search-mirror-CFC1hqWp.js → search-mirror-C0Pt1h-G.js} +1 -1
  96. package/assets/{search-token-index-CXxBVdX5.js → search-token-index-BmcMDs9b.js} +1 -1
  97. package/assets/{sections-BKWo2Deh.js → sections-DvdIZ0pl.js} +1 -1
  98. package/assets/{senders-CyD_tWBm.js → senders-CE-k6MQW.js} +1 -1
  99. package/assets/settings-BxcgB4m7.js +1 -0
  100. package/assets/{settings-screen-BgUjgGfb.js → settings-screen-BRiGvg7z.js} +1 -1
  101. package/assets/{shield-check-D_NOwpHN.js → shield-check-BOYjSFE9.js} +1 -1
  102. package/assets/{suggested-vips-BRv9v-4q.js → suggested-vips-m-in5SKs.js} +1 -1
  103. package/assets/{useCalendarData-CfZbbmWc.js → useCalendarData-D3St5evd.js} +1 -1
  104. package/assets/{useCalendars-CgIo_kEf.js → useCalendars-76VW276g.js} +1 -1
  105. package/assets/{useDebouncedValue-tudCfT8G.js → useDebouncedValue-DQNqGEPg.js} +1 -1
  106. package/assets/{useFilters-D55evI_2.js → useFilters-B-7bJBEK.js} +1 -1
  107. package/assets/{useLabels-BS3G7NVR.js → useLabels-DzwmxI3k.js} +1 -1
  108. package/assets/{useLayoutTier-BHxPbufX.js → useLayoutTier-BEYBSkpq.js} +1 -1
  109. package/assets/{useMessageBodyContent-I6J6WaYN.js → useMessageBodyContent-CeF9pGv7.js} +1 -1
  110. package/assets/{useQueries-3Ta-bqMs.js → useQueries-CmJQ3O9W.js} +1 -1
  111. package/assets/{useRefreshControl-9O_O25oC.js → useRefreshControl-C9hbfjgD.js} +1 -1
  112. package/assets/{useResultFolderIndex-CURSMky8.js → useResultFolderIndex-Cv7Yvb7w.js} +1 -1
  113. package/assets/{useSearchTokenContext-D1NKXhM6.js → useSearchTokenContext-DshmuDOq.js} +1 -1
  114. package/assets/{useSemanticSearch-F_a8SnAV.js → useSemanticSearch-DZwukc7P.js} +1 -1
  115. package/assets/{useSignature-g4RGAb59.js → useSignature-jcBnHxI3.js} +1 -1
  116. package/assets/{window-BqaZu6ux.js → window-WjXllrlA.js} +1 -1
  117. package/index.html +1 -1
  118. package/package.json +1 -1
  119. package/assets/MailboxPane-DQb-w_Zk.js +0 -1
  120. package/assets/_calendarObjectId-CW7GoKo_.js +0 -1
  121. package/assets/_mailboxId-Bh6x_4Ta.js +0 -1
  122. package/assets/_messageId-BjdqRzNA.js +0 -1
  123. package/assets/_messageId-DYsODVAs.js +0 -1
  124. package/assets/_messageId-nZeew1Yi.js +0 -1
  125. package/assets/_outboxMessageId-BN-zHE9o.js +0 -1
  126. package/assets/_recurrenceId-Mxrcukbt.js +0 -1
  127. package/assets/_threadId-D4A-Ul62.js +0 -1
  128. package/assets/_threadId-DoPvTr-5.js +0 -1
  129. package/assets/_threadId-DrlECOd9.js +0 -1
  130. package/assets/brief-iiiTsECw.js +0 -1
  131. package/assets/chevron-left-BuHbO0ZQ.js +0 -1
  132. package/assets/compose._-_outboxMessageId_-BCv8oXYc.js +0 -1
  133. package/assets/compose._-_outboxMessageId_-BWWPKba4.js +0 -1
  134. package/assets/compose._-_outboxMessageId_-D8GfOivD.js +0 -1
  135. package/assets/compose._-_outboxMessageId_-rF2ebCVH.js +0 -1
  136. package/assets/flagged-CMInazao.js +0 -1
  137. package/assets/index-BbRtyPkp.js +0 -1
  138. package/assets/index-BiVNUJYH.js +0 -1
  139. package/assets/index-CLF7GeDo.js +0 -1
  140. package/assets/index-DXNSFZn6.js +0 -1
  141. package/assets/index-DYsODVAs.js +0 -1
  142. package/assets/index-X31FqCoN.js +0 -1
  143. package/assets/index-hhDrR9zg.js +0 -1
  144. package/assets/index-lIM5lIlU.js +0 -1
  145. package/assets/index-nZeew1Yi.js +0 -1
  146. package/assets/onboarding-BZef3Ejq.js +0 -1
  147. package/assets/outbox-BJKNqc37.js +0 -1
  148. package/assets/settings-2lNX20rB.js +0 -1
@@ -1 +1 @@
1
- import{r as m,i as b,e2 as E,c as C,e3 as x,dC as F,e4 as D,h as M,e5 as N,e6 as P,e7 as L,e8 as z}from"./index-D855R0Fw.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=p=>String(p).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",V=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),G=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",X=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?O(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,_=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:_(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:$(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],k=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?k(t):t.trim(),R=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:R(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),j=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},q=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},H=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=j(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=Q(t);return m.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},H);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:q(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,X as j,V as k,ee as n,G as o,O as p,U as r,re as u};
1
+ import{r as m,i as b,e2 as E,c as C,e3 as x,dC as F,e4 as D,h as M,e5 as N,e6 as P,e7 as L,e8 as z}from"./index-Dx85_wSY.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=p=>String(p).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",V=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),G=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",X=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?O(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,_=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:_(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:$(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],k=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?k(t):t.trim(),R=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:R(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),j=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},q=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},H=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=j(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=Q(t);return m.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},H);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:q(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,X as j,V as k,ee as n,G as o,O as p,U as r,re as u};
@@ -1 +1 @@
1
- import{c as d,dZ as L,h as n,i as l,d_ as p,r as o,d$ as y,e0 as c,e1 as g}from"./index-D855R0Fw.js";const u=e=>y({path:{accountId:e}}),f=e=>{const r=d({...L({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...p(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,m as b,C as c,h as u};
1
+ import{c as d,dZ as L,h as n,i as l,d_ as p,r as o,d$ as y,e0 as c,e1 as g}from"./index-Dx85_wSY.js";const u=e=>y({path:{accountId:e}}),f=e=>{const r=d({...L({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},h=e=>{const r=n(),t=l({...p(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},m=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,m as b,C as c,h as u};
@@ -1 +1 @@
1
- import{e as r,u as s,r as o,bU as t,bV as n}from"./index-D855R0Fw.js";const p=r("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function l(){const e=s();return o.useCallback(a=>{e({to:"/mail/brief",search:{q:a||void 0}})},[e])}function h(){const e=s();return o.useCallback((a,i)=>{e({to:"/mail/$mailboxId",params:{mailboxId:a},search:{q:i||void 0}})},[e])}const c=768,d=e=>e!=="desktop",b=()=>{const e=t(`(min-width: ${c}px)`);return t(n)?"desktop":e?"tablet":"phone"};export{p as B,l as a,h as b,d as i,b as u};
1
+ import{e as r,u as s,r as o,bU as t,bV as n}from"./index-Dx85_wSY.js";const p=r("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function l(){const e=s();return o.useCallback(a=>{e({to:"/mail/brief",search:{q:a||void 0}})},[e])}function h(){const e=s();return o.useCallback((a,i)=>{e({to:"/mail/$mailboxId",params:{mailboxId:a},search:{q:i||void 0}})},[e])}const c=768,d=e=>e!=="desktop",b=()=>{const e=t(`(min-width: ${c}px)`);return t(n)?"desktop":e?"tablet":"phone"};export{p as B,l as a,h as b,d as i,b as u};
@@ -1 +1 @@
1
- import{r as c,u as S,ce as O,cf as B,a8 as h,cg as N,q as P,aa as U,h as D,c as $,cD as F,cE as v}from"./index-D855R0Fw.js";const R="/mail/brief/compose/{-$outboxMessageId}",w="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:R,shouldThrow:!1}),t=h({from:w,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function Y(){return T()!==void 0}function j(){return T()?.outboxMessageId}function L(e,t,r){return e==="flagged"?{to:w,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:R,params:{outboxMessageId:r}}}function b(){const e=S(),t=O(),{list:r,mailboxId:s}=B();return c.useCallback((n,o)=>{e({...L(r,s,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function J(){const e=b();return c.useCallback(()=>e(void 0),[e])}function V(){const e=b();return c.useCallback(t=>e(t),[e])}function Z(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function ee(){return N()}const _=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},g={all:["messages"],detail:e=>[...g.all,"detail",e],body:e=>[...g.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const q=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},K=8,Q="x-remit-403-reason",I=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},X=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,G=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},H=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await v(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,q(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(Q),y=I(o.status,l);throw new f(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(G(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const m=await o.text();if(X(m,a))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},W=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),te=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?_(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),m=D(),l=c.useRef(!1),y=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;y.current!==C&&(y.current=C,l.current=!1);const i=$({queryKey:e?[...g.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,W({fetchContent:(u,M)=>H(u,M,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:F({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<K:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s,x=t!==void 0&&s===null;c.useEffect(()=>{p&&(a.current=performance.now())},[p]),c.useEffect(()=>{i.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,n]);const A=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:A,isLoading:p,hasNoRenderablePart:x,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,Y as a,te as b,j as c,Z as d,ee as e,V as f,I as g,J as u};
1
+ import{r as c,u as S,ce as O,cf as B,a8 as h,cg as N,q as P,aa as U,h as D,c as $,cD as F,cE as v}from"./index-Dx85_wSY.js";const R="/mail/brief/compose/{-$outboxMessageId}",w="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:R,shouldThrow:!1}),t=h({from:w,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function Y(){return T()!==void 0}function j(){return T()?.outboxMessageId}function L(e,t,r){return e==="flagged"?{to:w,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:R,params:{outboxMessageId:r}}}function b(){const e=S(),t=O(),{list:r,mailboxId:s}=B();return c.useCallback((n,o)=>{e({...L(r,s,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function J(){const e=b();return c.useCallback(()=>e(void 0),[e])}function V(){const e=b();return c.useCallback(t=>e(t),[e])}function Z(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function ee(){return N()}const _=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},g={all:["messages"],detail:e=>[...g.all,"detail",e],body:e=>[...g.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const q=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},K=8,Q="x-remit-403-reason",I=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},X=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,G=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},H=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await v(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,q(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(Q),y=I(o.status,l);throw new f(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(G(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const m=await o.text();if(X(m,a))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},W=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),te=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?_(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),m=D(),l=c.useRef(!1),y=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;y.current!==C&&(y.current=C,l.current=!1);const i=$({queryKey:e?[...g.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,W({fetchContent:(u,M)=>H(u,M,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:F({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<K:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s,x=t!==void 0&&s===null;c.useEffect(()=>{p&&(a.current=performance.now())},[p]),c.useEffect(()=>{i.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,n]);const A=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:A,isLoading:p,hasNoRenderablePart:x,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,Y as a,te as b,j as c,Z as d,ee as e,V as f,I as g,J as u};
@@ -1 +1 @@
1
- import{bW as Q,bX as y,bY as S,bZ as w,b_ as C,h as k,b$ as q,c0 as x,r as p,c1 as M,c2 as H,c3 as L,c4 as P,c5 as O,c6 as B,c7 as A}from"./index-D855R0Fw.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function T(r,e,s){const t=r.slice(0);return t[e]=s,t}var z=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#d(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#f(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,d)=>o!==s[d]),f=u||a,b=f?!0:n.some((o,d)=>{const g=this.#e[d];return!g||!S(o,g)});!f&&!b||(f&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(f&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(d=>{this.#d(o,d)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#f(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#f(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#d(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=T(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function U({queries:r,...e},s){const t=k(),i=q(),n=x(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{M(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new z(t,u,e)),[f,b,o]=a.getOptimisticResult(u,e.combine),d=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>d?a.subscribe(y.batchCalls(h)):P,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=f.some((h,c)=>O(u[c],h))?f.flatMap((h,c)=>{const l=u[c];if(l&&O(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=f.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(v?.error)throw v.error;return b(o())}export{U as u};
1
+ import{bW as Q,bX as y,bY as S,bZ as w,b_ as C,h as k,b$ as q,c0 as x,r as p,c1 as M,c2 as H,c3 as L,c4 as P,c5 as O,c6 as B,c7 as A}from"./index-Dx85_wSY.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function T(r,e,s){const t=r.slice(0);return t[e]=s,t}var z=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#d(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#f(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,d)=>o!==s[d]),f=u||a,b=f?!0:n.some((o,d)=>{const g=this.#e[d];return!g||!S(o,g)});!f&&!b||(f&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(f&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(d=>{this.#d(o,d)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#f(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#f(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#d(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=T(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function U({queries:r,...e},s){const t=k(),i=q(),n=x(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{M(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new z(t,u,e)),[f,b,o]=a.getOptimisticResult(u,e.combine),d=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>d?a.subscribe(y.batchCalls(h)):P,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=f.some((h,c)=>O(u[c],h))?f.flatMap((h,c)=>{const l=u[c];if(l&&O(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=f.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(v?.error)throw v.error;return b(o())}export{U as u};
@@ -1 +1 @@
1
- import{j as E,_ as W,t as Q,f as U,r as o,aN as R,h as O,C as $,q as z,K as B,M as G,N as I,P as X}from"./index-D855R0Fw.js";import{C as V}from"./circle-check-big-PApHOS4Q.js";import{R as J}from"./refresh-cw-BzxgnCmO.js";import{u as P}from"./useQueries-3Ta-bqMs.js";import{i as Y,t as Z}from"./search-token-index-CXxBVdX5.js";function we({state:e,onRefresh:s,label:t,errorMessage:r,hasUpdate:a,size:u="sm",className:c}){const i=e==="refreshing",n=e==="error",h=e==="success",y=n?E.jsx(W,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(J,{className:Q("size-4",i&&"animate-spin")}),w=n?`${t} — failed: ${r??"try again"}`:i?`${t} — refreshing`:h?`${t} — up to date`:a?`${t} — new mail`:t;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(U,{variant:"ghost",size:u,icon:y,onClick:s,disabled:i,"aria-label":w,"aria-busy":i||void 0,title:n?r:t,className:c}),e==="idle"&&a&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const ee=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&ee.has(e)}const q=3e3,te=q*2,T={syncing:!1,resolved:!1,synced:0,total:0};function xe(e,s){const t=e.join(","),[r,a]=o.useState(!1),[u,c]=o.useState(!1);o.useEffect(()=>{a(!1),c(!1)},[t,s]),o.useEffect(()=>{if(!s)return;const m=setTimeout(()=>c(!0),te);return()=>clearTimeout(m)},[t,s]);const i=P({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!r,refetchInterval:q,meta:{softError:!0}}))}),n=i.every(m=>m.isSuccess||m.isError),h=i.length===0||n||u;let y=!1,w=0,S=0;for(const m of i)if(L(m.data?.syncPhase)){y=!0;for(const l of m.data?.mailboxes??[])w+=l.messagesSynced,S+=l.messagesTotal}const x=s&&h&&!y;return o.useEffect(()=>{x&&a(!0)},[x]),!s||!h?T:{syncing:y,resolved:!0,synced:w,total:S}}const se=180*1e3,pe=30*1e3;let F=0;const M=new Set,ne=(e=Date.now())=>{F=e+se;for(const s of M)s()},Ee=(e=Date.now())=>e<F,be=e=>(M.add(e),()=>{M.delete(e)}),_=6e4,re=new Set(["sent","drafts","trash","archive"]),C=(e,s)=>{const t=new Map;for(const r of e){const a=s.get(r.mailboxId)?.role;a&&re.has(a)||t.set(r.mailboxId,r.messagesTotal)}return t},j=(e,s)=>{const t=[];for(const[r,a]of s)a>(e.get(r)??0)&&t.push(r);return t},oe=(e,s)=>j(e,s).length>0,D=o.createContext(null),ae=()=>{const e=o.useContext(D);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function Re({accountIds:e,children:s}){const t=O(),{resultFolderIndex:r}=$(),a=o.useRef(new Map),u=o.useRef(new Set),c=o.useRef(new Map),[i,n]=o.useState(new Set),h=P({queries:e.map(l=>({...R({path:{accountId:l}}),refetchInterval:_,staleTime:_,meta:{softError:!0}}))}),y=h.map(l=>l.dataUpdatedAt).join(","),w=e.join(",");o.useEffect(()=>{let l=!1;const f=new Set(i);e.forEach((d,p)=>{const b=h[p]?.data;if(!b)return;const g=C(b.mailboxes??[],r),k=c.current.get(d);if(c.current.set(d,g),k){const A=j(k,g);A.length>0&&Y(t,Z(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const K=a.current.get(d)??new Map;oe(K,g)&&(f.add(d),l=!0)}),l&&n(f)},[w,y]);const S=o.useCallback(l=>l.some(f=>i.has(f)),[i]),x=o.useCallback(l=>{n(f=>{if(l.every(p=>!f.has(p)))return f;const d=new Set(f);for(const p of l)d.delete(p);return d});for(const f of l){const d=t.getQueryData(R({path:{accountId:f}}).queryKey);a.current.set(f,C(d?.mailboxes??[],r)),u.current.add(f)}},[t,r]),m=o.useMemo(()=>({hasNewMail:S,acknowledge:x}),[S,x]);return E.jsx(D.Provider,{value:m,children:s})}const ie=2e3,ce=45e3,ue=e=>new Promise(s=>setTimeout(s,e)),v=e=>e instanceof Error&&e.message?e.message:"Something went wrong",le=e=>{I(e,{softError:!0},"user")&&X(e)},N=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,fe=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:r=0,onInboxSynced:a,deadline:u,pollMs:c=ie})=>{let i=!1;for(;;){const n=await s().then(S=>({ok:!0,data:S})).catch(S=>({ok:!1,error:S}));if(!n.ok)return{accountId:e,message:v(n.error)};const{syncPhase:h,lastSyncAt:y}=n.data;if((y??0)>t&&!L(h))return h==="error"?{accountId:e,message:"Sync failed for this account"}:void 0;if(!i&&H(n.data)>r&&(i=!0,a?.()),Date.now()>=u)return{accountId:e,message:"Refresh is taking longer than usual"};await ue(c)}},de=async(e,s,t,r,a)=>{const u=await N(e,t).then(n=>({ok:!0,lastSyncAt:n.lastSyncAt??0,inboxSyncedAt:H(n)})).catch(n=>({ok:!1,error:n}));if(!u.ok)return{accountId:t,enqueued:!1,ok:!1,message:v(u.error)};const c=await B({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(n=>({ok:!1,error:n}));if(!c.ok)return le(c.error),{accountId:t,enqueued:!1,ok:!1,message:v(c.error)};s.recordEvent("sync.triggered");const i=await fe({accountId:t,readStatus:()=>N(e,t),baselineLastSyncAt:u.lastSyncAt,baselineInboxSyncedAt:u.inboxSyncedAt,onInboxSynced:()=>a(t),deadline:r});return i?{accountId:t,enqueued:!0,ok:!1,message:i.message}:{accountId:t,enqueued:!0,ok:!0}},Me=(e,s={})=>{const t=O(),r=z(),{acknowledge:a}=ae(),[u,c]=o.useState("idle"),[i,n]=o.useState(),h=o.useRef(0),y=o.useRef(e);y.current=e;const w=o.useRef(s);w.current=s,o.useEffect(()=>{if(u!=="success")return;const x=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(x)},[u]);const S=o.useCallback(()=>{const x=y.current;if(x.length===0){c("error"),n("Nothing to refresh yet");return}const m=++h.current;c("refreshing"),n(void 0),ne();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:G({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ce,d=await Promise.all(x.map(g=>de(t,r,g,f,l)));if(h.current!==m)return;const p=d.filter(g=>g.enqueued).map(g=>g.accountId);for(const g of p)l(g);p.length>0&&a(p);const b=d.filter(g=>!g.ok);b.length===0?c("success"):(c("error"),n(b[0]?.message))})()},[a,t,r]);return{state:u,errorMessage:i,refresh:S}};export{pe as H,Re as M,we as R,Me as a,L as b,xe as c,Ee as i,be as s,ae as u};
1
+ import{j as E,_ as W,t as Q,f as U,r as o,aN as R,h as O,C as $,q as z,K as B,M as G,N as I,P as X}from"./index-Dx85_wSY.js";import{C as V}from"./circle-check-big-DdkGJGpC.js";import{R as J}from"./refresh-cw-COcsl_Af.js";import{u as P}from"./useQueries-CmJQ3O9W.js";import{i as Y,t as Z}from"./search-token-index-BmcMDs9b.js";function we({state:e,onRefresh:s,label:t,errorMessage:r,hasUpdate:a,size:u="sm",className:c}){const i=e==="refreshing",n=e==="error",h=e==="success",y=n?E.jsx(W,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(J,{className:Q("size-4",i&&"animate-spin")}),w=n?`${t} — failed: ${r??"try again"}`:i?`${t} — refreshing`:h?`${t} — up to date`:a?`${t} — new mail`:t;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(U,{variant:"ghost",size:u,icon:y,onClick:s,disabled:i,"aria-label":w,"aria-busy":i||void 0,title:n?r:t,className:c}),e==="idle"&&a&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const ee=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&ee.has(e)}const q=3e3,te=q*2,T={syncing:!1,resolved:!1,synced:0,total:0};function xe(e,s){const t=e.join(","),[r,a]=o.useState(!1),[u,c]=o.useState(!1);o.useEffect(()=>{a(!1),c(!1)},[t,s]),o.useEffect(()=>{if(!s)return;const m=setTimeout(()=>c(!0),te);return()=>clearTimeout(m)},[t,s]);const i=P({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!r,refetchInterval:q,meta:{softError:!0}}))}),n=i.every(m=>m.isSuccess||m.isError),h=i.length===0||n||u;let y=!1,w=0,S=0;for(const m of i)if(L(m.data?.syncPhase)){y=!0;for(const l of m.data?.mailboxes??[])w+=l.messagesSynced,S+=l.messagesTotal}const x=s&&h&&!y;return o.useEffect(()=>{x&&a(!0)},[x]),!s||!h?T:{syncing:y,resolved:!0,synced:w,total:S}}const se=180*1e3,pe=30*1e3;let F=0;const M=new Set,ne=(e=Date.now())=>{F=e+se;for(const s of M)s()},Ee=(e=Date.now())=>e<F,be=e=>(M.add(e),()=>{M.delete(e)}),_=6e4,re=new Set(["sent","drafts","trash","archive"]),C=(e,s)=>{const t=new Map;for(const r of e){const a=s.get(r.mailboxId)?.role;a&&re.has(a)||t.set(r.mailboxId,r.messagesTotal)}return t},j=(e,s)=>{const t=[];for(const[r,a]of s)a>(e.get(r)??0)&&t.push(r);return t},oe=(e,s)=>j(e,s).length>0,D=o.createContext(null),ae=()=>{const e=o.useContext(D);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function Re({accountIds:e,children:s}){const t=O(),{resultFolderIndex:r}=$(),a=o.useRef(new Map),u=o.useRef(new Set),c=o.useRef(new Map),[i,n]=o.useState(new Set),h=P({queries:e.map(l=>({...R({path:{accountId:l}}),refetchInterval:_,staleTime:_,meta:{softError:!0}}))}),y=h.map(l=>l.dataUpdatedAt).join(","),w=e.join(",");o.useEffect(()=>{let l=!1;const f=new Set(i);e.forEach((d,p)=>{const b=h[p]?.data;if(!b)return;const g=C(b.mailboxes??[],r),k=c.current.get(d);if(c.current.set(d,g),k){const A=j(k,g);A.length>0&&Y(t,Z(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const K=a.current.get(d)??new Map;oe(K,g)&&(f.add(d),l=!0)}),l&&n(f)},[w,y]);const S=o.useCallback(l=>l.some(f=>i.has(f)),[i]),x=o.useCallback(l=>{n(f=>{if(l.every(p=>!f.has(p)))return f;const d=new Set(f);for(const p of l)d.delete(p);return d});for(const f of l){const d=t.getQueryData(R({path:{accountId:f}}).queryKey);a.current.set(f,C(d?.mailboxes??[],r)),u.current.add(f)}},[t,r]),m=o.useMemo(()=>({hasNewMail:S,acknowledge:x}),[S,x]);return E.jsx(D.Provider,{value:m,children:s})}const ie=2e3,ce=45e3,ue=e=>new Promise(s=>setTimeout(s,e)),v=e=>e instanceof Error&&e.message?e.message:"Something went wrong",le=e=>{I(e,{softError:!0},"user")&&X(e)},N=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,fe=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:r=0,onInboxSynced:a,deadline:u,pollMs:c=ie})=>{let i=!1;for(;;){const n=await s().then(S=>({ok:!0,data:S})).catch(S=>({ok:!1,error:S}));if(!n.ok)return{accountId:e,message:v(n.error)};const{syncPhase:h,lastSyncAt:y}=n.data;if((y??0)>t&&!L(h))return h==="error"?{accountId:e,message:"Sync failed for this account"}:void 0;if(!i&&H(n.data)>r&&(i=!0,a?.()),Date.now()>=u)return{accountId:e,message:"Refresh is taking longer than usual"};await ue(c)}},de=async(e,s,t,r,a)=>{const u=await N(e,t).then(n=>({ok:!0,lastSyncAt:n.lastSyncAt??0,inboxSyncedAt:H(n)})).catch(n=>({ok:!1,error:n}));if(!u.ok)return{accountId:t,enqueued:!1,ok:!1,message:v(u.error)};const c=await B({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(n=>({ok:!1,error:n}));if(!c.ok)return le(c.error),{accountId:t,enqueued:!1,ok:!1,message:v(c.error)};s.recordEvent("sync.triggered");const i=await fe({accountId:t,readStatus:()=>N(e,t),baselineLastSyncAt:u.lastSyncAt,baselineInboxSyncedAt:u.inboxSyncedAt,onInboxSynced:()=>a(t),deadline:r});return i?{accountId:t,enqueued:!0,ok:!1,message:i.message}:{accountId:t,enqueued:!0,ok:!0}},Me=(e,s={})=>{const t=O(),r=z(),{acknowledge:a}=ae(),[u,c]=o.useState("idle"),[i,n]=o.useState(),h=o.useRef(0),y=o.useRef(e);y.current=e;const w=o.useRef(s);w.current=s,o.useEffect(()=>{if(u!=="success")return;const x=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(x)},[u]);const S=o.useCallback(()=>{const x=y.current;if(x.length===0){c("error"),n("Nothing to refresh yet");return}const m=++h.current;c("refreshing"),n(void 0),ne();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:G({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ce,d=await Promise.all(x.map(g=>de(t,r,g,f,l)));if(h.current!==m)return;const p=d.filter(g=>g.enqueued).map(g=>g.accountId);for(const g of p)l(g);p.length>0&&a(p);const b=d.filter(g=>!g.ok);b.length===0?c("success"):(c("error"),n(b[0]?.message))})()},[a,t,r]);return{state:u,errorMessage:i,refresh:S}};export{pe as H,Re as M,we as R,Me as a,L as b,xe as c,Ee as i,be as s,ae as u};
@@ -1 +1 @@
1
- import{G as r,r as s,b3 as t}from"./index-D855R0Fw.js";import{u as m}from"./useQueries-3Ta-bqMs.js";const a=i=>({items:i.map(e=>e.data?.items??[]),isPending:i.some(e=>e.isPending),error:i.find(e=>e.error)?.error??null});function u(i){const e=m({queries:i.map(o=>({...r({path:{accountId:o.accountId}}),staleTime:1/0})),combine:a});return{index:s.useMemo(()=>t(i.map((o,n)=>({folderAppointments:o.folderAppointments,mailboxes:e.items[n]??[]}))),[i,e]),isPending:e.isPending,error:e.error}}export{u};
1
+ import{G as r,r as s,b3 as t}from"./index-Dx85_wSY.js";import{u as m}from"./useQueries-CmJQ3O9W.js";const a=i=>({items:i.map(e=>e.data?.items??[]),isPending:i.some(e=>e.isPending),error:i.find(e=>e.error)?.error??null});function u(i){const e=m({queries:i.map(o=>({...r({path:{accountId:o.accountId}}),staleTime:1/0})),combine:a});return{index:s.useMemo(()=>t(i.map((o,n)=>({folderAppointments:o.folderAppointments,mailboxes:e.items[n]??[]}))),[i,e]),isPending:e.isPending,error:e.error}}export{u};
@@ -1,4 +1,4 @@
1
- import{cn as V,r as g,j as a,t as b,I as Q,h as Y,as as q,i as X,au as Z,cD as J,bL as ee,aa as te,_ as se,X as re,cV as R,C as ne,cf as ae}from"./index-D855R0Fw.js";import{K as k}from"./kbd-Cfms0Oys.js";import{B as oe,b as ie}from"./useMessageBodyContent-I6J6WaYN.js";import{i as ce}from"./search-scope-B5-OK3Cq.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
1
+ import{cn as V,r as g,j as a,t as b,I as Q,h as Y,as as q,i as X,au as Z,cD as J,bL as ee,aa as te,_ as se,X as re,cV as R,C as ne,cf as ae}from"./index-Dx85_wSY.js";import{K as k}from"./kbd-C52Xn_j4.js";import{B as oe,b as ie}from"./useMessageBodyContent-CeF9pGv7.js";import{i as ce}from"./search-scope-B5-OK3Cq.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
2
2
  /* Zero the UA default body margin and clamp the document to the iframe width so
3
3
  wide author markup can't push the body (and the page) past the viewport. */
4
4
  html, body {
@@ -1 +1 @@
1
- import{h as T,as as C,i as I,cz as k,dV as A,r as v,j as p,dW as h,dX as E,dY as j,C as w,cf as z,c as D,dv as Q,cV as R}from"./index-D855R0Fw.js";import{P as O}from"./attachment-file-BKW1LvYE.js";import{ag as P,ah as _}from"./MailListHeader-kD_OYiqE.js";import{i as N,t as q}from"./search-token-index-CXxBVdX5.js";import{a as B}from"./useLabels-BS3G7NVR.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{b as V}from"./search-scope-B5-OK3Cq.js";import{u as F,p as G}from"./useSearchTokenContext-D1NKXhM6.js";const ne=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},H=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=C(),{mutateAsync:i,isPending:o}=I({...A(),onError:(n,d)=>{l({title:d.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(n),error:n})},onSettled:(n,d,u)=>{N(c,q(P(u.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,d,u)=>{n.length!==0&&_(n,m=>i({body:{messageIds:m,labelId:d,action:u}}))},[i]),isPending:o}};function re({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=B(e),{applyLabel:l}=H({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(O,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const K=20,W=new Set(Object.values(R)),X=e=>e!==void 0&&W.has(e)?e:void 0,Y=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function ie({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=w(),c=F(),l=z(),i=U(a),{freeText:o,tokens:r}=G(i,c),n=o.length>0,d=r.find(s=>s.type==="category"),u=X(t)??d?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,f=r.some(s=>s.type==="isStarred")?!0:void 0,y=Y(r),b=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=V({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=D({...Q({query:{query:o,mailboxId:x,limit:K,...u!==void 0?{category:u}:{},...m!==void 0?{hasAttachment:m}:{},...f!==void 0?{hasStars:f}:{},...y!==void 0?{isRead:y}:{},...b?{sentDateFrom:b.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{re as L,ne as r,ie as u};
1
+ import{h as T,as as C,i as I,cz as k,dV as A,r as v,j as p,dW as h,dX as E,dY as j,C as w,cf as z,c as D,dv as Q,cV as R}from"./index-Dx85_wSY.js";import{P as O}from"./attachment-file-C21uro77.js";import{ag as P,ah as _}from"./MailListHeader-k_H6Nj4H.js";import{i as N,t as q}from"./search-token-index-BmcMDs9b.js";import{a as B}from"./useLabels-DzwmxI3k.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{b as V}from"./search-scope-B5-OK3Cq.js";import{u as F,p as G}from"./useSearchTokenContext-DshmuDOq.js";const ne=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},H=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=C(),{mutateAsync:i,isPending:o}=I({...A(),onError:(n,d)=>{l({title:d.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(n),error:n})},onSettled:(n,d,u)=>{N(c,q(P(u.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,d,u)=>{n.length!==0&&_(n,m=>i({body:{messageIds:m,labelId:d,action:u}}))},[i]),isPending:o}};function re({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=B(e),{applyLabel:l}=H({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(O,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const K=20,W=new Set(Object.values(R)),X=e=>e!==void 0&&W.has(e)?e:void 0,Y=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function ie({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=w(),c=F(),l=z(),i=U(a),{freeText:o,tokens:r}=G(i,c),n=o.length>0,d=r.find(s=>s.type==="category"),u=X(t)??d?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,f=r.some(s=>s.type==="isStarred")?!0:void 0,y=Y(r),b=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=V({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=D({...Q({query:{query:o,mailboxId:x,limit:K,...u!==void 0?{category:u}:{},...m!==void 0?{hasAttachment:m}:{},...f!==void 0?{hasStars:f}:{},...y!==void 0?{isRead:y}:{},...b?{sentDateFrom:b.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{re as L,ne as r,ie as u};
@@ -1 +1 @@
1
- import{h as g,as as p,c as f,d as m,r,i as y,au as T,o as E,l as d}from"./index-D855R0Fw.js";const i={html:"",plainText:""},x=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...d(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{x as u};
1
+ import{h as g,as as p,c as f,d as m,r,i as y,au as T,o as E,l as d}from"./index-Dx85_wSY.js";const i={html:"",plainText:""},x=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...d(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{x as u};
@@ -1 +1 @@
1
- import{a8 as d,eg as g,r as u,eh as y,bQ as m,u as D,ce as b,ef as C}from"./index-D855R0Fw.js";const i="/calendar/$view/$date";function I(){const e=d({from:i,shouldThrow:!1}),a=g({from:i,shouldThrow:!1}),t=e?.view??"",n=e?.date??"",r=a?.calendarId;return u.useMemo(()=>({...y({view:t,date:n},m(new Date)),calendarIds:r??[]}),[t,n,r])}function z(){const e=d({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),a=d({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),t=e?.calendarObjectId,n=a?.recurrenceId;return u.useMemo(()=>t?{calendarObjectId:t,recurrenceId:n}:void 0,[t,n])}function j(){return d({from:"/calendar/$view/$date/new",shouldThrow:!1})!==void 0}function A(){const e=D(),a=b(),{view:t,date:n}=I(),r=u.useCallback(s=>{e({to:i,params:s,search:!0,hash:a})},[e,a]);return u.useMemo(()=>({goToView:s=>r({view:s,date:n}),step:s=>r({view:t,date:C(n,t,s)}),goToToday:()=>r({view:t,date:m(new Date)}),setAnchorDate:s=>e({to:i,params:{view:t,date:s},search:!0,hash:a,replace:!0}),zoomToDay:s=>r({view:"day",date:s}),openEvent:(s,o)=>e(o===void 0||o===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:n,calendarObjectId:s},search:!0,hash:a}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:n,calendarObjectId:s,recurrenceId:o},search:!0,hash:a}),closeEvent:()=>r({view:t,date:n}),openComposer:()=>e({to:"/calendar/$view/$date/new",params:{view:t,date:n},search:!0,hash:a})}),[r,e,a,t,n])}const c=e=>String(e).padStart(2,"0"),N=e=>`${e.getUTCFullYear()}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`,p=e=>{const a=e<0?"-":"+",t=Math.abs(e);return`${a}${c(Math.floor(t/60))}:${c(t%60)}`};function w(e,a){const t=new Date(`${e}T${a}:00`);return`${e}T${a}:00${p(-t.getTimezoneOffset())}`}const l=new Map;function O(e){if(l.has(e))return l.get(e);let a;try{a=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{a=void 0}return l.set(e,a),a}function h(e,a){const t=O(e);if(!t)return Number.NaN;const n=t.formatToParts(new Date(a)),r=T=>Number(n.find(v=>v.type===T)?.value),s=r("hour")%24;return(Date.UTC(r("year"),r("month")-1,r("day"),s,r("minute"),r("second"))-a)/6e4}function P(e,a,t){if(t==="")return`${e}T${a}:00+00:00`;const n=Date.parse(`${e}T${a}:00Z`),r=h(t,n);if(Number.isNaN(r))return w(e,a);const s=h(t,n-r*6e4);return`${e}T${a}:00${p(Number.isNaN(s)?r:s)}`}const $=e=>w(e,"00:00");function f(e,a){const[t,n,r]=e.split("-").map(Number);return N(new Date(Date.UTC(t,n-1,r+a)))}function U(e){const[a,t,n]=e.split("-").map(Number),r=new Date(Date.UTC(a,t-1,n));return f(e,-((r.getUTCDay()+6)%7))}function E(e,a){const[t,n]=a.split("-").map(Number);if(e==="year")return[`${t}-01-01`,`${t+1}-01-01`];if(e==="month"){const s=`${t}-${c(n)}-01`,o=n===12?`${t+1}-01-01`:`${t}-${c(n+1)}-01`;return[s,o]}if(e==="day")return[a,f(a,1)];const r=U(a);return[r,f(r,7)]}function S(e,a){const[t,n]=E(e,a);return{from:$(t),to:$(n)}}export{f as a,A as b,S as c,z as d,j as e,P as i,I as u};
1
+ import{a8 as d,eg as g,r as u,eh as y,bQ as m,u as D,ce as b,ef as C}from"./index-Dx85_wSY.js";const i="/calendar/$view/$date";function I(){const e=d({from:i,shouldThrow:!1}),a=g({from:i,shouldThrow:!1}),t=e?.view??"",n=e?.date??"",r=a?.calendarId;return u.useMemo(()=>({...y({view:t,date:n},m(new Date)),calendarIds:r??[]}),[t,n,r])}function z(){const e=d({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),a=d({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),t=e?.calendarObjectId,n=a?.recurrenceId;return u.useMemo(()=>t?{calendarObjectId:t,recurrenceId:n}:void 0,[t,n])}function j(){return d({from:"/calendar/$view/$date/new",shouldThrow:!1})!==void 0}function A(){const e=D(),a=b(),{view:t,date:n}=I(),r=u.useCallback(s=>{e({to:i,params:s,search:!0,hash:a})},[e,a]);return u.useMemo(()=>({goToView:s=>r({view:s,date:n}),step:s=>r({view:t,date:C(n,t,s)}),goToToday:()=>r({view:t,date:m(new Date)}),setAnchorDate:s=>e({to:i,params:{view:t,date:s},search:!0,hash:a,replace:!0}),zoomToDay:s=>r({view:"day",date:s}),openEvent:(s,o)=>e(o===void 0||o===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:n,calendarObjectId:s},search:!0,hash:a}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:n,calendarObjectId:s,recurrenceId:o},search:!0,hash:a}),closeEvent:()=>r({view:t,date:n}),openComposer:()=>e({to:"/calendar/$view/$date/new",params:{view:t,date:n},search:!0,hash:a})}),[r,e,a,t,n])}const c=e=>String(e).padStart(2,"0"),N=e=>`${e.getUTCFullYear()}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`,p=e=>{const a=e<0?"-":"+",t=Math.abs(e);return`${a}${c(Math.floor(t/60))}:${c(t%60)}`};function w(e,a){const t=new Date(`${e}T${a}:00`);return`${e}T${a}:00${p(-t.getTimezoneOffset())}`}const l=new Map;function O(e){if(l.has(e))return l.get(e);let a;try{a=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{a=void 0}return l.set(e,a),a}function h(e,a){const t=O(e);if(!t)return Number.NaN;const n=t.formatToParts(new Date(a)),r=T=>Number(n.find(v=>v.type===T)?.value),s=r("hour")%24;return(Date.UTC(r("year"),r("month")-1,r("day"),s,r("minute"),r("second"))-a)/6e4}function P(e,a,t){if(t==="")return`${e}T${a}:00+00:00`;const n=Date.parse(`${e}T${a}:00Z`),r=h(t,n);if(Number.isNaN(r))return w(e,a);const s=h(t,n-r*6e4);return`${e}T${a}:00${p(Number.isNaN(s)?r:s)}`}const $=e=>w(e,"00:00");function f(e,a){const[t,n,r]=e.split("-").map(Number);return N(new Date(Date.UTC(t,n-1,r+a)))}function U(e){const[a,t,n]=e.split("-").map(Number),r=new Date(Date.UTC(a,t-1,n));return f(e,-((r.getUTCDay()+6)%7))}function E(e,a){const[t,n]=a.split("-").map(Number);if(e==="year")return[`${t}-01-01`,`${t+1}-01-01`];if(e==="month"){const s=`${t}-${c(n)}-01`,o=n===12?`${t+1}-01-01`:`${t}-${c(n+1)}-01`;return[s,o]}if(e==="day")return[a,f(a,1)];const r=U(a);return[r,f(r,7)]}function S(e,a){const[t,n]=E(e,a);return{from:$(t),to:$(n)}}export{f as a,A as b,S as c,z as d,j as e,P as i,I as u};
package/index.html CHANGED
@@ -38,7 +38,7 @@
38
38
  } catch (_) {}
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-D855R0Fw.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-Dx85_wSY.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-SEZpqOSx.css">
43
43
  </head>
44
44
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client-dist",
3
- "version": "0.0.524",
3
+ "version": "0.0.526",
4
4
  "description": "Built Remit web client — static assets and the default runtime config.",
5
5
  "files": [
6
6
  "**/*"
@@ -1 +0,0 @@
1
- import{bU as Ss,bV as ys,j as r,cK as Cs,B as ct,f as te,U as Is,t as Ee,g as Lt,r as c,Y as js,Z as ks,bo as Ts,h as Ct,c as It,ac as ws,i as jt,cL as Ms,cB as Rs,I as Es,a6 as Os,a2 as _t,bO as As,bi as Ns,cM as zs,cN as Fs,as as Pt,aX as Ds,aY as Ls,a1 as _s,q as kt,m as Ps,M as Bt,bl as Bs,G as $s,bm as Ws,bn as Ks,cO as Vs,o as qs,cP as Hs,cz as Qs,s as Us,cQ as Js,cR as Gs,C as $t,ch as Ys,ah as Xs,cS as Zs,cT as en,aj as tn,cU as sn,bx as nn}from"./index-D855R0Fw.js";import{u as on,p as rn,R as an}from"./useSearchTokenContext-D1NKXhM6.js";import{u as ln,a as cn,R as dn}from"./useRefreshControl-9O_O25oC.js";import{C as Wt,a as Kt,c as Vt,j as un,M as hn,t as qt,u as fn,b as mn,d as Ht,e as Qt,f as gn,g as pn,h as xn,r as bn,n as vn,i as Sn,k as yn,l as Cn,m as In,o as jn,S as kn,p as Tn,D as wn,q as Mn,s as Rn,v as Ut,w as En,x as On,y as An,z as Nn,A as zn,B as Jt,E as Fn,F as Dn,G as Ln,H as _n,I as At,J as Nt,K as Pn,L as Bn,N as $n,O as Wn,P as Kn,Q as Vn,R as qn,T as Hn,U as Qn,V as Un,W as Jn,X as Gn,Y as Gt,Z as Yt,_ as Xt,$ as Yn,a0 as Xn,a1 as Zn,a2 as eo,a3 as to,a4 as so,a5 as no}from"./MailListHeader-kD_OYiqE.js";import{S as oo,M as io,a as ro,i as ao,h as lo,t as co,u as uo,b as ho,c as fo,f as mo,d as go,s as po}from"./MailViewChrome-B6yFR2VU.js";import{A as Tt}from"./avatar-CMlohog8.js";import{c as Ue,d as xo,e as Zt}from"./format-Cc3aS3ot.js";import{c as bo,f as vo,a as So,u as yo}from"./useMessageBodyContent-I6J6WaYN.js";import{g as Je,i as Co,t as Io,h as jo,j as ko,k as To,l as wo}from"./search-token-index-CXxBVdX5.js";import{N as Mo}from"./NavMenuButton-xOndgihg.js";import{C as Ro}from"./confirm-dialog-BTkV4N2t.js";import{f as Eo}from"./ErrorState--2p5I6wj.js";import{a as Oo}from"./useLabels-BS3G7NVR.js";import{L as Ao,r as No,u as zo}from"./useSemanticSearch-F_a8SnAV.js";import{S as dt}from"./shield-check-D_NOwpHN.js";import{B as Fo}from"./bottom-sheet-FUNFJG28.js";import{C as Do}from"./circle-help-W-bok798.js";import{C as Lo}from"./circle-check-B73TBv-p.js";import{u as _o}from"./useLayoutTier-BHxPbufX.js";import{n as Po}from"./search-query-Cr_ZXBCp.js";import{u as Bo}from"./sections-BKWo2Deh.js";const $o=({children:e,onRefresh:o,isRefreshing:t})=>Ss(ys)?e:r.jsx(Cs,{onRefresh:o,isPullable:!t,children:e}),Wo=e=>e===1?"message":"messages";function Ko({count:e,onReview:o,onDismiss:t,actionLabel:s="Review & rescue"}){return r.jsx(ct,{tone:"info",variant:"soft",onDismiss:t,children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("p",{className:"flex items-start gap-2 text-sm text-fg",children:[r.jsx(dt,{className:"mt-0.5 size-4 shrink-0 text-positive","aria-hidden":!0}),r.jsxs("span",{children:[r.jsx("span",{className:"font-semibold text-fg",children:`${e} ${Wo(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(te,{variant:"primary",size:"sm",onClick:o,className:"self-start",children:s})]})})}const Vo=(e,o)=>e==="vip"?"vip":e==="unknown"&&o==="md"?"unknown-pill":"hidden",es=({senderTrust:e,size:o="sm",className:t})=>{const s=Vo(e,o);return s==="vip"?r.jsx(Is,{className:Ee("text-warning shrink-0",o==="sm"&&"size-3.5",o==="md"&&"size-4",t),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):s==="unknown-pill"?r.jsx("span",{className:Ee("inline-flex items-center rounded border border-dashed border-fg-subtle/40 font-medium uppercase tracking-wide text-fg-muted/80 shrink-0","px-2 py-0.5 text-xs",t),title:"First message from this sender","aria-label":"First message from this sender","data-testid":"sender-trust-unknown",children:"new"}):null};function qo({candidate:e,selected:o,onToggle:t,hideSender:s=!1}){const{senderName:n,senderAddress:i,subject:l,snippet:a,trustReason:d,trustSubReason:u,senderTrust:h}=e;return r.jsxs("label",{className:Ee("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",s&&"pl-11",o?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[r.jsx(Wt,{className:"mt-0.5",checked:o,onChange:t,"aria-label":`${o?"Deselect":"Select"} ${s?l:`message from ${n}`}`}),!s&&r.jsx(Tt,{name:n,email:i,size:"sm"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[!s&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:n}),h&&r.jsx(es,{senderTrust:h,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:i})]}),r.jsx("span",{className:"block truncate text-sm text-fg-muted",children:l}),r.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:a}),!s&&r.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Lt,{tone:"positive",children:[r.jsx(dt,{className:"size-3","aria-hidden":!0}),d]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:u})]})]})]})}const Ho=e=>{const o=new Map,t=[];for(const s of e){const n=(s.senderAddress||s.senderName).toLowerCase(),i=o.get(n);if(i){i.messages.push(s);continue}o.set(n,{key:n,senderName:s.senderName,senderAddress:s.senderAddress,trustReason:s.trustReason,trustSubReason:s.trustSubReason,senderTrust:s.senderTrust,messages:[s]}),t.push(n)}return t.map(s=>o.get(s)).sort((s,n)=>n.messages.length-s.messages.length)},Qo=(e,o)=>{const t=e.messages.filter(s=>o.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},zt=e=>e===1?"message":"messages";function Uo({group:e,selected:o,onToggleGroup:t,onToggleMessage:s}){const[n,i]=c.useState(!1),l=Qo(e,o),a=e.messages.length,d=n?js:ks;return r.jsxs("div",{className:Ee(l!=="none"?"bg-positive/10":"bg-surface"),children:[r.jsxs("div",{className:"flex w-full items-start gap-3 px-3 py-2.5",children:[r.jsx(Wt,{className:"mt-0.5",checked:l==="all",indeterminate:l==="some",onChange:()=>t(e,l!=="all"),"aria-label":`${l==="all"?"Deselect":"Select"} all ${a} ${zt(a)} from ${e.senderName}`}),r.jsx(Tt,{name:e.senderName,email:e.senderAddress,size:"sm"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:e.senderName}),e.senderTrust&&r.jsx(es,{senderTrust:e.senderTrust,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:e.senderAddress})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Lt,{tone:"positive",children:[r.jsx(dt,{className:"size-3","aria-hidden":!0}),e.trustReason]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:e.trustSubReason})]})]}),r.jsxs("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":n,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-2xs text-fg-muted transition-colors hover:bg-surface-sunken hover:text-fg",children:[`${a} ${zt(a)}`,r.jsx(d,{className:"size-3.5","aria-hidden":!0})]})]}),n&&r.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(u=>r.jsx(qo,{candidate:u,selected:o.has(u.id),onToggle:()=>s(u.id),hideSender:!0},u.id))})]})}const wt=e=>e===1?"message":"messages",Jo=(e,o)=>`Moves ${e===1?"this message":`these ${e} ${wt(e)}`} out of Spam to ${o} now. Nothing later.`,yt=(e,o)=>e.find(t=>t.id===o)?.label??"Inbox";function Go(){return r.jsx(ct,{tone:"info",variant:"soft",children:r.jsx("p",{className:"text-2xs text-fg-muted",children:"We list a message here only when we can confirm the sender is who they say — usually someone you've emailed before, write to often, or a service that consistently checks out. We never guess from words in the subject. Anything we can't confirm stays in Spam."})})}function Yo({candidates:e,selected:o,onToggle:t,onToggleGroup:s,onSelectAll:n,onSelectNone:i,onContinue:l,onCancel:a}){const[d,u]=c.useState(!1),h=o.size,g=c.useMemo(()=>Ho(e),[e]);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r.jsx(dt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(te,{variant:"ghost",size:"sm",icon:r.jsx(Do,{className:"size-3.5"}),onClick:()=>u(m=>!m),className:"-mr-1.5 -mt-0.5",children:"Why these?"})]}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"These look safe — from senders we can verify. Uncheck any sender that belongs in Spam, or open a sender to pick individual messages."}),d&&r.jsx("div",{className:"mt-2",children:r.jsx(Go,{})})]}),r.jsxs("div",{className:"flex items-center justify-between px-row-inset pb-1.5",children:[r.jsx("span",{className:"text-2xs font-medium text-fg-muted",children:`${h} of ${e.length} selected · ${g.length} ${g.length===1?"sender":"senders"}`}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:n,children:"Select all"}),r.jsx(te,{variant:"ghost",size:"sm",onClick:i,children:"Select none"})]})]}),r.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto border-y border-line",children:g.map(m=>r.jsx(Uo,{group:m,selected:o,onToggleGroup:s,onToggleMessage:t},m.key))}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx(te,{variant:"primary",onClick:l,className:"h-11 w-full font-semibold",children:`Continue with ${h} ${wt(h)}`}),r.jsx(te,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function Xo({count:e,folders:o,delimiter:t,destination:s,onPick:n,onMove:i,onBack:l}){const[a,d]=c.useState(!1);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Where should they go?"}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Pick a folder, then we move them out of Spam."})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-row-inset py-2",children:a?r.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-line bg-surface",children:r.jsx(Ts,{folders:o,selectedId:s,delimiter:t,onSelect:n,onCancel:()=>d(!1)})}):r.jsxs("div",{className:"rounded-xl border border-line bg-surface-sunken p-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:"Destination"}),r.jsx("p",{className:"mt-0.5 text-sm font-medium text-fg",children:yt(o,s)}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>d(!0),className:"mt-2 px-0",children:"Move to a different folder"})]})}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:Jo(e,yt(o,s))}),r.jsx(te,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(te,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Back"})]})]})}function Zo({count:e,destinationLabel:o,onClose:t}){return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-row-inset py-10 text-center",children:[r.jsx(Lo,{className:"size-10 text-positive","aria-hidden":!0}),r.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${wt(e)} out of Spam.`}),r.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${o}.`})]}),r.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:r.jsx(te,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function ei({open:e,candidates:o,defaultDestinationId:t,availableFolders:s,delimiter:n,onConfirmMove:i,onCancel:l}){const[a,d]=c.useState("review"),[u,h]=c.useState(()=>e?new Set(o.map(I=>I.id)):new Set),[g,m]=c.useState(t),[p,C]=c.useState(0),b=c.useRef(!1);c.useEffect(()=>{e&&!b.current&&(d("review"),h(new Set(o.map(I=>I.id))),m(t),C(0)),b.current=e},[e,o,t]);const T=u.size,v=I=>{h(j=>{const E=new Set(j);return E.has(I)?E.delete(I):E.add(I),E})},x=(I,j)=>{h(E=>{const O=new Set(E);for(const L of I.messages)j?O.add(L.id):O.delete(L.id);return O})},w=()=>{const I=Array.from(u);C(I.length),i(I,g),d("done")};return r.jsxs(Fo,{open:e,onClose:l,dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(Yo,{candidates:o,selected:u,onToggle:v,onToggleGroup:x,onSelectAll:()=>h(new Set(o.map(I=>I.id))),onSelectNone:()=>h(new Set),onContinue:()=>d("destination"),onCancel:l}),a==="destination"&&r.jsx(Xo,{count:T,folders:s,delimiter:n,destination:g,onPick:m,onMove:w,onBack:()=>d("review")}),a==="done"&&r.jsx(Zo,{count:p,destinationLabel:yt(s,g),onClose:l})]})}function ti(e){const o=e.toAddresses.join(", ");return{id:e.outboxMessageId,accountId:e.accountId,fromName:e.fromName??e.fromAddress??"Me",fromEmail:e.fromAddress??"",subject:e.subject??"(No subject)",snippet:o?`To: ${o}`:"(No recipients)",timeLabel:Ue(e.updatedAt),isRead:!0}}function si(e){return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ue(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0}}function ni({outboxMessages:e,accountId:o,imapThreads:t}){const s=e.filter(l=>l.status==="draft"&&l.accountId===o).map(ti),n=t.map(si),i=[];return s.length>0&&i.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),n.length>0&&i.push({id:"imap-drafts",label:"On the server",threads:n}),i}const oi=({label:e,count:o})=>r.jsxs("div",{className:"sticky top-0 z-10 flex items-baseline justify-between border-b border-line bg-surface-sunken px-row-inset py-1",children:[r.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),r.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:o})]}),ii=({row:e,isSelected:o,onOpen:t,onDelete:s,isDeleting:n})=>r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ee("group",Vt({active:o})),children:[r.jsx(Os,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(Kt,{thread:e}),r.jsx("div",{className:"flex items-center gap-1 shrink-0",children:r.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),s(e.id)},disabled:n,className:"p-1.5 rounded-md text-fg-muted hover:text-danger hover:bg-surface-raised transition-colors opacity-0 group-hover:opacity-100 focus:opacity-100",title:"Delete draft",children:r.jsx(_t,{className:"size-3.5"})})})]}),ri=({row:e,isSelected:o,onOpen:t})=>{const s=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Ee("group",Vt({active:o})),children:[s&&r.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),r.jsx(Tt,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(Kt,{thread:e})]})};function ai({accountId:e,selectedMessageId:o,imapThreads:t,title:s,unreadCount:n}){const i=bo(),l=vo(),a=Je(),d=Ct(),{data:u}=It(ws()),h=c.useMemo(()=>ni({outboxMessages:u?.items??[],accountId:e,imapThreads:t}),[u?.items,e,t]),g=jt({...Rs(),onSuccess:()=>{d.invalidateQueries({queryKey:Ms()})}}),m=b=>{g.mutate({path:{outboxMessageId:b}})},p=b=>{const T=t.find(v=>v.messageId===b)?.threadId;T&&a({threadId:T,messageId:b})},C=h.length===0;return r.jsxs("section",{className:"flex h-full w-full flex-col bg-surface",children:[r.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[r.jsx(Mo,{}),r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),(n??0)>0&&r.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[n," unread"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:C?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(Es,{className:"size-8 text-fg-subtle"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"No drafts"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Messages you start composing will appear here."})]}):h.map(b=>r.jsxs("div",{children:[b.label&&r.jsx(oi,{label:b.label,count:b.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:b.threads.map(T=>b.id==="remit-drafts"?r.jsx(ii,{row:T,isSelected:T.id===i,onOpen:l,onDelete:m,isDeleting:g.isPending},T.id):r.jsx(ri,{row:T,isSelected:T.id===o,onOpen:p},T.id))})]},b.id))})]})}const ts=e=>e===1?"1 message":`${Zt(e)} messages`,li=e=>({title:"Empty Trash?",description:`${ts(e)} ${e===1?"is":"are"} erased from the mail server and cannot be restored.`,confirmLabel:"Empty Trash"}),ci=(e,o={})=>{const{trashFolderLabel:t,staleFolderLabel:s}=o;if(e==="unconfirmed"){const n=xo(0,"unconfirmed",{trashFolderLabel:t});return{headline:n.title,body:n.description,actionLabel:n.confirmLabel}}return e==="stale"?{headline:"Nothing was emptied.",body:s?`The folder you chose for Trash — ${s} — is gone from the mail server.`:"The folder you chose for Trash is gone from the mail server.",actionLabel:"Pick another folder"}:{headline:"Nothing was emptied.",body:"No folder on this account is set as Trash.",actionLabel:"Pick a folder"}};function di({messageCount:e,isEmptying:o,deletedCount:t,refusalReason:s,trashFolderLabel:n,staleFolderLabel:i,onEmpty:l,onRepair:a,children:d}){const[u,h]=c.useState(!1);if(e<1&&s===void 0&&t===void 0)return r.jsx(r.Fragment,{children:d});const g=s?ci(s,{trashFolderLabel:n,staleFolderLabel:i}):void 0,m=li(e);return r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:r.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-line px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t!==void 0&&r.jsx("p",{className:"mr-auto text-2xs text-fg-subtle",role:"status",children:`${ts(t)} erased from the mail server.`}),r.jsx(te,{variant:"ghost",size:"sm",icon:r.jsx(_t,{className:"size-3.5","aria-hidden":!0}),disabled:o||e<1,"aria-busy":o,onClick:()=>h(!0),children:o?"Emptying…":"Empty Trash"})]}),g&&r.jsx(ct,{tone:"warning",variant:"soft",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("p",{className:"font-semibold text-fg",children:g.headline}),r.jsx("p",{className:"text-sm",children:g.body}),r.jsx(te,{variant:"primary",size:"sm",className:"self-start",onClick:a,children:g.actionLabel})]})})]})}),r.jsx("div",{className:"min-h-0 flex-1",children:d}),r.jsx(Ro,{isOpen:u,title:m.title,description:m.description,confirmLabel:m.confirmLabel,destructive:!0,onConfirm:()=>{h(!1),l()},onCancel:()=>h(!1)})]})}function ui(e,o,t){const s=new Array(e);return new Proxy(s,{get(n,i,l){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const d=+i;if(Number.isInteger(d)&&d>=0&&d<e){let u=n[d];if(!u){const h=o[d*2];u=n[d]={index:d,key:t(d),start:h,size:o[d*2+1],end:h+o[d*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(n,i,l)}})}function _e(e,o,t){let s=t.initialDeps??[],n,i=!0;function l(){const a=e();return(a.length!==s.length||a.some((u,h)=>s[h]!==u))&&(s=a,n=o(...a),t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(n),i=!1),n}return l.updateDeps=a=>{s=a},l}function Ft(e,o){if(e===void 0)throw new Error("Unexpected undefined");return e}const hi=(e,o)=>Math.abs(e-o)<1.01,fi=(e,o,t)=>{let s;return function(...n){e.clearTimeout(s),s=e.setTimeout(()=>o.apply(this,n),t)}};let Qe;const vt=()=>{if(Qe!==void 0)return Qe;if(typeof navigator>"u")return Qe=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Qe=!0;const e=navigator.maxTouchPoints;return Qe=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Dt=e=>{const{offsetWidth:o,offsetHeight:t}=e;return{width:o,height:t}},mi=e=>e,gi=e=>{const o=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-o+1,n=new Array(s);for(let i=0;i<s;i++)n[i]=o+i;return n},pi=(e,o)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const n=l=>{const{width:a,height:d}=l;o({width:Math.round(a),height:Math.round(d)})};if(n(Dt(t)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(l=>{const a=()=>{const d=l[0];if(d?.borderBoxSize){const u=d.borderBoxSize[0];if(u){n({width:u.inlineSize,height:u.blockSize});return}}n(Dt(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},lt={passive:!0},xi=typeof window>"u"?!0:"onscrollend"in window,bi=(e,o,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;const i=e.options.useScrollendEvent&&xi;let l=0;const a=i?null:fi(n,()=>o(l,!1),e.options.isScrollingResetDelay),d=g=>()=>{l=t(s),a?.(),o(l,g)},u=d(!0),h=d(!1);return s.addEventListener("scroll",u,lt),i&&s.addEventListener("scrollend",h,lt),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",h)}},vi=(e,o)=>bi(e,o,t=>{const{horizontal:s,isRtl:n}=e.options;return s?t.scrollLeft*(n&&-1||1):t.scrollTop}),Si=(e,o,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(e),n=t.options.getItemKey(s);return t.itemSizeCache.get(n)??t.options.estimateSize(s)}if(o?.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!o){const s=t.indexFromElement(e),n=t.options.getItemKey(s),i=t.itemSizeCache.get(n);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},yi=(e,{adjustments:o=0,behavior:t},s)=>{var n,i;(i=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||i.call(n,{[s.options.horizontal?"left":"top"]:e+o,behavior:t})},Ci=yi;class Ii{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,s,n;return((n=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:n.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(n=>{n.forEach(i=>{const l=()=>{const a=i.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,h]of this.elementsCache)if(h===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),t=null},observe:n=>{var i;return(i=s())==null?void 0:i.observe(n,{box:"border-box"})},unobserve:n=>{var i;return(i=s())==null?void 0:i.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{var s,n;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mi,rangeExtractor:gi,onChange:()=>{},measureElement:Si,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in t){const p=t[m];p!==void 0&&(i[m]=p)}const l=this.options;let a=null,d=null,u=!1;if(l!==void 0&&l.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,p=i.count,C=this.getMeasurements(),b=m>0?((s=C[0])==null?void 0:s.key)??l.getItemKey(0):null,T=m>0?((n=C[m-1])==null?void 0:n.key)??l.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==T)){u=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??C[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const I=i.followOnAppend===!0?"auto":i.followOnAppend||null;I&&p>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==T)&&(d=I)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,g=0;if(a&&this.scrollOffset!==null){const[m,p]=a,C=this.getMeasurements(),{count:b,getItemKey:T}=this.options;let v=0;for(;v<b&&T(v)!==m;)v++;if(v<b){const x=C[v];if(x){const w=x.start+p;w!==this.scrollOffset&&(g=w-this.scrollOffset,this.scrollOffset=w,h=!0)}}}(h||d)&&(this.pendingScrollAnchor=[h?a[0]:null,h?a[1]:0,d,g])},this.notify=t=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,t)},this.maybeNotify=_e(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,l)=>{if(l&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=l?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!vt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",l,lt),i.addEventListener("touchend",a,lt),this.unsubs.push(()=>{i.removeEventListener("touchstart",l),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[i,l,a,d]=n;i!==null&&!a&&(vt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?d!==0&&(this._iosDeferredAdjustment+=d):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=_e(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,n,i,l,a,d,u)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:n,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:d,gap:u}),{key:!1}),this.getMeasurements=_e(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:n,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:d,gap:u},h)=>{const g=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),a===1){const v=t*2;let x=this._flatMeasurements;if(!x||x.length<v){const j=new Float64Array(v);x&&m>0&&j.set(x.subarray(0,m*2)),x=j,this._flatMeasurements=x}let w;if(m===0)w=s+n;else{const j=m-1;w=x[j*2]+x[j*2+1]+u}for(let j=m;j<t;j++){const E=i(j),O=g.get(E),L=typeof O=="number"?O:this.options.estimateSize(j);x[j*2]=w,x[j*2+1]=L,w+=L+u}const I=ui(t,x,i);return this.measurementsCache=I,I}const p=this.measurementsCache.slice(0,m),C=new Array(a).fill(void 0),b=new Float64Array(a);let T=0;for(let v=0;v<m;v++){const x=p[v];x&&(C[x.lane]===void 0&&T++,C[x.lane]=v,b[x.lane]=x.end)}for(let v=m;v<t;v++){const x=i(v),w=this.laneAssignments.get(v);let I,j;const E=d==="estimate"||g.has(x);if(w!==void 0&&this.options.lanes>1){I=w;const F=C[I],J=F!==void 0?p[F]:void 0;j=J?J.end+u:s+n}else if(T===a){let F=0,J=b[0],_=C[0];for(let G=1;G<a;G++){const se=b[G];(se<J||se===J&&C[G]<_)&&(F=G,J=se,_=C[G])}I=F,j=J+u,E&&this.laneAssignments.set(v,I)}else I=v%this.options.lanes,j=s+n,E&&this.laneAssignments.set(v,I);const O=g.get(x),L=typeof O=="number"?O:this.options.estimateSize(v),A=j+L;p[v]={index:v,start:j,size:L,end:A,key:x,lane:I},C[I]===void 0&&T++,C[I]=v,b[I]=A}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=_e(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,n,i)=>t.length===0||s===0?(this.range=null,null):(this.range=ki(t,s,n,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=_e(()=>{let t=null,s=null;const n=this.calculateRange();return n&&(t=n.startIndex,s=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,n,i,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,overscan:s,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,n=t.getAttribute(s);return n?parseInt(n,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(n!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,n-i),a=Math.min(this.options.count-1,n+i);return t>=l&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,a)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(a))});return}const s=this.indexFromElement(t),n=this.options.getItemKey(s),i=this.elementsCache.get(n);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(n,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var n,i;if(t<0||t>=this.options.count)return;let l,a,d;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)d=this.options.getItemKey(t),a=u[t*2],l=u[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;d=m.key,a=m.start,l=m.size}const h=this.itemSizeCache.get(d)??l,g=s-h;if(g!==0){const m=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,C=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:d,start:a,size:l,end:a+l,lane:0},g,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(d)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(d,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):C&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=_e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const n=[];for(let i=0,l=t.length;i<l;i++){const a=t[i],d=s[a];n.push(d)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length===0)return;const n=this._flatMeasurements,i=this.options.lanes===1&&n!=null,l=ss(0,s.length-1,i?a=>n[a*2]:a=>Ft(s[a]).start,t);return Ft(s[l])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,n=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+i?"end":"start"),s==="center"?t+=(n-i)/2:s==="end"&&(t-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),i=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=i+n-this.options.scrollPaddingEnd)s="end";else if(l.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,l.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:n="auto"}={})=>{const i=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:n,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:n="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,s);if(!i)return;const[l,a]=i,d=this.now();this.scrollState={index:t,align:a,behavior:n,startedAt:d,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const n=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let n;if(s.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,l=this._flatMeasurements;l!=null?n=l[i*2]+l[i*2+1]:n=((t=s[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let l=s.length-1;for(;l>=0&&i.some(a=>a===null);){const a=s[l];i[a.lane]===null&&(i[a.lane]=a.end),l--}n=Math.max(...i.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const n of s)n&&this.itemSizeCache.has(n.key)&&t.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:n})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:n,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(o)}applyScrollAdjustment(o,t){o!==0&&(vt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=o:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=s?s[0]:this.scrollState.lastTargetOffset,i=1,l=n!==this.scrollState.lastTargetOffset;if(!l&&hi(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const a=this.getSize()||600,d=Math.abs(n-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&d>a;this.scrollState.lastTargetOffset=n,u||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ss=(e,o,t,s)=>{for(;e<=o;){const n=(e+o)/2|0,i=t(n);if(i<s)e=n+1;else if(i>s)o=n-1;else return n}return e>0?e-1:0};function ji(e,o,t){let s=0;for(;s<=o;){const n=(s+o)/2|0,i=e[n*2];if(i<t)s=n+1;else if(i>t)o=n-1;else return n}return s>0?s-1:0}function ki(e,o,t,s,n){const i=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:i};if(s===1&&n!==null){const u=ji(n,i,t);let h=u;const g=t+o;for(;h<i&&n[h*2]+n[h*2+1]<g;)h++;return{startIndex:u,endIndex:h}}let a=ss(0,i,u=>e[u].start,t),d=a;if(s===1)for(;d<i&&e[d].end<t+o;)d++;else if(s>1){const u=Array(s).fill(0);for(;d<i&&u.some(g=>g<t+o);){const g=e[d];u[g.lane]=g.end,d++}const h=Array(s).fill(t+o);for(;a>=0&&h.some(g=>g>=t);){const g=e[a];h[g.lane]=g.start,a--}a=Math.max(0,a-a%s),d=Math.min(i,d+(s-1-d%s))}return{startIndex:a,endIndex:d}}const St=typeof document<"u"?c.useLayoutEffect:c.useEffect;function Ti({useFlushSync:e=!0,directDomUpdates:o=!1,directDomUpdatesMode:t="transform",...s}){const n=c.useReducer(u=>u+1,0)[1],i=c.useRef({enabled:o,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=o,i.current.mode=t;const l=u=>{const h=i.current;if(!h.enabled||!h.container)return;const g=u.getTotalSize();if(g!==h.lastSize){h.lastSize=g;const v=u.options.horizontal?"width":"height";h.container.style[v]=`${g}px`}const m=!!u.options.horizontal,p=h.mode==="transform",C=m?"left":"top",b=u.options.scrollMargin,T=u.getVirtualItems();for(const v of T){const x=v.start-b,w=u.elementsCache.get(v.key);w&&h.lastPositions.get(w)!==x&&(h.lastPositions.set(w,x),p?w.style.transform=m?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:w.style[C]=`${x}px`)}},a={...s,onChange:(u,h)=>{var g;const m=i.current;let p=!0;if(m.enabled){l(u);const C=u.range,b=m.prevRange;p=!b||b.isScrolling!==u.isScrolling||b.startIndex!==C?.startIndex||b.endIndex!==C?.endIndex,p&&(m.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:u.isScrolling}:null)}p&&(e&&h?As.flushSync(n):n()),(g=s.onChange)==null||g.call(s,u,h)}},[d]=c.useState(()=>{const u=new Ii(a);return Object.assign(u,{containerRef:h=>{const g=i.current;if(g.container=h,g.lastSize=null,h&&g.enabled){const m=u.getTotalSize();g.lastSize=m;const p=u.options.horizontal?"width":"height";h.style[p]=`${m}px`}}})});return d.setOptions(a),St(()=>d._didMount(),[]),St(()=>d._willUpdate()),St(()=>{l(d)}),d}function wi(e){return Ti({observeElementRect:pi,observeElementOffset:vi,scrollToFn:Ci,...e})}const Mt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",Mi=e=>`Select all ${Mt(e)}`,Ri=(e,o)=>`All ${Zt(o)} ${Mt(e)} selected`,Ei=({verb:e,confirmingDelete:o,hasSelection:t,junkMailboxId:s,currentMailboxId:n,deletableMessageId:i})=>{if(o)return{kind:"withheld"};if(e==="junk"){const l=un(s,n);if(l!==void 0)return{kind:"unavailable",reason:l}}return t?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},Oi=(e,o,t)=>e==="BACK"&&o&&t===void 0,Ai=(e,o)=>({id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ue(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:qt(e.category),messageCount:o,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels}),Ni=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,messageCount:u,isMultiSelectMode:h,onLongPress:g,isDesktop:m,density:p})=>r.jsx(hn,{thread:Ai(e,u),link:{mailboxId:o,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:n,density:p,isDesktop:m,onFocusRow:i,selection:{isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:h,onLongPress:g}}),zi=c.memo(Ni),Fi=e=>{const o=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:Ue(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:qt(e.category),suspicious:o}},Di=({thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:h,isDesktop:g,onDelete:m,onToggleRead:p,density:C})=>{const[b,T]=c.useState("none"),v=Je(),x=c.useCallback(O=>{navigator.vibrate?.(10),O==="trailing"?m(e.messageId):p(e.messageId,e.isRead),T("none")},[m,p,e.messageId,e.isRead]),w=c.useCallback(()=>{h(e.messageId)},[h,e.messageId]),I=c.useCallback(()=>{a(e.messageId)},[a,e.messageId]),j=c.useCallback(()=>{v({threadId:e.threadId,messageId:e.messageId})},[v,e.threadId,e.messageId]),E=fn(e.messageId,d);return g||u?r.jsx(zi,{thread:e,mailboxId:o,isSelected:t,isFocused:s,isTabStop:n,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:d,isMultiSelectMode:u,onLongPress:h,isDesktop:g,density:C}):r.jsx("div",{role:"presentation",onPointerDownCapture:E.onMouseDown,onClickCapture:E.claimClick,onContextMenu:E.onContextMenu,children:r.jsx(oo,{thread:Fi(e),selectionMode:!1,checked:!1,active:t,peek:b,onPeek:T,onToggleCheck:I,onLongPress:w,onOpen:j,onAct:x})})},Li=72,_i=32,Pi=5,ns="remit:list-density",Bi=()=>{try{const e=localStorage.getItem(ns);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},$i=({query:e})=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface-sunken/30",children:[r.jsx(_s,{className:"size-4 text-fg-muted"}),r.jsxs("span",{className:"text-sm text-fg-muted",children:["Results for “",e,"”"]})]}),Wi=(e,o,t)=>No(e.filter(s=>o.has(s.messageId)).map(s=>s.accountId??t)).moveDisabledHint,Ki=({mailboxId:e,threads:o,selectedMessageId:t,isLoading:s,isError:n=!1,error:i,onRetry:l,searchQuery:a,searchPredicate:d,onDeleteMessages:u,isDeleting:h=!1,isMoving:g=!1,onLoadMore:m,hasMore:p=!1,isLoadingMore:C=!1,accountId:b,listTitle:T,listMeta:v,listFilter:x,listScopeLabel:w,onTriageContextChange:I,commandsRef:j,hideHeader:E=!1})=>{const O=c.useRef(null),L=Je(),A=Ns(),F=zs(),{verb:J,start:_,startFromSearch:G}=F,se=Fs(),pe=!!a?.trim(),P=mn(),{labels:Pe}=Oo(b),{pushError:ae}=Pt(),[M,Ce]=c.useState(t),[W,Ie]=c.useState(),K=c.useCallback(f=>{Ie(S=>S===f?S:void 0),Ce(f)},[]),[D,Be]=c.useState(Bi),xe=c.useCallback(()=>{Be(f=>{const S=f==="comfortable"?"compact":"comfortable";try{localStorage.setItem(ns,S)}catch{}return S})},[]),{toggleReadFor:be}=Ht({mailboxId:e}),{junkMailboxId:le}=Qt(b),Oe=Ut(le,e),Ae=c.useMemo(()=>[{accountId:b,mailboxId:e}],[b,e]),{outcome:ce,staleFolderLabel:V,guessedMailboxId:q}=gn(Ae),{selectedIds:Z,selectedCount:H,hasSelection:oe,isSelected:Ne,toggle:ee,select:je,clearSelection:de,selectRange:ue,setAnchor:N,selectAll:ke,toggleAll:$e,intersectWith:ze}=pn(),R=Rn(H,A),[Fe,he]=c.useState(null),We=pe&&!!d,Ge=`${e}|${JSON.stringify(d??{})}`,k=xn({mailboxId:e,accountId:b,enabled:We,predicateKey:Ge,searchQuery:d??{}}),Ye=c.useCallback((f,S,ge)=>{const U=bn(f,S,ge,ce);U&&ae(U)},[ae,ce]),Te=k.phase.kind,Xe=k.clear,z=c.useCallback(()=>{Te==="escalated"&&Xe(),de()},[de,Xe,Te]),[Ze,et]=c.useState(null),ve=c.useRef(null),ie=c.useRef(!1),Se=c.useRef(null),we=!s&&o.length>0,ne=wi({count:o.length,getScrollElement:()=>O.current,estimateSize:()=>D==="compact"?_i:Li,overscan:Pi}),Ke=t?o.findIndex(f=>f.messageId===t):-1,Y=M?o.findIndex(f=>f.messageId===M):-1,re=c.useCallback(f=>{if(f<0||f>=o.length)return;const S=o[f];if(R){ee(S.messageId);return}ve.current=S.messageId,ie.current=!1,Ie(S.messageId),Ce(S.messageId)},[o,R,ee]),Ve=c.useCallback(()=>{if(o.length===0)return;const f=Y<0?0:Math.min(Y+1,o.length-1);re(f)},[o.length,Y,re]),qe=c.useCallback(()=>{if(o.length===0)return;const f=Y<=0?0:Y-1;re(f)},[o.length,Y,re]),ye=c.useCallback(()=>re(0),[re]),Me=c.useCallback(()=>re(o.length-1),[re,o.length]),Re=c.useCallback(()=>{M&&ee(M)},[M,ee]),B=c.useMemo(()=>o.map(f=>f.messageId),[o]),ht=c.useMemo(()=>{const f=[];for(const S of o)Z.has(S.messageId)&&f.push({id:S.messageId,sender:S.fromName??S.fromEmail??"Unknown",email:S.fromEmail??"",subject:S.subject??"(No subject)",date:Ue(S.sentDate),accountId:b});return f},[o,Z,b]),ft=c.useCallback((f,S)=>S.shiftKey?(ue(B,f,M),!0):S.metaKey||S.ctrlKey?(ee(f),!0):(z(),N(f),!1),[B,M,ue,ee,z,N]),fe=c.useCallback(f=>{!u||f.length===0||(Se.current=M??null,he(f))},[u,M]),De=c.useCallback(f=>{const S=vn(B,M,f);S!==void 0&&(ue(B,S),ve.current=S,ie.current=!1,Ie(void 0),Ce(S))},[B,M,ue]),tt=c.useCallback(()=>De(-1),[De]),st=c.useCallback(()=>De(1),[De]),nt=c.useCallback(()=>{B.length>0&&ke(B)},[B,ke]),ot=c.useCallback(f=>{const S=Ei({verb:f,confirmingDelete:Fe!==null,hasSelection:oe,junkMailboxId:le,currentMailboxId:e,deletableMessageId:u?M:void 0});return S.kind==="openWizard"?(_(f),!0):S.kind==="confirmDelete"?(fe([S.messageId]),!0):S.kind==="unavailable"?(ae({severity:"warning",title:S.reason}),!0):S.kind==="withheld"},[Fe,u,oe,le,e,_,M,fe,ae]),me=c.useCallback((f,S)=>{const ge=o.find(U=>U.messageId===f)?.threadId;ge&&L({threadId:ge,messageId:f},{replace:S?.replace})},[L,o]),it=c.useCallback(()=>{M&&me(M)},[M,me]),rt=c.useCallback(f=>me(f,{replace:!0}),[me]);Sn({keyboardFocusedMessageId:W,openMessageId:t,enabled:A&&H===0,open:rt});const Le=k.phase.kind==="escalated"?{scope:Mt(d??{}),total:k.phase.total,searchQuery:d??{},run:f=>k.runAction(f),stop:k.stop}:void 0,mt=c.useCallback(f=>{if(f.length===0){he(null);return}const S=new Set(f),ge=o.findIndex(X=>S.has(X.messageId));let U;for(let X=ge+1;X<o.length;X++)if(!S.has(o[X].messageId)){U=o[X].messageId;break}if(U===void 0){for(let X=ge-1;X>=0;X--)if(!S.has(o[X].messageId)){U=o[X].messageId;break}}u?.(f),z(),Se.current=null,he(null),U!==void 0&&(ve.current=U,ie.current=!1,K(U),A&&me(U,{replace:!0})),A||et(yn("delete",f.length,ce))},[o,u,z,me,A,K,ce]),gt=c.useCallback(()=>{const f=Se.current;Se.current=null,he(null),f!==null&&(ve.current=f,ie.current=!1,K(f))},[K]),He=c.useMemo(()=>Wi(o,Z,b),[b,Z,o]),at=c.useCallback(()=>{if(Le){G();return}_("organize")},[Le,G,_]),pt=c.useCallback(f=>{u?.([f])},[u]),y=c.useCallback((f,S)=>{be([f],!S)},[be]),Q=c.useCallback(f=>{A||je(f)},[A,je]),$=c.useCallback(()=>{if(k.isRunning||k.phase.kind==="counting"){k.stop();return}z()},[k,z]),rs=c.useCallback(()=>{k.clear()},[k]);c.useEffect(()=>{if(ie.current||!A&&t)return;const f=Y>=0?Y:Ke;f>=0&&ne.scrollToIndex(f,{align:"auto"})},[Y,Ke,ne,A,t]),c.useEffect(()=>{t&&(ie.current=!1,K(t))},[t,K]),c.useEffect(()=>{M&&(o.some(f=>f.messageId===M)||K(o[0]?.messageId))},[o,M,K]),c.useEffect(()=>{I?.({focusedMessageId:M,selectedIds:Array.from(Z),hasList:we})},[M,Z,we,I]);const Rt=c.useRef(I);Rt.current=I,c.useEffect(()=>()=>Rt.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1}),[]),c.useEffect(()=>{k.phase.kind!=="idle"||k.isRunning||ze(o.map(f=>f.messageId))},[o,ze,k.phase,k.isRunning]);const Et=c.useRef(e);c.useEffect(()=>{Et.current!==e&&(Et.current=e,z())},[e,z]),Cn({shouldBlockFn:({action:f})=>Oi(f,oe,se)?(z(),!0):!1,enableBeforeUnload:!1,disabled:!oe||se!==void 0}),c.useEffect(()=>{const f=O.current;if(!f||!p||!m)return;const S=()=>{if(C)return;const{scrollTop:ge,scrollHeight:U,clientHeight:X}=f;ge+X>=U-200&&m()};return f.addEventListener("scroll",S,{passive:!0}),S(),()=>f.removeEventListener("scroll",S)},[p,C,m]),c.useEffect(()=>{const f=ve.current;if(!f)return;const S=O.current?.querySelector(`[data-message-id="${f}"]`);S&&(ve.current=null,S.focus({preventScroll:!0}))}),c.useEffect(()=>{if(j){if(!we){j.current=null;return}return j.current={focusNext:Ve,focusPrevious:qe,focusFirst:ye,focusLast:Me,openFocused:it,toggleSelect:Re,extendSelectDown:st,extendSelectUp:tt,selectAll:nt,clearSelection:()=>oe?(z(),!0):!1,requestVerb:ot,toggleDensity:xe},()=>{j.current=null}}},[j,we,Ve,qe,ye,Me,it,Re,st,tt,nt,oe,z,ot,xe]);const Ot=s?"loading":n?"error":o.length===0?"empty":"ready",as=n?Eo(i):void 0,ls=c.useCallback(()=>{const f=Ds(Ls());window.open(f,"_blank","noopener,noreferrer")},[]),cs=[{id:"inbox",threads:[]}],xt=B.length>0&&B.every(f=>Z.has(f)),ds=We&&p&&xt&&!h&&!g&&k.phase.kind==="idle"&&!k.isRunning,us=h||g||k.isRunning,bt=k.phase.kind==="escalated"?k.phase.total:H,hs=k.runningAction?In(k.runningAction.kind,k.progress?.done??0,k.progress?.total??bt):k.phase.kind==="counting"?"Counting matches…":k.phase.kind==="escalated"?Ri(d??{},k.phase.total):void 0,fs=k.phase.kind!=="escalated"&&B.length>0?{checked:xt,indeterminate:H>0&&!xt,onChange:()=>$e(B)}:void 0,ms=k.runningAction?{value:k.progress?.done??0,max:k.progress?.total??bt,tone:jn(k.runningAction.kind)}:void 0,gs=(k.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:k.stop}}:k.phase.kind==="escalated"&&!k.isRunning?{tone:"info",text:"",action:{label:"Clear selection",onClick:rs}}:ds?{tone:"info",text:"",action:{label:Mi(d??{}),onClick:k.escalate}}:void 0)??(He?{tone:"warning",text:He}:void 0),ps=r.jsx(kn,{title:P.title||T,navSlot:P.navSlot,titleMeta:P.titleMeta,searchSlot:P.searchSlot,searchField:P.searchField,idleSlot:P.makeFilterSlot,count:bt,onCancel:$,onDelete:()=>_("delete"),onMove:()=>_("move"),onOrganize:at,onJunk:Oe?()=>_("junk"):void 0,onMarkRead:()=>_("markRead"),overflowSlot:b&&e&&H>0&&Pe.length>0?r.jsx(Ao,{accountId:b,mailboxId:e,messageIds:Array.from(Z)}):void 0,isBusy:us,isCounting:k.phase.kind==="counting",selectAll:fs,statusLabel:hs,progress:ms,notice:gs}),xs=Tn(B,M),bs=c.useCallback(f=>{ie.current=!0,K(f)},[K]),vs=r.jsxs(r.Fragment,{children:[pe&&a&&r.jsx($i,{query:a}),r.jsxs("div",{ref:O,role:"listbox","aria-multiselectable":!0,"aria-label":T,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${ne.getTotalSize()}px`},children:ne.getVirtualItems().map(f=>{const S=o[f.index];return r.jsx("div",{role:"presentation","data-index":f.index,ref:ne.measureElement,className:Ee("absolute left-0 top-0 w-full border-b border-line",k.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${f.start}px)`},children:r.jsx(Di,{thread:S,mailboxId:e,isSelected:t===S.messageId,isFocused:M===S.messageId,isTabStop:xs===S.messageId,onFocusRow:bs,isChecked:Ne(S.messageId),onToggleCheck:ee,onRowSelect:ft,isMultiSelectMode:R,onLongPress:Q,isDesktop:A,onDelete:pt,onToggleRead:y,density:D})},f.key)})}),C&&r.jsx(io,{})]})]});return r.jsxs(r.Fragment,{children:[Ze&&!A&&r.jsx(ct,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>et(null),children:Ze}),r.jsx(ro,{listTitle:T,listMeta:v,sections:cs,flatList:!0,listState:P.searchResults?"ready":Ot,searchQuery:pe?a:void 0,listFilter:x,listScopeLabel:w,errorMessage:as,onRetry:l,onReportError:ls,density:D,selectedThreadId:t,onSelectThread:f=>me(f),isDesktop:A,hideHeader:E,selectionBar:ps,listBody:P.searchResults??(Ot==="ready"?vs:void 0)}),r.jsx(wn,{isOpen:Fe!==null,messageIds:Fe??[],outcome:ce,accountId:b,trashFolderLabel:T,staleFolderLabel:V,guessedMailboxId:q,isDeleting:h,onConfirm:mt,onCancel:gt}),r.jsx(Mn,{verb:J,accountId:b,mailboxId:e,selection:ht,selectionRestriction:He?"spansAccounts":void 0,escalated:Le,escalatedProgress:k.progress,onFinished:z,onRunEnded:Ye})]})},Vi=e=>Bt({path:{accountId:e}}),qi=e=>{const o=Ct(),t=kt(),s=jt({...Ps(),onSuccess:()=>{t.recordEvent("sync.triggered"),o.invalidateQueries({queryKey:Vi(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},Hi=({accountId:e,children:o})=>{const{triggerAsync:t,isPending:s}=qi(e);return r.jsx($o,{onRefresh:t,isRefreshing:s,children:o})};function Qi({accountId:e,currentMailboxId:o,candidates:t,onMove:s,children:n}){const[i,l]=c.useState(!1),a=kt(),d=Bs(),{inboxMailboxId:u}=En(e),h=On(e),{data:g}=It({...$s({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>Ws({mailboxes:g?.items??[],folderAppointments:h,currentMailboxId:o,translator:d}),[g?.items,h,o,d]),p=c.useMemo(()=>u||(m.find(x=>x.label.toLowerCase()==="inbox")?.id??m.find(x=>!x.isCurrent)?.id??""),[u,m]),C=c.useRef(!1);c.useEffect(()=>{C.current||(C.current=!0,An(a,t.length))},[a,t.length]);const b=c.useCallback(()=>{Nn(a,t.length),l(!0)},[a,t.length]),T=c.useCallback((v,x)=>{zn(a,{selected:v.length,total:t.length,toInbox:x===u}),s(v,x)},[a,t.length,u,s]);return r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:r.jsx(Ko,{count:t.length,onReview:b})}),r.jsx("div",{className:"min-h-0 flex-1",children:n}),r.jsx(ei,{open:i,candidates:t,defaultDestinationId:p,availableFolders:m,delimiter:Ks(g?.items??[]),onConfirmMove:T,onCancel:()=>l(!1)})]})}const Ui=(e,o,t,s)=>`${e??""}|${o}|${t??""}|${s??""}`,Ji=({accountId:e,mailboxId:o})=>{const t=Ct(),{pushError:s}=Pt(),{requestAppointment:n}=Vs(),{trashByAccount:i}=Jt(),l=e?i.get(e):void 0,a=Ui(e,o,l?.mailboxId,l?.source),[d,u]=c.useState({scope:a});d.scope!==a&&u({scope:a});const h=d.scope===a?d:void 0,g=c.useCallback(()=>t.getQueryData(qs())?.accounts.find(j=>j.accountId===e)?.folderAppointments.find(j=>j.role==="Trash")?.mailboxId??o,[t,e,o]),m=c.useRef(void 0),{mutateAsync:p,isPending:C}=jt({...Js(),meta:Us(409),onMutate:()=>(m.current=a,{scope:a,listMailboxId:g()}),onSuccess:(x,w,I)=>{I.scope===a&&u({scope:a,deletedCount:x.deletedCount})},onError:(x,w,I)=>{const j=Hs(x);if(!j){s({title:"Couldn't empty Trash",detail:Qs(x),error:x});return}I?.scope===a&&u({scope:a,refusal:j})},onSettled:(x,w,I,j)=>{m.current===j?.scope&&(m.current=void 0),Co(t,Io([j?.listMailboxId??o])),e&&t.invalidateQueries({queryKey:Bt({path:{accountId:e}})})}}),b=c.useCallback(()=>e?(u({scope:a}),p({path:{accountId:e}}).then(()=>{},()=>{})):Promise.resolve(),[e,a,p]),T=c.useCallback(()=>{b()},[b]),v=c.useCallback(()=>{const x=h?.refusal;x&&n({accountId:x.accountId,role:x.role,reason:x.reason,action:{kind:"emptyTrash"},onAppointed:b})},[h,n,b]);return{emptyTrash:T,isEmptying:C&&m.current===a,deletedCount:h?.deletedCount,refusal:h?.refusal,repair:v}},Gi="We can verify this sender";function Yi(e){const{data:o}=It({...Gs({path:{mailboxId:e??""},query:{senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500}}),enabled:!!e,staleTime:6e4});return{candidates:(o?.items??[]).map(s=>({id:s.messageId,senderName:s.fromName||s.fromEmail||"Unknown sender",senderAddress:s.fromEmail??"",subject:s.subject||"(no subject)",snippet:s.snippet??"",trustReason:Gi,trustSubReason:Fn(s.senderTrust),senderTrust:s.senderTrust}))}}const Xi=e=>{const o=new Set,t=[];for(const s of e)o.has(s.threadMessageId)||(o.add(s.threadMessageId),t.push(s));return t},Zi=50,os=c.createContext(null);function ut(){const e=c.useContext(os);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function er({mailboxId:e,thread:o,children:t}){const s=Je(),n=jo(),i=Bo(),l=o?.threadId,a=o?.messageId,d=kt(),{accounts:u,searchQuery:h,onToggleIntelligence:g}=$t(),m=on(),p=Po(h),C=p.length>0,{freeText:b,tokens:T}=rn(p,m),[v,x]=c.useState("all"),[w,I]=c.useState(new Set),j=c.useMemo(()=>({category:v,attributes:w}),[v,w]),E=c.useMemo(()=>ao(j),[j]),O=C||lo(j),{params:L,residual:A}=co(T,E),F={order:"desc",limit:Zi,...b?{query:b}:{},...L,...E},J={category:F.category,unread:F.unread,starred:F.starred,attachments:F.attachments},_=O?Ys({path:{mailboxId:e},query:F}):Xs({path:{mailboxId:e},query:{order:"desc"}}),{data:G,isLoading:se,isError:pe,error:P,refetch:Pe,fetchNextPage:ae,hasNextPage:M,isFetchingNextPage:Ce}=uo({queryKey:_,queryFn:async({pageParam:y})=>{if(O){const{data:$}=await sn({path:{mailboxId:e},query:{...F,continuationToken:y},throwOnError:!0});return $}const{data:Q}=await nn({path:{mailboxId:e},query:{order:"desc",continuationToken:y},throwOnError:!0});return Q},initialPageParam:void 0,getNextPageParam:y=>y.continuationToken,placeholderData:(y,Q)=>po(Q?.queryKey,J)?y:void 0}),{accountId:W,isLoading:Ie}=Dn(e),K=ko({accounts:u}),D=ho(Ln(Xi(G?.pages.flatMap(y=>y.items??[])??[])),A,W),Be=c.useCallback(y=>{x(y)},[]),xe=c.useCallback(y=>{I(Q=>{const $=new Set(Q);return $.has(y)?$.delete(y):$.add(y),$})},[]),be=c.useCallback(()=>{x("all"),I(new Set)},[]),le=fo(v),Oe=le?{label:le,reach:A.length>0?"loaded-pages":mo(F),onClear:be}:void 0,Ae=l?D.find(y=>y.messageId===a)??D.find(y=>y.threadId===l):void 0,ce=_n(l,a),V=Ae??ce,q=a??V?.messageId,Z=c.useMemo(()=>{if(l)return{threadId:l,mailboxId:V?.mailboxId??e,subject:V?.subject,messageId:q,authenticity:V?.authenticity}},[l,V,q,e]),H=c.useCallback(y=>{q&&y.includes(q)&&n()},[q,n]),{deleteMessages:oe,isPending:Ne}=At({mailboxId:e,onAfterOptimisticRemove:H}),{moveMessages:ee,isPending:je}=Nt({mailboxId:e,accountId:W,onAfterOptimisticRemove:H}),de=c.useRef(null),ue=Pn(),{listCommandsRef:N,onTriageContextChange:ke,focusedMessageId:$e,selectedIds:ze}=ue,R=D.find(y=>y.messageId===$e)??V,Fe=To({accounts:u})??null,he=Bn({thread:V,isOpen:!0,mailboxId:e,accountId:W,onAfterOptimisticRemove:H}),{draftsMailboxId:We}=$n(W),Ge=We!==void 0&&We===e,{archiveMailboxId:k}=Wn(W),Ye=Kn(),Te=Zs(),Xe=c.useMemo(()=>en(Te,l,q),[Te,l,q]),z=c.useMemo(()=>{if(R)return y=>Te({threadId:R.threadId,messageId:R.messageId,mode:y})},[Te,R]),Ze=So(),et=tn(),ve=yo(),ie=c.useCallback(y=>y?Ye(y):[],[Ye]),{toggleStar:Se}=Vn({threadId:R?.threadId??"",mailboxId:e}),{toggleReadFor:we}=Ht({mailboxId:e,accountId:W}),{junkMailboxId:ne}=Qt(W),Ke=ne!=null&&ne===e,Y=Ut(ne,e),{candidates:re}=Yi(Ke?ne:void 0),{moveMessages:Ve}=Nt({mailboxId:e,threadId:R?.threadId,accountId:W,onAfterOptimisticRemove:H}),{deleteMessages:qe}=At({mailboxId:e,threadId:R?.threadId,onAfterOptimisticRemove:H}),{addressId:ye,address:Me}=qn(R),{updateFlags:Re}=Hn({addressId:ye,senderEmail:R?.fromEmail??void 0}),B=c.useCallback(()=>z?.("reply"),[z]),ht=c.useCallback(()=>z?.("reply-all"),[z]),ft=c.useCallback(()=>z?.("forward"),[z]),fe=c.useCallback(()=>ie(R),[ie,R]),De=c.useCallback(()=>{if(N.current?.requestVerb("delete"))return;const y=fe();y.length>0&&qe(y)},[N,fe,qe]),tt=c.useCallback(()=>{if(N.current?.requestVerb("junk")||!Y)return;const y=fe();y.length!==0&&(Qn(d,{count:y.length,senderTrust:R?.senderTrust??"unknown",wasRescuable:R?Un(R):!1}),Ve(y,Y))},[N,Y,fe,Ve,d,R]),st=c.useCallback(()=>{if(ze.length>0){const y=!(R?.hasStars??!1),Q=new Set(ze);for(const $ of D)Q.has($.messageId)&&$.hasStars!==y&&Se($.messageId,$.hasStars);return}R&&Se(R.messageId,R.hasStars)},[ze,D,R,Se]),nt=c.useCallback(()=>{if(N.current?.requestVerb("markRead"))return;const y=fe();if(y.length===0)return;const Q=!(R?.isRead??!1);we(y,Q)},[N,fe,R,we]),ot=c.useCallback(()=>{if(!ye)return;const y=Me?.flags?.muted?.value!==!0;Re({muted:{value:y}})},[ye,Me,Re]),me=c.useCallback(()=>{if(!ye)return;const y=Me?.flags?.vip?.value!==!0;Re({vip:{value:y}})},[ye,Me,Re]),it=c.useCallback(()=>{de.current?.open()},[]),rt=Ge?"drafts":k===e?"archive":ne===e?"junk":"inbox",Le=c.useRef("");c.useEffect(()=>{const y=Le.current;Le.current=p,p.length>0&&y.length===0&&d.recordEvent("search.submitted",{mailboxType:rt})},[p,rt,d]);const{goBack:mt,nextMessageId:gt,previousMessageId:He}=Jn({context:ue,orderedIds:D.map(y=>y.messageId),selectedMessageId:q,enabled:!Ze&&!et,hasOpenThread:l!==void 0,onClose:n,handlers:{reply:B,replyAll:ht,forward:ft,delete:De,toggleStar:st,toggleRead:nt,muteSender:ot,blockSender:V?it:void 0,vipSender:me,markJunk:tt,toggleIntelligence:V?()=>de.current?.toggle():void 0,compose:ve,goBrief:()=>i("brief"),goInbox:()=>i("brief"),goSent:()=>i("brief"),goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),at=y=>{if(!y)return;const Q=D.find($=>$.messageId===y);return Q?{threadId:Q.threadId,messageId:y}:void 0},pt={mailboxId:e,selectedMessageId:q,selectedThread:V,conversation:Z,onOpenThread:s,threads:D,isLoading:se,isError:pe,error:P,mailboxAccountId:W,mailboxAccountLoading:Ie,mailboxName:K,unreadCount:Fe,isDraftsMailbox:Ge,isSpamFolder:Ke,rescueCandidates:re,filterCategory:v,filterAttributes:w,onSelectFilterCategory:Be,onToggleFilterAttribute:xe,onClearFilters:be,listFilter:Oe,onToggleIntelligence:g,intelligenceRef:de,handleDeselectIfRemoved:H,searchPredicate:C&&A.length===0?F:void 0,onDeleteMessages:oe,onMoveMessages:ee,isDeleting:Ne,isMoving:je,onLoadMore:ae,hasMore:M,isLoadingMore:Ce,onTriageContextChange:ke,listCommandsRef:N,onRetry:()=>Pe(),onReply:Xe,onToolbarDelete:he.deleteThread,onToolbarStar:he.toggleStar,isStarred:he.isStarred,onToolbarMove:he.moveThread,onBack:mt,nextThread:at(gt),previousThread:at(He)};return r.jsx(os.Provider,{value:pt,children:t})}function is(){const{mailboxId:e,selectedMessageId:o,threads:t,isLoading:s,isError:n,error:i,onDeleteMessages:l,onMoveMessages:a,isDeleting:d,isMoving:u,onLoadMore:h,hasMore:g,isLoadingMore:m,mailboxAccountId:p,mailboxName:C,unreadCount:b,isDraftsMailbox:T,isSpamFolder:v,rescueCandidates:x,onTriageContextChange:w,listCommandsRef:I,onRetry:j,filterCategory:E,filterAttributes:O,onSelectFilterCategory:L,onToggleFilterAttribute:A,onClearFilters:F,listFilter:J,searchPredicate:_}=ut(),{searchQuery:G,searchInput:se,accounts:pe,resultFolderIndex:P}=$t(),Pe=_o(),ae=Je(),M=C??"Inbox",Ce=c.useMemo(()=>eo(),[]),{trashMailboxId:W}=to(p),Ie=wo({accounts:pe}),{trashByAccount:K}=Jt(),D=Ji({accountId:p,mailboxId:e}),Be=W!=null&&W===e,xe=c.useMemo(()=>p?[p]:[],[p]),{hasNewMail:be}=ln(),{state:le,errorMessage:Oe,refresh:Ae}=cn(xe,{onSettled:j}),ce=c.useMemo(()=>r.jsx(dn,{state:le,onRefresh:Ae,label:`Refresh ${M}`,errorMessage:Oe,hasUpdate:be(xe)}),[le,Ae,M,Oe,be,xe]),V=c.useMemo(()=>t.map(N=>so(N,P)),[t,P]),{hits:q,isLoading:Z}=zo({mailboxId:e,filterCategory:E}),H=c.useMemo(()=>no(q,t.map(N=>N.threadId),P),[q,t,P]),oe=c.useCallback(N=>{const ke=N.threadId??t.find($e=>$e.messageId===N.id)?.threadId;ke&&ae({threadId:ke,messageId:N.id},{mailboxId:N.mailboxId??e,query:se})},[e,ae,se,t]);if(T&&p)return r.jsx(ai,{accountId:p,selectedMessageId:o,imapThreads:t,title:C??"Drafts",unreadCount:b??void 0});const Ne=r.jsx(Ki,{mailboxId:e,threads:t,selectedMessageId:o,isLoading:s,isError:n,error:i,onRetry:j,searchQuery:G,searchPredicate:_,onDeleteMessages:l,isDeleting:d,isMoving:u,onLoadMore:h,hasMore:g,isLoadingMore:m,accountId:p,listTitle:M,listFilter:J,listScopeLabel:M,hideHeader:!0,onTriageContextChange:w,commandsRef:I}),ee=pe[0]?.accountId,je=Pe==="phone"&&ee?r.jsx(Hi,{accountId:ee,children:Ne}):Ne,de=v&&x.length>0&&p?r.jsx(Qi,{accountId:p,currentMailboxId:e,candidates:x,onMove:a,children:je}):je,ue=Be?r.jsx(di,{messageCount:Ie,isEmptying:D.isEmptying,deletedCount:D.deletedCount,refusalReason:D.refusal?.reason,trashFolderLabel:C??void 0,staleFolderLabel:p?K.get(p)?.staleFolderPath:void 0,onEmpty:D.emptyTrash,onRepair:D.repair,children:de}):de;return r.jsx(go,{title:M,unreadCount:b,preset:Ce,selectedCategory:E,activeFilters:O,onSelectCategory:L,onToggleFilter:A,onClearFilters:F,searchResults:V,searchLoading:s,relatedResults:H,relatedLoading:Z,onSelectSearchResult:oe,searchResultsInBody:!0,refreshControl:ce,children:ue})}function tr(){const{mailboxId:e,mailboxAccountId:o,mailboxAccountLoading:t,selectedThread:s,conversation:n,onReply:i,onToolbarDelete:l,onToolbarStar:a,isStarred:d,onToolbarMove:u,handleDeselectIfRemoved:h,intelligenceRef:g}=ut(),m=!!n,p=Xn(n?.threadId);Gt(g,p);const C=c.useRef(null),{railFits:b,openRail:T}=p;c.useEffect(()=>{if(!b)return;const x=s?.messageId??null;x&&C.current!==x&&s?.authenticity?.dkimMismatch&&(C.current=x,T())},[b,T,s?.messageId,s?.authenticity?.dkimMismatch]);const v=n?r.jsx(Yt,{threadId:n.threadId,mailboxId:n.mailboxId,subject:n.subject,selectedMessageId:n.messageId,authenticity:n.authenticity,onOpenIntelligence:p.open,listOnScreen:!0}):r.jsx(an,{});return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Zn,{hasThread:m,messageId:n?.messageId,intelligenceOpen:p.isShowing,canToggleIntelligence:p.canToggle,onToggleIntelligence:p.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:m?l:void 0,onToggleStar:m?a:void 0,isStarred:d,moveContext:m&&o?{accountId:o,currentMailboxId:e,onMove:u}:void 0,moveContextLoading:t}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:v})]}),r.jsx(Xt,{isOpen:p.drawerOpen,onClose:p.closeDrawer,thread:s,mailboxId:e,accountId:o,onAfterOptimisticRemove:h})]})}function sr(){const{mailboxId:e,mailboxAccountId:o,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:n}=ut();return r.jsx(Yn,{onClose:s,thread:t,mailboxId:e,accountId:o,onAfterOptimisticRemove:n})}function nr(){const{mailboxId:e,mailboxAccountId:o,selectedThread:t,conversation:s,onOpenThread:n,onBack:i,nextThread:l,previousThread:a,handleDeselectIfRemoved:d,intelligenceRef:u}=ut(),h=Gn(s?.threadId??null);return Gt(u,h),s?r.jsxs(r.Fragment,{children:[r.jsx(Yt,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:h.toggle,onSwipeNext:l?()=>n(l):void 0,onSwipePrevious:a?()=>n(a):void 0,mobileIntelligenceOpen:h.isOpen}),r.jsx(Xt,{isOpen:h.isOpen,onClose:h.close,thread:t,mailboxId:e,accountId:o,onAfterOptimisticRemove:d})]}):r.jsx(is,{})}const wr=Object.assign(er,{List:is,Reading:tr,Intelligence:sr,Phone:nr});export{wr as M};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-D855R0Fw.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{ai as m,j as o,O as p}from"./index-D855R0Fw.js";import{a}from"./MailShell-C6gzPUuw.js";import{M as r}from"./MailboxPane-DQb-w_Zk.js";import{d as e}from"./search-token-index-CXxBVdX5.js";import{u as s}from"./search-mirror-CFC1hqWp.js";import"./FullCompose-B4d9WZ6T.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useQueries-3Ta-bqMs.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./EmptyState-B5l4DUW4.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./useLayoutTier-BHxPbufX.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./NavMenuButton-xOndgihg.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-FUNFJG28.js";import"./circle-help-W-bok798.js";import"./circle-check-B73TBv-p.js";function oo(){const{mailboxId:t}=m.useParams(),i=e();return s({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{oo as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{M as r}from"./MailboxPane-DQb-w_Zk.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useQueries-3Ta-bqMs.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./NavMenuButton-xOndgihg.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-FUNFJG28.js";import"./circle-help-W-bok798.js";import"./circle-check-B73TBv-p.js";function S(){return o.jsx(r.Reading,{})}export{S as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{F as r}from"./FlaggedPane-DB-AxQh4.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./refresh-cw-BzxgnCmO.js";import"./wizard-selection-B1bng5Jq.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-D855R0Fw.js";import{B as o}from"./BriefPane-BFt6V6kp.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function L(){return r.jsx(o.Reading,{})}export{L as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{O as t}from"./OutboxPane-CmsB8bhV.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-PApHOS4Q.js";import"./clock-C5E9t_wY.js";import"./row-actions-9TTs03mH.js";import"./rotate-ccw-CShnXVol.js";import"./NavMenuButton-xOndgihg.js";import"./menu-BHyCi7rW.js";import"./format-Cc3aS3ot.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
@@ -1 +0,0 @@
1
- import{en as o,j as m}from"./index-D855R0Fw.js";import{O as e}from"./OpenCalendarEvent-hZfI9rcX.js";import"./CalendarComposePane-DAcupn2s.js";import"./window-BqaZu6ux.js";import"./ErrorState--2p5I6wj.js";import"./calendar-color-BjjneYsQ.js";import"./attendee-row-CaFcq0Dc.js";import"./avatar-CMlohog8.js";import"./clock-C5E9t_wY.js";import"./map-pin-BqQOdN8M.js";import"./mail-D8ExCCOr.js";import"./pencil-BcFzbpXu.js";import"./useCalendars-CgIo_kEf.js";import"./useCalendarData-CfZbbmWc.js";import"./useQueries-3Ta-bqMs.js";function E(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return m.jsx(e,{calendarObjectId:r,recurrenceId:t})}export{E as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-D855R0Fw.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-D855R0Fw.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-D855R0Fw.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{j as r,O as i}from"./index-D855R0Fw.js";import{a as m}from"./MailShell-C6gzPUuw.js";import{B as o}from"./BriefPane-BFt6V6kp.js";import{d as p}from"./search-token-index-CXxBVdX5.js";import{u as e}from"./search-mirror-CFC1hqWp.js";import"./FullCompose-B4d9WZ6T.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./EmptyState-B5l4DUW4.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./useLayoutTier-BHxPbufX.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./useQueries-3Ta-bqMs.js";import"./menu-BHyCi7rW.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function W(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{W as component};
@@ -1 +0,0 @@
1
- import{e}from"./index-D855R0Fw.js";const t=e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);export{t as C};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-B4d9WZ6T.js";import"./index-D855R0Fw.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";const C=o;export{C as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-B4d9WZ6T.js";import"./index-D855R0Fw.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";const C=o;export{C as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-B4d9WZ6T.js";import"./index-D855R0Fw.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";const C=o;export{C as component};
@@ -1 +0,0 @@
1
- import{F as o}from"./FullCompose-B4d9WZ6T.js";import"./index-D855R0Fw.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";const C=o;export{C as component};
@@ -1 +0,0 @@
1
- import{j as o,O as i}from"./index-D855R0Fw.js";import{a as m}from"./MailShell-C6gzPUuw.js";import{F as r}from"./FlaggedPane-DB-AxQh4.js";import{d as p}from"./search-token-index-CXxBVdX5.js";import{u as e}from"./search-mirror-CFC1hqWp.js";import"./FullCompose-B4d9WZ6T.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./EmptyState-B5l4DUW4.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./useLayoutTier-BHxPbufX.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./useQueries-3Ta-bqMs.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./refresh-cw-BzxgnCmO.js";import"./wizard-selection-B1bng5Jq.js";function N(){const t=p();return e({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{N as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{F as r}from"./FlaggedPane-DB-AxQh4.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./refresh-cw-BzxgnCmO.js";import"./wizard-selection-B1bng5Jq.js";function I(){return o.jsx(r.Reading,{})}export{I as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{O as t}from"./OutboxPane-CmsB8bhV.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-PApHOS4Q.js";import"./clock-C5E9t_wY.js";import"./row-actions-9TTs03mH.js";import"./rotate-ccw-CShnXVol.js";import"./NavMenuButton-xOndgihg.js";import"./menu-BHyCi7rW.js";import"./format-Cc3aS3ot.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{M as i}from"./MailboxPane-DQb-w_Zk.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useQueries-3Ta-bqMs.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./NavMenuButton-xOndgihg.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-FUNFJG28.js";import"./circle-help-W-bok798.js";import"./circle-check-B73TBv-p.js";function S(){return o.jsx(i.Reading,{})}export{S as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-D855R0Fw.js";import{B as o}from"./BriefPane-BFt6V6kp.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function M(){return r.jsx(o.Reading,{})}export{M as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{F as r}from"./FlaggedPane-DB-AxQh4.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./refresh-cw-BzxgnCmO.js";import"./wizard-selection-B1bng5Jq.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
@@ -1 +0,0 @@
1
- import{j as t,am as o}from"./index-D855R0Fw.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-D855R0Fw.js";import{M as r}from"./MailboxPane-DQb-w_Zk.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useQueries-3Ta-bqMs.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./MailListHeader-kD_OYiqE.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./MailViewChrome-B6yFR2VU.js";import"./NavMenuButton-xOndgihg.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-FUNFJG28.js";import"./circle-help-W-bok798.js";import"./circle-check-B73TBv-p.js";function Q(){return o.jsx(r.Reading,{})}export{Q as component};
@@ -1 +0,0 @@
1
- import{el as o,j as r}from"./index-D855R0Fw.js";import{O as m}from"./OpenCalendarEvent-hZfI9rcX.js";import"./CalendarComposePane-DAcupn2s.js";import"./window-BqaZu6ux.js";import"./ErrorState--2p5I6wj.js";import"./calendar-color-BjjneYsQ.js";import"./attendee-row-CaFcq0Dc.js";import"./avatar-CMlohog8.js";import"./clock-C5E9t_wY.js";import"./map-pin-BqQOdN8M.js";import"./mail-D8ExCCOr.js";import"./pencil-BcFzbpXu.js";import"./useCalendars-CgIo_kEf.js";import"./useCalendarData-CfZbbmWc.js";import"./useQueries-3Ta-bqMs.js";function R(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{R as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-D855R0Fw.js";import{B as o}from"./BriefPane-BFt6V6kp.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-kD_OYiqE.js";import"./search-token-index-CXxBVdX5.js";import"./useLayoutTier-BHxPbufX.js";import"./useQueries-3Ta-bqMs.js";import"./attachment-file-BKW1LvYE.js";import"./mail-D8ExCCOr.js";import"./avatar-CMlohog8.js";import"./index-86n4-j8G.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./EmptyState-B5l4DUW4.js";import"./ErrorState--2p5I6wj.js";import"./download-iYbfvVSU.js";import"./calendar-event-chip-MdQdmgJv.js";import"./calendar-color-BjjneYsQ.js";import"./map-pin-BqQOdN8M.js";import"./attendee-row-CaFcq0Dc.js";import"./clock-C5E9t_wY.js";import"./shield-check-D_NOwpHN.js";import"./useFilters-D55evI_2.js";import"./confirm-dialog-BTkV4N2t.js";import"./menu-BHyCi7rW.js";import"./useRefreshControl-9O_O25oC.js";import"./circle-check-big-PApHOS4Q.js";import"./refresh-cw-BzxgnCmO.js";import"./useLabels-BS3G7NVR.js";import"./useSemanticSearch-F_a8SnAV.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function L(){return r.jsx(o.Reading,{})}export{L as component};
@@ -1 +0,0 @@
1
- import{q as n,h as i,u as a,r as m,j as s}from"./index-D855R0Fw.js";import{O as p}from"./OnboardingWizard--zWbuuZO.js";import{c}from"./onboarding-completion-CZcSJIaU.js";import"./kbd-Cfms0Oys.js";import"./credential-steps-SdAyOxLX.js";import"./card-IQFeqGVt.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-D8ExCCOr.js";import"./file-json-C19C1p7d.js";function O(){const o=n(),e=i(),t=a(),r=m.useCallback(l=>{c({queryClient:e,recordCompleted:()=>o.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[o,e]);return s.jsx(p,{skipWelcome:!1,onComplete:r,onImportConfig:()=>{t({to:"/import"})}})}export{O as component};
@@ -1 +0,0 @@
1
- import{j as o,O as i}from"./index-D855R0Fw.js";import{a as m}from"./MailShell-C6gzPUuw.js";import{u as p,O as t}from"./OutboxPane-CmsB8bhV.js";import{u as s}from"./search-mirror-CFC1hqWp.js";import"./FullCompose-B4d9WZ6T.js";import"./ErrorState--2p5I6wj.js";import"./index-86n4-j8G.js";import"./useMessageBodyContent-I6J6WaYN.js";import"./useSignature-g4RGAb59.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-tudCfT8G.js";import"./sections-BKWo2Deh.js";import"./format-Cc3aS3ot.js";import"./confirm-dialog-BTkV4N2t.js";import"./useSearchTokenContext-D1NKXhM6.js";import"./kbd-Cfms0Oys.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-PApHOS4Q.js";import"./clock-C5E9t_wY.js";import"./row-actions-9TTs03mH.js";import"./rotate-ccw-CShnXVol.js";import"./NavMenuButton-xOndgihg.js";import"./menu-BHyCi7rW.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function v(){const r=p();return s({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{})})})}export{v as component};
@@ -1 +0,0 @@
1
- import{j as t,O as o}from"./index-D855R0Fw.js";const n=()=>t.jsx(o,{});export{n as component};