progon-agent 1.3.1 → 1.4.0
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 +41 -41
- package/extension-bundle.json +3 -3
- package/extension-dist/background/background.js +89 -89
- package/extension-dist/card/card.html +8 -7
- package/extension-dist/card/card.js +3 -3
- package/extension-dist/chunks/shared-B4EisBUi.js +1 -0
- package/extension-dist/chunks/shared-B7QwPadt.js +98 -0
- package/extension-dist/chunks/shared-BQF2LG1p.js +377 -0
- package/extension-dist/chunks/shared-BgsXTfSV.js +1 -0
- package/extension-dist/chunks/shared-BpcMA-xb.js +135 -0
- package/extension-dist/chunks/shared-BvwA-cm2.css +1 -0
- package/extension-dist/chunks/shared-BwS34Mep.js +111 -0
- package/extension-dist/chunks/shared-CAKh7jnb.css +1 -0
- package/extension-dist/chunks/{shared-BJIubFtc.js → shared-CCOKrUJ3.js} +1 -1
- package/extension-dist/chunks/shared-Co5HfH-n.js +1 -0
- package/extension-dist/chunks/shared-Cs6uBr12.js +1 -0
- package/extension-dist/chunks/shared-D7SUgUlB.js +1 -0
- package/extension-dist/chunks/shared-DGDE0AeD.js +1 -0
- package/extension-dist/chunks/shared-DjlOTYdL.js +1 -0
- package/extension-dist/chunks/shared-Dk6zuyaK.css +1 -0
- package/extension-dist/chunks/shared-LK5ScAJA.js +227 -0
- package/extension-dist/chunks/shared-_8sSdh22.js +21 -0
- package/extension-dist/chunks/shared-sY-POWsC.js +51 -0
- package/extension-dist/content/content.css +1 -1
- package/extension-dist/content/content.js +211 -211
- package/extension-dist/manifest.json +30 -28
- package/extension-dist/offscreen/offscreen.html +2 -2
- package/extension-dist/offscreen/offscreen.js +1 -1
- package/extension-dist/popup/popup.html +7 -7
- package/extension-dist/popup/popup.js +3 -3
- package/extension-dist/sidepanel/sidepanel.html +10 -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 +59 -55
- package/package.json +2 -2
- package/extension-dist/chunks/shared-B3hsjAeB.js +0 -371
- package/extension-dist/chunks/shared-BJOAkaqO.js +0 -1
- package/extension-dist/chunks/shared-BUQXvbGJ.css +0 -1
- package/extension-dist/chunks/shared-BWYPh-Al.js +0 -1
- package/extension-dist/chunks/shared-Bdgj5eQ5.js +0 -1
- package/extension-dist/chunks/shared-BiDh2lEA.js +0 -1
- package/extension-dist/chunks/shared-BjgSKbjc.js +0 -1
- package/extension-dist/chunks/shared-Ccz3X65G.js +0 -51
- package/extension-dist/chunks/shared-CdkSNWvx.js +0 -21
- package/extension-dist/chunks/shared-CwW6XlwM.js +0 -1
- package/extension-dist/chunks/shared-DCs5uS1P.js +0 -1
- package/extension-dist/chunks/shared-DdJtX3_m.js +0 -105
- package/extension-dist/chunks/shared-O0OgUhxM.js +0 -227
- package/extension-dist/chunks/shared-SnJc3X_h.js +0 -126
- package/extension-dist/chunks/shared-UK_0TOj7.js +0 -98
- package/extension-dist/chunks/shared-c_EHmnKR.css +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{r as e}from"./shared-hePW80VL.js";import{Er as t,Fr as n,Hn as r,Hr as i,Ji as a,Lr as o,Po as s,Ur as c,Vn as l,Xr as u,ai as d,ba as f,ci as p,da as m,fa as h,hr as g,ii as _,li as v,qi as y,qr as b,ri as x,si as S,zn as C,zr as w}from"./shared-LK5ScAJA.js";import{Zn as T,br as ee,dr as E,or as te,sr as ne,t as D}from"./shared-B7QwPadt.js";import{D as O,E as re,O as k,S as ie,_ as ae,g as oe,t as A,v as se,w as ce}from"./shared-sY-POWsC.js";var j=class extends TypeError{constructor(e,t){super(`${e} ${t}: no HTTP answer`),this.name=`XhrNoAnswerError`}};function le(e){let{method:t,url:n,headers:r,body:i,signal:a,onProgress:o}=e;return a.aborted?Promise.reject(a.reason):new Promise((e,s)=>{let c=new XMLHttpRequest,l=i instanceof Blob?i.size:i.byteLength,u=()=>{a.removeEventListener(`abort`,d)},d=()=>{c.abort(),u(),s(a.reason)};c.open(t,n);for(let[e,t]of Object.entries(r))c.setRequestHeader(e,t);c.upload.addEventListener(`progress`,e=>o(e.loaded)),c.upload.addEventListener(`load`,()=>o(l)),c.addEventListener(`load`,()=>{u(),e({status:c.status,body:c.responseText})}),c.addEventListener(`error`,()=>{u(),s(new j(t,n))}),a.addEventListener(`abort`,d,{once:!0}),o(0),c.send(i)})}
|
|
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 M=p(`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`}]]),N=p(`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`}]]),P=p(`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`}]]),ue=D(`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 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;if(i===void 0){o(/* @__PURE__ */ Error(`The window ${String(r)} of this document has no active tab`));return}s(i)},e=>{o(F(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(F(e))}),()=>{n=!0,chrome.tabs.onActivated.removeListener(l),chrome.windows.onFocusChanged.removeListener(u)}}}}function F(e){return e instanceof Error?e:Error(String(e))}var I=D(`pgs-1f4abfc72f`);function L(e){return e instanceof Error?e.message:String(e)}function fe(e,t){h.call(`OPEN_NOTIFICATION_TARGET`,{notificationId:e.id,target:e.target,windowId:t}).then(t=>{t.success||I.error(`pgm-9d95f41149`,{notificationId:e.id,error:t.error})},t=>{I.error(`pgm-75d229efd3`,{notificationId:e.id,error:L(t)})})}function pe(e){h.call(`NOTIFICATIONS_REFRESH`).then(t=>{t.success||I.warn(`pgm-f7016cc548`,{cause:e,error:t.error})},t=>{I.error(`pgm-da30882b0d`,{cause:e,error:L(t)})})}var R=/* @__PURE__ */ e(a(),1),z=`notifications:snapshot`,B=ee({offset:!0}),me=ne({userId:E().min(1),waitingCount:te().int().min(0),unseenCount:te().int().min(0),attentionToken:E().min(1),disabledGroups:T(E().min(1)),nextExpiryAt:B.nullable(),fetchedAt:B}).strict();function V(e){return e===void 0?null:me.parse(e)}function he(e,t){if(e.length!==t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function ge(e){let t=(t,n)=>{if(n!==`local`)return;let r=t[z];r!==void 0&&e(V(r.newValue))};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}var _e=D(`pgs-f455a5ff56`);function ve(e,t){return e===null||t===null?e!==t:e.userId!==t.userId||e.attentionToken!==t.attentionToken||t.unseenCount>e.unseenCount||!he(e.disabledGroups,t.disabledGroups)}function ye(e){let[t,n]=(0,R.useState)({status:`loading`});if((0,R.useEffect)(()=>{let e=!0,t=!1,r=e=>{n(t=>t.status===`ready`?{status:`ready`,snapshot:e,revision:ve(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));_e.error(`pgm-bbac8e31b8`,{error:r.message}),n({status:`failed`,error:r})},a=ge(n=>{e&&(t=!0,r(n))});return chrome.storage.local.get(z).then(n=>{if(e&&!t)try{r(V(n[z]))}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 be=D(`pgs-c9315bb341`);function xe(){let[e,t]=(0,R.useState)({status:`loading`});if((0,R.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));be.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 H=y(),U=99,Se={web:`chrome`,popup:`notification-window`,panel:`notification-window`};function Ce(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 we({host:e,t,counts:n,onClick:i,popoverOpen:a,ref:o}){let s=n===null?0:n.waitingCount+n.unseenCount,[l,u]=(0,R.useState)(s),[d,f]=(0,R.useState)(0);s!==l&&(u(s),s>l&&f(e=>e+1));let p=Ce(t,n),m=a===!0,h=n!==null&&n.waitingCount>0,g=/* @__PURE__ */ (0,H.jsxs)(`button`,{ref:o,type:`button`,onClick:i,...a===void 0?{}:{"aria-haspopup":`dialog`,"aria-expanded":m},...m?{"aria-label":p}:{},className:c(`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`,m?`bg-surface-active-layer text-fg-primary`:``),children:[/* @__PURE__ */ (0,H.jsx)(N,{"aria-hidden":`true`,className:c(`size-[18px] origin-[50%_2px]`,d>0?`animate-notification-bell-ring motion-reduce:animate-none`:``)},d),s>0?/* @__PURE__ */ (0,H.jsx)(r,{tone:h?`primary`:`quiet`,ring:Se[e],children:s>U?`${U}+`:s}):null]});return/* @__PURE__ */ (0,H.jsx)(v,{relationship:`label`,content:p,placement:`bottom-end`,disabled:m,children:g})}var W={conversation:ce,page:re},Te={answered:S,cancelled:b,expired:k},Ee={neutral:null,positive:x,negative:_},De={answered:`notifications.resolution.answered`,cancelled:`notifications.resolution.cancelled`,expired:`notifications.resolution.expired`};function G(e){if(e.class===`action_required`)return e.resolution===null?W[e.target.kind]:Te[e.resolution];let t=Ee[e.tone];return t===null?W[e.target.kind]:t}function Oe(e){return e.class!==`informational`||e.tone===`neutral`?null:e.tone}function ke(e,t,n){return t.kind===`conversation`?{label:e(`notifications.action.openChat`),mark:/* @__PURE__ */ (0,H.jsx)(d,{"aria-hidden":`true`}),external:!1}:n===`web`?{label:e(`notifications.action.go`),mark:/* @__PURE__ */ (0,H.jsx)(d,{"aria-hidden":`true`}),external:!1}:{label:e(`notifications.action.openInWeb`),mark:/* @__PURE__ */ (0,H.jsx)(O,{"aria-hidden":`true`}),external:!0}}var Ae=6e4,K=60,q=1440;function J(e,t){let n=Math.floor(t/Ae);return n<1?e(`notifications.duration.lessThanMinute`):n<K?e(`notifications.duration.minutes`,{count:n}):n<q?e(`notifications.duration.hours`,{count:Math.floor(n/K)}):e(`notifications.duration.days`,{count:Math.floor(n/q)})}function Y(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 je=[`today`,`yesterday`,`earlier`],Me={today:`notifications.feed.today`,yesterday:`notifications.feed.yesterday`,earlier:`notifications.feed.earlier`};function Ne(e,t){return e(Me[t])}function X(e,t){let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()-t).getTime()}function Pe(e,t){let n=Date.parse(e);return n>=X(t,0)?`today`:n>=X(t,1)?`yesterday`:`earlier`}var Fe=/* @__PURE__ */ new Map,Ie=/* @__PURE__ */ new Map;function Le(e){let t=Fe.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`}),Fe.set(e,t)),t}function Re(e,t){let n=`${e}:${t?`y`:`-`}`,r=Ie.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t?{day:`numeric`,month:`short`,year:`numeric`}:{day:`numeric`,month:`short`}),Ie.set(n,r)),r}function ze(e,t,n,r){let i=Date.parse(n);switch(Pe(n,r)){case`today`:return J(e,r-i);case`yesterday`:return Le(t).format(i);case`earlier`:return Re(t,new Date(i).getFullYear()!==new Date(r).getFullYear()).format(i)}}var Be=`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`,Ve=`border-0 border-t border-t-[color-mix(in_srgb,var(--color-primary)_20%,transparent)]`,He=`hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)] active:bg-[color-mix(in_srgb,var(--color-primary)_15%,transparent)]`;function Ue({entries:e,count:t,host:n,t:r,now:i,onOpen:a,onLeft:o,footer:s,className:l}){let u=(0,R.useId)();return/* @__PURE__ */ (0,H.jsxs)(`section`,{"aria-labelledby":u,className:c(Be,l),children:[/* @__PURE__ */ (0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-[9px] pr-3 pb-[7px] pl-[calc(var(--nf-x)-1px)]`,children:[/* @__PURE__ */ (0,H.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,H.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,H.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,H.jsx)(We,{entry:e,host:n,t:r,now:i,onOpen:a,onLeft:o},e.item.id)),s===void 0?null:/* @__PURE__ */ (0,H.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 ${Ve} hover:bg-[color-mix(in_srgb,var(--color-primary)_10%,transparent)]`,children:[s.label,/* @__PURE__ */ (0,H.jsx)(d,{"aria-hidden":`true`})]})]})}function We({entry:e,host:t,t:n,now:r,onOpen:i,onLeft:a}){let{item:o,leaving:s}=e,l=G(o),u=Y(n,o),d=ke(n,o.target,t),f=Ge(o,r);return/* @__PURE__ */ (0,H.jsxs)(`button`,{type:`button`,"data-feed-row":``,onClick:()=>i(o),onAnimationEnd:e=>{s&&e.target===e.currentTarget&&a(o.id)},className:c(`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`,Ve,He,s?`animate-notification-leave motion-reduce:[animation-duration:1ms]`:``),children:[/* @__PURE__ */ (0,H.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,H.jsx)(l,{})}),/* @__PURE__ */ (0,H.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,H.jsx)(`span`,{className:`text-sm leading-[1.35] font-semibold tracking-[-0.15px] text-fg-primary [overflow-wrap:anywhere]`,children:o.title}),u===null?null:/* @__PURE__ */ (0,H.jsx)(`span`,{className:`text-(length:--text-notification-detail) leading-[1.45] text-fg-secondary [overflow-wrap:anywhere]`,children:u}),/* @__PURE__ */ (0,H.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,H.jsx)(`span`,{children:n(`notifications.deck.waitingFor`,{duration:J(n,r-Date.parse(o.createdAt))})}):/* @__PURE__ */ (0,H.jsxs)(H.Fragment,{children:[/* @__PURE__ */ (0,H.jsx)(k,{"aria-hidden":`true`}),/* @__PURE__ */ (0,H.jsx)(`span`,{children:n(`notifications.deck.timeLeft`,{duration:J(n,f.left)})})]})})]}),/* @__PURE__ */ (0,H.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,H.jsx)(`span`,{className:`@max-[350px]:sr-only`,children:d.label}),/* @__PURE__ */ (0,H.jsx)(`span`,{className:c(`inline-flex`,d.external?``:`group-hover:[&_svg]:translate-x-0.5`),children:d.mark})]}),f===null?null:/* @__PURE__ */ (0,H.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,H.jsx)(`i`,{className:`block h-full rounded-[inherit] bg-(--color-primary-400)`,style:{width:`${f.fraction*100}%`}})})]})}function Ge(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 Ke=`grid grid-cols-[32px_1fr_40px] items-center gap-3`,qe=[`w-[70%]`,`w-[58%]`],Je=[`w-[82%]`,`w-[64%]`,`w-[74%]`,`w-[52%]`];function Ye({width:e,inDeck:t}){return/* @__PURE__ */ (0,H.jsxs)(`div`,{className:t?Ke:`${Ke} py-2 pr-2 pl-(--nf-x)`,children:[/* @__PURE__ */ (0,H.jsx)(g,{className:`size-7 rounded-sm`}),/* @__PURE__ */ (0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,H.jsx)(g,{className:`h-3 ${e}`}),/* @__PURE__ */ (0,H.jsx)(g,{className:`h-2.5 w-[34%]`})]}),/* @__PURE__ */ (0,H.jsx)(g,{className:`h-2.5 w-9`})]})}function Xe({label:e}){return/* @__PURE__ */ (0,H.jsxs)(`div`,{role:`status`,"aria-label":e,children:[/* @__PURE__ */ (0,H.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,H.jsx)(g,{className:`h-3 w-[84px]`}),qe.map(e=>/* @__PURE__ */ (0,H.jsx)(Ye,{width:e,inDeck:!0},e))]}),/* @__PURE__ */ (0,H.jsx)(g,{className:`mt-3 mb-1.5 ml-(--nf-x) h-2.5 w-[60px]`}),Je.map(e=>/* @__PURE__ */ (0,H.jsx)(Ye,{width:e,inDeck:!1},e))]})}function Ze({entries:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let o=/* @__PURE__ */ new Map;for(let t of e){let e=Pe(t.item.createdAt,r),n=o.get(e);n===void 0?o.set(e,[t]):n.push(t)}return/* @__PURE__ */ (0,H.jsx)(H.Fragment,{children:je.map(e=>{let s=o.get(e);return s===void 0?null:/* @__PURE__ */ (0,H.jsx)(Qe,{title:Ne(t,e),rows:s,t,locale:n,now:r,onOpen:i,onLanded:a},e)})})}function Qe({title:e,rows:t,...n}){let r=(0,R.useId)();return/* @__PURE__ */ (0,H.jsxs)(H.Fragment,{children:[/* @__PURE__ */ (0,H.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,H.jsx)(`ul`,{"aria-labelledby":r,className:`m-0 grid list-none gap-px p-0`,children:t.map(e=>/* @__PURE__ */ (0,H.jsx)(`li`,{children:/* @__PURE__ */ (0,H.jsx)(it,{entry:e,...n})},e.item.id))})]})}var $e={new:`font-semibold text-fg-primary`,seen:`font-medium text-fg-primary`,read:`font-normal text-fg-secondary`},et=`border-stroke bg-surface-hover-layer text-fg-secondary`,tt=`border-stroke bg-surface-hover-layer text-fg-success`,nt=c(o.error.edge,o.error.fill,o.error.ink),rt=`border-dashed border-stroke-hover bg-transparent text-fg-muted`;function it({entry:e,t,locale:n,now:r,onOpen:i,onLanded:a}){let{item:o,reading:s,landed:l}=e,u=G(o),d=Y(t,o),f=o.class===`action_required`?o.resolution:null,p=Oe(o),m=f===null?p===`negative`?nt:p===`positive`?tt:et:rt;return/* @__PURE__ */ (0,H.jsxs)(`button`,{type:`button`,"data-feed-row":``,"data-state":s,"data-tone":p===null?void 0:p,"data-closed":f===null?void 0:``,onClick:()=>i(o),onAnimationEnd:e=>{l&&e.target===e.currentTarget&&a(o.id)},className:c(`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,H.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,H.jsx)(u,{})}),/* @__PURE__ */ (0,H.jsxs)(`span`,{className:`grid min-w-0 gap-px`,children:[/* @__PURE__ */ (0,H.jsx)(`span`,{className:`text-(length:--text-notification-title) leading-[1.35] tracking-[-0.1px] [overflow-wrap:anywhere] ${$e[s]}`,children:o.title}),d===null?null:/* @__PURE__ */ (0,H.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,H.jsx)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs leading-4 text-fg-muted`,children:t(De[f])})]}),/* @__PURE__ */ (0,H.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:[ze(t,n,o.createdAt,r),s===`new`?/* @__PURE__ */ (0,H.jsxs)(H.Fragment,{children:[/* @__PURE__ */ (0,H.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,H.jsx)(`span`,{className:`sr-only`,children:t(`notifications.feed.new`)})]}):null]})]})}function at({children:e,align:t=`start`,className:n}){return/* @__PURE__ */ (0,H.jsxs)(`div`,{role:`alert`,className:c(`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,H.jsx)(_,{"aria-hidden":`true`}),e]})}function ot({onClick:e,children:t,size:n=`md`,className:r}){return/* @__PURE__ */ (0,H.jsx)(`button`,{type:`button`,onClick:e,className:c(`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 st(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 ct(e){return e.map(e=>e.id).join(`|`)}function lt(e){let t=e.filter(f),n=ct(t),[r,i]=(0,R.useState)(t),[a,o]=(0,R.useState)(n),[s,c]=(0,R.useState)(()=>/* @__PURE__ */ new Map),[l,u]=(0,R.useState)(()=>/* @__PURE__ */ new Set);if(a!==n){let a=new Set(t.map(e=>e.id)),s=new Set(e.filter(e=>!f(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)=>st(e.item,t.item)),openCount:t.length,history:e.filter(e=>!f(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 ut(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}async function dt(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=ut(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 ft(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var pt=2**31-1;function mt({api:e,locale:t,revision:n,logger:r,onSeen:i}){let[a,o]=(0,R.useState)({status:`loading`}),[s,c]=(0,R.useState)(0),[l,u]=(0,R.useState)(0),[d,p]=(0,R.useState)(()=>/* @__PURE__ */ new Set),m=ae(),h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useRef)(/* @__PURE__ */ new Set),v=(0,R.useRef)(i),y=(0,R.useRef)(r);(0,R.useEffect)(()=>{v.current=i,y.current=r});let b=(0,R.useCallback)(e=>{h.current=e,o({status:`ready`,data:e,more:`idle`})},[]);(0,R.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([dt(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=>{if(!r.signal.aborted){if(i===null){o({status:`error`,retrying:!1});return}y.current.error(`notification feed: re-read failed`,{error:e}),o({status:`ready`,data:i,more:`idle`})}}),()=>r.abort()},[e,t,n,s,l,b]);let x=(0,R.useCallback)(()=>{o({status:`error`,retrying:!0}),c(e=>e+1)},[]),S=(0,R.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,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=h.current;t!==null&&b({...t,items:ut(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&&o({status:`ready`,data:t,more:`error`})})},[e,t,b]),C=a.status===`ready`?a.data.items:null;(0,R.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 ft(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(!f(t)||t.expiresAt===null)return e;let n=Date.parse(t.expiresAt);return e===null||n<e?n:e},null),T=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(w===null)return;let e=`${w}@${m}`;if(T.current===e)return;let t=w-Date.now();if(t>pt)return;let n=setTimeout(()=>{T.current=e,u(e=>e+1)},t);return()=>clearTimeout(n)},[w,m]),{load:a,freshIds:d,now:m,retry:x,loadMore:S}}var ht={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`},gt=/* @__PURE__ */ new Set([`ArrowDown`,`ArrowUp`,`Home`,`End`]);function _t(e){var t;if(!gt.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 vt(e){let{api:r,locale:i,t:a,revision:o,logger:s,onSeen:c,host:l,onOpenSettings:u}=e,d=mt({api:r,locale:i,revision:o,logger:s,onSeen:c}),{load:f}=d;return/* @__PURE__ */ (0,H.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,H.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,H.jsx)(`h2`,{id:e.headingId,className:`m-0 mr-auto text-base leading-6 font-semibold tracking-[-0.35px] text-fg-primary`,children:a(`notifications.feed.title`)}),/* @__PURE__ */ (0,H.jsx)(v,{relationship:`label`,content:a(`notifications.feed.settings`),children:/* @__PURE__ */ (0,H.jsx)(n,{size:`sm`,icon:/* @__PURE__ */ (0,H.jsx)(P,{"aria-hidden":`true`}),onClick:u})})]}):null,/* @__PURE__ */ (0,H.jsx)(`div`,{onKeyDown:_t,className:`min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--scrollbar-thumb)_transparent] [scrollbar-width:thin] ${ht[l]}`,children:f.status===`loading`?/* @__PURE__ */ (0,H.jsx)(Xe,{label:a(`notifications.feed.loading`)}):f.status===`error`?/* @__PURE__ */ (0,H.jsx)(yt,{host:l,children:/* @__PURE__ */ (0,H.jsx)(t,{icon:/* @__PURE__ */ (0,H.jsx)(ie,{"aria-hidden":`true`}),title:a(`notifications.feed.errorTitle`),description:a(`notifications.feed.errorText`),retry:{label:a(`common.retry`),onRetry:d.retry,pending:f.retrying,pendingLabel:a(`common.loading`)},className:`[&_p]:max-w-70`})}):/* @__PURE__ */ (0,H.jsx)(bt,{...e,data:f.data,more:f.more,freshIds:d.freshIds,now:d.now,onLoadMore:d.loadMore})}),f.status===`ready`?/* @__PURE__ */ (0,H.jsx)(xt,{host:l,t:a,data:f.data,onOpenSettings:u}):null]})}function yt({host:e,children:t}){return/* @__PURE__ */ (0,H.jsx)(`div`,{className:c(`grid flex-1 content-center p-2`,e===`popup`?`min-h-80`:`min-h-[300px]`),children:t})}function bt({host:e,t,locale:n,data:r,more:i,freshIds:a,now:o,onLoadMore:s,onOpenTarget:c,onOpenSettings:u,focusFirstRow:d}){let f=lt(r.items),[p,m]=(0,R.useState)(()=>/* @__PURE__ */ new Set),h=(0,R.useRef)(null),g=(0,R.useRef)(!1),_=r.items.length>0;(0,R.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])),c(e)},y=e=>e.readAt!==null||p.has(e.id)?`read`:e.seenAt===null||a.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,H.jsx)(yt,{host:e,children:n?/* @__PURE__ */ (0,H.jsx)(l,{icon:/* @__PURE__ */ (0,H.jsx)(M,{"aria-hidden":`true`}),title:t(`notifications.feed.allOffTitle`),description:t(`notifications.feed.allOffText`),className:`[&_p]:max-w-70`,action:/* @__PURE__ */ (0,H.jsx)(w,{variant:`primary`,onClick:u,children:e===`panel`?/* @__PURE__ */ (0,H.jsxs)(H.Fragment,{children:[t(`notifications.feed.configureInWeb`),/* @__PURE__ */ (0,H.jsx)(O,{"aria-hidden":`true`})]}):t(`notifications.feed.openSettings`)})}):/* @__PURE__ */ (0,H.jsx)(l,{icon:/* @__PURE__ */ (0,H.jsx)(N,{"aria-hidden":`true`}),title:t(`notifications.feed.emptyTitle`),description:t(`notifications.feed.emptyText`),className:`[&_p]:max-w-70`})})}return/* @__PURE__ */ (0,H.jsxs)(`div`,{ref:h,children:[f.deck.length>0?/* @__PURE__ */ (0,H.jsx)(Ue,{entries:f.deck,count:f.openCount,host:e,t,now:o,onOpen:v,onLeft:f.onLeft,className:`mt-0.5 mb-1.5`}):null,/* @__PURE__ */ (0,H.jsx)(Ze,{entries:f.history.map(e=>({item:e,reading:y(e),landed:f.landedIds.has(e.id)})),t,locale:n,now:o,onOpen:v,onLanded:f.onLanded}),r.nextOffset<r.total?/* @__PURE__ */ (0,H.jsxs)(`div`,{className:`mt-2 mb-0.5`,children:[i===`error`?/* @__PURE__ */ (0,H.jsx)(at,{className:`mb-1.5 ml-(--nf-x)`,children:/* @__PURE__ */ (0,H.jsx)(`span`,{children:t(`notifications.feed.loadMoreFailed`)})}):null,/* @__PURE__ */ (0,H.jsx)(se,{label:t(i===`error`?`common.retry`:`notifications.feed.loadMore`),loadingLabel:t(`notifications.feed.loadMore`),loading:i===`busy`,onLoadMore:s})]}):null]})}function xt({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,H.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,H.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 flex-none text-fg-muted`}),/* @__PURE__ */ (0,H.jsxs)(`p`,{className:`m-0 min-w-0 flex-1`,children:[t(`notifications.feed.disabled`),` `,/* @__PURE__ */ (0,H.jsx)(`b`,{className:`font-medium text-fg-primary`,children:i.map(e=>e.title).join(`, `)})]}),/* @__PURE__ */ (0,H.jsx)(ot,{onClick:r,className:`flex-none`,children:e===`panel`?/* @__PURE__ */ (0,H.jsxs)(H.Fragment,{children:[t(`notifications.feed.configureInWeb`),/* @__PURE__ */ (0,H.jsx)(O,{"aria-hidden":`true`})]}):t(`notifications.feed.configure`)})]})}function St({api:e,locale:t,t:n,waitingCount:r,revision:i,logger:a,onOpenTarget:o,onOpenFeed:s,onSeen:l,className:u}){let[d,p]=(0,R.useState)(null),m=ae(),h=(0,R.useRef)(a),g=(0,R.useRef)(l);if((0,R.useEffect)(()=>{h.current=a,g.current=l}),(0,R.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(f);p(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=g.current)==null?void 0:t.call(g,e)},e=>h.current.error(`waiting strip: marking seen failed`,{count:i.length,error:e}))},e=>{n.signal.aborted||h.current.error(`waiting strip: read failed`,{error:e})}),()=>n.abort()},[e,t,r,i]),r===0||d===null||d.length===0)return null;let _=r-d.length;return/* @__PURE__ */ (0,H.jsx)(`div`,{className:c(`@container flex-none [--nf-x:13px] [--nf-surface:var(--color-bg-notification-window)]`,u),children:/* @__PURE__ */ (0,H.jsx)(Ue,{entries:d.map(e=>({item:e,leaving:!1})),count:r,host:`popup`,t:n,now:m,onOpen:o,onLeft:()=>void 0,footer:{label:_>0?n(`notifications.deck.moreAndAll`,{count:_}):n(`notifications.deck.all`),onClick:s}})})}var Ct=[[`w-[38%]`,`w-[74%]`],[`w-[52%]`,`w-[86%]`],[`w-[44%]`,`w-[68%]`]];function wt({api:e,locale:t,t:n,logger:r,onChanged:a}){let[o,s]=(0,R.useState)({status:`loading`}),[c,l]=(0,R.useState)(0),[d,f]=(0,R.useState)(()=>/* @__PURE__ */ new Map),p=(0,R.useRef)(/* @__PURE__ */ new Map),m=(0,R.useRef)(r),h=(0,R.useRef)(a);(0,R.useEffect)(()=>{m.current=r,h.current=a});let v=(0,R.useRef)(!0);(0,R.useEffect)(()=>{v.current=!0;let e=p.current;return()=>{v.current=!1;for(let t of e.values())t.next=null}},[]),(0,R.useEffect)(()=>{let n=new AbortController;return e.listGroups({locale:t,signal:n.signal}).then(e=>{n.signal.aborted||s({status:`ready`,groups:e.items})},()=>{n.signal.aborted||s({status:`error`,retrying:!1})}),()=>n.abort()},[e,t,c]);let y=(0,R.useCallback)((e,t)=>{f(n=>{let r=new Map(n);return t===null?r.delete(e):r.set(e,t),r})},[]),b=(0,R.useCallback)((n,r)=>{let i=p.current.get(n);i===void 0&&(i={inFlight:!1,next:null},p.current.set(n,i));let a=i;a.inFlight=!0,y(n,{shown:r,busy:!0,failed:null});let o=e=>{if(a.inFlight=!1,v.current){if(a.next!==null){let e=a.next;a.next=null,b(n,e);return}y(n,e===null?null:{shown:!e,busy:!1,failed:e})}};e.setGroupEnabled(n,r,{locale:t}).then(e=>{var t;s(t=>t.status===`ready`?{status:`ready`,groups:t.groups.map(t=>t.key===e.key?e:t)}:t),v.current&&((t=h.current)==null||t.call(h,e)),o(null)},e=>{m.current.error(`notification groups: save failed`,{key:n,enabled:r,error:e}),o(r)})},[e,t,y]),x=(e,t)=>{let n=p.current.get(e);if((n==null?void 0:n.inFlight)===!0){n.next=t,y(e,{shown:t,busy:!0,failed:null});return}b(e,t)};return o.status===`loading`?/* @__PURE__ */ (0,H.jsx)(H.Fragment,{children:Ct.map(([e,t],r)=>/* @__PURE__ */ (0,H.jsxs)(C,{end:/* @__PURE__ */ (0,H.jsx)(g,{className:`h-5 w-9 rounded-full`}),children:[r===0?/* @__PURE__ */ (0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:n(`notifications.groups.loading`)}):null,/* @__PURE__ */ (0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`grid gap-1.5`,children:[/* @__PURE__ */ (0,H.jsx)(g,{className:`h-3.25 ${e}`}),/* @__PURE__ */ (0,H.jsx)(g,{className:`h-2.75 ${t}`})]})]},e))}):o.status===`error`?/* @__PURE__ */ (0,H.jsx)(C,{children:/* @__PURE__ */ (0,H.jsxs)(`div`,{role:`alert`,className:`grid justify-items-start gap-2.5`,children:[/* @__PURE__ */ (0,H.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,H.jsx)(_,{"aria-hidden":`true`}),/* @__PURE__ */ (0,H.jsx)(`span`,{children:n(`notifications.groups.loadFailed`)})]}),/* @__PURE__ */ (0,H.jsx)(w,{variant:`secondary`,size:`sm`,icon:/* @__PURE__ */ (0,H.jsx)(u,{"aria-hidden":`true`}),loading:o.retrying,loadingLabel:n(`common.loading`),onClick:()=>{s({status:`error`,retrying:!0}),l(e=>e+1)},children:n(`common.retry`)})]})}):/* @__PURE__ */ (0,H.jsx)(H.Fragment,{children:o.groups.map(e=>{let t=d.get(e.key),r=t!==void 0&&t.busy?t.shown:e.enabled;return/* @__PURE__ */ (0,H.jsx)(C,{"data-on":String(r),title:e.title,caption:e.description===``?void 0:e.description,end:/* @__PURE__ */ (0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-fg-muted`,children:[t!==void 0&&t.busy?/* @__PURE__ */ (0,H.jsx)(i,{}):null,/* @__PURE__ */ (0,H.jsx)(oe,{checked:r,onChange:t=>x(e.key,t),"aria-label":e.title})]}),children:t!==void 0&&t.failed!==null?/* @__PURE__ */ (0,H.jsxs)(at,{align:`center`,className:`mt-1.5`,children:[/* @__PURE__ */ (0,H.jsx)(`span`,{children:n(`notifications.groups.saveFailed`)}),/* @__PURE__ */ (0,H.jsx)(ot,{size:`sm`,onClick:()=>x(e.key,t.failed===!0),children:n(`common.retry`)})]}):null},e.key)})})}var Tt=`animate-[extension-view-in_var(--motion-medium)_var(--ease-out)_both]`,Et=`animate-[extension-view-back_var(--motion-medium)_var(--ease-out)_both]`;async function Dt(e){let{url:t,headers:n,contentType:r,bytes:i,signal:a,onProgress:o}=e;try{return await le({method:`POST`,url:t,headers:{...n,"Content-Type":r},body:i,signal:a,onProgress:o})}catch(e){throw e instanceof j?new A({status:0,errorCode:null,params:null,message:`POST ${t}: no HTTP answer`}):e}}var Ot=401;async function kt(e){let{contentType:t,bytes:n,signal:r,onProgress:i,authorize:a,refuse:o}=e,s=async()=>{let{url:e,headers:o}=await a();return Dt({url:e,headers:o,contentType:t,bytes:n,signal:r,onProgress:i})},c=await s();return c.status===Ot&&(c=await s()),c.status<200||c.status>=300?o(c):JSON.parse(c.body)}function At(e,t){return(t==null?void 0:t.aborted)===!0?t.reason:e instanceof TypeError?new A({status:0,errorCode:null,params:null,message:e.message}):e}async function Z(e,t){try{return await e()}catch(e){throw At(e,t)}}var jt=401;async function Mt(e,t){let n=await h.call(`API_DIRECT_AUTHORIZE`,{path:t});if(`error`in n)throw new s(n.error,n.status,{method:e,path:t});return{url:n.url,headers:n.headers}}async function Q(e,t,n,r){let i=await h.call(`API_DIRECT_REFUSED`,{path:t,status:n,body:r});throw new s(i.error,i.status,{method:e,path:t})}function Nt(e){let{path:t,contentType:n,bytes:r,signal:i,onProgress:a}=e;return kt({contentType:n,bytes:r,signal:i,onProgress:a,authorize:()=>Mt(`POST`,t),refuse:({status:e,body:n})=>Q(`POST`,t,e,n)})}async function Pt(e){let{path:t,signal:n}=e,r=async()=>{let{url:e,headers:r}=await Mt(`GET`,t);return Z(()=>fetch(e,{headers:r,...n!==void 0&&{signal:n}}),n)},i=await r();if(i.status===jt&&(i=await r()),!i.ok){let e=await Z(()=>i.text(),n);return Q(`GET`,t,i.status,e)}let a=i.headers.get(`content-type`);if(a===null)throw Error(`GET ${t} answered ${String(i.status)} without a Content-Type`);let o=await Z(()=>i.arrayBuffer(),n);return{contentType:a,bytes:new Uint8Array(o)}}function Ft(){return{async request({method:e,path:t,body:n,schema:r}){let i=await $(m(t,{method:e,...n!==void 0&&{body:JSON.stringify(n)}}));return r.parse(i)},async upload({path:e,contentType:t,bytes:n,schema:r,signal:i,onProgress:a}){let o=await $(Nt({path:e,contentType:t,bytes:n,signal:i,onProgress:a}));return r.parse(o)},download({path:e,signal:t}){return $(Pt({path:e,signal:t}))}}}async function $(e){try{return await e}catch(e){throw e instanceof s?It(e):e}}function It(e){let t=typeof e.payload.message==`string`&&e.payload.message!==``?e.payload.message:`Chat request failed with HTTP ${String(e.status)}`;return new A({status:e.status,errorCode:e.errorCode??null,params:e.params??null,message:t})}export{St as a,xe as c,pe as d,de as f,wt as i,ye as l,Et as n,vt as o,P as p,Tt as r,we as s,Ft as t,fe as u};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import{r as e}from"./shared-hePW80VL.js";import{$i as t,Gn as n,Hr as r,Ji as i,Mr as a,Oi as o,Po as s,Qn as c,Ri as l,Ur as u,ci as d,ea as f,li as p,qi as m,ua as h,xi as ee,zr as te}from"./shared-LK5ScAJA.js";import{Qn as g,Yn as _,Zn as v,_r as y,br as b,dr as x,or as S,sr as C,t as ne}from"./shared-B7QwPadt.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 re=d(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ie=d(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),w=d(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),T=d(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),E=d(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),D=d(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),O=d(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),k=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),A=/* @__PURE__ */ e(i(),1),j=m(),ae=[`M28 5 L52 16 L28 27 Z`,`M59 28 L48 52 L37 28 Z`,`M36 59 L12 48 L36 37 Z`,`M5 36 L16 12 L27 36 Z`],oe={brand:[`var(--color-primary-300)`,`var(--color-primary-400)`,`var(--color-secondary)`,`var(--color-primary)`],"primary-ramp":[`var(--color-primary-300)`,`var(--color-primary-400)`,`var(--color-primary-500)`,`var(--color-primary-600)`]}
|
|
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
|
+
/**
|
|
22
|
+
* @license lucide-react v0.574.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @license lucide-react v0.574.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @license lucide-react v0.574.0 - ISC
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the ISC license.
|
|
37
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @license lucide-react v0.574.0 - ISC
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the ISC license.
|
|
43
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @license lucide-react v0.574.0 - ISC
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the ISC license.
|
|
49
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/
|
|
51
|
+
;function M({className:e,palette:t=`brand`}){let n=oe[t];return/* @__PURE__ */ (0,j.jsx)(`svg`,{viewBox:`0 0 64 64`,"aria-hidden":`true`,className:e,children:ae.map((e,t)=>/* @__PURE__ */ (0,j.jsx)(`path`,{d:e,fill:n[t],stroke:n[t],strokeWidth:`4`,strokeLinejoin:`round`},e))})}var se=ne(`pgs-3273faf788`);function ce({subtitle:e,footer:t}){let{t:r}=ee(),i=a(),s=(0,A.useId)(),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(``),[p,m]=(0,A.useState)(!1),[g,_]=(0,A.useState)(null),v=(0,A.useRef)(!1),y=async e=>{if(e.preventDefault(),!v.current){v.current=!0,m(!0);try{let e=await h.auth.login({email:l.trim(),password:d});_(null),i.signedIn(e.user)}catch(e){_(le(e))}finally{v.current=!1,m(!1)}}},b=(g==null?void 0:g.kind)===`refused`;return/* @__PURE__ */ (0,j.jsxs)(`form`,{className:`grid content-start gap-4.5 px-5 pt-7 pb-4`,"aria-labelledby":s,noValidate:!0,onSubmit:e=>{y(e)},"data-testid":`shell-sign-in`,children:[/* @__PURE__ */ (0,j.jsxs)(`div`,{className:`grid justify-items-center gap-1.5 text-center`,children:[/* @__PURE__ */ (0,j.jsx)(`span`,{className:`mb-1 grid size-16 place-items-center rounded-full bg-[radial-gradient(circle_at_50%_45%,color-mix(in_srgb,var(--color-primary)_24%,transparent)_0%,transparent_68%)]`,children:/* @__PURE__ */ (0,j.jsx)(M,{className:`size-10`})}),/* @__PURE__ */ (0,j.jsx)(`h1`,{id:s,className:`m-0 text-(length:--text-window-title) leading-(--leading-window-title) font-semibold tracking-(--tracking-window-title) text-fg-primary`,children:r(`shell.signIn.title`)}),/* @__PURE__ */ (0,j.jsx)(`p`,{className:`m-0 text-body-sm text-fg-muted`,children:e})]}),/* @__PURE__ */ (0,j.jsxs)(`div`,{className:`grid gap-3`,children:[/* @__PURE__ */ (0,j.jsx)(n,{type:`email`,label:r(`shell.signIn.email`),autoComplete:`username`,placeholder:r(`shell.signIn.emailPlaceholder`),value:l,onValueChange:u,invalid:b,autoFocus:!0}),/* @__PURE__ */ (0,j.jsx)(n,{type:`password`,label:r(`shell.signIn.password`),autoComplete:`current-password`,placeholder:r(`shell.signIn.passwordPlaceholder`),value:d,onValueChange:f,invalid:b}),g!==null&&/* @__PURE__ */ (0,j.jsx)(c,{tone:`error`,icon:g.kind===`noAnswer`?/* @__PURE__ */ (0,j.jsx)(k,{"aria-hidden":`true`}):void 0,title:g.kind===`noAnswer`?r(`shell.signIn.noAnswer`):g.message,"data-testid":`shell-sign-in-error`}),/* @__PURE__ */ (0,j.jsx)(te,{type:`submit`,size:`lg`,fullWidth:!0,loading:p,"data-testid":`shell-sign-in-submit`,children:r(`shell.signIn.submit`)}),/* @__PURE__ */ (0,j.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[/* @__PURE__ */ (0,j.jsx)(N,{onOpen:()=>o(`/forgot-password`),children:r(`shell.signIn.forgotPassword`)}),/* @__PURE__ */ (0,j.jsx)(N,{onOpen:()=>o(`/register`),external:!0,children:r(`shell.signIn.createAccount`)})]})]}),t!==void 0&&/* @__PURE__ */ (0,j.jsx)(`div`,{className:`flex justify-center border-t border-stroke-light pt-3.5`,children:t})]})}function N({onOpen:e,external:t=!1,children:n}){return/* @__PURE__ */ (0,j.jsxs)(`a`,{href:`#`,className:`rounded-xs px-0.5 py-1 text-body-sm font-medium text-fg-link no-underline hover:underline hover:underline-offset-3 focus-visible:outline-2 focus-visible:outline-stroke-focus`,onClick:t=>{t.preventDefault(),e()},children:[n,t&&/* @__PURE__ */ (0,j.jsx)(w,{"aria-hidden":`true`,className:`ml-0.75 inline size-3 align-[-1px]`})]})}function le(e){return e instanceof s&&e.status!==0?{kind:`refused`,message:t(f,e,`shell.signIn.refused`)}:(se.error(`pgm-53794f16d4`,{error:e instanceof Error?e.message:String(e)}),{kind:`noAnswer`})}function ue({user:e,project:t,children:n}){let{id:r,number:i}=t,a=(0,A.useMemo)(()=>({projectId:r,projectNumber:i,user:e}),[r,i,e]);return/* @__PURE__ */ (0,j.jsx)(l,{value:a,children:n})}function P({label:e,loadingLabel:t,loading:n,onLoadMore:i,className:a,"data-testid":o}){return/* @__PURE__ */ (0,j.jsx)(`button`,{type:`button`,onClick:i,disabled:n,"aria-busy":n||void 0,"data-testid":o,className:u(`flex h-9 w-full items-center justify-center gap-2 rounded-md border border-dashed border-stroke-hover bg-transparent text-(length:--text-body-sm) font-medium text-fg-secondary transition-colors duration-(--motion-short) ease-out hover-enabled:border-solid hover-enabled:bg-surface-hover-layer hover-enabled:text-fg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-stroke-focus aria-busy:cursor-progress`,a),children:n?/* @__PURE__ */ (0,j.jsxs)(j.Fragment,{children:[/* @__PURE__ */ (0,j.jsx)(r,{}),t]}):e})}var F=6e4,I=Date.now(),L=/* @__PURE__ */ new Set,R;function z(e){return L.add(e),R===void 0&&(I=Date.now(),R=setInterval(()=>{I=Date.now(),L.forEach(e=>e())},F)),()=>{L.delete(e),L.size===0&&R!==void 0&&(clearInterval(R),R=void 0)}}function B(){return I}function V(){return(0,A.useSyncExternalStore)(z,B,B)}var H=`relative inline-block shrink-0 rounded-full bg-surface-active-layer shadow-[inset_0_0_0_1px_var(--color-border-hairline)] [transition:background-color_var(--motion-short)_var(--ease-out)] peer-checked:bg-primary after:absolute after:rounded-full after:bg-toggle-thumb after:shadow-toggle-thumb after:content-[''] after:[transition:translate_var(--motion-short)_var(--ease-out)]`,U=`peer-checked:bg-primary/40`,de={md:`h-5 w-9 after:top-0.75 after:left-0.75 after:size-3.5 peer-checked:after:translate-x-4`,sm:`h-3.75 w-6.5 after:top-0.5 after:left-0.5 after:size-2.75 peer-checked:after:translate-x-2.75`},fe={md:`peer-checked:*:translate-x-4`,sm:`peer-checked:*:translate-x-2.75`},pe={md:`top-0.75 left-0.75 size-3.5 [&>[data-slot=spinner]]:size-2.5`,sm:`top-0.5 left-0.5 size-2.75 [&>[data-slot=spinner]]:size-2 [&>[data-slot=spinner]]:border`},me={md:`peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-stroke-focus`,sm:``},he={md:`gap-2.5 text-body-sm text-fg-primary`,sm:`h-8 gap-2 rounded-full px-2.5 text-xs font-medium text-fg-secondary [transition:background-color_var(--motion-short)_var(--ease-out)] has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-stroke-focus`},ge={md:``,sm:`hover:bg-surface-hover-layer`};function W({checked:e,onChange:t,disabled:n=!1,saving:i=!1,muted:a=!1,size:o=`md`,id:s,className:c,label:l,"aria-label":d,"aria-describedby":f,"data-testid":p,...m}){let h=n||i;return/* @__PURE__ */ (0,j.jsxs)(`label`,{...m,className:u(`relative inline-flex select-none items-center`,he[o],n?`cursor-not-allowed opacity-disabled`:i?`cursor-progress`:u(`cursor-pointer`,ge[o]),c),children:[/* @__PURE__ */ (0,j.jsx)(`input`,{type:`checkbox`,role:`switch`,id:s,checked:e,"aria-checked":e,disabled:h,"aria-busy":i||void 0,"aria-label":d,"aria-describedby":f,"data-testid":p,onChange:e=>t(e.target.checked),className:`peer sr-only`}),/* @__PURE__ */ (0,j.jsx)(`span`,{"aria-hidden":`true`,className:u(H,de[o],me[o],a&&U,i&&fe[o]),children:i&&/* @__PURE__ */ (0,j.jsx)(`span`,{className:u(`absolute z-1 grid place-items-center text-(--color-primary-text) [transition:translate_var(--motion-short)_var(--ease-out)]`,pe[o]),children:/* @__PURE__ */ (0,j.jsx)(r,{})})}),l]})}function _e({hint:e,ref:t,...n}){return e===void 0?/* @__PURE__ */ (0,j.jsx)(W,{...n,ref:t}):/* @__PURE__ */ (0,j.jsx)(p,{relationship:`description`,content:e,children:/* @__PURE__ */ (0,j.jsx)(W,{...n,ref:t})})}C({maxEdgePx:S().int().min(1),patchPx:S().int().min(1).nullable(),maxPatches:S().int().min(1).nullable()}).refine(e=>e.patchPx===null==(e.maxPatches===null),{message:`patchPx and maxPatches are null together`});var ve=C({width:S().int().min(1),height:S().int().min(1)});function ye(e,t){return Math.ceil(e.width/t.patchPx)*Math.ceil(e.height/t.patchPx)}var G=_([`image/png`,`image/jpeg`,`image/webp`,`application/pdf`,`text/plain`,`text/markdown`]),be=[`image/png`,`image/jpeg`,`image/webp`],xe=[`text/plain`,`text/markdown`];function K(e){return be.includes(e)}function Se(e){return xe.includes(e)}var Ce={"image/png":5e7,"image/jpeg":5e7,"image/webp":5e7,"application/pdf":5e7,"text/plain":4e6,"text/markdown":4e6},we=ve,Te=_([`pending`,`sent`]),Ee=C({id:y(),projectId:y(),fileName:x().min(1).max(255),mediaType:G,byteSize:S().int().min(1),pageCount:S().int().min(1).nullable(),image:we.nullable(),state:Te,createdAt:b()}).strict().superRefine((e,t)=>{e.mediaType===`application/pdf`!=(e.pageCount!==null)&&t.addIssue({code:`custom`,message:`pageCount is set exactly for application/pdf`,path:[`pageCount`]}),K(e.mediaType)!==(e.image!==null)&&t.addIssue({code:`custom`,message:`image is set exactly for an image media type`,path:[`image`]})}),De=_([`media_type`,`file_bytes`,`image_bytes`,`image_edge`,`image_patches`,`pdf_pages`,`request_bytes`,`files_bytes`,`images_count`,`many_images_edge`,`context_window`]),Oe=C({requestMaxBytes:S().int().min(1).nullable(),fileMaxBytes:S().int().min(1).nullable(),filesMaxBytesPerRequest:S().int().min(1).nullable(),imageMaxBase64Bytes:S().int().min(1).nullable(),imageMaxEdgePx:S().int().min(1).nullable(),imageMaxPatches:C({patchPx:S().int().min(1),maxPatches:S().int().min(1)}).nullable(),manyImages:C({over:S().int().min(1),maxEdgePx:S().int().min(1)}).nullable(),imagesMaxPerRequest:S().int().min(1).nullable(),pdfMaxPagesPerRequest:S().int().min(1).nullable()}),ke=C({mediaTypes:v(G).min(1),facts:Oe}).nullable();function Ae(e){return 4*Math.ceil(e/3)}function je(e,t){let n=q(e,t);if(!n.ok||t===null)return n;if(e.mediaType===`application/pdf`){if(e.pageCount===null)throw Error(`checkAttachmentFitsModel: an application/pdf attachment has no page count`);let{pdfMaxPagesPerRequest:n}=t.facts;if(n!==null&&e.pageCount>n)return{ok:!1,fact:`pdf_pages`}}return{ok:!0}}function q(e,t){if(t===null||!t.mediaTypes.includes(e.mediaType))return{ok:!1,fact:`media_type`};let{facts:n}=t,r=K(e.mediaType),i=Ae(e.byteSize);if(!r&&n.fileMaxBytes!==null&&e.byteSize>n.fileMaxBytes)return{ok:!1,fact:`file_bytes`};if(r&&n.imageMaxBase64Bytes!==null&&i>n.imageMaxBase64Bytes)return{ok:!1,fact:`image_bytes`};if(n.requestMaxBytes!==null&&i>n.requestMaxBytes)return{ok:!1,fact:`request_bytes`};if(r){let{image:t}=e;if(t===null)throw Error(`checkAttachmentFitsModel: an ${e.mediaType} attachment has no image size`);if(n.imageMaxEdgePx!==null&&Math.max(t.width,t.height)>n.imageMaxEdgePx)return{ok:!1,fact:`image_edge`};let r=n.imageMaxPatches;if(r!==null&&ye(t,r)>r.maxPatches)return{ok:!1,fact:`image_patches`}}return{ok:!0}}var Me={invalidFileName:`chat_attachments.invalid_file_name`,emptyFile:`chat_attachments.empty_file`,contentMismatch:`chat_attachments.content_mismatch`,textNotUtf8:`chat_attachments.text_not_utf8`,pdfEncrypted:`chat_attachments.pdf_encrypted`,pdfUnreadable:`chat_attachments.pdf_unreadable`,imageUnreadable:`chat_attachments.image_unreadable`,notFound:`chat_attachments.not_found`,alreadySent:`chat_attachments.already_sent`,unsupportedByModel:`chat_attachments.unsupported_by_model`};C({declared:G}).strict(),C({attachmentIds:v(y()).min(1)}).strict();var Ne=C({modelId:x().min(1),attachmentIds:v(y()).min(1),fact:De,factValue:S().nullable()}).strict(),J=e=>encodeURIComponent(e);function Y(e,t){let n=t.toString();return n===``?e:`${e}?${n}`}var X={conversationList:{method:`GET`,path:e=>{let t=new URLSearchParams;return t.set(`projectId`,e.projectId),t.set(`limit`,String(e.limit)),e.cursor!==null&&t.set(`cursor`,e.cursor),e.search!==null&&t.set(`search`,e.search),Y(`/assistant/conversations`,t)}},conversationCreate:{method:`POST`,path:()=>`/assistant/conversations`},conversationDelete:{method:`DELETE`,path:e=>`/assistant/conversations/${J(e)}`},conversationPermissionMode:{method:`PATCH`,path:e=>`/assistant/conversations/${J(e)}`},lastPermissionModeRead:{method:`GET`,path:()=>`/assistant/permission-mode`},lastPermissionModeWrite:{method:`PATCH`,path:()=>`/assistant/permission-mode`},conversationMessages:{method:`GET`,path:(e,t)=>{let n=new URLSearchParams({limit:String(t.limit)});switch(t.mode){case`latest`:n.set(`latest`,`true`),t.decisionLaneId!==null&&n.set(`decisionLaneId`,t.decisionLaneId),t.outstandingCallIds.length>0&&n.set(`outstandingCallIds`,t.outstandingCallIds.join(`,`));break;case`before`:n.set(`before`,t.olderCursor);break;case`offset`:n.set(`offset`,String(t.offset))}return Y(`/assistant/conversations/${J(e)}/messages`,n)}},browserApiHostActionResolve:{method:`POST`,path:(e,t)=>`/assistant/conversations/${J(e)}/host-actions/${J(t)}/resolve`},browserApiHostActionPersist:{method:`POST`,path:(e,t)=>`/assistant/conversations/${J(e)}/host-actions/${J(t)}/persist`},hostActionRefusal:{method:`POST`,path:(e,t)=>`/assistant/conversations/${J(e)}/host-actions/${J(t)}/refusal`},availableModels:{method:`GET`,path:()=>`/ai-settings/available-models`},subscription:{method:`GET`,path:()=>`/subscription`},aiSettingsUser:{method:`GET`,path:()=>`/ai-settings/user`},agentList:{method:`GET`,path:e=>Y(`/agents`,new URLSearchParams({limit:String(e.limit),offset:String(e.offset)}))},myLiveBrowserTasks:{method:`GET`,path:(e,t)=>Y(`/test-runs`,new URLSearchParams({projectId:e,assignedToMe:`true`,launchKind:`preset`,status:`in_progress`,executor:`browser`,limit:String(t.limit),offset:String(t.offset)}))},workflowCancel:{method:`POST`,path:e=>`/workflows/${J(e)}/cancel`},attachmentUpload:{method:`POST`,path:(e,t)=>`/assistant/projects/${J(e)}/attachments?fileName=${encodeURIComponent(t)}`},attachmentDelete:{method:`DELETE`,path:e=>`/assistant/attachments/${J(e)}`},attachmentContent:{method:`GET`,path:e=>`/assistant/attachments/${J(e)}/content`},changeSetSnapshot:{method:`GET`,path:(e,t,n)=>{let r=n===void 0?``:`view`in n?`?view=task_card`:`?itemsCursor=${encodeURIComponent(n.itemsCursor)}&itemsLimit=${String(n.itemsLimit??50)}`;return`/assistant/projects/${J(e)}/change-sets/${J(t)}${r}`}},changeSetCommand:{method:`POST`,path:(e,t,n)=>`/assistant/projects/${J(e)}/change-sets/${J(t)}/${n}`},changeSetUndo:{method:`POST`,path:e=>`/assistant/change-sets/${J(e)}/undo`},changeSetSecretValue:{method:`POST`,path:(e,t,n)=>`/assistant/projects/${J(e)}/change-sets/${J(t)}/items/${J(n)}/secret-value`},currentUser:{method:`GET`,path:()=>`/auth/me`},agentJobStatus:{method:`GET`,path:e=>`/agent-jobs/${J(e)}/status`},agentJobCommand:{method:`POST`,path:(e,t)=>`/agent-jobs/${J(e)}/${t}`},scenarioSteps:{method:`GET`,path:(e,t)=>Y(`/scenarios/${J(e)}/steps`,new URLSearchParams({limit:String(t.limit),offset:String(t.offset)}))},scenarioRuns:{method:`GET`,path:(e,t)=>Y(`/scenario-runs/scenario/${J(e)}`,new URLSearchParams({limit:String(t.limit),offset:String(t.offset),includeOutdated:`true`}))},searchPage:{method:`GET`,path:(e,t,n)=>{let r=new URLSearchParams;r.set(`q`,t.query);for(let e of t.entityTypes)r.append(`entityTypes`,e);return r.set(`limit`,String(n.limit)),r.set(`cursor`,n.cursor),Y(`/assistant/projects/${J(e)}/search`,r)}}};function Z(e){return e.selectable&&e.sendable}var Pe=[`fastest`,`balanced`,`smartest`],Fe=[`managed`,`company`,`personal`],Ie=C({id:x().min(1),name:x(),selectionId:x().min(1),selectable:g(),sendable:g(),disabledReason:_([`key_invalid`,`no_key`]).nullable(),tier:x(),reasoning:g(),attachments:ke}),Le=C({defaultSelectionId:x().nullable(),policyVersion:x(),providers:v(C({type:x(),models:v(Ie)}))}),Re=C({plan:x()});function Q(e){return Fe.includes(e)}function ze(e){return Pe.includes(e)}var Be=[`Claude `,`Anthropic `];function Ve(e){for(let t of Be)if(e.startsWith(t)){let n=e.slice(t.length).trim();if(n!==``)return n}return e}function He(e,t){let n=/* @__PURE__ */ new Map,r=[],i=[];for(let t of e.providers){if(!Q(t.type)){r.push({type:t.type,modelIds:t.models.map(e=>e.id)});continue}let e=t.type,a=t.models.flatMap(t=>ze(t.tier)?[{id:t.id,name:t.name,shortName:Ve(t.name),selectionId:t.selectionId,selectable:t.selectable,sendable:t.sendable,disabledReason:t.disabledReason,tier:t.tier,reasoning:t.reasoning,attachments:t.attachments}]:(i.push({type:e,modelId:t.id,tier:t.tier}),[]));if(a.length===0)continue;let o=n.get(e);n.set(e,o===void 0?{source:e,models:a}:{...o,models:[...o.models,...a]})}return(r.length>0||i.length>0)&&t.warn(`available-models: wire values outside the client contract were dropped`,{policyVersion:e.policyVersion,droppedBuckets:r,droppedModels:i}),{groups:[...n.values()],defaultSelectionId:e.defaultSelectionId}}function Ue(e,t){let n=$(e,t);return n===null||!Z(n.model)?null:n.model.selectionId}function $(e,t){let n=e.groups.find(e=>e.source===t.keySource);if(n===void 0)return null;let r=n.models.find(e=>e.id===t.modelId);return r===void 0?null:{model:r,source:n.source}}function We(e,t,n){let{groups:r,defaultSelectionId:i}=e,a=e=>{for(let t of r){let n=t.models.find(t=>t.selectionId===e);if(n!==void 0)return{model:n,source:t.source}}return null};if(t!==null){let e=a(t);if(e!==null)return e}if(n!==null){let e=r.find(e=>e.source===n.provider),t=e==null?void 0:e.models.find(e=>e.id===n.model);if(e!==void 0&&t!==void 0)return{model:t,source:e.source}}if(i!==null){let e=a(i);if(e!==null&&Z(e.model))return e}return null}function Ge(e){let{http:t,logger:n}=e;return{async load(){let[e,r]=await Promise.all([t.request({method:X.availableModels.method,path:X.availableModels.path(),schema:Le}),t.request({method:X.subscription.method,path:X.subscription.path(),schema:Re})]),i=He(e,n);return{groups:i.groups,defaultSelectionId:i.defaultSelectionId,isEnterprise:r.plan===`enterprise`}}}}var Ke=class extends Error{constructor(e){super(e.message),this.name=`ChatHttpError`,this.status=e.status,this.errorCode=e.errorCode,this.params=e.params}};export{O as C,w as D,T as E,ie as O,k as S,E as T,V as _,Z as a,ce as b,Me as c,Ne as d,je as f,_e as g,Se as h,$ as i,re as k,Ce as l,K as m,Ge as n,Ue as o,q as p,We as r,X as s,Ke as t,Ee as u,P as v,D as w,M as x,ue as y};
|