@remit/web-client-dist 0.0.310 → 0.0.312

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/assets/BriefPane-CyCnqfV1.js +1 -0
  2. package/assets/{ErrorState-DiX_zNTK.js → ErrorState-CN4Cwb5A.js} +1 -1
  3. package/assets/FlaggedPane-MgcE5bKj.js +1 -0
  4. package/assets/MailListHeader-DX7_Cewa.js +52 -0
  5. package/assets/MailViewChrome-9cKXCycT.js +1 -0
  6. package/assets/MailboxPane-Db0hba1S.js +1 -0
  7. package/assets/NavMenuButton-3t-xq8p6.js +1 -0
  8. package/assets/{OnboardingWizard-r-N3eGPg.js → OnboardingWizard-BFkNhodP.js} +1 -1
  9. package/assets/OutboxPane-O18gKLgX.js +1 -0
  10. package/assets/_mailboxId-DbcIOfsr.js +1 -0
  11. package/assets/{account-form-helpers-BHUowns0.js → account-form-helpers-D3tfbITU.js} +1 -1
  12. package/assets/accounts-J2omBETN.js +1 -0
  13. package/assets/advanced-Cb-Yw4fX.js +1 -0
  14. package/assets/appearance-BXwFGVL1.js +1 -0
  15. package/assets/avatar-DTwl3jb1.js +1 -0
  16. package/assets/bottom-sheet-Bw79dNtH.js +1 -0
  17. package/assets/brief-Cj9RHZn4.js +1 -0
  18. package/assets/brief-CrERI6Q7.js +1 -0
  19. package/assets/browser-ponyfill-Dfl9dHmO.js +2 -0
  20. package/assets/circle-check-DizPpF0Y.js +1 -0
  21. package/assets/circle-check-big-ChA18R4j.js +1 -0
  22. package/assets/circle-help-DPkDkgdF.js +1 -0
  23. package/assets/clock-uuvA1em-.js +1 -0
  24. package/assets/confirm-dialog-BTyZAw5R.js +1 -0
  25. package/assets/conversation-target-B0jE-e47.js +1 -0
  26. package/assets/{download-Bg6cLSAV.js → download-B3EpkLuL.js} +1 -1
  27. package/assets/enums-CCxx0t2v.js +1 -0
  28. package/assets/filters-Dk1yDjyQ.js +1 -0
  29. package/assets/{flagged-CuV2oZw_.js → flagged-CHfuc_hl.js} +1 -1
  30. package/assets/flagged-CZrDrTDc.js +1 -0
  31. package/assets/folders-B8orXsv8.js +1 -0
  32. package/assets/{format-CKZmh-Ru.js → format-De9HZKjg.js} +1 -1
  33. package/assets/index-BHkaa_C4.js +1 -0
  34. package/assets/index-CdMOAANs.js +1 -0
  35. package/assets/index-DDXDeP1_.js +1 -0
  36. package/assets/index-DjZFLwif.js +294 -0
  37. package/assets/index-O_DYWmDx.js +1 -0
  38. package/assets/index-lDYTJ6Ao.js +1 -0
  39. package/assets/intelligence-pref-C6lFpj6U.js +1 -0
  40. package/assets/{kbd-C00o9L4B.js → kbd-C0TyJDqO.js} +1 -1
  41. package/assets/labels-BzM1g0fg.js +1 -0
  42. package/assets/mail-oqxsK0QY.js +1 -0
  43. package/assets/menu-Cpsp0ZMZ.js +1 -0
  44. package/assets/move-options-CdaX2x7F.js +1 -0
  45. package/assets/onboarding-BAPCDoFw.js +1 -0
  46. package/assets/outbox-DQtIjp3h.js +1 -0
  47. package/assets/outbox-status-CPfNHfUQ.js +1 -0
  48. package/assets/pencil-Cm8cWZKn.js +1 -0
  49. package/assets/{rich-text-CoTs3nIc.js → rich-text-CGn1MSzM.js} +2 -2
  50. package/assets/rotate-ccw-oQ2bjkRm.js +1 -0
  51. package/assets/row-actions-CN3rJN24.js +1 -0
  52. package/assets/search-query-Cr_ZXBCp.js +1 -0
  53. package/assets/search-scope-CFN-gjTv.js +1 -0
  54. package/assets/search-token-index-CxMDhXuP.js +1 -0
  55. package/assets/search-view-ClRhrhjK.js +1 -0
  56. package/assets/senders-C-f6yU99.js +1 -0
  57. package/assets/settings-BbNYlJXs.js +1 -0
  58. package/assets/settings-screen-DBHgQU-S.js +1 -0
  59. package/assets/shield-check-BG5lmiwu.js +1 -0
  60. package/assets/{suggested-vips-BQoY6-Yl.js → suggested-vips-D0nhcuze.js} +1 -1
  61. package/assets/{useDebouncedValue-Ck8McJvG.js → useDebouncedValue-BFCY668u.js} +1 -1
  62. package/assets/useFilters-CxQU6LTN.js +1 -0
  63. package/assets/useLabels-DdQPlRo8.js +1 -0
  64. package/assets/useMediaQuery-fUhUpE77.js +1 -0
  65. package/assets/useRefreshControl-BsKYVbfM.js +1 -0
  66. package/assets/useSearchMirror-HHNbELBF.js +1 -0
  67. package/assets/useSearchTokenContext-D5dvdLSW.js +67 -0
  68. package/assets/useSignature-C6SBu3ql.js +1 -0
  69. package/index.html +1 -1
  70. package/package.json +1 -1
  71. package/assets/_mailboxId-DtqBFgK5.js +0 -1
  72. package/assets/accounts-B4-7wVt4.js +0 -1
  73. package/assets/advanced-Dlyjnb6l.js +0 -1
  74. package/assets/appearance-Drfetqy5.js +0 -1
  75. package/assets/avatar-Ci3CMhdo.js +0 -1
  76. package/assets/browser-ponyfill-BhnZT7aq.js +0 -2
  77. package/assets/circle-check-BM6iE_RP.js +0 -1
  78. package/assets/confirm-dialog-F7nDmx5t.js +0 -1
  79. package/assets/filters-CsWlycJW.js +0 -1
  80. package/assets/flagged-DtqBFgK5.js +0 -1
  81. package/assets/folders-Dg7RilCS.js +0 -1
  82. package/assets/index-BSJKHoKS.js +0 -1
  83. package/assets/index-DtqBFgK5.js +0 -1
  84. package/assets/index-dsr8I39S.js +0 -1
  85. package/assets/index-xOALrEh8.js +0 -294
  86. package/assets/labels-pEUVx_Ue.js +0 -1
  87. package/assets/mail-Chm12_Xz.js +0 -118
  88. package/assets/move-options-B2c-WWEl.js +0 -1
  89. package/assets/onboarding-DKy8Q5MV.js +0 -1
  90. package/assets/outbox-DtqBFgK5.js +0 -1
  91. package/assets/pencil-CZK87pI9.js +0 -1
  92. package/assets/senders-p6LBrcYb.js +0 -1
  93. package/assets/settings-C2TANSwS.js +0 -1
  94. package/assets/settings-screen-C7xmJsXG.js +0 -1
  95. package/assets/shield-check-CdES_QdC.js +0 -1
  96. package/assets/useFilters-DMt8Gx-P.js +0 -1
  97. package/assets/useLabels-oSXOt6KZ.js +0 -1
  98. package/assets/useSignature-BQN3IL24.js +0 -1
@@ -1,2 +0,0 @@
1
- import{d4 as A,bZ as $}from"./index-xOALrEh8.js";function X(_,d){for(var b=0;b<d.length;b++){const y=d[b];if(typeof y!="string"&&!Array.isArray(y)){for(const l in y)if(l!=="default"&&!(l in _)){const p=Object.getOwnPropertyDescriptor(y,l);p&&Object.defineProperty(_,l,p.get?p:{enumerable:!0,get:()=>y[l]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}},H;function Z(){return H||(H=1,(function(_,d){var b=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof A<"u"&&A,y=(function(){function p(){this.fetch=!1,this.DOMException=b.DOMException}return p.prototype=b,new p})();(function(p){(function(h){var a=typeof p<"u"&&p||typeof self<"u"&&self||typeof A<"u"&&A||{},u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function F(e){return e&&DataView.prototype.isPrototypeOf(e)}if(u.arrayBuffer)var q=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],C=ArrayBuffer.isView||function(e){return e&&q.indexOf(Object.prototype.toString.call(e))>-1};function v(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function T(e){return typeof e!="string"&&(e=String(e)),e}function B(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return u.iterable&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}i.prototype.append=function(e,t){e=v(e),t=T(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},i.prototype.delete=function(e){delete this.map[v(e)]},i.prototype.get=function(e){return e=v(e),this.has(e)?this.map[e]:null},i.prototype.has=function(e){return this.map.hasOwnProperty(v(e))},i.prototype.set=function(e,t){this.map[v(e)]=T(t)},i.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},i.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),B(e)},i.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),B(e)},i.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),B(e)},u.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);function O(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function D(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function I(e){var t=new FileReader,r=D(t);return t.readAsArrayBuffer(e),r}function M(e){var t=new FileReader,r=D(t),n=/charset=([A-Za-z0-9_-]+)/.exec(e.type),s=n?n[1]:"utf-8";return t.readAsText(e,s),r}function L(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function R(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:u.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():u.arrayBuffer&&u.blob&&F(e)?(this._bodyArrayBuffer=R(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||C(e))?this._bodyArrayBuffer=R(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=O(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(u.blob)return this.blob().then(I);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return M(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function k(e){var t=e.toUpperCase();return N.indexOf(t)>-1?t:e}function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new i(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new i(t.headers)),this.method=k(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||(function(){if("AbortController"in a){var o=new AbortController;return o.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var s=/\?/;this.url+=(s.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})};function z(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),s=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(o))}}),t}function G(e){var t=new i,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
2
- `)===0?n.substr(1,n.length):n}).forEach(function(n){var s=n.split(":"),o=s.shift().trim();if(o){var g=s.join(":").trim();try{t.append(o,g)}catch(x){console.warn("Response "+x.message)}}}),t}U.call(w.prototype);function c(e,t){if(!(this instanceof c))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}U.call(c.prototype),c.prototype.clone=function(){return new c(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},c.error=function(){var e=new c(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var V=[301,302,303,307,308];c.redirect=function(e,t){if(V.indexOf(t)===-1)throw new RangeError("Invalid status code");return new c(null,{status:t,headers:{location:e}})},h.DOMException=a.DOMException;try{new h.DOMException}catch{h.DOMException=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},h.DOMException.prototype=Object.create(Error.prototype),h.DOMException.prototype.constructor=h.DOMException}function P(e,t){return new Promise(function(r,n){var s=new w(e,t);if(s.signal&&s.signal.aborted)return n(new h.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function g(){o.abort()}o.onload=function(){var f={statusText:o.statusText,headers:G(o.getAllResponseHeaders()||"")};s.url.indexOf("file://")===0&&(o.status<200||o.status>599)?f.status=200:f.status=o.status,f.url="responseURL"in o?o.responseURL:f.headers.get("X-Request-URL");var m="response"in o?o.response:o.responseText;setTimeout(function(){r(new c(m,f))},0)},o.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request timed out"))},0)},o.onabort=function(){setTimeout(function(){n(new h.DOMException("Aborted","AbortError"))},0)};function x(f){try{return f===""&&a.location.href?a.location.href:f}catch{return f}}if(o.open(s.method,x(s.url),!0),s.credentials==="include"?o.withCredentials=!0:s.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(u.blob?o.responseType="blob":u.arrayBuffer&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof i||a.Headers&&t.headers instanceof a.Headers)){var j=[];Object.getOwnPropertyNames(t.headers).forEach(function(f){j.push(v(f)),o.setRequestHeader(f,T(t.headers[f]))}),s.headers.forEach(function(f,m){j.indexOf(m)===-1&&o.setRequestHeader(m,f)})}else s.headers.forEach(function(f,m){o.setRequestHeader(m,f)});s.signal&&(s.signal.addEventListener("abort",g),o.onreadystatechange=function(){o.readyState===4&&s.signal.removeEventListener("abort",g)}),o.send(typeof s._bodyInit>"u"?null:s._bodyInit)})}return P.polyfill=!0,a.fetch||(a.fetch=P,a.Headers=i,a.Request=w,a.Response=c),h.Headers=i,h.Request=w,h.Response=c,h.fetch=P,h})({})})(y),y.fetch.ponyfill=!0,delete y.fetch.polyfill;var l=b.fetch?b:y;d=l.fetch,d.default=l.fetch,d.fetch=l.fetch,d.Headers=l.Headers,d.Request=l.Request,d.Response=l.Response,_.exports=d})(E,E.exports)),E.exports}var S=Z();const J=$(S),Q=X({__proto__:null,default:J},[S]);export{Q as b};
@@ -1 +0,0 @@
1
- import{a as c}from"./index-xOALrEh8.js";const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{r as C};
@@ -1 +0,0 @@
1
- import{r as n,j as e,bR as b,d as o}from"./index-xOALrEh8.js";const h=({isOpen:s,title:i,description:l,confirmLabel:d,cancelLabel:m="Cancel",destructive:u=!1,isBusy:f=!1,onConfirm:x,onCancel:r})=>{const c=n.useRef(null),a=n.useCallback(t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r())},[r]);return n.useEffect(()=>{if(s)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s,a]),n.useEffect(()=>{if(!s)return;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),()=>{t?.isConnected&&t.focus()}},[s]),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:r,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i,className:o("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:i}),l&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:l}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{ref:c,type:"button",onClick:r,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:m}),e.jsx("button",{type:"button",onClick:x,disabled:f,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",u?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:d})]})]})]}):null};export{h as C};
@@ -1 +0,0 @@
1
- import{af as X,aN as Z,cB as ee,cC as te,r as x,j as t,cD as se,cE as ae,L as R,B as N,D as ie,e as ne,cF as re,i as oe,T as le,aK as P,av as ce,aw as de,aI as me,au as ue,aS as pe,cn as xe,cp as fe}from"./index-xOALrEh8.js";import{S as he}from"./settings-screen-C7xmJsXG.js";import{h as ge,N as S,p as ve,c as be,r as je,d as ye,S as L,i as Ne,n as Ce,u as Se,B as Fe,j as Ie,k as Me,l as we,m as Ee}from"./useFilters-DMt8Gx-P.js";import{a as Oe,u as De,b as Ae,f as Le}from"./move-options-B2c-WWEl.js";import{a as ke,u as Te}from"./useLabels-oSXOt6KZ.js";import{C as A}from"./circle-check-BM6iE_RP.js";import{E as $}from"./ErrorState-DiX_zNTK.js";import"./avatar-Ci3CMhdo.js";const Re=(e,s)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:ge(e)}),s&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:s}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!s||c({path:{accountId:e,filterId:s},body:d})},[e,s,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,s=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...s?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const s=Date.parse(e);if(Number.isNaN(s))return"";const r=new Date(s),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},k=e=>JSON.stringify({clauses:e.clauses.map(s=>[s.field,s.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,s)=>k(e)!==k(s),T=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),B=(e,s)=>T(e)!==T(s),ze=(e,s)=>{const r={},i=(e.name??"").trim();return i!==(s.name??"").trim()&&(r.name=i),z(e,s)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),B(e,s)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=ve(e.until??""))),r};function Be({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(s,g),[s,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),I=x.useRef(0),{count:C}=be(e,je(n)),y=Re(e,s.filterId),v=ye(e),{createFolderIn:F}=Oe(e),{createLabel:E}=ke(e),M=async o=>{const a=await E(o);return{id:a.labelId,name:a.name,color:a.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const a=n.clauses.find(j=>j.id===o);a&&u({mode:"edit",clauseId:o,draft:{field:a.field,value:a.value}})},O=o=>u(a=>a&&{...a,draft:{...a.draft,field:o}}),_=o=>u(a=>a&&{...a,draft:{...a.draft,value:o}}),K=()=>{if(!m)return;const o=m.draft.field,a=Ce(o,m.draft.value);a!==""&&(l(j=>m.mode==="edit"&&m.clauseId?{...j,clauses:j.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:a}:D)}:(I.current+=1,{...j,clauses:[...j.clauses,{id:`new-${I.current}`,field:o,value:a}]})),u(void 0))},U=o=>l(a=>({...a,clauses:a.clauses.filter(j=>j.id!==o)})),Q=o=>l(a=>({...a,matchOperator:o})),G=o=>l(a=>({...a,moveMailboxId:o||void 0})),H=o=>l(a=>({...a,labelId:o||void 0})),J=o=>l(a=>({...a,name:o})),V=o=>l(a=>({...a,scope:o,until:o==="until"?a.until:void 0})),q=o=>l(a=>({...a,until:o})),W=()=>{const o=z(n,f)||B(n,f),a=ze(n,f);if(Object.keys(a).length===0){d();return}b(o),y.updateFilter(a)},Y=()=>v.start(Ne(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Qe,{progress:v.progress,isDone:v.isDone,onClose:d}):y.isPending?t.jsx(_e,{}):y.isError?t.jsx(Ge,{onRetry:y.reset,onClose:d}):y.isSuccess?h?t.jsx(Ue,{preview:se(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ke,{onClose:d}):t.jsx(ae,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:U,onChangeDraftField:O,onChangeDraftValue:_,onSubmitClause:K,onCancelClause:()=>u(void 0),onChangeMatchOperator:Q,onChangeMove:G,onCreateFolder:F,onChangeLabel:H,onCreateLabel:M,onChangeName:J,onChangeScope:V,onChangeUntil:q,onCommit:W,onCancel:d})}function _e(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ke({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Ue({preview:e,blocked:s,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:s,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Qe({progress:e,isDone:s,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!s&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),s&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),s&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ge({onRetry:e,onClose:s}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function He({accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Se(),n=t.jsx(Be,{accountId:e,filter:s,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(Fe,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:s,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ie(n,f),m=l==="Expired",u=n.actionMailboxId!==S?s(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Me(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(ne,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const s=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=we(s),{deleteFilter:f,deletingFilterId:n}=Ee(s),[l,m]=x.useState(),{data:u}=P({...ce({path:{accountId:s}}),staleTime:1/0}),h=De(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),I=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return me(w,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>Ae({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),y=Le(u?.items??[]),{labels:v}=Te(s),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),M=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),M&&t.jsx(He,{accountId:s,filter:M,folders:C,delimiter:y,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:I,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function it(){const e=ue(),[s,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:s,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,it as component};
@@ -1 +0,0 @@
1
- const n=()=>null;export{n as component};
@@ -1 +0,0 @@
1
- import{j as e,B as j,T as R,_ as G,r as u,D as H,X as V,cq as le,cc as Y,v as ie,cN as W,cO as ce,cb as de,l as me,cP as xe,af as U,aC as X,c3 as Z,cQ as ue,cR as he,by as fe,bW as J,aI as L,aw as ee,L as q,N as se,F as pe,G as ge,au as be,aK as te,aS as je,cn as ve,cp as Ne,av as ye,aN as B,cS as Ce,cT as ke,cU as Me,cV as we}from"./index-xOALrEh8.js";import{P as Ie}from"./pencil-CZK87pI9.js";import{S as Se}from"./settings-screen-C7xmJsXG.js";import{c as Oe,d as P,e as Ae,g as De,i as K,a as ae,u as re,b as Ee,m as Q,h as Te}from"./move-options-B2c-WWEl.js";import{E as ne}from"./ErrorState-DiX_zNTK.js";import"./avatar-Ci3CMhdo.js";const Pe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:l,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=l?`${r(s)} — ${l}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:l,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-label":c,disabled:l!==void 0,onClick:t})})]})},Fe=({folders:s,onRename:n,onDelete:t,onCreateFolder:l,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(G,{folders:s,onCreateFolder:l,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Pe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},Re=({open:s,folderLabel:n,defaultLabel:t,name:l,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const i=u.useId(),p=`Rename ${n}`;return s?e.jsxs(H,{open:s,onClose:c,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(le,{htmlFor:i,children:"Folder name"}),e.jsx(Y,{id:i,value:l,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},Le=["inbox","drafts","sent","archive","junk","trash"],z="";function ze(s){const n=s.messageCount===1?"msg":"msgs";return`${W(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:l,onAppoint:d,onRename:r}){const[c,o]=u.useState(l),a=n.find(m=>m.mailboxId===t)??null,i=xe(s),p=a!=null&&c.trim()!==l.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[ce(s),i]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??z,"aria-label":`Folder for ${i}`,onChange:m=>d(s,m.target.value===z?null:m.target.value),children:[e.jsx("option",{value:z,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:ze(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:i,"aria-label":`Display name for ${i}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:l={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Le.map(a=>{const i=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:i,displayName:i?l[i]??"":"",onAppoint:d,onRename:r},a)})}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:o.map(a=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(ie,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:W(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,qe=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:qe(n)})),Be=async(s,n,t,l)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(l.aborted)return d;const{data:o}=await J({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},Ke=async(s,n)=>{let t=0,l;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await J({path:{mailboxId:s},query:{order:"desc",continuationToken:l},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;l=r.continuationToken}return t};function Qe({accountId:s,mailboxId:n,onDeleted:t}){const l=U(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,i]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{l.invalidateQueries({queryKey:X({path:{accountId:s}})}),l.invalidateQueries({queryKey:Z()})},[l,s]),y=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){i(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),i(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){i(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(Be(n,k,De,f));if(f.aborted)return;if(!v.ok){h=P(h,v.error),o(h),i(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=P(h,A.error),o(h),i(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const N=await T(Ke(n,f));if(!f.aborted){if(!N.ok){h=P(h,N.error),o(h),i(N.error),r("error");return}if(N.value>0){const v=`${N.value} ${N.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=P(h,v),o(h),i(v),r("error"),m();return}await y()}},[n,C,y,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),i(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:y,moveThenDelete:w,cancel:E,reset:D}}const F=s=>`${s} ${s===1?"email":"emails"}`;function Ge({open:s,accountId:n,folder:t,mailboxes:l,appointments:d,onClose:r}){const[c,o]=u.useState(()=>K(t.messageCount)),[a,i]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:y,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Qe({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(K(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&i(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:l,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[l,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>L(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const N=`Delete ${k}`,v=y==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:C?Q(C):"Moved 0 of 0"})]}):y==="deleting"||y==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(q,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):y==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[Q(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",F(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(R,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>o("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(pe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k})," and its"," ",F(t.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",F(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(G,{folders:I,selectedId:a,delimiter:l[0]?.hierarchyDelimiter??"/",onSelect:i,onCreateFolder:p,onCancel:()=>{i(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${F(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(H,{open:s,onClose:f,title:N,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:N}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const He=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function Ve({account:s}){const n=U(),t=s.accountId,l=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(ye({path:{accountId:t}})),{createFolderIn:i}=ae(t),p=B({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:Z()})}}),m=B({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:X({path:{accountId:t}})})}}),[y,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:L(x,f.get(x.mailboxId),l),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,l,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const N=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(y);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:N,appointments:v,displayNames:M,onAppoint:h,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Fe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:i,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(Re,{open:!0,folderLabel:L(S,f.get(S.mailboxId),l),defaultLabel:L({fullPath:S.fullPath},f.get(S.mailboxId),l),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(Ge,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function es(){const s=be(),[n,t]=u.useState(!0),{data:l,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=i=>{const p=Ne[i];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:He,helpOpen:n,onToggleHelp:()=>t(i=>!i),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):l.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:l.accounts.map(i=>e.jsx(Ve,{account:i},i.accountId))})})}export{es as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-xOALrEh8.js";import{E as t}from"./ErrorState-DiX_zNTK.js";const n=({error:e,reset:o})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(t,{title:"Couldn't load your mailboxes",error:e,onRetry:o})});export{n as errorComponent};
@@ -1 +0,0 @@
1
- const n=()=>null;export{n as component};
@@ -1 +0,0 @@
1
- import{j as t,c4 as o}from"./index-xOALrEh8.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};