@remit/web-client-dist 0.0.448 → 0.0.450
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-BJBY10LH.js → BriefPane-dKCi6-E_.js} +1 -1
- package/assets/{ErrorState-DUMGPSGb.js → ErrorState-B5TOm3KZ.js} +1 -1
- package/assets/FlaggedPane-6HAeoMgd.js +1 -0
- package/assets/{FullCompose-DI9H4wuM.js → FullCompose-DsqyCnSL.js} +1 -1
- package/assets/MailListHeader-C5zKQU_o.js +7 -0
- package/assets/{MailShell-CAJen86u.js → MailShell-Nd8_djMF.js} +1 -1
- package/assets/{MailViewChrome-xbtYuhYE.js → MailViewChrome-B3QlslFv.js} +1 -1
- package/assets/{MailboxPane-D_HcCiBp.js → MailboxPane-WWLcBFbU.js} +1 -1
- package/assets/{NavMenuButton-k2uGxeRQ.js → NavMenuButton-BKtTJ3tv.js} +1 -1
- package/assets/{OnboardingWizard-hPL9MeE9.js → OnboardingWizard-DnJm_w_0.js} +1 -1
- package/assets/{OutboxPane-B20yuWky.js → OutboxPane-DTrz4GM2.js} +1 -1
- package/assets/_mailboxId-Uuw-dejK.js +1 -0
- package/assets/_messageId-CiAz-I57.js +1 -0
- package/assets/_messageId-DAm0G-cH.js +1 -0
- package/assets/_messageId-GeVh69vq.js +1 -0
- package/assets/_outboxMessageId-CzD5itu9.js +1 -0
- package/assets/_threadId-BZz3SRGw.js +1 -0
- package/assets/_threadId-CCQ1qyCY.js +1 -0
- package/assets/_threadId-ddO4i2o3.js +1 -0
- package/assets/{accounts-Cq5S3VGV.js → accounts-BEtgS8sl.js} +1 -1
- package/assets/{advanced-DmOKwh1H.js → advanced-B4f4yhHR.js} +1 -1
- package/assets/{appearance-DgEq-mZi.js → appearance-E7OkH1gn.js} +1 -1
- package/assets/{attachment-file-_o9Sebri.js → attachment-file-Ct9wXIh3.js} +1 -1
- package/assets/{avatar-CMKqsL_r.js → avatar-DemwoTLw.js} +1 -1
- package/assets/{bottom-sheet-BRAmfSVS.js → bottom-sheet-91Jhbi2L.js} +1 -1
- package/assets/{brief-DtF6XFOE.js → brief-BR7IpHd7.js} +1 -1
- package/assets/brief-CRP4R_1a.js +1 -0
- package/assets/{browser-ponyfill-DOgRuQU2.js → browser-ponyfill-DevOh_Ff.js} +1 -1
- package/assets/{bug-CUCVBw1E.js → bug-CqJ_ptlG.js} +1 -1
- package/assets/{circle-check-C1epc7Zl.js → circle-check-DNwFaT-9.js} +1 -1
- package/assets/{circle-check-big-BR3rJx34.js → circle-check-big-B091lXse.js} +1 -1
- package/assets/{circle-help-CjRKlYsV.js → circle-help-D_kDH1n0.js} +1 -1
- package/assets/{clock-c5b41U5G.js → clock-c9Hw4Pnh.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BOB1Y_kx.js +1 -0
- package/assets/compose._-_outboxMessageId_-CXKaW9ok.js +1 -0
- package/assets/compose._-_outboxMessageId_-Ca5ECD8Z.js +1 -0
- package/assets/compose._-_outboxMessageId_-DqML8pwf.js +1 -0
- package/assets/{confirm-dialog-yD_X1uOR.js → confirm-dialog-FCURkX56.js} +1 -1
- package/assets/{download-sl5EY_kv.js → download-Bp4d1z1G.js} +1 -1
- package/assets/{filters-AwuG6wDL.js → filters-DF9dyxhA.js} +1 -1
- package/assets/flagged-CMZLNVjj.js +1 -0
- package/assets/{flagged-DfTo6lCi.js → flagged-D3Sjm81v.js} +1 -1
- package/assets/{folders-BS0FEumj.js → folders-BWHJibRX.js} +1 -1
- package/assets/{help-copy-BaYFnzou.js → help-copy-CO7fR1xI.js} +1 -1
- package/assets/{index-BTwt_qFK.js → index-BABocYUA.js} +4 -4
- package/assets/index-BzTJ7SoP.js +1 -0
- package/assets/index-CBH1baUZ.js +1 -0
- package/assets/index-CNGJaz2o.js +1 -0
- package/assets/{index-C7eoBaay.js → index-CSlQeR7K.js} +3 -3
- package/assets/index-Ca9ECobC.js +1 -0
- package/assets/index-Cd4XaGYN.js +1 -0
- package/assets/index-CiAz-I57.js +1 -0
- package/assets/index-DF91xfmT.js +1 -0
- package/assets/index-GeVh69vq.js +1 -0
- package/assets/{kbd-CF7ZIMAF.js → kbd-DSNCR5_d.js} +1 -1
- package/assets/{labels-BCcTD3WQ.js → labels-CTqnlxDL.js} +1 -1
- package/assets/{mail-Bna3UXQo.js → mail-CcdXOMwF.js} +1 -1
- package/assets/{mail-0NkX4HN3.js → mail-DwPYrIRu.js} +1 -1
- package/assets/{menu-DMu0540K.js → menu-AacW4NBj.js} +1 -1
- package/assets/{onboarding-CxArk4tD.js → onboarding-DVP56vFk.js} +1 -1
- package/assets/outbox-DzFVbvF2.js +1 -0
- package/assets/{pencil-ptEZAHZu.js → pencil-DAs1SGTt.js} +1 -1
- package/assets/{rich-text-XQj9eiFD.js → rich-text-obKSk5_J.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-Dijr6dtH.js → rich-text-spellcheck-worker-provider-Dr1X3Zbw.js} +1 -1
- package/assets/{rotate-ccw-CdbKLDJe.js → rotate-ccw-CEofI5OJ.js} +1 -1
- package/assets/{row-actions-Cy1k8mIP.js → row-actions-boCs6FqX.js} +1 -1
- package/assets/{search-mirror-t0XhRGx1.js → search-mirror-DYAZcFJ6.js} +1 -1
- package/assets/{search-token-index-BpkIrpcT.js → search-token-index-BUo4HNZ4.js} +1 -1
- package/assets/{senders-CzJBuyCq.js → senders-CVTeGnv1.js} +1 -1
- package/assets/settings-B2ljoyvv.js +1 -0
- package/assets/{settings-screen-dfuvop4_.js → settings-screen-B5erjy_j.js} +1 -1
- package/assets/{shield-check-BFi0-SSj.js → shield-check-CXNCPcAW.js} +1 -1
- package/assets/{suggested-vips-sQTGhQeS.js → suggested-vips-DOiBgtFf.js} +1 -1
- package/assets/{useDebouncedValue-Dy58y2N2.js → useDebouncedValue-C20Bi7o5.js} +1 -1
- package/assets/{useFilters-Btv0LuOV.js → useFilters-D5SeRB7E.js} +1 -1
- package/assets/{useLabels-CqG8FCis.js → useLabels-D-DDvu3d.js} +1 -1
- package/assets/{useMessageBodyContent-Btm-f3R7.js → useMessageBodyContent-Cc1URKWS.js} +1 -1
- package/assets/{useRefreshControl-BtemUOMa.js → useRefreshControl-ByLiMQUK.js} +1 -1
- package/assets/{useSearchTokenContext-Cacdc4gx.js → useSearchTokenContext-2jIzOIvy.js} +1 -1
- package/assets/{useSemanticSearch-DlqgA9sn.js → useSemanticSearch-BDK19goH.js} +1 -1
- package/assets/{useSignature-Cczwk1Gm.js → useSignature-DQRD3NoL.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/FlaggedPane-Ddr165fd.js +0 -1
- package/assets/MailListHeader-a6YQT5FI.js +0 -7
- package/assets/_mailboxId-B04K8Hzs.js +0 -1
- package/assets/_messageId-C30CcYq6.js +0 -1
- package/assets/_messageId-CbPNgoqB.js +0 -1
- package/assets/_messageId-DUV02xIv.js +0 -1
- package/assets/_outboxMessageId-BDQRG3LU.js +0 -1
- package/assets/_threadId-BLUgn03r.js +0 -1
- package/assets/_threadId-CbcbZRym.js +0 -1
- package/assets/_threadId-CwelZDY5.js +0 -1
- package/assets/brief-XD-L1HYd.js +0 -1
- package/assets/compose._-_outboxMessageId_-BHCXT_yR.js +0 -1
- package/assets/compose._-_outboxMessageId_-BLzmbd2u.js +0 -1
- package/assets/compose._-_outboxMessageId_-Dblqkqf9.js +0 -1
- package/assets/compose._-_outboxMessageId_-etIB-vBW.js +0 -1
- package/assets/flagged-D-1ak84K.js +0 -1
- package/assets/index-BXW8Lulk.js +0 -1
- package/assets/index-C9xjEwgv.js +0 -1
- package/assets/index-CbPNgoqB.js +0 -1
- package/assets/index-D1nZyhCp.js +0 -1
- package/assets/index-DUV02xIv.js +0 -1
- package/assets/index-DXBcuToa.js +0 -1
- package/assets/index-Df7AKT5Y.js +0 -1
- package/assets/index-t_Nzpc4i.js +0 -1
- package/assets/outbox-C3P-9_t2.js +0 -1
- package/assets/settings-Drhq82aC.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Jr,r as O,j as F,B as nf,dL as ku,b as da,ac as ho,dM as Ap,dN as Fp,aE as zp,bE as xu,bz as Op,bA as Mp,u as jp,dO as Rp,e as Pp,ar as Lp,dP as Ip}from"./index-
|
|
1
|
+
import{c as Jr,r as O,j as F,B as nf,dL as ku,b as da,ac as ho,dM as Ap,dN as Fp,aE as zp,bE as xu,bz as Op,bA as Mp,u as jp,dO as Rp,e as Pp,ar as Lp,dP as Ip}from"./index-BABocYUA.js";import{s as ml,c as Cu,b as Bp}from"./index-CSlQeR7K.js";import{C as Kp}from"./confirm-dialog-FCURkX56.js";import{B as Wp}from"./bottom-sheet-91Jhbi2L.js";import{a as qp,b as Up,c as js,f as vu,U as Hp}from"./attachment-file-Ct9wXIh3.js";import{o as qC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-Cc1URKWS.js";import"./useSignature-DQRD3NoL.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-C20Bi7o5.js";const Jp=Jr("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const Vp=Jr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const Yp=Jr("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const Xp=Jr("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Gp=Jr("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Qp=Jr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),TC={html:"",text:"",formatting:[]},Zp={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},em=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=Fp(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${Zp[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:da("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??Ap(navigator.userAgent)})]})]})},tm=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),nm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rf=n=>{const e=n.activeElement;return e?.shadowRoot?rf(e.shadowRoot)??e:e},rm=n=>{const e=n.tagName.toUpperCase();if(e==="IFRAME"||e==="FRAME"||e==="TEXTAREA"||e==="SELECT")return!0;if(e==="INPUT"){const r=(n.getAttribute("type")??"text").toLowerCase();return!nm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},of=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=rf(e);return!t||t===n||n?.contains(t)?!1:rm(t)};function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function sf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,om=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||om)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!af,lf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&af&&lf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!lf,im=0,sm=1,am=2,fa=1,ha=2,ga=4,pa=8,lm=16,Rs=32,Ps=64,yl=128,um=1,cm=2,dm=3,fm=4,hm=5,gm=6,ko=jo||En||Ro?" ":"",In=`
|
|
2
2
|
|
|
3
3
|
`,_l=Pt?" ":ko,hn={bold:1,capitalize:1024,code:16,highlight:yl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},pm={directionless:1,unmergeable:2},Ti={center:2,end:6,justify:4,left:1,right:3,start:5},mm={[cm]:"center",[gm]:"end",[fm]:"justify",[um]:"left",[dm]:"right",[hm]:"start"},ym={normal:0,segmented:2,token:1},_m={[im]:"normal",[am]:"segmented",[sm]:"token"},Su="$config";function wu(){return we()._blockCursorElement}function bm(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let uf=class gi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new gi(this.element,e,this.after)}withAfter(e){return new gi(this.element,this.before,e)}withElement(e){return this.element===e?this:new gi(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&$(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const o=Eu(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(t===e)return r<=i?"before":"after";const s=Eu(e,t);if(s===null)return"after";const a=Array.prototype.indexOf.call(e.childNodes,s);return a>=0&&a<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Eu(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let cf=class pi extends uf{withBefore(e){return new pi(this.element,e,this.after)}withAfter(e){return new pi(this.element,this.before,e)}withElement(e){return this.element===e?this:new pi(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;bm(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===wu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Ro||En||jo);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=ae().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=ae().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==t;o=o.nextSibling)r++;return r}resolveChildIndex(e,t,r,o){if(r===this.element){const l=this.getFirstChildOffset(),u=wu(),c=this.element.childNodes,d=Math.min(o,c.length);let f=0;for(let h=l;h<d;h++)c[h]!==u&&f++;return[e,Math.min(f,e.getChildrenSize())]}const i=Tu(t,r);i.push(o);const s=Tu(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){const u=i[l],c=s[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}};function Tu(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&$(225),t.reverse()}let df;try{df="0.49.0+prod.esm"}catch{}const ff=df??'"<unknown>+source"';let eo=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const Mn=null;function hf(n,e=1e3){return n instanceof ma?n.clone():n.size<e?new Map(n):new ma().init(new Map(n),void 0,n.size)}let ma=class gf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new gf().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===Mn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,o]of this._nursery)o!==Mn?t.set(r,o):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const o=this.getNursery();return r!==Mn&&r!==void 0||(this._size++,r===Mn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Mn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const o=t(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(t)for(const r of t){const o=r[0],i=e?e.get(o):void 0;i!==Mn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===Mn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function Ni(n,e,t,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((C(s)||dn(s)&&s.__slots!==null)&&Ni(s,a,t,r,o,i),t.has(a)||i.delete(a),o.push(a)),s=s.getNextSibling()}}for(const s of dn(n)&&n.__slots!==null?n.__slots.values():[]){const a=r.get(s);a!==void 0&&Yn(a)&&a.__slotHost===e&&((C(a)||dn(a)&&a.__slots!==null)&&Ni(a,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let ya=!1,bl=0;function km(n){bl=n.timeStamp}function Ls(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Xr(n,t)!==void 0}function xm(n,e,t){const r=Pe(gt(t)),o=r&&ft(r,t._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const a=n.nodeValue;a!==null&&Ll(e,a,i,s,!1)}function Cm(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ht(e)&&t.isAttached()}function vm(n,e,t){for(let r=n;r&&!Bh(r);r=or(r)){const o=Xr(r,e);if(o!==void 0){const i=te(o,t);if(i)return ne(i)||!q(r)?void 0:[r,i]}}}function pf(n,e,t){ya=!0;const r=performance.now()-bl>100;try{wt(n,()=>{const o=z()||(function(d){return d.read("latest",()=>{const f=z();return f!==null?f.clone():null})})(n),i=new Map,s=n._editorState,a=n._blockCursorElement;let l=!1,u="";for(let d=0;d<e.length;d++){const f=e[d],h=f.type,g=f.target,m=vm(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ht(g)&&Cm(o,g,y)&&xm(g,y,n);else if(h==="childList"){l=!0;const _=f.addedNodes;for(let S=0;S<_.length;S++){const x=_[S],w=Eh(x),v=x.parentNode;if(!(v==null||x===a||w!==null||Ls(x,v,n)||n._slotsUsed&&q(x)&&x.hasAttribute("data-lexical-slot")||Bh(x))){if(Pt){const E=(q(x)?x.innerText:null)||x.nodeValue;E&&(u+=E)}v.removeChild(x)}}const b=f.removedNodes,k=b.length;if(k>0){let S=0;for(let x=0;x<k;x++){const w=b[x];(Ls(w,g,n)||a===w)&&(g.appendChild(w),S++)}k!==S&&i.set(p,y)}}}if(i.size>0)for(const[d,f]of i)f.reconcileObservedMutation(d,n);const c=t.takeRecords();if(c.length>0){for(let d=0;d<c.length;d++){const f=c[d],h=f.addedNodes,g=f.target;for(let m=0;m<h.length;m++){const p=h[m],y=p.parentNode;y==null||p.nodeName!=="BR"||Ls(p,g,n)||y.removeChild(p)}}t.takeRecords()}o!==null&&(l&&_e(o),Pt&&Fh(n)&&o.insertRawText(u))})}finally{ya=!1}}function mf(n){const e=n._observer;e!==null&&pf(n,e.takeRecords(),e)}function yf(n){(function(e){bl===0&>(e).addEventListener("textInput",km,!0)})(n),n._observer=new MutationObserver((e,t)=>{pf(n,e,t)})}const Nu="latest";let Sm=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Tm).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Po(n,e){return new Sm(n,e)}function Lo(n,e,t=Nu){const r=(t===Nu?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Cr(n,e,t){let r;if(Ie(),typeof t=="function"){const i=n.getLatest(),s=Lo(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return bf(o).updateFromKnown(e,r),o}function wm(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Ul(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&t.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:t,sharedConfigMap:e}}const Du=new Set(["__proto__","constructor","prototype"]);let Em=class _f{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,u,c){let d=c.size;if(u)for(const f in u){const h=l.get(f);h&&c.has(h)||d++}return d})(s,r,o);this.size=a}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return $u(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new _f(e,t,(function(i,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(Du.has(u))continue;const d=i.get(u);d?s.has(d)||s.set(d,d.parse(c)):(l=l||{},l[u]=c)}return l})(t.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=$u(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(Du.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function bf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Em(e,kf(e));return e.__state=t,t}function kf(n){return n.__state?n.__state.sharedNodeState:vh(we(),n.getType()).sharedNodeState}function $u(n){if(n)for(const e in n)return n}function Tm(n){return n}function Au(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function Fu(n,e,t){const{unknownState:r}=e,o=t?t.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function zu(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ou(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,a=e.__style,l=n.__state,u=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===a)&&(n.__state===null||l===u||(function(c,d){if(c===d)return!0;const f=new Set;return!(c&&Au(f,c,d)||d&&Au(f,d,c)||c&&Fu(f,c,d)||d&&Fu(f,d,c))})(l,u))}function Mu(n,e){const t=n.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ju(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ou(e,r)){r=Mu(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ou(r,t)){r=Mu(r,t);break}break}t.remove()}}else r.remove()}function Kt(n){return Ru(n.anchor),Ru(n.focus),n}function Ru(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),D(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const xo=Symbol.for("@lexical/CachedTextSize");function Pu(n,e){return ba.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=zt.get(r);if(i===void 0&&$(345,r),C(i)){const s=De.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const a=qn.get(r),l=a&&a.__lexicalTextContent;typeof l!="string"&&$(346,i.getType()),t+=l.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[xo];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:de})}function xf(n){C(n)||n[xo]===void 0&&(n[xo]=D(n)?n.__text.length:n.getTextContentSize())}const Nm=4;let Co,de,vo,oe="",ze=null,Ye=null,qe=null;function Wt(){return{firstTextKey:qe,format:ze,style:Ye}}function Ct(n){n.firstTextKey!==null&&(ze=n.format,Ye=n.style,qe=n.firstTextKey)}function _a(n){if(qe!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=De.get(e);D(t)&&(ze=t.getFormat(),Ye=t.getStyle(),qe=e)}let ls,go,po,zt,ba,De,qn,ka,So,Un,ln=!1,Di=!1;function xn(n,e){const t=zt.get(n),r=De.has(n);if(e!==null){const o=wa(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(de._keyToDOMMap.delete(n),C(t)){const o=Vi(t,zt);xa(o,0,o.length-1,null)}if(t!==void 0){for(const o of pt(t).values()){const i=va(o);xn(o,null),i!==null&&i.remove()}Il(So,vo,ls,t,"destroyed")}}}function xa(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&xn(i,r)}}function jn(n,e){n.setProperty("text-align",e)}const Dm="40px";function Cf(n,e){const t=Co.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${Dm}))`)}function vf(n,e){const t=n.style;e===0?jn(t,""):e===1?jn(t,"left"):e===2?jn(t,"center"):e===3?jn(t,"right"):e===4?jn(t,"justify"):e===5?jn(t,"start"):e===6&&jn(t,"end")}function Ca(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(Oe(r))return null;const i=r.getParent();return i===null||Se(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function Sf(n){const e=ae().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function wf(n,e,t){e||n.contentEditable==="false"?Py(t,de):t.removeAttribute("contenteditable")}function Lu(n,e,t){const r=oe,o=Wt();oe="";let i="";const s=ne(n);for(const[a,l]of t){const u=Sf(a);wf(e,s,u),e.appendChild(u),oe="";const c=Wt();Cn(l,Dt(n,u,de)),Ct(c),Ef(n,a,e,u),i+=oe}return Ct(o),oe=r,i}function pt(n){return dn(n)&&n.__slots!==null?n.__slots:qh}function Ef(n,e,t,r){const o=Un.$getSlotTargetElement(n,e,t,de);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function va(n){const e=qn.get(n);return e!==void 0?e.parentElement:null}function Iu(n,e,t){const r=pt(n),o=pt(e);for(const[c,d]of r)if(!o.has(c)){const f=va(d);xn(d,null),f!==null&&f.remove()}const i=oe,s=Wt();let a="",l=null;const u=ne(e);for(const[c,d]of o){const f=r.get(c);let h=f!==void 0?va(f):null;oe="";const g=Wt();if(h===null){h=Sf(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),Cn(d,Dt(e,h,de))}else f===d?an(d,h):(f!==void 0&&xn(f,h),Cn(d,Dt(e,h,de)));if(Ct(g),wf(t,u,h),Ef(e,c,t,h),a+=oe,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return Ct(s),oe=i,a}function Cn(n,e){const t=De.get(n);if(t===void 0&&$(60),e!==null){const o=zt.get(n);if(o!==void 0){const i=qn.get(n);if(i!==void 0){const s=Yn(o)?o.__slotHost:null,a=Yn(t)?t.__slotHost:null,l=o.__parent!==t.__parent||s!==a,u=a!==null&&i.parentElement!==e.element;if(l||u)return e.insertChild(i),an(n,e.element)}}}const r=Un.$createDOM(t,de);if((function(o,i,s){const a=s._keyToDOMMap;Th(i,s,o),a.set(o,i)})(n,r,de),D(t)?r.setAttribute("data-lexical-text","true"):ne(t)&&(r.setAttribute("data-lexical-decorator","true"),Hi(r,{captureSelection:!0})),C(t)){const o=t.__indent,i=t.__size;Ca(r,t),o!==0&&Cf(r,o);const s=pt(t),a=s.size>0?Lu(t,r,s):"";if(i===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,oe+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=oe,c=i-1;if(Sa(Vi(t,De),t,0,c,Dt(t,r,de)),a!==""){const d=r.__lexicalTextContent||"";r.__lexicalTextContent=a+d,oe=u+a+d}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&vf(r,l),t.isInline()||Tf(null,t,r)}else{const o=t.getTextContent();if(ne(t)){const i=t.decorate(de,Co);i!==null&&Nf(n,i),r.contentEditable="false";const s=pt(t);s.size>0&&Lu(t,r,s)}oe+=o}return e!==null&&e.insertChild(r),Un.$decorateDOM(t,null,r,de),xf(t),Il(So,vo,ls,t,"created"),r}function Sa(n,e,t,r,o){const i=oe,s=Wt();oe="",ze=null,Ye=null,qe=null;let a=t;for(;a<=r;++a){const u=Wt();Cn(n[a],o);const c=De.get(n[a]);c!==null&&D(c)?ze===null&&(ze=c.getFormat(),Ye=c.getStyle(),qe=c.__key):C(c)&&a<r&&!c.isInline()&&(oe+=In),Ct(u)}const l=de._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=oe,l.__lexicalFirstTextKey=qe,oe=i+oe,Ct(s)}function Tf(n,e,t){const r=Dt(e,t,de),o=r.element.__lexicalLastChildKind??null,i=(function(s,a){if(s){const l=s.__last;if(l){const u=a.get(l);if(u)return We(u)?"line-break":ne(u)&&u.isInline()?"decorator":null}return pt(s).size>0?null:"empty"}return null})(e,De);o!==i&&r.setManagedLineBreak(i)}function $m(n,e,t){var r;ze=null,Ye=null,qe=null,(function(o,i,s){const a=oe,l=o.__size,u=i.__size;oe="";const c=s.element,d=de._keyToDOMMap.get(i.__key);d===void 0&&$(351,i.__key);const f=u-l;if(!ln&&Math.abs(f)<=1&&l>=Nm&&o.__first===i.__first&&(f!==0||!de._cloneNotNeeded.has(o.__key))){const h=d.__lexicalTextContent,g=ka.get(o.__key);if(!ln&&typeof h=="string"&&g!==void 0){const m=(function(p,y){const _=y.size;if(_===0||_>=p.__size)return null;let b=p.__last,k=null,S=0;for(;b!==null&&S<_;){if(!y.has(b))return null;k=b;const x=De.get(b);if(x===void 0)return null;b=x.__prev,S++}return S!==_||b!==null&&y.has(b)?null:k})(i,g);if(m!==null){const p=g.size;if(f===0){const y=Pu(m,p);let _=m,b=0;for(;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;const E=Wt();an(_,c),D(v)&&ze===null&&(ze=v.getFormat(),Ye=v.getStyle(),qe=v.__key),Ct(E),_=v.__next,b++}let k="";for(_=m,b=0;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;let E;if(C(v)){const A=de._keyToDOMMap.get(_),T=A&&A.__lexicalTextContent;typeof T!="string"&&$(352,v.getType()),E=T}else E=v.getTextContent();k+=E,b<p-1&&C(v)&&!v.isInline()&&(k+=In),_=v.__next,b++}const S=d.__lexicalSlotTextLength||0,x=S>0?h.slice(S):h,w=x.slice(0,x.length-y)+k;return d.__lexicalTextContent=w,oe=a+w,void Bu(i,d,g)}if((function(y,_,b,k,S,x,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const A=w-v;let T=y.__last;for(let re=0;re<A-1;re++){if(T===null)return!1;const $e=zt.get(T);if($e===void 0)return!1;T=$e.__prev}if(T===null)return!1;const M=De.get(x),j=zt.get(T);if(M===void 0||j===void 0||M.__prev!==j.__prev)return!1;const R=[];let B=x;for(let re=0;re<w;re++){if(B===null)return!1;R.push(B);const $e=De.get(B);B=$e?$e.__next:null}const Q=[];B=T;for(let re=0;re<A;re++){if(B===null)return!1;Q.push(B);const $e=zt.get(B);B=$e?$e.__next:null}const ie=new Set(Q),Z=new Set(R),L=[];let P=0,K=0;for(;P<A&&K<w;)if(R[K]===Q[P])L.push({key:R[K],kind:"reconcile"}),P++,K++;else if(Z.has(Q[P])){if(ie.has(R[K]))return!1;L.push({key:R[K],kind:"create",nextIndex:K}),K++}else L.push({key:Q[P],kind:"destroy"}),P++;for(;P<A;)L.push({key:Q[P++],kind:"destroy"});for(;K<w;)L.push({key:R[K],kind:"create",nextIndex:K}),K++;const se=Pu(T,A);for(const re of L){const $e=Wt();if(re.kind==="reconcile")an(re.key,b.element);else if(re.kind==="destroy")xn(re.key,b.element);else{let it=null;for(let nn=re.nextIndex+1;nn<w;nn++){const _n=de._keyToDOMMap.get(R[nn]);if(_n!==void 0){it=_n;break}}Cn(re.key,b.withBefore(it??b.before))}if(re.kind!=="destroy"){const it=De.get(re.key);it&&D(it)&&ze===null&&(ze=it.getFormat(),Ye=it.getStyle(),qe=it.__key)}Ct($e)}let ee="";for(let re=0;re<w;re++){const $e=De.get(R[re]);if($e===void 0)return!1;let it;if(C($e)){const nn=de._keyToDOMMap.get(R[re]),_n=nn&&nn.__lexicalTextContent;typeof _n!="string"&&$(350,$e.getType()),it=_n}else it=$e.getTextContent();ee+=it,re<w-1&&C($e)&&!$e.isInline()&&(ee+=In)}const xe=k.__lexicalSlotTextLength||0,ot=xe>0?S.slice(xe):S;return k.__lexicalTextContent=ot.slice(0,ot.length-se)+ee,!0})(o,0,s,d,h,m,p,f)){const y=d.__lexicalTextContent;return typeof y!="string"&&$(353),oe=a+y,void Bu(i,d,g)}}}if(f===0){let m=o.__first,p=0;for(;m!==null;){const y=De.get(m);if(y===void 0)break;const _=ln||po.has(m)||go.has(m),b=Wt();if(_)an(m,c);else{let k,S;if(C(y)){S=qn.get(m);const x=S&&S.__lexicalTextContent;typeof x!="string"&&$(354,y.getType()),k=x}else k=y.getTextContent();oe+=k,S!==void 0&&_a(S)}D(y)?ze===null&&(ze=y.getFormat(),Ye=y.getStyle(),qe=y.__key):C(y)&&p<u-1&&!y.isInline()&&(oe+=In),Ct(b),m=y.__next,p++}return d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,void(oe=a+oe)}}if(l===1&&u===1){const h=o.__first,g=i.__first;if(h===g)an(h,c);else{const p=wa(h),y=Cn(g,null);try{p.parentNode===c?c.replaceChild(y,p):s.insertChild(y)}catch(_){if(typeof _=="object"&&_!=null){const b=`${_.toString()} Parent: ${c.tagName}, new child: {tag: ${y.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(b)}throw _}xn(h,null)}const m=De.get(g);D(m)&&ze===null&&(ze=m.getFormat(),Ye=m.getStyle(),qe=m.__key)}else{const h=Vi(o,zt),g=Vi(i,De);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&Sa(g,i,0,u-1,s);else if(u===0){if(l!==0){const m=s.after==null&&s.before==null&&pt(i).size===0&&s.element.__lexicalLineBreak==null;xa(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const S=_-1,x=b-1;let w,v,E=k.getFirstChild(),A=0,T=0;for(;A<=S&&T<=x;){const R=p[A],B=y[T],Q=Wt();if(R===B)E=Is(an(B,k.element)),A++,T++;else{if(v===void 0&&(v=Ku(y,T)),w===void 0)w=Ku(p,A);else if(!w.has(R)){A++,Ct(Q);continue}if(!v.has(R)){E=Is(wa(R)),xn(R,k.element),A++,w.delete(R),Ct(Q);continue}if(w.has(B)){const Z=Pr(de,B);Z!==E&&k.withBefore(E??k.before).insertChild(Z),E=Is(an(B,k.element)),A++,T++}else Cn(B,k.withBefore(E??k.before)),T++}const ie=De.get(B);ie!==null&&D(ie)?ze===null&&(ze=ie.getFormat(),Ye=ie.getStyle(),qe=ie.__key):C(ie)&&T<=x&&!ie.isInline()&&(oe+=In),Ct(Q)}const M=A>S,j=T>x;if(M&&!j){const R=y[x+1],B=R===void 0?null:de.getElementByKey(R);Sa(y,m,T,x,k.withBefore(B??k.before))}else j&&!M&&xa(p,A,S,k.element)})(i,h,g,l,u,s)}d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,oe=a+oe})(n,e,Dt(e,t,de)),Se(e)||(r=e,ze==null||ze===r.__textFormat||Di||r.setTextFormat(ze),(function(o){Ye==null||Ye===o.__textStyle||Di||o.setTextStyle(Ye)})(e))}function Bu(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=De.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!t.has(i)){const s=De.get(r);if(D(s))return ze=s.getFormat(),void(Ye=s.getStyle())}}e.__lexicalFirstTextKey=qe}function an(n,e){const t=zt.get(n);let r=De.get(n);t!==void 0&&r!==void 0||$(61);const o=ln||po.has(n)||go.has(n),i=Pr(de,n);if(t===r&&!o){let s;if(C(t)){const a=i.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,_a(i)}else s=t.getTextContent();return oe+=s,i}if(t!==r&&o&&Il(So,vo,ls,r,"updated"),Un.$updateDOM(r,t,i,de)){const s=Cn(n,null);return e===null&&$(62),e.replaceChild(s,i),xn(n,null),s}if(C(t)){C(r)||$(334,n);const s=r.__indent;(ln||s!==t.__indent)&&Cf(i,s);const a=r.__format;(ln||a!==t.__format)&&vf(i,a);const l=o&&(pt(r).size>0||pt(t).size>0)?Iu(t,r,i):"";if(o){const u=oe;if($m(t,r,i),Oe(r)||r.isInline()||Tf(0,r,i),l!==""){const c=i.__lexicalTextContent||"";i.__lexicalTextContent=l+c,oe=u+l+c,i.__lexicalSlotTextLength=l.length}else(pt(r).size>0||pt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const u=i.__lexicalTextContent;typeof u!="string"&&$(356,t.getType()),oe+=u,_a(i)}if((ln||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Ca(i,r),Oe(r)&&!ln))for(const u of r.getChildren())C(u)&&Ca(Pr(de,u.getKey()),u)}else{const s=r.getTextContent();if(ne(r)){const a=r.decorate(de,Co);a!==null&&Nf(n,a),o&&(pt(r).size>0||pt(t).size>0)&&Iu(t,r,i)}oe+=s}if(!Di&&Oe(r)){const s=r.getLatest();if(s.__cachedText!==oe){const a=s.getWritable();a.__cachedText=oe,r=a}}return Un.$decorateDOM(r,t,i,de),xf(r),i}function Nf(n,e){let t=de._pendingDecorators;const r=de._decorators;if(t===null){if(r[n]===e)return;t=Nh(de)}t[n]=e}function Is(n){let e=n.nextSibling;return e!==null&&e===de._blockCursorElement&&(e=e.nextSibling),e}function Ku(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Am(n,e,t,r,o,i){oe="",ze=null,Ye=null,qe=null,ln=r===2,de=t,Co=t._config,Un=t._config.dom||Bi,vo=t._nodes,ls=de._listeners.mutation,go=o,po=i,zt=n._nodeMap,ba=n,De=e._nodeMap,Di=e._readOnly,qn=hf(t._keyToDOMMap),ka=(function(){const a=new Map,l=u=>{for(const c of u){const d=De.get(c);if(d===void 0)continue;const f=d.__parent;if(f===null)continue;let h=a.get(f);h===void 0&&(h=new Set,a.set(f,h)),h.add(c)}};return l(go.keys()),l(po),a})();const s=new Map;return So=s,an("root",null),de=void 0,vo=void 0,go=void 0,po=void 0,zt=void 0,ba=void 0,De=void 0,Co=void 0,qn=void 0,ka=void 0,So=void 0,Un=Bi,s}function wa(n){const e=qn.get(n);return e===void 0&&$(75,n),e}function W(n){return{type:n}}const qt=W("SELECTION_CHANGE_COMMAND"),Df=W("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),us=W("CLICK_COMMAND"),$f=W("BEFORE_INPUT_COMMAND"),Af=W("INPUT_COMMAND"),Ff=W("COMPOSITION_START_COMMAND"),zf=W("COMPOSITION_END_COMMAND"),vn=W("DELETE_CHARACTER_COMMAND"),vr=W("INSERT_LINE_BREAK_COMMAND"),Hn=W("INSERT_PARAGRAPH_COMMAND"),Kn=W("CONTROLLED_TEXT_INSERTION_COMMAND"),Vr=W("PASTE_COMMAND"),mi=W("REMOVE_TEXT_COMMAND"),zr=W("DELETE_WORD_COMMAND"),Or=W("DELETE_LINE_COMMAND"),Ot=W("FORMAT_TEXT_COMMAND"),Fm=W("SET_TEXT_FORMAT_COMMAND"),cs=W("UNDO_COMMAND"),ds=W("REDO_COMMAND"),fs=W("KEYDOWN_COMMAND"),kl=W("KEY_ARROW_RIGHT_COMMAND"),Of=W("MOVE_TO_END"),xl=W("KEY_ARROW_LEFT_COMMAND"),Mf=W("MOVE_TO_START"),Cl=W("KEY_ARROW_UP_COMMAND"),vl=W("KEY_ARROW_DOWN_COMMAND"),$i=W("KEY_ENTER_COMMAND"),jf=W("KEY_SPACE_COMMAND"),hs=W("KEY_BACKSPACE_COMMAND"),Sl=W("KEY_ESCAPE_COMMAND"),wl=W("KEY_DELETE_COMMAND"),El=W("KEY_TAB_COMMAND"),zm=W("INSERT_TAB_COMMAND"),Om=W("INDENT_CONTENT_COMMAND"),Wu=W("OUTDENT_CONTENT_COMMAND"),Rf=W("DROP_COMMAND"),Pf=W("FORMAT_ELEMENT_COMMAND"),Lf=W("DRAGSTART_COMMAND"),If=W("DRAGOVER_COMMAND"),Mm=W("DRAGEND_COMMAND"),Io=W("COPY_COMMAND"),gs=W("CUT_COMMAND"),Tl=W("SELECT_ALL_COMMAND"),jm=W("CLEAR_EDITOR_COMMAND"),Rm=W("CLEAR_HISTORY_COMMAND"),ao=W("CAN_REDO_COMMAND"),lo=W("CAN_UNDO_COMMAND"),Bf=W("FOCUS_COMMAND"),Pm=W("BLUR_COMMAND"),Lm=W("KEY_MODIFIER_COMMAND");function Im(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let o=e.get(t);o===void 0&&(o={dispose:n(t,r),holders:new Set},e.set(t,o));const i=()=>{const s=e.get(t);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(t),s.dispose())};return o.holders.add(i),i}}}function mo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const rn=Object.freeze({}),Ea=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&wo(t),!e.isComposing()&&I(e,fs,n)}],["pointerdown",function(n,e){const t=Vn(n),r=n.pointerType;Lt(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&wt(e,()=>{Ji(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){I(e,Ff,n)}],["compositionend",function(n,e){const t=e._inputState;Pt?t.compositionPhase="ending-firefox":En||!jo&&!Ro?I(e,zf,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;wo(t),wt(e,()=>{Uf(n,e)||e.dispatchCommand(Af,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){wt(e,()=>{const t=z(),r=Pe(gt(e)),o=yt();if(r){if(N(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!Oe(s)&&ge().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=ft(r,e._rootElement).anchorNode;(q(i)||ht(i))&&_e(To(o,r,e,n))}}if(Pt&&r!==null&&r.rangeCount===0){const i=e._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let a=i.childNodes.length;for(let u=0;u<i.childNodes.length;u++){const c=i.childNodes[u];if(q(c)){const d=c.getBoundingClientRect();if(s<=(d.top+d.bottom)/2){a=u;break}}}r.setBaseAndExtent(i,a,i,a);const l=To(o,r,e,n);l!==null?_e(l):r.removeAllRanges()}}I(e,us,n)})}],["cut",rn],["copy",rn],["dragstart",rn],["dragover",rn],["dragend",rn],["paste",rn],["focus",rn],["blur",rn],["drop",rn]];Fr&&Ea.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Pt&&Fh(r)||o!=="insertCompositionText"&&wt(r,()=>{Uf(t,r)||I(r,$f,t)},{event:t})})(n,e)]);const Ta=new WeakMap,Ai=new WeakMap,Bm=Im(n=>(n.addEventListener("selectionchange",Vu),()=>n.removeEventListener("selectionchange",Vu)));function Kf(n,e,t,r,o,i){const s=n.anchor,a=n.focus,l=s.getNode(),u=he();let c;if(i!==void 0)c=i;else{const m=Pe(gt(u));c=m!==null?ft(m,u._rootElement):null}const d=c!==null?c.anchorNode:null,f=s.key,h=u.getElementByKey(f),g=t.length;return f!==a.key||!D(l)||(!o&&(!Fr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||Dh(t))&&s.offset!==a.offset&&!l.isComposing()||Et(l)||l.isDirty()&&g>1||(o||!Fr)&&h!==null&&!l.isComposing()&&d!==wn(l,h,u)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==n.format||l.getStyle()!==n.style)||(function(m,p){if(p.isSegmented())return!0;if(!m.isCollapsed())return!1;const y=m.anchor.offset,_=p.getParentOrThrow(),b=Ki(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const S=k.getPreviousSibling();return(D(S)||C(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function qu(n,e){return ht(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Uu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=ft(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,qu(r,o)&&qu(i,s)&&!a.postDeleteSelectionToRestore)||wt(e,()=>{if(!t)return void _e(null);if(!Wo(e,r,i))return;let l=z();if(a.postDeleteSelectionToRestore&&N(l)&&l.isCollapsed()){const u=l.anchor,c=a.postDeleteSelectionToRestore.anchor;(u.key===c.key&&u.offset===c.offset+1||u.offset===1&&c.getNode().is(u.getNode().getPreviousSibling()))&&(l=a.postDeleteSelectionToRestore.clone(),_e(l))}if(a.postDeleteSelectionToRestore=null,N(l)){const u=l.anchor,c=u.getNode();if(l.isCollapsed()){n.type==="Range"&&r===i&&(l.dirty=!0);const d=gt(e).event,f=d?d.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:y}=a.collapsedSelectionFormat,_=ge(),b=e.isComposing()===!1&&_.getTextContent()==="";if(f<y+200&&u.offset===m&&u.key===p)yi(l,h,g);else if(u.type==="text")D(c)||$(141),Wf(l,c);else if(u.type==="element"&&!b){C(c)||$(259);const k=u.getNode();k.isEmpty()?(function(S,x){const w=x.getTextFormat(),v=x.getTextStyle();yi(S,w,v)})(l,k):yi(l,l.format,"")}}else{const d=u.key,f=l.focus.key,h=l.getNodes(),g=h.length,m=l.isBackward(),p=m?s:o,y=m?o:s,_=m?f:d,b=m?d:f;let k=2047,S=!1;for(let x=0;x<g;x++){const w=h[x],v=w.getTextContentSize();if(D(w)&&v!==0&&!(x===0&&w.__key===_&&p===v||x===g-1&&w.__key===b&&y===0)&&(S=!0,k&=w.getFormat(),k===0))break}l.format=S?k:0}}I(e,qt)})}function yi(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Wf(n,e){yi(n,e.getFormat(),e.getStyle())}function qf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n){const{lastKeyCode:e}=he()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
|
|
4
4
|
`:e==="Tab"?" ":null;if(!t)return;const r=z();if(!N(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!D(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dQ as r,dR as o,dS as a}from"./index-
|
|
1
|
+
import{dQ as r,dR as o,dS as a}from"./index-BABocYUA.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./index-
|
|
1
|
+
import{c as t}from"./index-BABocYUA.js";const e=t("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{e as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as l,B as b,b as y,ar as x}from"./index-
|
|
1
|
+
import{r as e,j as l,B as b,b as y,ar as x}from"./index-BABocYUA.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as v,v as x,o as p,a8 as I,r as g,q as Q}from"./index-
|
|
1
|
+
import{a0 as v,v as x,o as p,a8 as I,r as g,q as Q}from"./index-BABocYUA.js";import{b}from"./MailShell-Nd8_djMF.js";import{a as q}from"./useMessageBodyContent-Cc1URKWS.js";function W(o){const t=v(),{searchInput:c,searchQuery:e}=x(),i=p({select:a=>Q(a.location.search)}),u=p({select:a=>a.location.pathname}),h=q(),f=I(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;g.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as H,r as c,j as g,g as X,b as C,c7 as J,X as Y,c8 as Z,c9 as D,ca as ee,cb as te,cc as _,x as ne,cd as se,ce as re,cf as oe,cg as ie,ch as ae,ci as ce,cj as Q,ck as ue,cl as le,l as v,a0 as K,cm as fe,c0 as E,cn as de,y as he,z as q,G as pe,H as me,v as ge,bz as $,bA as ye,co as A}from"./index-BTwt_qFK.js";import{a as be,S as xe}from"./search-scope-DTcpOp3S.js";const He=H("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const _e=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),we=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return we.filter(t=>e[t.action]!==void 0)}const ke=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ve(e){for(const t of ke){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ve(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ze(e){const t=Ce(e);return t===""?"":`(${t})`}const I={action:null,nextPrefix:null,preventDefault:!1},Se={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Ie={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function Ee(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...I,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...I,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...I,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=Se[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const r=n==="j"||n==="arrowdown";if(r||(n==="k"||n==="arrowup"))return{action:r?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=Ie[n];if(o){const r=o.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!r&&e.shiftKey&&!i?I:{action:o.action,nextPrefix:null,preventDefault:!0}}return I}function Re(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Te="data-message-row",Oe='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Me(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Oe);return t?!t.hasAttribute(Te):!1}function Pe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Ne({key:e,repeat:t=!1,index:n,chipCount:s}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function Le(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const De=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Ae=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:l=!0,showClearButton:f=!0,size:p="sm",inputId:u,suggest:h,className:x})=>{const R=c.useId(),S=u??R,m=c.useRef(null),y=c.useRef([]),b=r??o,[T,O]=c.useState(null),P=c.useRef(void 0),[U,z]=c.useState(""),N=e.length>0;c.useEffect(()=>{O(a=>a!==null&&a>=e.length?null:a)},[e.length]),c.useEffect(()=>{const a=P.current;if(a!==void 0){if(P.current=void 0,a===null){m.current?.focus();return}y.current[a]?.focus()}});const F=c.useRef(void 0);c.useEffect(()=>{const a=h?.caret;if(!a||a===F.current)return;F.current=a;const d=m.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const M=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=c.useCallback(a=>{O(a),P.current=a},[]),L=c.useCallback(a=>{const d=e[a];d&&t&&(w(Le(a,e.length)),z(`${d.label} removed`),t(d.id))},[e,t,w]),G=c.useCallback(()=>{w(null),o()},[o,w]),V=c.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Pe({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),W=c.useCallback(a=>d=>{const k=Ne({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":L(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,L,w]);return c.useEffect(()=>{if(!l)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||De(d.target)||(d.preventDefault(),m.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l]),g.jsxs("label",{htmlFor:S,className:C("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",p==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[g.jsx(X,{className:C("shrink-0 text-fg-muted pointer-events-none",p==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[N&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(J,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:T===d,onFocusLabel:()=>O(d),onKeyDown:W(d),onRemove:()=>L(d)},a.id))}),g.jsx("input",{ref:m,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:T===null?0:-1,onChange:a=>{s(a.target.value),M(a.target)},onKeyDown:V,onKeyUp:a=>M(a.currentTarget),onClick:a=>M(a.currentTarget),onFocus:a=>{O(null),h?.onFocusChange?.(!0),M(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:N?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||N)&&f&&g.jsx("button",{type:"button",onClick:G,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(Y,{className:C("text-fg-muted",p==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:U})]})},Ge=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:l=!0,showClearButton:f=!0,size:p,inputId:u,suggest:h,className:x})=>g.jsx(Ae,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:l,showClearButton:f,size:p,inputId:u,suggest:h,className:x});function Ve({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=c.useRef(e);o.current=e;const r=c.useRef(null),i=c.useRef(null);c.useEffect(()=>{if(!t)return;const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=u=>{const h=Ee({key:u.key,shiftKey:u.shiftKey,metaKey:u.metaKey,ctrlKey:u.ctrlKey,altKey:u.altKey,inEditable:Re(u.target),onControl:Me(u.target)},r.current);if(l(),r.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),h.action===null)return;const x=o.current[h.action];x&&(h.preventDefault&&u.preventDefault(),x())},p=n===void 0?window:n;if(p!==null)return p.addEventListener("keydown",f),()=>{p.removeEventListener("keydown",f),l(),r.current=null}},[t,s,n])}function B(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var qe=class extends Z{#r;#e;#o;#s;#t;#n;#i;#a;#c;#u=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,D.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const o=s.map(u=>u.observer),r=o.map(u=>u.getCurrentResult()),i=n.length!==o.length,l=o.some((u,h)=>u!==n[h]),f=i||l,p=f?!0:r.some((u,h)=>{const x=this.#e[h];return!x||!ee(u,x)});!f&&!p||(f&&(this.#u=s,this.#t=o),this.#e=r,this.hasListeners()&&(f&&(B(n,o).forEach(u=>{u.destroy()}),B(o,n).forEach(u=>{u.subscribe(h=>{this.#h(u,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),o=n.map(r=>r.defaultedQueryOptions.queryHash);return[s,r=>this.#f(r??s,t,o),()=>this.#l(s,n)]}#l(e,t){return t.map((n,s)=>{const o=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,r=>{t.forEach(i=>{i.observer.trackProp(r)})})})}#f(e,t,n){if(t){const s=this.#c,o=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((r,i)=>r!==s[i]));return(!this.#n||this.#e!==this.#a||o||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=te(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const o=s.options.queryHash;if(!o)return;const r=t.get(o);r?r.push(s):t.set(o,[s])});const n=[];return e.forEach(s=>{const o=this.#r.defaultQueryOptions(s),i=t.get(o.queryHash)?.shift()??new _(this.#r,o);n.push({defaultedQueryOptions:o,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#l(this.#e,this.#u),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&D.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function j({queries:e,...t},n){const s=ne(),o=se(),r=re(),i=c.useMemo(()=>e.map(m=>{const y=s.defaultQueryOptions(m);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,s,o]);i.forEach(m=>{oe(m);const y=s.getQueryCache().get(m.queryHash);ie(m,r,y)}),ae(r);const[l]=c.useState(()=>new qe(s,i,t)),[f,p,u]=l.getOptimisticResult(i,t.combine),h=!o&&t.subscribed!==!1;c.useSyncExternalStore(c.useCallback(m=>h?l.subscribe(D.batchCalls(m)):ce,[l,h]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),c.useEffect(()=>{l.setQueries(i,t)},[i,t,l]);const R=f.some((m,y)=>Q(i[y],m))?f.flatMap((m,y)=>{const b=i[y];if(b&&Q(b,m)){const T=new _(s,b);return ue(b,T,r)}return[]}):[];if(R.length>0)throw Promise.all(R);const S=f.find((m,y)=>{const b=i[y];return b&&le({result:m,errorResetBoundary:r,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return p(u())}function We(){const e=v({from:"/mail/brief/$threadId",shouldThrow:!1}),t=v({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=v({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=v({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=v({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=v({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,l=t?.messageId??s?.messageId??r?.messageId;return c.useMemo(()=>i?{threadId:i,messageId:l}:void 0,[i,l])}function Xe(){const e=K(),t=fe(),{list:n,mailboxId:s}=E();return c.useCallback((o,r)=>{const i=r?.query,f={search:u=>i===void 0?u:{...u,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...f});return}const p=r?.mailboxId??s;if(n==="mailbox"&&p){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:p,...o},...f});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...f})},[e,t,n,s])}function Je(){return de()}function je(){const e=K();return c.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Ye(){const e=K();return c.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const Ze=({trigger:e,children:t,align:n="right"})=>{const[s,o]=c.useState(!1),r=c.useRef(null),i=c.useCallback(f=>{r.current&&!r.current.contains(f.target)&&o(!1)},[]),l=c.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return c.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",l)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",l)}),[s,i,l]),g.jsxs("div",{ref:r,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!s)},className:C("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&g.jsx("div",{className:C("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},et=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:C("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),tt=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),Fe=({accounts:e})=>{const{list:t,mailboxId:n}=E(),{t:s}=he("mail",{useSuspense:!1}),o=c.useCallback((i,l)=>s(i,{defaultValue:l}),[s]),r=j({queries:e.map(i=>({...q({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const l=r[i]?.data?.items;if(!l)continue;const f=l.find(u=>u.mailboxId===n);if(!f)continue;const p=pe(e[i].folderAppointments);return me(f,p.get(n),o)}return null},nt=({accounts:e})=>{const{mailboxId:t}=E(),n=j({queries:e.map(s=>({...q({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},st=({accounts:e})=>{const{mailboxId:t}=E(),n=j({queries:e.map(s=>({...q({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function rt(e){const t=je(),{searchInput:n}=ge(),s=Fe({accounts:e}),o=E(),r=be(o,s),i=c.useCallback(l=>{l===xe&&t(n)},[t,n]);return{scope:r,clearScope:i}}const Qe=768,ot=e=>e!=="desktop",it=()=>{const e=$(`(min-width: ${Qe}px)`);return $(ye)?"desktop":e?"tablet":"phone"};function at(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function ct(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=A(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function ut(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=A(r).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=A(r),l=s.get(i.toLowerCase())===1,f=t.length>1?o.get(r.accountId):void 0;return{value:l?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function lt(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{He as B,Ze as D,ke as K,_e as R,Ge as S,tt as a,et as b,je as c,j as d,ct as e,it as f,We as g,Ve as h,at as i,ot as j,Xe as k,Je as l,Fe as m,nt as n,st as o,Ye as p,we as q,Te as r,Ce as s,ze as t,rt as u,ut as v,lt as w,Ue as x};
|
|
1
|
+
import{c as H,r as c,j as g,g as X,b as C,c7 as J,X as Y,c8 as Z,c9 as D,ca as ee,cb as te,cc as _,x as ne,cd as se,ce as re,cf as oe,cg as ie,ch as ae,ci as ce,cj as Q,ck as ue,cl as le,l as v,a0 as K,cm as fe,c0 as E,cn as de,y as he,z as q,G as pe,H as me,v as ge,bz as $,bA as ye,co as A}from"./index-BABocYUA.js";import{a as be,S as xe}from"./search-scope-DTcpOp3S.js";const He=H("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const _e=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),we=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return we.filter(t=>e[t.action]!==void 0)}const ke=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ve(e){for(const t of ke){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ve(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ze(e){const t=Ce(e);return t===""?"":`(${t})`}const I={action:null,nextPrefix:null,preventDefault:!1},Se={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Ie={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function Ee(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...I,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...I,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...I,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=Se[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const r=n==="j"||n==="arrowdown";if(r||(n==="k"||n==="arrowup"))return{action:r?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=Ie[n];if(o){const r=o.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!r&&e.shiftKey&&!i?I:{action:o.action,nextPrefix:null,preventDefault:!0}}return I}function Re(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Te="data-message-row",Oe='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Me(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Oe);return t?!t.hasAttribute(Te):!1}function Pe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Ne({key:e,repeat:t=!1,index:n,chipCount:s}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function Le(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const De=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Ae=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:l=!0,showClearButton:f=!0,size:p="sm",inputId:u,suggest:h,className:x})=>{const R=c.useId(),S=u??R,m=c.useRef(null),y=c.useRef([]),b=r??o,[T,O]=c.useState(null),P=c.useRef(void 0),[U,z]=c.useState(""),N=e.length>0;c.useEffect(()=>{O(a=>a!==null&&a>=e.length?null:a)},[e.length]),c.useEffect(()=>{const a=P.current;if(a!==void 0){if(P.current=void 0,a===null){m.current?.focus();return}y.current[a]?.focus()}});const F=c.useRef(void 0);c.useEffect(()=>{const a=h?.caret;if(!a||a===F.current)return;F.current=a;const d=m.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const M=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=c.useCallback(a=>{O(a),P.current=a},[]),L=c.useCallback(a=>{const d=e[a];d&&t&&(w(Le(a,e.length)),z(`${d.label} removed`),t(d.id))},[e,t,w]),G=c.useCallback(()=>{w(null),o()},[o,w]),V=c.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Pe({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),W=c.useCallback(a=>d=>{const k=Ne({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":L(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,L,w]);return c.useEffect(()=>{if(!l)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||De(d.target)||(d.preventDefault(),m.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l]),g.jsxs("label",{htmlFor:S,className:C("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",p==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[g.jsx(X,{className:C("shrink-0 text-fg-muted pointer-events-none",p==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[N&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(J,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:T===d,onFocusLabel:()=>O(d),onKeyDown:W(d),onRemove:()=>L(d)},a.id))}),g.jsx("input",{ref:m,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:T===null?0:-1,onChange:a=>{s(a.target.value),M(a.target)},onKeyDown:V,onKeyUp:a=>M(a.currentTarget),onClick:a=>M(a.currentTarget),onFocus:a=>{O(null),h?.onFocusChange?.(!0),M(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:N?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||N)&&f&&g.jsx("button",{type:"button",onClick:G,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(Y,{className:C("text-fg-muted",p==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:U})]})},Ge=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:l=!0,showClearButton:f=!0,size:p,inputId:u,suggest:h,className:x})=>g.jsx(Ae,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:l,showClearButton:f,size:p,inputId:u,suggest:h,className:x});function Ve({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=c.useRef(e);o.current=e;const r=c.useRef(null),i=c.useRef(null);c.useEffect(()=>{if(!t)return;const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=u=>{const h=Ee({key:u.key,shiftKey:u.shiftKey,metaKey:u.metaKey,ctrlKey:u.ctrlKey,altKey:u.altKey,inEditable:Re(u.target),onControl:Me(u.target)},r.current);if(l(),r.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),h.action===null)return;const x=o.current[h.action];x&&(h.preventDefault&&u.preventDefault(),x())},p=n===void 0?window:n;if(p!==null)return p.addEventListener("keydown",f),()=>{p.removeEventListener("keydown",f),l(),r.current=null}},[t,s,n])}function B(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var qe=class extends Z{#r;#e;#o;#s;#t;#n;#i;#a;#c;#u=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,D.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const o=s.map(u=>u.observer),r=o.map(u=>u.getCurrentResult()),i=n.length!==o.length,l=o.some((u,h)=>u!==n[h]),f=i||l,p=f?!0:r.some((u,h)=>{const x=this.#e[h];return!x||!ee(u,x)});!f&&!p||(f&&(this.#u=s,this.#t=o),this.#e=r,this.hasListeners()&&(f&&(B(n,o).forEach(u=>{u.destroy()}),B(o,n).forEach(u=>{u.subscribe(h=>{this.#h(u,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),o=n.map(r=>r.defaultedQueryOptions.queryHash);return[s,r=>this.#f(r??s,t,o),()=>this.#l(s,n)]}#l(e,t){return t.map((n,s)=>{const o=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,r=>{t.forEach(i=>{i.observer.trackProp(r)})})})}#f(e,t,n){if(t){const s=this.#c,o=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((r,i)=>r!==s[i]));return(!this.#n||this.#e!==this.#a||o||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=te(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const o=s.options.queryHash;if(!o)return;const r=t.get(o);r?r.push(s):t.set(o,[s])});const n=[];return e.forEach(s=>{const o=this.#r.defaultQueryOptions(s),i=t.get(o.queryHash)?.shift()??new _(this.#r,o);n.push({defaultedQueryOptions:o,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#l(this.#e,this.#u),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&D.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function j({queries:e,...t},n){const s=ne(),o=se(),r=re(),i=c.useMemo(()=>e.map(m=>{const y=s.defaultQueryOptions(m);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,s,o]);i.forEach(m=>{oe(m);const y=s.getQueryCache().get(m.queryHash);ie(m,r,y)}),ae(r);const[l]=c.useState(()=>new qe(s,i,t)),[f,p,u]=l.getOptimisticResult(i,t.combine),h=!o&&t.subscribed!==!1;c.useSyncExternalStore(c.useCallback(m=>h?l.subscribe(D.batchCalls(m)):ce,[l,h]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),c.useEffect(()=>{l.setQueries(i,t)},[i,t,l]);const R=f.some((m,y)=>Q(i[y],m))?f.flatMap((m,y)=>{const b=i[y];if(b&&Q(b,m)){const T=new _(s,b);return ue(b,T,r)}return[]}):[];if(R.length>0)throw Promise.all(R);const S=f.find((m,y)=>{const b=i[y];return b&&le({result:m,errorResetBoundary:r,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return p(u())}function We(){const e=v({from:"/mail/brief/$threadId",shouldThrow:!1}),t=v({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=v({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=v({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=v({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=v({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,l=t?.messageId??s?.messageId??r?.messageId;return c.useMemo(()=>i?{threadId:i,messageId:l}:void 0,[i,l])}function Xe(){const e=K(),t=fe(),{list:n,mailboxId:s}=E();return c.useCallback((o,r)=>{const i=r?.query,f={search:u=>i===void 0?u:{...u,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...f});return}const p=r?.mailboxId??s;if(n==="mailbox"&&p){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:p,...o},...f});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...f})},[e,t,n,s])}function Je(){return de()}function je(){const e=K();return c.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Ye(){const e=K();return c.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const Ze=({trigger:e,children:t,align:n="right"})=>{const[s,o]=c.useState(!1),r=c.useRef(null),i=c.useCallback(f=>{r.current&&!r.current.contains(f.target)&&o(!1)},[]),l=c.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return c.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",l)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",l)}),[s,i,l]),g.jsxs("div",{ref:r,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!s)},className:C("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&g.jsx("div",{className:C("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},et=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:C("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),tt=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),Fe=({accounts:e})=>{const{list:t,mailboxId:n}=E(),{t:s}=he("mail",{useSuspense:!1}),o=c.useCallback((i,l)=>s(i,{defaultValue:l}),[s]),r=j({queries:e.map(i=>({...q({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const l=r[i]?.data?.items;if(!l)continue;const f=l.find(u=>u.mailboxId===n);if(!f)continue;const p=pe(e[i].folderAppointments);return me(f,p.get(n),o)}return null},nt=({accounts:e})=>{const{mailboxId:t}=E(),n=j({queries:e.map(s=>({...q({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},st=({accounts:e})=>{const{mailboxId:t}=E(),n=j({queries:e.map(s=>({...q({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function rt(e){const t=je(),{searchInput:n}=ge(),s=Fe({accounts:e}),o=E(),r=be(o,s),i=c.useCallback(l=>{l===xe&&t(n)},[t,n]);return{scope:r,clearScope:i}}const Qe=768,ot=e=>e!=="desktop",it=()=>{const e=$(`(min-width: ${Qe}px)`);return $(ye)?"desktop":e?"tablet":"phone"};function at(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function ct(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=A(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function ut(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=A(r).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=A(r),l=s.get(i.toLowerCase())===1,f=t.length>1?o.get(r.accountId):void 0;return{value:l?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function lt(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{He as B,Ze as D,ke as K,_e as R,Ge as S,tt as a,et as b,je as c,j as d,ct as e,it as f,We as g,Ve as h,at as i,ot as j,Xe as k,Je as l,Fe as m,nt as n,st as o,Ye as p,we as q,Te as r,Ce as s,ze as t,rt as u,ut as v,lt as w,Ue as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,b as S,a0 as L,r as c,aD as O,ap as T,g as $,aH as A,D as I,bv as q,x as C,aj as k,bw as M,bx as P,B as N,a as R,by as D,X as G}from"./index-
|
|
1
|
+
import{j as e,b as S,a0 as L,r as c,aD as O,ap as T,g as $,aH as A,D as I,bv as q,x as C,aj as k,bw as M,bx as P,B as N,a as R,by as D,X as G}from"./index-BABocYUA.js";import{K as f}from"./kbd-DSNCR5_d.js";import{S as Q,a as E}from"./settings-screen-B5erjy_j.js";import{E as V}from"./ErrorState-B5TOm3KZ.js";import{u as B}from"./useDebouncedValue-C20Bi7o5.js";import{a as K}from"./format-23Av07Go.js";import{s as _}from"./help-copy-CO7fR1xI.js";import"./avatar-DemwoTLw.js";import"./menu-AacW4NBj.js";import"./circle-help-D_kDH1n0.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:n,isError:d,error:b}=I(q()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:M()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(a=>e.jsx(E,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function U({group:t,query:r,onCount:m}){const n=B(r.trim(),300),d=C(),[b,g]=c.useState(null),i=n.length>=2,l=D({query:{q:n,limit:50}}),{data:p,isPending:u,isError:a,error:j}=I({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&K(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(G,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=L(),[r,m]=c.useState("vip"),[n,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),a=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=A[s];o&&t({to:o})};return e.jsx(Q,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:_,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:n,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:n,onCount:a}):e.jsx(U,{group:r,query:n,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{re as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,a4 as o}from"./index-BABocYUA.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,r as j,j as e,b as f,B as i,X as N,aF as S}from"./index-
|
|
1
|
+
import{c as z,r as j,j as e,b as f,B as i,X as N,aF as S}from"./index-BABocYUA.js";import{A as w}from"./avatar-DemwoTLw.js";import{M as B}from"./menu-AacW4NBj.js";import{C as v}from"./circle-help-D_kDH1n0.js";const h=z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function E({items:l,activeId:t,title:c,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,x]=j.useState(!1),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),x(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>x(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),x(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>x(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-4"}),className:"lg:hidden",onClick:()=>x(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:c}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function R({name:l,email:t,meta:c,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[c,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:c,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(S,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",c," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{X as A,E as S,R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-BABocYUA.js";const c=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,ab as e}from"./index-
|
|
1
|
+
import{j as t,ab as e}from"./index-BABocYUA.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-BABocYUA.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,aj as b,dC as E,D as C,dD as x,dk as D,dE as F,x as M,dF as N,dG as P,dH as L,dI as z}from"./index-
|
|
1
|
+
import{r as m,aj as b,dC as E,D as C,dD as x,dk as D,dE as F,x as M,dF as N,dG as P,dH as L,dI as z}from"./index-BABocYUA.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=p=>String(p).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",G=e=>!e.literalClauses.some(t=>t.field==="HasWords"),y=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),V=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",X=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?O(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,k=15e3,J=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,k)},_=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:J(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:_(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],$=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?$(t):t.trim(),R=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:R(e.matchOperator),literalClauses:a}},j=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),H=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},Q=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},q=350,re=(e,t,r)=>{const a=b(D()),{mutateAsync:i}=a,n=H(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=j(t);return m.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:Q(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:F},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,X as j,G as k,ee as n,V as o,O as p,U as r,re as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as L,c2 as p,x as n,aj as l,c3 as d,r as o,c4 as c,c5 as y,c6 as g}from"./index-
|
|
1
|
+
import{D as L,c2 as p,x as n,aj as l,c3 as d,r as o,c4 as c,c5 as y,c6 as g}from"./index-BABocYUA.js";const u=e=>c({path:{accountId:e}}),f=e=>{const r=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},m=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const r=n(),t=l({...y(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,h as b,C as c,m as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as h,r as c,cn as M,a0 as S,cm as O,c0 as B,a6 as P,t as U,x as D,D as N,cI as $,cJ as F}from"./index-
|
|
1
|
+
import{l as h,r as c,cn as M,a0 as S,cm as O,c0 as B,a6 as P,t as U,x as D,D as N,cI as $,cJ as F}from"./index-BABocYUA.js";const w="/mail/brief/compose/{-$outboxMessageId}",R="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:w,shouldThrow:!1}),t=h({from:R,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function z(){return T()!==void 0}function J(){return T()?.outboxMessageId}function L(e,t,r){return e==="flagged"?{to:R,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:w,params:{outboxMessageId:r}}}function b(){const e=S(),t=O(),{list:r,mailboxId:s}=B();return c.useCallback((n,o)=>{e({...L(r,s,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function Y(){const e=b();return c.useCallback(()=>e(void 0),[e])}function j(){const e=b();return c.useCallback(t=>e(t),[e])}function V(){const e=b();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Z(){return M()}const v=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},g={all:["messages"],detail:e=>[...g.all,"detail",e],body:e=>[...g.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const _=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},I=8,K="x-remit-403-reason",Q=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},q=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,X=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},G=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await F(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,_(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(K),y=Q(o.status,l);throw new f(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(X(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const m=await o.text();if(q(m,a))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},H=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),ee=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?v(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),m=D(),l=c.useRef(!1),y=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;y.current!==C&&(y.current=C,l.current=!1);const i=N({queryKey:e?[...g.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,H({fetchContent:(u,A)=>G(u,A,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:$({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<I:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s;c.useEffect(()=>{p&&(a.current=performance.now())},[p]),c.useEffect(()=>{i.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,n]);const x=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:x,isLoading:p,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,z as a,J as b,j as c,ee as d,V as e,Z as f,Q as g,Y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as E,e as q,b as j,B as D,r as i,aJ as R,x as C,v as K,a6 as A,Y as Q,W as $,Z as z,_ as B}from"./index-
|
|
1
|
+
import{j as E,e as q,b as j,B as D,r as i,aJ as R,x as C,v as K,a6 as A,Y as Q,W as $,Z as z,_ as B}from"./index-BABocYUA.js";import{C as G}from"./circle-check-big-B091lXse.js";import{R as H,d as P}from"./search-token-index-BUo4HNZ4.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(G,{className:"size-4 text-positive"}):E.jsx(H,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function _(e){return!!e&&W.has(e)}const N=3e3,U=N*2,v={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=P({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:N,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(_(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?v:{syncing:g,resolved:!0,synced:y,total:w}}const M=6e4,I=new Set(["sent","drafts","trash","archive"]),k=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},F=i.createContext(null),X=()=>{const e=i.useContext(F);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=P({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:M,staleTime:M,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=k(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,k(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(F.Provider,{value:S,children:t})}const Y=2e3,Z=45e3,V=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{z(e,{softError:!0},"user")&&B(e)},L=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(_(c))n=!0;else if(n||L(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await V(Y)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:L(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await $({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Z,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,_ as i,X as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cs as V,r as g,j as a,b,I as Q,x as Y,ah as q,aj as X,ak as Z,cI as J,bx as ee,t as te,e as se,X as re,bN as R,v as ne,c0 as ae}from"./index-
|
|
1
|
+
import{cs as V,r as g,j as a,b,I as Q,x as Y,ah as q,aj as X,ak as Z,cI as J,bx as ee,t as te,e as se,X as re,bN as R,v as ne,c0 as ae}from"./index-BABocYUA.js";import{K as k}from"./kbd-DSNCR5_d.js";import{B as oe,d as ie}from"./useMessageBodyContent-Cc1URKWS.js";import{i as ce}from"./search-scope-DTcpOp3S.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
|
|
2
2
|
/* Zero the UA default body margin and clamp the document to the iframe width so
|
|
3
3
|
wide author markup can't push the body (and the page) past the viewport. */
|
|
4
4
|
html, body {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as T,ah as I,aj as C,bK as k,bY as A,r as v,j as p,bZ as h,b_ as E,b$ as j,v as D,c0 as w,D as z,c1 as Q,bN as R}from"./index-
|
|
1
|
+
import{x as T,ah as I,aj as C,bK as k,bY as A,r as v,j as p,bZ as h,b_ as E,b$ as j,v as D,c0 as w,D as z,c1 as Q,bN as R}from"./index-BABocYUA.js";import{P as _}from"./attachment-file-Ct9wXIh3.js";import{E as N,F as O,ao as P,ap as q}from"./MailListHeader-C5zKQU_o.js";import{a as B}from"./useLabels-D-DDvu3d.js";import{n as F}from"./search-query-Cr_ZXBCp.js";import{s as U}from"./search-scope-DTcpOp3S.js";import{u as G,p as H}from"./useSearchTokenContext-2jIzOIvy.js";const ae=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},K=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=C({...A(),onError:(n,u)=>{l({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(n),error:n})},onSettled:(n,u,d)=>{N(c,O(P(d.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,u,d)=>{n.length!==0&&q(n,m=>i({body:{messageIds:m,labelId:u,action:d}}))},[i]),isPending:o}};function ne({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=B(e),{applyLabel:l}=K({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(_,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const $=20,V=new Set(Object.values(R)),Y=e=>e!==void 0&&V.has(e)?e:void 0,Z=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function re({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=D(),c=G(),l=w(),i=F(a),{freeText:o,tokens:r}=H(i,c),n=o.length>0,u=r.find(s=>s.type==="category"),d=Y(t)??u?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,b=r.some(s=>s.type==="isStarred")?!0:void 0,y=Z(r),f=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),x=r.find(s=>s.type==="in"),S=U({browsed:l,callerMailboxId:e,inTokenMailboxId:x?.mailboxId}),{data:L,isLoading:M}=z({...Q({query:{query:o,mailboxId:S,limit:$,...d!==void 0?{category:d}:{},...m!==void 0?{hasAttachment:m}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{ne as L,ae as r,re as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as g,ah as p,D as f,a1 as m,r,aj as y,ak as T,a5 as x,al as E}from"./index-
|
|
1
|
+
import{x as g,ah as p,D as f,a1 as m,r,aj as y,ak as T,a5 as x,al as E}from"./index-BABocYUA.js";const i={html:"",plainText:""},C=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(s=>s.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),a=y({...E(),onSuccess:()=>{u.invalidateQueries({queryKey:x()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,s)=>{e&&a.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:s}})},[e,a]);return{signature:l,setSignature:c,isSaving:a.isPending}};export{C as u};
|
package/index.html
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
} catch (_) {}
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-BABocYUA.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-OWhz0EKb.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dJ as $,r as n,d0 as X,v as z,b3 as Y,bF as Z,aR as ee,aS as te,j as a,a8 as se,bP as ae,bQ as oe}from"./index-BTwt_qFK.js";import{u as re,p as ne,R as de}from"./useSearchTokenContext-Cacdc4gx.js";import{H as ie,ac as le,I as ce,aw as ue,ad as ge,b as he,M as me,ak as fe,ax as Ie,am as pe,q as xe,L as Te,Q as V,P as ye,N as be,d as ve,_ as Re,$ as Ce,a1 as K,a2 as W,a3 as Se,a4 as we,a5 as je}from"./MailListHeader-a6YQT5FI.js";import{u as Fe,b as Me,a as Oe}from"./MailViewChrome-xbtYuhYE.js";import{f as Pe}from"./ErrorState-DUMGPSGb.js";import{w as ke}from"./wizard-selection-B1bng5Jq.js";import{a as Le}from"./useMessageBodyContent-Btm-f3R7.js";import{k as Ae,l as Ne}from"./search-token-index-BpkIrpcT.js";import{u as De}from"./index-C7eoBaay.js";const Ee=()=>X({query:{starred:!0,order:"desc"}});function _(){const{data:e,isLoading:t,isError:s,error:d,refetch:h,fetchNextPage:c,hasNextPage:o,isFetchingNextPage:m}=Fe({queryKey:Ee(),queryFn:async({pageParam:p})=>{const{data:b}=await $({query:{starred:!0,order:"desc",continuationToken:p},throwOnError:!0});return b},initialPageParam:void 0,getNextPageParam:p=>p.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(p=>p.items??[]),[e]),isLoading:t,isError:s,error:d,refetch:h,fetchNextPage:c,hasNextPage:o,isFetchingNextPage:m}}const Be=e=>{const t=new Set;return e.filter(s=>t.has(s.threadId)?!1:(t.add(s.threadId),!0))},qe={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function Qe({rows:e,verb:t}){const{selectedIds:s,exitSelection:d}=pe(),h=n.useMemo(()=>ke(e,s),[e,s]);return a.jsx(xe,{verb:t,selection:h,selectionRestriction:"spansAccounts",onFinished:d})}function ze({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:d,onDeleteMessages:h}){const{searchQuery:c,resultFolderIndex:o}=z(),m=re(),I=Y(),p=Z(),[b,f]=n.useState("all"),[g,F]=n.useState(new Set),D=n.useCallback(r=>{F(u=>{const T=new Set(u);return T.has(r)?T.delete(r):T.add(r),T})},[]),C=n.useCallback(()=>{f("all"),F(new Set)},[]),{threads:M,isLoading:y,isError:O,error:E,refetch:P,fetchNextPage:H,hasNextPage:x,isFetchingNextPage:S}=_(),{freeText:R,tokens:k}=ne(c.trim().toLowerCase(),m),i=n.useMemo(()=>{const r=Array.from(g).map(u=>qe[u]).filter(u=>u!=null);return Be(M).map(ie).filter(u=>(b==="all"||u.category===b)&&r.every(T=>T(u))&&(!R||le(u,R))&&ce(u,k))},[M,b,g,R,k]),w=n.useCallback((r,u)=>{const T=i.find(U=>U.id===r)?.threadId;T&&t?.({threadId:T,messageId:r},u)},[i,t]),j=n.useCallback(r=>{const u=r.threadId??i.find(T=>T.id===r.id)?.threadId;u&&t?.({threadId:u,messageId:r.id})},[i,t]),B=n.useMemo(()=>ue(),[]),q=n.useMemo(()=>i.map(r=>ge(r,o)),[i,o]),L=n.useMemo(()=>i.filter(r=>!r.isRead).length,[i]),A=y?"loading":O?"error":i.length===0?"empty":"ready",l=n.useCallback(()=>{const r=ee(te());window.open(r,"_blank","noopener,noreferrer")},[]),v=he(),Q=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:i.map(r=>a.jsx(me,{thread:r,active:r.id===e,onClick:()=>w(r.id)},r.id))}),x?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>H(),disabled:S,children:S?"Loading…":"Load more"}):null]})});return a.jsx(Me,{title:"Starred",unreadCount:L,preset:B,selectedCategory:b,activeFilters:g,onSelectCategory:f,onToggleFilter:D,onClearFilters:C,searchResults:q,searchLoading:y,onSelectSearchResult:j,searchResultsInBody:!0,children:a.jsxs(fe,{selectedMessageId:e,rows:i,onOpen:w,onDeleteMessages:h,onSelectionVerb:p.start,wizardOpen:p.isOpen,commandsRef:s,onTriageContextChange:d,children:[a.jsx(Oe,{listTitle:"Starred",sections:[{id:"flagged",threads:i}],flatList:!0,hideHeader:!0,listState:v.searchResults?"ready":A,searchQuery:R?c:void 0,errorMessage:O?Pe(E):void 0,onRetry:()=>P(),onReportError:l,selectedThreadId:e,onSelectThread:w,isDesktop:I,selectionBar:a.jsx(Ie,{title:"Starred"}),listBody:v.searchResults??(A==="ready"?Q:void 0)}),a.jsx(Qe,{rows:i,verb:p.verb})]})})}const G=n.createContext(null);function N(){const e=n.useContext(G);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function He({thread:e,children:t}){const s=Ae(),d=Ne(),h=De(),{searchInput:c}=z(),o=e?.threadId,m=e?.messageId,{threads:I}=_(),p=n.useMemo(()=>{if(o)return I.find(l=>l.messageId===m)??I.find(l=>l.threadId===o)},[I,o,m]),b=Te(o,m),f=p??b,g=m??f?.messageId,F=n.useMemo(()=>{if(o)return{threadId:o,mailboxId:f?.mailboxId??"",subject:f?.subject,messageId:g,authenticity:f?.authenticity}},[o,f,g]),D=n.useCallback((l,v)=>{s(l,{replace:v?.replace,query:c})},[s,c]),C=n.useCallback(l=>{g&&l.includes(g)&&d()},[g,d]),M=V({thread:f,isOpen:!0,onAfterOptimisticRemove:C}),y=ye(),{deleteMessages:O}=be({mailboxId:f?.mailboxId??"",messages:I,onAfterOptimisticRemove:C}),{toggleReadFor:E}=ve({mailboxId:f?.mailboxId??"",messages:I}),P=y.focusedMessageId,x=n.useMemo(()=>I.find(l=>l.messageId===P),[I,P])??f,S=V({thread:x,isOpen:x?.messageId===g}),R=Le(),k=se(),i=ae(),w=n.useMemo(()=>oe(i,o,g),[i,o,g]),j=n.useMemo(()=>{if(x)return l=>i({threadId:x.threadId,messageId:x.messageId,mode:l})},[i,x]),{nextMessageId:B,previousMessageId:q}=Re({context:y,orderedIds:y.orderedIds,selectedMessageId:g,enabled:!R&&!k,onClose:d,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{y.listCommandsRef.current?.requestVerb("delete")||S.deleteThread()},toggleStar:S.toggleStar,toggleRead:()=>{y.listCommandsRef.current?.requestVerb("markRead")||x&&E([x.messageId],!x.isRead)},goBrief:()=>h("brief"),goSettings:()=>h("settings")}}),L=n.useCallback(l=>{if(!l)return;const v=I.find(Q=>Q.messageId===l);return v?{threadId:v.threadId,messageId:l}:void 0},[I]),A={selectedMessageId:g,selectedThread:f,conversation:F,onOpenThread:D,onCloseThread:d,nextThread:L(B),previousThread:L(q),actions:M,onReply:w,triage:y,onDeleteMessages:O,handleDeselectIfRemoved:C};return a.jsx(G.Provider,{value:A,children:t})}function J(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:d}=N();return a.jsx(ze,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:d})}function Ve(){const{conversation:e,selectedThread:t,actions:s,onReply:d,handleDeselectIfRemoved:h}=N(),c=!!e,o=we(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(je,{hasThread:c,intelligenceOpen:o.isShowing,canToggleIntelligence:o.canToggle,onToggleIntelligence:o.toggle,onReply:d?()=>d("reply"):void 0,onReplyAll:d?()=>d("reply-all"):void 0,onForward:d?()=>d("forward"):void 0,onDelete:c?s.deleteThread:void 0,onToggleStar:c?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:c&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:o.open}):a.jsx(de,{})})]}),a.jsx(W,{isOpen:o.drawerOpen,onClose:o.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:h})]})}function Ke(){const{selectedThread:e,handleDeselectIfRemoved:t}=N(),{onToggleIntelligence:s}=z();return a.jsx(Se,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function We(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:d,nextThread:h,previousThread:c,handleDeselectIfRemoved:o}=N(),m=Ce(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx(K,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:m.toggle,onSwipeNext:h?()=>d(h):void 0,onSwipePrevious:c?()=>d(c):void 0,mobileIntelligenceOpen:m.isOpen}),a.jsx(W,{isOpen:m.isOpen,onClose:m.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:o})]}):a.jsx("div",{className:"h-full",children:a.jsx(J,{})})}const tt=Object.assign(He,{List:J,Reading:Ve,Intelligence:Ke,Phone:We});export{tt as F};
|