progon-agent 1.5.2 → 1.5.3

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 (57) hide show
  1. package/dist/supervisor/cli.js +75 -75
  2. package/extension-bundle.json +3 -3
  3. package/extension-dist/background/background.js +101 -95
  4. package/extension-dist/card/card.html +10 -9
  5. package/extension-dist/card/card.js +3 -3
  6. package/extension-dist/chunks/shared-B3glEBMw.js +1 -0
  7. package/extension-dist/chunks/shared-B9oC2P3-.js +8 -0
  8. package/extension-dist/chunks/shared-BByPq6Kh.js +1 -0
  9. package/extension-dist/chunks/shared-BMIAtDPv.js +45 -0
  10. package/extension-dist/chunks/shared-BTOXSk0k.js +118 -0
  11. package/extension-dist/chunks/{shared-VvEftNwZ.js → shared-C-Q9DKcM.js} +1 -1
  12. package/extension-dist/chunks/shared-C4rk8dhz.js +1 -0
  13. package/extension-dist/chunks/shared-CHDbyhV4.js +1 -0
  14. package/extension-dist/chunks/shared-CmGCWsjS.js +15 -0
  15. package/extension-dist/chunks/shared-D7P2v9Mb.js +372 -0
  16. package/extension-dist/chunks/shared-DKBOqKL2.css +1 -0
  17. package/extension-dist/chunks/shared-Dnq0mR_F.css +1 -0
  18. package/extension-dist/chunks/shared-Dor6Qf-t.js +1 -0
  19. package/extension-dist/chunks/shared-DwL_iWMx.js +1 -0
  20. package/extension-dist/chunks/shared-GBy7ssZb.js +1 -0
  21. package/extension-dist/chunks/shared-gmwevruS.js +159 -0
  22. package/extension-dist/chunks/shared-iMtAwxmT.js +351 -0
  23. package/extension-dist/chunks/shared-mCuRTIv8.js +129 -0
  24. package/extension-dist/chunks/shared-rQyAr3p-.js +1 -0
  25. package/extension-dist/chunks/shared-yvJVPBBs.css +1 -0
  26. package/extension-dist/content/content.js +205 -205
  27. package/extension-dist/content/frame.js +80 -80
  28. package/extension-dist/manifest.json +32 -29
  29. package/extension-dist/offscreen/offscreen.html +3 -2
  30. package/extension-dist/offscreen/offscreen.js +1 -1
  31. package/extension-dist/popup/popup.css +1 -1
  32. package/extension-dist/popup/popup.html +9 -8
  33. package/extension-dist/popup/popup.js +9 -3
  34. package/extension-dist/sidepanel/sidepanel.css +1 -1
  35. package/extension-dist/sidepanel/sidepanel.html +12 -11
  36. package/extension-dist/sidepanel/sidepanel.js +1 -1
  37. package/extension-dist/workspace/workspace.html +13 -11
  38. package/extension-dist/workspace/workspace.js +48 -54
  39. package/npm-shrinkwrap.json +2 -2
  40. package/package.json +2 -2
  41. package/extension-dist/chunks/shared--PKAvBPy.js +0 -1
  42. package/extension-dist/chunks/shared-0jT00uC5.js +0 -317
  43. package/extension-dist/chunks/shared-8TdX8bnw.js +0 -1
  44. package/extension-dist/chunks/shared-BBwL-FWr.js +0 -8
  45. package/extension-dist/chunks/shared-BECVQaqd.js +0 -1
  46. package/extension-dist/chunks/shared-BYkDbcM2.js +0 -372
  47. package/extension-dist/chunks/shared-BdaUsVif.css +0 -1
  48. package/extension-dist/chunks/shared-CDlAJRnF.js +0 -117
  49. package/extension-dist/chunks/shared-CQ5Ygj2p.js +0 -1
  50. package/extension-dist/chunks/shared-CnMBv8Ku.js +0 -1
  51. package/extension-dist/chunks/shared-CyNKhHOY.js +0 -1
  52. package/extension-dist/chunks/shared-D3X5MuUz.js +0 -1
  53. package/extension-dist/chunks/shared-D7GfVHk0.js +0 -129
  54. package/extension-dist/chunks/shared-U9lBnzuH.js +0 -33
  55. package/extension-dist/chunks/shared-fJPHxpB5.css +0 -1
  56. package/extension-dist/chunks/shared-o0-3vI--.js +0 -193
  57. package/extension-dist/chunks/shared-uKTblxo0.js +0 -15
@@ -1,15 +0,0 @@
1
- import{r as e}from"./shared-XKyaHtl9.js";import{Br as t,Bs as n,Cs as r,Fi as i,Hr as a,Ja as o,Kn as s,Oi as c,Ri as l,Sr as u,Ti as d,Vr as f,Yn as p,_o as m,as as h,bo as g,di as _,do as v,ho as y,mo as b,os as x,pl as S,po as C,qa as w,qn as T,ro as ee,ui as te,uo as ne,yo as E,zi as D}from"./shared-0jT00uC5.js";import{$a as O,Ka as re,Ua as ie,eo as ae,io as k,t as A}from"./shared-CDlAJRnF.js";import{f as j,l as oe,o as M,s as se}from"./shared-U9lBnzuH.js"
2
- /**
3
- * @license lucide-react v0.574.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- ;var ce=E(`bell-off`,[[`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`}]]),le=E(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ue=A(`pgs-c323e6f59d`)
9
- /**
10
- * @license lucide-react v0.574.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- ;function de(){return{start(e,t){let n=!1,r=null,i=null,a=0,o=e=>{n||(ue.error(`pgm-9dc91cfaa1`,{windowId:r,error:e.message}),t(e))},s=t=>{n||t===i||(i=t,e(t))},c=()=>{if(r===null)return;let e=++a;chrome.tabs.query({active:!0,windowId:r}).then(t=>{var n;if(e!==a)return;let i=(n=t[0])==null?void 0:n.id;i===void 0?o(/* @__PURE__ */ Error(`The window ${String(r)} of this document has no active tab`)):s(i)},e=>{o(N(e))})},l=e=>{e.windowId===r&&(a+=1,s(e.tabId))},u=e=>{e===r&&c()};return chrome.windows.getCurrent().then(e=>{n||(e.id===void 0?o(/* @__PURE__ */ Error(`chrome.windows.getCurrent() answered a window without an id`)):(r=e.id,chrome.tabs.onActivated.addListener(l),chrome.windows.onFocusChanged.addListener(u),c()))},e=>{o(N(e))}),()=>{n=!0,chrome.tabs.onActivated.removeListener(l),chrome.windows.onFocusChanged.removeListener(u)}}}}function N(e){return e instanceof Error?e:Error(String(e))}var P=/* @__PURE__ */ e(x(),1),F=h(),fe={on:`bg-success shadow-(--glow-status-success)`,neutral:`bg-fg-muted`,warning:`bg-warning`},pe={on:`text-fg-muted`,neutral:`text-fg-muted`,warning:`text-fg-warning`,error:`text-fg-error`};function I({tone:e,error:t,children:n,announce:r=!1,retry:a,hint:o,className:s,"data-testid":c}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{role:e===`error`?`alert`:r?`status`:void 0,className:D(`flex items-start gap-1.75 text-xs leading-(--leading-caption)`,pe[e],s),"data-testid":c,children:[e===`error`?/* @__PURE__ */ (0,F.jsx)(b,{"aria-hidden":`true`,className:`mt-px size-3.5 flex-none`}):/* @__PURE__ */ (0,F.jsx)(`i`,{"aria-hidden":`true`,className:D(`mt-1.25 size-1.75 flex-none rounded-full`,fe[e])}),/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`min-w-0`,children:[/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[/* @__PURE__ */ (0,F.jsxs)(`span`,{children:[n,o!==void 0&&/* @__PURE__ */ (0,F.jsxs)(F.Fragment,{children:[` `,/* @__PURE__ */ (0,F.jsx)(`span`,{className:`inline-flex align-middle`,children:/* @__PURE__ */ (0,F.jsx)(w,{size:`sm`,name:o.name,text:o.text})})]})]}),a!==void 0&&/* @__PURE__ */ (0,F.jsx)(i,{variant:`link`,size:`xs`,loading:a.retrying===!0,onClick:a.onRetry,children:a.label})]}),e===`error`&&t!==void 0&&/* @__PURE__ */ (0,F.jsx)(_,{error:t,form:`line`,className:`mt-0.5`})]})]})}var L={pending:null,saving:!1,failure:null};function R(e){let[t,n]=(0,P.useState)(()=>/* @__PURE__ */ new Map),r=(0,P.useRef)(e);(0,P.useEffect)(()=>{r.current=e});let i=(0,P.useRef)(/* @__PURE__ */ new Map),a=(0,P.useRef)(null);(0,P.useEffect)(()=>{let e=new AbortController;a.current=e;let t=i.current;return()=>{e.abort();for(let e of t.values())e.next=null}},[]);let o=(0,P.useCallback)((e,t)=>{n(n=>{let r={...n.get(e)??L,...t},i=new Map(n);return r.pending===null&&!r.saving&&r.failure===null?i.delete(e):i.set(e,r),i})},[]),s=(0,P.useCallback)(async(e,t)=>{if(t.running)return;if(a.current===null)throw Error(`useSettingSaves: a save before the owner mounted`);t.running=!0;let n=a.current.signal;t.failure=null,o(e,{saving:!0,failure:null});let i=null,s=null,c=null;try{for(;;){let a=t.next;if(a!==null){t.next=null;try{let n=await r.current.write(e,a.value);i=a,t.confirmDue={reply:n},s=null}catch(c){r.current.onWriteError(e,c,a.value),t.next===null&&(s={step:`write`,value:a.value,error:c},n.aborted||o(e,{pending:i}))}continue}let l=t.confirmDue;if(l===null)break;t.confirmDue=null;try{await r.current.confirm(e,l.reply,n),c=null,t.failedConfirm=null}catch(e){c={step:`confirm`,error:e},t.failedConfirm=l}}}finally{t.running=!1,t.failure=c===null?s:c,n.aborted||o(e,{pending:null,saving:!1,failure:t.failure})}},[o]),c=(0,P.useCallback)((e,t)=>{let n=i.current.get(e);n===void 0&&(n={next:null,confirmDue:null,failure:null,failedConfirm:null,running:!1},i.current.set(e,n)),n.next={value:t},n.failure=null,o(e,{pending:{value:t},failure:null}),s(e,n)},[s,o]),l=(0,P.useCallback)(e=>{let t=i.current.get(e);if(t===void 0||t.failure===null)throw Error(`useSettingSaves: nothing failed to retry`);let n=t.failure;if(n.step===`write`){c(e,n.value);return}let r=t.failedConfirm;if(r===null)throw Error(`useSettingSaves: the failed confirmation has no reply`);t.confirmDue=r,t.failure=null,o(e,{failure:null}),s(e,t)},[c,s,o]);return{state:(0,P.useCallback)(e=>t.get(e)??L,[t]),choose:c,retry:l}}var z=`setting`;function me(e){let t=R({write:(t,n)=>e.write(n),confirm:(t,n,r)=>e.confirm(n,r),onWriteError:(t,n,r)=>e.onWriteError(n,r)}),{choose:n,retry:r}=t,i=(0,P.useCallback)(e=>n(z,e),[n]),a=(0,P.useCallback)(()=>r(z),[r]);return{...t.state(z),choose:i,retry:a}}var B=A(`pgs-1f4abfc72f`);function V(e){return e instanceof Error?e.message:String(e)}function he(e,t){r.call(`OPEN_NOTIFICATION_TARGET`,{notificationId:e.id,target:e.target,windowId:t}).then(t=>{t.success||B.error(`pgm-9d95f41149`,{notificationId:e.id,error:t.error})},t=>{B.error(`pgm-75d229efd3`,{notificationId:e.id,error:V(t)})})}function ge(e){r.call(`NOTIFICATIONS_REFRESH`).then(t=>{t.success||B.warn(`pgm-f7016cc548`,{cause:e,error:t.error})},t=>{B.error(`pgm-da30882b0d`,{cause:e,error:V(t)})})}var H=`notifications:snapshot`,U=ie({offset:!0}),_e=ae({userId:k().min(1),waitingCount:O().int().min(0),unseenCount:O().int().min(0),attentionToken:k().min(1),disabledGroups:re(k().min(1)),nextExpiryAt:U.nullable(),fetchedAt:U}).strict();function W(e){return e===void 0?null:_e.parse(e)}function ve(e,t){if(e.length!==t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function ye(e){let t=(t,n)=>{if(n!==`local`)return;let r=t[H];r!==void 0&&e(W(r.newValue))};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}var be=A(`pgs-f455a5ff56`);function xe(e,t){return e===null||t===null?e!==t:e.userId!==t.userId||e.attentionToken!==t.attentionToken||t.unseenCount>e.unseenCount||!ve(e.disabledGroups,t.disabledGroups)}function Se(e){let[t,n]=(0,P.useState)({status:`loading`});if((0,P.useEffect)(()=>{let e=!0,t=!1,r=e=>{n(t=>t.status===`ready`?{status:`ready`,snapshot:e,revision:xe(t.snapshot,e)?t.revision+1:t.revision}:{status:`ready`,snapshot:e,revision:0})},i=t=>{if(!e)return;let r=t instanceof Error?t:Error(String(t));be.error(`pgm-bbac8e31b8`,{error:r.message}),n({status:`failed`,error:r})},a=ye(n=>{e&&(t=!0,r(n))});return chrome.storage.local.get(H).then(n=>{if(e&&!t)try{r(W(n[H]))}catch(e){i(e)}},e=>{i(e)}),()=>{e=!1,a()}},[]),t.status===`failed`)throw t.error;return t.status===`loading`||t.snapshot===null||t.snapshot.userId===e?t:{status:`ready`,snapshot:null,revision:t.revision}}var Ce=A(`pgs-c9315bb341`);function we(){let[e,t]=(0,P.useState)({status:`loading`});if((0,P.useEffect)(()=>{let e=!0;return chrome.windows.getCurrent().then(n=>{e&&(n.id===void 0?t({status:`failed`,error:/* @__PURE__ */ Error(`chrome.windows.getCurrent() answered a window without an id`)}):t({status:`ready`,windowId:n.id}))},n=>{if(!e)return;let r=n instanceof Error?n:Error(String(n));Ce.error(`pgm-2ad602d0e7`,{error:r.message}),t({status:`failed`,error:r})}),()=>{e=!1}},[]),e.status===`failed`)throw e.error;return e.status===`ready`?e.windowId:void 0}var G=99,Te={web:`chrome`,popup:`notification-window`,panel:`notification-window`};function Ee(e,t){if(t===null)return e(`notifications.bell.name`);let n=[];return t.waitingCount>0&&n.push(e(`notifications.bell.waiting`,{count:t.waitingCount})),t.unseenCount>0&&n.push(e(`notifications.bell.unseen`,{count:t.unseenCount})),n.length===0?e(`notifications.bell.name`):e(`notifications.bell.nameWithCounts`,{counts:n.join(`, `)})}function De({host:e,t,counts:n,onClick:r,popoverOpen:i,ref:a}){let o=n===null?0:n.waitingCount+n.unseenCount,[s,c]=(0,P.useState)(o),[l,u]=(0,P.useState)(0);o!==s&&(c(o),o>s&&u(e=>e+1));let d=Ee(t,n),f=i===!0,m=n!==null&&n.waitingCount>0,h=/* @__PURE__ */ (0,F.jsxs)(`button`,{ref:a,type:`button`,onClick:r,...i===void 0?{}:{"aria-haspopup":`dialog`,"aria-expanded":f},...f?{"aria-label":d}:{},className:D(`relative inline-grid size-8 flex-none cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 transition-[background-color,color,transform] duration-(--motion-short) ease-(--ease-out) hover:bg-surface-hover-layer hover:text-fg-primary focus-visible:outline-2 focus-visible:outline-stroke-focus active:scale-[.94] active:duration-(--motion-instant)`,o>0?`text-fg-primary`:`text-fg-muted`,f?`bg-surface-active-layer text-fg-primary`:``),children:[/* @__PURE__ */ (0,F.jsx)(le,{"aria-hidden":`true`,className:D(`size-[18px] origin-[50%_2px]`,l>0?`animate-notification-bell-ring motion-reduce:animate-none`:``)},l),o>0?/* @__PURE__ */ (0,F.jsx)(p,{tone:m?`primary`:`quiet`,ring:Te[e],children:o>G?`${G}+`:o}):null]});return/* @__PURE__ */ (0,F.jsx)(g,{relationship:`label`,content:d,placement:`bottom-end`,disabled:f,children:h})}var K={conversation:ee,page:ne},Oe={answered:m,cancelled:o,expired:j},ke={neutral:null,positive:C,negative:b},Ae={answered:`notifications.resolution.answered`,cancelled:`notifications.resolution.cancelled`,expired:`notifications.resolution.expired`};function q(e){if(e.class===`action_required`)return e.resolution===null?K[e.target.kind]:Oe[e.resolution];let t=ke[e.tone];return t===null?K[e.target.kind]:t}function je(e){return e.class!==`informational`||e.tone===`neutral`?null:e.tone}function Me(e,t,n){return t.kind===`conversation`?{label:e(`notifications.action.openChat`),mark:/* @__PURE__ */ (0,F.jsx)(y,{"aria-hidden":`true`}),external:!1}:n===`web`?{label:e(`notifications.action.go`),mark:/* @__PURE__ */ (0,F.jsx)(y,{"aria-hidden":`true`}),external:!1}:{label:e(`notifications.action.openInWeb`),mark:/* @__PURE__ */ (0,F.jsx)(v,{"aria-hidden":`true`}),external:!0}}var Ne=6e4,J=60,Y=1440;function X(e,t){let n=Math.floor(t/Ne);return n<1?e(`notifications.duration.lessThanMinute`):n<J?e(`notifications.duration.minutes`,{count:n}):n<Y?e(`notifications.duration.hours`,{count:Math.floor(n/J)}):e(`notifications.duration.days`,{count:Math.floor(n/Y)})}function Z(e,t){return t.project!==null&&t.body!==``?e(`notifications.projectLine`,{project:t.project.name,body:t.body}):t.project===null?t.body===``?null:t.body:t.project.name}var Pe=[`today`,`yesterday`,`earlier`],Fe={today:`notifications.feed.today`,yesterday:`notifications.feed.yesterday`,earlier:`notifications.feed.earlier`};function Ie(e,t){return e(Fe[t])}function Q(e,t){let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()-t).getTime()}function Le(e,t){let n=Date.parse(e);return n>=Q(t,0)?`today`:n>=Q(t,1)?`yesterday`:`earlier`}var Re=/* @__PURE__ */ new Map,ze=/* @__PURE__ */ new Map;function Be(e){let t=Re.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`}),Re.set(e,t)),t}function Ve(e,t){let n=`${e}:${t?`y`:`-`}`,r=ze.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t?{day:`numeric`,month:`short`,year:`numeric`}:{day:`numeric`,month:`short`}),ze.set(n,r)),r}function He(e,t,n,r){let i=Date.parse(n);switch(Le(n,r)){case`today`:return X(e,r-i);case`yesterday`:return Be(t).format(i);case`earlier`:return Ve(t,new Date(i).getFullYear()!==new Date(r).getFullYear()).format(i)}}var Ue=`overflow-hidden rounded-lg border border-[color-mix(in_srgb,var(--color-primary)_var(--notification-deck-edge),var(--color-border))] bg-[color-mix(in_srgb,var(--color-primary)_var(--notification-deck-tint),var(--nf-surface))] shadow-[var(--shadow-md),var(--glow-primary-sm)] animate-notification-deck-in motion-reduce:animate-none`,We=`border-0 border-t border-t-[color-mix(in_srgb,var(--color-primary)_20%,transparent)]`,Ge=`hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)] active:bg-[color-mix(in_srgb,var(--color-primary)_15%,transparent)]`;function Ke({entries:e,count:t,host:n,t:r,now:i,onOpen:a,onLeft:o,footer:s,className:c}){let l=(0,P.useId)();return/* @__PURE__ */ (0,F.jsxs)(`section`,{"aria-labelledby":l,className:D(Ue,c),children:[/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`flex items-center gap-2 pt-[9px] pr-3 pb-[7px] pl-[calc(var(--nf-x)-1px)]`,children:[/* @__PURE__ */ (0,F.jsx)(`i`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-(--color-primary-400) shadow-[0_0_0_3px_var(--color-ring-primary-25)] animate-pulse-dot`}),/* @__PURE__ */ (0,F.jsx)(`h3`,{id:l,className:`m-0 text-(length:--text-body-sm) leading-5 font-semibold tracking-[-0.1px] text-fg-on-primary-tint`,children:r(`notifications.deck.title`)}),/* @__PURE__ */ (0,F.jsx)(`span`,{className:`h-5 min-w-5 rounded-full bg-primary px-1.5 text-center text-(length:--text-caption) leading-5 font-semibold text-fg-on-accent tabular-nums`,children:t})]}),e.map(e=>/* @__PURE__ */ (0,F.jsx)(qe,{entry:e,host:n,t:r,now:i,onOpen:a,onLeft:o},e.item.id)),s===void 0?null:/* @__PURE__ */ (0,F.jsxs)(`button`,{type:`button`,onClick:s.onClick,className:`flex h-9 w-full cursor-pointer items-center gap-1.5 bg-transparent pr-2.5 pl-[calc(var(--nf-x)-1px)] text-left text-(length:--text-body-sm) font-medium text-(--color-primary-text) focus-visible:rounded-md focus-visible:outline-2 focus-visible:-outline-offset-3 focus-visible:outline-stroke-focus [&_svg]:ml-auto [&_svg]:size-3.5 ${We} hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)]`,children:[s.label,/* @__PURE__ */ (0,F.jsx)(y,{"aria-hidden":`true`})]})]})}function qe({entry:e,host:t,t:n,now:r,onOpen:i,onLeft:a}){let{item:o,leaving:s}=e,c=q(o),l=Z(n,o),u=Me(n,o.target,t),d=Je(o,r);return/* @__PURE__ */ (0,F.jsxs)(`button`,{type:`button`,"data-feed-row":``,onClick:()=>i(o),onAnimationEnd:e=>{s&&e.target===e.currentTarget&&a(o.id)},className:D(`group relative grid w-full cursor-pointer grid-cols-[32px_minmax(0,1fr)_auto] items-center gap-x-3 bg-transparent pt-2.5 pr-2 pb-3 pl-[calc(var(--nf-x)-1px)] text-left text-inherit transition-[background-color] duration-(--motion-short) ease-(--ease-out) focus-visible:rounded-md focus-visible:outline-2 focus-visible:-outline-offset-3 focus-visible:outline-stroke-focus @max-[350px]:gap-x-2.5`,We,Ge,s?`animate-notification-leave motion-reduce:[animation-duration:1ms]`:``),children:[/* @__PURE__ */ (0,F.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 place-items-center self-start rounded-md border border-[color-mix(in_srgb,var(--color-primary)_40%,transparent)] bg-surface-primary-tint-15 text-(--color-primary-text) [&_svg]:size-[15px]`,children:/* @__PURE__ */ (0,F.jsx)(c,{})}),/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,F.jsx)(`span`,{className:`text-sm leading-[1.35] font-semibold tracking-[-0.15px] text-fg-primary [overflow-wrap:anywhere]`,children:o.title}),l===null?null:/* @__PURE__ */ (0,F.jsx)(`span`,{className:`text-(length:--text-notification-detail) leading-[1.45] text-fg-secondary [overflow-wrap:anywhere]`,children:l}),/* @__PURE__ */ (0,F.jsx)(`span`,{className:`mt-[3px] flex items-center gap-[5px] text-xs leading-4 text-fg-secondary tabular-nums [&_svg]:size-3`,children:d===null?/* @__PURE__ */ (0,F.jsx)(`span`,{children:n(`notifications.deck.waitingFor`,{duration:X(n,r-Date.parse(o.createdAt))})}):/* @__PURE__ */ (0,F.jsxs)(F.Fragment,{children:[/* @__PURE__ */ (0,F.jsx)(j,{"aria-hidden":`true`}),/* @__PURE__ */ (0,F.jsx)(`span`,{children:n(`notifications.deck.timeLeft`,{duration:X(n,d.left)})})]})})]}),/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-0.5 rounded-sm pr-1 pl-2.5 text-(length:--text-body-sm) font-medium whitespace-nowrap text-(--color-primary-text) transition-[background-color] duration-(--motion-short) ease-(--ease-out) group-hover:bg-surface-primary-tint-15 [&_svg]:size-3.5 [&_svg]:transition-transform [&_svg]:duration-(--motion-medium) [&_svg]:ease-(--ease-out) @max-[350px]:w-6 @max-[350px]:justify-center @max-[350px]:p-0`,children:[/* @__PURE__ */ (0,F.jsx)(`span`,{className:`@max-[350px]:sr-only`,children:u.label}),/* @__PURE__ */ (0,F.jsx)(`span`,{className:D(`inline-flex`,u.external?``:`group-hover:[&_svg]:translate-x-0.5`),children:u.mark})]}),d===null?null:/* @__PURE__ */ (0,F.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-3 bottom-1 left-[calc(var(--nf-x)-1px)] h-0.5 overflow-hidden rounded-full bg-[color-mix(in_srgb,var(--color-primary)_20%,transparent)]`,children:/* @__PURE__ */ (0,F.jsx)(`i`,{className:`block h-full rounded-[inherit] bg-(--color-primary-400)`,style:{width:`${d.fraction*100}%`}})})]})}function Je(e,t){if(e.expiresAt===null)return null;let n=Date.parse(e.expiresAt),r=n-Date.parse(e.createdAt),i=Math.max(0,n-t);return{left:i,fraction:r>0?Math.min(1,i/r):0}}var Ye=`grid grid-cols-[32px_1fr_40px] items-center gap-3`,Xe=[`w-[70%]`,`w-[58%]`],Ze=[`w-[82%]`,`w-[64%]`,`w-[74%]`,`w-[52%]`];function $({width:e,inDeck:t}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{className:t?Ye:`${Ye} py-2 pr-2 pl-(--nf-x)`,children:[/* @__PURE__ */ (0,F.jsx)(u,{className:`size-7 rounded-sm`}),/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,F.jsx)(u,{className:`h-3 ${e}`}),/* @__PURE__ */ (0,F.jsx)(u,{className:`h-2.5 w-[34%]`})]}),/* @__PURE__ */ (0,F.jsx)(u,{className:`h-2.5 w-9`})]})}function Qe({label:e}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{role:`status`,"aria-label":e,children:[/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`mt-0.5 mb-2.5 grid gap-3 rounded-lg border border-stroke pt-3 pr-3 pb-3.5 pl-[calc(var(--nf-x)-1px)]`,children:[/* @__PURE__ */ (0,F.jsx)(u,{className:`h-3 w-[84px]`}),Xe.map(e=>/* @__PURE__ */ (0,F.jsx)($,{width:e,inDeck:!0},e))]}),/* @__PURE__ */ (0,F.jsx)(u,{className:`mt-3 mb-1.5 ml-(--nf-x) h-2.5 w-[60px]`}),Ze.map(e=>/* @__PURE__ */ (0,F.jsx)($,{width:e,inDeck:!1},e))]})}function $e({entries:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let o=/* @__PURE__ */ new Map;for(let t of e){let e=Le(t.item.createdAt,r),n=o.get(e);n===void 0?o.set(e,[t]):n.push(t)}return/* @__PURE__ */ (0,F.jsx)(F.Fragment,{children:Pe.map(e=>{let s=o.get(e);return s===void 0?null:/* @__PURE__ */ (0,F.jsx)(et,{title:Ie(t,e),rows:s,t,locale:n,now:r,onOpen:i,onLanded:a},e)})})}function et({title:e,rows:t,...n}){let r=(0,P.useId)();return/* @__PURE__ */ (0,F.jsxs)(F.Fragment,{children:[/* @__PURE__ */ (0,F.jsx)(`h3`,{id:r,className:`m-0 pt-2.5 pr-2 pb-[3px] pl-(--nf-x) text-xs leading-4 font-medium tracking-normal text-fg-muted`,children:e}),/* @__PURE__ */ (0,F.jsx)(`ul`,{"aria-labelledby":r,className:`m-0 grid list-none gap-px p-0`,children:t.map(e=>/* @__PURE__ */ (0,F.jsx)(`li`,{children:/* @__PURE__ */ (0,F.jsx)(ot,{entry:e,...n})},e.item.id))})]})}var tt={new:`font-semibold text-fg-primary`,seen:`font-medium text-fg-primary`,read:`font-normal text-fg-secondary`},nt=`border-stroke bg-surface-hover-layer text-fg-secondary`,rt=`border-stroke bg-surface-hover-layer text-fg-success`,it=D(c.error.edge,c.error.fill,c.error.ink),at=`border-dashed border-stroke-hover bg-transparent text-fg-muted`;function ot({entry:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let{item:o,reading:s,landed:c}=e,l=q(o),u=Z(t,o),d=o.class===`action_required`?o.resolution:null,f=je(o),p=d===null?f===`negative`?it:f===`positive`?rt:nt:at;return/* @__PURE__ */ (0,F.jsxs)(`button`,{type:`button`,"data-feed-row":``,"data-state":s,"data-tone":f===null?void 0:f,"data-closed":d===null?void 0:``,onClick:()=>i(o),onAnimationEnd:e=>{c&&e.target===e.currentTarget&&a(o.id)},className:D(`group grid w-full cursor-pointer grid-cols-[32px_minmax(0,1fr)_auto] items-start gap-x-3 rounded-md border-0 bg-transparent py-2 pr-2 pl-(--nf-x) text-left text-inherit transition-[background-color] duration-(--motion-instant) ease-(--ease-out) hover:bg-surface-hover-layer active:bg-surface-active-layer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-stroke-focus @max-[350px]:gap-x-2.5`,c?`animate-notification-land motion-reduce:[animation-duration:1ms]`:``),children:[/* @__PURE__ */ (0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-7 place-items-center justify-self-start rounded-sm border [&_svg]:size-3.5 ${p}`,children:/* @__PURE__ */ (0,F.jsx)(l,{})}),/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,F.jsx)(`span`,{className:`text-(length:--text-notification-title) leading-[1.35] tracking-[-0.1px] [overflow-wrap:anywhere] ${tt[s]}`,children:o.title}),u===null?null:/* @__PURE__ */ (0,F.jsx)(`span`,{className:`text-(length:--text-notification-detail) leading-[1.45] text-fg-muted [overflow-wrap:anywhere] group-hover:text-fg-secondary`,children:u}),d===null?null:/* @__PURE__ */ (0,F.jsx)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs leading-4 text-fg-muted`,children:t(Ae[d])})]}),/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`flex items-center gap-[7px] pt-0.5 text-xs leading-[18px] whitespace-nowrap text-fg-muted tabular-nums group-hover:text-fg-secondary`,children:[He(t,n,o.createdAt,r),s===`new`?/* @__PURE__ */ (0,F.jsxs)(F.Fragment,{children:[/* @__PURE__ */ (0,F.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-(--color-primary-400) shadow-[0_0_0_3px_var(--color-ring-primary-25)]`}),/* @__PURE__ */ (0,F.jsx)(`span`,{className:`sr-only`,children:t(`notifications.feed.new`)})]}):null]})]})}function st({children:e,align:t=`start`,className:n}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{role:`alert`,className:D(`flex gap-1.5 text-xs leading-[1.45] text-fg-error [&>svg]:size-3.5 [&>svg]:flex-none`,t===`start`?`items-start [&>svg]:mt-px`:`items-center`,n),children:[/* @__PURE__ */ (0,F.jsx)(b,{"aria-hidden":`true`}),e]})}function ct({onClick:e,children:t,size:n=`md`,className:r}){return/* @__PURE__ */ (0,F.jsx)(`button`,{type:`button`,onClick:e,className:D(`cursor-pointer rounded-xs border-0 bg-transparent px-0.5 font-medium text-(--color-primary-text) no-underline hover:underline hover:underline-offset-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-stroke-focus [&_svg]:ml-[3px] [&_svg]:inline [&_svg]:size-3 [&_svg]:align-[-1px]`,n===`md`?`py-1 text-(length:--text-body-sm)`:`py-0 text-xs`,r),children:t})}function lt(e,t){let n=e=>e.class===`action_required`&&e.open?0:1;return n(e)-n(t)||Date.parse(t.createdAt)-Date.parse(e.createdAt)||(e.id<t.id?-1:+(e.id>t.id))}function ut(e){return e.map(e=>e.id).join(`|`)}function dt(e){let t=e.filter(n),r=ut(t),[i,a]=(0,P.useState)(t),[o,s]=(0,P.useState)(r),[c,l]=(0,P.useState)(()=>/* @__PURE__ */ new Map),[u,d]=(0,P.useState)(()=>/* @__PURE__ */ new Set);if(o!==r){let o=new Set(t.map(e=>e.id)),c=new Set(e.filter(e=>!n(e)).map(e=>e.id)),u=i.filter(e=>!o.has(e.id)&&c.has(e.id));s(r),a(t),u.length>0&&l(e=>new Map([...e,...u.map(e=>[e.id,e])]))}let f=new Set(t.map(e=>e.id));return{deck:[...t.map(e=>({item:e,leaving:!1})),...[...c.values()].filter(e=>!f.has(e.id)).map(e=>({item:e,leaving:!0}))].sort((e,t)=>lt(e.item,t.item)),openCount:t.length,history:e.filter(e=>!n(e)&&!c.has(e.id)),landedIds:u,onLeft:e=>{l(t=>{let n=new Map(t);return n.delete(e),n}),d(t=>/* @__PURE__ */ new Set([...t,e]))},onLanded:e=>{d(t=>{let n=new Set(t);return n.delete(e),n})}}}function ft(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}async function pt(e,t,n,r){let i=[],a=0,o=0;for(;o<n;){let s=await e.list({locale:t,signal:r,limit:Math.min(500,n-o),offset:o});if(i=ft(i,s.items),a=s.total,o+=s.items.length,o>=s.total||s.items.length===0)break}return{items:i,total:a,nextOffset:o}}function mt(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var ht=2**31-1;function gt({api:e,locale:t,revision:r,logger:i,onSeen:a}){let[o,s]=(0,P.useState)({status:`loading`}),[c,l]=(0,P.useState)(0),[u,d]=(0,P.useState)(0),[f,p]=(0,P.useState)(()=>/* @__PURE__ */ new Set),m=M(),h=(0,P.useRef)(null),g=(0,P.useRef)(null),_=(0,P.useRef)(/* @__PURE__ */ new Set),v=(0,P.useRef)(a),y=(0,P.useRef)(i);(0,P.useEffect)(()=>{v.current=a,y.current=i});let b=(0,P.useCallback)(e=>{h.current=e,s({status:`ready`,data:e,more:`idle`})},[]);(0,P.useEffect)(()=>{var n;let r=new AbortController;(n=g.current)==null||n.abort();let i=h.current;return(async()=>{if(i===null){let[n,i]=await Promise.all([e.list({locale:t,signal:r.signal}),e.listGroups({locale:t,signal:r.signal})]);return{items:n.items,total:n.total,nextOffset:n.items.length,pageLimit:n.limit,groups:i.items}}let[n,a]=await Promise.all([pt(e,t,Math.max(i.nextOffset,i.pageLimit),r.signal),e.listGroups({locale:t,signal:r.signal})]);return{...n,pageLimit:i.pageLimit,groups:a.items}})().then(e=>{r.signal.aborted||b(e)},e=>{r.signal.aborted||(i===null?s({status:`error`,error:e,retrying:!1}):(y.current.error(`notification feed: re-read failed`,{error:e}),s({status:`ready`,data:i,more:`idle`})))}),()=>r.abort()},[e,t,r,c,u,b]);let x=(0,P.useCallback)(()=>{s(e=>e.status===`error`?{...e,retrying:!0}:e),l(e=>e+1)},[]),S=(0,P.useCallback)(()=>{var n;let r=h.current;if(r===null)throw Error(`notification feed: \u00AB\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0435\u0449\u0451\u00BB before the first page`);(n=g.current)==null||n.abort();let i=new AbortController;g.current=i,s({status:`ready`,data:r,more:`busy`}),e.list({locale:t,signal:i.signal,limit:r.pageLimit,offset:r.nextOffset}).then(e=>{if(i.signal.aborted)return;let t=h.current;t!==null&&b({...t,items:ft(t.items,e.items),total:e.total,nextOffset:t.nextOffset+e.items.length})},e=>{if(i.signal.aborted)return;y.current.error(`notification feed: next page failed`,{offset:r.nextOffset,error:e});let t=h.current;t!==null&&s({status:`ready`,data:t,more:`error`})})},[e,t,b]),C=o.status===`ready`?o.data.items:null;(0,P.useEffect)(()=>{if(C===null)return;let t=C.filter(e=>e.seenAt===null&&!_.current.has(e.id)).map(e=>e.id);if(t.length!==0){for(let e of t)_.current.add(e);p(e=>/* @__PURE__ */ new Set([...e,...t]));for(let n of mt(t,500))e.markSeen(n).then(e=>{var t;return(t=v.current)==null?void 0:t.call(v,e)},e=>{for(let e of n)_.current.delete(e);y.current.error(`notification feed: marking seen failed`,{count:n.length,error:e})})}},[e,C]);let w=C===null?null:C.reduce((e,t)=>{if(!n(t)||t.expiresAt===null)return e;let r=Date.parse(t.expiresAt);return e===null||r<e?r:e},null),T=(0,P.useRef)(null);return(0,P.useEffect)(()=>{if(w===null)return;let e=`${w}@${m}`;if(T.current===e)return;let t=w-Date.now();if(t>ht)return;let n=setTimeout(()=>{T.current=e,d(e=>e+1)},t);return()=>clearTimeout(n)},[w,m]),{load:o,freshIds:f,now:m,retry:x,loadMore:S}}var _t={web:`px-2 pt-1 pb-2.5`,popup:`px-2 pt-1.5 pb-3`,panel:`px-2.5 pt-2 pb-3.5`},vt=/* @__PURE__ */ new Set([`ArrowDown`,`ArrowUp`,`Home`,`End`]);function yt(e){var t;if(!vt.has(e.key))return;let n=[...e.currentTarget.querySelectorAll(`[data-feed-row]`)],r=n.findIndex(e=>e===document.activeElement);if(r===-1)return;let i=e.key===`Home`?0:e.key===`End`?n.length-1:e.key===`ArrowDown`?Math.min(n.length-1,r+1):Math.max(0,r-1);e.preventDefault(),(t=n[i])==null||t.focus()}function bt(e){let{api:t,locale:n,t:r,revision:i,logger:a,onSeen:o,host:s,onOpenSettings:c}=e,l=gt({api:t,locale:n,revision:i,logger:a,onSeen:o}),{load:u}=l,d=(0,P.useRef)(null),p=e.host===`web`?d:e.focusOnLeave;return/* @__PURE__ */ (0,F.jsxs)(`div`,{"data-host":s,className:`@container flex min-h-0 min-w-0 flex-col text-left [--nf-x:13px] ${s===`web`?`[--nf-surface:var(--color-bg-elevated)]`:`flex-1 [--nf-surface:var(--color-bg-notification-window)]`}`,children:[e.host===`web`?/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`flex flex-none items-center gap-2 pt-3 pr-2.5 pb-1.5 pl-[calc(8px+var(--nf-x))]`,children:[/* @__PURE__ */ (0,F.jsx)(`h2`,{ref:d,id:e.headingId,tabIndex:-1,className:`m-0 mr-auto rounded-xs text-base leading-6 font-semibold tracking-[-0.35px] text-fg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-stroke-focus`,children:r(`notifications.feed.title`)}),/* @__PURE__ */ (0,F.jsx)(g,{relationship:`label`,content:r(`notifications.feed.settings`),children:/* @__PURE__ */ (0,F.jsx)(te,{size:`sm`,icon:/* @__PURE__ */ (0,F.jsx)(oe,{"aria-hidden":`true`}),onClick:c})})]}):null,/* @__PURE__ */ (0,F.jsx)(`div`,{onKeyDown:yt,className:`min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--scrollbar-thumb)_transparent] [scrollbar-width:thin] ${_t[s]}`,children:u.status===`loading`?/* @__PURE__ */ (0,F.jsx)(Qe,{label:r(`notifications.feed.loading`)}):u.status===`error`?/* @__PURE__ */ (0,F.jsx)(xt,{host:s,children:/* @__PURE__ */ (0,F.jsx)(f,{tone:`error`,error:u.error,title:r(`notifications.feed.errorTitle`),onRetry:l.retry,retrying:u.retrying,focusOnLeave:p})}):/* @__PURE__ */ (0,F.jsx)(St,{...e,data:u.data,more:u.more,freshIds:l.freshIds,now:l.now,onLoadMore:l.loadMore})}),u.status===`ready`?/* @__PURE__ */ (0,F.jsx)(Ct,{host:s,t:r,data:u.data,onOpenSettings:c}):null]})}function xt({host:e,children:n}){return/* @__PURE__ */ (0,F.jsx)(t,{className:D(`p-2`,e===`popup`&&`min-h-80`),floor:`island`,children:n})}function St({host:e,t,locale:n,data:r,more:i,freshIds:a,now:o,onLoadMore:s,onOpenTarget:c,onOpenSettings:l,focusFirstRow:u}){let d=dt(r.items),[p,m]=(0,P.useState)(()=>/* @__PURE__ */ new Set),h=(0,P.useRef)(null),g=(0,P.useRef)(!1),_=r.items.length>0;(0,P.useEffect)(()=>{var e;u===!0&&!g.current&&_&&(g.current=!0,(e=h.current)==null||(e=e.querySelector(`[data-feed-row]`))==null||e.focus())},[u,_]);let y=e=>{m(t=>/* @__PURE__ */ new Set([...t,e.id])),c(e)},b=e=>e.readAt!==null||p.has(e.id)?`read`:e.seenAt===null||a.has(e.id)?`new`:`seen`;if(!_&&d.deck.length===0){let n=r.groups.length>0&&r.groups.every(e=>!e.enabled);return/* @__PURE__ */ (0,F.jsx)(xt,{host:e,children:n?/* @__PURE__ */ (0,F.jsx)(f,{tone:`empty`,icon:/* @__PURE__ */ (0,F.jsx)(ce,{"aria-hidden":`true`}),title:t(`notifications.feed.allOffTitle`),description:t(`notifications.feed.allOffText`),primary:e===`panel`?{label:t(`notifications.feed.configureInWeb`),icon:/* @__PURE__ */ (0,F.jsx)(v,{"aria-hidden":`true`}),onClick:l}:{label:t(`notifications.feed.openSettings`),onClick:l}}):/* @__PURE__ */ (0,F.jsx)(f,{tone:`empty`,icon:/* @__PURE__ */ (0,F.jsx)(le,{"aria-hidden":`true`}),title:t(`notifications.feed.emptyTitle`),description:t(`notifications.feed.emptyText`)})})}return/* @__PURE__ */ (0,F.jsxs)(`div`,{ref:h,children:[d.deck.length>0?/* @__PURE__ */ (0,F.jsx)(Ke,{entries:d.deck,count:d.openCount,host:e,t,now:o,onOpen:y,onLeft:d.onLeft,className:`mt-0.5 mb-1.5`}):null,/* @__PURE__ */ (0,F.jsx)($e,{entries:d.history.map(e=>({item:e,reading:b(e),landed:d.landedIds.has(e.id)})),t,locale:n,now:o,onOpen:y,onLanded:d.onLanded}),r.nextOffset<r.total?/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`mt-2 mb-0.5`,children:[i===`error`?/* @__PURE__ */ (0,F.jsx)(st,{className:`mb-1.5 ml-(--nf-x)`,children:/* @__PURE__ */ (0,F.jsx)(`span`,{children:t(`notifications.feed.loadMoreFailed`)})}):null,/* @__PURE__ */ (0,F.jsx)(se,{label:t(i===`error`?`common.retry`:`notifications.feed.loadMore`),loadingLabel:t(`notifications.feed.loadMore`),loading:i===`busy`,onLoadMore:s})]}):null]})}function Ct({host:e,t,data:n,onOpenSettings:r}){let i=n.groups.filter(e=>!e.enabled);return i.length===0||i.length===n.groups.length?null:/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`flex min-h-10 flex-none items-center gap-2 border-t border-stroke-light py-1.5 pr-2.5 pl-[calc(8px+var(--nf-x))] text-(length:--text-notification-detail) leading-[1.4] text-fg-secondary`,children:[/* @__PURE__ */ (0,F.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 flex-none text-fg-muted`}),/* @__PURE__ */ (0,F.jsxs)(`p`,{className:`m-0 min-w-0 flex-1`,children:[t(`notifications.feed.disabled`),` `,/* @__PURE__ */ (0,F.jsx)(`b`,{className:`font-medium text-fg-primary`,children:i.map(e=>e.title).join(`, `)})]}),/* @__PURE__ */ (0,F.jsx)(ct,{onClick:r,className:`flex-none`,children:e===`panel`?/* @__PURE__ */ (0,F.jsxs)(F.Fragment,{children:[t(`notifications.feed.configureInWeb`),/* @__PURE__ */ (0,F.jsx)(v,{"aria-hidden":`true`})]}):t(`notifications.feed.configure`)})]})}function wt({api:e,locale:t,t:r,waitingCount:i,revision:a,logger:o,onOpenTarget:s,onOpenFeed:c,onSeen:l,className:u}){let[d,f]=(0,P.useState)(null),p=M(),m=(0,P.useRef)(o),h=(0,P.useRef)(l);if((0,P.useEffect)(()=>{m.current=o,h.current=l}),(0,P.useEffect)(()=>{if(i===0)return;let r=new AbortController;return e.list({locale:t,limit:2,offset:0,signal:r.signal}).then(t=>{if(r.signal.aborted)return;let i=t.items.filter(n);f(i);let a=i.filter(e=>e.seenAt===null).map(e=>e.id);a.length!==0&&e.markSeen(a).then(e=>{var t;return(t=h.current)==null?void 0:t.call(h,e)},e=>m.current.error(`waiting strip: marking seen failed`,{count:a.length,error:e}))},e=>{r.signal.aborted||m.current.error(`waiting strip: read failed`,{error:e})}),()=>r.abort()},[e,t,i,a]),i===0||d===null||d.length===0)return null;let g=i-d.length;return/* @__PURE__ */ (0,F.jsx)(`div`,{className:D(`@container flex-none [--nf-x:13px] [--nf-surface:var(--color-bg-notification-window)]`,u),children:/* @__PURE__ */ (0,F.jsx)(Ke,{entries:d.map(e=>({item:e,leaving:!1})),count:i,host:`popup`,t:r,now:p,onOpen:s,onLeft:()=>void 0,footer:{label:g>0?r(`notifications.deck.moreAndAll`,{count:g}):r(`notifications.deck.all`),onClick:c}})})}var Tt=[[`w-[38%]`,`w-[74%]`],[`w-[52%]`,`w-[86%]`],[`w-[44%]`,`w-[68%]`]];function Et({api:e,locale:t,t:n,logger:r,onChanged:i}){let[a,o]=(0,P.useState)({status:`loading`}),[s,c]=(0,P.useState)(0);(0,P.useEffect)(()=>{let n=new AbortController;return e.listGroups({locale:t,signal:n.signal}).then(e=>{n.signal.aborted||o({status:`ready`,groups:e.items})},e=>{n.signal.aborted||o({status:`error`,error:e,retrying:!1})}),()=>n.abort()},[e,t,s]);let l=(0,P.useCallback)(e=>{o(t=>t.status===`ready`?{status:`ready`,groups:t.groups.map(t=>t.key===e.key?e:t)}:t)},[]),d=R({write:(n,r)=>e.setGroupEnabled(n,r,{locale:t}),confirm:(e,t,n)=>{n.aborted||(l(t),i==null||i(t))},onWriteError:(e,t,n)=>r.error(`notification groups: save failed`,{key:e,enabled:n,error:t})});return a.status===`loading`?/* @__PURE__ */ (0,F.jsx)(F.Fragment,{children:Tt.map(([e,t],r)=>/* @__PURE__ */ (0,F.jsxs)(T,{end:/* @__PURE__ */ (0,F.jsx)(u,{className:`h-5 w-9 rounded-full`}),children:[r===0?/* @__PURE__ */ (0,F.jsx)(`span`,{role:`status`,className:`sr-only`,children:n(`notifications.groups.loading`)}):null,/* @__PURE__ */ (0,F.jsxs)(`span`,{"aria-hidden":`true`,className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,F.jsx)(u,{className:`h-3.25 ${e}`}),/* @__PURE__ */ (0,F.jsx)(u,{className:`h-2.75 ${t}`})]})]},e))}):a.status===`error`?/* @__PURE__ */ (0,F.jsx)(T,{children:/* @__PURE__ */ (0,F.jsx)(f,{tone:`error`,error:a.error,title:n(`notifications.groups.loadFailed`),onRetry:()=>{o({...a,retrying:!0}),c(e=>e+1)},retrying:a.retrying})}):/* @__PURE__ */ (0,F.jsx)(F.Fragment,{children:a.groups.map(e=>/* @__PURE__ */ (0,F.jsx)(Dt,{group:e,t:n,save:d.state(e.key),onChoose:t=>d.choose(e.key,t),onRetry:()=>d.retry(e.key)},e.key))})}function Dt({group:e,t,save:n,onChoose:r,onRetry:i}){let o=d(),c=n.pending===null?e.enabled:n.pending.value;return/* @__PURE__ */ (0,F.jsx)(T,{"data-on":String(c),title:e.title,caption:e.description===``?void 0:e.description,end:/* @__PURE__ */ (0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-fg-muted`,children:[n.saving?/* @__PURE__ */ (0,F.jsx)(l,{}):null,/* @__PURE__ */ (0,F.jsx)(s,{checked:c,onChange:r,"aria-label":e.title})]}),children:n.failure===null?null:/* @__PURE__ */ (0,F.jsx)(I,{tone:`error`,error:n.failure.error,className:`mt-1.5`,retry:{label:t(`common.retry`),onRetry:i},children:a(t,o.has,n.failure.error,e=>S({t,has:o.has},e))})})}var Ot=`animate-[extension-view-in_var(--motion-medium)_var(--ease-out)_both]`,kt=`animate-[extension-view-back_var(--motion-medium)_var(--ease-out)_both]`;export{bt as a,Se as c,me as d,I as f,wt as i,he as l,Ot as n,De as o,de as p,Et as r,we as s,kt as t,ge as u};