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
@@ -0,0 +1,15 @@
1
+ import{r as e}from"./shared-XKyaHtl9.js";import{$i as t,Bo as n,Go as r,Ho as i,Is as a,Jo as o,Ko as s,Ld as c,Ls as l,Qs as u,Ri as d,So as f,Sr as p,Wo as m,Xo as h,Zo as g,Zr as _,fa as v,gi as y,hi as b,jo as ee,la as x,mi as S,na as C,pa as w,vc as T,wr as te,xo as ne,xr as re,zi as ie}from"./shared-iMtAwxmT.js";import{At as ae,Pt as E,ft as oe,kt as D,t as O,vt as se}from"./shared-BTOXSk0k.js";import{S as k,_ as ce,g as A,y as le}from"./shared-BMIAtDPv.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 j=h(`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`}]]),M=h(`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=O(`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(l(),1),F=a(),fe={on:`bg-success shadow-(--glow-status-success)`,neutral:`bg-fg-muted`,wait:`bg-(--color-primary-300) shadow-(--draft-dot) motion-safe:[animation:setting-wait_var(--motion-ambient)_var(--ease-in-out)_infinite]`,warning:`bg-warning`},pe={on:`text-fg-secondary`,neutral:`text-fg-muted`,wait:`text-(--color-primary-text)`,warning:`text-fg-warning`,error:`text-fg-error`};function I({tone:e,error:t,children:n,announce:i=!1,retry:a,hint:o,className:s,"data-testid":c}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{role:e===`error`?`alert`:i?`status`:void 0,className:w(`flex items-start gap-1.75 text-xs leading-(--leading-caption)`,pe[e],s),"data-testid":c,children:[e===`error`?/* @__PURE__ */ (0,F.jsx)(r,{"aria-hidden":`true`,className:`mt-px size-3.5 flex-none`}):/* @__PURE__ */ (0,F.jsx)(`i`,{"aria-hidden":`true`,className:w(`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)(ne,{size:`sm`,name:o.name,text:o.text})})]})]}),a!==void 0&&/* @__PURE__ */ (0,F.jsx)(x,{variant:`link`,size:`xs`,loading:a.retrying===!0,onClick:a.onRetry,children:a.label})]}),e===`error`&&t!==void 0&&/* @__PURE__ */ (0,F.jsx)(ie,{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=O(`pgs-1f4abfc72f`);function V(e){return e instanceof Error?e.message:String(e)}function he(e,t){u.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){u.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=oe({offset:!0}),_e=ae({userId:E().min(1),waitingCount:D().int().min(0),unseenCount:D().int().min(0),attentionToken:E().min(1),disabledGroups:se(E().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=O(`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=O(`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,p=n!==null&&n.waitingCount>0,m=/* @__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:w(`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)(M,{"aria-hidden":`true`,className:w(`size-[18px] origin-[50%_2px]`,l>0?`animate-notification-bell-ring motion-reduce:animate-none`:``)},l),o>0?/* @__PURE__ */ (0,F.jsx)(te,{tone:p?`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:m})}var K={conversation:ee,page:n},Oe={answered:o,cancelled:f,expired:k},ke={neutral:null,positive:m,negative:r},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)(s,{"aria-hidden":`true`}),external:!1}:n===`web`?{label:e(`notifications.action.go`),mark:/* @__PURE__ */ (0,F.jsx)(s,{"aria-hidden":`true`}),external:!1}:{label:e(`notifications.action.openInWeb`),mark:/* @__PURE__ */ (0,F.jsx)(i,{"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 $(e,t){let n=Date.parse(e);return n>=Q(t,0)?`today`:n>=Q(t,1)?`yesterday`:`earlier`}var Le=/* @__PURE__ */ new Map,Re=/* @__PURE__ */ new Map;function ze(e){let t=Le.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`}),Le.set(e,t)),t}function Be(e,t){let n=`${e}:${t?`y`:`-`}`,r=Re.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t?{day:`numeric`,month:`short`,year:`numeric`}:{day:`numeric`,month:`short`}),Re.set(n,r)),r}function Ve(e,t,n,r){let i=Date.parse(n);switch($(n,r)){case`today`:return X(e,r-i);case`yesterday`:return ze(t).format(i);case`earlier`:return Be(t,new Date(i).getFullYear()!==new Date(r).getFullYear()).format(i)}}var He=`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`,Ue=`border-0 border-t border-t-[color-mix(in_srgb,var(--color-primary)_20%,transparent)]`,We=`hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)] active:bg-[color-mix(in_srgb,var(--color-primary)_15%,transparent)]`;function Ge({entries:e,count:t,host:n,t:r,now:i,onOpen:a,onLeft:o,footer:c,className:l}){let u=(0,P.useId)();return/* @__PURE__ */ (0,F.jsxs)(`section`,{"aria-labelledby":u,className:w(He,l),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:u,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)(Ke,{entry:e,host:n,t:r,now:i,onOpen:a,onLeft:o},e.item.id)),c===void 0?null:/* @__PURE__ */ (0,F.jsxs)(`button`,{type:`button`,onClick:c.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 ${Ue} hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)]`,children:[c.label,/* @__PURE__ */ (0,F.jsx)(s,{"aria-hidden":`true`})]})]})}function Ke({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=qe(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:w(`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`,Ue,We,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)(k,{"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:w(`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 qe(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 Je=`grid grid-cols-[32px_1fr_40px] items-center gap-3`,Ye=[`w-[70%]`,`w-[58%]`],Xe=[`w-[82%]`,`w-[64%]`,`w-[74%]`,`w-[52%]`];function Ze({width:e,inDeck:t}){return/* @__PURE__ */ (0,F.jsxs)(`div`,{className:t?Je:`${Je} py-2 pr-2 pl-(--nf-x)`,children:[/* @__PURE__ */ (0,F.jsx)(_,{className:`size-7 rounded-sm`}),/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,F.jsx)(_,{className:`h-3 ${e}`}),/* @__PURE__ */ (0,F.jsx)(_,{className:`h-2.5 w-[34%]`})]}),/* @__PURE__ */ (0,F.jsx)(_,{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)(_,{className:`h-3 w-[84px]`}),Ye.map(e=>/* @__PURE__ */ (0,F.jsx)(Ze,{width:e,inDeck:!0},e))]}),/* @__PURE__ */ (0,F.jsx)(_,{className:`mt-3 mb-1.5 ml-(--nf-x) h-2.5 w-[60px]`}),Xe.map(e=>/* @__PURE__ */ (0,F.jsx)(Ze,{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=$(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=w(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:w(`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:[Ve(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:w(`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)(r,{"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:w(`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(T),n=ut(t),[r,i]=(0,P.useState)(t),[a,o]=(0,P.useState)(n),[s,c]=(0,P.useState)(()=>/* @__PURE__ */ new Map),[l,u]=(0,P.useState)(()=>/* @__PURE__ */ new Set);if(a!==n){let a=new Set(t.map(e=>e.id)),s=new Set(e.filter(e=>!T(e)).map(e=>e.id)),l=r.filter(e=>!a.has(e.id)&&s.has(e.id));o(n),i(t),l.length>0&&c(e=>new Map([...e,...l.map(e=>[e.id,e])]))}let d=new Set(t.map(e=>e.id));return{deck:[...t.map(e=>({item:e,leaving:!1})),...[...s.values()].filter(e=>!d.has(e.id)).map(e=>({item:e,leaving:!0}))].sort((e,t)=>lt(e.item,t.item)),openCount:t.length,history:e.filter(e=>!T(e)&&!s.has(e.id)),landedIds:l,onLeft:e=>{c(t=>{let n=new Map(t);return n.delete(e),n}),u(t=>/* @__PURE__ */ new Set([...t,e]))},onLanded:e=>{u(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:n,logger:r,onSeen:i}){let[a,o]=(0,P.useState)({status:`loading`}),[s,c]=(0,P.useState)(0),[l,u]=(0,P.useState)(0),[d,f]=(0,P.useState)(()=>/* @__PURE__ */ new Set),p=A(),m=(0,P.useRef)(null),h=(0,P.useRef)(null),g=(0,P.useRef)(/* @__PURE__ */ new Set),_=(0,P.useRef)(i),v=(0,P.useRef)(r);(0,P.useEffect)(()=>{_.current=i,v.current=r});let y=(0,P.useCallback)(e=>{m.current=e,o({status:`ready`,data:e,more:`idle`})},[]);(0,P.useEffect)(()=>{var n;let r=new AbortController;(n=h.current)==null||n.abort();let i=m.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||y(e)},e=>{r.signal.aborted||(i===null?o({status:`error`,error:e,retrying:!1}):(v.current.error(`notification feed: re-read failed`,{error:e}),o({status:`ready`,data:i,more:`idle`})))}),()=>r.abort()},[e,t,n,s,l,y]);let b=(0,P.useCallback)(()=>{o(e=>e.status===`error`?{...e,retrying:!0}:e),c(e=>e+1)},[]),ee=(0,P.useCallback)(()=>{var n;let r=m.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=h.current)==null||n.abort();let i=new AbortController;h.current=i,o({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=m.current;t!==null&&y({...t,items:ft(t.items,e.items),total:e.total,nextOffset:t.nextOffset+e.items.length})},e=>{if(i.signal.aborted)return;v.current.error(`notification feed: next page failed`,{offset:r.nextOffset,error:e});let t=m.current;t!==null&&o({status:`ready`,data:t,more:`error`})})},[e,t,y]),x=a.status===`ready`?a.data.items:null;(0,P.useEffect)(()=>{if(x===null)return;let t=x.filter(e=>e.seenAt===null&&!g.current.has(e.id)).map(e=>e.id);if(t.length!==0){for(let e of t)g.current.add(e);f(e=>/* @__PURE__ */ new Set([...e,...t]));for(let n of mt(t,500))e.markSeen(n).then(e=>{var t;return(t=_.current)==null?void 0:t.call(_,e)},e=>{for(let e of n)g.current.delete(e);v.current.error(`notification feed: marking seen failed`,{count:n.length,error:e})})}},[e,x]);let S=x===null?null:x.reduce((e,t)=>{if(!T(t)||t.expiresAt===null)return e;let n=Date.parse(t.expiresAt);return e===null||n<e?n:e},null),C=(0,P.useRef)(null);return(0,P.useEffect)(()=>{if(S===null)return;let e=`${S}@${p}`;if(C.current===e)return;let t=S-Date.now();if(t>ht)return;let n=setTimeout(()=>{C.current=e,u(e=>e+1)},t);return()=>clearTimeout(n)},[S,p]),{load:a,freshIds:d,now:p,retry:b,loadMore:ee}}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,f=(0,P.useRef)(null),p=e.host===`web`?f: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:f,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)(d,{size:`sm`,icon:/* @__PURE__ */ (0,F.jsx)(le,{"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)(b,{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:t}){return/* @__PURE__ */ (0,F.jsx)(S,{className:w(`p-2`,e===`popup`&&`min-h-80`),floor:`island`,children:t})}function St({host:e,t,locale:n,data:r,more:a,freshIds:o,now:s,onLoadMore:c,onOpenTarget:l,onOpenSettings:u,focusFirstRow:d}){let f=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;d===!0&&!g.current&&_&&(g.current=!0,(e=h.current)==null||(e=e.querySelector(`[data-feed-row]`))==null||e.focus())},[d,_]);let v=e=>{m(t=>/* @__PURE__ */ new Set([...t,e.id])),l(e)},y=e=>e.readAt!==null||p.has(e.id)?`read`:e.seenAt===null||o.has(e.id)?`new`:`seen`;if(!_&&f.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)(b,{tone:`empty`,icon:/* @__PURE__ */ (0,F.jsx)(j,{"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)(i,{"aria-hidden":`true`}),onClick:u}:{label:t(`notifications.feed.openSettings`),onClick:u}}):/* @__PURE__ */ (0,F.jsx)(b,{tone:`empty`,icon:/* @__PURE__ */ (0,F.jsx)(M,{"aria-hidden":`true`}),title:t(`notifications.feed.emptyTitle`),description:t(`notifications.feed.emptyText`)})})}return/* @__PURE__ */ (0,F.jsxs)(`div`,{ref:h,children:[f.deck.length>0?/* @__PURE__ */ (0,F.jsx)(Ge,{entries:f.deck,count:f.openCount,host:e,t,now:s,onOpen:v,onLeft:f.onLeft,className:`mt-0.5 mb-1.5`}):null,/* @__PURE__ */ (0,F.jsx)($e,{entries:f.history.map(e=>({item:e,reading:y(e),landed:f.landedIds.has(e.id)})),t,locale:n,now:s,onOpen:v,onLanded:f.onLanded}),r.nextOffset<r.total?/* @__PURE__ */ (0,F.jsxs)(`div`,{className:`mt-2 mb-0.5`,children:[a===`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)(ce,{label:t(a===`error`?`common.retry`:`notifications.feed.loadMore`),loadingLabel:t(`notifications.feed.loadMore`),loading:a===`busy`,onLoadMore:c})]}):null]})}function Ct({host:e,t,data:n,onOpenSettings:r}){let a=n.groups.filter(e=>!e.enabled);return a.length===0||a.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)(j,{"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:a.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)(i,{"aria-hidden":`true`})]}):t(`notifications.feed.configure`)})]})}function wt({api:e,locale:t,t:n,waitingCount:r,revision:i,logger:a,onOpenTarget:o,onOpenFeed:s,onSeen:c,className:l}){let[u,d]=(0,P.useState)(null),f=A(),p=(0,P.useRef)(a),m=(0,P.useRef)(c);if((0,P.useEffect)(()=>{p.current=a,m.current=c}),(0,P.useEffect)(()=>{if(r===0)return;let n=new AbortController;return e.list({locale:t,limit:2,offset:0,signal:n.signal}).then(t=>{if(n.signal.aborted)return;let r=t.items.filter(T);d(r);let i=r.filter(e=>e.seenAt===null).map(e=>e.id);i.length!==0&&e.markSeen(i).then(e=>{var t;return(t=m.current)==null?void 0:t.call(m,e)},e=>p.current.error(`waiting strip: marking seen failed`,{count:i.length,error:e}))},e=>{n.signal.aborted||p.current.error(`waiting strip: read failed`,{error:e})}),()=>n.abort()},[e,t,r,i]),r===0||u===null||u.length===0)return null;let h=r-u.length;return/* @__PURE__ */ (0,F.jsx)(`div`,{className:w(`@container flex-none [--nf-x:13px] [--nf-surface:var(--color-bg-notification-window)]`,l),children:/* @__PURE__ */ (0,F.jsx)(Ge,{entries:u.map(e=>({item:e,leaving:!1})),count:r,host:`popup`,t:n,now:f,onOpen:o,onLeft:()=>void 0,footer:{label:h>0?n(`notifications.deck.moreAndAll`,{count:h}):n(`notifications.deck.all`),onClick:s}})})}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)},[]),u=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)(p,{end:/* @__PURE__ */ (0,F.jsx)(_,{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)(_,{className:`h-3.25 ${e}`}),/* @__PURE__ */ (0,F.jsx)(_,{className:`h-2.75 ${t}`})]})]},e))}):a.status===`error`?/* @__PURE__ */ (0,F.jsx)(p,{children:/* @__PURE__ */ (0,F.jsx)(b,{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:u.state(e.key),onChoose:t=>u.choose(e.key,t),onRetry:()=>u.retry(e.key)},e.key))})}function Dt({group:e,t:n,save:r,onChoose:i,onRetry:a}){let o=t(),s=r.pending===null?e.enabled:r.pending.value;return/* @__PURE__ */ (0,F.jsx)(p,{"data-on":String(s),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:[r.saving?/* @__PURE__ */ (0,F.jsx)(v,{}):null,/* @__PURE__ */ (0,F.jsx)(re,{checked:s,onChange:i,"aria-label":e.title})]}),children:r.failure===null?null:/* @__PURE__ */ (0,F.jsx)(I,{tone:`error`,error:r.failure.error,className:`mt-1.5`,retry:{label:n(`common.retry`),onRetry:a},children:y(n,o.has,r.failure.error,e=>c({t:n,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]`;function At(e,t){return{subscribe:n=>e.subscribeNotify({channel:`user-model`,channelId:t},{onSignal:n})}}export{wt as a,we as c,ge as d,me as f,M as h,Et as i,Se as l,de as m,kt as n,bt as o,I as p,Ot as r,De as s,At as t,he as u};