progon-agent 1.3.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/supervisor/cli.js +44 -44
- package/extension-bundle.json +3 -3
- package/extension-dist/background/background.js +88 -89
- package/extension-dist/card/card.css +1 -1
- package/extension-dist/card/card.html +9 -9
- package/extension-dist/card/card.js +3 -9
- package/extension-dist/chunks/shared-B5dGSIVr.js +1 -0
- package/extension-dist/chunks/shared-BAuQl9-k.js +323 -0
- package/extension-dist/chunks/shared-BBv6J4oP.js +199 -0
- package/extension-dist/chunks/shared-BQbdfGz-.css +1 -0
- package/extension-dist/chunks/shared-BROt3HHj.js +1 -0
- package/extension-dist/chunks/shared-Beih6ywL.js +1 -0
- package/extension-dist/chunks/shared-C05lJ8nQ.js +98 -0
- package/extension-dist/chunks/shared-C0apd10a.js +21 -0
- package/extension-dist/chunks/shared-C5qHe-zg.js +239 -0
- package/extension-dist/chunks/shared-CFv6cSrr.js +1 -0
- package/extension-dist/chunks/shared-CNYvsh0O.js +39 -0
- package/extension-dist/chunks/shared-CUdYAeXx.js +134 -0
- package/extension-dist/chunks/shared-CdFf-X4Y.css +1 -0
- package/extension-dist/chunks/shared-CgUMEof2.js +1 -0
- package/extension-dist/chunks/shared-CmGrLhdH.js +1 -0
- package/extension-dist/chunks/shared-DDyAbNyB.js +1 -0
- package/extension-dist/chunks/shared-Dbbjj01C.js +1 -0
- package/extension-dist/chunks/shared-Dk6zuyaK.css +1 -0
- package/extension-dist/chunks/shared-pdVr5lDK.js +1 -0
- package/extension-dist/content/content.css +1 -1
- package/extension-dist/content/content.js +216 -231
- package/extension-dist/manifest.json +32 -31
- package/extension-dist/offscreen/offscreen.html +2 -3
- package/extension-dist/offscreen/offscreen.js +1 -1
- package/extension-dist/popup/popup.html +8 -8
- package/extension-dist/popup/popup.js +3 -3
- package/extension-dist/sidepanel/sidepanel.html +11 -10
- package/extension-dist/sidepanel/sidepanel.js +1 -1
- package/extension-dist/workspace/workspace.css +1 -1
- package/extension-dist/workspace/workspace.html +12 -11
- package/extension-dist/workspace/workspace.js +47 -74
- package/package.json +2 -2
- package/extension-dist/chunks/shared-9kMbf8PO.js +0 -1
- package/extension-dist/chunks/shared-BEB011Tg.js +0 -1
- package/extension-dist/chunks/shared-BWYPh-Al.js +0 -1
- package/extension-dist/chunks/shared-Bi_ASAsl.js +0 -377
- package/extension-dist/chunks/shared-BjgSKbjc.js +0 -1
- package/extension-dist/chunks/shared-Bts1WtwM.js +0 -1
- package/extension-dist/chunks/shared-BvwA-cm2.css +0 -1
- package/extension-dist/chunks/shared-Bwk7ZjOr.js +0 -21
- package/extension-dist/chunks/shared-CInXPYm9.js +0 -1
- package/extension-dist/chunks/shared-COCbj3mN.js +0 -1
- package/extension-dist/chunks/shared-CX8XGwZc.js +0 -1
- package/extension-dist/chunks/shared-CZrS2BT6.js +0 -111
- package/extension-dist/chunks/shared-C_dmgeUK.js +0 -120
- package/extension-dist/chunks/shared-CeuPJn47.js +0 -227
- package/extension-dist/chunks/shared-CiEEQWpw.js +0 -1
- package/extension-dist/chunks/shared-Cxo909tK.js +0 -1
- package/extension-dist/chunks/shared-DyRhAmgo.js +0 -51
- package/extension-dist/chunks/shared-Xq2emDMe.js +0 -98
- package/extension-dist/chunks/shared-_jlBqdBD.css +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{r as e}from"./shared-hePW80VL.js";import{$i as t,Bi as n,Bn as r,Ga as i,Gi as a,Gr as o,Lr as s,Or as c,Qi as l,Ui as u,Un as d,Vn as f,Vr as p,Wa as m,Wn as h,Wr as g,Yi as _,_r as v,ea as y,ho as b,ia as x,lo as S,na as C,ra as w,zr as T}from"./shared-C5qHe-zg.js";import{Hr as ee,Nr as E,Or as D,Sr as te,kr as ne,t as O}from"./shared-C05lJ8nQ.js";import{d as re,h as k,m as A,o as ie,s as ae}from"./shared-CNYvsh0O.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=w(`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=w(`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`}]]),N=w(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),oe=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
|
+
/**
|
|
16
|
+
* @license lucide-react v0.574.0 - ISC
|
|
17
|
+
*
|
|
18
|
+
* This source code is licensed under the ISC license.
|
|
19
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
+
*/
|
|
21
|
+
;function se(){return{start(e,t){let n=!1,r=null,i=null,a=0,o=e=>{n||(oe.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;if(i===void 0){o(/* @__PURE__ */ Error(`The window ${String(r)} of this document has no active tab`));return}s(i)},e=>{o(P(e))})},l=e=>{e.windowId===r&&(a+=1,s(e.tabId))},u=e=>{e===r&&c()};return chrome.windows.getCurrent().then(e=>{if(!n){if(e.id===void 0){o(/* @__PURE__ */ Error(`chrome.windows.getCurrent() answered a window without an id`));return}r=e.id,chrome.tabs.onActivated.addListener(l),chrome.windows.onFocusChanged.addListener(u),c()}},e=>{o(P(e))}),()=>{n=!0,chrome.tabs.onActivated.removeListener(l),chrome.windows.onFocusChanged.removeListener(u)}}}}function P(e){return e instanceof Error?e:Error(String(e))}var F=O(`pgs-1f4abfc72f`);function I(e){return e instanceof Error?e.message:String(e)}function ce(e,t){S.call(`OPEN_NOTIFICATION_TARGET`,{notificationId:e.id,target:e.target,windowId:t}).then(t=>{t.success||F.error(`pgm-9d95f41149`,{notificationId:e.id,error:t.error})},t=>{F.error(`pgm-75d229efd3`,{notificationId:e.id,error:I(t)})})}function le(e){S.call(`NOTIFICATIONS_REFRESH`).then(t=>{t.success||F.warn(`pgm-f7016cc548`,{cause:e,error:t.error})},t=>{F.error(`pgm-da30882b0d`,{cause:e,error:I(t)})})}var L=/* @__PURE__ */ e(i(),1),R=`notifications:snapshot`,z=ee({offset:!0}),ue=ne({userId:E().min(1),waitingCount:D().int().min(0),unseenCount:D().int().min(0),attentionToken:E().min(1),disabledGroups:te(E().min(1)),nextExpiryAt:z.nullable(),fetchedAt:z}).strict();function B(e){return e===void 0?null:ue.parse(e)}function de(e,t){if(e.length!==t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function fe(e){let t=(t,n)=>{if(n!==`local`)return;let r=t[R];r!==void 0&&e(B(r.newValue))};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}var pe=O(`pgs-f455a5ff56`);function me(e,t){return e===null||t===null?e!==t:e.userId!==t.userId||e.attentionToken!==t.attentionToken||t.unseenCount>e.unseenCount||!de(e.disabledGroups,t.disabledGroups)}function he(e){let[t,n]=(0,L.useState)({status:`loading`});if((0,L.useEffect)(()=>{let e=!0,t=!1,r=e=>{n(t=>t.status===`ready`?{status:`ready`,snapshot:e,revision:me(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));pe.error(`pgm-bbac8e31b8`,{error:r.message}),n({status:`failed`,error:r})},a=fe(n=>{e&&(t=!0,r(n))});return chrome.storage.local.get(R).then(n=>{if(e&&!t)try{r(B(n[R]))}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 ge=O(`pgs-c9315bb341`);function _e(){let[e,t]=(0,L.useState)({status:`loading`});if((0,L.useEffect)(()=>{let e=!0;return chrome.windows.getCurrent().then(n=>{if(e){if(n.id===void 0){t({status:`failed`,error:/* @__PURE__ */ Error(`chrome.windows.getCurrent() answered a window without an id`)});return}t({status:`ready`,windowId:n.id})}},n=>{if(!e)return;let r=n instanceof Error?n:Error(String(n));ge.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 V=m(),H=99,ve={web:`chrome`,popup:`notification-window`,panel:`notification-window`};function ye(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 be({host:e,t,counts:n,onClick:r,popoverOpen:i,ref:a}){let s=n===null?0:n.waitingCount+n.unseenCount,[c,l]=(0,L.useState)(s),[u,d]=(0,L.useState)(0);s!==c&&(l(s),s>c&&d(e=>e+1));let f=ye(t,n),p=i===!0,m=n!==null&&n.waitingCount>0,g=/* @__PURE__ */ (0,V.jsxs)(`button`,{ref:a,type:`button`,onClick:r,...i===void 0?{}:{"aria-haspopup":`dialog`,"aria-expanded":p},...p?{"aria-label":f}:{},className:o(`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)`,s>0?`text-fg-primary`:`text-fg-muted`,p?`bg-surface-active-layer text-fg-primary`:``),children:[/* @__PURE__ */ (0,V.jsx)(M,{"aria-hidden":`true`,className:o(`size-[18px] origin-[50%_2px]`,u>0?`animate-notification-bell-ring motion-reduce:animate-none`:``)},u),s>0?/* @__PURE__ */ (0,V.jsx)(h,{tone:m?`primary`:`quiet`,ring:ve[e],children:s>H?`${H}+`:s}):null]});return/* @__PURE__ */ (0,V.jsx)(x,{relationship:`label`,content:f,placement:`bottom-end`,disabled:p,children:g})}var U={conversation:a,page:_},xe={answered:C,cancelled:n,expired:k},Se={neutral:null,positive:l,negative:t},Ce={answered:`notifications.resolution.answered`,cancelled:`notifications.resolution.cancelled`,expired:`notifications.resolution.expired`};function W(e){if(e.class===`action_required`)return e.resolution===null?U[e.target.kind]:xe[e.resolution];let t=Se[e.tone];return t===null?U[e.target.kind]:t}function we(e){return e.class!==`informational`||e.tone===`neutral`?null:e.tone}function Te(e,t,n){return t.kind===`conversation`?{label:e(`notifications.action.openChat`),mark:/* @__PURE__ */ (0,V.jsx)(y,{"aria-hidden":`true`}),external:!1}:n===`web`?{label:e(`notifications.action.go`),mark:/* @__PURE__ */ (0,V.jsx)(y,{"aria-hidden":`true`}),external:!1}:{label:e(`notifications.action.openInWeb`),mark:/* @__PURE__ */ (0,V.jsx)(A,{"aria-hidden":`true`}),external:!0}}var Ee=6e4,G=60,K=1440;function q(e,t){let n=Math.floor(t/Ee);return n<1?e(`notifications.duration.lessThanMinute`):n<G?e(`notifications.duration.minutes`,{count:n}):n<K?e(`notifications.duration.hours`,{count:Math.floor(n/G)}):e(`notifications.duration.days`,{count:Math.floor(n/K)})}function J(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 De=[`today`,`yesterday`,`earlier`],Oe={today:`notifications.feed.today`,yesterday:`notifications.feed.yesterday`,earlier:`notifications.feed.earlier`};function ke(e,t){return e(Oe[t])}function Y(e,t){let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()-t).getTime()}function X(e,t){let n=Date.parse(e);return n>=Y(t,0)?`today`:n>=Y(t,1)?`yesterday`:`earlier`}var Z=/* @__PURE__ */ new Map,Q=/* @__PURE__ */ new Map;function Ae(e){let t=Z.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`}),Z.set(e,t)),t}function je(e,t){let n=`${e}:${t?`y`:`-`}`,r=Q.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t?{day:`numeric`,month:`short`,year:`numeric`}:{day:`numeric`,month:`short`}),Q.set(n,r)),r}function Me(e,t,n,r){let i=Date.parse(n);switch(X(n,r)){case`today`:return q(e,r-i);case`yesterday`:return Ae(t).format(i);case`earlier`:return je(t,new Date(i).getFullYear()!==new Date(r).getFullYear()).format(i)}}var Ne=`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`,Pe=`border-0 border-t border-t-[color-mix(in_srgb,var(--color-primary)_20%,transparent)]`,Fe=`hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)] active:bg-[color-mix(in_srgb,var(--color-primary)_15%,transparent)]`;function Ie({entries:e,count:t,host:n,t:r,now:i,onOpen:a,onLeft:s,footer:c,className:l}){let u=(0,L.useId)();return/* @__PURE__ */ (0,V.jsxs)(`section`,{"aria-labelledby":u,className:o(Ne,l),children:[/* @__PURE__ */ (0,V.jsxs)(`div`,{className:`flex items-center gap-2 pt-[9px] pr-3 pb-[7px] pl-[calc(var(--nf-x)-1px)]`,children:[/* @__PURE__ */ (0,V.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,V.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,V.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,V.jsx)(Le,{entry:e,host:n,t:r,now:i,onOpen:a,onLeft:s},e.item.id)),c===void 0?null:/* @__PURE__ */ (0,V.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 ${Pe} hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)]`,children:[c.label,/* @__PURE__ */ (0,V.jsx)(y,{"aria-hidden":`true`})]})]})}function Le({entry:e,host:t,t:n,now:r,onOpen:i,onLeft:a}){let{item:s,leaving:c}=e,l=W(s),u=J(n,s),d=Te(n,s.target,t),f=Re(s,r);return/* @__PURE__ */ (0,V.jsxs)(`button`,{type:`button`,"data-feed-row":``,onClick:()=>i(s),onAnimationEnd:e=>{c&&e.target===e.currentTarget&&a(s.id)},className:o(`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`,Pe,Fe,c?`animate-notification-leave motion-reduce:[animation-duration:1ms]`:``),children:[/* @__PURE__ */ (0,V.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,V.jsx)(l,{})}),/* @__PURE__ */ (0,V.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,V.jsx)(`span`,{className:`text-sm leading-[1.35] font-semibold tracking-[-0.15px] text-fg-primary [overflow-wrap:anywhere]`,children:s.title}),u===null?null:/* @__PURE__ */ (0,V.jsx)(`span`,{className:`text-(length:--text-notification-detail) leading-[1.45] text-fg-secondary [overflow-wrap:anywhere]`,children:u}),/* @__PURE__ */ (0,V.jsx)(`span`,{className:`mt-[3px] flex items-center gap-[5px] text-xs leading-4 text-fg-secondary tabular-nums [&_svg]:size-3`,children:f===null?/* @__PURE__ */ (0,V.jsx)(`span`,{children:n(`notifications.deck.waitingFor`,{duration:q(n,r-Date.parse(s.createdAt))})}):/* @__PURE__ */ (0,V.jsxs)(V.Fragment,{children:[/* @__PURE__ */ (0,V.jsx)(k,{"aria-hidden":`true`}),/* @__PURE__ */ (0,V.jsx)(`span`,{children:n(`notifications.deck.timeLeft`,{duration:q(n,f.left)})})]})})]}),/* @__PURE__ */ (0,V.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,V.jsx)(`span`,{className:`@max-[350px]:sr-only`,children:d.label}),/* @__PURE__ */ (0,V.jsx)(`span`,{className:o(`inline-flex`,d.external?``:`group-hover:[&_svg]:translate-x-0.5`),children:d.mark})]}),f===null?null:/* @__PURE__ */ (0,V.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,V.jsx)(`i`,{className:`block h-full rounded-[inherit] bg-(--color-primary-400)`,style:{width:`${f.fraction*100}%`}})})]})}function Re(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 ze=`grid grid-cols-[32px_1fr_40px] items-center gap-3`,Be=[`w-[70%]`,`w-[58%]`],Ve=[`w-[82%]`,`w-[64%]`,`w-[74%]`,`w-[52%]`];function He({width:e,inDeck:t}){return/* @__PURE__ */ (0,V.jsxs)(`div`,{className:t?ze:`${ze} py-2 pr-2 pl-(--nf-x)`,children:[/* @__PURE__ */ (0,V.jsx)(v,{className:`size-7 rounded-sm`}),/* @__PURE__ */ (0,V.jsxs)(`div`,{className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,V.jsx)(v,{className:`h-3 ${e}`}),/* @__PURE__ */ (0,V.jsx)(v,{className:`h-2.5 w-[34%]`})]}),/* @__PURE__ */ (0,V.jsx)(v,{className:`h-2.5 w-9`})]})}function Ue({label:e}){return/* @__PURE__ */ (0,V.jsxs)(`div`,{role:`status`,"aria-label":e,children:[/* @__PURE__ */ (0,V.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,V.jsx)(v,{className:`h-3 w-[84px]`}),Be.map(e=>/* @__PURE__ */ (0,V.jsx)(He,{width:e,inDeck:!0},e))]}),/* @__PURE__ */ (0,V.jsx)(v,{className:`mt-3 mb-1.5 ml-(--nf-x) h-2.5 w-[60px]`}),Ve.map(e=>/* @__PURE__ */ (0,V.jsx)(He,{width:e,inDeck:!1},e))]})}function We({entries:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let o=/* @__PURE__ */ new Map;for(let t of e){let e=X(t.item.createdAt,r),n=o.get(e);n===void 0?o.set(e,[t]):n.push(t)}return/* @__PURE__ */ (0,V.jsx)(V.Fragment,{children:De.map(e=>{let s=o.get(e);return s===void 0?null:/* @__PURE__ */ (0,V.jsx)(Ge,{title:ke(t,e),rows:s,t,locale:n,now:r,onOpen:i,onLanded:a},e)})})}function Ge({title:e,rows:t,...n}){let r=(0,L.useId)();return/* @__PURE__ */ (0,V.jsxs)(V.Fragment,{children:[/* @__PURE__ */ (0,V.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,V.jsx)(`ul`,{"aria-labelledby":r,className:`m-0 grid list-none gap-px p-0`,children:t.map(e=>/* @__PURE__ */ (0,V.jsx)(`li`,{children:/* @__PURE__ */ (0,V.jsx)(Ze,{entry:e,...n})},e.item.id))})]})}var Ke={new:`font-semibold text-fg-primary`,seen:`font-medium text-fg-primary`,read:`font-normal text-fg-secondary`},qe=`border-stroke bg-surface-hover-layer text-fg-secondary`,Je=`border-stroke bg-surface-hover-layer text-fg-success`,Ye=o(T.error.edge,T.error.fill,T.error.ink),Xe=`border-dashed border-stroke-hover bg-transparent text-fg-muted`;function Ze({entry:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let{item:s,reading:c,landed:l}=e,u=W(s),d=J(t,s),f=s.class===`action_required`?s.resolution:null,p=we(s),m=f===null?p===`negative`?Ye:p===`positive`?Je:qe:Xe;return/* @__PURE__ */ (0,V.jsxs)(`button`,{type:`button`,"data-feed-row":``,"data-state":c,"data-tone":p===null?void 0:p,"data-closed":f===null?void 0:``,onClick:()=>i(s),onAnimationEnd:e=>{l&&e.target===e.currentTarget&&a(s.id)},className:o(`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`,l?`animate-notification-land motion-reduce:[animation-duration:1ms]`:``),children:[/* @__PURE__ */ (0,V.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-7 place-items-center justify-self-start rounded-sm border [&_svg]:size-3.5 ${m}`,children:/* @__PURE__ */ (0,V.jsx)(u,{})}),/* @__PURE__ */ (0,V.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,V.jsx)(`span`,{className:`text-(length:--text-notification-title) leading-[1.35] tracking-[-0.1px] [overflow-wrap:anywhere] ${Ke[c]}`,children:s.title}),d===null?null:/* @__PURE__ */ (0,V.jsx)(`span`,{className:`text-(length:--text-notification-detail) leading-[1.45] text-fg-muted [overflow-wrap:anywhere] group-hover:text-fg-secondary`,children:d}),f===null?null:/* @__PURE__ */ (0,V.jsx)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs leading-4 text-fg-muted`,children:t(Ce[f])})]}),/* @__PURE__ */ (0,V.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:[Me(t,n,s.createdAt,r),c===`new`?/* @__PURE__ */ (0,V.jsxs)(V.Fragment,{children:[/* @__PURE__ */ (0,V.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,V.jsx)(`span`,{className:`sr-only`,children:t(`notifications.feed.new`)})]}):null]})]})}function Qe({children:e,align:n=`start`,className:r}){return/* @__PURE__ */ (0,V.jsxs)(`div`,{role:`alert`,className:o(`flex gap-1.5 text-xs leading-[1.45] text-fg-error [&>svg]:size-3.5 [&>svg]:flex-none`,n===`start`?`items-start [&>svg]:mt-px`:`items-center`,r),children:[/* @__PURE__ */ (0,V.jsx)(t,{"aria-hidden":`true`}),e]})}function $e({onClick:e,children:t,size:n=`md`,className:r}){return/* @__PURE__ */ (0,V.jsx)(`button`,{type:`button`,onClick:e,className:o(`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 et(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 tt(e){return e.map(e=>e.id).join(`|`)}function nt(e){let t=e.filter(b),n=tt(t),[r,i]=(0,L.useState)(t),[a,o]=(0,L.useState)(n),[s,c]=(0,L.useState)(()=>/* @__PURE__ */ new Map),[l,u]=(0,L.useState)(()=>/* @__PURE__ */ new Set);if(a!==n){let a=new Set(t.map(e=>e.id)),s=new Set(e.filter(e=>!b(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)=>et(e.item,t.item)),openCount:t.length,history:e.filter(e=>!b(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 rt(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}async function it(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=rt(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 at(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var ot=2**31-1;function st({api:e,locale:t,revision:n,logger:r,onSeen:i}){let[a,o]=(0,L.useState)({status:`loading`}),[s,c]=(0,L.useState)(0),[l,u]=(0,L.useState)(0),[d,f]=(0,L.useState)(()=>/* @__PURE__ */ new Set),p=ie(),m=(0,L.useRef)(null),h=(0,L.useRef)(null),g=(0,L.useRef)(/* @__PURE__ */ new Set),_=(0,L.useRef)(i),v=(0,L.useRef)(r);(0,L.useEffect)(()=>{_.current=i,v.current=r});let y=(0,L.useCallback)(e=>{m.current=e,o({status:`ready`,data:e,more:`idle`})},[]);(0,L.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([it(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=>{if(!r.signal.aborted){if(i===null){o({status:`error`,retrying:!1});return}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 x=(0,L.useCallback)(()=>{o({status:`error`,retrying:!0}),c(e=>e+1)},[]),S=(0,L.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:rt(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]),C=a.status===`ready`?a.data.items:null;(0,L.useEffect)(()=>{if(C===null)return;let t=C.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 at(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,C]);let w=C===null?null:C.reduce((e,t)=>{if(!b(t)||t.expiresAt===null)return e;let n=Date.parse(t.expiresAt);return e===null||n<e?n:e},null),T=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(w===null)return;let e=`${w}@${p}`;if(T.current===e)return;let t=w-Date.now();if(t>ot)return;let n=setTimeout(()=>{T.current=e,u(e=>e+1)},t);return()=>clearTimeout(n)},[w,p]),{load:a,freshIds:d,now:p,retry:x,loadMore:S}}var ct={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`},lt=/* @__PURE__ */ new Set([`ArrowDown`,`ArrowUp`,`Home`,`End`]);function ut(e){var t;if(!lt.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 dt(e){let{api:t,locale:n,t:r,revision:i,logger:a,onSeen:o,host:l,onOpenSettings:u}=e,d=st({api:t,locale:n,revision:i,logger:a,onSeen:o}),{load:f}=d;return/* @__PURE__ */ (0,V.jsxs)(`div`,{"data-host":l,className:`@container flex min-h-0 min-w-0 flex-col text-left [--nf-x:13px] ${l===`web`?`[--nf-surface:var(--color-bg-elevated)]`:`flex-1 [--nf-surface:var(--color-bg-notification-window)]`}`,children:[e.host===`web`?/* @__PURE__ */ (0,V.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,V.jsx)(`h2`,{id:e.headingId,className:`m-0 mr-auto text-base leading-6 font-semibold tracking-[-0.35px] text-fg-primary`,children:r(`notifications.feed.title`)}),/* @__PURE__ */ (0,V.jsx)(x,{relationship:`label`,content:r(`notifications.feed.settings`),children:/* @__PURE__ */ (0,V.jsx)(s,{size:`sm`,icon:/* @__PURE__ */ (0,V.jsx)(N,{"aria-hidden":`true`}),onClick:u})})]}):null,/* @__PURE__ */ (0,V.jsx)(`div`,{onKeyDown:ut,className:`min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--scrollbar-thumb)_transparent] [scrollbar-width:thin] ${ct[l]}`,children:f.status===`loading`?/* @__PURE__ */ (0,V.jsx)(Ue,{label:r(`notifications.feed.loading`)}):f.status===`error`?/* @__PURE__ */ (0,V.jsx)($,{host:l,children:/* @__PURE__ */ (0,V.jsx)(c,{icon:/* @__PURE__ */ (0,V.jsx)(re,{"aria-hidden":`true`}),title:r(`notifications.feed.errorTitle`),description:r(`notifications.feed.errorText`),retry:{label:r(`common.retry`),onRetry:d.retry,pending:f.retrying,pendingLabel:r(`common.loading`)},className:`[&_p]:max-w-70`})}):/* @__PURE__ */ (0,V.jsx)(ft,{...e,data:f.data,more:f.more,freshIds:d.freshIds,now:d.now,onLoadMore:d.loadMore})}),f.status===`ready`?/* @__PURE__ */ (0,V.jsx)(pt,{host:l,t:r,data:f.data,onOpenSettings:u}):null]})}function $({host:e,children:t}){return/* @__PURE__ */ (0,V.jsx)(`div`,{className:o(`grid flex-1 content-center p-2`,e===`popup`?`min-h-80`:`min-h-[300px]`),children:t})}function ft({host:e,t,locale:n,data:r,more:i,freshIds:a,now:o,onLoadMore:s,onOpenTarget:c,onOpenSettings:l,focusFirstRow:u}){let f=nt(r.items),[m,h]=(0,L.useState)(()=>/* @__PURE__ */ new Set),g=(0,L.useRef)(null),_=(0,L.useRef)(!1),v=r.items.length>0;(0,L.useEffect)(()=>{var e;u===!0&&!_.current&&v&&(_.current=!0,(e=g.current)==null||(e=e.querySelector(`[data-feed-row]`))==null||e.focus())},[u,v]);let y=e=>{h(t=>/* @__PURE__ */ new Set([...t,e.id])),c(e)},b=e=>e.readAt!==null||m.has(e.id)?`read`:e.seenAt===null||a.has(e.id)?`new`:`seen`;if(!v&&f.deck.length===0){let n=r.groups.length>0&&r.groups.every(e=>!e.enabled);return/* @__PURE__ */ (0,V.jsx)($,{host:e,children:n?/* @__PURE__ */ (0,V.jsx)(d,{icon:/* @__PURE__ */ (0,V.jsx)(j,{"aria-hidden":`true`}),title:t(`notifications.feed.allOffTitle`),description:t(`notifications.feed.allOffText`),className:`[&_p]:max-w-70`,action:/* @__PURE__ */ (0,V.jsx)(p,{variant:`primary`,onClick:l,children:e===`panel`?/* @__PURE__ */ (0,V.jsxs)(V.Fragment,{children:[t(`notifications.feed.configureInWeb`),/* @__PURE__ */ (0,V.jsx)(A,{"aria-hidden":`true`})]}):t(`notifications.feed.openSettings`)})}):/* @__PURE__ */ (0,V.jsx)(d,{icon:/* @__PURE__ */ (0,V.jsx)(M,{"aria-hidden":`true`}),title:t(`notifications.feed.emptyTitle`),description:t(`notifications.feed.emptyText`),className:`[&_p]:max-w-70`})})}return/* @__PURE__ */ (0,V.jsxs)(`div`,{ref:g,children:[f.deck.length>0?/* @__PURE__ */ (0,V.jsx)(Ie,{entries:f.deck,count:f.openCount,host:e,t,now:o,onOpen:y,onLeft:f.onLeft,className:`mt-0.5 mb-1.5`}):null,/* @__PURE__ */ (0,V.jsx)(We,{entries:f.history.map(e=>({item:e,reading:b(e),landed:f.landedIds.has(e.id)})),t,locale:n,now:o,onOpen:y,onLanded:f.onLanded}),r.nextOffset<r.total?/* @__PURE__ */ (0,V.jsxs)(`div`,{className:`mt-2 mb-0.5`,children:[i===`error`?/* @__PURE__ */ (0,V.jsx)(Qe,{className:`mb-1.5 ml-(--nf-x)`,children:/* @__PURE__ */ (0,V.jsx)(`span`,{children:t(`notifications.feed.loadMoreFailed`)})}):null,/* @__PURE__ */ (0,V.jsx)(ae,{label:t(i===`error`?`common.retry`:`notifications.feed.loadMore`),loadingLabel:t(`notifications.feed.loadMore`),loading:i===`busy`,onLoadMore:s})]}):null]})}function pt({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,V.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,V.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 flex-none text-fg-muted`}),/* @__PURE__ */ (0,V.jsxs)(`p`,{className:`m-0 min-w-0 flex-1`,children:[t(`notifications.feed.disabled`),` `,/* @__PURE__ */ (0,V.jsx)(`b`,{className:`font-medium text-fg-primary`,children:i.map(e=>e.title).join(`, `)})]}),/* @__PURE__ */ (0,V.jsx)($e,{onClick:r,className:`flex-none`,children:e===`panel`?/* @__PURE__ */ (0,V.jsxs)(V.Fragment,{children:[t(`notifications.feed.configureInWeb`),/* @__PURE__ */ (0,V.jsx)(A,{"aria-hidden":`true`})]}):t(`notifications.feed.configure`)})]})}function mt({api:e,locale:t,t:n,waitingCount:r,revision:i,logger:a,onOpenTarget:s,onOpenFeed:c,onSeen:l,className:u}){let[d,f]=(0,L.useState)(null),p=ie(),m=(0,L.useRef)(a),h=(0,L.useRef)(l);if((0,L.useEffect)(()=>{m.current=a,h.current=l}),(0,L.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(b);f(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=h.current)==null?void 0:t.call(h,e)},e=>m.current.error(`waiting strip: marking seen failed`,{count:i.length,error:e}))},e=>{n.signal.aborted||m.current.error(`waiting strip: read failed`,{error:e})}),()=>n.abort()},[e,t,r,i]),r===0||d===null||d.length===0)return null;let g=r-d.length;return/* @__PURE__ */ (0,V.jsx)(`div`,{className:o(`@container flex-none [--nf-x:13px] [--nf-surface:var(--color-bg-notification-window)]`,u),children:/* @__PURE__ */ (0,V.jsx)(Ie,{entries:d.map(e=>({item:e,leaving:!1})),count:r,host:`popup`,t:n,now:p,onOpen:s,onLeft:()=>void 0,footer:{label:g>0?n(`notifications.deck.moreAndAll`,{count:g}):n(`notifications.deck.all`),onClick:c}})})}var ht=[[`w-[38%]`,`w-[74%]`],[`w-[52%]`,`w-[86%]`],[`w-[44%]`,`w-[68%]`]];function gt({api:e,locale:n,t:i,logger:a,onChanged:o}){let[s,c]=(0,L.useState)({status:`loading`}),[l,d]=(0,L.useState)(0),[m,h]=(0,L.useState)(()=>/* @__PURE__ */ new Map),_=(0,L.useRef)(/* @__PURE__ */ new Map),y=(0,L.useRef)(a),b=(0,L.useRef)(o);(0,L.useEffect)(()=>{y.current=a,b.current=o});let x=(0,L.useRef)(!0);(0,L.useEffect)(()=>{x.current=!0;let e=_.current;return()=>{x.current=!1;for(let t of e.values())t.next=null}},[]),(0,L.useEffect)(()=>{let t=new AbortController;return e.listGroups({locale:n,signal:t.signal}).then(e=>{t.signal.aborted||c({status:`ready`,groups:e.items})},()=>{t.signal.aborted||c({status:`error`,retrying:!1})}),()=>t.abort()},[e,n,l]);let S=(0,L.useCallback)((e,t)=>{h(n=>{let r=new Map(n);return t===null?r.delete(e):r.set(e,t),r})},[]),C=(0,L.useCallback)((t,r)=>{let i=_.current.get(t);i===void 0&&(i={inFlight:!1,next:null},_.current.set(t,i));let a=i;a.inFlight=!0,S(t,{shown:r,busy:!0,failed:null});let o=e=>{if(a.inFlight=!1,x.current){if(a.next!==null){let e=a.next;a.next=null,C(t,e);return}S(t,e===null?null:{shown:!e,busy:!1,failed:e})}};e.setGroupEnabled(t,r,{locale:n}).then(e=>{var t;c(t=>t.status===`ready`?{status:`ready`,groups:t.groups.map(t=>t.key===e.key?e:t)}:t),x.current&&((t=b.current)==null||t.call(b,e)),o(null)},e=>{y.current.error(`notification groups: save failed`,{key:t,enabled:r,error:e}),o(r)})},[e,n,S]),w=(e,t)=>{let n=_.current.get(e);if((n==null?void 0:n.inFlight)===!0){n.next=t,S(e,{shown:t,busy:!0,failed:null});return}C(e,t)};return s.status===`loading`?/* @__PURE__ */ (0,V.jsx)(V.Fragment,{children:ht.map(([e,t],n)=>/* @__PURE__ */ (0,V.jsxs)(f,{end:/* @__PURE__ */ (0,V.jsx)(v,{className:`h-5 w-9 rounded-full`}),children:[n===0?/* @__PURE__ */ (0,V.jsx)(`span`,{role:`status`,className:`sr-only`,children:i(`notifications.groups.loading`)}):null,/* @__PURE__ */ (0,V.jsxs)(`span`,{"aria-hidden":`true`,className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,V.jsx)(v,{className:`h-3.25 ${e}`}),/* @__PURE__ */ (0,V.jsx)(v,{className:`h-2.75 ${t}`})]})]},e))}):s.status===`error`?/* @__PURE__ */ (0,V.jsx)(f,{children:/* @__PURE__ */ (0,V.jsxs)(`div`,{role:`alert`,className:`grid justify-items-start gap-2.5`,children:[/* @__PURE__ */ (0,V.jsxs)(`p`,{className:`m-0 flex gap-1.5 text-(length:--text-body-sm) leading-normal text-fg-error [&>svg]:mt-0.5 [&>svg]:size-3.5 [&>svg]:flex-none`,children:[/* @__PURE__ */ (0,V.jsx)(t,{"aria-hidden":`true`}),/* @__PURE__ */ (0,V.jsx)(`span`,{children:i(`notifications.groups.loadFailed`)})]}),/* @__PURE__ */ (0,V.jsx)(p,{variant:`secondary`,size:`sm`,icon:/* @__PURE__ */ (0,V.jsx)(u,{"aria-hidden":`true`}),loading:s.retrying,loadingLabel:i(`common.loading`),onClick:()=>{c({status:`error`,retrying:!0}),d(e=>e+1)},children:i(`common.retry`)})]})}):/* @__PURE__ */ (0,V.jsx)(V.Fragment,{children:s.groups.map(e=>{let t=m.get(e.key),n=t!==void 0&&t.busy?t.shown:e.enabled;return/* @__PURE__ */ (0,V.jsx)(f,{"data-on":String(n),title:e.title,caption:e.description===``?void 0:e.description,end:/* @__PURE__ */ (0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-fg-muted`,children:[t!==void 0&&t.busy?/* @__PURE__ */ (0,V.jsx)(g,{}):null,/* @__PURE__ */ (0,V.jsx)(r,{checked:n,onChange:t=>w(e.key,t),"aria-label":e.title})]}),children:t!==void 0&&t.failed!==null?/* @__PURE__ */ (0,V.jsxs)(Qe,{align:`center`,className:`mt-1.5`,children:[/* @__PURE__ */ (0,V.jsx)(`span`,{children:i(`notifications.groups.saveFailed`)}),/* @__PURE__ */ (0,V.jsx)($e,{size:`sm`,onClick:()=>w(e.key,t.failed===!0),children:i(`common.retry`)})]}):null},e.key)})})}var _t=`animate-[extension-view-in_var(--motion-medium)_var(--ease-out)_both]`,vt=`animate-[extension-view-back_var(--motion-medium)_var(--ease-out)_both]`;export{dt as a,he as c,se as d,N as f,mt as i,ce as l,_t as n,be as o,gt as r,_e as s,vt as t,le as u};
|