@remit/web-client-dist 0.0.486 → 0.0.488

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 (145) hide show
  1. package/assets/{BriefPane-C5f59Mn7.js → BriefPane-8e5wD9U2.js} +1 -1
  2. package/assets/CalendarComposePane-CnkwI8w6.js +1 -0
  3. package/assets/CalendarComposeSeed-bGtEytNs.js +1 -0
  4. package/assets/{CalendarShell-CHBR4YdK.js → CalendarShell-D8nnETBx.js} +1 -1
  5. package/assets/{EmptyState-CQL1Pjbh.js → EmptyState-Bnpl3mxy.js} +1 -1
  6. package/assets/{ErrorState-D8AQD4QI.js → ErrorState-BN1KI1QC.js} +1 -1
  7. package/assets/{FlaggedPane-DM3Wy8rZ.js → FlaggedPane--S_CB4Cc.js} +1 -1
  8. package/assets/{FullCompose-Ca20lPOA.js → FullCompose-BOiOQ-Qf.js} +1 -1
  9. package/assets/{MailListHeader-D7oYyz3_.js → MailListHeader-D3QJgz1J.js} +1 -1
  10. package/assets/{MailNav-D93z2NPe.js → MailNav-BmcDEbrF.js} +1 -1
  11. package/assets/{MailShell-BpD0VQlu.js → MailShell-CZF1GQXr.js} +1 -1
  12. package/assets/{MailViewChrome-C3m2xTjA.js → MailViewChrome-BSKS3ijj.js} +1 -1
  13. package/assets/{MailboxPane-BODFQwbs.js → MailboxPane-M3YI2Lhj.js} +1 -1
  14. package/assets/{NavMenuButton-C23ZlNzG.js → NavMenuButton-DZeoJSH-.js} +1 -1
  15. package/assets/{OnboardingWizard-8NOySNwj.js → OnboardingWizard-Dpl2R9Cy.js} +1 -1
  16. package/assets/OpenCalendarEvent-kYb3ZTPU.js +2 -0
  17. package/assets/{OutboxPane-qfe7PmY5.js → OutboxPane-uihHargp.js} +1 -1
  18. package/assets/_calendarObjectId-B1Oalf3b.js +1 -0
  19. package/assets/_mailboxId-DdbPW7YF.js +1 -0
  20. package/assets/_messageId-BP9-n-lV.js +1 -0
  21. package/assets/_messageId-C-cSawQe.js +1 -0
  22. package/assets/_messageId-mWUrP87X.js +1 -0
  23. package/assets/_outboxMessageId-IVVtaP13.js +1 -0
  24. package/assets/_recurrenceId-DMP1BEIN.js +1 -0
  25. package/assets/_threadId-C5CRN2ch.js +1 -0
  26. package/assets/_threadId-DOK4zcvh.js +1 -0
  27. package/assets/_threadId-qUW2tqRz.js +1 -0
  28. package/assets/_view._date-Djnasj-2.js +1 -0
  29. package/assets/{accounts-DV03g8iQ.js → accounts-Coh0pl5z.js} +1 -1
  30. package/assets/{advanced-Ba8zDo2z.js → advanced-BMnUr3k2.js} +1 -1
  31. package/assets/{appearance-u-ZvKiJu.js → appearance-Cc_1nX_R.js} +1 -1
  32. package/assets/{attachment-file-CZyLTO92.js → attachment-file-DEgj4Vud.js} +1 -1
  33. package/assets/{avatar-BUFzqa0m.js → avatar-jIsSo2Zf.js} +1 -1
  34. package/assets/{bottom-sheet-DTbJ9FNm.js → bottom-sheet-DheWfAIR.js} +1 -1
  35. package/assets/{brief-8uXFnUen.js → brief-CcZTo542.js} +1 -1
  36. package/assets/brief-Dln7pOiH.js +1 -0
  37. package/assets/{browser-ponyfill-A1bHqxco.js → browser-ponyfill-B4xJekFS.js} +1 -1
  38. package/assets/{bug-C_nJpj_h.js → bug-D1kIQg-0.js} +1 -1
  39. package/assets/{calendar-O9O5ZUgT.js → calendar-DxJZvi6b.js} +1 -1
  40. package/assets/{calendar-days-BiSAAPsl.js → calendar-days-C_HOm0G3.js} +1 -1
  41. package/assets/{card-CCWeYAnf.js → card-BvJM4Bar.js} +1 -1
  42. package/assets/chevron-left-DLqD6AAq.js +1 -0
  43. package/assets/{circle-check-CZSsF6OM.js → circle-check-DtpNGVtU.js} +1 -1
  44. package/assets/{circle-check-big-CJe-UlT7.js → circle-check-big-UXLrOtDo.js} +1 -1
  45. package/assets/{circle-help-r3PbN8xG.js → circle-help-Bn8ystJn.js} +1 -1
  46. package/assets/{clock-BLND_Uqn.js → clock-a9wtJIFb.js} +1 -1
  47. package/assets/compose._-_outboxMessageId_-BEQR2RT3.js +1 -0
  48. package/assets/compose._-_outboxMessageId_-Bdvxfy8-.js +1 -0
  49. package/assets/compose._-_outboxMessageId_-CUn9IfOQ.js +1 -0
  50. package/assets/compose._-_outboxMessageId_-YNuTsqHY.js +1 -0
  51. package/assets/{config-import-Bci3Xwoi.js → config-import-B94_wCpF.js} +1 -1
  52. package/assets/{confirm-dialog-NVOOFruZ.js → confirm-dialog-5hKuL5ov.js} +1 -1
  53. package/assets/{credential-steps-CtI45h_j.js → credential-steps-DJcQCoMN.js} +1 -1
  54. package/assets/{download-BJz8IQEk.js → download-CiAfXfNQ.js} +1 -1
  55. package/assets/{filters-YM-AjxWk.js → filters-BNAxy-pd.js} +1 -1
  56. package/assets/flagged-BYKUghBm.js +1 -0
  57. package/assets/{flagged-zj7lygZW.js → flagged-C0mYVO9Q.js} +1 -1
  58. package/assets/{folders-DB27d312.js → folders-B8E9XQGy.js} +1 -1
  59. package/assets/{format-DxgW1axG.js → format-CxG3FNVs.js} +1 -1
  60. package/assets/{help-copy-B9B_sS4o.js → help-copy-DC0qUPIv.js} +1 -1
  61. package/assets/{import-DFAWR-kC.js → import-mtITAI1H.js} +1 -1
  62. package/assets/index-BP9-n-lV.js +1 -0
  63. package/assets/{index-oS749L3s.js → index-BW01bO1J.js} +4 -4
  64. package/assets/{index-DSi1cxOe.js → index-Bcu7BqZh.js} +62 -62
  65. package/assets/index-C-cSawQe.js +1 -0
  66. package/assets/index-CpVVKgK6.js +1 -0
  67. package/assets/index-Crs0s6jC.js +1 -0
  68. package/assets/index-DAUjRbOW.js +1 -0
  69. package/assets/index-DHdIEMDT.js +1 -0
  70. package/assets/{index-CDQgKHBD.js → index-DThWcnpG.js} +1 -1
  71. package/assets/index-DX4E3icM.js +1 -0
  72. package/assets/index-DXZ_UtbG.js +1 -0
  73. package/assets/index-Dz7e4G6z.js +1 -0
  74. package/assets/{kbd-EJpwdDwi.js → kbd-wWeybs89.js} +1 -1
  75. package/assets/{labels-C2P2HsOp.js → labels-RhvMKifz.js} +1 -1
  76. package/assets/{mail-Dp-ZQxV4.js → mail-BAbQAZ9G.js} +1 -1
  77. package/assets/{mail-5cZo03IU.js → mail-WRNyVFjV.js} +1 -1
  78. package/assets/{menu-ByhBSEmm.js → menu-BXqls5WZ.js} +1 -1
  79. package/assets/minus-BaGFpEMe.js +1 -0
  80. package/assets/new-CzBf8alD.js +1 -0
  81. package/assets/onboarding-D7fm-uK7.js +1 -0
  82. package/assets/{onboarding-completion-CW5PdZse.js → onboarding-completion-lWgQaoiS.js} +1 -1
  83. package/assets/outbox-BJe-Ixj_.js +1 -0
  84. package/assets/{pencil-DLTDTx7a.js → pencil-CkHvTVt7.js} +1 -1
  85. package/assets/{rich-text-DYJXalrz.js → rich-text-CTg_ypvW.js} +1 -1
  86. package/assets/{rich-text-spellcheck-worker-provider-CfVhFCIc.js → rich-text-spellcheck-worker-provider-DNPJIUYl.js} +1 -1
  87. package/assets/{rotate-ccw-D4M_tmYq.js → rotate-ccw-Coc_HVFv.js} +1 -1
  88. package/assets/{row-actions-Dp_6Oacr.js → row-actions-D6pg-4y5.js} +1 -1
  89. package/assets/{search-mirror-B3kZUGfA.js → search-mirror-Csy2vxLR.js} +1 -1
  90. package/assets/{search-token-index-DeYdHtqE.js → search-token-index-B4kJtFA_.js} +1 -1
  91. package/assets/{sections-qjX9kREL.js → sections-DT0azgaj.js} +1 -1
  92. package/assets/{senders-BhsqVDaT.js → senders-DzxfBV7S.js} +1 -1
  93. package/assets/settings-HKkjK28O.js +1 -0
  94. package/assets/{settings-screen-Bxg7gmcf.js → settings-screen-EigWdTdk.js} +1 -1
  95. package/assets/{shield-check-Cvh9jlfx.js → shield-check-CWXSXjpp.js} +1 -1
  96. package/assets/{suggested-vips-DuweqHkG.js → suggested-vips-HChlmA8o.js} +1 -1
  97. package/assets/useCalendarData-Uek-8FpX.js +1 -0
  98. package/assets/useCalendars-Rv-pJFtI.js +1 -0
  99. package/assets/{useDebouncedValue-Ca-AmULI.js → useDebouncedValue-jtTlNJDr.js} +1 -1
  100. package/assets/{useFilters-BT2H6A9z.js → useFilters-BxnI0t9W.js} +1 -1
  101. package/assets/{useLabels-C3ibzzsY.js → useLabels-C-ytwpWV.js} +1 -1
  102. package/assets/{useLayoutTier-D0kPsil-.js → useLayoutTier-P9na-5Xh.js} +1 -1
  103. package/assets/{useMessageBodyContent-DgKoLcSS.js → useMessageBodyContent-ClKIcNPh.js} +1 -1
  104. package/assets/{useQueries-7N8So0Dt.js → useQueries-4YYdm8Yg.js} +1 -1
  105. package/assets/{useRefreshControl--nOYmIrG.js → useRefreshControl-BMS0clfU.js} +1 -1
  106. package/assets/{useSearchTokenContext-DUxpTOVT.js → useSearchTokenContext-BW55Y3Yb.js} +1 -1
  107. package/assets/{useSemanticSearch-BUANNC0c.js → useSemanticSearch-BrrFjCJ5.js} +1 -1
  108. package/assets/{useSignature-DYlo-oZl.js → useSignature-BISqUCGf.js} +1 -1
  109. package/index.html +1 -1
  110. package/package.json +1 -1
  111. package/assets/OpenCalendarEvent-CZoxi6ny.js +0 -1
  112. package/assets/_calendarObjectId-DXyBrLAy.js +0 -1
  113. package/assets/_mailboxId-qseqIpui.js +0 -1
  114. package/assets/_messageId-B08xPLe0.js +0 -1
  115. package/assets/_messageId-B7fwW8yi.js +0 -1
  116. package/assets/_messageId-iLGr4PWp.js +0 -1
  117. package/assets/_outboxMessageId-CKi0BpD-.js +0 -1
  118. package/assets/_recurrenceId-DCd_xCg3.js +0 -1
  119. package/assets/_threadId-CVmQFHBU.js +0 -1
  120. package/assets/_threadId-D-Y9MY3x.js +0 -1
  121. package/assets/_threadId-LOJwXMXk.js +0 -1
  122. package/assets/_view._date-pVW7O5az.js +0 -1
  123. package/assets/brief-DbjV3yOh.js +0 -1
  124. package/assets/calendar-DztH7JbA.js +0 -1
  125. package/assets/chevron-left-dl0LCVOD.js +0 -1
  126. package/assets/compose._-_outboxMessageId_-B_LR6PmJ.js +0 -1
  127. package/assets/compose._-_outboxMessageId_-C_gw9w32.js +0 -1
  128. package/assets/compose._-_outboxMessageId_-CdllO2zY.js +0 -1
  129. package/assets/compose._-_outboxMessageId_-ciaOsodJ.js +0 -1
  130. package/assets/flagged-CzD-VxgB.js +0 -1
  131. package/assets/index-B08xPLe0.js +0 -1
  132. package/assets/index-B7fwW8yi.js +0 -1
  133. package/assets/index-CZaX92xn.js +0 -1
  134. package/assets/index-Cemc4mf0.js +0 -1
  135. package/assets/index-CuHcq9gH.js +0 -1
  136. package/assets/index-DlXlL9UD.js +0 -1
  137. package/assets/index-G-uvsuNZ.js +0 -1
  138. package/assets/index-I0w0IbzN.js +0 -1
  139. package/assets/index-MYTdUrZy.js +0 -1
  140. package/assets/minus-CZaIJLbB.js +0 -1
  141. package/assets/new-N7ksMnEk.js +0 -1
  142. package/assets/onboarding-CbY3TxBB.js +0 -1
  143. package/assets/outbox-CLgw1jRo.js +0 -1
  144. package/assets/settings-Bz2o4JO9.js +0 -1
  145. package/assets/useCalendarData-d4Z1IfQ7.js +0 -1
@@ -0,0 +1 @@
1
+ import{e as y,a8 as d,e0 as v,r as l,e1 as w,e2 as h,u as T,c3 as O,e3 as D,c as x,e4 as N}from"./index-Bcu7BqZh.js";const F=y("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),E={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function W(e){return E[e]}const u="/calendar/$view/$date";function R(){const e=d({from:u,shouldThrow:!1}),a=v({from:u,shouldThrow:!1}),t=e?.view??"",n=e?.date??"",r=a?.calendarId;return l.useMemo(()=>({...w({view:t,date:n},h(new Date)),calendarIds:r??[]}),[t,n,r])}function _(){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 l.useMemo(()=>t?{calendarObjectId:t,recurrenceId:n}:void 0,[t,n])}function B(){return d({from:"/calendar/$view/$date/new",shouldThrow:!1})!==void 0}function V(){const e=T(),a=O(),{view:t,date:n}=R(),r=l.useCallback(o=>{e({to:u,params:o,search:!0,hash:a})},[e,a]);return l.useMemo(()=>({goToView:o=>r({view:o,date:n}),step:o=>r({view:t,date:D(n,t,o)}),goToToday:()=>r({view:t,date:h(new Date)}),openEvent:(o,s)=>e(s===void 0||s===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:n,calendarObjectId:o},search:!0,hash:a}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:n,calendarObjectId:o,recurrenceId:s},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"),U=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 $(e,a){const t=new Date(`${e}T${a}:00`);return`${e}T${a}:00${p(-t.getTimezoneOffset())}`}const i=new Map;function j(e){if(i.has(e))return i.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 i.set(e,a),a}function m(e,a){const t=j(e);if(!t)return Number.NaN;const n=t.formatToParts(new Date(a)),r=C=>Number(n.find(I=>I.type===C)?.value),o=r("hour")%24;return(Date.UTC(r("year"),r("month")-1,r("day"),o,r("minute"),r("second"))-a)/6e4}function Z(e,a,t){if(t==="")return`${e}T${a}:00+00:00`;const n=Date.parse(`${e}T${a}:00Z`),r=m(t,n);if(Number.isNaN(r))return $(e,a);const o=m(t,n-r*6e4);return`${e}T${a}:00${p(Number.isNaN(o)?r:o)}`}const b=e=>$(e,"00:00");function f(e,a){const[t,n,r]=e.split("-").map(Number);return U(new Date(Date.UTC(t,n-1,r+a)))}function M(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 A(e,a){const[t,n]=a.split("-").map(Number);if(e==="year")return[`${t}-01-01`,`${t+1}-01-01`];if(e==="month"){const o=`${t}-${c(n)}-01`,s=n===12?`${t+1}-01-01`:`${t}-${c(n+1)}-01`;return[o,s]}if(e==="day")return[a,f(a,1)];const r=M(a);return[r,f(r,7)]}function q(e,a){const[t,n]=A(e,a);return{from:b(t),to:b(n)}}const H=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,Q="",S={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},z={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},g="#";function k(e,a){return a===""?e:`${e}${g}${a}`}function Y(e){const a=e.indexOf(g);return a===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,a),recurrenceId:e.slice(a+1)}}function L(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:S[e.color]??"cal-1"}}function G(e,a){return{id:k(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.start,end:e.end,allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:a,zoneCertainty:z[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const J=e=>e.status!=="Cancelled";function K(){const{data:e,isLoading:a}=x(N());return l.useMemo(()=>{const t=e?.items??[],n=t.map(L);return{calendars:n,colorByCalendarId:Object.fromEntries(n.map(r=>[r.id,r.color])),timeZoneByCalendarId:Object.fromEntries(t.map(r=>[r.calendarId,r.timezone])),isLoading:a}},[e,a])}export{F as R,Q as U,V as a,_ as b,W as c,B as d,H as e,k as f,K as g,q as h,J as i,f as j,Z as k,Y as r,G as t,R as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-DSi1cxOe.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
1
+ import{r as o}from"./index-Bcu7BqZh.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
@@ -1 +1 @@
1
- import{r as p,i as b,dR as E,c as C,dS as x,dp as F,dT as D,h as M,dU as N,dV as P,dW as L,dX as z}from"./index-DSi1cxOe.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=m=>String(m).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}),X=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",G=({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,R=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]=p.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:R(g.state.dataUpdateCount)}}),s=p.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=p.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),m={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:m,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:_(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],$=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?$(t):t.trim(),k=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:k(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),W=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}},j=(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},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=W(t),[s,o]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(n),c=Q(t);return p.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(m=>{l.current===u&&o({count:m.matchedCount,matchedIds:m.messageIds,previewedSignature:u})}).catch(m=>{l.current===u&&o(g=>({...g,error:m instanceof Error?m.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(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=p.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=p.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:p.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,G as j,V as k,ee as n,X as o,O as p,U as r,re as u};
1
+ import{r as p,i as b,dR as E,c as C,dS as x,dp as F,dT as D,h as M,dU as N,dV as P,dW as L,dX as z}from"./index-Bcu7BqZh.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=m=>String(m).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}),X=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",G=({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,R=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]=p.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:R(g.state.dataUpdateCount)}}),s=p.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=p.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),m={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:m,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:_(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],$=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?$(t):t.trim(),k=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:k(e.matchOperator),literalClauses:a}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),W=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}},j=(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},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=W(t),[s,o]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(n),c=Q(t);return p.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(m=>{l.current===u&&o({count:m.matchedCount,matchedIds:m.messageIds,previewedSignature:u})}).catch(m=>{l.current===u&&o(g=>({...g,error:m instanceof Error?m.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(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=p.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=p.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:p.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,G as j,V as k,ee as n,X as o,O as p,U as r,re as u};
@@ -1 +1 @@
1
- import{c as d,dM as L,h as n,i as l,dN as p,r as o,dO as y,dP as c,dQ as g}from"./index-DSi1cxOe.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,dM as L,h as n,i as l,dN as p,r as o,dO as y,dP as c,dQ as g}from"./index-Bcu7BqZh.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,bJ as t,bK as n}from"./index-DSi1cxOe.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,bJ as t,bK as n}from"./index-Bcu7BqZh.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 M,c3 as S,c4 as O,a8 as h,c5 as B,q as P,aa as U,h as N,c as $,cu as D,cv as F}from"./index-DSi1cxOe.js";const w="/mail/brief/compose/{-$outboxMessageId}",R="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:w,shouldThrow:!1}),t=h({from:R,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function z(){return T()!==void 0}function Y(){return T()?.outboxMessageId}function v(e,t,r){return e==="flagged"?{to:R,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:w,params:{outboxMessageId:r}}}function b(){const e=M(),t=S(),{list:r,mailboxId:s}=O();return c.useCallback((n,o)=>{e({...v(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 J(){const e=b();return c.useCallback(t=>e(t),[e])}function V(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Z(){return B()}const L=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 _=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},q=8,K="x-remit-403-reason",Q=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},I=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,X=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},G=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await F(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,_(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(K),m=Q(o.status,l);throw new f(m,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(X(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const y=await o.text();if(I(y,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 y},H=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),ee=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?L(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),y=N(),l=c.useRef(!1),m=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;m.current!==C&&(m.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,H({fetchContent:(u,A)=>G(u,A,o),refetchDescribeMessage:()=>y.refetchQueries({queryKey:D({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<q: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;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 x=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:x,isLoading:p,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,z as a,ee as b,Y as c,V as d,Z as e,J as f,Q as g,j as u};
1
+ import{r as c,u as M,c3 as S,c4 as O,a8 as h,c5 as B,q as P,aa as U,h as N,c as $,cu as D,cv as F}from"./index-Bcu7BqZh.js";const w="/mail/brief/compose/{-$outboxMessageId}",R="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:w,shouldThrow:!1}),t=h({from:R,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function z(){return T()!==void 0}function Y(){return T()?.outboxMessageId}function v(e,t,r){return e==="flagged"?{to:R,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:w,params:{outboxMessageId:r}}}function b(){const e=M(),t=S(),{list:r,mailboxId:s}=O();return c.useCallback((n,o)=>{e({...v(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 J(){const e=b();return c.useCallback(t=>e(t),[e])}function V(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Z(){return B()}const L=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 _=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},q=8,K="x-remit-403-reason",Q=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},I=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,X=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},G=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await F(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,_(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(K),m=Q(o.status,l);throw new f(m,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(X(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const y=await o.text();if(I(y,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 y},H=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),ee=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?L(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),y=N(),l=c.useRef(!1),m=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;m.current!==C&&(m.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,H({fetchContent:(u,A)=>G(u,A,o),refetchDescribeMessage:()=>y.refetchQueries({queryKey:D({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<q: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;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 x=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:x,isLoading:p,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,z as a,ee as b,Y as c,V as d,Z as e,J as f,Q as g,j as u};
@@ -1 +1 @@
1
- import{bL as E,bM as y,bN as S,bO as w,bP as C,h as k,bQ as M,bR as q,r as d,bS as x,bT as H,bU as L,bV as P,bW as R,bX as B,bY as T}from"./index-DSi1cxOe.js";function v(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function A(r,e,s){const t=r.slice(0);return t[e]=s,t}var U=class extends E{#i;#e;#n;#r;#s;#t;#o;#u;#h;#a=[];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.#f(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.#b(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,c=i.some((o,f)=>o!==s[f]),b=u||c,p=b?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!b&&!p||(b&&(this.#a=t,this.#s=i),this.#e=n,this.hasListeners()&&(b&&(v(s,i).forEach(o=>{o.destroy()}),v(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#d()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#b(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.#c(t,s)]}#c(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}#p(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#b(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}#f(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=A(this.#e,s,e),this.#d())}#d(){if(this.hasListeners()){const r=this.#c(this.#e,this.#a),e=this.#p(),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 I({queries:r,...e},s){const t=k(),i=M(),n=q(),u=d.useMemo(()=>r.map(h=>{const a=t.defaultQueryOptions(h);return a._optimisticResults=i?"isRestoring":"optimistic",a}),[r,t,i]);u.forEach(h=>{x(h);const a=t.getQueryCache().get(h.queryHash);H(h,n,a)}),L(n);const[c]=d.useState(()=>new U(t,u,e)),[b,p,o]=c.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;d.useSyncExternalStore(d.useCallback(h=>f?c.subscribe(y.batchCalls(h)):P,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(u,e)},[u,e,c]);const m=b.some((h,a)=>R(u[a],h))?b.flatMap((h,a)=>{const l=u[a];if(l&&R(l,h)){const Q=new C(t,l);return B(l,Q,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const O=b.find((h,a)=>{const l=u[a];return l&&T({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(O?.error)throw O.error;return p(o())}export{I as u};
1
+ import{bL as E,bM as y,bN as S,bO as w,bP as C,h as k,bQ as M,bR as q,r as d,bS as x,bT as H,bU as L,bV as P,bW as R,bX as B,bY as T}from"./index-Bcu7BqZh.js";function v(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function A(r,e,s){const t=r.slice(0);return t[e]=s,t}var U=class extends E{#i;#e;#n;#r;#s;#t;#o;#u;#h;#a=[];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.#f(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.#b(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,c=i.some((o,f)=>o!==s[f]),b=u||c,p=b?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!b&&!p||(b&&(this.#a=t,this.#s=i),this.#e=n,this.hasListeners()&&(b&&(v(s,i).forEach(o=>{o.destroy()}),v(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#d()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#b(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.#c(t,s)]}#c(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}#p(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#b(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}#f(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=A(this.#e,s,e),this.#d())}#d(){if(this.hasListeners()){const r=this.#c(this.#e,this.#a),e=this.#p(),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 I({queries:r,...e},s){const t=k(),i=M(),n=q(),u=d.useMemo(()=>r.map(h=>{const a=t.defaultQueryOptions(h);return a._optimisticResults=i?"isRestoring":"optimistic",a}),[r,t,i]);u.forEach(h=>{x(h);const a=t.getQueryCache().get(h.queryHash);H(h,n,a)}),L(n);const[c]=d.useState(()=>new U(t,u,e)),[b,p,o]=c.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;d.useSyncExternalStore(d.useCallback(h=>f?c.subscribe(y.batchCalls(h)):P,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(u,e)},[u,e,c]);const m=b.some((h,a)=>R(u[a],h))?b.flatMap((h,a)=>{const l=u[a];if(l&&R(l,h)){const Q=new C(t,l);return B(l,Q,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const O=b.find((h,a)=>{const l=u[a];return l&&T({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(O?.error)throw O.error;return p(o())}export{I as u};
@@ -1 +1 @@
1
- import{j as E,_ as Q,t as W,f as U,r as o,aN as R,h as O,C as $,q as z,M as B,N as G,P as I,Q as X}from"./index-DSi1cxOe.js";import{C as V}from"./circle-check-big-CJe-UlT7.js";import{R as J,i as Y,t as Z}from"./search-token-index-DeYdHtqE.js";import{u as P}from"./useQueries-7N8So0Dt.js";function Se({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(Q,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(J,{className:W("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 we(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,xe=30*1e3;let F=0;const M=new Set,ne=(e=Date.now())=>{F=e+se;for(const s of M)s()},pe=(e=Date.now())=>e<F,Ee=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 be({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}},Re=(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{xe as H,be as M,Se as R,Re as a,L as b,we as c,pe as i,Ee as s,ae as u};
1
+ import{j as E,_ as Q,t as W,f as U,r as o,aN as R,h as O,C as $,q as z,M as B,N as G,P as I,Q as X}from"./index-Bcu7BqZh.js";import{C as V}from"./circle-check-big-UXLrOtDo.js";import{R as J,i as Y,t as Z}from"./search-token-index-B4kJtFA_.js";import{u as P}from"./useQueries-4YYdm8Yg.js";function Se({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(Q,{className:"size-4 text-danger"}):h?E.jsx(V,{className:"size-4 text-positive"}):E.jsx(J,{className:W("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 we(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,xe=30*1e3;let F=0;const M=new Set,ne=(e=Date.now())=>{F=e+se;for(const s of M)s()},pe=(e=Date.now())=>e<F,Ee=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 be({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}},Re=(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{xe as H,be as M,Se as R,Re as a,L as b,we as c,pe as i,Ee as s,ae as u};
@@ -1,4 +1,4 @@
1
- import{cc 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,cu as J,bE as ee,aa as te,_ as se,X as re,cJ as R,C as ne,c4 as ae}from"./index-DSi1cxOe.js";import{K as k}from"./kbd-EJpwdDwi.js";import{B as oe,b as ie}from"./useMessageBodyContent-DgKoLcSS.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{cc 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,cu as J,bE as ee,aa as te,_ as se,X as re,cJ as R,C as ne,c4 as ae}from"./index-Bcu7BqZh.js";import{K as k}from"./kbd-wWeybs89.js";import{B as oe,b as ie}from"./useMessageBodyContent-ClKIcNPh.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 I,i as C,cq as k,dI as A,r as v,j as p,dJ as h,dK as E,dL as j,C as w,c4 as D,c as z,dh as Q,cJ as R}from"./index-DSi1cxOe.js";import{P as O}from"./attachment-file-CZyLTO92.js";import{ag as P,ah as _}from"./MailListHeader-D7oYyz3_.js";import{i as q,t as N}from"./search-token-index-DeYdHtqE.js";import{a as B}from"./useLabels-C3ibzzsY.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{b as F}from"./search-scope-B5-OK3Cq.js";import{u as G,p as H}from"./useSearchTokenContext-DUxpTOVT.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}},J=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=C({...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)=>{q(c,N(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}=J({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,V=new Set(Object.values(R)),$=e=>e!==void 0&&V.has(e)?e:void 0,W=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=G(),l=D(),i=U(a),{freeText:o,tokens:r}=H(i,c),n=o.length>0,d=r.find(s=>s.type==="category"),u=$(t)??d?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,f=r.some(s=>s.type==="isStarred")?!0:void 0,y=W(r),b=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=F({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=z({...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 I,i as C,cq as k,dI as A,r as v,j as p,dJ as h,dK as E,dL as j,C as w,c4 as D,c as z,dh as Q,cJ as R}from"./index-Bcu7BqZh.js";import{P as O}from"./attachment-file-DEgj4Vud.js";import{ag as P,ah as _}from"./MailListHeader-D3QJgz1J.js";import{i as q,t as N}from"./search-token-index-B4kJtFA_.js";import{a as B}from"./useLabels-C-ytwpWV.js";import{n as U}from"./search-query-Cr_ZXBCp.js";import{b as F}from"./search-scope-B5-OK3Cq.js";import{u as G,p as H}from"./useSearchTokenContext-BW55Y3Yb.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}},J=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=C({...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)=>{q(c,N(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}=J({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,V=new Set(Object.values(R)),$=e=>e!==void 0&&V.has(e)?e:void 0,W=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=G(),l=D(),i=U(a),{freeText:o,tokens:r}=H(i,c),n=o.length>0,d=r.find(s=>s.type==="category"),u=$(t)??d?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,f=r.some(s=>s.type==="isStarred")?!0:void 0,y=W(r),b=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=F({browsed:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=z({...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-DSi1cxOe.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-Bcu7BqZh.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};
package/index.html CHANGED
@@ -38,7 +38,7 @@
38
38
  } catch (_) {}
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-DSi1cxOe.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-Bcu7BqZh.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-DYO-sbPN.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.486",
3
+ "version": "0.0.488",
4
4
  "description": "Built Remit web client — static assets and the default runtime config.",
5
5
  "files": [
6
6
  "**/*"
@@ -1 +0,0 @@
1
- import{e as $,j as e,X as y,aA as D,t as d,r as b,f as N,a2 as R}from"./index-DSi1cxOe.js";import{c as E,G as w,R as I,u as T}from"./useCalendarData-d4Z1IfQ7.js";import{A as M}from"./avatar-BUFzqa0m.js";import{M as L}from"./minus-CZaIJLbB.js";import{C as v}from"./clock-BLND_Uqn.js";import{M as F}from"./mail-5cZo03IU.js";import{P as O}from"./pencil-DLTDTx7a.js";import{C as P}from"./calendar-days-BiSAAPsl.js";import{u as A,a as B}from"./calendar-DztH7JbA.js";const G=$("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),k={accepted:"Coming",tentative:"Maybe",declined:"Not coming",noReply:"No reply"},K={accepted:"text-positive",tentative:"text-warning",declined:"text-danger",noReply:"text-fg-subtle"},S={accepted:D,tentative:v,declined:y,noReply:L};function C({rsvp:s,className:t}){const n=S[s];return e.jsxs("span",{className:d("inline-flex items-center gap-1 text-2xs font-medium",K[s],t),children:[e.jsx(n,{className:"size-3"}),k[s]]})}function Z({attendee:s,active:t=!1,onActivate:n,contextId:a,touch:l=!1,className:c}){const o=e.jsxs(e.Fragment,{children:[e.jsx(M,{name:s.name,email:s.email,size:"sm"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-sm text-fg",children:s.name}),s.role==="organizer"&&e.jsx("span",{className:"block text-2xs text-fg-subtle",children:"Organiser"})]}),e.jsx(C,{rsvp:s.rsvp})]});return n?e.jsx("button",{type:"button","aria-expanded":t,"aria-controls":t&&a!==void 0?a:void 0,onClick:()=>n(t?"":s.email),onKeyDown:i=>{i.key==="Escape"&&n("")},onBlur:i=>{t&&i.relatedTarget!==null&&(i.currentTarget.parentElement?.contains(i.relatedTarget)||n(""))},className:d("flex w-full items-center gap-2.5 rounded-md px-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",l?"min-h-11":"min-h-9",t?"bg-accent-2-soft":"hover:bg-surface-sunken",c),children:o}):e.jsx("div",{className:d("flex min-h-9 items-center gap-2.5",c),children:o})}function q({attendees:s,activeEmail:t="",onActivate:n,renderContext:a,touch:l=!1,className:c}){const o=b.useId();if(s.length===0)return null;const i=["accepted","tentative","declined","noReply"].map(r=>({state:r,count:s.filter(m=>m.rsvp===r).length})).filter(r=>r.count>0).map(r=>`${r.count} ${k[r.state].toLowerCase()}`).join(" · ");return e.jsxs("div",{className:d("flex flex-col",c),children:[e.jsx("p",{className:"pb-1 text-2xs uppercase tracking-wider text-fg-subtle",children:`${s.length} guests · ${i}`}),s.map((r,m)=>{const x=r.email===t,h=`${o}-guest-${m}`,f=e.jsx(Z,{attendee:r,active:x,onActivate:n,contextId:a?h:void 0,touch:l});return n?e.jsxs("div",{children:[f,x&&a&&e.jsx("div",{id:h,className:"py-1",children:a(r)})]},r.email):e.jsx(b.Fragment,{children:f},r.email)})]})}function u({icon:s,children:t}){return e.jsxs("div",{className:"flex items-start gap-2.5 py-1",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle",children:s}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-fg",children:t})]})}function W({event:s,calendar:t,whenText:n,onEdit:a,onDelete:l,onOpenThread:c,onClose:o,activeAttendee:i="",onActivateAttendee:r,renderAttendeeContext:m,touch:x=!1,chrome:h="header",className:f}){const z=E(t.color),j=e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s.title}),e.jsxs("div",{className:"mt-3 flex flex-col border-b border-line pb-3",children:[e.jsx(u,{icon:e.jsx(v,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n,s.attendees.length>0&&e.jsx(C,{rsvp:s.myRsvp})]})}),s.zoneCertainty==="ambiguous"?e.jsx(u,{icon:e.jsx(w,{className:"size-4 text-warning"}),children:e.jsx("span",{className:"text-warning",children:"The mail said a time but never a zone. Shown in your own; confirm before you travel for it."})}):s.timeZone!==""&&e.jsx(u,{icon:e.jsx(w,{className:"size-4"}),children:s.timeZone}),s.recurrenceRule!==""&&e.jsx(u,{icon:e.jsx(I,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.recurrenceRule,s.seriesException&&e.jsx("span",{className:"rounded-xs bg-warning-soft px-1.5 py-0.5 text-2xs text-warning",children:"Moved out of the series"})]})}),s.location!==""&&e.jsx(u,{icon:e.jsx(G,{className:"size-4"}),children:s.location})]}),s.threadId!==""&&c&&e.jsxs("button",{type:"button",onClick:c,className:"mt-3 flex w-full items-center gap-2.5 rounded-md border border-line bg-surface-sunken px-3 py-2 text-left outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(F,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:"From this thread"}),e.jsx("span",{className:"block truncate text-sm text-fg",children:s.threadSubject})]})]}),s.attendees.length>0&&e.jsx(q,{attendees:s.attendees,activeEmail:i,onActivate:r,renderContext:m,touch:x,className:"mt-3"}),s.notes!==""&&e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm text-fg-muted",children:s.notes})]});return h==="bare"?e.jsx("div",{className:d("flex flex-col",f),children:j}):e.jsxs("article",{className:d("flex h-full w-full flex-col bg-surface",f),children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[e.jsx("span",{className:d("size-2.5 shrink-0 rounded-full",z.solid)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:[t.name," · ",t.accountLabel]}),a&&e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(O,{className:"size-3.5"}),onClick:a,children:"Edit"}),l&&e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:l,className:"text-danger",children:"Delete"}),o&&e.jsx("button",{type:"button","aria-label":"Close event",onClick:o,className:"flex size-7 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(y,{className:"size-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-3",children:j})]})}const g=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),p=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function X(s){const t=new Date(s.start),n=new Date(s.end),a=g.format(t);return s.allDay?`${a}, all day`:g.format(n)===a?`${a}, ${p.format(t)} – ${p.format(n)}`:`${a}, ${p.format(t)} – ${g.format(n)}, ${p.format(n)}`}function Y({event:s,calendar:t,isOccurrence:n,onClose:a}){return!s||!t?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-surface p-8 text-center",children:[e.jsx(P,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"That event isn't on this week"}),e.jsx("p",{className:"max-w-xs text-sm text-fg-muted",children:"The address names an event the calendar doesn't have here."}),e.jsx("button",{type:"button",onClick:a,className:"rounded-md border border-line px-2.5 py-1 text-sm font-medium text-fg outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Back to the calendar"})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface",children:[n&&e.jsx("p",{className:"shrink-0 border-b border-line bg-surface-sunken px-row-inset py-1.5 text-2xs uppercase tracking-wider text-fg-subtle",children:"One occurrence of a repeating event"}),e.jsx(W,{event:s,calendar:t,whenText:X(s),onClose:a,className:"min-h-0 flex-1"})]})}function ne({calendarObjectId:s,recurrenceId:t}){const{view:n,date:a,calendarIds:l}=A(),{events:c,calendars:o}=T({date:a,calendarIds:l}),{closeEvent:i}=B(),r=c.find(x=>x.id===s),m=o.find(x=>x.id===r?.calendarId);return e.jsx(Y,{event:r,calendar:m,isOccurrence:t!==void 0,onClose:i})}export{ne as O};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-DSi1cxOe.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{ai as m,j as o,O as p}from"./index-DSi1cxOe.js";import{a}from"./MailShell-BpD0VQlu.js";import{M as r}from"./MailboxPane-BODFQwbs.js";import{d as e}from"./search-token-index-DeYdHtqE.js";import{u as s}from"./search-mirror-B3kZUGfA.js";import"./FullCompose-Ca20lPOA.js";import"./ErrorState-D8AQD4QI.js";import"./index-oS749L3s.js";import"./useMessageBodyContent-DgKoLcSS.js";import"./useSignature-DYlo-oZl.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Ca-AmULI.js";import"./sections-qjX9kREL.js";import"./format-DxgW1axG.js";import"./confirm-dialog-NVOOFruZ.js";import"./useSearchTokenContext-DUxpTOVT.js";import"./kbd-EJpwdDwi.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl--nOYmIrG.js";import"./circle-check-big-CJe-UlT7.js";import"./useQueries-7N8So0Dt.js";import"./MailListHeader-D7oYyz3_.js";import"./attachment-file-CZyLTO92.js";import"./mail-5cZo03IU.js";import"./avatar-BUFzqa0m.js";import"./EmptyState-CQL1Pjbh.js";import"./download-BJz8IQEk.js";import"./useLayoutTier-D0kPsil-.js";import"./shield-check-Cvh9jlfx.js";import"./useFilters-BT2H6A9z.js";import"./minus-CZaIJLbB.js";import"./clock-BLND_Uqn.js";import"./menu-ByhBSEmm.js";import"./MailViewChrome-C3m2xTjA.js";import"./NavMenuButton-C23ZlNzG.js";import"./useLabels-C3ibzzsY.js";import"./useSemanticSearch-BUANNC0c.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DTbJ9FNm.js";import"./circle-help-r3PbN8xG.js";import"./circle-check-CZSsF6OM.js";function X(){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{X as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-DSi1cxOe.js";import{B as o}from"./BriefPane-C5f59Mn7.js";import"./useSearchTokenContext-DUxpTOVT.js";import"./kbd-EJpwdDwi.js";import"./useMessageBodyContent-DgKoLcSS.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D7oYyz3_.js";import"./search-token-index-DeYdHtqE.js";import"./useLayoutTier-D0kPsil-.js";import"./useQueries-7N8So0Dt.js";import"./attachment-file-CZyLTO92.js";import"./mail-5cZo03IU.js";import"./avatar-BUFzqa0m.js";import"./index-oS749L3s.js";import"./useSignature-DYlo-oZl.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Ca-AmULI.js";import"./sections-qjX9kREL.js";import"./format-DxgW1axG.js";import"./EmptyState-CQL1Pjbh.js";import"./ErrorState-D8AQD4QI.js";import"./download-BJz8IQEk.js";import"./shield-check-Cvh9jlfx.js";import"./useFilters-BT2H6A9z.js";import"./minus-CZaIJLbB.js";import"./confirm-dialog-NVOOFruZ.js";import"./clock-BLND_Uqn.js";import"./menu-ByhBSEmm.js";import"./useRefreshControl--nOYmIrG.js";import"./circle-check-big-CJe-UlT7.js";import"./useLabels-C3ibzzsY.js";import"./useSemanticSearch-BUANNC0c.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function H(){return r.jsx(o.Reading,{})}export{H as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-DSi1cxOe.js";import{F as r}from"./FlaggedPane-DM3Wy8rZ.js";import"./useSearchTokenContext-DUxpTOVT.js";import"./kbd-EJpwdDwi.js";import"./useMessageBodyContent-DgKoLcSS.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D7oYyz3_.js";import"./search-token-index-DeYdHtqE.js";import"./useLayoutTier-D0kPsil-.js";import"./useQueries-7N8So0Dt.js";import"./attachment-file-CZyLTO92.js";import"./mail-5cZo03IU.js";import"./avatar-BUFzqa0m.js";import"./index-oS749L3s.js";import"./useSignature-DYlo-oZl.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Ca-AmULI.js";import"./sections-qjX9kREL.js";import"./format-DxgW1axG.js";import"./EmptyState-CQL1Pjbh.js";import"./ErrorState-D8AQD4QI.js";import"./download-BJz8IQEk.js";import"./shield-check-Cvh9jlfx.js";import"./useFilters-BT2H6A9z.js";import"./minus-CZaIJLbB.js";import"./confirm-dialog-NVOOFruZ.js";import"./clock-BLND_Uqn.js";import"./menu-ByhBSEmm.js";import"./MailViewChrome-C3m2xTjA.js";import"./wizard-selection-B1bng5Jq.js";function B(){return o.jsx(r.Reading,{})}export{B as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-DSi1cxOe.js";import{M as r}from"./MailboxPane-BODFQwbs.js";import"./useSearchTokenContext-DUxpTOVT.js";import"./kbd-EJpwdDwi.js";import"./useMessageBodyContent-DgKoLcSS.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl--nOYmIrG.js";import"./circle-check-big-CJe-UlT7.js";import"./search-token-index-DeYdHtqE.js";import"./useLayoutTier-D0kPsil-.js";import"./useQueries-7N8So0Dt.js";import"./MailListHeader-D7oYyz3_.js";import"./attachment-file-CZyLTO92.js";import"./mail-5cZo03IU.js";import"./avatar-BUFzqa0m.js";import"./index-oS749L3s.js";import"./useSignature-DYlo-oZl.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Ca-AmULI.js";import"./sections-qjX9kREL.js";import"./format-DxgW1axG.js";import"./EmptyState-CQL1Pjbh.js";import"./ErrorState-D8AQD4QI.js";import"./download-BJz8IQEk.js";import"./shield-check-Cvh9jlfx.js";import"./useFilters-BT2H6A9z.js";import"./minus-CZaIJLbB.js";import"./confirm-dialog-NVOOFruZ.js";import"./clock-BLND_Uqn.js";import"./menu-ByhBSEmm.js";import"./MailViewChrome-C3m2xTjA.js";import"./NavMenuButton-C23ZlNzG.js";import"./useLabels-C3ibzzsY.js";import"./useSemanticSearch-BUANNC0c.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DTbJ9FNm.js";import"./circle-help-r3PbN8xG.js";import"./circle-check-CZSsF6OM.js";function L(){return o.jsx(r.Reading,{})}export{L as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-DSi1cxOe.js";import{O as t}from"./OutboxPane-qfe7PmY5.js";import"./useSearchTokenContext-DUxpTOVT.js";import"./kbd-EJpwdDwi.js";import"./useMessageBodyContent-DgKoLcSS.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-CJe-UlT7.js";import"./clock-BLND_Uqn.js";import"./row-actions-Dp_6Oacr.js";import"./rotate-ccw-D4M_tmYq.js";import"./NavMenuButton-C23ZlNzG.js";import"./menu-ByhBSEmm.js";import"./format-DxgW1axG.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{e5 as o,j as e}from"./index-DSi1cxOe.js";import{O as m}from"./OpenCalendarEvent-CZoxi6ny.js";import"./useCalendarData-d4Z1IfQ7.js";import"./avatar-BUFzqa0m.js";import"./minus-CZaIJLbB.js";import"./clock-BLND_Uqn.js";import"./mail-5cZo03IU.js";import"./pencil-DLTDTx7a.js";import"./calendar-days-BiSAAPsl.js";import"./calendar-DztH7JbA.js";function O(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return e.jsx(m,{calendarObjectId:r,recurrenceId:t})}export{O as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-DSi1cxOe.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-DSi1cxOe.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{O as o}from"./index-DSi1cxOe.js";const n=o;export{n as component};