@remit/web-client-dist 0.0.693 → 0.0.695
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.
- package/assets/BriefPane-BJLNB-w7.js +1 -0
- package/assets/{CalendarEventEditor-ByaBmUP7.js → CalendarEventEditor-MMNLFvjJ.js} +1 -1
- package/assets/{CalendarEventPopup-NPO2QK5a.js → CalendarEventPopup-DVJ9DC_Y.js} +1 -1
- package/assets/{CalendarLoadFailed-MMfmxIOT.js → CalendarLoadFailed-uHGxFBGx.js} +1 -1
- package/assets/{CalendarQuickCreate-BhMEUw9n.js → CalendarQuickCreate-CzJ4lehP.js} +1 -1
- package/assets/{CalendarSession-B8ChEcvA.js → CalendarSession-BVuy8A2H.js} +1 -1
- package/assets/CollectionPane-RUuB6sFo.js +1 -0
- package/assets/{DesktopChrome-Ut5v-Z4q.js → DesktopChrome-Ct-IB4ks.js} +1 -1
- package/assets/{DropdownMenu-DeSAAnwz.js → DropdownMenu-CTCHgh4X.js} +1 -1
- package/assets/{EmptyState-nnSadc_r.js → EmptyState-CN-AyHj-.js} +1 -1
- package/assets/{ErrorState-DMaeeewe.js → ErrorState-Bk3DwNvd.js} +1 -1
- package/assets/{FullCompose-DktaLciC.js → FullCompose-BWiLy3Vm.js} +1 -1
- package/assets/{LabelApplyTrigger-ez73tEPG.js → LabelApplyTrigger-52QGuTLD.js} +1 -1
- package/assets/{MailShell-BpzbpiB4.js → MailShell-DAqGpnce.js} +1 -1
- package/assets/{MailViewChrome-C8hjtsK2.js → MailViewChrome-BDymWKX9.js} +1 -1
- package/assets/MailboxPane-DUI-sxQF.js +135 -0
- package/assets/{MessageBody-D4k3ez4t.js → MessageBody-BeciCqb_.js} +4 -4
- package/assets/MessageToolbar-BYhqv9RG.js +1 -0
- package/assets/{NavMenuButton-Du6gwKpU.js → NavMenuButton-A6v6v8tE.js} +1 -1
- package/assets/{OnboardingWizard-DE2nyJkH.js → OnboardingWizard-CIneAccs.js} +1 -1
- package/assets/OutboxPane-InUnHiNC.js +1 -0
- package/assets/{ReportLink-zQuTfqJn.js → ReportLink-q8WFRQli.js} +1 -1
- package/assets/_calendarObjectId-B3IHxxnZ.js +1 -0
- package/assets/_labelId-BX1_9FW3.js +1 -0
- package/assets/_mailboxId-BKCf6hRR.js +1 -0
- package/assets/_messageId-DGc5xyqH.js +1 -0
- package/assets/_messageId-ODP9L5rG.js +1 -0
- package/assets/_messageId-_9l1GYCG.js +1 -0
- package/assets/_messageId-t0gwqxwG.js +1 -0
- package/assets/_outboxMessageId-DGFiVWCU.js +1 -0
- package/assets/_recurrenceId-yqFEhvsn.js +1 -0
- package/assets/_slotId-Cf-NASLE.js +1 -0
- package/assets/_threadId-Bvd5G-pJ.js +1 -0
- package/assets/_threadId-BwJQjORR.js +1 -0
- package/assets/_threadId-CFLbzDUi.js +1 -0
- package/assets/_threadId-Dj29QtLs.js +1 -0
- package/assets/{_view._date-BEWywi53.js → _view._date-dARprXsM.js} +1 -1
- package/assets/{account-service-status-BUrjl90m.js → account-service-status-DexPoUiT.js} +1 -1
- package/assets/{accounts-BKuizqtY.js → accounts-DPvTdrTr.js} +1 -1
- package/assets/advanced-CDr_JOXg.js +1 -0
- package/assets/{agenda-time-TSGSlLRN.js → agenda-time-BcOiQ5_R.js} +1 -1
- package/assets/{app-chrome-a0-5AITB.js → app-chrome-6ZXmy5H4.js} +1 -1
- package/assets/{appearance-N8-8YrHT.js → appearance-BQZnBlkc.js} +1 -1
- package/assets/{avatar-DgKc162N.js → avatar-B_QEsxCw.js} +1 -1
- package/assets/{badge-JIJtKd2K.js → badge-CeCxCmzS.js} +1 -1
- package/assets/{bottom-sheet-6SRJicmu.js → bottom-sheet-DWqGf7I3.js} +1 -1
- package/assets/{brief-xjy0DnZr.js → brief-B7EfkUB4.js} +1 -1
- package/assets/brief-NsiukvBp.js +1 -0
- package/assets/{calendar-Di5oc2bm.js → calendar-CJGXdypt.js} +1 -1
- package/assets/{calendar-D_6yFuPu.js → calendar-DxjT7IrR.js} +1 -1
- package/assets/{calendar-event-popup-ShfopMbU.js → calendar-event-popup-y4Z860B0.js} +1 -1
- package/assets/{calendar-event-sidebar-73r7iWYB.js → calendar-event-sidebar-BaAGgT2x.js} +1 -1
- package/assets/{calendar-failure-note-ue_eGWKG.js → calendar-failure-note-CJvPzX2o.js} +1 -1
- package/assets/{calendar-guests-BwFd8bsh.js → calendar-guests-DeRthr7k.js} +1 -1
- package/assets/{calendar-suggestion-CmlMj01X.js → calendar-suggestion-BulekNHV.js} +1 -1
- package/assets/{calendars-Zl5qFuho.js → calendars-D-Use38B.js} +1 -1
- package/assets/{card-CpdfeZg0.js → card-0Dzt3Scs.js} +1 -1
- package/assets/{checkbox-C3sJmmOb.js → checkbox-DIKh2-eX.js} +1 -1
- package/assets/{chevron-down-BjVAPUIZ.js → chevron-down-BnC2m4J6.js} +1 -1
- package/assets/{chevron-left-CPIlsz08.js → chevron-left-CNQ3caMn.js} +1 -1
- package/assets/{circle-check-CIFCh3Pe.js → circle-check-CTlM3FQo.js} +1 -1
- package/assets/{circle-check-big-reCDNK7n.js → circle-check-big-DCVJA_H0.js} +1 -1
- package/assets/{circle-question-mark-CcoXqBlZ.js → circle-question-mark-CpApZe3H.js} +1 -1
- package/assets/classification-C7_2tIfb.js +1 -0
- package/assets/{clock-BvslxjM5.js → clock-CTlZVcLb.js} +1 -1
- package/assets/cloud-off-CtJJ9OTh.js +1 -0
- package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +1 -0
- package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +1 -0
- package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +1 -0
- package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +1 -0
- package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +1 -0
- package/assets/{config-import-04fOLGAf.js → config-import-CHZ9oJuF.js} +1 -1
- package/assets/{confirm-dialog-CyYTO5x5.js → confirm-dialog-Cc446-7C.js} +1 -1
- package/assets/{copy-DhCC4a-G.js → copy-jXKvwaUz.js} +1 -1
- package/assets/{credential-steps-CDQpL_Qv.js → credential-steps-yT5IXLY8.js} +1 -1
- package/assets/{download-DPsR-mx8.js → download-CyhaY4zL.js} +1 -1
- package/assets/{draft-DCLq6qco.js → draft-C1ufEqDz.js} +1 -1
- package/assets/edit-BGhTeEac.js +1 -0
- package/assets/edit-CeXJ3wiI.js +1 -0
- package/assets/{external-link-BsGep1V-.js → external-link-1TiTglgB.js} +1 -1
- package/assets/{file-braces-CplGXMNS.js → file-braces-CXZUVCry.js} +1 -1
- package/assets/filters-CR0iG1ow.js +1 -0
- package/assets/flagged-B4N5fCui.js +1 -0
- package/assets/{flagged-BIfTM0zc.js → flagged-DuEE_WUV.js} +1 -1
- package/assets/{folder-input-DiXjxyWE.js → folder-input-kcvJkrLj.js} +1 -1
- package/assets/{folders-DQc8V606.js → folders-6mmHeM8E.js} +1 -1
- package/assets/{help-copy-DZY11DWz.js → help-copy-CIhcXCo3.js} +1 -1
- package/assets/{import-BFpbM0fn.js → import-76KXkdMq.js} +1 -1
- package/assets/index-5PtybTMj.js +1 -0
- package/assets/index-B-gNDz7v.js +1 -0
- package/assets/index-B1AltYi_.js +1 -0
- package/assets/index-BX5kv92z.js +1 -0
- package/assets/index-CzMYehsR.js +1 -0
- package/assets/{index-DjD_uOHk.css → index-DS2W4dIw.css} +1 -1
- package/assets/index-DT4iQTvg.js +1 -0
- package/assets/index-DZ4zN_a2.js +1 -0
- package/assets/index-Xq-TD3Lr.js +1 -0
- package/assets/index-eKzwYumy.js +1 -0
- package/assets/index-ehMMhnu5.js +1 -0
- package/assets/{index-Ch9-pOcE.js → index-iXcp-mGT.js} +10 -10
- package/assets/index-rui9BQ_f.js +1 -0
- package/assets/index-t0gwqxwG.js +1 -0
- package/assets/index-yeSesYv-.js +213 -0
- package/assets/{kbd-87RT_Nj_.js → kbd-BVK8yKhS.js} +1 -1
- package/assets/{label-chip-DMq-zsvm.js → label-chip-CrQMhpJe.js} +1 -1
- package/assets/{labels-ra9ROlwe.js → labels-CaXUAL8B.js} +1 -1
- package/assets/{mail-Bd3Nb9N7.js → mail-CLkdzm71.js} +1 -1
- package/assets/mail-CiuTTyMm.js +1 -0
- package/assets/{menu-DPaXdm-B.js → menu-Cn2tY52U.js} +1 -1
- package/assets/{nav-link-DbsxgxMR.js → nav-link-BvlYCbp-.js} +1 -1
- package/assets/new-ZEuIlDnl.js +1 -0
- package/assets/onboarding-bCsMaIPY.js +1 -0
- package/assets/{onboarding-completion-YPHv2tnn.js → onboarding-completion-CJl9zKMA.js} +1 -1
- package/assets/outbox-BthyAXQ5.js +1 -0
- package/assets/{pencil-CUjJNGXo.js → pencil-A679n1yJ.js} +1 -1
- package/assets/{people-Dj45Sj6w.js → people-C5ni4bV_.js} +1 -1
- package/assets/{plus-DEbDoPs_.js → plus-D9A6i0pi.js} +1 -1
- package/assets/{popover-menu-mRa93JRF.js → popover-menu-wrc2e8Vk.js} +1 -1
- package/assets/{refresh-cw-CRjuvR6N.js → refresh-cw-BRmmCn_2.js} +1 -1
- package/assets/{reply-D62C8M_H.js → reply-DL5kkaJs.js} +1 -1
- package/assets/{rich-text-DuAbH45K.js → rich-text-EZFEOU8t.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-D7WsKeGh.js → rich-text-spellcheck-worker-provider-NOmoFs4G.js} +1 -1
- package/assets/{rotate-ccw-nJVUfniy.js → rotate-ccw-C2NtRHS-.js} +1 -1
- package/assets/{roving-focus-CSY9NYZu.js → roving-focus-CSq3MPWi.js} +1 -1
- package/assets/{row-actions-DQQOtYGX.js → row-actions-Cthc4RCY.js} +1 -1
- package/assets/{search-mirror-BXJ0y1kD.js → search-mirror-CCAs_ZWe.js} +1 -1
- package/assets/{search-scope-B_8aEz2h.js → search-scope-DaiXqXNv.js} +1 -1
- package/assets/{search-token-index-oQMvIa8e.js → search-token-index-VBBiMTaA.js} +1 -1
- package/assets/{sections-CNfPMOAR.js → sections-uFHlOXiA.js} +1 -1
- package/assets/{segmented-control-C-RwTZ8I.js → segmented-control-DNxc5Ghi.js} +1 -1
- package/assets/{select-TMp5ih6Q.js → select-B9t8348S.js} +1 -1
- package/assets/senders-uBzIqu95.js +1 -0
- package/assets/settings-BLs90wKU.js +1 -0
- package/assets/{settings-screen-DfxQ6K4C.js → settings-screen-CafoSGzb.js} +1 -1
- package/assets/shield-check-BdZGtm0z.js +1 -0
- package/assets/spam-DKjh33Xi.js +1 -0
- package/assets/{suggest-list-D8Ma2KQS.js → suggest-list-Do7i1-gb.js} +1 -1
- package/assets/{suggested-vips-D-q4Ski_.js → suggested-vips-C-je5foZ.js} +1 -1
- package/assets/suggestion._suggestionId-DF2BM_zX.js +1 -0
- package/assets/{switch-DJaDWP2C.js → switch-1RDXcNo-.js} +1 -1
- package/assets/{task._calendarTaskId-BDTL-x3M.js → task._calendarTaskId-B7k5whQt.js} +1 -1
- package/assets/{undo-2-YQhybyJt.js → undo-2-B-b8_FeJ.js} +1 -1
- package/assets/{useCalendarData-DcKv8J39.js → useCalendarData-BcNSn1yP.js} +1 -1
- package/assets/{useCalendarScheduling-BNESC6Sx.js → useCalendarScheduling-Dfk1b293.js} +1 -1
- package/assets/{useCalendarSuggestions-asjHDP2Q.js → useCalendarSuggestions-D_tk6nh4.js} +1 -1
- package/assets/{useCalendarTasks-DvRUJS7T.js → useCalendarTasks-CX2Wh1Fn.js} +1 -1
- package/assets/useClassificationSettings-Bi0m63-O.js +1 -0
- package/assets/{useDebouncedValue-Ci-c9u_d.js → useDebouncedValue-AWe2Zncy.js} +1 -1
- package/assets/{useFilters-zI-LLBh6.js → useFilters-Bp1QgyWU.js} +1 -1
- package/assets/useJunkMailboxIds-CWScvBHw.js +1 -0
- package/assets/useLabels-CGE9kc74.js +1 -0
- package/assets/{useLayoutTier-MVSmVZp-.js → useLayoutTier-D5MoTNho.js} +1 -1
- package/assets/{useMediaQuery-DyVqQyw1.js → useMediaQuery-Bf7zukl9.js} +1 -1
- package/assets/{useMessageBodyContent-Am5kUaI9.js → useMessageBodyContent-BxjoKGiE.js} +1 -1
- package/assets/{useQueries-DSE4jlRt.js → useQueries-Dj93detX.js} +1 -1
- package/assets/{useRefreshControl-Ck0n6NLI.js → useRefreshControl-DCFTdDZz.js} +1 -1
- package/assets/{useResultFolderIndex-Rs6vWQYC.js → useResultFolderIndex-DAcbTt0T.js} +1 -1
- package/assets/useSignature-CA8ypw7f.js +1 -0
- package/assets/{warnings-CyUEYIiz.js → warnings-C-blkf-m.js} +3 -3
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/BriefPane-yrb4BVCw.js +0 -1
- package/assets/CollectionPane-CxujucTw.js +0 -1
- package/assets/MailboxPane-B7qGrdvh.js +0 -135
- package/assets/MessageToolbar-BUDWthZC.js +0 -1
- package/assets/OutboxPane-DPSNZUuT.js +0 -1
- package/assets/_calendarObjectId-CEpV_AQA.js +0 -1
- package/assets/_labelId-DABFD4PZ.js +0 -1
- package/assets/_mailboxId-BRoS8Mwj.js +0 -1
- package/assets/_messageId-BTtnQ0o_.js +0 -1
- package/assets/_messageId-C0UBmFqw.js +0 -1
- package/assets/_messageId-DxeGB2Ak.js +0 -1
- package/assets/_messageId-UxNdXfkW.js +0 -1
- package/assets/_outboxMessageId-buKygU4B.js +0 -1
- package/assets/_recurrenceId-6oeOt-u4.js +0 -1
- package/assets/_slotId-F8i3-z-s.js +0 -1
- package/assets/_threadId-BxgdFrfy.js +0 -1
- package/assets/_threadId-CiXEbmEZ.js +0 -1
- package/assets/_threadId-DClgthvx.js +0 -1
- package/assets/_threadId-Dtgsuh5z.js +0 -1
- package/assets/advanced-DJpNc3kM.js +0 -1
- package/assets/brief-B2lB0FJy.js +0 -1
- package/assets/classification-B4oAmRL8.js +0 -1
- package/assets/compose._-_outboxMessageId_-BBirD1SC.js +0 -1
- package/assets/compose._-_outboxMessageId_-BXrZc_aU.js +0 -1
- package/assets/compose._-_outboxMessageId_-B_bwVs79.js +0 -1
- package/assets/compose._-_outboxMessageId_-CZX2i0CY.js +0 -1
- package/assets/compose._-_outboxMessageId_-HahCa7sA.js +0 -1
- package/assets/edit-BRJX6z-q.js +0 -1
- package/assets/edit-C3-Hl_Ov.js +0 -1
- package/assets/filters-BdDuzTmL.js +0 -1
- package/assets/flagged-BH8Kawij.js +0 -1
- package/assets/index-BG0V0va3.js +0 -1
- package/assets/index-BHkrM-Kn.js +0 -1
- package/assets/index-BTtnQ0o_.js +0 -1
- package/assets/index-BUGqdwU9.js +0 -1
- package/assets/index-C3cMdadO.js +0 -1
- package/assets/index-Cu349H81.js +0 -1
- package/assets/index-DTrFBojr.js +0 -213
- package/assets/index-DU8baGSk.js +0 -1
- package/assets/index-DdvMNVJS.js +0 -1
- package/assets/index-UxNdXfkW.js +0 -1
- package/assets/index-cDwHPIf0.js +0 -1
- package/assets/index-hxyTtlVC.js +0 -1
- package/assets/index-muoe1j5g.js +0 -1
- package/assets/mail-DZQ29OS_.js +0 -1
- package/assets/new-CcqLVf2J.js +0 -1
- package/assets/onboarding-CJFUg80G.js +0 -1
- package/assets/outbox-D-d3HzZr.js +0 -1
- package/assets/senders-Bb7Q_eFp.js +0 -1
- package/assets/settings-BIc36rPe.js +0 -1
- package/assets/shield-check-BEVo2ulB.js +0 -1
- package/assets/suggestion._suggestionId-B5pkmBKQ.js +0 -1
- package/assets/useLabels-CaeBr4vJ.js +0 -1
- package/assets/useSignature-D7iBQ4gs.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as O,p as
|
|
1
|
+
import{r as u,j as O,p as v,f as y,fn as P,fo as q,fp as W,a as E,fq as R,aS as I,fr as j,s as D}from"./index-yeSesYv-.js";import{a as z,C as k}from"./useCalendarSuggestions-D_tk6nh4.js";import{f as B}from"./ErrorState-Bk3DwNvd.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),G=(e,t)=>e.width>0&&e.height>0&&e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0;function C(e,t){return{left:Math.max(i,(t.width-e.width)/2),top:Math.max(i,(t.height-e.height)/2),side:"center"}}function H(e,t,a){if(!e||!G(e,a))return C(t,a);const r=x(e.top,i,a.height-t.height-i),c=e.left+e.width+i;if(c+t.width<=a.width-i)return{left:c,top:r,side:"right"};const f=e.left-i-t.width;if(f>=i)return{left:f,top:r,side:"left"};const l=x(e.left,i,a.width-t.width-i),s=e.top+e.height+i;if(s+t.height<=a.height-i)return{left:l,top:s,side:"below"};const h=e.top-i-t.height;return h>=i?{left:l,top:h,side:"above"}:C(t,a)}const N='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function _({anchor:e,anchorKey:t,labelledBy:a,children:r,header:c,wrapTab:f=!1,panelRef:l,className:s}){const h=u.useRef(null),[w,M]=u.useState(null),[p,A]=u.useState({key:t,x:0,y:0}),g=p.key===t?p:{x:0,y:0};u.useLayoutEffect(()=>{const n=h.current;if(!n||t==="")return;const d=()=>{const o=(typeof e=="string"?document.querySelector(e):e)?.getBoundingClientRect();M(H(o?{left:o.left,top:o.top,width:o.width,height:o.height}:null,{width:n.offsetWidth,height:n.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[e,t]);const S=n=>{if(n.button!==0||n.target instanceof Element&&n.target.closest("button, input, select, a"))return;n.preventDefault();const d={x:n.clientX-g.x,y:n.clientY-g.y},m=b=>A({key:t,x:b.clientX-d.x,y:b.clientY-d.y}),o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},L=n=>{if(!f||n.key!=="Tab")return;const d=Array.from(n.currentTarget.querySelectorAll(N));if(d.length===0)return;const m=d[0],o=d[d.length-1];n.shiftKey&&document.activeElement===m?(n.preventDefault(),o.focus()):!n.shiftKey&&document.activeElement===o&&(n.preventDefault(),m.focus())};return O.jsxs("div",{ref:n=>{h.current=n,typeof l=="function"?l(n):l&&(l.current=n)},role:"dialog","aria-modal":"false","aria-labelledby":a,"data-calendar-popover":"",onKeyDown:L,className:v("fixed z-40 w-[26rem] max-w-[calc(100vw-1rem)] rounded-xl border border-line bg-surface-raised text-fg shadow-xl shadow-black/20",w===null&&"opacity-0",s),style:{left:(w?.left??0)+g.x,top:(w?.top??0)+g.y},children:[c?.({onPointerDown:S}),r]})}const F=e=>({calendarTaskId:e.calendarTaskId,calendarId:e.calendarId,title:e.summary,due:e.allDay?e.due.slice(0,10):e.dueAt,allDay:e.allDay,completed:e.completed});function Q(e,t=!0){const{data:a,error:r,refetch:c}=E({...R({query:{from:e.from,to:e.to}}),meta:D(400,404),enabled:t});return{tasks:u.useMemo(()=>a?.items??[],[a?.items]),error:r,refetch:c}}function V(e){const{data:t,error:a,refetch:r}=E({...j({path:{calendarTaskId:e}}),meta:D(404),retry:!1});return t?{kind:"found",task:t}:a===null?{kind:"loading"}:I(a)===404?{kind:"gone"}:{kind:"failed",error:a,retry:()=>{r()}}}const T=e=>({kind:"refused",message:I(e)===412?"This task changed while you were looking at it. Close it and open it again.":B(e)});function J(){const e=z(),t=y({...P(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...W(),meta:k,onSuccess:e}),c=u.useCallback(s=>t.mutateAsync({body:s}).then(()=>({kind:"written"})).catch(T),[t]),f=u.useCallback((s,h)=>a.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag},body:h}).then(()=>({kind:"written"})).catch(T),[a]),l=u.useCallback(s=>r.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag}}).then(()=>({kind:"written"})).catch(T),[r]);return{createTask:c,updateTask:f,deleteTask:l,isWriting:t.isPending||a.isPending||r.isPending}}export{_ as C,Q as a,V as b,F as t,J as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,d as U,B as C,aS as k,az as x,aA as N,c8 as E,b3 as n,bU as P,s as y,c9 as w,a as K,c3 as I,r as M,bN as S,e as g,f as u,ca as A,cb as B,cc as $}from"./index-yeSesYv-.js";function V({title:e,message:s,reportHref:t,onRetry:r,retryLabel:o="Retry",retryRef:c}){return a.jsxs(U,{tone:"danger",variant:"soft",children:[a.jsx("p",{className:"font-medium",children:e}),a.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:s}),a.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r&&a.jsx(C,{ref:c,variant:"secondary",className:"min-h-11",onClick:r,children:o}),a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const L=y(403),d={...y(400,403,404,409,422,429),...E},v=e=>k(e)===403,i=e=>e.state==="NotConfigured"?{presetId:void 0,sources:void 0}:e.state==="Unrunnable"?{presetId:e.presetId,sources:void 0}:{presetId:e.presetId,sources:e.sources},O=(e,s)=>{const t=i(e);return t.presetId===s?t.sources:void 0},f=(e,s)=>e.state==="Configured"&&e.sources[s]===n.Saved?e[s]:"",R=(e,s,t)=>e.state==="Configured"&&e.presetId===s&&e[t]!==""?e[t]:void 0,F=e=>({presetId:i(e).presetId,model:f(e,"model"),baseUrl:f(e,"baseUrl"),apiKey:""}),G=(e,s)=>i(s).presetId===e.presetId?F(s):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Y=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(n.Saved),j={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},z=e=>{const s=[];for(const t of e){const r=s.find(o=>o.group===t.group);if(r){r.presets.push(t);continue}s.push({group:t.group,label:j[t.group],presets:[t]})}return s},D=e=>e.defaultBaseUrl===void 0,X=(e,s)=>s===n.Saved?`${e} Saved by you.`:s===n.Deployment?`${e} Provided by the deployment.`:e,T="Paste an API key",Z=e=>w(e)?.code==="ClassificationApiKeyRequired",p="Enter a URL that starts with http:// or https://",q=e=>{if(!URL.canParse(e))return!1;const{protocol:s}=new URL(e);return s==="http:"||s==="https:"},J=(e,s,t)=>{const r=e.baseUrl.trim(),o=e.apiKey.trim(),c=O(t,s.presetId);if(r!==""&&!q(r))return{ok:!1,field:"BaseUrl",message:p};if(r===""&&D(s)&&R(t,s.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:p};const b=c?.apiKey??n.Default;return s.needsKey&&o===""&&b===n.Default?{ok:!1,field:"ApiKey",message:T}:{ok:!0,body:{...i(t).presetId!==s.presetId?{classificationPresetId:s.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:r,...s.needsKey&&o!==""?{classificationApiKey:o}:{}}}},W=(e,s,t)=>{const r=i(e).presetId;if(!(r===void 0||s===void 0)&&r!==s)return t.find(o=>o.presetId===r)},ee=e=>{const s=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${s}`},se=(e,s)=>x(N({title:`Mail classification: ${e}`,errorMessage:`${e}. ${s}`})),te=e=>{const s=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return s;const t=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${s} ${t} per million input tokens.`},m="Enter a whole number of 1 or more.",H=2147483647,re=e=>{const s=e.trim();if(!/^\d+$/.test(s))return{ok:!1,message:m};const t=Number(s);return t<1||t>H?{ok:!1,message:m}:{ok:!0,limit:t}},oe=e=>e.calls>=e.dailyLimit,ae=(e,s)=>{const{cost:t}=e;if(t.state==="Priced"){const r=new Intl.NumberFormat("en",{style:"currency",currency:t.currency,maximumFractionDigits:2});return t.amount>0&&t.amount<.01?`under ${r.format(.01)}`:t.amount===0?r.format(0):`about ${r.format(t.amount)}`}return s?.group==="Local"?"no price, self-hosted":"no price"},ne=e=>P(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),l=e=>{v(e)&&S()},h=e=>s=>{e.setQueryData(I().queryKey,s)},ie=()=>{const e=K({...I(),meta:L}),s=e.isError&&v(e.error);return M.useEffect(()=>{s&&S()},[s]),{...e,signedOut:s}},ce=()=>{const e=g();return u({...A(),meta:d,onSuccess:h(e),onError:l})},ue=()=>{const e=g();return u({...B(),meta:d,onSuccess:h(e),onError:l})},de=()=>u({...$(),meta:d,onError:l});export{V as F,T as P,ue as a,te as b,se as c,F as d,i as e,de as f,z as g,Y as h,G as i,O as j,R as k,J as l,Z as m,D as n,ie as o,re as p,oe as q,ne as r,W as s,ee as t,ce as u,ae as v,X as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-yeSesYv-.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{j as u,
|
|
1
|
+
import{j as u,eU as x,X as E,p as M,eV as z,eW as L,ar as w,B as O,r as p,f as v,eX as T,a as D,eY as R,eZ as $,e_ as _,e$ as J,e as S,f0 as U,f1 as q,f2 as B,bd as K}from"./index-yeSesYv-.js";import{u as Q,S as H}from"./suggest-list-Do7i1-gb.js";import{S as W}from"./select-B9t8348S.js";import{P as X}from"./plus-D9A6i0pi.js";const P="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs";function pe({clause:e,onEdit:t,onRemove:r}){return u.jsxs("span",{className:M(P,e.derived?"border-dashed border-line-strong bg-surface-sunken":"border-line bg-surface"),children:[u.jsxs("button",{type:"button",onClick:t,"aria-label":`Edit ${x(e.field)} clause`,className:"flex items-center gap-1 text-left",children:[u.jsx("span",{className:"font-medium text-fg-muted",children:x(e.field)}),u.jsx("span",{className:"text-fg",children:e.value})]}),e.derived&&u.jsx("span",{className:"text-2xs text-fg-subtle",children:"from sender"}),r&&u.jsx("button",{type:"button",onClick:r,"aria-label":`Remove ${x(e.field)} clause`,className:"flex size-4 items-center justify-center rounded-full text-fg-subtle hover:bg-surface-sunken hover:text-fg-muted",children:u.jsx(E,{className:"size-3"})})]})}function fe({label:e,onClick:t}){return u.jsxs("button",{type:"button",onClick:t,className:M(P,"border-dashed border-line-strong text-fg-muted hover:border-accent-2 hover:text-accent-2"),children:[u.jsx(X,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=L,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=z(e.field),l=Q({count:s.length,onAccept:i=>a?.(s[i].value)});return u.jsxs("div",{className:"space-y-1.5 rounded-lg border border-accent-2 bg-surface p-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(W,{"aria-label":"Clause field",value:e.field,onChange:i=>o?.(i.target.value),className:"h-8 w-32 shrink-0",children:r.map(i=>u.jsx("option",{value:i,children:x(i)},i))}),u.jsx(w,{"aria-label":"Clause value",value:e.value,placeholder:"value…",autoComplete:"off",onChange:i=>{l.reopen(),a?.(i.target.value)},onKeyDown:i=>{l.handleKeyDown(i)||i.key==="Enter"&&n?.()},className:"h-8 min-w-40 flex-1",...l.comboboxProps}),u.jsx(O,{variant:"primary",size:"sm",onClick:n,disabled:e.value.trim()==="",className:"shrink-0",children:t==="add"?"Add":"Save"}),u.jsx(O,{variant:"ghost",size:"sm",onClick:c,"aria-label":"Cancel clause edit",icon:u.jsx(E,{className:"size-4"}),className:"shrink-0 px-2"})]}),l.open&&u.jsx(H,{id:l.listId,suggestions:s,activeIndex:l.activeIndex,optionId:l.optionId,onPick:i=>{a?.(i.value),l.dismiss()},onHighlight:l.setActiveIndex,label:`${x(e.field)} suggestions`}),d&&u.jsx("p",{className:"px-0.5 text-2xs text-fg-subtle",children:d})]})}const ge=(e,t)=>{if(e.state==="Expired")return"Expired";const r=e.state==="Disabled"?"Disabled":"Active";if(e.scope!=="Temporary"||!e.expiresAt)return r;const s=Date.parse(e.expiresAt);return Number.isNaN(s)?r:s<=t?"Expired":r},N={UserDisabled:"Turned off. Turn it on to run it on new mail again.",AwaitingFolder:"Off until its folder exists on the mail server. It turns on by itself once the folder is created.",FolderCreateFailed:"Off: the mail server refused to create its folder. Pick another folder in the rule, then turn it on.",FolderMissing:"Off: the folder it moves mail into no longer exists. Pick another folder in the rule, then turn it on."},he=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?N.UserDisabled:N[e.disabledReason],xe=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"})},j=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,o,a]=r,n=new Date(Number(s),Number(o)-1,Number(a),23,59,59,0);if(Number.isNaN(n.getTime()))return;const c=-t.getTimezoneOffset(),d=c>=0?"+":"-",l=Math.abs(c),i=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),m=b=>String(b).padStart(2,"0");return`${n.getFullYear()}-${m(n.getMonth()+1)}-${m(n.getDate())}T${m(n.getHours())}:${m(n.getMinutes())}:${m(n.getSeconds())}${d}${i}:${f}`},h="None",Y=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),k=e=>({matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),ve=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",Ce=({ruleScope:e,clauses:t,matchOperator:r,moveMailboxId:s,until:o})=>({matchOperator:r==="all"?"And":"Or",literalClauses:t.map(a=>({field:a.field,value:a.value})),moveMailboxId:s,expiresAt:e==="until"?j(o??""):void 0}),F=(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}),G=new Set(["Complete","Failed"]),A=e=>e!==void 0&&G.has(e),V=1e3,Z=15e3,ee=e=>{const t=Math.max(0,e),r=V*2**t;return Math.min(r,Z)},te=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Se=e=>{const[t,r]=p.useState(),s=v({...T(),onSuccess:g=>r(g.organizeJobId)}),{mutate:o}=s,a=D({...R({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return A(I)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:k(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:Y(g)})},[e,o]),{refetch:d}=a,l=p.useCallback(()=>{d()},[d]),i=a.data,f=s.isPending?void 0:i,m=f?.state??s.data?.state,b=A(f?.state),C={state:m,matchedCount:f?.matchedCount??0,appliedCount:f?.appliedCount??0,failedCount:f?.failedCount??0,errorMessage:f?.errorMessage??""};return{start:n,startForFilter:c,watch:r,refreshStatus:l,progress:C,isStarting:s.isPending,isRunning:!!t&&!b,isDone:b,failure:te(s.error,a.error,!!i)}},ye=["From","Subject","HasWords","ListId","FromDomain"],re=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},Oe=(e,t)=>e==="ListId"?re(t):t.trim(),se=e=>e==="all"?"And":"Or",ae=e=>({matchOperator:se(e.matchOperator),literalClauses:e.clauses.map(t=>({field:t.field,value:t.value}))}),ie=e=>!e.literalClauses.some(t=>t.field==="HasWords"),ne=e=>JSON.stringify({operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),Ne=e=>{const t=ae(e);return{matchOperator:t.matchOperator,literalClauses:t.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?j(e.until??""):void 0}},oe=(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},le=350,Fe=(e,t,r)=>{const s=v($()),{mutateAsync:o}=s,a=ne(t),[n,c]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(a),i=ie(t);return p.useEffect(()=>{if(!e||!i||a===n.previewedSignature||a===n.errorSignature)return;const f=setTimeout(()=>{const m=a;l.current=m,o({path:{accountId:e},body:k({...d.current})}).then(b=>{l.current===m&&c({count:b.matchedCount,matchedIds:b.messageIds,previewedSignature:m})}).catch(b=>{l.current===m&&c(C=>({...C,error:b instanceof Error?b.message:"Couldn't count matches.",errorSignature:m}))})},le);return()=>clearTimeout(f)},[e,i,a,n.previewedSignature,n.errorSignature,o]),i?{count:oe(n,a),matchedIds:n.previewedSignature===a?n.matchedIds??[]:[]}:{count:{status:"error",reason:_},matchedIds:[]}},y=e=>q({path:{accountId:e}}),Ae=e=>{const t=D({...J({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},Ee=e=>{const t=S(),r=v({...U(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,mutateAsync:o}=r,a=p.useCallback((c,d,l)=>{e&&s({path:{accountId:e},body:F(c,d,l)})},[e,s]),n=p.useCallback(async(c,d,l)=>{if(e)return o({path:{accountId:e},body:F(c,d,l)}).then(i=>i,()=>{})},[e,o]);return{createFilter:a,createFilterAsync:n,data:r.data,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},Me=e=>{const t=S(),r=v({...B(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s}=r;return{deleteFilter:p.useCallback(a=>{e&&s({path:{accountId:e,filterId:a}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},De=e=>{const t=S(),r=v({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,variables:o}=r,a=p.useCallback((c,d)=>{e&&s({path:{accountId:e,filterId:c},body:{state:d?"Active":"Disabled"}})},[e,s]),n=p.useCallback(()=>{o&&s(o)},[s,o]);return{toggleFilter:a,retry:n,togglingFilterId:r.isPending?o?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:o?.body?.state==="Active"}};export{fe as A,pe as C,h as N,ye as S,be as a,y as b,Se as c,Ne as d,he as e,ge as f,xe as g,Ae as h,Me as i,De as j,Ee as k,Ce as l,Oe as n,ve as o,j as p,ae as r,Fe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,c as n,r}from"./index-yeSesYv-.js";const c=new Set,u=()=>{const{data:s}=a({...n(),staleTime:1/0});return r.useMemo(()=>{const e=(s?.accounts??[]).flatMap(o=>o.folderAppointments.flatMap(t=>t.role==="Junk"&&t.mailboxId?[t.mailboxId]:[]));return e.length===0?c:new Set(e)},[s?.accounts])};export{u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,d6 as g,e as i,f as o,d7 as y,r as u,d8 as p,d9 as L,da as c}from"./index-yeSesYv-.js";const f={Default:"bg-fg-subtle",Red:"bg-red-500",Orange:"bg-orange-500",Yellow:"bg-yellow-500",Green:"bg-green-500",Teal:"bg-teal-500",Blue:"bg-blue-500",Purple:"bg-purple-500",Gray:"bg-gray-500"},O=["Default","Red","Orange","Yellow","Green","Teal","Blue","Purple","Gray"],m=e=>Object.hasOwn(f,e),l=e=>g({path:{accountId:e}}),h=async e=>{const t=[];let a;do{const{data:s}=await c({path:{accountId:e},query:{continuationToken:a},throwOnError:!0});t.push(...s.items),a=s.continuationToken}while(a);return t},P=[],q=e=>{const t=d({queryKey:l(e??""),queryFn:()=>h(e??""),enabled:!!e});return{labels:t.data??P,isSuccess:t.isSuccess,isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},w=e=>{const t=i(),a=o({...y(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutateAsync:s}=a;return{createLabel:u.useCallback((r,n="Default")=>e?s({path:{accountId:e},body:{name:r,color:n}}):Promise.reject(new Error("No account")),[e,s]),isPending:a.isPending,isError:a.isError,error:a.error,reset:a.reset}},D=e=>{const t=i(),a=o({...p(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{updateLabel:u.useCallback((r,n)=>{e&&s({path:{accountId:e,labelId:r},body:n})},[e,s]),isPending:a.isPending,updatingLabelId:a.isPending?a.variables?.path.labelId:void 0}},E=e=>{const t=i(),a=o({...L(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:l(e)})}}),{mutate:s}=a;return{deleteLabel:u.useCallback(r=>{e&&s({path:{accountId:e,labelId:r}})},[e,s]),isPending:a.isPending,deletingLabelId:a.isPending?a.variables?.path.labelId:void 0}};export{w as a,O as b,D as c,E as d,m as i,f as l,q as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,D as e}from"./useMediaQuery-
|
|
1
|
+
import{a as s,D as e}from"./useMediaQuery-Bf7zukl9.js";const i=768,a=t=>t!=="desktop",r=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{a as i,r as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s}from"./index-
|
|
1
|
+
import{r as s}from"./index-yeSesYv-.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as V,u as _o,
|
|
1
|
+
import{r as V,u as _o,cw as Eo,K as De,l as yo,aa as Ao,e as bo,a as So,cT as Ro,cG as Oo}from"./index-yeSesYv-.js";import{d as wo,e as Do}from"./reply-DL5kkaJs.js";import{c as Lo}from"./nav-link-BvlYCbp-.js";function fn(n,o){(o==null||o>n.length)&&(o=n.length);for(var a=0,l=Array(o);a<o;a++)l[a]=n[a];return l}function Co(n){if(Array.isArray(n))return n}function No(n,o){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,c,m,h,F=[],A=!0,G=!1;try{if(m=(a=a.call(n)).next,o!==0)for(;!(A=(l=m.call(a)).done)&&(F.push(l.value),F.length!==o);A=!0);}catch(W){G=!0,c=W}finally{try{if(!A&&a.return!=null&&(h=a.return(),Object(h)!==h))return}finally{if(G)throw c}}return F}}function Io(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mo(n,o){return Co(n)||No(n,o)||Po(n,o)||Io()}function Po(n,o){if(n){if(typeof n=="string")return fn(n,o);var a={}.toString.call(n).slice(8,-1);return a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set"?Array.from(n):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?fn(n,o):void 0}}const wn=Object.entries,pn=Object.setPrototypeOf,xo=Object.isFrozen,Dn=Object.getPrototypeOf,Ln=Object.getOwnPropertyDescriptor;let O=Object.freeze,D=Object.seal,Te=Object.create,Cn=typeof Reflect<"u"&&Reflect,Dt=Cn.apply,Lt=Cn.construct;O||(O=function(o){return o});D||(D=function(o){return o});Dt||(Dt=function(o,a){for(var l=arguments.length,c=new Array(l>2?l-2:0),m=2;m<l;m++)c[m-2]=arguments[m];return o.apply(a,c)});Lt||(Lt=function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return new o(...l)});const $=E(Array.prototype.forEach),vo=E(Array.prototype.lastIndexOf),mn=E(Array.prototype.pop),Le=E(Array.prototype.push),ko=E(Array.prototype.slice),Uo=E(Array.prototype.splice),_e=Array.isArray,_t=Nn(Set),Et=E(Set.prototype.add),Ce=E(Set.prototype.has),se=E(String.prototype.toLowerCase),yt=E(String.prototype.toString),dn=E(String.prototype.match),Ne=E(String.prototype.replace),hn=E(String.prototype.indexOf),Fo=E(String.prototype.trim),zo=E(Number.prototype.toString),Ho=E(Boolean.prototype.toString),Tn=typeof BigInt>"u"?null:E(BigInt.prototype.toString),gn=typeof Symbol>"u"?null:E(Symbol.prototype.toString),P=E(Object.prototype.hasOwnProperty),Ie=E(Object.prototype.toString),w=E(RegExp.prototype.test),j=Nn(TypeError);function E(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return Dt(n,o,l)}}function Nn(n){return function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return Lt(n,a)}}function d(n,o){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:se;if(pn&&pn(n,null),!_e(o))return n;let l=o.length;for(;l--;){let c=o[l];if(typeof c=="string"){const m=a(c);m!==c&&(xo(o)||(o[l]=m),c=m)}n[c]=!0}return n}function Bo(n){for(let o=0;o<n.length;o++)P(n,o)||(n[o]=null);return n}function x(n){const o=Te(null);for(const l of wn(n)){var a=Mo(l,2);const c=a[0],m=a[1];P(n,c)&&(_e(m)?o[c]=Bo(m):m&&typeof m=="object"&&m.constructor===Object?o[c]=x(m):o[c]=m)}return o}function Go(n){switch(typeof n){case"string":return n;case"number":return zo(n);case"boolean":return Ho(n);case"bigint":return Tn?Tn(n):"0";case"symbol":return gn?gn(n):"Symbol()";case"undefined":return Ie(n);case"function":case"object":{if(n===null)return Ie(n);const o=n,a=k(o,"toString");if(typeof a=="function"){const l=a(o);return typeof l=="string"?l:Ie(l)}return Ie(n)}default:return Ie(n)}}function k(n,o){for(;n!==null;){const l=Ln(n,o);if(l){if(l.get)return E(l.get);if(typeof l.value=="function")return E(l.value)}n=Dn(n)}function a(){return null}return a}function Wo(n,o){for(;n!==null;){const a=Ln(n,o);if(a)return a.get?E(a.get):null;n=Dn(n)}return null}function Yo(n){try{return w(n,""),!0}catch{return!1}}const _n=O(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),At=O(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bt=O(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$o=O(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),St=O(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jo=O(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),En=O(["#text"]),yn=O(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Rt=O(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),An=O(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ye=O(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vo=D(/{{[\w\W]*|^[\w\W]*}}/g),Xo=D(/<%[\w\W]*|^[\w\W]*%>/g),Ko=D(/\${[\w\W]*/g),qo=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qo=D(/^aria-[\-\w]+$/),bn=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zo=D(/^(?:\w+script|data):/i),Jo=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),er=D(/^html$/i),tr=D(/^[a-z][.\w]*(-[.\w]+)+$/i),Ot=D(/<[/\w!]/g),Sn=D(/<[/\w]/g),nr=D(/<\/no(script|embed|frames)/i),Rn=D(/\/>/i),b={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},or=O(d({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),rr=function(){return typeof window>"u"?null:window},ir=function(o,a){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let l=null;const c="data-tt-policy-suffix";a&&a.hasAttribute(c)&&(l=a.getAttribute(c));const m="dompurify"+(l?"#"+l:"");try{return o.createPolicy(m,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+m+" could not be created."),null}},On=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Z=function(o,a,l,c){return P(o,a)&&_e(o[a])?d(c.base?x(c.base):{},o[a],c.transform):l},wt=function(o,a,l){const c=P(o,a)?o[a]:void 0;return c&&typeof c=="object"?x(c):l()};function In(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rr();const o=s=>In(s);if(o.version="3.4.17",o.removed=[],!n||!n.document||n.document.nodeType!==b.document||!n.Element)return o.isSupported=!1,o;let a=n.document;const l=a,c=l.currentScript;n.DocumentFragment;const m=n.HTMLTemplateElement,h=n.Node,F=n.Element,A=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const G=n.DOMParser,W=n.trustedTypes,R=F.prototype,Ee=k(R,"cloneNode"),ye=k(R,"remove"),Me=k(R,"removeAttributeNode"),J=k(R,"nextSibling"),C=k(R,"childNodes"),X=k(R,"parentNode"),$e=k(R,"shadowRoot"),je=k(R,"attributes"),ee=h&&h.prototype?k(h.prototype,"nodeType"):null,ae=h&&h.prototype?k(h.prototype,"nodeName"):null,Pe=h&&h.prototype?k(h.prototype,"ownerDocument"):null,v=function(e){return ee?ee(e):e.nodeType},Ae=function(e){return ae?ae(e):e.nodeName},It=Wo(R,"namespaceURI"),Ve=function(e){return It?It(e):e.namespaceURI};if(typeof m=="function"){const s=a.createElement("template");s.content&&s.content.ownerDocument&&(a=s.content.ownerDocument)}let N,te="",Xe,Mt=!1,be=0;const Pt=function(){if(be>0)throw j('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(e){Pt(),be++;try{return N.createHTML(e)}finally{be--}},zn=function(e){Pt(),be++;try{return N.createScriptURL(e)}finally{be--}},Hn=function(){return Mt||(Xe=ir(W,c),Mt=!0),Xe},xe=a,Ke=xe.implementation,xt=xe.createNodeIterator,Bn=xe.createDocumentFragment,Gn=xe.getElementsByTagName,Wn=l.importNode;let T=On();o.isSupported=typeof wn=="function"&&typeof X=="function"&&Ke&&Ke.createHTMLDocument!==void 0;const Yn=Vo,$n=Xo,jn=Ko,Vn=qo,Xn=Qo,Kn=Zo,vt=Jo,qn=tr;let kt=bn,g=null;const qe=d({},[..._n,...At,...bt,...St,...En]);let _=null;const Qe=d({},[...yn,...Rt,...An,...Ye]);let z=Object.seal(Te(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,Ut=null;const K=Object.seal(Te(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ft=!0,Ze=!0,zt=!1,Je=!0,Y=!1,ne=!0,oe=!1,et=!1,ve=null,ke=null,tt=!1,ce=!1,Ue=!1,Fe=!1,Ht=!0,Bt=!1;const Gt="user-content-";let nt=!0,ot=!1,re=null,ue={},ie=null;const Wt=d({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Yt=null;const $t=d({},["audio","video","img","source","image","track"]);let jt=null;const Vt=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",He="http://www.w3.org/2000/svg",H="http://www.w3.org/1999/xhtml";let fe=H,rt=!1,it=null;const Qn=d({},[ze,He,H],yt),Xt=O(["mi","mo","mn","ms","mtext"]);let st=d({},Xt);const Kt=O(["annotation-xml"]);let at=d({},Kt);const Zn=d({},["title","style","font","a","script"]);let Re=null;const Jn=["application/xhtml+xml","text/html"],eo="text/html";let y=null,pe=null;const to=a.createElement("form"),qt=function(e){return e instanceof RegExp||e instanceof Function},lt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pe&&pe===e)return;(!e||typeof e!="object")&&(e={}),e=x(e),Re=Jn.indexOf(e.PARSER_MEDIA_TYPE)===-1?eo:e.PARSER_MEDIA_TYPE,y=Re==="application/xhtml+xml"?yt:se,g=Z(e,"ALLOWED_TAGS",qe,{transform:y}),_=Z(e,"ALLOWED_ATTR",Qe,{transform:y}),it=Z(e,"ALLOWED_NAMESPACES",Qn,{transform:yt}),jt=Z(e,"ADD_URI_SAFE_ATTR",Vt,{transform:y,base:Vt}),Yt=Z(e,"ADD_DATA_URI_TAGS",$t,{transform:y,base:$t}),ie=Z(e,"FORBID_CONTENTS",Wt,{transform:y}),Se=Z(e,"FORBID_TAGS",x({}),{transform:y}),Ut=Z(e,"FORBID_ATTR",x({}),{transform:y}),ue=P(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?x(e.USE_PROFILES):e.USE_PROFILES:!1,Ft=e.ALLOW_ARIA_ATTR!==!1,Ze=e.ALLOW_DATA_ATTR!==!1,zt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,ne=e.SAFE_FOR_XML!==!1,oe=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,tt=e.FORCE_BODY||!1,Ht=e.SANITIZE_DOM!==!1,Bt=e.SANITIZE_NAMED_PROPS||!1,nt=e.KEEP_CONTENT!==!1,ot=e.IN_PLACE||!1,kt=Yo(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:bn,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:H,st=wt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>d({},Xt)),at=wt(e,"HTML_INTEGRATION_POINTS",()=>d({},Kt));const t=wt(e,"CUSTOM_ELEMENT_HANDLING",()=>Te(null));if(z=Te(null),P(t,"tagNameCheck")&&qt(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),P(t,"attributeNameCheck")&&qt(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),P(t,"allowCustomizedBuiltInElements")&&typeof t.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),D(z),Y&&(Ze=!1),Ue&&(ce=!0),ue&&(g=d({},En),_=Te(null),ue.html===!0&&(d(g,_n),d(_,yn)),ue.svg===!0&&(d(g,At),d(_,Rt),d(_,Ye)),ue.svgFilters===!0&&(d(g,bt),d(_,Rt),d(_,Ye)),ue.mathMl===!0&&(d(g,St),d(_,An),d(_,Ye))),K.tagCheck=null,K.attributeCheck=null,P(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?K.tagCheck=e.ADD_TAGS:_e(e.ADD_TAGS)&&(g===qe&&(g=x(g)),d(g,e.ADD_TAGS,y))),P(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?K.attributeCheck=e.ADD_ATTR:_e(e.ADD_ATTR)&&(_===Qe&&(_=x(_)),d(_,e.ADD_ATTR,y))),P(e,"ADD_FORBID_CONTENTS")&&_e(e.ADD_FORBID_CONTENTS)&&(ie===Wt&&(ie=x(ie)),d(ie,e.ADD_FORBID_CONTENTS,y)),nt&&(g["#text"]=!0),oe&&d(g,["html","head","body"]),g.table&&(d(g,["tbody"]),delete Se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const r=N;N=e.TRUSTED_TYPES_POLICY;try{te=le("")}catch(i){throw N=r,i}}else e.TRUSTED_TYPES_POLICY===null?(N=void 0,te=""):(N===void 0&&(N=Hn()),N&&typeof te=="string"&&(te=le("")));O&&O(e),pe=e},Qt=d({},[...At,...bt,...$o]),Zt=d({},[...St,...jo]),no=function(e,t,r){return t.namespaceURI===H?e==="svg":t.namespaceURI===ze?e==="svg"&&(r==="annotation-xml"||st[r]):!!Qt[e]},oo=function(e,t,r){return t.namespaceURI===H?e==="math":t.namespaceURI===He?e==="math"&&at[r]:!!Zt[e]},ro=function(e,t,r){return t.namespaceURI===He&&!at[r]||t.namespaceURI===ze&&!st[r]?!1:!Zt[e]&&(Zn[e]||!Qt[e])},io=function(e){const t=Ve(e),r=se(Ae(e)),i=X(e);let u,f;return i&&v(i)===b.element?(u={namespaceURI:Ve(i)},f=se(Ae(i))):(u={namespaceURI:fe},f="template"),it[t]?t===He?no(r,u,f):t===ze?oo(r,u,f):t===H?ro(r,u,f):!!(Re==="application/xhtml+xml"&&it[t]):!1},q=function(e){Le(o.removed,{element:e});try{X(e).removeChild(e)}catch{if(ye(e),!X(e))throw j("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Jt=function(e,t,r){try{Me(e,t)}catch{try{e.removeAttribute(r)}catch{}}},ct=function(e){ft(e);const t=C(e);t&&$(ko(t),i=>{try{ye(i)}catch{}});const r=v(e)===b.element?je(e):null;if(r)for(let i=r.length-1;i>=0;--i){const u=r[i],f=u&&u.name;typeof f=="string"&&Jt(e,u,f)}},me=function(e,t,r){if(!r)try{r=t.getAttributeNode(e)}catch{r=null}Le(o.removed,{attribute:r||null,from:t});try{r?Me(t,r):t.removeAttribute(e)}catch{try{t.removeAttribute(e)}catch{}}if(e==="is")if(ce||Ue)try{q(t)}catch{}else try{t.setAttribute(e,"")}catch{}},en=function(e){const t=je(e);if(t)for(let r=t.length-1;r>=0;--r){const i=t[r],u=i&&i.name;typeof u!="string"||_[y(u)]||Jt(e,i,u)}},ut=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=[e];for(;i.length>0;){const u=i.pop();if(t(u)===!1)continue;if(r&&v(u)===b.element){const p=$e(u);Q(p)&&i.push(p)}const f=C(u);if(f)for(let p=f.length-1;p>=0;--p)i.push(f[p])}},ft=function(e){ut(e,t=>{v(t)===b.element&&en(t)})},pt=function(e){const t=[];return ut(e,r=>{t.push(r)},!0),t},so=function(e,t){const r=_t();$(pt(e),i=>{v(i)===b.element&&Et(r,i)}),$(t,i=>{v(i)===b.element&&!Ce(r,i)&&en(i)})},tn=function(e,t){let r=!1;return $(o.removed,i=>{i.element&&(r=r||i.element===e,ft(i.element))}),so(e,t),r},ao=8,lo=function(e,t){const r=re;let i=null;const u=()=>(i||(i=_t(),$(t,f=>{Et(i,f)})),i);for(let f=0;;f++){const p=pt(e),S=[e];let B=!1;if($(p,L=>{v(L)===b.documentFragment?Le(S,L):!B&&!Ce(r,L)&&(B=Ce(u(),L))}),!B)return;if(f>=ao)throw j("the tree kept changing during in-place sanitization; refusing to return it");$(S,(L,I)=>{co(L,I>0,e,u())})}},co=function(e,t,r,i){const u=mt(e);let f;for(;f=u.nextNode();)!Ce(i,f)||Ce(re,f)||(t&&U(T.uponSanitizeShadowNode,f,null),ht(f,r),Tt(f,r),Q(f.content)&&we(f.content))},uo=function(e){re&&Et(re,e)},nn=function(e,t){return ne?e==="patchsrc"?!0:e==="for"&&t!=="label"&&t!=="output":!1},fo=function(e){ne&&ut(e,t=>{const r=v(t);if(r===b.processingInstruction||r===b.comment&&w(Sn,t.data)){try{ye(t)}catch{}return!1}if(r===b.element){const i=t,u=y(Ae(t));try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&nn("for",u)&&i.removeAttribute("for")}catch{}}return!0})},on=function(e){let t=null,r=null;if(tt)e="<remove></remove>"+e;else{const f=dn(e,/^[\r\n\t ]+/);r=f&&f[0]}Re==="application/xhtml+xml"&&fe===H&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=N?le(e):e;if(fe===H)try{t=new G().parseFromString(i,Re)}catch{}if(!t||!t.documentElement){t=Ke.createDocument(fe,"template",null);try{t.documentElement.innerHTML=rt?te:i}catch{}}const u=t.body||t.documentElement;return e&&r&&u.insertBefore(a.createTextNode(r),u.childNodes[0]||null),fe===H?Gn.call(t,oe?"html":"body")[0]:oe?t.documentElement:u},mt=function(e){const t=Pe?Pe(e):e.ownerDocument;return xt.call(t||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)},Be=function(e){return e=Ne(e,Yn," "),e=Ne(e,$n," "),e=Ne(e,jn," "),e},dt=function(e){var t;rn(e);const r=(t=e.querySelectorAll)===null||t===void 0?void 0:t.call(e,"template");r&&$(r,i=>{Q(i.content)&&dt(i.content)})},rn=function(e){e.normalize();const t=Pe?Pe(e):e.ownerDocument,r=xt.call(t||e,e,A.SHOW_TEXT|A.SHOW_COMMENT|A.SHOW_CDATA_SECTION|A.SHOW_PROCESSING_INSTRUCTION,null);let i=r.nextNode();for(;i;)i.data=Be(i.data),i=r.nextNode()},Ge=function(e){const t=ae?ae(e):null;return typeof t!="string"||y(t)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==je(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==ee(e)||e.childNodes!==C(e)},Q=function(e){if(!ee||typeof e!="object"||e===null)return!1;try{return ee(e)===b.documentFragment}catch{return!1}},Oe=function(e){if(!ee||typeof e!="object"||e===null)return!1;try{return typeof ee(e)=="number"}catch{return!1}};function U(s,e,t){s.length!==0&&$(s,r=>{r.call(o,e,t,pe)})}const po=function(e,t){return!!(ne&&e.hasChildNodes()&&!Oe(e.firstElementChild)&&w(Ot,e.textContent)&&w(Ot,e.innerHTML)||ne&&or[t]&&v(e)===b.element&&Ve(e)===H&&(Oe(e.firstElementChild)||typeof e.textContent=="string"&&w(Ot,e.textContent))||e.nodeType===b.processingInstruction||ne&&e.nodeType===b.comment&&w(Sn,e.data))},We=function(e,t){if(e instanceof RegExp)return w(e,t);if(e instanceof Function){for(var r=arguments.length,i=new Array(r>2?r-2:0),u=2;u<r;u++)i[u-2]=arguments[u];return!!e(t,...i)}return!1},mo=function(e,t,r){if(!Se[t]&&ln(t)&&We(z.tagNameCheck,t))return!1;if(nt&&!ie[t]&&!ie[se(t)]){const i=X(e),u=C(e);if(u&&i){const f=u.length;for(let p=f-1;p>=0;--p){const S=e===r?Ee(u[p],!0):u[p];i.insertBefore(S,J(e))}}}return q(e),!0},sn=function(e,t,r,i){return e.length===0?t:t===r||t===i?x(t):t},de=function(e,t){return e===t||X(e)!==null?!1:(ot&&ft(e),!0)},ht=function(e,t){if(uo(e),U(T.beforeSanitizeElements,e,null),de(e,t))return!0;if(Ge(e))return q(e),!0;const r=y(Ae(e));if(g=sn(T.uponSanitizeElement,g,qe,ve),U(T.uponSanitizeElement,e,{tagName:r,allowedTags:g}),de(e,t))return!0;if(po(e,r))return q(e),!0;if(Se[r]||!(K.tagCheck instanceof Function&&K.tagCheck(r))&&!g[r]){const i=mo(e,r,t);return i===!1&&(U(T.afterSanitizeElements,e,null),de(e,t))?!0:i}if(v(e)===b.element&&!io(e)||(r==="noscript"||r==="noembed"||r==="noframes")&&w(nr,e.innerHTML))return q(e),!0;if(Y&&e.nodeType===b.text){const i=Be(e.textContent);e.textContent!==i&&(Le(o.removed,{element:e.cloneNode()}),e.textContent=i)}return U(T.afterSanitizeElements,e,null),de(e,t)},an=function(e,t,r){if(Ut[t]||nn(t,e)||Ht&&(t==="id"||t==="name")&&(r in a||r in to))return!1;const i=_[t]||K.attributeCheck instanceof Function&&K.attributeCheck(t,e);return Ze&&w(Vn,t)||Ft&&w(Xn,t)?!0:i?jt[t]||w(kt,Ne(r,vt,""))||(t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&hn(r,"data:")===0&&Yt[e]||zt&&!w(Kn,Ne(r,vt,""))?!0:!r:ln(e)&&We(z.tagNameCheck,e)&&We(z.attributeNameCheck,t,e)||t==="is"&&z.allowCustomizedBuiltInElements&&We(z.tagNameCheck,r)},ho=d({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ln=function(e){return!ho[se(e)]&&w(qn,e)},To=function(e,t,r,i){if(N&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!r)switch(W.getAttributeType(e,t)){case"TrustedHTML":return le(i);case"TrustedScriptURL":return zn(i)}return i},go=function(e,t,r,i){try{return r?e.setAttributeNS(r,t,i):e.setAttribute(t,i),Ge(e)?(q(e),!1):!0}catch{return me(t,e),!1}},cn=function(e,t){return ne&&w(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:se(e)==="attributename"&&dn(t,"href")!==null},Tt=function(e,t){if(U(T.beforeSanitizeAttributes,e,null),de(e,t))return;const r=e.attributes;if(!r||Ge(e))return;_=sn(T.uponSanitizeAttribute,_,Qe,ke);const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let u=r.length;const f=y(e.nodeName);for(;u--;){const p=r[u],S=p.name,B=p.namespaceURI,L=p.value,I=y(S),he=L;let M=S==="value"?he:Fo(he),un=!1;if(i.attrName=I,i.attrValue=M,i.keepAttr=!0,i.forceKeepAttr=void 0,U(T.uponSanitizeAttribute,e,i),M=i.attrValue,Bt&&(I==="id"||I==="name")&&hn(M,Gt)!==0&&(me(S,e,p),M=Gt+M,un=!0),cn(S,M)){me(S,e,p);continue}if(!i.forceKeepAttr){if(!i.keepAttr){me(S,e,p);continue}if(!Je&&w(Rn,M)){me(S,e,p);continue}if(Y&&(M=Be(M)),!an(f,I,M)){me(S,e,p);continue}M=To(f,I,B,M),M!==he&&go(e,S,B,M)&&un&&mn(o.removed)}}U(T.afterSanitizeAttributes,e,null),de(e,t)},we=function(e){let t=null;const r=mt(e);for(U(T.beforeSanitizeShadowDOM,e,null);t=r.nextNode();)if(U(T.uponSanitizeShadowNode,t,null),ht(t,e),Tt(t,e),Q(t.content)&&we(t.content),v(t)===b.element){const i=$e(t);Q(i)&&(gt(i),we(i))}Y&&rn(e),U(T.afterSanitizeShadowDOM,e,null)},gt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const r=t.pop();if(r.shadow){we(r.shadow);continue}const i=r.node,u=v(i)===b.element,f=C(i);if(f)for(let p=f.length-1;p>=0;--p)t.push({node:f[p],shadow:null});if(u){const p=ae?ae(i):null;if(typeof p=="string"&&y(p)==="template"){const S=i.content;Q(S)&&t.push({node:S,shadow:null})}}if(u){const p=$e(i);Q(p)&&t.push({node:null,shadow:p},{node:p,shadow:null})}}};return o.sanitize=function(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,r=null,i=null,u=null;if(rt=!s,rt&&(s="<!-->"),typeof s!="string"&&!Oe(s)&&(s=Go(s),typeof s!="string"))throw j("dirty is not a string, aborting");if(!o.isSupported)return s;et?(g=ve,_=ke):lt(e),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(g=x(g)),T.uponSanitizeAttribute.length>0&&(_=x(_)),o.removed=[];const f=ot&&typeof s!="string"&&Oe(s);let p=[];const S=re;if(f){fo(s);const I=Ae(s);if(typeof I=="string"){const he=y(I);if(!g[he]||Se[he])throw ct(s),j("root node is forbidden and cannot be sanitized in-place")}if(Ge(s))throw ct(s),j("root node is clobbered and cannot be sanitized in-place");p=pt(s),re=_t()}else if(Oe(s))t=on("<!---->"),r=t.ownerDocument.importNode(s,!0),r.nodeType===b.element&&r.nodeName==="BODY"||r.nodeName==="HTML"?t=r:t.appendChild(r),gt(t);else{if(!ce&&!Y&&!oe&&s.indexOf("<")===-1)return N&&Fe?le(s):s;if(t=on(s),!t)return ce?null:Fe?te:""}t&&tt&&q(t.firstChild);const B=f?s:t;try{f&>(s);const I=mt(B);for(;i=I.nextNode();)ht(i,B),Tt(i,B),Q(i.content)&&we(i.content);f&&lo(s,p)}catch(I){throw f&&(ct(s),tn(s,p)),I}finally{re=S}if(f){if(tn(s,p))throw j("a node selected for removal could not be safely returned; refusing to sanitize in place");return Y&&dt(s),s}if(ce){if(Y&&dt(t),Ue)for(u=Bn.call(t.ownerDocument);t.firstChild;)u.appendChild(t.firstChild);else u=t;return(_.shadowroot||_.shadowrootmode)&&(u=Wn.call(l,u,!0)),u}let L=oe?t.outerHTML:t.innerHTML;return oe&&g["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&w(er,t.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
3
3
|
`+L),Y&&(L=Be(L)),N&&Fe?le(L):L},o.setConfig=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(s),et=!0,ve=g,ke=_},o.clearConfig=function(){pe=null,et=!1,ve=null,ke=null,N=Xe,te=""},o.isValidAttribute=function(s,e,t){pe||lt({});const r=y(s),i=y(e);return typeof t=="string"&&(cn(e,t)||!Je&&w(Rn,t))?!1:an(r,i,t)},o.addHook=function(s,e){typeof e=="function"&&P(T,s)&&Le(T[s],e)},o.removeHook=function(s,e){if(P(T,s)){if(e!==void 0){const t=vo(T[s],e);return t===-1?void 0:Uo(T[s],t,1)[0]}return mn(T[s])}},o.removeHooks=function(s){P(T,s)&&(T[s]=[])},o.removeAllHooks=function(){T=On()},o}var br=In();const Mn="/mail/brief/compose/{-$outboxMessageId}",Pn="/mail/flagged/compose/{-$outboxMessageId}",xn="/mail/outbox/compose/{-$outboxMessageId}",vn="/mail/$mailboxId/compose/{-$outboxMessageId}",kn="/mail/label/$labelId/compose/{-$outboxMessageId}";function Un(){const n=De({from:Mn,shouldThrow:!1}),o=De({from:Pn,shouldThrow:!1}),a=De({from:xn,shouldThrow:!1}),l=De({from:vn,shouldThrow:!1}),c=De({from:kn,shouldThrow:!1});return n??o??a??l??c}function Sr(){return Un()!==void 0}function Rr(){return Un()?.outboxMessageId}function sr({list:n,mailboxId:o,labelId:a},l){return n==="flagged"?{to:Pn,params:{outboxMessageId:l}}:n==="outbox"?{to:xn,params:{outboxMessageId:l}}:n==="mailbox"&&o?{to:vn,params:{mailboxId:o,outboxMessageId:l}}:n==="label"&&a?{to:kn,params:{labelId:a,outboxMessageId:l}}:{to:Mn,params:{outboxMessageId:l}}}function Nt(){const n=_o(),o=Lo(),a=wo();return V.useCallback((l,c)=>{n({...sr(a,l),search:Eo,hash:c?.keepPanels?!0:o,replace:c?.replace??!1})},[n,o,a])}function Or(){const n=Nt();return V.useCallback(()=>n(void 0),[n])}function wr(){const n=Nt();return V.useCallback(o=>n(o),[n])}function Dr(){const n=Nt();return V.useCallback(o=>n(o,{replace:!0,keepPanels:!0}),[n])}function Lr(){return Do()}const ar=new Set(["rfc822","global"]),lr=n=>n.mediaType.toUpperCase()==="MESSAGE"&&ar.has(n.mediaSubtype.toLowerCase()),Fn=(n,o)=>n.partPath.startsWith(`${o}.`),cr=n=>{const o=n.filter(lr);return n.filter(a=>!o.some(l=>Fn(a,l.partPath)))},Cr=(n,o)=>n.filter(a=>Fn(a,o)),ur=n=>{const o=cr(n).filter(c=>!c.isMultipart&&c.disposition!=="attachment"&&c.mediaType==="TEXT"&&c.contentUrl.length>0),a=o.find(c=>c.mediaSubtype.toUpperCase()==="HTML");if(a)return{kind:"html",contentUrl:a.contentUrl};const l=o.find(c=>c.mediaSubtype.toUpperCase()==="PLAIN");return l?{kind:"text",contentUrl:l.contentUrl}:null},Ct={all:["messages"],detail:n=>[...Ct.all,"detail",n],body:n=>[...Ct.detail(n),"body"]};class ge extends Error{reason;status;retryAfterSeconds;constructor(o,a,l,c){super(a),this.name="BodyFetchError",this.reason=o,this.status=l,this.retryAfterSeconds=c}}const fr=n=>{const o=Number.parseInt(n??"",10);return!Number.isFinite(o)||o<=0?1:Math.min(o,30)},pr=8,mr="x-remit-403-reason",dr=(n,o)=>{const a=o?.trim()??"";return n===401?"auth":n===403?a.length>0?"auth":"body-missing":n===404?"body-missing":"generic"},hr=(n,o)=>(o??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(n):!1,Tr=(n,o)=>{const a=(o??"").toLowerCase();return!!(n==="text"&&a.startsWith("text/html"))},gr=async(n,o,a=async()=>null)=>{const l={},c=await a();c&&(l.Authorization=`Bearer ${c}`);const m=await Oo(n,{headers:l});if(m.status===202)throw new ge("not-ready","Message body is still syncing",202,fr(m.headers.get("Retry-After")));if(!m.ok){const A=m.headers.get(mr),G=dr(m.status,A);throw new ge(G,`Failed to load message body (${m.status} ${m.statusText})`,m.status)}const h=m.headers.get("content-type");if(Tr(o,h))throw new ge("content-type-mismatch",`Refusing to render message body — expected ${o}, got Content-Type ${h}`);const F=await m.text();if(hr(F,h))throw new ge("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return F},_r=async(n,o)=>(o.isRetryAfterNotReady&&await n.refetchDescribeMessage(),n.fetchContent(o.contentUrl,o.kind)),Nr=({messageId:n,bodyParts:o,enabled:a=!0})=>{const l=o?ur(o):null,c=yo(),{getToken:m}=Ao(),h=V.useRef(null),F=bo(),A=V.useRef(!1),G=V.useRef(null),W=n&&l?`${n}:${l.contentUrl}`:null;G.current!==W&&(G.current=W,A.current=!1);const R=So({queryKey:n?[...Ct.body(n),l?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!l)throw new Error("No renderable body part");if(!n)throw new Error("No messageId");const J=A.current;return A.current=!1,_r({fetchContent:(C,X)=>gr(C,X,m),refetchDescribeMessage:()=>F.refetchQueries({queryKey:Ro({path:{messageId:n}})})},{contentUrl:l.contentUrl,kind:l.kind,isRetryAfterNotReady:J})},enabled:a&&!!n&&!!l,staleTime:300*1e3,gcTime:1800*1e3,retry:(J,C)=>C instanceof ge&&C.reason==="not-ready"?J<pr:J<1,retryDelay:(J,C)=>C instanceof ge&&C.reason==="not-ready"?(A.current=!0,(C.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),Ee=R.isLoading&&!!l,ye=o!==void 0&&l===null;V.useEffect(()=>{Ee&&(h.current=performance.now())},[Ee]),V.useEffect(()=>{R.isSuccess&&h.current!==null&&(c.recordTiming("message.body.load",Math.round(performance.now()-h.current)),h.current=null)},[R.isSuccess,c]);const Me=R.data&&l?{kind:l.kind,body:R.data}:void 0;return{picked:l,data:Me,isLoading:Ee,hasNoRenderablePart:ye,isError:R.isError,error:R.error,refetch:R.refetch}};export{ge as B,Sr as a,Nr as b,dr as c,Rr as d,Dr as e,Lr as f,wr as g,Cr as h,lr as i,cr as o,br as p,Or as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{cU as Q,cV as y,cW as S,cX as w,cY as C,e as k,cZ as q,c_ as x,r as p,c$ as M,d0 as H,d1 as L,d2 as P,d3 as O,d4 as B,d5 as A}from"./index-yeSesYv-.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 U=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.#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.#d(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,f)=>o!==s[f]),d=u||a,b=d?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!d&&!b||(d&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(d&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#d(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)}#d(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=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 I({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 U(t,u,e)),[d,b,o]=a.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>f?a.subscribe(y.batchCalls(h)):P,[a,f]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=d.some((h,c)=>O(u[c],h))?d.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=d.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{I as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as E,
|
|
1
|
+
import{j as E,y as K,p as Q,B as U,e as N,P as B,r as o,aI as R,U as $,V as z,l as G,a3 as I,a4 as V,a7 as X}from"./index-yeSesYv-.js";import{C as J}from"./circle-check-big-DCVJA_H0.js";import{R as Y}from"./refresh-cw-BRmmCn_2.js";import{u as P}from"./useQueries-Dj93detX.js";function ye({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(K,{className:"size-4 text-danger"}):h?E.jsx(J,{className:"size-4 text-positive"}):E.jsx(Y,{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 Z=180*1e3,Se=30*1e3;let L=0;const M=new Set,ee=(e=Date.now())=>{L=e+Z;for(const s of M)s()},we=(e=Date.now())=>e<L,xe=e=>(M.add(e),()=>{M.delete(e)}),_=6e4,te=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&&te.has(a)||t.set(r.mailboxId,r.highWaterMarkUid)}return t},q=(e,s)=>{const t=[];for(const[r,a]of s)a>(e.get(r)??0)&&t.push(r);return t},se=(e,s)=>q(e,s).length>0,F=o.createContext(null),ne=()=>{const e=o.useContext(F);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function pe({accountIds:e,children:s}){const t=N(),{resultFolderIndex:r}=B(),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),v=c.current.get(d);if(c.current.set(d,g),v){const A=q(v,g);A.length>0&&$(t,z(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const W=a.current.get(d)??new Map;se(W,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(F.Provider,{value:m,children:s})}const re=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function j(e){return!!e&&re.has(e)}const D=3e3,oe=D*2,O={syncing:!1,resolved:!1,synced:0,total:0};function Ee(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),oe);return()=>clearTimeout(m)},[t,s]);const i=P({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!r,refetchInterval:D,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(j(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?O:{syncing:y,resolved:!0,synced:w,total:S}}const ae=2e3,ie=45e3,ce=e=>new Promise(s=>setTimeout(s,e)),k=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ue=e=>{X(e,{softError:!0})},T=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,le=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:r=0,onInboxSynced:a,deadline:u,pollMs:c=ae})=>{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:k(n.error)};const{syncPhase:h,lastSyncAt:y}=n.data;if((y??0)>t&&!j(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 ce(c)}},fe=async(e,s,t,r,a)=>{const u=await T(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:k(u.error)};const c=await I({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(n=>({ok:!1,error:n}));if(!c.ok)return ue(c.error),{accountId:t,enqueued:!1,ok:!1,message:k(c.error)};s.recordEvent("sync.triggered");const i=await le({accountId:t,readStatus:()=>T(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}},be=(e,s={})=>{const t=N(),r=G(),{acknowledge:a}=ne(),[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),ee();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:V({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ie,d=await Promise.all(x.map(g=>fe(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{Se as H,pe as M,ye as R,be as a,j as b,Ee as c,we as i,xe as s,ne as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,
|
|
1
|
+
import{b as n,Y as s,r as d,cg as r}from"./index-yeSesYv-.js";import{u as p}from"./useQueries-Dj93detX.js";const i={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};i.node;const h=n(i),m=a=>({items:a.map(e=>e.data?.items??[]),isPending:a.some(e=>e.isPending),error:a.find(e=>e.error)?.error??null});function y(a){const e=p({queries:a.map(t=>({...s({path:{accountId:t.accountId}}),staleTime:1/0})),combine:m});return{index:d.useMemo(()=>r(a.map((t,o)=>({folderAppointments:t.folderAppointments,mailboxes:e.items[o]??[]}))),[a,e]),isPending:e.isPending,error:e.error}}export{h as B,y as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as m,an as y,a as b,c as L,r as c,f as w,ao as S,k as E,h as k}from"./index-yeSesYv-.js";var u={en:1199414,"en-GB":1199758,nl:3180464},g=["en","en-GB","nl"];const C=()=>typeof g>"u"?[]:g,M=()=>{const e="/spellcheck/de99b00dc30674fd/";return typeof document>"u"?e:new URL(e,document.baseURI).href},_=e=>typeof u>"u"?0:u[e]??0,O=(e,n=C())=>{const t=e.toLowerCase(),a=n.find(i=>i.toLowerCase()===t);if(a)return a;const o=t.split("-")[0];return n.find(i=>i.toLowerCase().split("-")[0]===o)??null},T=[{tag:"ar",detectionCode:"arb"},{tag:"az",detectionCode:"azj"},{tag:"be",detectionCode:"bel"},{tag:"bg",detectionCode:"bul"},{tag:"bs",detectionCode:"bos"},{tag:"cs",detectionCode:"ces"},{tag:"de",detectionCode:"deu"},{tag:"en",detectionCode:"eng"},{tag:"es",detectionCode:"spa"},{tag:"fa",detectionCode:"pes"},{tag:"fr",detectionCode:"fra"},{tag:"ha",detectionCode:"hau"},{tag:"hi",detectionCode:"hin"},{tag:"hr",detectionCode:"hrv"},{tag:"hu",detectionCode:"hun"},{tag:"id",detectionCode:"ind"},{tag:"ig",detectionCode:"ibo"},{tag:"it",detectionCode:"ita"},{tag:"jv",detectionCode:"jav"},{tag:"kk",detectionCode:"kaz"},{tag:"mr",detectionCode:"mar"},{tag:"ms",detectionCode:"zlm"},{tag:"ne",detectionCode:"npi"},{tag:"nl",detectionCode:"nld"},{tag:"pl",detectionCode:"pol"},{tag:"ps",detectionCode:"pbu"},{tag:"pt",detectionCode:"por"},{tag:"ro",detectionCode:"ron"},{tag:"ru",detectionCode:"rus"},{tag:"so",detectionCode:"som"},{tag:"sr",detectionCode:"srp"},{tag:"su",detectionCode:"sun"},{tag:"sv",detectionCode:"swe"},{tag:"sw",detectionCode:"swh"},{tag:"tl",detectionCode:"tgl"},{tag:"tr",detectionCode:"tur"},{tag:"uk",detectionCode:"ukr"},{tag:"ur",detectionCode:"urd"},{tag:"vi",detectionCode:"vie"},{tag:"yo",detectionCode:"yor"},{tag:"zu",detectionCode:"zul"}],d=e=>(e.split("-")[0]??"").toLowerCase(),v=new Map(T.map(e=>[e.tag,e])),x=e=>v.get(d(e))?.detectionCode??null,P=/^[a-z]{2,3}(-[a-z0-9]{2,8})*$/i,G=e=>d(e).toUpperCase(),H=e=>{if(!P.test(e))return e;const t=new Intl.DisplayNames([e],{type:"language",fallback:"none"}).of(e);return t?t.charAt(0).toLocaleUpperCase(e)+t.slice(1):e},z=(e,n=C())=>{const t=[...e,...n].filter(o=>x(o)!==null),a=[...new Set(t.map(d))];return a.includes("en")||a.push("en"),a},N=e=>/iPhone|iPad|iPod/.test(e)?"On iPhone and iPad the keyboard decides this. Add the language under Settings, then General, then Keyboard.":/Edg\//.test(e)?"Edge checks every language you add under Settings, then Languages. Adding one there checks it alongside the others.":/Firefox\//.test(e)?"Firefox uses this setting. Right-click the message to add a dictionary for it.":/Chrome\/|Chromium\//.test(e)?"Chrome checks every language you add under Settings, then Languages. Adding one there checks it alongside the others.":/Safari\//.test(e)?"macOS decides this under Keyboard, then Text Input, then Spelling. Automatic by Language covers every language enabled there.":"Your browser decides which dictionaries it checks. Add this language in its own language settings to have it spellchecked.",h=e=>new DOMParser().parseFromString(e,"text/html"),p=e=>{const n=[...e.children];if(n.length!==1)return null;const t=n[0];return t?[...e.childNodes].some(o=>o!==t&&(o.textContent??"").trim()!=="")?null:t:null},R=(e,n)=>{if(e==="")return"";const t=h(e),a=p(t.body);if(a?.tagName==="DIV"&&a.hasAttribute("lang"))return a.setAttribute("lang",n),t.body.innerHTML;const o=t.createElement("div");for(o.setAttribute("lang",n);t.body.firstChild;)o.append(t.body.firstChild);return t.body.append(o),t.body.innerHTML},U=e=>{if(e==="")return{html:e,language:null};const n=h(e),t=p(n.body);return t?.tagName!=="DIV"||!t.hasAttribute("lang")?{html:e,language:null}:{html:t.innerHTML,language:t.getAttribute("lang")}},l={html:"",plainText:""},B=e=>{const n=m(),{pushError:t}=y(),{data:a}=b({...L(),staleTime:1/0}),o=c.useMemo(()=>{if(!e||!a)return l;const s=a.accounts.find(r=>r.accountId===e);return s?{html:s.signatureHtml??"",plainText:s.signaturePlainText??""}:l},[e,a]),i=w({...k(),onSuccess:()=>{n.invalidateQueries({queryKey:E()})},onError:s=>{t(S("Couldn't save signature","The signature wasn't saved.",s))}}),f=c.useCallback((s,r)=>{e&&i.mutate({path:{accountId:e},body:{signatureHtml:s,signaturePlainText:r}})},[e,i]);return{signature:o,setSignature:f,isSaving:i.isPending}};export{T as C,U as a,G as b,N as c,z as d,x as e,O as f,_ as g,H as l,d as p,M as s,B as u,R as w};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{j as s,
|
|
1
|
+
import{j as s,aE as T,B as d,aL as C,bl as j,bj as N,d as $,ag as A,aa as E,bB as k,cd as f,ce as _,cf as M,a as P,c as W,r as l,a5 as z,az as p,aA as x,u as O,af as B}from"./index-yeSesYv-.js";import{B as h,u as L}from"./useResultFolderIndex-DAcbTt0T.js";import{B as y}from"./badge-CeCxCmzS.js";import{C as S}from"./circle-check-CTlM3FQo.js";import{C as q}from"./copy-jXKvwaUz.js";import{E as D}from"./external-link-1TiTglgB.js";import{f as U}from"./ErrorState-Bk3DwNvd.js";import{a as F}from"./sections-uFHlOXiA.js";import{w as G}from"./help-copy-CIhcXCo3.js";import{S as H}from"./settings-screen-CafoSGzb.js";import"./useQueries-Dj93detX.js";import"./kbd-BVK8yKhS.js";import"./avatar-B_QEsxCw.js";import"./chevron-left-CNQ3caMn.js";import"./menu-Cn2tY52U.js";import"./circle-question-mark-CpApZe3H.js";function Q({report:e,onClose:t,issueUrl:n,onCopy:a}){return e===null?null:s.jsx(T,{open:!0,onClose:t,title:"Report this message",children:s.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[s.jsxs("header",{className:"space-y-1 border-b border-line px-4 py-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-fg",children:"Report this message"}),s.jsx("p",{className:"text-xs text-fg-muted",children:"This is everything the report contains. It describes what went wrong with the message — never its contents, addresses, subject, attachment names, folder name, or the parser's own error text."})]}),s.jsx("pre",{className:"flex-1 overflow-auto bg-surface-sunken px-4 py-3 text-2xs leading-relaxed whitespace-pre-wrap text-fg-muted",children:e}),s.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-line px-4 py-3",children:[s.jsx(d,{variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),s.jsx(d,{variant:"secondary",size:"sm",icon:s.jsx(q,{className:"size-3.5"}),onClick:()=>a(e),children:"Copy report"}),s.jsx(C,{external:!0,size:"sm",href:n,icon:s.jsx(D,{className:"size-3.5"}),children:"Open on GitHub"})]})]})})}const V={BodyParse:"The message is built in a way Remit could not read."};function Y(e){return V[e]}function R(e){return e.split(";")[0].trim()}const b=/^[A-Za-z0-9!#$%&'*+._-]+$/,v=/^[A-Za-z0-9!#$%&'*+._-]+\/[A-Za-z0-9!#$%&'*+._-]+$/;function m(e,t){return t.test(e)?`\`${e}\``:`\`${JSON.stringify(e).replace(/`/g,"\\u0060")}\` (malformed)`}function Z(e){const t=R(e);return v.test(t)?t:JSON.stringify(t)}const g="_not read_";function J(e){return e.length===0?["(no MIME structure was read)"]:e.map(t=>`${" ".repeat(t.depth)}- ${Z(t.contentType)}`)}const K="_No message content, addresses, subject, attachment names or parser output are included._";function w(e){return{head:[`### Message quarantined at \`${e.failureStage}\``,"",`- **Failure**: \`${e.failureCode}\``,`- **Folder role**: ${e.mailboxRole??"_none appointed_"}`,`- **Failing part**: ${e.failurePartPath==null?"_whole message_":`\`${e.failurePartPath}\``}`,`- **Attempts before quarantine**: ${e.attempts}`,`- **Worker build**: ${e.workerVersion}`,`- **Message-ID hash**: ${e.messageIdHash==null?"_none declared_":`\`${e.messageIdHash}\``}`,"","#### Message shape","",`- **Content-Type**: ${e.contentType==null?g:m(R(e.contentType),v)}`,`- **Content-Transfer-Encoding**: ${e.transferEncoding==null?g:m(e.transferEncoding,b)}`,`- **Charset**: ${e.charset==null?"_not declared_":m(e.charset,b)}`,`- **Size**: ${e.sizeBytes==null?g:`${e.sizeBytes} bytes`}`,"","MIME structure:"].join(`
|
|
2
2
|
`),structure:J(e.structure).join(`
|
|
3
3
|
`),disclaimer:K}}function X(e){const{head:t,structure:n,disclaimer:a}=w(e);return[t,"","```",n,"```","",a].join(`
|
|
4
|
-
`)}function ee(e){return`Message quarantined: ${e.failureCode} at ${e.failureStage}`}function se(e){return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function te({entry:e,onCutBug:t}){return s.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-sm text-fg",children:Y(e.failureStage)}),s.jsx("p",{className:"truncate text-xs text-fg-muted",title:e.failureMessage,children:e.failureMessage}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[e.mailboxRole&&s.jsx(y,{tone:"warning",children:j(e.mailboxRole)}),s.jsx("span",{className:"truncate",title:e.mailboxPath,children:N(e.mailboxPath,e.mailboxDelimiter)}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`uid ${e.uid}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:se(e.quarantinedAt)}),e.attempts>1&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`${e.attempts} attempts`})]})]})]}),s.jsx(d,{variant:"secondary",size:"sm",className:"shrink-0",icon:s.jsx(h,{className:"size-3.5"}),onClick:()=>t(e),children:"Cut a bug"})]})}function ne({entries:e,onCutBug:t}){return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("header",{className:"space-y-1",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Mail Remit could not read is set aside here instead of being skipped, so nothing goes missing quietly. The rest of the folder keeps syncing. Recovering a set-aside message is a re-sync, not a per-row action."})]}),e.length===0&&s.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[s.jsx(S,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Every message has been read successfully. Nothing is set aside."})]}),e.length>1&&s.jsx(
|
|
5
|
-
`)}function le(e){return`Message failed to sync: ${e.state} at ${e.stage}`}function ce(e){return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function de({entry:e,onReport:t}){const n=e.state==="GaveUp";return s.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-sm text-fg",children:re(e)}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[s.jsx(y,{tone:n?"danger":"warning",children:n?"Gave up":"Retrying"}),s.jsx("span",{className:"truncate",children:e.folderLabel}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`uid ${e.uid}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`since ${ce(e.createdAt)}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`${e.attempts} attempts`})]})]}),s.jsx(d,{variant:"secondary",size:"sm",className:"shrink-0",icon:s.jsx(h,{className:"size-3.5"}),onClick:()=>t(e),children:"Cut a bug"})]})}function ue({entries:e,total:t,onReport:n}){return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("header",{className:"space-y-1",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages that failed to sync"}),s.jsx("p",{className:"text-xs text-fg-muted",children:"A message shows here after three failed rounds and leaves on its own once it syncs. The rest of the folder keeps syncing."})]}),e.length===0&&s.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[s.jsx(S,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Every message is syncing. Nothing has failed."})]}),t>e.length&&s.jsx("p",{className:"text-xs text-fg-muted",children:`Showing the ${e.length} newest of ${t} messages that failed to sync.`}),e.length>0&&s.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:e.map(a=>s.jsx(de,{entry:a,onReport:n},a.syncWarningId))})]})}function me(){const{Account:e}=
|
|
4
|
+
`)}function ee(e){return`Message quarantined: ${e.failureCode} at ${e.failureStage}`}function se(e){return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function te({entry:e,onCutBug:t}){return s.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-sm text-fg",children:Y(e.failureStage)}),s.jsx("p",{className:"truncate text-xs text-fg-muted",title:e.failureMessage,children:e.failureMessage}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[e.mailboxRole&&s.jsx(y,{tone:"warning",children:j(e.mailboxRole)}),s.jsx("span",{className:"truncate",title:e.mailboxPath,children:N(e.mailboxPath,e.mailboxDelimiter)}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`uid ${e.uid}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:se(e.quarantinedAt)}),e.attempts>1&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`${e.attempts} attempts`})]})]})]}),s.jsx(d,{variant:"secondary",size:"sm",className:"shrink-0",icon:s.jsx(h,{className:"size-3.5"}),onClick:()=>t(e),children:"Cut a bug"})]})}function ne({entries:e,onCutBug:t}){return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("header",{className:"space-y-1",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages set aside"}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Mail Remit could not read is set aside here instead of being skipped, so nothing goes missing quietly. The rest of the folder keeps syncing. Recovering a set-aside message is a re-sync, not a per-row action."})]}),e.length===0&&s.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[s.jsx(S,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Every message has been read successfully. Nothing is set aside."})]}),e.length>1&&s.jsx($,{tone:"warning",children:s.jsxs("p",{className:"flex items-start gap-2",children:[s.jsx(A,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:[s.jsx("span",{className:"font-semibold",children:`${e.length} messages could not be read.`})," ","More than one means something is wrong with how Remit reads mail, not with the mail. Reporting one of these gets it fixed."]})]})}),e.length>0&&s.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:e.map(n=>s.jsx(te,{entry:n,onCutBug:t},n.quarantineId))})]})}const ae={Retrying:"The message could not be synced. Remit tries again every sync.",GaveUp:"The message body could not be downloaded. Remit has stopped trying."};function re(e){return ae[e.state]}const ie="_No message content, addresses, subject, folder name or error text are included._";function oe(e){return[`### Message failed to sync at \`${e.stage}\``,"",`- **State**: \`${e.state}\``,`- **Attempts**: ${e.attempts}`,"",ie].join(`
|
|
5
|
+
`)}function le(e){return`Message failed to sync: ${e.state} at ${e.stage}`}function ce(e){return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function de({entry:e,onReport:t}){const n=e.state==="GaveUp";return s.jsxs("li",{className:"flex flex-col gap-2 border-b border-line px-row-inset py-3 last:border-b-0 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-sm text-fg",children:re(e)}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-2xs text-fg-subtle",children:[s.jsx(y,{tone:n?"danger":"warning",children:n?"Gave up":"Retrying"}),s.jsx("span",{className:"truncate",children:e.folderLabel}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`uid ${e.uid}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`since ${ce(e.createdAt)}`}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:`${e.attempts} attempts`})]})]}),s.jsx(d,{variant:"secondary",size:"sm",className:"shrink-0",icon:s.jsx(h,{className:"size-3.5"}),onClick:()=>t(e),children:"Cut a bug"})]})}function ue({entries:e,total:t,onReport:n}){return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("header",{className:"space-y-1",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Messages that failed to sync"}),s.jsx("p",{className:"text-xs text-fg-muted",children:"A message shows here after three failed rounds and leaves on its own once it syncs. The rest of the folder keeps syncing."})]}),e.length===0&&s.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-line bg-surface px-row-inset py-3",children:[s.jsx(S,{className:"size-4 shrink-0 text-positive","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Every message is syncing. Nothing has failed."})]}),t>e.length&&s.jsx("p",{className:"text-xs text-fg-muted",children:`Showing the ${e.length} newest of ${t} messages that failed to sync.`}),e.length>0&&s.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:e.map(a=>s.jsx(de,{entry:a,onReport:n},a.syncWarningId))})]})}function me(){const{Account:e}=E();return s.jsx(e,{children:({signOut:t})=>s.jsx("button",{type:"button",onClick:()=>t(),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:"Sign in again"})})}function ge(e,t){return{quarantineId:e.quarantineId,accountId:e.accountId,mailboxId:e.mailboxId,uidValidity:e.uidValidity,uid:e.uid,mailboxRole:e.mailboxRole?k[e.mailboxRole]:void 0,mailboxPath:e.mailboxPath,mailboxDelimiter:t,failureStage:e.failureStage,failureCode:e.failureCode,failureMessage:e.failureMessage,failurePartPath:e.failurePartPath,quarantinedAt:e.quarantinedAt,attempts:e.attempts,sizeBytes:e.sizeBytes,contentType:e.contentType,transferEncoding:e.transferEncoding,charset:e.charset,structure:e.structure,messageIdHash:e.messageIdHash,workerVersion:e.workerVersion}}const pe=3,xe=(e,t)=>e===_.Body&&t>=pe?f.GaveUp:f.Retrying,he="A folder no longer listed";function fe(e){return e?.role?j(e.role):e?.providerPath?N(e.providerPath,e.hierarchyDelimiter):he}function be(e,t){return{syncWarningId:e.syncWarningId,uid:e.uid,stage:e.stage,state:xe(e.stage,e.attempts),attempts:e.attempts,createdAt:e.createdAt,folderLabel:fe(t)}}const je=[],Ne=[];function ye(e){window.open(e,"_blank","noopener,noreferrer")}function Se(e){return{report:X(e),issueUrl:p(x({quarantine:w(e),title:ee(e)}))}}function Re(e){const t=oe(e);return{report:t,issueUrl:p(x({syncWarning:t,title:le(e)}))}}function ve({signIn:e}){return s.jsx("section",{role:"alert",className:"space-y-3",children:s.jsxs("div",{className:"space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-row-inset py-3",children:[s.jsx("p",{className:"text-sm font-medium text-danger",children:"Your session has ended."}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Sign in again to see the messages that failed to sync or were set aside."}),e]})})}function we({error:e}){return s.jsx("section",{role:"alert",className:"space-y-3",children:s.jsxs("div",{className:"space-y-2 rounded-sm border border-danger/40 bg-danger-soft px-row-inset py-3",children:[s.jsx("p",{className:"text-sm font-medium text-danger",children:"The warnings could not be read."}),s.jsx("p",{className:"break-words text-sm text-fg-muted",children:U(e)}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Mail may still be failing to sync or have been set aside — this page cannot say either way until it can read the list. Reporting this gets it fixed."}),s.jsx(d,{variant:"secondary",size:"sm",icon:s.jsx(h,{className:"size-3.5"}),onClick:()=>ye(p(x())),children:"Report this"})]})})}function Ie({read:e,signIn:t}){const[n,a]=l.useState(null),[o,r]=l.useState(!1);if(e.kind==="Pending")return s.jsx("p",{className:"animate-pulse text-sm text-fg-subtle",children:"Checking for warnings…"});if(e.kind==="SignedOut")return s.jsx(ve,{signIn:t});if(e.kind==="Failed")return s.jsx(we,{error:e.error});const u=i=>{navigator.clipboard.writeText(i).then(()=>{r(!1),a(null)},()=>{r(!0),a(null)})};return s.jsxs("div",{className:"space-y-6",children:[o&&s.jsx("p",{role:"alert",className:"text-sm text-danger",children:"The report was not copied — this browser refused clipboard access. Cut the bug again and use Open on GitHub, which needs no clipboard."}),s.jsx(ue,{entries:e.warnings,total:e.warningsTotal,onReport:i=>a(Re(i))}),s.jsx(ne,{entries:e.quarantine,onCutBug:i=>a(Se(i))}),s.jsx(Q,{report:n?.report??null,issueUrl:n?.issueUrl??"",onClose:()=>a(null),onCopy:u})]})}function Te(e,t){return e.get(t)?.hierarchyDelimiter??""}function Ce(){const e=M(),t=P(W()),n=l.useMemo(()=>t.data?.accounts??[],[t.data]),a=L(n),o=e.data?.entries??je,r=e.data?.warnings??Ne,u=l.useMemo(()=>o.map(c=>ge(c,Te(a.index,c.mailboxId))),[o,a.index]),i=l.useMemo(()=>r.map(c=>be(c,a.index.get(c.mailboxId))),[r,a.index]),I=$e(e.error??t.error??a.error,e.isPending||t.isPending||a.isPending,{kind:"Ready",quarantine:u,warnings:i,warningsTotal:e.data?.warningsTotal??0});return s.jsx(Ie,{read:I,signIn:s.jsx(me,{})})}function $e(e,t,n){return z(e)?{kind:"SignedOut"}:e?{kind:"Failed",error:e}:t?{kind:"Pending"}:n}function He(){const e=O(),t=B(),n=F(),[a,o]=l.useState(!0);return s.jsx(H,{items:t,activeId:"warnings",title:"Warnings",description:"Messages that failed to sync, and messages set aside.",help:G,helpOpen:a,onToggleHelp:()=>o(r=>!r),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:s.jsx(Ce,{})})}export{He as component};
|
package/index.html
CHANGED
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
} catch (_) {}
|
|
36
36
|
})();
|
|
37
37
|
</script>
|
|
38
|
-
<script type="module" crossorigin src="/assets/index-
|
|
39
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
38
|
+
<script type="module" crossorigin src="/assets/index-yeSesYv-.js"></script>
|
|
39
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DS2W4dIw.css">
|
|
40
40
|
</head>
|
|
41
41
|
<body>
|
|
42
42
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,L as Mt,S as jt,eP as ne,ec as re,r as a,a as Ge,J as ie,d5 as kt,U as Et,dM as Ot,eQ as At,v as Ke,eR as Ft}from"./index-DTrFBojr.js";import{a5 as Nt,y as Bt,A as Lt,an as qt,ao as Pt,ap as _t,aq as Dt,ar as Pe,as as Qt,at as zt,au as Wt,av as Ht,aw as Ut,ag as Gt,M as Kt,aj as $t,ax as Vt,ah as Yt,ay as Jt,az as Zt,f as Xt,p as es,ak as ts,m as ss,S as os,G as ns,K as _e,J as rs,H as as,e as is,V as cs,W as xe,X as ls,Z as $e,_ as Ve,$ as ds,a0 as us,a1 as fs}from"./MessageToolbar-BUDWthZC.js";import"./nav-link-DbsxgxMR.js";import{a as ms}from"./useMessageBodyContent-Am5kUaI9.js";import{o as hs,e as gs,f as ps}from"./search-token-index-oQMvIa8e.js";import{g as xs,f as Is,r as ys}from"./reply-D62C8M_H.js";import{u as Ye}from"./sections-CNfPMOAR.js";import{u as ae}from"./useQueries-DSE4jlRt.js";import{t as Je,s as vs,r as bs,L as Ss}from"./LabelApplyTrigger-ez73tEPG.js";import{u as Ts,a as Cs,R as ws,b as Rs,c as Ms}from"./useRefreshControl-Ck0n6NLI.js";import{u as js}from"./useLabels-CaeBr4vJ.js";import{u as ks}from"./useLayoutTier-MVSmVZp-.js";import{u as Es}from"./useMediaQuery-DyVqQyw1.js";import{r as Ze,n as Os,o as Xe,w as et,u as As,p as Fs,R as Ns}from"./MessageBody-D4k3ez4t.js";import{d as Bs,w as Ls}from"./wizard-selection-zWa1qc6-.js";import{R as qs}from"./refresh-cw-CRjuvR6N.js";function Ps({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Mt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(jt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const tt=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],st="category",Ds={unclassified:"uncategorized"},H=e=>Os(e).map(t=>t.raw),W=e=>e.join(" "),Ie=e=>{const t=Xe(e);if(t)return tt.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ye=e=>{const t=Xe(e);if(!t||t.name!==st)return;const s=t.value.toLowerCase(),n=Ds[s];if(n)return n;if(!(!et(s)||s==="all"))return s},ot=e=>tt.find(t=>t.id===e),nt=e=>ot(e)!==void 0,Qs=e=>{const t=new Set;for(const s of H(e)){const n=Ie(s);n&&t.add(n)}return t},zs=e=>{let t="all";for(const s of H(e)){const n=ye(s);n&&(t=n)}return t},Ws=(e,t)=>{const s=ot(t);if(!s)return;const n=H(e),i=n.filter(d=>Ie(d)!==t);return i.length<n.length?W(i):W([...n,Ze(s.name,s.value)])},Hs=(e,t)=>{const s=H(e).filter(n=>!ye(n));return W(t==="all"?s:[...s,Ze(st,t)])},Us=e=>W(H(e).filter(t=>!Ie(t)&&!ye(t))),rt=e=>e.trim().length>0,De=e=>{if(!rt(e.query))return e.ownFilters;const t=new Set(Qs(e.query));for(const s of e.ownFilters)nt(s)||t.add(s);return t},Qe=e=>rt(e.query)?zs(e.query):e.ownCategory,ze=6e4,Gs=3e4,Ks={kind:"unknown"},We=e=>(t,s)=>Nt(s?.queryKey,e)?t:void 0,$s=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),He=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function Ys({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const h=$s(t,c,s),u=He(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:We(u),staleTime:ze}})}),d=ae({queries:e.map(c=>{const h=Vs(t,c),u=He(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:n,placeholderData:We(u),staleTime:ze}})}),m=a.useMemo(()=>e.map((c,h)=>{const u=i[h],v=d[h],p=u?.data?.items??[];return{category:c,rows:p,atCap:p.length>=s,total:n?Je(v?.data?.count):Ks,loading:u?.isPending??!0,failed:u?.isError??!1,retry:()=>{u?.refetch(),n&&v?.refetch()}}}),[e,i,d,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of d)c.refetch()},[i,d]);return{sections:m,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function Js(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:d,isError:m,refetch:l}=Ge({queryKey:re({query:n}),queryFn:async()=>{const{data:h}=await ne({query:n,throwOnError:!0});return h},enabled:s,staleTime:Gs});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&d,isError:s&&m,refetch:a.useCallback(()=>{l()},[l])}}const Zs=3e4,Xs={kind:"unknown"},eo=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function to({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const d=eo(e,i);return{queryKey:re({query:d}),queryFn:async()=>{const{data:m}=await ne({query:d,throwOnError:!0});return m},enabled:s,staleTime:Zs}})});return a.useMemo(()=>t.map((i,d)=>({mailboxId:i,count:s?Je(n[d]?.data?.count):Xs,failed:s?n[d]?.isError??!1:!1})),[t,n,s])}const so=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),oo=e=>[...e].sort(so),no=["from","subject","category","unread","starred","attachments"],at=["contacts","today"],ro=e=>new Set(at.filter(t=>e.has(t))),ao=(e,t,s,n)=>{const i=Bt({category:e,attributes:t}),{params:d,residual:m}=Lt(s,i,no),l={...d,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:m}},io=({residual:e,attributes:t})=>e.length===0&&!at.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,co=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function lo(e,{pageRowsByMailbox:t}){const s=e.map(u=>({...u,pageRows:t.get(u.mailboxId)??0}));for(const[u,v]of t)v<=0||s.some(p=>p.mailboxId===u)||s.push({mailboxId:u,count:{kind:"unknown"},failed:!1,pageRows:v});const n=s[0];if(!n)return;let i=0,d=!0,m=n;for(const u of s)u.count.kind==="unknown"?d=!1:i+=u.count.value,co(u,m)&&(m=u);const l=s.some(u=>u.pageRows>0),c=s.some(u=>u.failed);if(i===0&&!l&&(d||!c))return;const h=d&&i===0&&l;return{mailboxId:m.mailboxId,count:d&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const uo=50,fo=200,mo=[],Ue=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),ho=({accountEmail:e})=>{const t=Ye();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(Ke,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},go=(e,t)=>{if(t.size===0)return{};const s=e.filter(d=>t.has(d.id)),n=bs(s.map(d=>d.accountId));if(n.restriction)return n;const i=new Set;for(const d of s)d.mailboxId&&i.add(d.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function po({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:d,exitSelection:m,orderedIds:l,allSelected:c,toggleAllLoaded:h}=Zt(),u=a.useMemo(()=>go(t,i),[t,i]),{junkMailboxId:v}=Xt(u.accountId),{labels:p}=js(u.accountId),b=a.useMemo(()=>Array.from(i),[i]),L=a.useMemo(()=>Ls(t,i),[t,i]),x=es(v,u.mailboxId),S=a.useMemo(()=>l.length>0?{checked:c,indeterminate:d>0&&!c,onChange:h}:void 0,[l.length,c,d,h]),F=u.moveDisabledHint?{tone:"warning",text:u.moveDisabledHint}:void 0,T=R=>r.jsx(os,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:m,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:u.accountId&&u.mailboxId&&d>0&&p.length>0?r.jsx(Ss,{accountId:u.accountId,mailboxId:u.mailboxId,messageIds:b}):void 0,selectAll:S,notice:F});return r.jsx(ts,{...e,selectionBar:T,paneOverlay:r.jsx(ss,{verb:s.verb,accountId:u.accountId,mailboxId:u.mailboxId,selection:L,selectionRestriction:u.restriction,onFinished:m}),children:n})}function xo({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:d}){const{searchQuery:m,searchInput:l,resultFolderIndex:c,onSearchChange:h}=ie(),u=As(),v=Es(),p=ks(),b=kt(),L=hs(),x=a.useMemo(()=>oo(e.filter(o=>!o.muted?.value)),[e]),[S,F]=a.useState("all"),[T,R]=a.useState("all"),[N,q]=a.useState(new Set),[le,M]=a.useState(!1),P=a.useCallback(o=>{q(f=>{const g=new Set(f);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:_}=Fs(m.trim().toLowerCase(),u),y=w.length>0,D=a.useMemo(()=>De({query:l,ownFilters:N}),[l,N]),Q=a.useMemo(()=>Qe({query:l,ownCategory:T}),[l,T]),A=a.useMemo(()=>De({query:m,ownFilters:N}),[m,N]),C=a.useMemo(()=>Qe({query:m,ownCategory:T}),[m,T]),I=a.useCallback(o=>{if(!E||!nt(o)){P(o);return}const f=Ws(l,o);f!==void 0&&h(f)},[E,l,h,P]),j=a.useCallback(o=>{if(!E){R(o);return}h(Hs(l,o))},[E,l,h]),de=a.useMemo(()=>C==="all"&&!y?o=>{et(o)&&j(o)}:void 0,[C,y,j]),ue=a.useCallback(()=>{R("all"),F("all"),U(),E&&h(Us(l))},[E,l,h,U]),G=ae({queries:x.map(o=>({...Et({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=a.useMemo(()=>{const o=new Map;for(let f=0;f<x.length;f++){const g=x[f].accountId,te=(G[f]?.data?.items??[]).reduce((O,Rt)=>O+(Rt.unseenCount??0),0);o.set(g,te)}return o},[x,G]),lt=a.useMemo(()=>x.filter((o,f)=>{const g=G[f];return g?.isError?!Ot(g.error):!1}),[x,G]),{criteria:fe,residual:$}=a.useMemo(()=>ao(C,A,_,S==="all"?void 0:S),[C,A,_,S]),dt=a.useMemo(()=>C==="all"?[...qt]:[C],[C]),ve=a.useMemo(()=>({...fe,query:w,...C==="all"?{}:{category:[C]}}),[fe,w,C]),be=io({residual:$,attributes:A}),{sections:V,isLoading:ut,isError:ft,refetch:Se}=Ys({categories:y?mo:dt,criteria:fe,limit:C==="all"?Jt:uo,counted:be}),{rows:Te,isLoading:mt,isError:ht,refetch:Ce}=Js(ve,fo,y),me=y?mt:ut,we=y?ht:ft,Re=a.useCallback(()=>{if(y){Ce();return}Se()},[y,Ce,Se]),Me=a.useMemo(()=>ro(A),[A]),Y=a.useCallback(o=>Bs(o).map(Pt).filter(f=>_t(f,Me)&&Dt(f,$)),[Me,$]),J=a.useMemo(()=>V.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:Y(o.rows)})),[V,Y]),Z=a.useMemo(()=>Y(Te),[Te,Y]),gt=a.useCallback(o=>{V.find(f=>f.category===o)?.retry()},[V]),k=a.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),pt=a.useMemo(()=>At(c),[c]),je=to({criteria:ve,junkMailboxIds:pt,enabled:be&&vs({hasSearchQuery:y,freeText:w,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const f=k.map(O=>Pe(O,c)),{spam:g}=Qt(f),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=lo(je,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(O=>O.id)):void 0,briefSpamOffer:te}},[k,w,c,je]),ke=a.useMemo(()=>{const o=f=>he===void 0?f:f.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:zt(J.map(f=>({...f,rows:o(f.rows)})))},[y,Z,J,he]),Ee=a.useCallback((o,f)=>{const g=k.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},f)},[k,s]),xt=a.useCallback(o=>{const f=o.threadId??k.find(g=>g.id===o.id)?.threadId;f&&s?.({threadId:f,messageId:o.id})},[k,s]),ge=a.useMemo(()=>x.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...x.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:K.get(o.accountId),active:S===o.accountId}))],[x,K,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),It=a.useMemo(()=>Array.from(K.values()).reduce((o,f)=>o+f,0),[K]),pe=a.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Oe}=Ts(),{state:Ae,errorMessage:Fe,refresh:Ne}=Cs(pe,{onSettled:()=>Re()}),yt=a.useMemo(()=>r.jsx(ws,{state:Ae,onRefresh:Ne,label:"Refresh daily brief",errorMessage:Fe,hasUpdate:Oe(pe)}),[Ae,Ne,Fe,Oe,pe]),vt=a.useMemo(()=>k.map(o=>Pe(o,c)),[k,c]),bt=a.useMemo(()=>{const o=Wt(ge.map(f=>({id:f.id,label:f.label,count:f.count,active:f.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:D,expanded:le,onExpandedChange:M,onSelectCategory:f=>j(f),onSelectSource:F,onToggleFilter:f=>I(f),onClear:ue}},[ge,z,Q,D,le,I,j,ue]),Be=ke.length===0&&S==="all"&&w.length===0&&_.length===0,St=a.useMemo(()=>x.map(o=>o.accountId),[x]),Tt=a.useMemo(()=>x.some(o=>Rs(o.syncPhase)),[x]),ee=Ms(St,Be||Tt),Le=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ue,{}),r.jsx(Ue,{})]}),qe=!me&&!we&&!Be,Ct=Ht({tier:p,hasLiveInput:E,hasCommittedQuery:m.trim().length>0,bodyRendersCommittedResults:!0}),wt=qe?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(Ut,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,m)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Gt,{sections:ke,briefCategory:Q,Row:Kt,selectedThreadId:t,onSelectThread:Ee,onShowAllSection:de,onRetrySection:gt,flat:y,onSelectBriefCategory:j,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:I,onClearFilters:ue})})]}):me?Le:we?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(Ke,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Re(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(qs,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Ps,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):Le;return r.jsx($t,{hasSheet:qe&&!Ct,children:r.jsx(Vt,{selectedMessageId:t,rows:k,onOpen:Ee,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(po,{wizard:b,header:{title:"Daily brief",unreadCount:It,footer:v?r.jsx(Yt,{}):void 0,searchFilter:bt,searchResults:vt,searchLoading:me,onSelectSearchResult:xt,spamOffer:X,searchResultsInBody:!0,refreshControl:yt},rows:k,children:r.jsxs("div",{className:"flex h-full flex-col",children:[lt.map(o=>r.jsx(ho,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:wt})]})})})})}const it=a.createContext(null);function ce(){const e=a.useContext(it);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function Io({thread:e,children:t}){const s=gs(),n=ps(),i=Ye(),{searchInput:d}=ie(),m=e?.threadId,l=e?.messageId,{data:c}=Ge({...Ft(),staleTime:6e4}),h=a.useMemo(()=>c?.items??[],[c]),u=a.useMemo(()=>{if(m)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===m)},[h,m,l]),v=ns(m,l),p=u??v,b=l??p?.messageId,L=a.useMemo(()=>{if(m)return{threadId:m,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[m,p,b]),x=a.useCallback((I,j)=>{s(I,{replace:j?.replace,query:d})},[s,d]),S=a.useCallback(I=>{b&&I.includes(b)&&n()},[b,n]),F=_e({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),T=rs(),{deleteMessages:R}=as({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=is({mailboxId:p?.mailboxId??"",messages:h}),q=T.focusedMessageId,M=a.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,P=_e({thread:M,isOpen:M?.messageId===b}),U=ms(),E=xs(),w=Is(),_=a.useMemo(()=>ys(w,m,b),[w,m,b]),y=a.useMemo(()=>{if(M)return I=>w({threadId:M.threadId,messageId:M.messageId,mode:I})},[w,M]),{nextMessageId:D,previousMessageId:Q}=cs({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:m!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||M&&N([M.messageId],!M.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),A=a.useCallback(I=>{if(!I)return;const j=h.find(de=>de.messageId===I);return j?{threadId:j.threadId,messageId:I}:void 0},[h]),C={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:n,nextThread:A(D),previousThread:A(Q),actions:F,onReply:_,triage:T,onDeleteMessages:R,handleDeselectIfRemoved:S};return r.jsx(it.Provider,{value:C,children:t})}function ct(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(xo,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function yo(){const e=xe(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:d,onOpenThread:m}=ce(),l=!!t,c=us(t?.threadId);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(fs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx($e,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(Ns,{})})]}),r.jsx(Ve,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:d,onReplyWithText:e,onOpenThread:m})]})}function vo(){const e=xe(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(ds,{onClose:i,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function bo(){const e=xe(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:d,previousThread:m,handleDeselectIfRemoved:l}=ce(),c=ls(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx($e,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:m?()=>n(m):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(Ve,{isOpen:c.isOpen,onClose:c.close,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(ct,{})})}const Po=Object.assign(Io,{List:ct,Reading:yo,Intelligence:vo,Phone:bo});export{Po as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{eP as Z,r as i,ec as $,a as ue,J as K,d5 as he,aw as ge,ax as me,j as r}from"./index-DTrFBojr.js";import{u as pe,l as fe,b as xe,a as Ie}from"./MailViewChrome-C8hjtsK2.js";import{y as Te,A as ye,ao as Ce,aq as ve,aA as Re,ar as be,d as we,M as Se,ax as je,aB as Me,az as Oe,m as ke,G as Pe,K as U,J as Fe,H as Le,e as Ae,V as Ne,W as V,X as De,Z as Y,_ as ee,$ as qe,a0 as Ee,a1 as Be}from"./MessageToolbar-BUDWthZC.js";import"./nav-link-DbsxgxMR.js";import{a as We}from"./useMessageBodyContent-Am5kUaI9.js";import{e as Qe,f as ze}from"./search-token-index-oQMvIa8e.js";import{g as He,f as Ke,r as Ve}from"./reply-D62C8M_H.js";import{u as _e}from"./sections-CNfPMOAR.js";import{u as Ge}from"./useMediaQuery-DyVqQyw1.js";import{u as Je,p as X,R as Ue}from"./MessageBody-D4k3ez4t.js";import{d as Xe,w as Ze}from"./wizard-selection-zWa1qc6-.js";import{f as $e}from"./ErrorState-DMaeeewe.js";const _=(t,e)=>({...e,...t,order:"desc"}),Ye=(t,e={})=>$({query:_(t,e)});function te(t,e={}){const{data:s,isLoading:o,isError:n,error:c,refetch:x,fetchNextPage:h,hasNextPage:a,isFetchingNextPage:I}=pe({queryKey:Ye(t,e),queryFn:async({pageParam:T})=>{const{data:b}=await Z({query:{..._(t,e),continuationToken:T},throwOnError:!0});return b},initialPageParam:void 0,getNextPageParam:T=>T.continuationToken,staleTime:6e4});return{threads:i.useMemo(()=>(s?.pages??[]).flatMap(T=>T.items??[]),[s]),isLoading:o,isError:n,error:c,refetch:x,fetchNextPage:h,hasNextPage:a,isFetchingNextPage:I}}function et(t,e={}){const s={..._(t,e),unread:!0,count:!0,results:!1},{data:o}=ue({queryKey:$({query:s}),queryFn:async()=>{const{data:n}=await Z({query:s,throwOnError:!0});return n},staleTime:6e4});return o?.count}const Ct={starred:!0},tt=["from","subject","category","unread","starred","attachments"],st=(t,e,s)=>{const o=Te(e),{params:n,residual:c}=ye(s,{...o,...t},tt);return{criteria:{...n,...o},residual:c}};function ot({rows:t,verb:e}){const{selectedIds:s,exitSelection:o}=Oe(),n=i.useMemo(()=>Ze(t,s),[t,s]);return r.jsx(ke,{verb:e,selection:n,selectionRestriction:"spansAccounts",onFinished:o})}function nt({collection:t,title:e,selectedMessageId:s,onOpenThread:o,commandsRef:n,onTriageContextChange:c,onDeleteMessages:x}){const{searchQuery:h,resultFolderIndex:a,onSearchClearQuery:I}=K(),g=Je(),T=Ge(),b=he(),[u,m]=i.useState("all"),[w,A]=i.useState(new Set),M=i.useCallback(l=>{A(j=>{const y=new Set(j);return y.has(l)?y.delete(l):y.add(l),y})},[]),O=i.useCallback(()=>{m("all"),A(new Set)},[]),C=i.useCallback(()=>{O(),I()},[O,I]),{freeText:k,tokens:v}=X(h.trim().toLowerCase(),g),N=X(h.trim(),g).freeText,{criteria:D,residual:p}=i.useMemo(()=>st(t,{category:u,attributes:w},v),[t,u,w,v]),P=i.useMemo(()=>k?{...D,query:k}:D,[D,k]),{threads:q,isLoading:E,isError:R,error:W,refetch:F,fetchNextPage:Q,hasNextPage:z,isFetchingNextPage:L}=te(t,P),f=i.useMemo(()=>Xe(q).map(Ce).filter(l=>ve(l,p)),[q,p]),d=i.useCallback((l,j)=>{const y=f.find(ce=>ce.id===l)?.threadId;y&&o?.({threadId:y,messageId:l},j)},[f,o]),S=i.useCallback(l=>{const j=l.threadId??f.find(y=>y.id===l.id)?.threadId;j&&o?.({threadId:j,messageId:l.id})},[f,o]),H=i.useMemo(()=>Re(),[]),ne=i.useMemo(()=>f.map(l=>be(l,a)),[f,a]),re=et(t,P)??null,ae=i.useMemo(()=>"starred"in t?v.filter(l=>l.type!=="isStarred"):v,[t,v]),ie=fe({chips:{category:u,attributes:w},tokens:ae,reach:p.length>0?"loaded-pages":"whole-folder",onClear:C}),G=E?"loading":R?"error":f.length===0?"empty":"ready",le=i.useCallback(()=>{const l=ge(me());window.open(l,"_blank","noopener,noreferrer")},[]),J=we(),de=r.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"divide-y divide-line",children:f.map(l=>r.jsx(Se,{thread:l,active:l.id===s,onClick:()=>d(l.id)},l.id))}),z?r.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:L,children:L?"Loading…":"Load more"}):null]})});return r.jsx(xe,{title:e,unreadCount:re,preset:H,selectedCategory:u,activeFilters:w,onSelectCategory:m,onToggleFilter:M,onClearFilters:O,searchResults:ne,searchLoading:E,onSelectSearchResult:S,searchResultsInBody:!0,children:r.jsxs(je,{selectedMessageId:s,rows:f,onOpen:d,onDeleteMessages:x,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:c,children:[r.jsx(Ie,{listTitle:e,sections:[{id:"collection",threads:f}],flatList:!0,hideHeader:!0,listState:J.searchResults?"ready":G,listFilter:ie,listScopeLabel:e,searchQuery:N||void 0,errorMessage:R?$e(W):void 0,onRetry:()=>F(),onReportError:le,selectedThreadId:s,onSelectThread:d,isDesktop:T,selectionBar:r.jsx(Me,{title:e}),listBody:J.searchResults??(G==="ready"?de:void 0)}),r.jsx(ot,{rows:f,verb:b.verb})]})})}const se=i.createContext(null);function B(){const t=i.useContext(se);if(!t)throw new Error("CollectionPane.* must be used inside <CollectionPane>");return t}function rt({collection:t,title:e,thread:s,children:o}){const n=Qe(),c=ze(),x=_e(),{searchInput:h}=K(),a=s?.threadId,I=s?.messageId,{threads:g}=te(t),T=i.useMemo(()=>{if(a)return g.find(d=>d.messageId===I)??g.find(d=>d.threadId===a)},[g,a,I]),b=Pe(a,I),u=T??b,m=I??u?.messageId,w=i.useMemo(()=>{if(a)return{threadId:a,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:m,authenticity:u?.authenticity}},[a,u,m]),A=i.useCallback((d,S)=>{n(d,{replace:S?.replace,query:h})},[n,h]),M=i.useCallback(d=>{m&&d.includes(m)&&c()},[m,c]),O=U({thread:u,isOpen:!0,onAfterOptimisticRemove:M}),C=Fe(),{deleteMessages:k}=Le({mailboxId:u?.mailboxId??"",messages:g,onAfterOptimisticRemove:M}),{toggleReadFor:v}=Ae({mailboxId:u?.mailboxId??"",messages:g}),N=C.focusedMessageId,p=i.useMemo(()=>g.find(d=>d.messageId===N),[g,N])??u,P=U({thread:p,isOpen:p?.messageId===m}),q=We(),E=He(),R=Ke(),W=i.useMemo(()=>Ve(R,a,m),[R,a,m]),F=i.useMemo(()=>{if(p)return d=>R({threadId:p.threadId,messageId:p.messageId,mode:d})},[R,p]),{nextMessageId:Q,previousMessageId:z}=Ne({context:C,orderedIds:C.orderedIds,selectedMessageId:m,enabled:!q&&!E,hasOpenThread:a!==void 0,onClose:c,handlers:{reply:()=>F?.("reply"),replyAll:()=>F?.("reply-all"),forward:()=>F?.("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||p&&v([p.messageId],!p.isRead)},goBrief:()=>x("brief"),goSettings:()=>x("settings")}}),L=i.useCallback(d=>{if(!d)return;const S=g.find(H=>H.messageId===d);return S?{threadId:S.threadId,messageId:d}:void 0},[g]),f={collection:t,title:e,selectedMessageId:m,selectedThread:u,conversation:w,onOpenThread:A,onCloseThread:c,nextThread:L(Q),previousThread:L(z),actions:O,onReply:W,triage:C,onDeleteMessages:k,handleDeselectIfRemoved:M};return r.jsx(se.Provider,{value:f,children:o})}function oe(){const{collection:t,title:e,selectedMessageId:s,onOpenThread:o,triage:n,onDeleteMessages:c}=B();return r.jsx(nt,{collection:t,title:e,selectedMessageId:s,onOpenThread:o,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:c})}function at(){const t=V(),{conversation:e,selectedThread:s,actions:o,onReply:n,handleDeselectIfRemoved:c,onOpenThread:x}=B(),h=!!e,a=Ee(e?.threadId);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(Be,{hasThread:h,intelligenceOpen:a.isShowing,canToggleIntelligence:a.canToggle,onToggleIntelligence:a.toggle,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("forward"):void 0,onDelete:h?o.deleteThread:void 0,onToggleStar:h?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:h&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Y,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:a.open,listOnScreen:!0}):r.jsx(Ue,{})})]}),r.jsx(ee,{isOpen:a.drawerOpen,onClose:a.closeDrawer,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:c,onReplyWithText:t,onOpenThread:x})]})}function it(){const t=V(),{selectedThread:e,handleDeselectIfRemoved:s,onOpenThread:o}=B(),{onToggleIntelligence:n}=K();return r.jsx(qe,{onClose:n,thread:e,accountId:e?.accountId,onAfterOptimisticRemove:s,onReplyWithText:t,onOpenThread:o})}function lt(){const t=V(),{selectedThread:e,conversation:s,onCloseThread:o,onOpenThread:n,nextThread:c,previousThread:x,handleDeselectIfRemoved:h}=B(),a=De(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Y,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:o,onOpenIntelligence:a.toggle,onSwipeNext:c?()=>n(c):void 0,onSwipePrevious:x?()=>n(x):void 0,mobileIntelligenceOpen:a.isOpen}),r.jsx(ee,{isOpen:a.isOpen,onClose:a.close,thread:e,accountId:e?.accountId,onAfterOptimisticRemove:h,onReplyWithText:t,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(oe,{})})}const vt=Object.assign(rt,{List:oe,Reading:at,Intelligence:it,Phone:lt});export{vt as C,Ct as S};
|