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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Progon",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.2",
|
|
5
5
|
"description": "Progon — visual QA tool with overlay for bug tracking, test recording, and risk zone highlighting",
|
|
6
6
|
"minimum_chrome_version": "125",
|
|
7
7
|
"permissions": [
|
|
@@ -118,20 +118,20 @@
|
|
|
118
118
|
{
|
|
119
119
|
"resources": [
|
|
120
120
|
"card/*",
|
|
121
|
-
"chunks/shared-
|
|
122
|
-
"chunks/shared-
|
|
123
|
-
"chunks/shared-
|
|
124
|
-
"chunks/shared-
|
|
125
|
-
"chunks/shared-
|
|
126
|
-
"chunks/shared-
|
|
127
|
-
"chunks/shared-
|
|
128
|
-
"chunks/shared-
|
|
129
|
-
"chunks/shared-
|
|
130
|
-
"chunks/shared-
|
|
131
|
-
"chunks/shared-
|
|
132
|
-
"chunks/shared-
|
|
133
|
-
"chunks/shared-
|
|
134
|
-
"chunks/shared-
|
|
121
|
+
"chunks/shared-B5dGSIVr.js",
|
|
122
|
+
"chunks/shared-BBv6J4oP.js",
|
|
123
|
+
"chunks/shared-BQbdfGz-.css",
|
|
124
|
+
"chunks/shared-BROt3HHj.js",
|
|
125
|
+
"chunks/shared-Beih6ywL.js",
|
|
126
|
+
"chunks/shared-C05lJ8nQ.js",
|
|
127
|
+
"chunks/shared-C5qHe-zg.js",
|
|
128
|
+
"chunks/shared-CUdYAeXx.js",
|
|
129
|
+
"chunks/shared-CgUMEof2.js",
|
|
130
|
+
"chunks/shared-CmGrLhdH.js",
|
|
131
|
+
"chunks/shared-DDyAbNyB.js",
|
|
132
|
+
"chunks/shared-Dk6zuyaK.css",
|
|
133
|
+
"chunks/shared-hePW80VL.js",
|
|
134
|
+
"chunks/shared-pdVr5lDK.js"
|
|
135
135
|
],
|
|
136
136
|
"matches": [
|
|
137
137
|
"<all_urls>"
|
|
@@ -141,22 +141,23 @@
|
|
|
141
141
|
{
|
|
142
142
|
"resources": [
|
|
143
143
|
"workspace/*",
|
|
144
|
-
"chunks/shared-
|
|
145
|
-
"chunks/shared-
|
|
146
|
-
"chunks/shared-
|
|
147
|
-
"chunks/shared-
|
|
148
|
-
"chunks/shared-
|
|
149
|
-
"chunks/shared-
|
|
150
|
-
"chunks/shared-
|
|
151
|
-
"chunks/shared-
|
|
152
|
-
"chunks/shared-
|
|
153
|
-
"chunks/shared-
|
|
154
|
-
"chunks/shared-
|
|
155
|
-
"chunks/shared-
|
|
156
|
-
"chunks/shared-
|
|
157
|
-
"chunks/shared-
|
|
158
|
-
"chunks/shared-
|
|
159
|
-
"chunks/shared-hePW80VL.js"
|
|
144
|
+
"chunks/shared-BAuQl9-k.js",
|
|
145
|
+
"chunks/shared-BBv6J4oP.js",
|
|
146
|
+
"chunks/shared-BQbdfGz-.css",
|
|
147
|
+
"chunks/shared-Beih6ywL.js",
|
|
148
|
+
"chunks/shared-C05lJ8nQ.js",
|
|
149
|
+
"chunks/shared-C5qHe-zg.js",
|
|
150
|
+
"chunks/shared-CFv6cSrr.js",
|
|
151
|
+
"chunks/shared-CNYvsh0O.js",
|
|
152
|
+
"chunks/shared-CUdYAeXx.js",
|
|
153
|
+
"chunks/shared-CdFf-X4Y.css",
|
|
154
|
+
"chunks/shared-CgUMEof2.js",
|
|
155
|
+
"chunks/shared-CmGrLhdH.js",
|
|
156
|
+
"chunks/shared-DDyAbNyB.js",
|
|
157
|
+
"chunks/shared-Dbbjj01C.js",
|
|
158
|
+
"chunks/shared-Dk6zuyaK.css",
|
|
159
|
+
"chunks/shared-hePW80VL.js",
|
|
160
|
+
"chunks/shared-pdVr5lDK.js"
|
|
160
161
|
],
|
|
161
162
|
"matches": [
|
|
162
163
|
"<all_urls>"
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Progon Offscreen</title>
|
|
6
6
|
<script type="module" crossorigin src="../offscreen/offscreen.js"></script>
|
|
7
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-COCbj3mN.js">
|
|
7
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C05lJ8nQ.js">
|
|
8
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-Dbbjj01C.js">
|
|
10
9
|
</head>
|
|
11
10
|
<body>
|
|
12
11
|
</body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../chunks/shared-
|
|
1
|
+
import{t as e}from"../chunks/shared-C05lJ8nQ.js";import"../chunks/shared-Dbbjj01C.js";var t=2e4,n=`AGENT_RUNTIME_HEARTBEAT`,r=e(`pgs-6c97a01773`),i={type:n};setInterval(()=>{chrome.runtime.sendMessage(i).catch(e=>{r.warn(`pgm-45c13bd730`,{error:e instanceof Error?e.message:String(e)})})},t);
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
<title>Progon</title>
|
|
6
6
|
<script type="module" crossorigin src="../popup/popup.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="../chunks/shared-hePW80VL.js">
|
|
8
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="../chunks/shared-
|
|
8
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C05lJ8nQ.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C5qHe-zg.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-B5dGSIVr.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-CFv6cSrr.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-CNYvsh0O.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C0apd10a.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-pdVr5lDK.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="../chunks/shared-BQbdfGz-.css">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="../popup/popup.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{r as e}from"../chunks/shared-hePW80VL.js";import{$i as t,$
|
|
1
|
+
import{r as e}from"../chunks/shared-hePW80VL.js";import{$i as t,$t as n,Ai as r,B as i,Bi as a,Bn as o,Ca as s,Dn as c,Ds as l,Ea as u,Ei as d,F as f,Ft as p,G as m,Ga as h,Gn as g,Gr as _,H as v,Hi as y,Hn as b,Ir as x,Ji as S,Jr as C,K as ee,Ki as w,Kn as T,Lr as E,Nr as D,Ns as O,O as te,Oi as k,On as ne,Or as re,Ps as ie,Qa as A,Qn as ae,Qt as oe,R as se,Ri as ce,Rr as le,Sr as j,Ui as ue,Un as de,V as fe,Vi as pe,Vn as me,Vr as M,Wa as he,Wi as ge,Wr as _e,X as ve,Xa as ye,Xn as be,Yn as xe,Za as N,Zt as Se,_a as Ce,_n as we,_r as P,a as Te,ai as Ee,an as De,ao as Oe,bi as ke,d as Ae,dt as je,eo as Me,er as Ne,fn as Pe,ga as F,gi as Fe,hi as Ie,hn as Le,i as Re,ia as I,j as ze,ks as Be,li as Ve,lo as L,mn as He,mr as Ue,na as We,no as Ge,o as Ke,oo as qe,pn as Je,qn as Ye,r as Xe,ra as R,ro as Ze,sn as Qe,so as z,sr as $e,ta as et,tn as tt,to as nt,tr as rt,va as it,vi as at,vr as ot,wi as st,xi as ct,yi as lt,z as ut,za as dt,zi as B}from"../chunks/shared-C5qHe-zg.js";import{t as V,z as ft}from"../chunks/shared-C05lJ8nQ.js";import{t as pt}from"../chunks/shared-B5dGSIVr.js";import{i as mt,r as ht,t as gt}from"../chunks/shared-CFv6cSrr.js";import{a as _t,c as vt,d as yt,f as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt,u as Ot}from"../chunks/shared-C0apd10a.js";import{a as kt,c as At,d as jt,f as Mt,g as Nt,i as Pt,l as Ft,m as It,n as Lt,p as Rt,t as zt,u as Bt}from"../chunks/shared-CNYvsh0O.js";import{a as Vt,b as Ht,c as Ut,d as Wt,f as Gt,g as Kt,h as qt,i as Jt,l as Yt,m as Xt,n as Zt,o as Qt,p as $t,r as en,s as tn,t as nn,u as rn,v as an,x as on,y as sn}from"../chunks/shared-pdVr5lDK.js"
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.574.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
;var
|
|
8
|
+
;var cn=R(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),ln=R(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),un=R(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),dn=R(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),fn=R(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),pn=R(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),H=/* @__PURE__ */ e(h(),1),U=he()
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.574.0 - ISC
|
|
11
11
|
*
|
|
@@ -36,4 +36,4 @@ import{r as e}from"../chunks/shared-hePW80VL.js";import{$i as t,$n as n,$r as r,
|
|
|
36
36
|
* This source code is licensed under the ISC license.
|
|
37
37
|
* See the LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
|
-
;function nn({off:e}){let{t}=M();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-body-md font-semibold tracking-(--tracking-brand) text-fg-primary`,children:[/* @__PURE__ */ (0,U.jsx)(zt,{className:y(`size-5 [transition:filter_var(--motion-medium)_var(--ease-out),opacity_var(--motion-medium)_var(--ease-out)]`,e&&`opacity-50 grayscale`)}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:t(`popup.brand`)})]})}function rn({children:e}){return/* @__PURE__ */ (0,U.jsx)(`header`,{className:`flex h-12 flex-none items-center gap-1 border-b border-stroke-light bg-(--color-bg-window-header) pr-2 pl-3.5`,children:e})}function an({children:e,className:t}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:y(`grid min-h-0 flex-1 grid-cols-1 content-start gap-4 overflow-y-auto px-3 pt-3 pb-4 [scrollbar-width:thin]`,t),children:e})}function on(){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`popup-loading`,children:[/* @__PURE__ */ (0,U.jsxs)(rn,{children:[/* @__PURE__ */ (0,U.jsx)(nn,{off:!1}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5 w-9 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`ml-2 size-7 rounded-md`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`ml-2 size-6 rounded-full`})]}),/* @__PURE__ */ (0,U.jsx)(an,{children:/* @__PURE__ */ (0,U.jsx)(sn,{})})]})}function sn(){let{t:e}=M();return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,"aria-label":e(`shell.loading`),className:`grid gap-2.5 rounded-lg border border-stroke bg-surface-card pt-3 pr-3 pb-3.5 pl-3.5`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`size-8.5 rounded-md`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`h-2.5 w-12`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-3.5 w-[62%]`})]})]}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex items-center gap-2.5 pl-1`,children:/* @__PURE__ */ (0,U.jsx)(L,{className:`h-3 w-[60%]`})}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 pl-1`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5.5 w-18.5 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5.5 w-20.5 rounded-full`})]})]}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid gap-2`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`h-2.5 w-37.5`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8.5 w-21 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8.5 w-27.5 rounded-full`})]})]})]})}function cn({value:e,options:t,onChange:n,ariaLabel:r,size:i,fullWidth:a,className:o}){return/* @__PURE__ */ (0,U.jsx)(k,{value:e,options:t,onValueChange:n,"aria-label":r,size:i,fullWidth:a,className:o})}var ln=V(`pgs-4d9951d24e`);function un(e){let t=0,n=Promise.resolve(),r=null;async function i(n,i,a){if(n!==t)return;if(e.signedInUserId()!==a){ln.warn(`pgm-4b072233de`,{locale:i});return}let o=new AbortController;r=o;try{await e.save(i,o.signal)}catch(r){if(o.signal.aborted){ln.info(`pgm-7aaa461c83`,{locale:i});return}if(n===t){e.onFailure(i,r);return}ln.warn(`pgm-f93a88619e`,{locale:i,error:r})}finally{r=null}}return{write(e,r){t+=1;let a=t;n=n.then(()=>i(a,e,r)).catch(t=>{ln.error(`pgm-1491eca8c6`,{locale:e,error:t})})},discardPending(){t+=1,r==null||r.abort()}}}var dn=V(`pgs-b78fd5fe0f`),fn=(0,H.createContext)(null);function pn({user:e,children:t}){let{t:n}=M(),r=w(),[i]=(0,H.useState)(()=>gn(e.id));return(0,H.useEffect)(()=>{i.setFailureReport((e,t)=>{dn.error(`pgm-0f28f45227`,{locale:e,error:t instanceof Error?t.message:String(t)}),r.show({id:`popup-profile-language`,variant:`error`,message:n(`popup.language.profileSaveFailed`),action:{label:n(`common.retry`),onAction:()=>i.retryShownLocale()}})})}),(0,H.useEffect)(()=>(i.start(),()=>i.end()),[i]),/* @__PURE__ */ (0,U.jsx)(fn,{value:i.profileLocale,children:t})}function mn(){return(0,H.useContext)(fn)}function hn(){let e=(0,H.useContext)(fn);if(e===null)throw Error(`useSignedInProfileLocale() is used outside the signed-in popup`);return e}function gn(e){let t=!1,n=null,r=un({save:async(e,t)=>{await R.preferences.update({locale:e},{signal:t})},signedInUserId:()=>t?e:null,onFailure:(e,t)=>{if(n===null)throw Error(`A profile language write failed before the popup was rendered`);n(e,t)}});return{profileLocale:{write:t=>r.write(t,e),discardPending:()=>r.discardPending()},setFailureReport:e=>{n=e},retryShownLocale:()=>{t&&r.write(I(),e)},start:()=>{t=!0},end:()=>{t=!1,r.discardPending()}}}function _n(e){let t=Ge(e);return(0,H.useSyncExternalStore)(t.subscribe,t.getState)}var vn=V(`pgs-520a54a8e3`);function W(e){let t=_n(e);if(t.status===`failed`)throw t.error;return t.status===`ready`?t.value:void 0}function yn(){let{t:e}=M(),t=w();return(0,H.useCallback)(function n(r){r.run().catch(i=>{vn.error(r.log.message,{...r.log.context,error:i instanceof Error?i.message:String(i)}),t.show({id:r.id,variant:`error`,message:r.message,detail:r.detail,action:{label:e(`common.retry`),onAction:()=>n(r)}})})},[e,t])}function G(){let{t:e}=M(),t=yn();return(0,H.useCallback)((n,r)=>t({id:`setting-${n}`,run:()=>je(n,r),log:{message:`A setting was not stored`,context:{key:n}},message:e(`popup.settings.saveFailed`)}),[e,t])}function bn({size:e,fullWidth:t}){let{t:n}=M(),r=yn(),i=mn();return/* @__PURE__ */ (0,U.jsx)(cn,{value:I(),options:S.map(e=>({value:e,label:n(`common.languageNames.${e}`)})),onChange:e=>r({id:`popup-language`,run:async()=>{await Le(e)!==`superseded`&&(i==null||i.write(e))},log:{message:`The language was not switched or not stored`,context:{locale:e}},message:n(`popup.settings.saveFailed`)}),ariaLabel:n(`popup.languageGroup`),size:e,fullWidth:t})}function xn(){let{t:e}=M();return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:/* @__PURE__ */ (0,U.jsx)(qt,{subtitle:e(`shell.signIn.subtitlePopup`),footer:/* @__PURE__ */ (0,U.jsx)(bn,{size:`sm`})})})}var Sn=V(`pgs-d05703aaa3`);function Cn({user:e}){let{t}=M(),n=w(),[r,a]=(0,H.useState)(!1),o=hn(),s=`${e.firstName} ${e.lastName}`;return/* @__PURE__ */ (0,U.jsxs)(l,{label:t(`popup.header.account`,{name:s}),align:`end`,className:`w-59`,trigger:/* @__PURE__ */ (0,U.jsx)(E,{"aria-label":t(`popup.header.account`,{name:s}),icon:/* @__PURE__ */ (0,U.jsx)(Jt,{firstName:e.firstName,lastName:e.lastName,email:e.email,size:`sm`,unknownLabel:t(`popup.header.unknownUser`)}),"data-testid":`popup-account`}),children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid gap-px px-2.5 py-2`,children:[/* @__PURE__ */ (0,U.jsx)(`b`,{className:`text-body-sm font-semibold text-fg-primary`,children:s}),/* @__PURE__ */ (0,U.jsxs)(`small`,{className:`text-xs text-fg-muted`,children:[e.email,` \u00B7 `,e.company.name]})]}),/* @__PURE__ */ (0,U.jsx)(T,{}),/* @__PURE__ */ (0,U.jsx)(i,{label:t(`popup.header.openWeb`),icon:/* @__PURE__ */ (0,U.jsx)(Ft,{"aria-hidden":`true`}),onSelect:()=>u()}),/* @__PURE__ */ (0,U.jsx)(T,{}),/* @__PURE__ */ (0,U.jsx)(i,{label:t(`popup.header.signOut`),icon:/* @__PURE__ */ (0,U.jsx)(Qt,{"aria-hidden":`true`}),tone:`danger`,disabled:r,onSelect:()=>{r||(a(!0),o.discardPending(),R.auth.logout().catch(e=>{Sn.error(`pgm-4db83b7ea3`,{error:e instanceof Error?e.message:String(e)}),n.show({id:`popup-sign-out`,variant:`error`,message:t(`popup.header.signOutFailed`)})}).finally(()=>a(!1)))},"data-testid":`popup-sign-out`})]})}function wn({enabled:e}){let{t}=M(),n=yn();return/* @__PURE__ */ (0,U.jsx)(P,{relationship:`description`,content:t(e?`popup.header.switchOn`:`popup.header.switchOff`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`inline-flex`,children:/* @__PURE__ */ (0,U.jsx)(Bt,{"aria-label":t(`popup.header.switchLabel`),checked:e,onChange:e=>n({id:`popup-power-switch`,run:()=>je(`enabled`,e),log:{message:`The extension switch was not stored`,context:{enabled:e}},message:t(`popup.header.switchFailed`),detail:t(`popup.header.switchFailedDetail`)}),className:`p-1.5`,"data-testid":`popup-power-switch`})})})}function Tn({user:e,onOpenSettings:t,notificationCounts:n,onOpenNotifications:r}){let{t:i}=M(),a=W(`enabled`);return/* @__PURE__ */ (0,U.jsxs)(rn,{children:[/* @__PURE__ */ (0,U.jsx)(nn,{off:a===!1}),a===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5 w-9 rounded-full`}):/* @__PURE__ */ (0,U.jsx)(wn,{enabled:a}),/* @__PURE__ */ (0,U.jsx)(Mt,{host:`popup`,t:i,counts:a===!1?null:n,onClick:r}),/* @__PURE__ */ (0,U.jsx)(P,{relationship:`label`,content:i(`popup.header.settings`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(At,{"aria-hidden":`true`}),onClick:t,"data-testid":`popup-open-settings`})}),/* @__PURE__ */ (0,U.jsx)(Cn,{user:e})]})}var En=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:f,setFocused:m,validationMode:h,validation:g}=Ne(),{labelId:_}=Ae(),v=bt(),y=v.useState(`selectionMode`),b=v.useState(`disabled`),x=v.useState(`readOnly`),S=v.useState(`required`),ee=v.useState(`positionerElement`),C=v.useState(`listElement`),te=v.useState(`popupId`),w=v.useState(`triggerProps`),T=v.useState(`inputInsidePopup`),E=v.useState(`id`),re=v.useState(`labelId`),D=v.useState(`open`),ae=v.useState(`selectedValue`),O=v.useState(`activeIndex`),oe=v.useState(`selectedIndex`),se=v.useState(`hasSelectedValue`),k=xt(),ce=nt(),A=we(),j=u||b||a,le=pt(),ue=ut(v);We({id:T?o:void 0});let de=T?o??E:o,fe=Ie(_,re),pe;D&&T?pe=te??vt(E):D&&(pe=C==null?void 0:C.id);let ge=H.useRef(``);function _e(e){ge.current=e.pointerType}let{reference:ye}=Je(k,{enabled:!D&&!x&&!b&&y===`single`,listRef:v.context.labelsRef,activeIndex:O,selectedIndex:oe,onMatch(e){let t=v.context.valuesRef.current[e];t!==void 0&&v.context.setSelectedValue(t,Me(d))}}),{reference:be}=ne(k,{enabled:!b,event:`mousedown`}),{buttonRef:M,getButtonProps:N}=Ce({native:i,disabled:j}),Se={...l,readOnly:x,open:D,disabled:j,popupSide:ue,listEmpty:le,placeholder:y!==`none`&&!se},P=Pe(e=>{v.set(`triggerElement`,e)});return xe(`button`,e,{ref:[t,M,P],state:Se,props:[w,be,ye,{id:de,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":D,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":pe,"aria-required":T&&S||void 0,"aria-readonly":T&&x||void 0,"aria-labelledby":fe,onPointerDown:_e,onPointerEnter:_e,onFocus(){m(!0),!j&&A.start(0,v.context.forceMount)},onBlur(e){if(!me(ee,e.relatedTarget)&&(f(!0),m(!1),h===`onBlur`)){let e=y===`none`?ce:ae;g.commit(e)}},onMouseDown(e){if(j)return;if(T||k.set(`domReferenceElement`,e.currentTarget),v.context.forceMount(),ge.current!==`touch`){var t;(t=v.context.inputRef.current)==null||t.focus(),T||e.preventDefault()}if(D)return;let n=Te(e.currentTarget);function r(e){let t=v.state.triggerElement;if(!t)return;let n=ve(e),r=v.state.positionerElement,i=v.state.listElement;me(t,n)||me(r,n)||me(i,n)||he(e,t)||v.context.setOpen(!1,Me(De,e))}T&&n.addEventListener(`mouseup`,r,{once:!0})},onKeyDown(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){var t;ie(e),v.context.setOpen(!0,Me(p,e.nativeEvent)),(t=v.context.inputRef.current)==null||t.focus()}}},g.getValidationProps(j,c),N],stateAttributesMapping:st})}),Dn=/*#__PURE__*/ H.createContext(void 0);function On(){let e=H.useContext(Dn);if(e===void 0)throw Error(Ee(18));return e}var kn=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=bt().useState(`grid`),[c,l]=H.useState(),u=H.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=xe(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=/*#__PURE__*/ (0,U.jsx)(Dn.Provider,{value:u,children:d});return a?/*#__PURE__*/ (0,U.jsx)(_t,{items:a,children:f}):f}),An=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=On(),c=ze(a);return Be(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),xe(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),jn=/^[^\p{L}\p{N}]*(\p{L})/u;function Mn(e){let t=e.trim().split(/\s+/).flatMap(e=>{var t;let n=(t=jn.exec(e))==null?void 0:t[1];return n===void 0?[]:[n.toLocaleUpperCase()]}).slice(0,2).join(``);return t===``?null:t}var Nn=`grid shrink-0 place-items-center font-semibold tracking-(--tracking-snug) select-none`,Pn=`bg-(image:--btn-primary-fill) text-fg-on-accent`,Fn=`bg-(--color-bg-tertiary) text-fg-muted shadow-[inset_0_0_0_1px_var(--color-border-hairline)]`,In=`shadow-[var(--shadow-primary-inset),var(--shadow-tile-primary-glow)]`,Ln={22:`size-5.5 rounded-sm text-(length:--text-2xs) [&_svg]:size-3`,26:`size-6.5 rounded-md text-xs [&_svg]:size-3.5`,32:`size-8 rounded-md text-sm [&_svg]:size-4`,40:`size-10 rounded-lg text-base [&_svg]:size-4.5`},Rn=/* @__PURE__ */ new Set([26,32,40]);function zn({name:e,size:t,drained:n=!1,className:r}){let i=e===null?null:Mn(e),a=n?Fn:y(Pn,Rn.has(t)&&In);return/* @__PURE__ */ (0,U.jsx)(`span`,{"aria-hidden":`true`,"data-size":t,"data-drained":n||void 0,className:y(Nn,Ln[t],a,r),children:i??/* @__PURE__ */ (0,U.jsx)(Gt,{})})}var Bn=5,Vn=3,Hn=`grid shrink-0 place-items-center rounded-md border border-solid border-[color-mix(in_srgb,var(--color-primary)_28%,transparent)] bg-(--color-bg-primary-tint-10) text-sm font-semibold tracking-(--tracking-snug) text-(--color-primary-text)`,Un=`grid shrink-0 place-items-center rounded-md border border-dashed border-stroke-hover bg-surface-hover-layer text-fg-muted [&_svg]:size-4`,Wn=`group/trigger flex h-11.5 w-full min-w-0 cursor-pointer items-center gap-2.5 rounded-md border border-solid border-transparent bg-transparent pr-2 pl-1.25 text-left font-sans outline-none [transition:background-color_var(--motion-short)_var(--ease-out),border-color_var(--motion-short)_var(--ease-out)] hover:border-stroke hover:bg-surface-hover-layer focus-visible:border-stroke-focus focus-visible:ring-3 focus-visible:ring-focus-ring data-popup-open:border-stroke-focus data-popup-open:bg-surface-secondary`,Gn=`group/trigger inline-flex h-9 min-w-0 shrink-0 cursor-pointer items-center gap-2 rounded-full border-0 bg-transparent pr-2.25 pl-1.25 font-sans text-body-sm font-semibold tracking-(--tracking-control) text-fg-primary [transition:background-color_var(--motion-short)_var(--ease-out)] hover:bg-surface-hover-layer data-popup-open:bg-surface-hover-layer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-stroke-focus`,Kn={header:`min-w-0 max-w-45 truncate`,"header-narrow":`min-w-0 max-w-30 truncate`},qn=`grid size-6.5 shrink-0 place-items-center rounded-md border border-dashed border-stroke-hover bg-surface-hover-layer text-fg-muted`,Jn=`grid grid-cols-[minmax(0,1fr)] gap-px overflow-y-auto overscroll-contain outline-none`,Yn={popup:`w-75`,list:`max-h-[min(--spacing(80),var(--available-height))]`,search:y(fe(`default`,!1,`page`,`sm`,`search`),`m-0.5 mb-1.5`),rowTile:null,row:`data-selected:bg-(--color-bg-primary-tint-10) [&>svg:last-child]:text-(--color-primary-text)`},Xn={full:{popup:`w-(--anchor-width)`,list:`max-h-[min(--spacing(52),var(--available-height))]`,search:y(fe(`default`,!1,`page`,`popup-search`),`mb-1`),rowTile:`grid size-5.5 shrink-0 place-items-center rounded-sm bg-surface-hover-layer text-caption font-semibold text-fg-secondary`,row:``},header:Yn,"header-narrow":Yn,"header-tile":Yn};function Zn({value:e,onValueChange:t,list:n,labels:r,variant:i=`full`,recent:a,footerActions:o,open:c,onOpenChange:l,autoFocus:u,"data-testid":d}){let f=v(),p=(0,H.useId)(),m=(0,H.useId)(),[g,_]=(0,H.useState)(``),[S,ee]=(0,H.useState)(!1),C=c??S,w=Xn[i],T=n.state===`ready`?n.projects:null,E=(0,H.useMemo)(()=>T===null?/* @__PURE__ */ new Map:new Map(T.map(e=>[e.id,e])),[T]),ne=(0,H.useMemo)(()=>{if(T===null||a===void 0||g.trim()!==``||T.length<=Bn)return null;let e=new Set(a.ids),t=T.filter(t=>e.has(t.id));return t.length===0?null:[{heading:a.heading,items:t},{heading:a.restHeading,items:T.filter(t=>!e.has(t.id))}]},[T,a,g]),re=T===null?[]:ne??T,D=e=>{c===void 0&&ee(e),l==null||l(e),e||_(``)},ie=e=>{let t=Mn(e.name);return/* @__PURE__ */ (0,U.jsxs)(ct,{value:e,className:y(ce,w.row),children:[w.rowTile===null?/* @__PURE__ */ (0,U.jsx)(zn,{name:e.name,size:22}):/* @__PURE__ */ (0,U.jsx)(`span`,{className:w.rowTile,"aria-hidden":`true`,children:t??/* @__PURE__ */ (0,U.jsx)(Gt,{className:`size-3`})}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:y(le,`truncate`),children:e.name}),/* @__PURE__ */ (0,U.jsx)(Re,{"aria-hidden":`true`,className:h})]},e.id)},oe=n.state===`loading`?/* @__PURE__ */ (0,U.jsx)(`div`,{role:`status`,"aria-label":r.loading,className:`grid gap-px`,children:Array.from({length:Vn},(e,t)=>/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2.5 px-2.5 py-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`size-5.5 rounded-sm`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-3 w-[60%]`})]},t))}):n.state===`error`?/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`alert`,className:`grid justify-items-center gap-2 pb-2`,children:[/* @__PURE__ */ (0,U.jsx)(`p`,{className:y(te,`m-0 pb-0`),children:n.message}),/* @__PURE__ */ (0,U.jsx)(O,{variant:`secondary`,size:`sm`,onClick:n.onRetry,children:r.retry})]}):/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(mt,{children:/* @__PURE__ */ (0,U.jsx)(`div`,{className:te,children:r.empty})}),/* @__PURE__ */ (0,U.jsx)(rt,{"aria-label":r.label,className:y(Jn,w.list),children:ne===null?ie:e=>/* @__PURE__ */ (0,U.jsxs)(kn,{items:e.items,children:[/* @__PURE__ */ (0,U.jsx)(An,{className:ae,children:e.heading}),/* @__PURE__ */ (0,U.jsx)(lt,{children:ie})]},e.heading)})]}),se=y(e===null?Un:Hn,`size-8.5`),k=e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{className:qn,"aria-hidden":`true`,children:/* @__PURE__ */ (0,U.jsx)(Qn,{name:null})}):/* @__PURE__ */ (0,U.jsx)(zn,{name:e.name,size:26}),A=/* @__PURE__ */ (0,U.jsx)(be,{"aria-hidden":`true`,className:y(`shrink-0 text-fg-muted [transition:transform_var(--motion-medium)_var(--ease-out)] group-data-popup-open/trigger:rotate-180`,i===`full`?`size-4`:`size-3.25`)}),j=i===`header-tile`?/* @__PURE__ */ (0,U.jsxs)(En,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${m}`,className:Gn,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{id:p,className:`sr-only`,children:r.label}),k,/* @__PURE__ */ (0,U.jsx)(`span`,{id:m,className:`sr-only`,children:e===null?r.placeholder:e.name}),A]}):i===`header`||i===`header-narrow`?/* @__PURE__ */ (0,U.jsxs)(En,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${m}`,className:Gn,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{id:p,className:`sr-only`,children:r.label}),k,e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{id:m,className:y(Kn[i],`font-medium text-fg-secondary`),children:r.placeholder}):/* @__PURE__ */ (0,U.jsx)(de,{value:e.name,children:/* @__PURE__ */ (0,U.jsx)(`span`,{id:m,className:Kn[i],children:e.name})}),A]}):/* @__PURE__ */ (0,U.jsxs)(En,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${m}`,className:Wn,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:se,"aria-hidden":`true`,children:/* @__PURE__ */ (0,U.jsx)(Qn,{name:(e==null?void 0:e.name)??null})}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`grid min-w-0 flex-1 leading-(--leading-picker)`,children:[/* @__PURE__ */ (0,U.jsx)(`small`,{id:p,className:`text-(length:--text-picker-label) text-fg-muted`,children:r.label}),e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{id:m,className:`truncate text-base font-medium tracking-(--tracking-snug) text-fg-secondary`,children:r.placeholder}):/* @__PURE__ */ (0,U.jsx)(de,{value:e.name,children:/* @__PURE__ */ (0,U.jsx)(`span`,{id:m,className:`truncate text-base font-semibold tracking-(--tracking-heading) text-fg-primary`,children:e.name})})]}),A]});return/* @__PURE__ */ (0,U.jsxs)(ot,{items:re,value:e,onValueChange:e=>{if(e===null)return;let n=E.get(e.id);if(n===void 0)throw Error(`ProjectPicker: chosen project ${e.id} is not in the list`);t(n)},itemToStringLabel:e=>e.name,isItemEqualToValue:(e,t)=>e.id===t.id,inputValue:g,onInputValueChange:_,open:C,onOpenChange:D,autoHighlight:!0,children:[i===`header-tile`?/* @__PURE__ */ (0,U.jsx)(P,{relationship:`none`,content:e===null?r.placeholder:e.name,placement:`bottom`,children:j}):j,/* @__PURE__ */ (0,U.jsx)(ht,{container:f,children:/* @__PURE__ */ (0,U.jsx)(ft,{side:`bottom`,align:`start`,sideOffset:i===`full`?4:8,collisionPadding:8,positionMethod:`fixed`,className:s,children:/* @__PURE__ */ (0,U.jsxs)(tt,{"data-project-picker":``,"aria-label":r.placeholder,className:y(Qe,w.popup),children:[/* @__PURE__ */ (0,U.jsxs)(it,{className:w.search,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:He,children:/* @__PURE__ */ (0,U.jsx)(x,{"aria-hidden":`true`})}),/* @__PURE__ */ (0,U.jsx)(at,{placeholder:r.search,"aria-label":r.search,className:b})]}),oe,o!==void 0&&/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(`div`,{className:`mx-(--menu-padding) my-1 h-px border-0 bg-stroke-light`,role:`separator`}),o.map(e=>/* @__PURE__ */ (0,U.jsxs)(`button`,{type:`button`,"data-testid":e.testId,className:y(`group/opt flex min-h-(--menu-row-height) w-full cursor-pointer select-none items-center gap-(--menu-row-gap) rounded-(--menu-row-radius) border-0 bg-transparent px-(--menu-row-padding-x) py-(--menu-row-padding-y) text-left font-sans text-[length:var(--text-body-sm)] leading-normal outline-hidden [transition:background-color_var(--motion-instant)_var(--ease-out)] data-disabled:cursor-not-allowed data-disabled:opacity-disabled [&_svg]:size-(--menu-icon-size) [&_svg]:shrink-0 text-fg-primary data-highlighted:bg-surface-elevated-hover active:bg-surface-elevated-active data-selected:font-medium`,`hover:bg-surface-elevated-hover focus-visible:bg-surface-elevated-hover`),onClick:()=>{D(!1),e.onSelect()},children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`inline-flex shrink-0 text-fg-muted`,children:e.icon}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.label})]},e.label))]})]})})})]})}function Qn({name:e}){let t=e===null?null:Mn(e);return t===null?/* @__PURE__ */ (0,U.jsx)(Gt,{"aria-hidden":`true`,className:`size-4`}):/* @__PURE__ */ (0,U.jsx)(U.Fragment,{children:t})}var $n=`animate-[popup-bind-swap_var(--motion-medium)_var(--ease-out)_both] motion-reduce:animate-none`;function er({host:e,applicationName:t,environmentName:n,newApplication:r,newEnvironment:i,replaced:a,fresh:o}){let s=e=>e.trim()===``?`\u2026`:e.trim(),c={host:/* @__PURE__ */ (0,U.jsx)(`span`,{children:e}),application:/* @__PURE__ */ (0,U.jsx)(`span`,{children:s(t)}),environment:/* @__PURE__ */ (0,U.jsx)(`span`,{children:s(n)}),old:/* @__PURE__ */ (0,U.jsx)(`span`,{children:a===null?``:a.address}),b:/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`})},l;l=a===null?r&&i?`popup.site.bindSay.both`:r?`popup.site.bindSay.newApplication`:i?`popup.site.bindSay.newEnvironment`:`popup.site.bindSay.free`:o===`taken`?`popup.site.bindSay.freshTaken`:o===`changed`?`popup.site.bindSay.freshChanged`:`popup.site.bindSay.replace`;let u=`${l}|${t}|${n}|${a===null?``:a.address}`;return a===null?/* @__PURE__ */ (0,U.jsx)(`p`,{"aria-live":`polite`,className:`m-0 min-w-0 text-(length:--text-compact) leading-normal text-fg-secondary text-pretty wrap-anywhere ${$n}`,"data-testid":`popup-bind-consequence`,children:/* @__PURE__ */ (0,U.jsx)(Ye,{i18nKey:l,components:c})},u):/* @__PURE__ */ (0,U.jsx)(`div`,{role:o===null?void 0:`alert`,"aria-live":o===null?`polite`:void 0,className:$n,"data-testid":`popup-bind-consequence`,"data-replace":`true`,children:/* @__PURE__ */ (0,U.jsx)(D,{tone:`warning`,title:/* @__PURE__ */ (0,U.jsx)(Ye,{i18nKey:l,components:c})})},u)}var tr={local:`dev`,dev:`dev`,staging:`staging`,prod:`production`},nr=/* @__PURE__ */ new WeakMap;function rr(e,t){return`${e}|${t}`}function ir(e){let t=nr.get(e);if(t!==void 0)return t;let n=new Map(e.map(e=>[rr(e.applicationId,e.environmentId),e]));return nr.set(e,n),n}function ar(e,t,n){let r=ir(e).get(rr(t,n));return r===void 0?null:r}function or(e,t,n){return n===null||t.kind!==`existing`||n.kind!==`existing`?null:ar(e.cells,t.id,n.id)}function sr(e){return e.trim().toLowerCase()}function cr(e,t){let n=sr(t);if(n===``)return null;let r=e.find(e=>sr(e.name)===n);return r===void 0?null:r}function lr(e,t,n){let r=e.environments.filter(n=>t===null||ar(e.cells,t,n.id)===null),i=r.find(e=>e.envType===n.type)??r.find(e=>e.isDefault)??r.at(0);return i===void 0?{choice:{kind:`new`,name:cr(e.environments,n.name)===null?n.name:``},allTaken:e.environments.length>0}:{choice:{kind:`existing`,id:i.id},allTaken:!1}}var ur=/* @__PURE__ */ new Set([`targets.cell_exists`,`targets.modified_concurrently`,`targets.host_conflict`,`targets.not_found`]);function dr(e){return e instanceof Fe&&e.errorCode!==void 0?e.errorCode:null}function fr(e){return e instanceof Error?e.message:String(e)}function pr(e,t,n){return{application:e.application.kind===`new`&&n.application===null?cr(t.applications,e.application.name):null,environment:e.environment!==null&&e.environment.kind===`new`&&n.environment===null?cr(t.environments,e.environment.name):null}}function mr(e){let t=dr(e);return t!==null&&ur.has(t)}function hr(e){return e.application!==null&&e.environment!==null?`both`:e.application===null?e.environment===null?null:`environment`:`application`}function gr(e,n){let r=hr(e);return r===null?n:t.t(`popup.site.createdNotBound.${r}`,{application:e.application,environment:e.environment,reason:n})}function K(e,n){let r=hr(n);if(r===null)return re(t,e,`popup.site.bindFailed`);let i={application:n.application,environment:n.environment},a=t.t(`popup.site.bindPartial.${r}`,i),o=re(t,e,`popup.site.bindPartial.${r}`,i);return o===a?o:gr(n,o)}function _r(e,t,n,r,i){let{defaultApplicationId:a,proposal:o}=i,s=e.application,c=s.kind===`existing`&&!t.applications.some(e=>e.id===s.id)?{kind:`existing`,id:a}:s;if(!t.applications.some(e=>e.id===a))throw Error(`The default application ${a} left the project`);let l={...e,lists:t,application:c},u=e.environment;if(u!==null&&u.kind===`existing`&&!t.environments.some(e=>e.id===u.id)){let e=lr(t,c.kind===`existing`?c.id:null,o);l={...l,environment:e.choice,environmentAllTaken:e.allTaken,environmentChosen:!1}}let d=dr(n),f=or(t,l.application,l.environment);return d===`targets.cell_exists`?{...l,fresh:f===null?null:`taken`,failure:null}:d===`targets.modified_concurrently`?{...l,fresh:f===null?null:`changed`,failure:null}:d===`targets.host_conflict`?{...l,fresh:null,failure:vr(n,l,r,i.host)}:{...l,fresh:null,failure:K(n,r)}}function vr(e,n,r,i){var a;let o=e instanceof Fe&&typeof((a=e.params)==null?void 0:a.applicationId)==`string`?e.params.applicationId:null,s=n.lists.applications.find(e=>e.id===o),c=n.environment,l=c!==null&&c.kind===`existing`?n.lists.environments.find(e=>e.id===c.id):void 0;return s===void 0||l===void 0?K(e,r):gr(r,t.t(`popup.site.hostConflict`,{host:i,application:s.name,environment:l.name}))}var q=V(`pgs-e9b150372c`);function yr(e){let{defaultApplicationId:t,host:n,proposal:r,requests:i}=e,[a,o]=(0,H.useState)(()=>{let n=lr(e.lists,t,r);return{lists:e.lists,application:{kind:`existing`,id:t},environment:n.choice,environmentChosen:!1,environmentAllTaken:n.allTaken,problem:null,failure:null,fresh:null,pending:!1,createUnsettled:!1,focus:null}}),s=(0,H.useRef)(!1),c=(0,H.useRef)(0),l=()=>(c.current+=1,c.current),u=(e,t)=>({target:e,field:t,seq:l()}),d=(e,t)=>{if(e.environmentChosen&&e.environment!==null)return{environment:e.environment,environmentAllTaken:e.environmentAllTaken};let n=lr(e.lists,t.kind===`existing`?t.id:null,r);return{environment:n.choice,environmentAllTaken:n.allTaken}},f=(e,t)=>({...e,application:t,...d(e,t),problem:null,failure:null,fresh:null}),p=(e,t)=>({...e,environment:t,environmentChosen:!0,environmentAllTaken:!1,problem:null,failure:null,fresh:null}),m=(e,t)=>{s.current||o(n=>{if(e===`application`)return t===`new`?{...f(n,{kind:`new`,name:``}),focus:u(`input`,e)}:f(n,{kind:`existing`,id:t});if(t!==`new`)return p(n,{kind:`existing`,id:t});let i=cr(n.lists.environments,r.name)!==null;return{...p(n,{kind:`new`,name:i?``:r.name}),focus:u(`input`,e)}})},h=(e,t)=>{o(n=>{let r=e===`application`?n.application:n.environment;if(r===null||r.kind!==`new`)throw Error(`The ${e} field is not a new name, it cannot be renamed`);let i={kind:`new`,name:t};return{...n,...e===`application`?{application:i}:{environment:i},problem:n.problem!==null&&n.problem.field===e?null:n.problem}})},g=e=>{s.current||o(n=>{if(e===`application`)return{...f(n,{kind:`existing`,id:t}),focus:u(`trigger`,e)};if(n.lists.environments.length===0)throw Error(`A project without environments has no list to go back to`);let i=lr(n.lists,n.application.kind===`existing`?n.application.id:null,r),a=i.choice.kind===`existing`?i.choice:null;return{...p(n,a),focus:u(`trigger`,e)}})},_=(e,t)=>{o(n=>({...e===`application`?f(n,{kind:`existing`,id:t}):p(n,{kind:`existing`,id:t}),focus:u(`trigger`,e)}))},v=async a=>{let s={application:null,environment:null},c=a;if(c.createUnsettled)try{c=b(c,await i.readLists(),s)}catch(e){q.error(`pgm-9a173522f2`,{error:fr(e)}),o(t=>({...t,failure:K(e,s),focus:{target:`submit`,seq:l()}}));return}let u=c.environment;if(u===null)throw Error(`The bind press ran with no environment chosen`);let d=null;try{let t;if(c.application.kind===`new`){d=`application`;let n=await i.createApplication(c.application.name.trim());d=null,s.application=n.name,t=n.id,o(e=>({...e,lists:{...e.lists,applications:[...e.lists.applications,n]},application:{kind:`existing`,id:n.id}})),e.onApplicationCreated()}else t=c.application.id;let n;if(u.kind===`new`){d=`environment`;let e=await i.createEnvironment(u.name.trim(),c.lists.environments.length===0);d=null,s.environment=e.name,n=e.id,o(t=>({...t,lists:{...t.lists,environments:[...t.lists.environments,e]},environment:{kind:`existing`,id:e.id},environmentAllTaken:!1}))}else n=u.id;let r=or(c.lists,c.application,u);r===null?await i.createCell(t,n):await i.replaceCell(r)}catch(e){if(q.error(`pgm-53ab6bb5fe`,{createdApplication:s.application!==null,createdEnvironment:s.environment!==null,status:e instanceof Fe?e.status:null,code:dr(e),error:fr(e)}),d!==null){await y(c,s,e);return}if(mr(e))try{let a=await i.readLists();o(i=>({..._r(i,a,e,s,{defaultApplicationId:t,proposal:r,host:n}),focus:{target:`submit`,seq:l()}}));return}catch(e){q.error(`pgm-a2654be732`,{error:fr(e)})}o(t=>({...t,failure:K(e,s),focus:{target:`submit`,seq:l()}}));return}q.info(`pgm-dfe3d492ed`,{createdApplication:s.application!==null,createdEnvironment:s.environment!==null}),await e.onBound()},y=async(e,t,n)=>{let r;try{r=await i.readLists()}catch(e){q.error(`pgm-200d50f185`,{error:fr(e)}),o(e=>({...e,createUnsettled:!0,failure:K(n,t),focus:{target:`submit`,seq:l()}}));return}b(e,r,t),o(e=>({...e,failure:K(n,t),focus:{target:`submit`,seq:l()}}))},b=(t,n,r)=>{let i=pr(t,n,r);i.application!==null&&(r.application=i.application.name,e.onApplicationCreated()),i.environment!==null&&(r.environment=i.environment.name),(i.application!==null||i.environment!==null)&&q.info(`pgm-52181e7844`,{application:i.application!==null,environment:i.environment!==null});let a=e=>({...e,lists:n,createUnsettled:!1,...i.application===null?{}:{application:{kind:`existing`,id:i.application.id}},...i.environment===null?{}:{environment:{kind:`existing`,id:i.environment.id},environmentAllTaken:!1}});return o(a),a(t)};return{state:a,choose:m,rename:h,backToList:g,chooseExisting:_,submit:()=>{if(!s.current){if(a.environment===null){o(e=>({...e,problem:{field:`environment`,kind:`unchosen`},focus:u(`trigger`,`environment`)}));return}for(let e of[`application`,`environment`]){let t=e===`application`?a.application:a.environment;if(t.kind!==`new`)continue;if(t.name.trim()===``){o(t=>({...t,problem:{field:e,kind:`empty`},focus:u(`input`,e)}));return}let n=cr(e===`application`?a.lists.applications:a.lists.environments,t.name);if(n!==null){o(t=>({...t,problem:{field:e,kind:`duplicate`,id:n.id,name:n.name},focus:u(`input`,e)}));return}}s.current=!0,o(e=>({...e,pending:!0,failure:null,fresh:null,problem:null})),v(a).finally(()=>{s.current=!1,o(e=>({...e,pending:!1}))})}}}}var br=V(`pgs-e9b150372c`),xr=`animate-[popup-bind-swap_var(--motion-medium)_var(--ease-out)_both] motion-reduce:animate-none`;function Sr(e){let{t}=M(),n=yr(e),{state:r}=n,i=(0,H.useId)(),a=e=>`${i}-${e}`,o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=r.focus;if(e===null)return;let t;if(t=e.target===`submit`?c.current:e.target===`input`?(e.field===`application`?o:s).current:document.getElementById(`${i}-${e.field}`),t===null){br.warn(`pgm-9d57cb6e57`,{target:e.target});return}t.focus()},[r.focus,i]);let{lists:l,application:u,environment:d,pending:f,problem:p}=r,m=u.kind===`new`?u.name:Cr(l.applications,u.id),h=d===null?``:d.kind===`new`?d.name:Cr(l.environments,d.id),_=or(l,u,d),v=e=>{if(p!==null&&p.field===e)return p.kind===`empty`?t(e===`application`?`popup.site.emptyApplication`:`popup.site.emptyEnvironment`):p.kind===`unchosen`?t(`popup.site.environmentRequired`):/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 wrap-anywhere`,children:[t(e===`application`?`popup.site.duplicateApplication`:`popup.site.duplicateEnvironment`,{name:p.name}),` `,/* @__PURE__ */ (0,U.jsx)(O,{variant:`link`,size:`xs`,onClick:()=>n.chooseExisting(e,p.id),"data-testid":`popup-bind-${e}-choose-existing`,children:t(`popup.site.chooseExisting`)})]})},y=(e,r,i)=>{let c=e===`application`||l.environments.length>0;return/* @__PURE__ */ (0,U.jsx)(g,{ref:e===`application`?o:s,id:a(e),size:`sm`,fieldClassName:`grid-cols-1`,label:t(e===`application`?`popup.site.newApplication`:`popup.site.newEnvironment`),placeholder:t(e===`application`?`popup.site.newApplicationPlaceholder`:`popup.site.newEnvironmentPlaceholder`),autoComplete:`off`,value:r,onValueChange:t=>n.rename(e,t),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),n.submit()):t.key===`Escape`&&c&&(t.preventDefault(),n.backToList(e))},disabled:f,leading:/* @__PURE__ */ (0,U.jsx)(pe,{"aria-hidden":`true`,className:`size-3.5 text-fg-link`}),trailing:c?/* @__PURE__ */ (0,U.jsx)(P,{relationship:`label`,content:t(`popup.site.backToList`),placement:`top`,children:/* @__PURE__ */ (0,U.jsx)(E,{size:`sm`,icon:/* @__PURE__ */ (0,U.jsx)(C,{"aria-hidden":`true`}),onClick:()=>n.backToList(e),disabled:f,"data-testid":`popup-bind-${e}-back`})}):void 0,hint:i,error:v(e),className:xr,"data-testid":`popup-bind-${e}-name`},`${e}-new`)},b=e=>({options:[{value:`new`,label:t(e===`application`?`popup.site.newApplication`:`popup.site.newEnvironment`),icon:/* @__PURE__ */ (0,U.jsx)(pe,{"aria-hidden":`true`,className:`text-fg-link`})}]}),x=u.kind===`new`?y(`application`,u.name,void 0):/* @__PURE__ */ (0,U.jsx)(B,{id:a(`application`),size:`sm`,fieldClassName:`grid-cols-1`,label:t(`popup.site.applicationLabel`),value:u.id,onValueChange:e=>n.choose(`application`,e),disabled:f,groups:[{options:l.applications.map(e=>({value:e.id,label:e.name}))},b(`application`)],"data-testid":`popup-bind-application`},`application-list`),S;l.environments.length===0?S=t(`popup.site.noEnvironmentsHint`):r.environmentAllTaken&&(S=/* @__PURE__ */ (0,U.jsx)(`span`,{className:`wrap-anywhere`,children:t(`popup.site.allTakenHint`,{application:m.trim()===``?`\u2026`:m.trim()})}));let ee=d!==null&&d.kind===`new`?y(`environment`,d.name,S):/* @__PURE__ */ (0,U.jsx)(B,{id:a(`environment`),size:`sm`,fieldClassName:`grid-cols-1`,label:t(`popup.site.environmentLabel`),value:d===null?null:d.id,placeholder:t(`popup.site.environmentPlaceholder`),error:v(`environment`),onValueChange:e=>n.choose(`environment`,e),disabled:f,groups:[{options:l.environments.map(e=>{let n=u.kind===`existing`?ar(l.cells,u.id,e.id):null;return n===null?{value:e.id,label:e.name}:{value:e.id,label:e.name,description:t(`popup.site.taken`,{address:n.address})}})},b(`environment`)],"data-testid":`popup-bind-environment`},`environment-list`);return/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`group`,"aria-label":t(`popup.site.bind`),"aria-busy":f,className:`grid min-w-0 grid-cols-1 gap-2.5 rounded-md border border-stroke-light bg-surface-modal-inset px-3 pt-2.5 pb-3`,"data-testid":`popup-bind-form`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2.5`,children:[x,ee]}),p===null&&d!==null&&/* @__PURE__ */ (0,U.jsx)(er,{host:e.host,applicationName:m,environmentName:h,newApplication:u.kind===`new`,newEnvironment:d.kind===`new`,replaced:_,fresh:r.fresh}),r.failure!==null&&/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-1.5 text-(length:--text-compact) leading-(--leading-caption) text-fg-error`,"data-testid":`popup-bind-failure`,children:[/* @__PURE__ */ (0,U.jsx)(Ke,{"aria-hidden":`true`,className:`mt-px size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:r.failure})]}),/* @__PURE__ */ (0,U.jsx)(O,{ref:c,size:`sm`,icon:_===null?/* @__PURE__ */ (0,U.jsx)(_e,{"aria-hidden":`true`}):/* @__PURE__ */ (0,U.jsx)(Xt,{"aria-hidden":`true`}),loading:f,onClick:n.submit,className:`justify-self-end`,"data-testid":`popup-bind-submit`,children:t(_===null?`popup.site.bind`:`popup.site.replace`)})]})}function Cr(e,t){let n=e.find(e=>e.id===t);if(n===void 0)throw Error(`The bind form chose ${t}, absent from its list`);return n.name}function J({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{"aria-live":`polite`,className:`grid grid-cols-1 gap-2 border-t border-stroke-light py-2.5 pr-3 pl-3.5 animate-ui-fade-in motion-reduce:animate-none`,"data-testid":`popup-site`,children:e})}function Y({host:e}){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-body-sm text-fg-secondary`,children:[/* @__PURE__ */ (0,U.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-fg-muted`}),/* @__PURE__ */ (0,U.jsx)(`b`,{className:`min-w-0 truncate font-medium text-fg-primary`,children:e})]})}var wr=`inline-flex h-6 items-center rounded-full border border-stroke bg-surface-hover-layer text-xs text-fg-primary`;function Tr({applicationName:e,environmentName:t}){let{t:n}=M();return/* @__PURE__ */ (0,U.jsxs)(`div`,{"aria-label":n(`popup.site.cellLabel`),className:`flex flex-wrap items-center gap-1.5`,"data-testid":`popup-site-cell`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:y(wr,`px-2.25 font-medium`),children:e}),/* @__PURE__ */ (0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-fg-muted`,children:`\u00D7`}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:y(wr,`px-2.5 font-semibold animate-[popup-environment-in_var(--motion-long)_var(--ease-out)_both]`),children:t})]})}function Er({children:e,hintName:t,hint:n,tone:r=`default`,icon:i}){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:y(`flex min-w-0 items-center gap-1.5 [&>svg]:size-3.5 [&>svg]:shrink-0`,r===`warning`&&`text-fg-warning`),children:[i,/* @__PURE__ */ (0,U.jsx)(`p`,{className:y(`m-0 min-w-0 text-(length:--text-compact) leading-normal [&_b]:font-semibold [&_b]:text-fg-primary`,r===`warning`?`text-inherit`:r===`muted`?`text-fg-muted`:`text-fg-secondary`),children:e}),/* @__PURE__ */ (0,U.jsx)(_,{name:t,text:n,placement:`bottom-start`})]})}var Dr=V(`pgs-f048f86b7e`);function Or({projectId:e,host:t,environments:n,chosenId:r,onChosen:i}){let{t:a}=M(),o=w(),[s,c]=(0,H.useState)(!1);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(Er,{hintName:a(`popup.site.more`,{about:a(`popup.site.environmentChoice`)}),hint:a(`popup.site.environmentChoiceHint`),children:a(`popup.site.environmentChoice`)}),/* @__PURE__ */ (0,U.jsx)(B,{size:`sm`,"aria-label":a(`popup.site.environmentLabel`),placeholder:a(`popup.site.environmentPlaceholder`),value:r,onValueChange:t=>{s||(c(!0),R.environments.setActive(N(e),`extension`,t).then(()=>{Dr.info(`pgm-f54cd7418d`,{projectId:e}),i()}).catch(t=>{Dr.error(`pgm-effdde2b56`,{projectId:e,error:t instanceof Error?t.message:String(t)}),o.show({id:`popup-environment-choice`,variant:`error`,message:a(`popup.site.environmentFailed`)})}).finally(()=>c(!1)))},disabled:s,options:n.map(e=>({value:e.id,label:e.name,description:t})),"data-testid":`popup-site-environment`})]})}function kr(e){let t=e.toLowerCase();return/(^|\/\/|\.)dev\./.test(t)?`dev`:/stag/.test(t)?`staging`:/localhost|127\.0/.test(t)?`local`:`prod`}function Ar(e){let t=e.toLowerCase();return/prod/.test(t)?`production`:/stag/.test(t)?`staging`:/dev|local|\u043B\u043E\u043A\u0430\u043B/.test(t)?`dev`:`custom`}function jr(e){let t=kr(e);return{key:`popup.site.environmentSuggestion.${t}`,type:tr[t]}}async function Mr(e,t,n){let r=N(t),[i,a,o]=await Promise.all([e.targets.listAll(r,{signal:n}),e.applications.byProject(r,{signal:n}),e.environments.list(r,{signal:n})]);return{targets:i,applications:a,environments:o}}async function Nr(e,t,n,r){let i=await Mr(e,t,r),{targets:a,applications:o,environments:s}=i,c=(e,n)=>{let r=e.find(e=>e.id===n);if(r===void 0)throw Error(`A cell of project ${t} names ${n}, absent from the lists just read`);return r.name},l=yt(n.href,a.map(Yt),null);switch(l.kind){case`matched`:return{kind:`matched`,applicationName:c(o,l.applicationId),environmentName:c(s,l.environmentId)};case`ambiguous_application`:return{kind:`ambiguous`,environmentName:c(s,l.environmentId)};case`environment_choice`:{let n=await e.environments.getActive(N(t),`extension`,{signal:r}),i=n.source===`user_preference`&&l.environmentIds.includes(n.environmentId)?n.environmentId:null;return{kind:`environmentChoice`,environments:s.filter(e=>l.environmentIds.includes(e.id)).map(e=>({id:e.id,name:e.name})),chosenId:i}}case`unknown_host`:case`no_targets`:{let e=o.find(e=>e.isDefault);if(e===void 0)throw Error(`Project ${t} has no default application`);return{kind:`bind`,reason:l.kind,lists:Fr(i),defaultApplicationId:e.id}}case`unsupported_url`:return{kind:`unsupported`}}}async function Pr(e,t){return Fr(await Mr(e,t,void 0))}function Fr(e){return{applications:e.applications.map(Ir),environments:e.environments.map(Lr),cells:e.targets.map(Rr)}}function Ir(e){return{id:e.id,name:e.name}}function Lr(e){return{id:e.id,name:e.name,envType:e.envType,isDefault:e.isDefault}}function Rr(e){let t;if(e.baseUrl!==null)t=new URL(e.baseUrl).host;else if(e.hostPattern!==null)t=e.hostPattern;else throw Error(`Cell ${e.id} has neither an origin nor a host pattern`);return{id:e.id,applicationId:e.applicationId,environmentId:e.environmentId,address:t,hostPattern:e.hostPattern,updatedAt:e.updatedAt}}async function zr(e,t,n){return Ir(await e.applications.create({projectId:N(t),name:n}))}async function Br(e,t,n,r){return Lr(await e.environments.create({projectId:N(t),name:n,envType:Ar(n),isDefault:r}))}async function Vr(e,t,n,r,i){await e.targets.create(N(t),{applicationId:Oe(r),environmentId:i,baseUrl:n})}async function Hr(e,t,n,r){let i=r.hostPattern!==null&&et(n,[{targetId:r.id,applicationId:r.applicationId,environmentId:r.environmentId,baseUrl:null,hostPattern:r.hostPattern}]).length>0;await e.targets.update(N(t),r.id,{baseUrl:n,...r.hostPattern===null||i?{}:{hostPattern:null},expectedUpdatedAt:r.updatedAt})}var Ur=V(`pgs-c1e3b0bb6f`);function Wr({page:e,projects:t,onSelect:n}){let{t:r}=M(),{data:i,error:a}=f({fetcher:()=>R.targets.match(e.href),deps:[e.href]});if((0,H.useEffect)(()=>{a!==null&&Ur.error(`pgm-f294aabbd9`,{error:a.message})},[a]),a!==null||i===void 0)return null;let o=new Set(i.items.map(e=>e.projectId)),s=t.filter(e=>o.has(e.id));return s.length===0?null:/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:e.host}),s.map(e=>/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface-hover-layer py-2 pr-2 pl-2.5`,children:[/* @__PURE__ */ (0,U.jsxs)(`p`,{className:`m-0 min-w-0 flex-1 truncate text-(length:--text-compact) leading-(--leading-caption) text-fg-secondary`,children:[r(`popup.site.suggestion`),` `,/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`,children:r(`popup.site.suggestionProject`,{project:e.name})})]}),/* @__PURE__ */ (0,U.jsx)(O,{variant:`secondary`,size:`sm`,onClick:()=>n(e),"data-testid":`popup-site-suggestion`,children:r(`popup.site.select`)})]},e.id))]})}var Gr=V(`pgs-3b85b4fc58`);function Kr({tabId:e,project:t,projects:n,onSelectProject:r,onApplicationCreated:i}){let{data:o,error:s}=f({fetcher:()=>chrome.tabs.get(e).then(e=>e.url??null),deps:[e]});if((0,H.useEffect)(()=>{s!==null&&Gr.error(`pgm-df207305cf`,{tabId:e,error:s.message})},[s,e]),s!==null||o===void 0)return null;let c=o===null?null:a(o),l=c!==null&&c.ok?c.url:null;return t===null?l===null?null:/* @__PURE__ */ (0,U.jsx)(Wr,{page:l,projects:n,onSelect:r}):l===null?/* @__PURE__ */ (0,U.jsx)(qr,{}):/* @__PURE__ */ (0,U.jsx)(Jr,{project:t,page:l,onApplicationCreated:i})}function qr(){let{t:e}=M();return/* @__PURE__ */ (0,U.jsx)(J,{children:/* @__PURE__ */ (0,U.jsx)(Er,{tone:`muted`,hintName:e(`popup.site.more`,{about:e(`popup.site.notSite`)}),hint:e(`popup.site.notSiteHint`),children:e(`popup.site.notSite`)})})}function Jr({project:e,page:t,onApplicationCreated:n}){let{t:r}=M(),{data:i,loading:a,error:o,reload:s}=f({fetcher:n=>Nr(R,e.id,t,n),deps:[e.id,t.href]}),c={createApplication:t=>zr(R,e.id,t),createEnvironment:(t,n)=>Br(R,e.id,t,n),createCell:(n,r)=>Vr(R,e.id,t.origin,n,r),replaceCell:n=>Hr(R,e.id,t.origin,n),readLists:()=>Pr(R,e.id)},l=async()=>{try{let t=await F.call(`REFRESH_PROJECT_TARGETS`,{projectId:e.id});t.success||Gr.error(`pgm-ef389a0081`,{projectId:e.id,error:t.error})}catch(t){Gr.error(`pgm-fc30de5d00`,{projectId:e.id,error:t instanceof Error?t.message:String(t)})}s()};if(o!==null)return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsxs)(`p`,{role:`alert`,className:`m-0 flex gap-1.5 text-(length:--text-compact) leading-normal text-fg-error`,children:[/* @__PURE__ */ (0,U.jsx)(Ke,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:r(`popup.site.readFailed`)})]}),/* @__PURE__ */ (0,U.jsx)(`div`,{children:/* @__PURE__ */ (0,U.jsx)(O,{variant:`secondary`,size:`sm`,icon:/* @__PURE__ */ (0,U.jsx)(ge,{"aria-hidden":`true`}),onClick:s,"data-testid":`popup-site-retry`,children:r(`common.retry`)})})]});if(a||i===void 0)return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,"aria-label":r(`popup.site.reading`),className:`flex items-center gap-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(L,{className:`h-6 w-18.5 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(L,{className:`h-6 w-20.5 rounded-full`})]})]});switch(i.kind){case`unsupported`:return/* @__PURE__ */ (0,U.jsx)(qr,{});case`matched`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Tr,{applicationName:i.applicationName,environmentName:i.environmentName})]});case`ambiguous`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Er,{tone:`warning`,icon:/* @__PURE__ */ (0,U.jsx)(Ue,{"aria-hidden":`true`}),hintName:r(`popup.site.more`,{about:r(`popup.site.ambiguous`,{environment:i.environmentName})}),hint:r(`popup.site.ambiguousHint`),children:r(`popup.site.ambiguous`,{environment:i.environmentName})})]});case`environmentChoice`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Or,{projectId:e.id,host:t.host,environments:i.environments,chosenId:i.chosenId,onChosen:s})]});case`bind`:{let a=jr(t.host);return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Er,{hintName:r(`popup.site.bindMore`),hint:r(`popup.site.bindInfo`),children:/* @__PURE__ */ (0,U.jsx)(Ye,{i18nKey:i.reason===`no_targets`?`popup.site.noTargets`:`popup.site.notBound`,components:{b:/* @__PURE__ */ (0,U.jsx)(`b`,{}),project:/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})}})}),/* @__PURE__ */ (0,U.jsx)(Sr,{lists:i.lists,defaultApplicationId:i.defaultApplicationId,host:t.host,proposal:{name:r(a.key),type:a.type},requests:c,onApplicationCreated:n,onBound:l})]})}}}var Yr=V(`pgs-930365a583`),Xr=`all`;function Zr({tabId:e,applications:t,applicationId:n}){let{t:r}=M(),i=w();return/* @__PURE__ */ (0,U.jsx)(B,{appearance:`inline`,label:r(`popup.application.label`),value:n===null?Xr:n,onValueChange:t=>{let n=t===Xr?null:t;F.call(`SET_TAB_STATE`,{tabId:e,state:{applicationId:n}}).then(e=>{if(!e.success)throw Error(`SET_TAB_STATE refused: ${e.error}`)}).catch(t=>{Yr.error(`pgm-e58825e7fe`,{tabId:e,error:t instanceof Error?t.message:String(t)}),i.show({id:`popup-application`,variant:`error`,message:r(`popup.application.switchFailed`)})})},options:[{value:Xr,label:r(`popup.application.all`)},...t.map(e=>({value:e.id,label:e.name}))],"data-testid":`popup-application`})}function Qr({run:e}){let{t}=M();return/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2.5 rounded-b-lg border-t border-stroke-light bg-[color-mix(in_srgb,var(--color-info)_8%,transparent)] py-2.25 pr-3 pl-3.5 text-(length:--text-compact) leading-snug`,"data-testid":`popup-run-line`,children:[/* @__PURE__ */ (0,U.jsx)(`i`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-info shadow-(--glow-status-info) animate-pulse-dot`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`text-fg-secondary`,children:[/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`,children:e.kind===`free`?t(`popup.run.free`,{number:e.number}):t(`popup.run.plan`,{plan:e.planName})}),` `,t(`popup.run.where`)]})]})}var $r=V(`pgs-c184079221`);function ei({tabId:e,projects:t,tabProject:n,applicationId:r,run:i,onPick:a,pickerOpen:o,onPickerOpenChange:s}){let{t:c}=M(),[l,u]=(0,H.useState)(0);return/* @__PURE__ */ (0,U.jsxs)(`section`,{"aria-label":c(`popup.project.contextLabel`),className:`relative rounded-lg border border-(--color-border-overlay) bg-surface-card shadow-(--shadow-context-card)`,"data-testid":`popup-context`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`relative grid p-2`,children:[/* @__PURE__ */ (0,U.jsx)(Zn,{value:n===null?null:{id:n.id,name:n.name},onValueChange:a,list:{state:`ready`,projects:t},labels:{label:c(`popup.project.label`),placeholder:c(`popup.project.placeholder`),search:c(`popup.project.search`),empty:c(`popup.project.empty`),loading:c(`popup.project.loading`),retry:c(`common.retry`)},open:o,onOpenChange:s,autoFocus:!0,"data-testid":`popup-project`}),n!==null&&/* @__PURE__ */ (0,U.jsx)(ti,{tabId:e,projectId:n.id,applicationId:r,applicationsCreated:l},n.id)]}),/* @__PURE__ */ (0,U.jsx)(Kr,{tabId:e,project:n,projects:t,onSelectProject:a,onApplicationCreated:()=>u(e=>e+1)},`${e}:${n===null?``:n.id}`),i!==null&&/* @__PURE__ */ (0,U.jsx)(Qr,{run:i})]})}function ti({tabId:e,projectId:t,applicationId:n,applicationsCreated:r}){let{data:i,error:a}=f({fetcher:e=>R.applications.byProject(N(t),{signal:e}),deps:[t,r]});return(0,H.useEffect)(()=>{a!==null&&$r.error(`pgm-f42292fd59`,{error:a.message})},[a]),a!==null||i===void 0||i.length<=1?null:/* @__PURE__ */ (0,U.jsx)(Zr,{tabId:e,applications:i,applicationId:n})}var ni=[{key:`bugs`,tone:`error`},{key:`checklists`,tone:`primary`},...qe.incidentsEnabled?[{key:`incidents`,tone:`warning`}]:[]],ri={bugs:`popup.filters.bugs`,checklists:`popup.filters.checklists`,incidents:`popup.filters.incidents`};function ii(){let{t:e}=M(),t=W(`filters`),n=G();return/* @__PURE__ */ (0,U.jsxs)(`section`,{"aria-label":e(`popup.filters.title`),className:`grid gap-2`,"data-testid":`popup-filters`,children:[/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`mx-0.5 my-0 text-xs font-medium text-fg-muted`,children:e(`popup.filters.title`)}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t===void 0?ni.map(e=>/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8.5 w-24 rounded-full`},e.key)):ni.map(r=>/* @__PURE__ */ (0,U.jsx)(dt,{pressed:t[r.key],tone:r.tone,size:`md`,onClick:()=>n(`filters`,{...t,[r.key]:!t[r.key]}),"data-testid":`popup-filter-${r.key}`,children:e(ri[r.key])},r.key))})]})}function ai(){let{t:e}=M(),t=G();return/* @__PURE__ */ (0,U.jsx)(`div`,{role:`status`,children:/* @__PURE__ */ (0,U.jsx)(D,{tone:`info`,icon:/* @__PURE__ */ (0,U.jsx)(en,{"aria-hidden":`true`}),title:e(`popup.paused.title`),actionsPlacement:`below`,actions:/* @__PURE__ */ (0,U.jsx)(n,{onClick:()=>t(`enabled`,!0),children:e(`popup.paused.enable`)}),"data-testid":`popup-paused`})})}function oi({projectSwitch:e,currentProjectName:t}){let{t:n}=M(),{question:r,busy:i,confirm:a,cancel:o}=e;if(r===null)return null;let{run:s,target:c}=r,l=s.kind===`free`,u=s.kind===`free`?n(`popup.switchRun.freeText`,{number:s.number,project:c.name}):t===null?n(`popup.switchRun.planTextNoProject`,{plan:s.planName}):n(`popup.switchRun.planText`,{plan:s.planName,project:t});return/* @__PURE__ */ (0,U.jsx)(m,{open:!0,busy:i,onCancel:o,tone:l?`danger`:`warning`,icon:l?/* @__PURE__ */ (0,U.jsx)(C,{"aria-hidden":`true`}):/* @__PURE__ */ (0,U.jsx)(Zt,{"aria-hidden":`true`}),title:n(l?`popup.switchRun.freeTitle`:`popup.switchRun.planTitle`),description:u,"data-testid":`popup-project-switch-question`,actions:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(O,{variant:`secondary`,onClick:o,children:n(`popup.switchRun.stay`)}),/* @__PURE__ */ (0,U.jsx)(O,{variant:l?`danger`:`primary`,loading:i,onClick:a,"data-testid":`popup-project-switch-confirm`,children:n(l?`popup.switchRun.freeConfirm`:`popup.switchRun.planConfirm`)})]})})}var si=V(`pgs-ab0307fe13`);function ci({tabId:e,projectId:t,currentTestRun:n}){let{t:r}=M(),i=w(),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),l=async t=>{let n=await F.call(`RESTORE_PROJECT`,{tabId:e,projectId:t.id,projectNumber:t.number,applicationId:null});if(!n.success)throw Error(`RESTORE_PROJECT refused: ${n.error}`);si.info(`pgm-496ade1c1d`,{tabId:e})},u=t=>{si.error(`pgm-61ab57a774`,{tabId:e,error:t instanceof Error?t.message:String(t)}),i.show({id:`popup-project-switch`,variant:`error`,message:r(`popup.project.switchFailed`)})};return{question:a,busy:s,choose(e){if(e.id!==t){if(n!==null){o({target:e,run:n});return}l(e).catch(u)}},confirm(){a===null||s||(c(!0),l(a.target).catch(u).finally(()=>{c(!1),o(null)}))},cancel(){s||o(null)}}}function li({user:e,header:t,back:n,strip:r,snapshot:i,projects:a,tabProject:o}){let{t:s}=M(),c=W(`enabled`),[l,d]=(0,H.useState)(!1),{state:f,tabId:p}=i,m=ci({tabId:p,projectId:f.projectId,currentTestRun:f.currentTestRun}),h;switch(a.state){case`loading`:h=/* @__PURE__ */ (0,U.jsx)(sn,{});break;case`error`:h=/* @__PURE__ */ (0,U.jsx)(ui,{children:/* @__PURE__ */ (0,U.jsx)(se,{icon:/* @__PURE__ */ (0,U.jsx)(Kt,{"aria-hidden":`true`}),title:s(`popup.projects.failedTitle`),description:s(`popup.projects.failedText`),retry:{label:s(`common.retry`),onRetry:a.retry}})});break;case`ready`:{if(a.projects.length===0){h=/* @__PURE__ */ (0,U.jsx)(ui,{children:/* @__PURE__ */ (0,U.jsx)(A,{icon:/* @__PURE__ */ (0,U.jsx)(Gt,{"aria-hidden":`true`}),title:s(`popup.projects.emptyTitle`),description:s(`popup.projects.emptyText`),action:/* @__PURE__ */ (0,U.jsx)(O,{icon:/* @__PURE__ */ (0,U.jsx)(Ft,{"aria-hidden":`true`}),onClick:()=>u(),children:s(`popup.projects.openWeb`)})})});break}let t=/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(ei,{tabId:p,projects:a.projects,tabProject:o,applicationId:f.applicationId,run:f.currentTestRun,onPick:m.choose,pickerOpen:l,onPickerOpenChange:d}),/* @__PURE__ */ (0,U.jsx)(ii,{})]});h=o===null?t:/* @__PURE__ */ (0,U.jsx)(Wt,{user:e,project:{id:N(o.id),number:Xe(o.number)},children:t});break}}let g=a.state===`ready`&&a.projects.length>0;return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:y(`flex min-h-0 flex-1 flex-col`,n?Ot:jt),children:[t,/* @__PURE__ */ (0,U.jsxs)(an,{className:g&&l?`min-h-90`:void 0,children:[g&&c===!1&&/* @__PURE__ */ (0,U.jsx)(ai,{}),r,h]}),/* @__PURE__ */ (0,U.jsx)(oi,{projectSwitch:m,currentProjectName:o===null?null:o.name})]})}function ui({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`grid min-h-84 content-center`,children:e})}function di(){let{data:e,loading:t,error:n,reload:r}=f({fetcher:e=>R.projects.list({signal:e})}),i=(0,H.useMemo)(()=>new Map(e===void 0?[]:e.map(e=>[e.id,e])),[e]);return n===null?t||e===void 0?{state:`loading`}:{state:`ready`,projects:e,byId:i}:{state:`error`,error:n,retry:r}}var fi=V(`pgs-aea740cf56`);function pi({windowId:e,revision:t,back:n,onBack:r,onOpenSettings:i}){let{t:a}=M();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col ${n?Ot:jt}`,"data-testid":`popup-notification-feed`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-12 flex-none items-center gap-1.5 border-b border-stroke-light pr-3 pl-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{relationship:`label`,content:a(`popup.settings.back`),placement:`bottom-start`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(It,{"aria-hidden":`true`}),onClick:r,autoFocus:!0,"data-testid":`popup-feed-back`})}),/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`m-0 mr-auto text-body-md font-semibold tracking-(--tracking-title) text-fg-primary`,children:a(`notifications.feed.title`)}),/* @__PURE__ */ (0,U.jsx)(P,{relationship:`label`,content:a(`notifications.feed.settings`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(At,{"aria-hidden":`true`}),onClick:i,"data-testid":`popup-feed-settings`})})]}),/* @__PURE__ */ (0,U.jsx)(kt,{host:`popup`,api:R.notifications,locale:I(),t:a,revision:t,logger:fi,onOpenTarget:t=>Pt(t,e),onOpenSettings:i,onSeen:()=>wt(`seen`)})]})}var mi=V(`pgs-a3c52049ce`);function hi({windowId:e,waitingCount:t,revision:n,onOpenFeed:r}){let{t:i}=M();return/* @__PURE__ */ (0,U.jsx)(St,{api:R.notifications,locale:I(),t:i,waitingCount:t,revision:n,logger:mi,onOpenTarget:t=>Pt(t,e),onOpenFeed:r,onSeen:()=>wt(`seen`)})}function gi({value:e,onChange:t,labels:n,size:r,fullWidth:i,className:a}){return/* @__PURE__ */ (0,U.jsx)(k,{value:e,onValueChange:t,"aria-label":n.group,size:r,fullWidth:i,className:a,options:[{value:`light`,label:n.light,icon:/* @__PURE__ */ (0,U.jsx)(tn,{"aria-hidden":`true`})},{value:`dark`,label:n.dark,icon:/* @__PURE__ */ (0,U.jsx)($t,{"aria-hidden":`true`})},{value:`system`,label:n.system,icon:/* @__PURE__ */ (0,U.jsx)(Lt,{"aria-hidden":`true`})}]})}function X({title:e,hint:t,children:n,"data-testid":r}){let{t:i}=M();return/* @__PURE__ */ (0,U.jsxs)(`section`,{className:`grid gap-1.5`,"data-testid":r,children:[/* @__PURE__ */ (0,U.jsxs)(`h3`,{className:`mx-0.5 my-0 flex items-center gap-1 text-xs font-medium text-fg-muted`,children:[e,t!==void 0&&/* @__PURE__ */ (0,U.jsx)(_,{name:i(`popup.site.more`,{about:e}),text:t,placement:`bottom-start`})]}),/* @__PURE__ */ (0,U.jsx)(gt,{kind:`block`,body:`rows`,density:`compact`,children:/* @__PURE__ */ (0,U.jsx)(c,{children:n})})]})}function Z({label:e,below:t,stacked:n=!1,alignStart:r=!1,children:i,"data-testid":a}){return/* @__PURE__ */ (0,U.jsx)($e,{title:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:e}),end:i,stacked:n,alignStart:r,"data-testid":a,children:t})}var _i={on:`bg-success shadow-(--glow-status-success)`,neutral:`bg-fg-muted`,warning:`bg-warning`,error:`bg-error`},vi={on:`text-fg-muted`,neutral:`text-fg-muted`,warning:`text-fg-warning`,error:`text-fg-error`};function Q({tone:e,announce:t=!1,children:n,action:r,"data-testid":i}){return/* @__PURE__ */ (0,U.jsxs)(`span`,{role:e===`error`?`alert`:t?`status`:void 0,className:y(`flex items-start gap-1.75 text-xs leading-(--leading-caption)`,vi[e]),"data-testid":i,children:[/* @__PURE__ */ (0,U.jsx)(`i`,{"aria-hidden":`true`,className:y(`mt-1.25 size-1.75 flex-none rounded-full`,_i[e])}),/* @__PURE__ */ (0,U.jsxs)(`span`,{children:[n,r]})]})}function yi({onRetry:e}){let{t}=M();return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[` \u00B7 `,/* @__PURE__ */ (0,U.jsx)(O,{variant:`link`,size:`xs`,onClick:e,children:t(`common.retry`)})]})}var bi=V(`pgs-6344bc6f0d`);function xi(e,t){let n=f({fetcher:async()=>{if(e===null)throw Error(`Discovery settings are read per project`);let t=await F.call(`REFRESH_DISCOVERY_SETTINGS`,{projectId:e});if(!t.success)throw Error(`REFRESH_DISCOVERY_SETTINGS refused: ${t.error}`);if(t.discoverySettings===null)throw Error(`The service worker could not read the discovery settings`);return t.discoverySettings},deps:[e],enabled:e!==null}),[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,p]=(0,H.useState)(!1),m=(0,H.useRef)(null),h=(0,H.useRef)(!1),g=(0,H.useRef)(!1),_=(0,H.useRef)(null),v=(0,H.useCallback)(async()=>{if(!(g.current||e===null)){g.current=!0,c(!0),u(!1),p(!1);try{for(;m.current!==null||h.current;){let n=m.current;if(n!==null){try{await R.discovery.updateUserSettings(n)}catch(t){bi.warn(`pgm-6e1d90d469`,{projectId:e,error:t instanceof Error?t.message:String(t)}),_.current=m.current,m.current=null,o(null),u(!0);continue}h.current=!0,m.current===n&&(m.current=null,o(null));continue}h.current=!1;let r=await Si(e,t);r===null?p(!0):(i(r),p(!1))}}finally{g.current=!1,c(!1)}}},[e,t]),y=(0,H.useCallback)(e=>{m.current=e,o(e),v()},[v]),b=(0,H.useCallback)(()=>{let e=_.current;if(e===null)throw Error(`No failed discovery save to retry`);_.current=null,y(e)},[y]),x=(0,H.useCallback)(()=>{h.current=!0,v()},[v]);if(e===null)return{status:`noProject`};if(n.error!==null&&r===null)return{status:`readFailed`,retry:n.reload};if(d&&!s)return{status:`readFailed`,retry:x};let S=r===null?n.data:r;return S===void 0?{status:`loading`}:{status:`ready`,settings:S,checked:a===null?S.userEnabled:a,saving:s,saveFailed:l,toggle:y,retrySave:b}}async function Si(e,t){let n=await F.call(`REFRESH_DISCOVERY_SETTINGS`,{tabId:t,projectId:e}).catch(t=>(bi.warn(`pgm-8a2d41a868`,{projectId:e,error:t instanceof Error?t.message:String(t)}),null));return n===null?null:n.success?(n.discoverySettings===null&&bi.warn(`pgm-842d0b7de2`,{projectId:e}),n.discoverySettings):(bi.warn(`pgm-a943e9be7d`,{projectId:e,error:n.error}),null)}function Ci(e){var t;return((t=e.disabledReasons)==null?void 0:t.includes(`company_disabled`))===!0||!e.companyEnabled}function wi(e){return e.gatingModel===`company+user+project`&&e.projectEnabled===!1}var $=`popup-discovery-status`;function Ti({tabId:e,project:t}){let{t:n}=M(),r=xi(t==null?null:t.id,e),i=t===void 0?{status:`loading`}:r,a,o=null;switch(i.status){case`noProject`:a=/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.noProject`)});break;case`loading`:a=/* @__PURE__ */ (0,U.jsx)(L,{className:`mt-1 h-3 w-40`}),o=/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5 w-9 rounded-full`});break;case`readFailed`:a=/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(yi,{onRetry:i.retry}),children:n(`popup.settings.discoveryStatus.readFailed`)});break;case`ready`:{let{settings:e}=i;if(t==null)throw Error(`Discovery settings were read without a project`);a=i.saving?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.saving`)}):i.saveFailed?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(yi,{onRetry:i.retrySave}),children:n(`popup.settings.discoveryStatus.saveFailed`)}):Ci(e)?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`warning`,children:n(`popup.settings.discoveryStatus.companyOff`)}):wi(e)?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`warning`,children:n(`popup.settings.discoveryStatus.projectOff`,{project:t.name})}):e.effectiveEnabled?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`on`,children:n(`popup.settings.discoveryStatus.on`,{project:t.name})}):/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.off`)}),o=/* @__PURE__ */ (0,U.jsx)(Bt,{"aria-label":n(`popup.settings.discovery`),checked:i.checked,onChange:i.toggle,"data-testid":`popup-discovery-toggle`});break}}return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[n(`popup.settings.discovery`),/* @__PURE__ */ (0,U.jsx)(_,{name:n(`popup.site.more`,{about:n(`popup.settings.discovery`)}),text:n(`popup.settings.discoveryHint`),placement:`bottom-start`})]}),below:a,alignStart:!0,"data-testid":`popup-discovery`,children:o})}function Ei({children:e}){return/* @__PURE__ */ (0,U.jsx)(`kbd`,{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.75 font-sans text-(length:--text-micro) leading-none font-medium whitespace-nowrap text-fg-muted shadow-[inset_0_0_0_1px_var(--color-border-hairline)]`,children:e})}var Di=/* @__PURE__ */ new Set([`Control`,`Alt`,`Shift`,`Meta`]);function Oi(e){if(Di.has(e.key))return null;let t=[];return(e.ctrlKey||e.metaKey)&&t.push(`Ctrl`),e.altKey&&t.push(`Alt`),e.shiftKey&&t.push(`Shift`),e.key===` `?t.push(`Space`):t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join(`+`)}function ki(){let{t:e}=M(),t=W(`selectionHotkey`),n=G(),[r,i]=(0,H.useState)(!1);return t===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-(--control-height-sm) w-12 rounded-(--input-radius)`}):/* @__PURE__ */ (0,U.jsx)(ue,{size:`sm`,active:r,"aria-label":e(`popup.settings.hotkeyName`,{hotkey:t}),onClick:()=>i(!0),onBlur:()=>i(!1),onKeyDown:e=>{if(!r)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Oi(e);t!==null&&(i(!1),n(`selectionHotkey`,t))},"data-testid":`popup-hotkey`,children:r?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`text-xs text-(--color-primary-text) animate-pulse-dot`,children:e(`popup.settings.hotkeyCapture`)}):/* @__PURE__ */ (0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:t.split(`+`).map((e,t)=>/* @__PURE__ */ (0,U.jsx)(Ei,{children:e},`${e}-${t}`))})})}function Ai(e,t){return t?`element`:e?`window`:`off`}function ji(e){return{isolationWindow:e===`window`,isolationElement:e===`element`}}var Mi=Promise.resolve();function Ni(e){let t=()=>ye(ji(e)),n=Mi.then(t,t);return Mi=n,n}var Pi=V(`pgs-fed3bb0e75`),Fi={managed:null,company:`popup.settings.modelKeyCompany`,personal:`popup.settings.modelKeyPersonal`};function Ii(){let{t:e}=M(),t=w(),n=G(),r=W(`modelPick`),i=(0,H.useMemo)(()=>Ht({http:Nt(),logger:Pi}),[]),{data:a,error:o,reload:s}=f({fetcher:()=>i.load()});if((0,H.useEffect)(()=>{o!==null&&(Pi.error(`pgm-9665648376`,{error:o.message}),t.show({id:`popup-models`,variant:`error`,message:e(`popup.settings.modelLoadFailed`),action:{label:e(`common.retry`),onAction:s}}))},[o,s,e,t]),r===void 0||a===void 0&&o===null)return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.model`),children:/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8 w-37.5 rounded-md`})});let c=a===void 0?[]:a.groups,l=a===void 0||r===null?null:Rt(a,r),u=a===void 0?null:Ut(a,l,null);return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.model`),"data-testid":`popup-model`,children:/* @__PURE__ */ (0,U.jsx)(B,{size:`sm`,"aria-label":e(`popup.settings.model`),placeholder:e(`popup.settings.modelNone`),value:u===null?null:u.model.selectionId,onValueChange:r=>{for(let i of c){let a=i.models.find(e=>e.selectionId===r);if(a!==void 0){n(`modelPick`,{keySource:i.source,modelId:a.id}),R.aiSettings.updateUser({selectedProvider:i.source,selectedModel:a.id}).catch(n=>{Pi.error(`pgm-573d3af0bc`,{error:n instanceof Error?n.message:String(n)}),t.show({id:`popup-model-save`,variant:`error`,message:e(`popup.settings.saveFailed`)})});return}}throw Error(`The AI model Select picked a row it did not render: ${r}`)},className:`w-37.5`,options:c.flatMap(t=>t.models.map(n=>{let r=Fi[t.source];return{value:n.selectionId,label:r===null?n.name:`${n.name} \u00B7 ${e(r)}`,disabled:!Vt(n)}}))})})}var Li=V(`pgs-cdc66fba2a`),Ri={permissions:[`notifications`]};function zi(e){return e instanceof Error?e.message:String(e)}function Bi(){return[chrome.permissions.onAdded,chrome.permissions.onRemoved]}function Vi(e){var t;return((t=e.permissions)==null?void 0:t.includes(`notifications`))===!0}function Hi(){let{t:e}=M(),[t,n]=(0,H.useState)(`reading`),r=(0,H.useRef)(!0),i=(0,H.useCallback)(()=>{chrome.permissions.contains(Ri).then(e=>{r.current&&n(t=>e?`on`:t===`denied`?`denied`:`off`)},e=>{Li.error(`pgm-cbfb085fbb`,{error:zi(e)}),r.current&&n(`readFailed`)})},[]);(0,H.useEffect)(()=>{r.current=!0;let e=e=>{Vi(e)&&i()},t=Bi();for(let n of t)n.addListener(e);return i(),()=>{r.current=!1;for(let n of t)n.removeListener(e)}},[i]);let a=()=>{n(`reading`),i()},o=e=>{if(e){n(`asking`),chrome.permissions.request(Ri).then(e=>n(e?`on`:`denied`),e=>{Li.error(`pgm-67efc28caa`,{error:zi(e)}),n(`off`)});return}chrome.permissions.remove(Ri).then(e=>{e||Li.error(`pgm-2cbfb59188`),n(e?`off`:`on`)},e=>{Li.error(`pgm-ac8845b9f5`,{error:zi(e)})})},s=e(`popup.settings.osNotifications`);return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[s,/* @__PURE__ */ (0,U.jsx)(_,{name:e(`popup.site.more`,{about:s}),text:e(`popup.settings.osNotificationsHint`),placement:`bottom-start`})]}),below:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(`small`,{className:`text-xs leading-(--leading-caption) text-fg-muted`,children:e(`popup.settings.osNotificationsWhen`)}),t===`denied`&&/* @__PURE__ */ (0,U.jsx)(Q,{tone:`neutral`,announce:!0,"data-testid":`popup-os-notifications-denied`,children:e(`popup.settings.osNotificationsDenied`)}),t===`readFailed`&&/* @__PURE__ */ (0,U.jsx)(Q,{tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(yi,{onRetry:a}),"data-testid":`popup-os-notifications-read-failed`,children:e(`popup.settings.osNotificationsReadFailed`)})]}),alignStart:!0,"data-testid":`popup-os-notifications`,children:t===`reading`?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5 w-9 rounded-full`}):t===`readFailed`?null:/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-fg-muted`,children:[t===`asking`&&/* @__PURE__ */ (0,U.jsx)(j,{}),/* @__PURE__ */ (0,U.jsx)(Bt,{"aria-label":s,checked:t===`on`,onChange:o,"data-testid":`popup-os-notifications-switch`})]})})}var Ui=V(`pgs-7fed4be7cb`);function Wi(){let{t:e}=M(),t=W(`notificationsEnabled`),n=G(),r=e(`popup.settings.notifications`);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(X,{title:e(`popup.settings.groups.notifications`),hint:e(`popup.settings.groups.notificationsHint`),"data-testid":`popup-notification-groups`,children:/* @__PURE__ */ (0,U.jsx)(Et,{api:R.notifications,locale:I(),t:e,logger:Ui,onChanged:()=>wt(`group_changed`)})}),/* @__PURE__ */ (0,U.jsxs)(X,{title:e(`popup.settings.groups.thisBrowser`),children:[/* @__PURE__ */ (0,U.jsx)(Hi,{}),/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[r,/* @__PURE__ */ (0,U.jsx)(_,{name:e(`popup.site.more`,{about:r}),text:e(`popup.settings.notificationsHint`),placement:`bottom-start`})]}),children:t===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-5 w-9 rounded-full`}):/* @__PURE__ */ (0,U.jsx)(Bt,{"aria-label":r,checked:t,onChange:e=>n(`notificationsEnabled`,e),"data-testid":`popup-notifications`})})]})]})}var Gi=/^\d+$/;function Ki(e){let t=e.trim();return Gi.test(t)?Number(t)>Se?`tooLong`:null:`notWholeNumber`}function qi(){let{t:e,i18n:t}=M(),n=W(`autoplayStepPauseMs`),r=G(),[i,a]=(0,H.useState)(null),o=i===null?null:Ki(i),s=o!==null,c=()=>{if(i===null||s)return;let e=Number(i.trim());a(null),e!==n&&r(`autoplayStepPauseMs`,e)};return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.pause`),alignStart:!0,below:s?/* @__PURE__ */ (0,U.jsxs)(`span`,{role:`alert`,className:`mt-0.5 flex items-start gap-1.5 text-xs leading-(--leading-caption) text-fg-error`,children:[/* @__PURE__ */ (0,U.jsx)(Ke,{"aria-hidden":`true`,className:`mt-px size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:o===`tooLong`?e(`popup.settings.pauseTooLong`,{max:new Intl.NumberFormat(t.language).format(Se)}):e(`popup.settings.pauseInvalid`)})]}):void 0,"data-testid":`popup-step-pause`,children:n===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8 w-26 rounded-md`}):/* @__PURE__ */ (0,U.jsx)(g,{size:`sm`,inputMode:`numeric`,"aria-label":e(`popup.settings.pauseName`),value:i??String(n),onValueChange:a,onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c()},invalid:s,trailing:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e(`popup.settings.ms`)}),className:`w-26 [&_input]:text-right [&_input]:tabular-nums`})})}function Ji({tabId:e,project:t,onBack:n}){let{t:r}=M(),i=W(`theme`),a=G();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col ${jt}`,"data-testid":`popup-settings`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-12 flex-none items-center gap-1.5 border-b border-stroke-light pr-3 pl-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{relationship:`label`,content:r(`popup.settings.back`),placement:`bottom-start`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(It,{"aria-hidden":`true`}),onClick:n,autoFocus:!0,"data-testid":`popup-settings-back`})}),/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`m-0 text-body-md font-semibold tracking-(--tracking-title) text-fg-primary`,children:r(`popup.settings.title`)})]}),/* @__PURE__ */ (0,U.jsxs)(an,{children:[/* @__PURE__ */ (0,U.jsx)(Wi,{}),/* @__PURE__ */ (0,U.jsxs)(X,{title:r(`popup.settings.groups.view`),children:[/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.theme`),stacked:!0,children:i===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8.5 w-full rounded-md`}):/* @__PURE__ */ (0,U.jsx)(gi,{value:i,onChange:e=>a(`theme`,e),labels:{group:r(`popup.settings.theme`),light:r(`popup.settings.themeLight`),dark:r(`popup.settings.themeDark`),system:r(`popup.settings.themeSystem`)},fullWidth:!0})}),/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.language`),stacked:!0,children:/* @__PURE__ */ (0,U.jsx)(bn,{fullWidth:!0})})]}),/* @__PURE__ */ (0,U.jsxs)(X,{title:r(`popup.settings.groups.recording`),children:[/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.hotkey`),children:/* @__PURE__ */ (0,U.jsx)(ki,{})}),/* @__PURE__ */ (0,U.jsx)(qi,{}),/* @__PURE__ */ (0,U.jsx)(Yi,{})]}),/* @__PURE__ */ (0,U.jsx)(X,{title:r(`popup.settings.groups.assistant`),children:/* @__PURE__ */ (0,U.jsx)(Ii,{})}),/* @__PURE__ */ (0,U.jsx)(X,{title:r(`popup.settings.groups.pages`),children:/* @__PURE__ */ (0,U.jsx)(Ti,{tabId:e,project:t},t==null?``:t.id)})]})]})}function Yi(){let{t:e}=M(),t=yn(),n=W(`isolationWindow`),r=W(`isolationElement`),i=n=>{t({id:`popup-isolation`,run:()=>Ni(n),log:{message:`Input isolation was not stored`,context:{isolation:n}},message:e(`popup.settings.saveFailed`)})},a=n===void 0||r===void 0?void 0:Ai(n,r);return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[e(`popup.settings.isolation`),/* @__PURE__ */ (0,U.jsx)(_,{name:e(`popup.site.more`,{about:e(`popup.settings.isolation`)}),text:e(`popup.settings.isolationHint`),placement:`bottom-start`})]}),stacked:!0,"data-testid":`popup-isolation`,children:a===void 0?/* @__PURE__ */ (0,U.jsx)(L,{className:`h-8.5 w-full rounded-md`}):/* @__PURE__ */ (0,U.jsx)(k,{value:a,onValueChange:i,"aria-label":e(`popup.settings.isolation`),fullWidth:!0,options:[{value:`off`,label:e(`popup.settings.isolationOff`)},{value:`window`,label:e(`popup.settings.isolationWindow`)},{value:`element`,label:e(`popup.settings.isolationElement`)}]})})}var Xi=V(`pgs-b5906754fa`);function Zi({user:e}){let t=Ze(),n=di(),r=W(`enabled`),i=Dt(e.id),a=Ct(),[o,s]=(0,H.useState)({name:`main`,back:!1});if((0,H.useEffect)(()=>{wt(`surface_opened`)},[]),a===void 0)return/* @__PURE__ */ (0,U.jsx)(on,{});let c=n.state===`ready`?Qi(t,n.byId):null,l=i.status===`ready`?i.snapshot:null,u=i.status===`ready`?i.revision:0,d=()=>s({name:`settings`,back:!1}),f=()=>s({name:`feed`,back:!1}),p=()=>s({name:`main`,back:!0}),m=/* @__PURE__ */ (0,U.jsx)(Tn,{user:e,onOpenSettings:d,notificationCounts:l,onOpenNotifications:f}),h=r===!0&&l!==null?/* @__PURE__ */ (0,U.jsx)(hi,{windowId:a,waitingCount:l.waitingCount,revision:u,onOpenFeed:f}):null;switch(o.name){case`settings`:{let r=/* @__PURE__ */ (0,U.jsx)(Ji,{tabId:t.tabId,project:n.state===`loading`?void 0:c,onBack:p});return c===null?r:/* @__PURE__ */ (0,U.jsx)(Wt,{user:e,project:{id:N(c.id),number:Xe(c.number)},children:r})}case`feed`:return/* @__PURE__ */ (0,U.jsx)(pi,{windowId:a,revision:u,back:o.back,onBack:p,onOpenSettings:d});case`main`:return/* @__PURE__ */ (0,U.jsx)(li,{user:e,header:m,back:o.back,strip:h,snapshot:t,projects:n,tabProject:c})}}function Qi(e,t){let{projectId:n}=e.state;if(n===null)return null;let r=t.get(n);return r===void 0?(Xi.warn(`pgm-cb1ec83f44`,{tabId:e.tabId}),null):r}function $i(){return/* @__PURE__ */ (0,U.jsx)(o,{loading:/* @__PURE__ */ (0,U.jsx)(on,{}),signedOut:/* @__PURE__ */ (0,U.jsx)(xn,{}),children:e=>/* @__PURE__ */ (0,U.jsx)(pn,{user:e,children:/* @__PURE__ */ (0,U.jsx)(H.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(on,{}),children:/* @__PURE__ */ (0,U.jsx)(Zi,{user:e})})})})}var ea=V(`pgs-2e3f74b175`),ta=document.getElementById(`popup-root`);ta===null?ea.error(`pgm-f13077b9ed`):ke({surface:`popup`,root:ta,followedTab:Tt(),editorNavigation:oe(`popup`),render:()=>/* @__PURE__ */ (0,U.jsx)($i,{})}).catch(e=>{ea.error(`pgm-f4cc990f36`,e)});
|
|
39
|
+
;function mn({off:e}){let{t}=F();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-body-md font-semibold tracking-(--tracking-brand) text-fg-primary`,children:[/* @__PURE__ */ (0,U.jsx)(Bt,{className:_(`size-5 [transition:filter_var(--motion-medium)_var(--ease-out),opacity_var(--motion-medium)_var(--ease-out)]`,e&&`opacity-50 grayscale`)}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:t(`popup.brand`)})]})}function hn({children:e}){return/* @__PURE__ */ (0,U.jsx)(`header`,{className:`flex h-12 flex-none items-center gap-1 border-b border-stroke-light bg-(--color-bg-window-header) pr-2 pl-3.5`,children:e})}function gn({children:e,className:t}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:_(`grid min-h-0 flex-1 grid-cols-1 content-start gap-4 overflow-y-auto px-3 pt-3 pb-4 [scrollbar-width:thin]`,t),children:e})}function _n(){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`popup-loading`,children:[/* @__PURE__ */ (0,U.jsxs)(hn,{children:[/* @__PURE__ */ (0,U.jsx)(mn,{off:!1}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5 w-9 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`ml-2 size-7 rounded-md`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`ml-2 size-6 rounded-full`})]}),/* @__PURE__ */ (0,U.jsx)(gn,{children:/* @__PURE__ */ (0,U.jsx)(vn,{})})]})}function vn(){let{t:e}=F();return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,"aria-label":e(`shell.loading`),className:`grid gap-2.5 rounded-lg border border-stroke bg-surface-card pt-3 pr-3 pb-3.5 pl-3.5`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`size-8.5 rounded-md`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`h-2.5 w-12`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-3.5 w-[62%]`})]})]}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex items-center gap-2.5 pl-1`,children:/* @__PURE__ */ (0,U.jsx)(P,{className:`h-3 w-[60%]`})}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 pl-1`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5.5 w-18.5 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5.5 w-20.5 rounded-full`})]})]}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid gap-2`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`h-2.5 w-37.5`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8.5 w-21 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8.5 w-27.5 rounded-full`})]})]})]})}function yn({value:e,options:t,onChange:n,ariaLabel:r,size:i,fullWidth:a,className:o}){return/* @__PURE__ */ (0,U.jsx)(g,{value:e,options:t,onValueChange:n,"aria-label":r,size:i,fullWidth:a,className:o})}var bn=V(`pgs-4d9951d24e`);function xn(e){let t=0,n=Promise.resolve(),r=null;async function i(n,i,a){if(n!==t)return;if(e.signedInUserId()!==a){bn.warn(`pgm-4b072233de`,{locale:i});return}let o=new AbortController;r=o;try{await e.save(i,o.signal)}catch(r){if(o.signal.aborted){bn.info(`pgm-7aaa461c83`,{locale:i});return}if(n===t){e.onFailure(i,r);return}bn.warn(`pgm-f93a88619e`,{locale:i,error:r})}finally{r=null}}return{write(e,r){t+=1;let a=t;n=n.then(()=>i(a,e,r)).catch(t=>{bn.error(`pgm-1491eca8c6`,{locale:e,error:t})})},discardPending(){t+=1,r==null||r.abort()}}}var Sn=V(`pgs-b78fd5fe0f`),Cn=(0,H.createContext)(null);function wn({user:e,children:t}){let{t:n}=F(),r=x(),[i]=(0,H.useState)(()=>Dn(e.id));return(0,H.useEffect)(()=>{i.setFailureReport((e,t)=>{Sn.error(`pgm-0f28f45227`,{locale:e,error:t instanceof Error?t.message:String(t)}),r.show({id:`popup-profile-language`,variant:`error`,message:n(`popup.language.profileSaveFailed`),action:{label:n(`common.retry`),onAction:()=>i.retryShownLocale()}})})}),(0,H.useEffect)(()=>(i.start(),()=>i.end()),[i]),/* @__PURE__ */ (0,U.jsx)(Cn,{value:i.profileLocale,children:t})}function Tn(){return(0,H.useContext)(Cn)}function En(){let e=(0,H.useContext)(Cn);if(e===null)throw Error(`useSignedInProfileLocale() is used outside the signed-in popup`);return e}function Dn(e){let t=!1,n=null,r=xn({save:async(e,t)=>{await z.preferences.update({locale:e},{signal:t})},signedInUserId:()=>t?e:null,onFailure:(e,t)=>{if(n===null)throw Error(`A profile language write failed before the popup was rendered`);n(e,t)}});return{profileLocale:{write:t=>r.write(t,e),discardPending:()=>r.discardPending()},setFailureReport:e=>{n=e},retryShownLocale:()=>{t&&r.write(A(),e)},start:()=>{t=!0},end:()=>{t=!1,r.discardPending()}}}function On(e){let t=nt(e);return(0,H.useSyncExternalStore)(t.subscribe,t.getState)}var kn=V(`pgs-520a54a8e3`);function W(e){let t=On(e);if(t.status===`failed`)throw t.error;return t.status===`ready`?t.value:void 0}function An(){let{t:e}=F(),t=x();return(0,H.useCallback)(function n(r){r.run().catch(i=>{kn.error(r.log.message,{...r.log.context,error:i instanceof Error?i.message:String(i)}),t.show({id:r.id,variant:`error`,message:r.message,detail:r.detail,action:{label:e(`common.retry`),onAction:()=>n(r)}})})},[e,t])}function G(){let{t:e}=F(),t=An();return(0,H.useCallback)((n,r)=>t({id:`setting-${n}`,run:()=>Ge(n,r),log:{message:`A setting was not stored`,context:{key:n}},message:e(`popup.settings.saveFailed`)}),[e,t])}function jn({size:e,fullWidth:t}){let{t:n}=F(),r=An(),i=Tn();return/* @__PURE__ */ (0,U.jsx)(yn,{value:A(),options:ft.map(e=>({value:e,label:n(`common.languageNames.${e}`)})),onChange:e=>r({id:`popup-language`,run:async()=>{await Me(e)!==`superseded`&&(i==null||i.write(e))},log:{message:`The language was not switched or not stored`,context:{locale:e}},message:n(`popup.settings.saveFailed`)}),ariaLabel:n(`popup.languageGroup`),size:e,fullWidth:t})}function Mn(){let{t:e}=F();return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:/* @__PURE__ */ (0,U.jsx)(Ft,{subtitle:e(`shell.signIn.subtitlePopup`),footer:/* @__PURE__ */ (0,U.jsx)(jn,{size:`sm`})})})}var Nn=V(`pgs-d05703aaa3`);function Pn({user:e}){let{t}=F(),n=x(),[r,i]=(0,H.useState)(!1),a=En(),o=`${e.firstName} ${e.lastName}`;return/* @__PURE__ */ (0,U.jsxs)(te,{label:t(`popup.header.account`,{name:o}),align:`end`,className:`w-59`,trigger:/* @__PURE__ */ (0,U.jsx)(E,{"aria-label":t(`popup.header.account`,{name:o}),icon:/* @__PURE__ */ (0,U.jsx)(gt,{firstName:e.firstName,lastName:e.lastName,email:e.email,size:`sm`,unknownLabel:t(`popup.header.unknownUser`)}),"data-testid":`popup-account`}),children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid gap-px px-2.5 py-2`,children:[/* @__PURE__ */ (0,U.jsx)(`b`,{className:`text-body-sm font-semibold text-fg-primary`,children:o}),/* @__PURE__ */ (0,U.jsxs)(`small`,{className:`text-xs text-fg-muted`,children:[e.email,` \u00B7 `,e.company.name]})]}),/* @__PURE__ */ (0,U.jsx)(f,{}),/* @__PURE__ */ (0,U.jsx)(ze,{label:t(`popup.header.openWeb`),icon:/* @__PURE__ */ (0,U.jsx)(It,{"aria-hidden":`true`}),onSelect:()=>s()}),/* @__PURE__ */ (0,U.jsx)(f,{}),/* @__PURE__ */ (0,U.jsx)(ze,{label:t(`popup.header.signOut`),icon:/* @__PURE__ */ (0,U.jsx)(un,{"aria-hidden":`true`}),tone:`danger`,disabled:r,onSelect:()=>{r||(i(!0),a.discardPending(),z.auth.logout().catch(e=>{Nn.error(`pgm-4db83b7ea3`,{error:e instanceof Error?e.message:String(e)}),n.show({id:`popup-sign-out`,variant:`error`,message:t(`popup.header.signOutFailed`)})}).finally(()=>i(!1)))},"data-testid":`popup-sign-out`})]})}function Fn({enabled:e}){let{t}=F(),n=An();return/* @__PURE__ */ (0,U.jsx)(I,{relationship:`description`,content:t(e?`popup.header.switchOn`:`popup.header.switchOff`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`inline-flex`,children:/* @__PURE__ */ (0,U.jsx)(o,{"aria-label":t(`popup.header.switchLabel`),checked:e,onChange:e=>n({id:`popup-power-switch`,run:()=>Ge(`enabled`,e),log:{message:`The extension switch was not stored`,context:{enabled:e}},message:t(`popup.header.switchFailed`),detail:t(`popup.header.switchFailedDetail`)}),className:`p-1.5`,"data-testid":`popup-power-switch`})})})}function In({user:e,onOpenSettings:t,notificationCounts:n,onOpenNotifications:r}){let{t:i}=F(),a=W(`enabled`);return/* @__PURE__ */ (0,U.jsxs)(hn,{children:[/* @__PURE__ */ (0,U.jsx)(mn,{off:a===!1}),a===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5 w-9 rounded-full`}):/* @__PURE__ */ (0,U.jsx)(Fn,{enabled:a}),/* @__PURE__ */ (0,U.jsx)(wt,{host:`popup`,t:i,counts:a===!1?null:n,onClick:r}),/* @__PURE__ */ (0,U.jsx)(I,{relationship:`label`,content:i(`popup.header.settings`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(bt,{"aria-hidden":`true`}),onClick:t,"data-testid":`popup-open-settings`})}),/* @__PURE__ */ (0,U.jsx)(Pn,{user:e})]})}var Ln=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:r,className:i,nativeButton:a=!0,disabled:o=!1,id:s,style:l,...u}=e,{state:d,disabled:f,setTouched:m,setFocused:h,validationMode:g,validation:_}=Ae(),{labelId:v}=Ke(),y=on(),b=y.useState(`selectionMode`),x=y.useState(`disabled`),S=y.useState(`readOnly`),C=y.useState(`required`),ee=y.useState(`positionerElement`),w=y.useState(`listElement`),T=y.useState(`popupId`),E=y.useState(`triggerProps`),D=y.useState(`inputInsidePopup`),O=y.useState(`id`),te=y.useState(`labelId`),k=y.useState(`open`),re=y.useState(`selectedValue`),ie=y.useState(`activeIndex`),A=y.useState(`selectedIndex`),ae=y.useState(`hasSelectedValue`),se=sn(),ce=Ht(),le=tt(),j=f||x||o,ue=$t(),de=Xt(y);Te({id:D?s:void 0});let fe=D?s??O:s,pe=Re(v,te),me;k&&D?me=T??an(O):k&&(me=w==null?void 0:w.id);let M=H.useRef(``);function he(e){M.current=e.pointerType}let{reference:ge}=je(se,{enabled:!k&&!S&&!x&&b===`single`,listRef:y.context.labelsRef,activeIndex:ie,selectedIndex:A,onMatch(e){let t=y.context.valuesRef.current[e];t!==void 0&&y.context.setSelectedValue(t,De(ne))}}),{reference:_e}=p(se,{enabled:!x,event:`mousedown`}),{buttonRef:ye,getButtonProps:be}=Pe({native:a,disabled:j}),xe={...d,readOnly:S,open:k,disabled:j,popupSide:de,listEmpty:ue,placeholder:b!==`none`&&!ae},N=Le(e=>{y.set(`triggerElement`,e)});return $e(`button`,e,{ref:[t,ye,N],state:xe,props:[E,_e,ge,{id:fe,tabIndex:D?0:-1,role:D?`combobox`:void 0,"aria-expanded":k,"aria-haspopup":D?`dialog`:`listbox`,"aria-controls":me,"aria-required":D&&C||void 0,"aria-readonly":D&&S||void 0,"aria-labelledby":pe,onPointerDown:he,onPointerEnter:he,onFocus(){h(!0),!j&&le.start(0,y.context.forceMount)},onBlur(e){if(!Se(ee,e.relatedTarget)&&(m(!0),h(!1),g===`onBlur`)){let e=b===`none`?ce:re;_.commit(e)}},onMouseDown(e){if(j)return;if(D||se.set(`domReferenceElement`,e.currentTarget),y.context.forceMount(),M.current!==`touch`){var t;(t=y.context.inputRef.current)==null||t.focus(),D||e.preventDefault()}if(k)return;let n=Je(e.currentTarget);function r(e){let t=y.state.triggerElement;if(!t)return;let n=oe(e),r=y.state.positionerElement,i=y.state.listElement;Se(t,n)||Se(r,n)||Se(i,n)||ve(e,t)||y.context.setOpen(!1,De(we,e))}D&&n.addEventListener(`mouseup`,r,{once:!0})},onKeyDown(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){var t;n(e),y.context.setOpen(!0,De(c,e.nativeEvent)),(t=y.context.inputRef.current)==null||t.focus()}}},_.getValidationProps(j,u),be],stateAttributesMapping:qt})}),Rn=/*#__PURE__*/ H.createContext(void 0);function zn(){let e=H.useContext(Rn);if(e===void 0)throw Error(Ue(18));return e}var Bn=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=on().useState(`grid`),[c,l]=H.useState(),u=H.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=$e(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=/*#__PURE__*/ (0,U.jsx)(Rn.Provider,{value:u,children:d});return a?/*#__PURE__*/ (0,U.jsx)(rn,{items:a,children:f}):f}),Vn=/*#__PURE__*/ H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=zn(),c=Qe(a);return He(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),$e(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),Hn=/^[^\p{L}\p{N}]*(\p{L})/u;function Un(e){let t=e.trim().split(/\s+/).flatMap(e=>{var t;let n=(t=Hn.exec(e))==null?void 0:t[1];return n===void 0?[]:[n.toLocaleUpperCase()]}).slice(0,2).join(``);return t===``?null:t}var Wn=`grid shrink-0 place-items-center font-semibold tracking-(--tracking-snug) select-none`,Gn=`bg-(image:--btn-primary-fill) text-fg-on-accent`,Kn=`bg-(--color-bg-tertiary) text-fg-muted shadow-[inset_0_0_0_1px_var(--color-border-hairline)]`,qn=`shadow-[var(--shadow-primary-inset),var(--shadow-tile-primary-glow)]`,Jn={22:`size-5.5 rounded-sm text-(length:--text-2xs) [&_svg]:size-3`,26:`size-6.5 rounded-md text-xs [&_svg]:size-3.5`,32:`size-8 rounded-md text-sm [&_svg]:size-4`,40:`size-10 rounded-lg text-base [&_svg]:size-4.5`},Yn=/* @__PURE__ */ new Set([26,32,40]);function Xn({name:e,size:t,drained:n=!1,className:r}){let i=e===null?null:Un(e),a=n?Kn:_(Gn,Yn.has(t)&&qn);return/* @__PURE__ */ (0,U.jsx)(`span`,{"aria-hidden":`true`,"data-size":t,"data-drained":n||void 0,className:_(Wn,Jn[t],a,r),children:i??/* @__PURE__ */ (0,U.jsx)(Rt,{})})}var Zn=5,Qn=3,$n=`grid shrink-0 place-items-center rounded-md border border-solid border-[color-mix(in_srgb,var(--color-primary)_28%,transparent)] bg-(--color-bg-primary-tint-10) text-sm font-semibold tracking-(--tracking-snug) text-(--color-primary-text)`,er=`grid shrink-0 place-items-center rounded-md border border-dashed border-stroke-hover bg-surface-hover-layer text-fg-muted [&_svg]:size-4`,tr=`group/trigger flex h-11.5 w-full min-w-0 cursor-pointer items-center gap-2.5 rounded-md border border-solid border-transparent bg-transparent pr-2 pl-1.25 text-left font-sans outline-none [transition:background-color_var(--motion-short)_var(--ease-out),border-color_var(--motion-short)_var(--ease-out)] hover:border-stroke hover:bg-surface-hover-layer focus-visible:border-stroke-focus focus-visible:ring-3 focus-visible:ring-focus-ring data-popup-open:border-stroke-focus data-popup-open:bg-surface-secondary`,nr=`group/trigger inline-flex h-9 min-w-0 shrink-0 cursor-pointer items-center gap-2 rounded-full border-0 bg-transparent pr-2.25 pl-1.25 font-sans text-body-sm font-semibold tracking-(--tracking-control) text-fg-primary [transition:background-color_var(--motion-short)_var(--ease-out)] hover:bg-surface-hover-layer data-popup-open:bg-surface-hover-layer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-stroke-focus`,rr={header:`min-w-0 max-w-45 truncate`,"header-narrow":`min-w-0 max-w-30 truncate`},ir=`grid size-6.5 shrink-0 place-items-center rounded-md border border-dashed border-stroke-hover bg-surface-hover-layer text-fg-muted`,ar=`grid grid-cols-[minmax(0,1fr)] gap-px overflow-y-auto overscroll-contain outline-none`,or={popup:`w-75`,list:`max-h-[min(--spacing(80),var(--available-height))]`,search:_(ae(`default`,!1,`page`,`sm`,`search`),`m-0.5 mb-1.5`),rowTile:null,row:`data-selected:bg-(--color-bg-primary-tint-10) [&>svg:last-child]:text-(--color-primary-text)`},sr={full:{popup:`w-(--anchor-width)`,list:`max-h-[min(--spacing(52),var(--available-height))]`,search:_(ae(`default`,!1,`page`,`popup-search`),`mb-1`),rowTile:`grid size-5.5 shrink-0 place-items-center rounded-sm bg-surface-hover-layer text-caption font-semibold text-fg-secondary`,row:``},header:or,"header-narrow":or,"header-tile":or};function cr({value:e,onValueChange:t,list:n,labels:r,variant:a=`full`,recent:o,footerActions:s,open:c,onOpenChange:l,autoFocus:u,"data-testid":d}){let f=dt(),p=(0,H.useId)(),h=(0,H.useId)(),[g,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),C=c??x,w=sr[a],T=n.state===`ready`?n.projects:null,E=(0,H.useMemo)(()=>T===null?/* @__PURE__ */ new Map:new Map(T.map(e=>[e.id,e])),[T]),D=(0,H.useMemo)(()=>{if(T===null||o===void 0||g.trim()!==``||T.length<=Zn)return null;let e=new Set(o.ids),t=T.filter(t=>e.has(t.id));return t.length===0?null:[{heading:o.heading,items:t},{heading:o.restHeading,items:T.filter(t=>!e.has(t.id))}]},[T,o,g]),O=T===null?[]:D??T,te=e=>{c===void 0&&S(e),l==null||l(e),e||b(``)},k=e=>{let t=Un(e.name);return/* @__PURE__ */ (0,U.jsxs)(Jt,{value:e,className:_(v,w.row),children:[w.rowTile===null?/* @__PURE__ */ (0,U.jsx)(Xn,{name:e.name,size:22}):/* @__PURE__ */ (0,U.jsx)(`span`,{className:w.rowTile,"aria-hidden":`true`,children:t??/* @__PURE__ */ (0,U.jsx)(Rt,{className:`size-3`})}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:_(m,`truncate`),children:e.name}),/* @__PURE__ */ (0,U.jsx)(We,{"aria-hidden":`true`,className:ee})]},e.id)},ne=n.state===`loading`?/* @__PURE__ */ (0,U.jsx)(`div`,{role:`status`,"aria-label":r.loading,className:`grid gap-px`,children:Array.from({length:Qn},(e,t)=>/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2.5 px-2.5 py-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`size-5.5 rounded-sm`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-3 w-[60%]`})]},t))}):n.state===`error`?/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`alert`,className:`grid justify-items-center gap-2 pb-2`,children:[/* @__PURE__ */ (0,U.jsx)(`p`,{className:_(se,`m-0 pb-0`),children:n.message}),/* @__PURE__ */ (0,U.jsx)(M,{variant:`secondary`,size:`sm`,onClick:n.onRetry,children:r.retry})]}):/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(en,{children:/* @__PURE__ */ (0,U.jsx)(`div`,{className:se,children:r.empty})}),/* @__PURE__ */ (0,U.jsx)(Ut,{"aria-label":r.label,className:_(ar,w.list),children:D===null?k:e=>/* @__PURE__ */ (0,U.jsxs)(Bn,{items:e.items,children:[/* @__PURE__ */ (0,U.jsx)(Vn,{className:ut,children:e.heading}),/* @__PURE__ */ (0,U.jsx)(Yt,{children:k})]},e.heading)})]}),re=_(e===null?er:$n,`size-8.5`),ie=e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{className:ir,"aria-hidden":`true`,children:/* @__PURE__ */ (0,U.jsx)(lr,{name:null})}):/* @__PURE__ */ (0,U.jsx)(Xn,{name:e.name,size:26}),A=/* @__PURE__ */ (0,U.jsx)(et,{"aria-hidden":`true`,className:_(`shrink-0 text-fg-muted [transition:transform_var(--motion-medium)_var(--ease-out)] group-data-popup-open/trigger:rotate-180`,a===`full`?`size-4`:`size-3.25`)}),ae=a===`header-tile`?/* @__PURE__ */ (0,U.jsxs)(Ln,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${h}`,className:nr,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{id:p,className:`sr-only`,children:r.label}),ie,/* @__PURE__ */ (0,U.jsx)(`span`,{id:h,className:`sr-only`,children:e===null?r.placeholder:e.name}),A]}):a===`header`||a===`header-narrow`?/* @__PURE__ */ (0,U.jsxs)(Ln,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${h}`,className:nr,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{id:p,className:`sr-only`,children:r.label}),ie,e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{id:h,className:_(rr[a],`font-medium text-fg-secondary`),children:r.placeholder}):/* @__PURE__ */ (0,U.jsx)(ce,{value:e.name,children:/* @__PURE__ */ (0,U.jsx)(`span`,{id:h,className:rr[a],children:e.name})}),A]}):/* @__PURE__ */ (0,U.jsxs)(Ln,{"data-testid":d,autoFocus:u,"aria-labelledby":`${p} ${h}`,className:tr,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:re,"aria-hidden":`true`,children:/* @__PURE__ */ (0,U.jsx)(lr,{name:(e==null?void 0:e.name)??null})}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`grid min-w-0 flex-1 leading-(--leading-picker)`,children:[/* @__PURE__ */ (0,U.jsx)(`small`,{id:p,className:`text-(length:--text-picker-label) text-fg-muted`,children:r.label}),e===null?/* @__PURE__ */ (0,U.jsx)(`span`,{id:h,className:`truncate text-base font-medium tracking-(--tracking-snug) text-fg-secondary`,children:r.placeholder}):/* @__PURE__ */ (0,U.jsx)(ce,{value:e.name,children:/* @__PURE__ */ (0,U.jsx)(`span`,{id:h,className:`truncate text-base font-semibold tracking-(--tracking-heading) text-fg-primary`,children:e.name})})]}),A]});return/* @__PURE__ */ (0,U.jsxs)(Kt,{items:O,value:e,onValueChange:e=>{if(e===null)return;let n=E.get(e.id);if(n===void 0)throw Error(`ProjectPicker: chosen project ${e.id} is not in the list`);t(n)},itemToStringLabel:e=>e.name,isItemEqualToValue:(e,t)=>e.id===t.id,inputValue:g,onInputValueChange:b,open:C,onOpenChange:te,autoHighlight:!0,children:[a===`header-tile`?/* @__PURE__ */ (0,U.jsx)(I,{relationship:`none`,content:e===null?r.placeholder:e.name,placement:`bottom`,children:ae}):ae,/* @__PURE__ */ (0,U.jsx)(tn,{container:f,children:/* @__PURE__ */ (0,U.jsx)(Qt,{side:`bottom`,align:`start`,sideOffset:a===`full`?4:8,collisionPadding:8,positionMethod:`fixed`,className:fe,children:/* @__PURE__ */ (0,U.jsxs)(Vt,{"data-project-picker":``,"aria-label":r.placeholder,className:_(i,w.popup),children:[/* @__PURE__ */ (0,U.jsxs)(Wt,{className:w.search,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:xe,children:/* @__PURE__ */ (0,U.jsx)(y,{"aria-hidden":`true`})}),/* @__PURE__ */ (0,U.jsx)(Gt,{placeholder:r.search,"aria-label":r.search,className:be})]}),ne,s!==void 0&&/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(`div`,{className:`mx-(--menu-padding) my-1 h-px border-0 bg-stroke-light`,role:`separator`}),s.map(e=>/* @__PURE__ */ (0,U.jsxs)(`button`,{type:`button`,"data-testid":e.testId,className:_(`group/opt flex min-h-(--menu-row-height) w-full cursor-pointer select-none items-center gap-(--menu-row-gap) rounded-(--menu-row-radius) border-0 bg-transparent px-(--menu-row-padding-x) py-(--menu-row-padding-y) text-left font-sans text-[length:var(--text-body-sm)] leading-normal outline-hidden [transition:background-color_var(--motion-instant)_var(--ease-out)] data-disabled:cursor-not-allowed data-disabled:opacity-disabled [&_svg]:size-(--menu-icon-size) [&_svg]:shrink-0 text-fg-primary data-highlighted:bg-surface-elevated-hover active:bg-surface-elevated-active data-selected:font-medium`,`hover:bg-surface-elevated-hover focus-visible:bg-surface-elevated-hover`),onClick:()=>{te(!1),e.onSelect()},children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`inline-flex shrink-0 text-fg-muted`,children:e.icon}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.label})]},e.label))]})]})})})]})}function lr({name:e}){let t=e===null?null:Un(e);return t===null?/* @__PURE__ */ (0,U.jsx)(Rt,{"aria-hidden":`true`,className:`size-4`}):/* @__PURE__ */ (0,U.jsx)(U.Fragment,{children:t})}var ur=`animate-[popup-bind-swap_var(--motion-medium)_var(--ease-out)_both] motion-reduce:animate-none`;function dr({host:e,applicationName:t,environmentName:n,newApplication:r,newEnvironment:i,replaced:a,fresh:o}){let s=e=>e.trim()===``?`\u2026`:e.trim(),c={host:/* @__PURE__ */ (0,U.jsx)(`span`,{children:e}),application:/* @__PURE__ */ (0,U.jsx)(`span`,{children:s(t)}),environment:/* @__PURE__ */ (0,U.jsx)(`span`,{children:s(n)}),old:/* @__PURE__ */ (0,U.jsx)(`span`,{children:a===null?``:a.address}),b:/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`})},l;l=a===null?r&&i?`popup.site.bindSay.both`:r?`popup.site.bindSay.newApplication`:i?`popup.site.bindSay.newEnvironment`:`popup.site.bindSay.free`:o===`taken`?`popup.site.bindSay.freshTaken`:o===`changed`?`popup.site.bindSay.freshChanged`:`popup.site.bindSay.replace`;let u=`${l}|${t}|${n}|${a===null?``:a.address}`;return a===null?/* @__PURE__ */ (0,U.jsx)(`p`,{"aria-live":`polite`,className:`m-0 min-w-0 text-(length:--text-compact) leading-normal text-fg-secondary text-pretty wrap-anywhere ${ur}`,"data-testid":`popup-bind-consequence`,children:/* @__PURE__ */ (0,U.jsx)(Ce,{i18nKey:l,components:c})},u):/* @__PURE__ */ (0,U.jsx)(`div`,{role:o===null?void 0:`alert`,"aria-live":o===null?`polite`:void 0,className:ur,"data-testid":`popup-bind-consequence`,"data-replace":`true`,children:/* @__PURE__ */ (0,U.jsx)(Ne,{tone:`warning`,title:/* @__PURE__ */ (0,U.jsx)(Ce,{i18nKey:l,components:c})})},u)}var fr={local:`dev`,dev:`dev`,staging:`staging`,prod:`production`},pr=/* @__PURE__ */ new WeakMap;function mr(e,t){return`${e}|${t}`}function hr(e){let t=pr.get(e);if(t!==void 0)return t;let n=new Map(e.map(e=>[mr(e.applicationId,e.environmentId),e]));return pr.set(e,n),n}function gr(e,t,n){let r=hr(e).get(mr(t,n));return r===void 0?null:r}function _r(e,t,n){return n===null||t.kind!==`existing`||n.kind!==`existing`?null:gr(e.cells,t.id,n.id)}function vr(e){return e.trim().toLowerCase()}function yr(e,t){let n=vr(t);if(n===``)return null;let r=e.find(e=>vr(e.name)===n);return r===void 0?null:r}function br(e,t,n){let r=e.environments.filter(n=>t===null||gr(e.cells,t,n.id)===null),i=r.find(e=>e.envType===n.type)??r.find(e=>e.isDefault)??r.at(0);return i===void 0?{choice:{kind:`new`,name:yr(e.environments,n.name)===null?n.name:``},allTaken:e.environments.length>0}:{choice:{kind:`existing`,id:i.id},allTaken:!1}}var xr=/* @__PURE__ */ new Set([`targets.cell_exists`,`targets.modified_concurrently`,`targets.host_conflict`,`targets.not_found`]);function Sr(e){return e instanceof l&&e.errorCode!==void 0?e.errorCode:null}function Cr(e){return e instanceof Error?e.message:String(e)}function wr(e,t,n){return{application:e.application.kind===`new`&&n.application===null?yr(t.applications,e.application.name):null,environment:e.environment!==null&&e.environment.kind===`new`&&n.environment===null?yr(t.environments,e.environment.name):null}}function Tr(e){let t=Sr(e);return t!==null&&xr.has(t)}function Er(e){return e.application!==null&&e.environment!==null?`both`:e.application===null?e.environment===null?null:`environment`:`application`}function Dr(e,t){let n=Er(e);return n===null?t:N.t(`popup.site.createdNotBound.${n}`,{application:e.application,environment:e.environment,reason:t})}function K(e,t){let n=Er(t);if(n===null)return ye(N,e,`popup.site.bindFailed`);let r={application:t.application,environment:t.environment},i=N.t(`popup.site.bindPartial.${n}`,r),a=ye(N,e,`popup.site.bindPartial.${n}`,r);return a===i?a:Dr(t,a)}function Or(e,t,n,r,i){let{defaultApplicationId:a,proposal:o}=i,s=e.application,c=s.kind===`existing`&&!t.applications.some(e=>e.id===s.id)?{kind:`existing`,id:a}:s;if(!t.applications.some(e=>e.id===a))throw Error(`The default application ${a} left the project`);let l={...e,lists:t,application:c},u=e.environment;if(u!==null&&u.kind===`existing`&&!t.environments.some(e=>e.id===u.id)){let e=br(t,c.kind===`existing`?c.id:null,o);l={...l,environment:e.choice,environmentAllTaken:e.allTaken,environmentChosen:!1}}let d=Sr(n),f=_r(t,l.application,l.environment);return d===`targets.cell_exists`?{...l,fresh:f===null?null:`taken`,failure:null}:d===`targets.modified_concurrently`?{...l,fresh:f===null?null:`changed`,failure:null}:d===`targets.host_conflict`?{...l,fresh:null,failure:kr(n,l,r,i.host)}:{...l,fresh:null,failure:K(n,r)}}function kr(e,t,n,r){var i;let a=e instanceof l&&typeof((i=e.params)==null?void 0:i.applicationId)==`string`?e.params.applicationId:null,o=t.lists.applications.find(e=>e.id===a),s=t.environment,c=s!==null&&s.kind===`existing`?t.lists.environments.find(e=>e.id===s.id):void 0;return o===void 0||c===void 0?K(e,n):Dr(n,N.t(`popup.site.hostConflict`,{host:r,application:o.name,environment:c.name}))}var q=V(`pgs-e9b150372c`);function Ar(e){let{defaultApplicationId:t,host:n,proposal:r,requests:i}=e,[a,o]=(0,H.useState)(()=>{let n=br(e.lists,t,r);return{lists:e.lists,application:{kind:`existing`,id:t},environment:n.choice,environmentChosen:!1,environmentAllTaken:n.allTaken,problem:null,failure:null,fresh:null,pending:!1,createUnsettled:!1,focus:null}}),s=(0,H.useRef)(!1),c=(0,H.useRef)(0),u=()=>(c.current+=1,c.current),d=(e,t)=>({target:e,field:t,seq:u()}),f=(e,t)=>{if(e.environmentChosen&&e.environment!==null)return{environment:e.environment,environmentAllTaken:e.environmentAllTaken};let n=br(e.lists,t.kind===`existing`?t.id:null,r);return{environment:n.choice,environmentAllTaken:n.allTaken}},p=(e,t)=>({...e,application:t,...f(e,t),problem:null,failure:null,fresh:null}),m=(e,t)=>({...e,environment:t,environmentChosen:!0,environmentAllTaken:!1,problem:null,failure:null,fresh:null}),h=(e,t)=>{s.current||o(n=>{if(e===`application`)return t===`new`?{...p(n,{kind:`new`,name:``}),focus:d(`input`,e)}:p(n,{kind:`existing`,id:t});if(t!==`new`)return m(n,{kind:`existing`,id:t});let i=yr(n.lists.environments,r.name)!==null;return{...m(n,{kind:`new`,name:i?``:r.name}),focus:d(`input`,e)}})},g=(e,t)=>{o(n=>{let r=e===`application`?n.application:n.environment;if(r===null||r.kind!==`new`)throw Error(`The ${e} field is not a new name, it cannot be renamed`);let i={kind:`new`,name:t};return{...n,...e===`application`?{application:i}:{environment:i},problem:n.problem!==null&&n.problem.field===e?null:n.problem}})},_=e=>{s.current||o(n=>{if(e===`application`)return{...p(n,{kind:`existing`,id:t}),focus:d(`trigger`,e)};if(n.lists.environments.length===0)throw Error(`A project without environments has no list to go back to`);let i=br(n.lists,n.application.kind===`existing`?n.application.id:null,r),a=i.choice.kind===`existing`?i.choice:null;return{...m(n,a),focus:d(`trigger`,e)}})},v=(e,t)=>{o(n=>({...e===`application`?p(n,{kind:`existing`,id:t}):m(n,{kind:`existing`,id:t}),focus:d(`trigger`,e)}))},y=async a=>{let s={application:null,environment:null},c=a;if(c.createUnsettled)try{c=x(c,await i.readLists(),s)}catch(e){q.error(`pgm-9a173522f2`,{error:Cr(e)}),o(t=>({...t,failure:K(e,s),focus:{target:`submit`,seq:u()}}));return}let d=c.environment;if(d===null)throw Error(`The bind press ran with no environment chosen`);let f=null;try{let t;if(c.application.kind===`new`){f=`application`;let n=await i.createApplication(c.application.name.trim());f=null,s.application=n.name,t=n.id,o(e=>({...e,lists:{...e.lists,applications:[...e.lists.applications,n]},application:{kind:`existing`,id:n.id}})),e.onApplicationCreated()}else t=c.application.id;let n;if(d.kind===`new`){f=`environment`;let t=await i.createEnvironment(d.name.trim(),c.lists.environments.length===0);f=null,s.environment=t.name,n=t.id,o(e=>({...e,lists:{...e.lists,environments:[...e.lists.environments,t]},environment:{kind:`existing`,id:t.id},environmentAllTaken:!1})),e.onEnvironmentCreated()}else n=d.id;let r=_r(c.lists,c.application,d);r===null?await i.createCell(t,n):await i.replaceCell(r)}catch(e){if(q.error(`pgm-53ab6bb5fe`,{createdApplication:s.application!==null,createdEnvironment:s.environment!==null,status:e instanceof l?e.status:null,code:Sr(e),error:Cr(e)}),f!==null){await b(c,s,e);return}if(Tr(e))try{let a=await i.readLists();o(i=>({...Or(i,a,e,s,{defaultApplicationId:t,proposal:r,host:n}),focus:{target:`submit`,seq:u()}}));return}catch(e){q.error(`pgm-a2654be732`,{error:Cr(e)})}o(t=>({...t,failure:K(e,s),focus:{target:`submit`,seq:u()}}));return}q.info(`pgm-dfe3d492ed`,{createdApplication:s.application!==null,createdEnvironment:s.environment!==null}),await e.onBound()},b=async(e,t,n)=>{let r;try{r=await i.readLists()}catch(e){q.error(`pgm-200d50f185`,{error:Cr(e)}),o(e=>({...e,createUnsettled:!0,failure:K(n,t),focus:{target:`submit`,seq:u()}}));return}x(e,r,t),o(e=>({...e,failure:K(n,t),focus:{target:`submit`,seq:u()}}))},x=(t,n,r)=>{let i=wr(t,n,r);i.application!==null&&(r.application=i.application.name,e.onApplicationCreated()),i.environment!==null&&(r.environment=i.environment.name,e.onEnvironmentCreated()),(i.application!==null||i.environment!==null)&&q.info(`pgm-52181e7844`,{application:i.application!==null,environment:i.environment!==null});let a=e=>({...e,lists:n,createUnsettled:!1,...i.application===null?{}:{application:{kind:`existing`,id:i.application.id}},...i.environment===null?{}:{environment:{kind:`existing`,id:i.environment.id},environmentAllTaken:!1}});return o(a),a(t)};return{state:a,choose:h,rename:g,backToList:_,chooseExisting:v,submit:()=>{if(!s.current){if(a.environment===null){o(e=>({...e,problem:{field:`environment`,kind:`unchosen`},focus:d(`trigger`,`environment`)}));return}for(let e of[`application`,`environment`]){let t=e===`application`?a.application:a.environment;if(t.kind!==`new`)continue;if(t.name.trim()===``){o(t=>({...t,problem:{field:e,kind:`empty`},focus:d(`input`,e)}));return}let n=yr(e===`application`?a.lists.applications:a.lists.environments,t.name);if(n!==null){o(t=>({...t,problem:{field:e,kind:`duplicate`,id:n.id,name:n.name},focus:d(`input`,e)}));return}}s.current=!0,o(e=>({...e,pending:!0,failure:null,fresh:null,problem:null})),e.onPressStarted(),y(a).finally(()=>{s.current=!1,o(e=>({...e,pending:!1})),e.onPressEnded()})}}}}var jr=V(`pgs-e9b150372c`),Mr=`animate-[popup-bind-swap_var(--motion-medium)_var(--ease-out)_both] motion-reduce:animate-none`;function Nr(e){let{t:n}=F(),r=Ar(e),{state:i}=r,o=(0,H.useId)(),s=e=>`${o}-${e}`,c=(0,H.useRef)(null),l=(0,H.useRef)(null),u=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=i.focus;if(e===null)return;let t;if(t=e.target===`submit`?u.current:e.target===`input`?(e.field===`application`?c:l).current:document.getElementById(`${o}-${e.field}`),t===null){jr.warn(`pgm-9d57cb6e57`,{target:e.target});return}t.focus()},[i.focus,o]);let{lists:d,application:f,environment:p,pending:m,problem:h}=i,g=f.kind===`new`?f.name:Pr(d.applications,f.id),_=p===null?``:p.kind===`new`?p.name:Pr(d.environments,p.id),v=_r(d,f,p),y=e=>{if(h!==null&&h.field===e)return h.kind===`empty`?n(e===`application`?`popup.site.emptyApplication`:`popup.site.emptyEnvironment`):h.kind===`unchosen`?n(`popup.site.environmentRequired`):/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 wrap-anywhere`,children:[n(e===`application`?`popup.site.duplicateApplication`:`popup.site.duplicateEnvironment`,{name:h.name}),` `,/* @__PURE__ */ (0,U.jsx)(M,{variant:`link`,size:`xs`,onClick:()=>r.chooseExisting(e,h.id),"data-testid":`popup-bind-${e}-choose-existing`,children:n(`popup.site.chooseExisting`)})]})},b=(e,t,i)=>{let o=e===`application`||d.environments.length>0;return/* @__PURE__ */ (0,U.jsx)(Ye,{ref:e===`application`?c:l,id:s(e),size:`sm`,fieldClassName:`grid-cols-1`,label:n(e===`application`?`popup.site.newApplication`:`popup.site.newEnvironment`),placeholder:n(e===`application`?`popup.site.newApplicationPlaceholder`:`popup.site.newEnvironmentPlaceholder`),autoComplete:`off`,value:t,onValueChange:t=>r.rename(e,t),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),r.submit()):t.key===`Escape`&&o&&(t.preventDefault(),r.backToList(e))},disabled:m,leading:/* @__PURE__ */ (0,U.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5 text-fg-link`}),trailing:o?/* @__PURE__ */ (0,U.jsx)(I,{relationship:`label`,content:n(`popup.site.backToList`),placement:`top`,children:/* @__PURE__ */ (0,U.jsx)(E,{size:`sm`,icon:/* @__PURE__ */ (0,U.jsx)(a,{"aria-hidden":`true`}),onClick:()=>r.backToList(e),disabled:m,"data-testid":`popup-bind-${e}-back`})}):void 0,hint:i,error:y(e),className:Mr,"data-testid":`popup-bind-${e}-name`},`${e}-new`)},x=e=>({options:[{value:`new`,label:n(e===`application`?`popup.site.newApplication`:`popup.site.newEnvironment`),icon:/* @__PURE__ */ (0,U.jsx)(ge,{"aria-hidden":`true`,className:`text-fg-link`})}]}),S=f.kind===`new`?b(`application`,f.name,void 0):/* @__PURE__ */ (0,U.jsx)(Xe,{id:s(`application`),size:`sm`,fieldClassName:`grid-cols-1`,label:n(`popup.site.applicationLabel`),value:f.id,onValueChange:e=>r.choose(`application`,e),disabled:m,groups:[{options:d.applications.map(e=>({value:e.id,label:e.name}))},x(`application`)],"data-testid":`popup-bind-application`},`application-list`),C;d.environments.length===0?C=n(`popup.site.noEnvironmentsHint`):i.environmentAllTaken&&(C=/* @__PURE__ */ (0,U.jsx)(`span`,{className:`wrap-anywhere`,children:n(`popup.site.allTakenHint`,{application:g.trim()===``?`\u2026`:g.trim()})}));let ee=p!==null&&p.kind===`new`?b(`environment`,p.name,C):/* @__PURE__ */ (0,U.jsx)(Xe,{id:s(`environment`),size:`sm`,fieldClassName:`grid-cols-1`,label:n(`popup.site.environmentLabel`),value:p===null?null:p.id,placeholder:n(`popup.site.environmentPlaceholder`),error:y(`environment`),onValueChange:e=>r.choose(`environment`,e),disabled:m,groups:[{options:d.environments.map(e=>{let t=f.kind===`existing`?gr(d.cells,f.id,e.id):null;return t===null?{value:e.id,label:e.name}:{value:e.id,label:e.name,description:n(`popup.site.taken`,{address:t.address})}})},x(`environment`)],"data-testid":`popup-bind-environment`},`environment-list`);return/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`group`,"aria-label":n(`popup.site.bind`),"aria-busy":m,className:`grid min-w-0 grid-cols-1 gap-2.5 rounded-md border border-stroke-light bg-surface-modal-inset px-3 pt-2.5 pb-3`,"data-testid":`popup-bind-form`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2.5`,children:[S,ee]}),h===null&&p!==null&&/* @__PURE__ */ (0,U.jsx)(dr,{host:e.host,applicationName:g,environmentName:_,newApplication:f.kind===`new`,newEnvironment:p.kind===`new`,replaced:v,fresh:i.fresh}),i.failure!==null&&/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-1.5 text-(length:--text-compact) leading-(--leading-caption) text-fg-error`,"data-testid":`popup-bind-failure`,children:[/* @__PURE__ */ (0,U.jsx)(t,{"aria-hidden":`true`,className:`mt-px size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:i.failure})]}),/* @__PURE__ */ (0,U.jsx)(M,{ref:u,size:`sm`,icon:v===null?/* @__PURE__ */ (0,U.jsx)(w,{"aria-hidden":`true`}):/* @__PURE__ */ (0,U.jsx)(cn,{"aria-hidden":`true`}),loading:m,onClick:r.submit,className:`justify-self-end`,"data-testid":`popup-bind-submit`,children:n(v===null?`popup.site.bind`:`popup.site.replace`)})]})}function Pr(e,t){let n=e.find(e=>e.id===t);if(n===void 0)throw Error(`The bind form chose ${t}, absent from its list`);return n.name}function J({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{"aria-live":`polite`,className:`grid grid-cols-1 gap-2 border-t border-stroke-light py-2.5 pr-3 pl-3.5 animate-ui-fade-in motion-reduce:animate-none`,"data-testid":`popup-site`,children:e})}function Y({host:e}){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-body-sm text-fg-secondary`,children:[/* @__PURE__ */ (0,U.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-fg-muted`}),/* @__PURE__ */ (0,U.jsx)(`b`,{className:`min-w-0 truncate font-medium text-fg-primary`,children:e})]})}var Fr=`inline-flex h-6 items-center rounded-full border border-stroke bg-surface-hover-layer text-xs text-fg-primary`;function Ir({applicationName:e,environmentName:t}){let{t:n}=F();return/* @__PURE__ */ (0,U.jsxs)(`div`,{"aria-label":n(`popup.site.cellLabel`),className:`flex flex-wrap items-center gap-1.5`,"data-testid":`popup-site-cell`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:_(Fr,`px-2.25 font-medium`),children:e}),/* @__PURE__ */ (0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-fg-muted`,children:`\u00D7`}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:_(Fr,`px-2.5 font-semibold animate-[popup-environment-in_var(--motion-long)_var(--ease-out)_both]`),children:t})]})}function Lr({children:e,hintName:t,hint:n,tone:r=`default`,icon:i}){return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:_(`flex min-w-0 items-center gap-1.5 [&>svg]:size-3.5 [&>svg]:shrink-0`,r===`warning`&&`text-fg-warning`),children:[i,/* @__PURE__ */ (0,U.jsx)(`p`,{className:_(`m-0 min-w-0 text-(length:--text-compact) leading-normal [&_b]:font-semibold [&_b]:text-fg-primary`,r===`warning`?`text-inherit`:r===`muted`?`text-fg-muted`:`text-fg-secondary`),children:e}),/* @__PURE__ */ (0,U.jsx)(B,{name:t,text:n,placement:`bottom-start`})]})}var Rr=V(`pgs-f048f86b7e`);function zr({projectId:e,host:t,environments:n,chosenId:r,onChosen:i}){let{t:a}=F(),o=x(),[s,c]=(0,H.useState)(!1);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(Lr,{hintName:a(`popup.site.more`,{about:a(`popup.site.environmentChoice`)}),hint:a(`popup.site.environmentChoiceHint`),children:a(`popup.site.environmentChoice`)}),/* @__PURE__ */ (0,U.jsx)(Xe,{size:`sm`,"aria-label":a(`popup.site.environmentLabel`),placeholder:a(`popup.site.environmentPlaceholder`),value:r,onValueChange:t=>{s||(c(!0),z.environments.setActive(O(e),`extension`,t).then(()=>{Rr.info(`pgm-f54cd7418d`,{projectId:e}),i()}).catch(t=>{Rr.error(`pgm-effdde2b56`,{projectId:e,error:t instanceof Error?t.message:String(t)}),o.show({id:`popup-environment-choice`,variant:`error`,message:a(`popup.site.environmentFailed`)})}).finally(()=>c(!1)))},disabled:s,options:n.map(e=>({value:e.id,label:e.name,description:t})),"data-testid":`popup-site-environment`})]})}function Br(e){let t=e.toLowerCase();return/(^|\/\/|\.)dev\./.test(t)?`dev`:/stag/.test(t)?`staging`:/localhost|127\.0/.test(t)?`local`:`prod`}function Vr(e){let t=e.toLowerCase();return/prod/.test(t)?`production`:/stag/.test(t)?`staging`:/dev|local|\u043B\u043E\u043A\u0430\u043B/.test(t)?`dev`:`custom`}function Hr(e){let t=Br(e);return{key:`popup.site.environmentSuggestion.${t}`,type:fr[t]}}function Ur(e){return{targetId:e.id,applicationId:e.applicationId,environmentId:e.environmentId,baseUrl:e.baseUrl,hostPattern:e.hostPattern}}function Wr(e,t,n){let{targets:r,applications:i,environments:a}=t,o=r.find(e=>e.baseUrl===null&&e.hostPattern===null);if(o!==void 0)return{kind:`inconsistent`,reason:`Cell ${o.id} has neither an origin nor a host pattern`};let s=mt(n.href,r.map(Ur),null);switch(s.kind){case`matched`:{let t=Kr(i,s.applicationId),n=Kr(a,s.environmentId);return t===null||n===null?qr(e,t===null?s.applicationId:s.environmentId):{kind:`matched`,applicationName:t,environmentName:n}}case`ambiguous_application`:{let t=Kr(a,s.environmentId);return t===null?qr(e,s.environmentId):{kind:`ambiguous`,environmentName:t}}case`environment_choice`:{let t=s.environmentIds.find(e=>!a.some(t=>t.id===e));return t===void 0?{kind:`environmentChoice`,environments:a.filter(e=>s.environmentIds.includes(e.id)).map(e=>({id:e.id,name:e.name}))}:qr(e,t)}case`unknown_host`:case`no_targets`:{let n=i.find(e=>e.isDefault);return n===void 0?{kind:`inconsistent`,reason:`Project ${e} has no default application`}:{kind:`bind`,reason:s.kind,lists:Xr(t),defaultApplicationId:n.id}}case`unsupported_url`:return{kind:`unsupported`}}}function Gr(e,t){if(e.source!==`user_preference`||e.environmentId===null)return null;let n=e.environmentId;return t.some(e=>e.id===n)?n:null}function Kr(e,t){let n=e.find(e=>e.id===t);return n===void 0?null:n.name}function qr(e,t){return{kind:`inconsistent`,reason:`A cell of project ${e} names ${t}, absent from the lists read`}}async function Jr(e,t){let n=O(t),[r,i,a]=await Promise.all([e.targets.listAll(n),e.applications.byProject(n),e.environments.list(n)]);return{targets:r,applications:i,environments:a}}async function Yr(e,t){return Xr(await Jr(e,t))}function Xr(e){return{applications:e.applications.map(Zr),environments:e.environments.map(Qr),cells:e.targets.map($r)}}function Zr(e){return{id:e.id,name:e.name}}function Qr(e){return{id:e.id,name:e.name,envType:e.envType,isDefault:e.isDefault}}function $r(e){let t;if(e.baseUrl!==null)t=new URL(e.baseUrl).host;else if(e.hostPattern!==null)t=e.hostPattern;else throw Error(`Cell ${e.id} has neither an origin nor a host pattern`);return{id:e.id,applicationId:e.applicationId,environmentId:e.environmentId,address:t,hostPattern:e.hostPattern,updatedAt:e.updatedAt}}async function ei(e,t,n){return Zr(await e.applications.create({projectId:O(t),name:n}))}async function ti(e,t,n,r){return Qr(await e.environments.create({projectId:O(t),name:n,envType:Vr(n),isDefault:r}))}async function ni(e,t,n,r,i){await e.targets.create(O(t),{applicationId:Be(r),environmentId:i,baseUrl:n})}async function ri(e,t,n,r){let i=r.hostPattern!==null&&ht(n,[{targetId:r.id,applicationId:r.applicationId,environmentId:r.environmentId,baseUrl:null,hostPattern:r.hostPattern}]).length>0;await e.targets.update(O(t),r.id,{baseUrl:n,...r.hostPattern===null||i?{}:{hostPattern:null},expectedUpdatedAt:r.updatedAt})}var ii=V(`pgs-c1e3b0bb6f`);function ai({page:e,projects:t,onSelect:n}){let{t:i}=F(),a=st(),{data:o,error:s}=k({key:r(a,`target-matches`,e.href),read:()=>z.targets.match(e.href),freshness:`screen`});if((0,H.useEffect)(()=>{s!==null&&ii.error(`pgm-f294aabbd9`,{error:s.message})},[s]),s!==null||o===void 0)return null;let c=new Set(o.items.map(e=>e.projectId)),l=t.filter(e=>c.has(e.id));return l.length===0?null:/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:e.host}),l.map(e=>/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface-hover-layer py-2 pr-2 pl-2.5`,children:[/* @__PURE__ */ (0,U.jsxs)(`p`,{className:`m-0 min-w-0 flex-1 truncate text-(length:--text-compact) leading-(--leading-caption) text-fg-secondary`,children:[i(`popup.site.suggestion`),` `,/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`,children:i(`popup.site.suggestionProject`,{project:e.name})})]}),/* @__PURE__ */ (0,U.jsx)(M,{variant:`secondary`,size:`sm`,onClick:()=>n(e),"data-testid":`popup-site-suggestion`,children:i(`popup.site.select`)})]},e.id))]})}var oi=V(`pgs-94aad7e91e`),si={phase:`none`};function ci(e,t){let n=d(),[r,i]=(0,H.useState)(si),a=(0,H.useRef)({applications:null,environments:null}),o=(0,H.useMemo)(()=>({kind:`project`,projectId:e}),[e]),s=Ve({projectId:e}),c=ke({projectId:e}),l=ct({projectId:e}),u=t.href,f=(0,H.useMemo)(()=>s.data===void 0||c.data===void 0||l.data===void 0?null:Wr(e,{targets:s.data,applications:c.data,environments:l.data},new URL(u)),[e,s.data,c.data,l.data,u]),p=lt({projectId:e,client:`extension`},{enabled:f!==null&&f.kind===`environmentChoice`}),m=f!==null&&f.kind===`inconsistent`?f.reason:null;(0,H.useEffect)(()=>{m!==null&&oi.error(`pgm-0efc4cf256`,{projectId:e,reason:m})},[m,e]);let h=[s,c,l],g=e=>()=>{for(let t of e)t.reload()},_,v=h.filter(li);if(v.length>0)_={status:`failed`,retry:g(v)};else if(f===null)_={status:`loading`};else if(f.kind===`inconsistent`)_={status:`failed`,retry:g(h)};else if(f.kind===`environmentChoice`){if(li(p))_={status:`failed`,retry:g([p])};else if(p.data===void 0)_={status:`loading`};else{let e=Gr(p.data,f.environments);_={status:`ready`,screen:{...f,chosenId:e}}}}else _={status:`ready`,screen:f};r.phase===`outcome`&&_.status!==`failed`&&i(si);let y=_;return(r.phase===`press`||r.phase===`outcome`&&_.status===`failed`)&&(y={status:`binding`,screen:r.screen,retry:_.status===`failed`?_.retry:null}),{state:y,bindStarted:()=>{let e;if(y.status===`binding`)e=y.screen;else if(y.status===`ready`&&y.screen.kind===`bind`)e=y.screen;else throw Error(`A bind press started while the site strip is ${y.status}`);a.current={applications:null,environments:null},i({phase:`press`,screen:e})},bindEnded:()=>{i(e=>e.phase===`press`?{phase:`outcome`,screen:e.screen}:e)},afterApplicationCreated:()=>{a.current.applications=n.invalidateAfterChange(Fe(o))},afterEnvironmentCreated:()=>{a.current.environments=n.invalidateAfterChange(at(o))},afterBind:async()=>{let e=a.current;a.current={applications:null,environments:null};let t=(e,t)=>e===null?n.invalidateAfterChange(t):e;await Promise.all([t(e.applications,Fe(o)),t(e.environments,at(o))]),await n.invalidateAfterChange(Ee(o)),i(si)},afterEnvironmentChosen:()=>{n.invalidateAfterChange(Ie(o))}}}function li(e){return e.error!==null||e.refreshError!==null}var ui=V(`pgs-3b85b4fc58`);function di({tabId:e,project:t,projects:n,onSelectProject:r}){let i=fi(e);if(i.status!==`read`)return null;let a=i.url,o=a===null?null:u(a),s=o!==null&&o.ok?o.url:null;return t===null?s===null?null:/* @__PURE__ */ (0,U.jsx)(ai,{page:s,projects:n,onSelect:r}):s===null?/* @__PURE__ */ (0,U.jsx)(pi,{}):/* @__PURE__ */ (0,U.jsx)(mi,{project:t,page:s})}function fi(e){let[t,n]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let t=!0;return chrome.tabs.get(e).then(r=>{t&&n({tabId:e,result:{status:`read`,url:r.url??null}})},r=>{ui.error(`pgm-df207305cf`,{tabId:e,error:r instanceof Error?r.message:String(r)}),t&&n({tabId:e,result:{status:`failed`}})}),()=>{t=!1}},[e]),t===null||t.tabId!==e?{status:`reading`}:t.result}function pi(){let{t:e}=F();return/* @__PURE__ */ (0,U.jsx)(J,{children:/* @__PURE__ */ (0,U.jsx)(Lr,{tone:`muted`,hintName:e(`popup.site.more`,{about:e(`popup.site.notSite`)}),hint:e(`popup.site.notSiteHint`),children:e(`popup.site.notSite`)})})}function mi({project:e,page:t}){let{t:n}=F(),r=ci(O(e.id),t),{state:i}=r,a={createApplication:t=>ei(z,e.id,t),createEnvironment:(t,n)=>ti(z,e.id,t,n),createCell:(n,r)=>ni(z,e.id,t.origin,n,r),replaceCell:n=>ri(z,e.id,t.origin,n),readLists:()=>Yr(z,e.id)},o=async()=>{try{let t=await L.call(`REFRESH_PROJECT_TARGETS`,{projectId:e.id});t.success||ui.error(`pgm-ef389a0081`,{projectId:e.id,error:t.error})}catch(t){ui.error(`pgm-fc30de5d00`,{projectId:e.id,error:t instanceof Error?t.message:String(t)})}await r.afterBind()};if(i.status===`failed`)return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(gi,{retry:i.retry})]});if(i.status===`loading`)return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,"aria-label":n(`popup.site.reading`),className:`flex items-center gap-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(P,{className:`h-6 w-18.5 rounded-full`}),/* @__PURE__ */ (0,U.jsx)(P,{className:`h-6 w-20.5 rounded-full`})]})]});let s=(n,i)=>/* @__PURE__ */ (0,U.jsx)(hi,{project:e,page:t,screen:n,retry:i,requests:a,site:r,onBound:o});if(i.status===`binding`)return s(i.screen,i.retry);let c=i.screen;switch(c.kind){case`unsupported`:return/* @__PURE__ */ (0,U.jsx)(pi,{});case`matched`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Ir,{applicationName:c.applicationName,environmentName:c.environmentName})]});case`ambiguous`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(Lr,{tone:`warning`,icon:/* @__PURE__ */ (0,U.jsx)(pe,{"aria-hidden":`true`}),hintName:n(`popup.site.more`,{about:n(`popup.site.ambiguous`,{environment:c.environmentName})}),hint:n(`popup.site.ambiguousHint`),children:n(`popup.site.ambiguous`,{environment:c.environmentName})})]});case`environmentChoice`:return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),/* @__PURE__ */ (0,U.jsx)(zr,{projectId:e.id,host:t.host,environments:c.environments,chosenId:c.chosenId,onChosen:r.afterEnvironmentChosen})]});case`bind`:return s(c,null)}}function hi({project:e,page:t,screen:n,retry:r,requests:i,site:a,onBound:o}){let{t:s}=F(),c=Hr(t.host);return/* @__PURE__ */ (0,U.jsxs)(J,{children:[/* @__PURE__ */ (0,U.jsx)(Y,{host:t.host}),r!==null&&/* @__PURE__ */ (0,U.jsx)(gi,{retry:r}),/* @__PURE__ */ (0,U.jsx)(Lr,{hintName:s(`popup.site.bindMore`),hint:s(`popup.site.bindInfo`),children:/* @__PURE__ */ (0,U.jsx)(Ce,{i18nKey:n.reason===`no_targets`?`popup.site.noTargets`:`popup.site.notBound`,components:{b:/* @__PURE__ */ (0,U.jsx)(`b`,{}),project:/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})}})}),/* @__PURE__ */ (0,U.jsx)(Nr,{lists:n.lists,defaultApplicationId:n.defaultApplicationId,host:t.host,proposal:{name:s(c.key),type:c.type},requests:i,onPressStarted:a.bindStarted,onPressEnded:a.bindEnded,onApplicationCreated:a.afterApplicationCreated,onEnvironmentCreated:a.afterEnvironmentCreated,onBound:o})]})}function gi({retry:e}){let{t:n}=F();return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsxs)(`p`,{role:`alert`,className:`m-0 flex gap-1.5 text-(length:--text-compact) leading-normal text-fg-error`,children:[/* @__PURE__ */ (0,U.jsx)(t,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:n(`popup.site.readFailed`)})]}),/* @__PURE__ */ (0,U.jsx)(`div`,{children:/* @__PURE__ */ (0,U.jsx)(M,{variant:`secondary`,size:`sm`,icon:/* @__PURE__ */ (0,U.jsx)(ue,{"aria-hidden":`true`}),onClick:e,"data-testid":`popup-site-retry`,children:n(`common.retry`)})})]})}var _i=V(`pgs-930365a583`),vi=`all`;function yi({tabId:e,applications:t,applicationId:n}){let{t:r}=F(),i=x();return/* @__PURE__ */ (0,U.jsx)(Xe,{appearance:`inline`,label:r(`popup.application.label`),value:n===null?vi:n,onValueChange:t=>{let n=t===vi?null:t;L.call(`SET_TAB_STATE`,{tabId:e,state:{applicationId:n}}).then(e=>{if(!e.success)throw Error(`SET_TAB_STATE refused: ${e.error}`)}).catch(t=>{_i.error(`pgm-e58825e7fe`,{tabId:e,error:t instanceof Error?t.message:String(t)}),i.show({id:`popup-application`,variant:`error`,message:r(`popup.application.switchFailed`)})})},options:[{value:vi,label:r(`popup.application.all`)},...t.map(e=>({value:e.id,label:e.name}))],"data-testid":`popup-application`})}function bi({run:e}){let{t}=F();return/* @__PURE__ */ (0,U.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2.5 rounded-b-lg border-t border-stroke-light bg-[color-mix(in_srgb,var(--color-info)_8%,transparent)] py-2.25 pr-3 pl-3.5 text-(length:--text-compact) leading-snug`,"data-testid":`popup-run-line`,children:[/* @__PURE__ */ (0,U.jsx)(`i`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-info shadow-(--glow-status-info) animate-pulse-dot`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`text-fg-secondary`,children:[/* @__PURE__ */ (0,U.jsx)(`b`,{className:`font-semibold text-fg-primary`,children:e.kind===`free`?t(`popup.run.free`,{number:e.number}):t(`popup.run.plan`,{plan:e.planName})}),` `,t(`popup.run.where`)]})]})}var xi=V(`pgs-c184079221`);function Si({tabId:e,projects:t,tabProject:n,applicationId:r,run:i,onPick:a,pickerOpen:o,onPickerOpenChange:s}){let{t:c}=F();return/* @__PURE__ */ (0,U.jsxs)(`section`,{"aria-label":c(`popup.project.contextLabel`),className:`relative rounded-lg border border-(--color-border-overlay) bg-surface-card shadow-(--shadow-context-card)`,"data-testid":`popup-context`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`relative grid p-2`,children:[/* @__PURE__ */ (0,U.jsx)(cr,{value:n===null?null:{id:n.id,name:n.name},onValueChange:a,list:{state:`ready`,projects:t},labels:{label:c(`popup.project.label`),placeholder:c(`popup.project.placeholder`),search:c(`popup.project.search`),empty:c(`popup.project.empty`),loading:c(`popup.project.loading`),retry:c(`common.retry`)},open:o,onOpenChange:s,autoFocus:!0,"data-testid":`popup-project`}),n!==null&&/* @__PURE__ */ (0,U.jsx)(Ci,{tabId:e,projectId:O(n.id),applicationId:r},n.id)]}),/* @__PURE__ */ (0,U.jsx)(di,{tabId:e,project:n,projects:t,onSelectProject:a},`${e}:${n===null?``:n.id}`),i!==null&&/* @__PURE__ */ (0,U.jsx)(bi,{run:i})]})}function Ci({tabId:e,projectId:t,applicationId:n}){let{data:r,error:i}=ke({projectId:t});return(0,H.useEffect)(()=>{i!==null&&xi.error(`pgm-f42292fd59`,{error:i.message})},[i]),i!==null||r===void 0||r.length<=1?null:/* @__PURE__ */ (0,U.jsx)(yi,{tabId:e,applications:r,applicationId:n})}var wi=[{key:`bugs`,tone:`error`},{key:`checklists`,tone:`primary`},...Oe.incidentsEnabled?[{key:`incidents`,tone:`warning`}]:[]],Ti={bugs:`popup.filters.bugs`,checklists:`popup.filters.checklists`,incidents:`popup.filters.incidents`};function Ei(){let{t:e}=F(),t=W(`filters`),n=G();return/* @__PURE__ */ (0,U.jsxs)(`section`,{"aria-label":e(`popup.filters.title`),className:`grid gap-2`,"data-testid":`popup-filters`,children:[/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`mx-0.5 my-0 text-xs font-medium text-fg-muted`,children:e(`popup.filters.title`)}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t===void 0?wi.map(e=>/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8.5 w-24 rounded-full`},e.key)):wi.map(r=>/* @__PURE__ */ (0,U.jsx)(Zt,{pressed:t[r.key],tone:r.tone,size:`md`,onClick:()=>n(`filters`,{...t,[r.key]:!t[r.key]}),"data-testid":`popup-filter-${r.key}`,children:e(Ti[r.key])},r.key))})]})}function Di(){let{t:e}=F(),t=G();return/* @__PURE__ */ (0,U.jsx)(`div`,{role:`status`,children:/* @__PURE__ */ (0,U.jsx)(Ne,{tone:`info`,icon:/* @__PURE__ */ (0,U.jsx)(fn,{"aria-hidden":`true`}),title:e(`popup.paused.title`),actionsPlacement:`below`,actions:/* @__PURE__ */ (0,U.jsx)(rt,{onClick:()=>t(`enabled`,!0),children:e(`popup.paused.enable`)}),"data-testid":`popup-paused`})})}function Oi({projectSwitch:e,currentProjectName:t}){let{t:n}=F(),{question:r,busy:i,confirm:o,cancel:s}=e;if(r===null)return null;let{run:c,target:l}=r,u=c.kind===`free`,d=c.kind===`free`?n(`popup.switchRun.freeText`,{number:c.number,project:l.name}):t===null?n(`popup.switchRun.planTextNoProject`,{plan:c.planName}):n(`popup.switchRun.planText`,{plan:c.planName,project:t});return/* @__PURE__ */ (0,U.jsx)(le,{open:!0,busy:i,onCancel:s,tone:u?`danger`:`warning`,icon:u?/* @__PURE__ */ (0,U.jsx)(a,{"aria-hidden":`true`}):/* @__PURE__ */ (0,U.jsx)(ln,{"aria-hidden":`true`}),title:n(u?`popup.switchRun.freeTitle`:`popup.switchRun.planTitle`),description:d,"data-testid":`popup-project-switch-question`,actions:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(M,{variant:`secondary`,onClick:s,children:n(`popup.switchRun.stay`)}),/* @__PURE__ */ (0,U.jsx)(M,{variant:u?`danger`:`primary`,loading:i,onClick:o,"data-testid":`popup-project-switch-confirm`,children:n(u?`popup.switchRun.freeConfirm`:`popup.switchRun.planConfirm`)})]})})}var ki=V(`pgs-ab0307fe13`);function Ai({tabId:e,projectId:t,currentTestRun:n}){let{t:r}=F(),i=x(),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),l=async t=>{let n=await L.call(`RESTORE_PROJECT`,{tabId:e,projectId:t.id,projectNumber:t.number,applicationId:null});if(!n.success)throw Error(`RESTORE_PROJECT refused: ${n.error}`);ki.info(`pgm-496ade1c1d`,{tabId:e})},u=t=>{ki.error(`pgm-61ab57a774`,{tabId:e,error:t instanceof Error?t.message:String(t)}),i.show({id:`popup-project-switch`,variant:`error`,message:r(`popup.project.switchFailed`)})};return{question:a,busy:s,choose(e){if(e.id!==t){if(n!==null){o({target:e,run:n});return}l(e).catch(u)}},confirm(){a===null||s||(c(!0),l(a.target).catch(u).finally(()=>{c(!1),o(null)}))},cancel(){s||o(null)}}}function ji({user:e,header:t,back:n,strip:r,snapshot:i,projects:a,tabProject:o}){let{t:c}=F(),l=W(`enabled`),[u,d]=(0,H.useState)(!1),{state:f,tabId:p}=i,m=Ai({tabId:p,projectId:f.projectId,currentTestRun:f.currentTestRun}),h;switch(a.state){case`loading`:h=/* @__PURE__ */ (0,U.jsx)(vn,{});break;case`error`:h=/* @__PURE__ */ (0,U.jsx)(Mi,{children:/* @__PURE__ */ (0,U.jsx)(re,{icon:/* @__PURE__ */ (0,U.jsx)(jt,{"aria-hidden":`true`}),title:c(`popup.projects.failedTitle`),description:c(`popup.projects.failedText`),retry:{label:c(`common.retry`),onRetry:a.retry}})});break;case`ready`:{if(a.projects.length===0){h=/* @__PURE__ */ (0,U.jsx)(Mi,{children:/* @__PURE__ */ (0,U.jsx)(de,{icon:/* @__PURE__ */ (0,U.jsx)(Rt,{"aria-hidden":`true`}),title:c(`popup.projects.emptyTitle`),description:c(`popup.projects.emptyText`),action:/* @__PURE__ */ (0,U.jsx)(M,{icon:/* @__PURE__ */ (0,U.jsx)(It,{"aria-hidden":`true`}),onClick:()=>s(),children:c(`popup.projects.openWeb`)})})});break}let t=/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(Si,{tabId:p,projects:a.projects,tabProject:o,applicationId:f.applicationId,run:f.currentTestRun,onPick:m.choose,pickerOpen:u,onPickerOpenChange:d}),/* @__PURE__ */ (0,U.jsx)(Ei,{})]});h=o===null?t:/* @__PURE__ */ (0,U.jsx)(At,{user:e,project:{id:O(o.id),number:ie(o.number)},children:t});break}}let g=a.state===`ready`&&a.projects.length>0;return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:_(`flex min-h-0 flex-1 flex-col`,n?Dt:Ct),children:[t,/* @__PURE__ */ (0,U.jsxs)(gn,{className:g&&u?`min-h-90`:void 0,children:[g&&l===!1&&/* @__PURE__ */ (0,U.jsx)(Di,{}),r,h]}),/* @__PURE__ */ (0,U.jsx)(Oi,{projectSwitch:m,currentProjectName:o===null?null:o.name})]})}function Mi({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`grid min-h-84 content-center`,children:e})}function Ni(){let{data:e,loading:t,error:n,reload:r}=C(),i=(0,H.useMemo)(()=>new Map(e===void 0?[]:e.map(e=>[e.id,e])),[e]);return n===null?t||e===void 0?{state:`loading`}:{state:`ready`,projects:e,byId:i}:{state:`error`,error:n,retry:()=>void r()}}var Pi=V(`pgs-aea740cf56`);function Fi({windowId:e,revision:t,back:n,onBack:r,onOpenSettings:i}){let{t:a}=F();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col ${n?Dt:Ct}`,"data-testid":`popup-notification-feed`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-12 flex-none items-center gap-1.5 border-b border-stroke-light pr-3 pl-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(I,{relationship:`label`,content:a(`popup.settings.back`),placement:`bottom-start`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(Nt,{"aria-hidden":`true`}),onClick:r,autoFocus:!0,"data-testid":`popup-feed-back`})}),/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`m-0 mr-auto text-body-md font-semibold tracking-(--tracking-title) text-fg-primary`,children:a(`notifications.feed.title`)}),/* @__PURE__ */ (0,U.jsx)(I,{relationship:`label`,content:a(`notifications.feed.settings`),placement:`bottom-end`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(bt,{"aria-hidden":`true`}),onClick:i,"data-testid":`popup-feed-settings`})})]}),/* @__PURE__ */ (0,U.jsx)(_t,{host:`popup`,api:z.notifications,locale:A(),t:a,revision:t,logger:Pi,onOpenTarget:t=>St(t,e),onOpenSettings:i,onSeen:()=>Ot(`seen`)})]})}var Ii=V(`pgs-a3c52049ce`);function Li({windowId:e,waitingCount:t,revision:n,onOpenFeed:r}){let{t:i}=F();return/* @__PURE__ */ (0,U.jsx)(xt,{api:z.notifications,locale:A(),t:i,waitingCount:t,revision:n,logger:Ii,onOpenTarget:t=>St(t,e),onOpenFeed:r,onSeen:()=>Ot(`seen`)})}function Ri({value:e,onChange:t,labels:n,size:r,fullWidth:i,className:a}){return/* @__PURE__ */ (0,U.jsx)(g,{value:e,onValueChange:t,"aria-label":n.group,size:r,fullWidth:i,className:a,options:[{value:`light`,label:n.light,icon:/* @__PURE__ */ (0,U.jsx)(pn,{"aria-hidden":`true`})},{value:`dark`,label:n.dark,icon:/* @__PURE__ */ (0,U.jsx)(dn,{"aria-hidden":`true`})},{value:`system`,label:n.system,icon:/* @__PURE__ */ (0,U.jsx)(Mt,{"aria-hidden":`true`})}]})}function X({title:e,hint:t,children:n,"data-testid":r}){let{t:i}=F();return/* @__PURE__ */ (0,U.jsxs)(`section`,{className:`grid gap-1.5`,"data-testid":r,children:[/* @__PURE__ */ (0,U.jsxs)(`h3`,{className:`mx-0.5 my-0 flex items-center gap-1 text-xs font-medium text-fg-muted`,children:[e,t!==void 0&&/* @__PURE__ */ (0,U.jsx)(B,{name:i(`popup.site.more`,{about:e}),text:t,placement:`bottom-start`})]}),/* @__PURE__ */ (0,U.jsx)(nn,{kind:`block`,body:`rows`,density:`compact`,children:/* @__PURE__ */ (0,U.jsx)(b,{children:n})})]})}function Z({label:e,below:t,stacked:n=!1,alignStart:r=!1,children:i,"data-testid":a}){return/* @__PURE__ */ (0,U.jsx)(me,{title:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:e}),end:i,stacked:n,alignStart:r,"data-testid":a,children:t})}var zi={on:`bg-success shadow-(--glow-status-success)`,neutral:`bg-fg-muted`,warning:`bg-warning`,error:`bg-error`},Bi={on:`text-fg-muted`,neutral:`text-fg-muted`,warning:`text-fg-warning`,error:`text-fg-error`};function Q({tone:e,announce:t=!1,children:n,action:r,"data-testid":i}){return/* @__PURE__ */ (0,U.jsxs)(`span`,{role:e===`error`?`alert`:t?`status`:void 0,className:_(`flex items-start gap-1.75 text-xs leading-(--leading-caption)`,Bi[e]),"data-testid":i,children:[/* @__PURE__ */ (0,U.jsx)(`i`,{"aria-hidden":`true`,className:_(`mt-1.25 size-1.75 flex-none rounded-full`,zi[e])}),/* @__PURE__ */ (0,U.jsxs)(`span`,{children:[n,r]})]})}function Vi({onRetry:e}){let{t}=F();return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[` \u00B7 `,/* @__PURE__ */ (0,U.jsx)(M,{variant:`link`,size:`xs`,onClick:e,children:t(`common.retry`)})]})}var Hi=V(`pgs-6344bc6f0d`);function Ui(e,t){let n=d(),i=(0,H.useMemo)(()=>r({kind:`project`,projectId:e},`discovery-settings`),[e]),a=k({key:i,read:async()=>{let t=await L.call(`REFRESH_DISCOVERY_SETTINGS`,{projectId:e});if(!t.success)throw Error(`REFRESH_DISCOVERY_SETTINGS refused: ${t.error}`);if(t.discoverySettings===null)throw Error(`The service worker could not read the discovery settings`);return t.discoverySettings},freshness:`screen`}),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),[u,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(!1),h=(0,H.useRef)(null),g=(0,H.useRef)(!1),_=(0,H.useRef)(!1),v=(0,H.useRef)(null),y=(0,H.useCallback)(async()=>{if(!_.current){_.current=!0,l(!0),f(!1),m(!1);try{for(;h.current!==null||g.current;){let r=h.current;if(r!==null){try{await z.discovery.updateUserSettings(r)}catch(t){Hi.warn(`pgm-6e1d90d469`,{projectId:e,error:t instanceof Error?t.message:String(t)}),v.current=h.current,h.current=null,s(null),f(!0);continue}g.current=!0,h.current===r&&(h.current=null,s(null));continue}g.current=!1;let a=await Wi(e,t);a===null?m(!0):(n.write(i,a),m(!1))}}finally{_.current=!1,l(!1)}}},[n,i,e,t]),b=(0,H.useCallback)(e=>{h.current=e,s(e),y()},[y]),x=(0,H.useCallback)(()=>{let e=v.current;if(e===null)throw Error(`No failed discovery save to retry`);v.current=null,b(e)},[b]),S=(0,H.useCallback)(()=>{g.current=!0,y()},[y]);if(a.error!==null)return{status:`readFailed`,retry:()=>void a.reload()};if(p&&!c)return{status:`readFailed`,retry:S};let C=a.data;return C===void 0?{status:`loading`}:{status:`ready`,settings:C,checked:o===null?C.userEnabled:o,saving:c,saveFailed:u,toggle:b,retrySave:x}}async function Wi(e,t){let n=await L.call(`REFRESH_DISCOVERY_SETTINGS`,{tabId:t,projectId:e}).catch(t=>(Hi.warn(`pgm-8a2d41a868`,{projectId:e,error:t instanceof Error?t.message:String(t)}),null));return n===null?null:n.success?(n.discoverySettings===null&&Hi.warn(`pgm-842d0b7de2`,{projectId:e}),n.discoverySettings):(Hi.warn(`pgm-a943e9be7d`,{projectId:e,error:n.error}),null)}function Gi(e){var t;return((t=e.disabledReasons)==null?void 0:t.includes(`company_disabled`))===!0||!e.companyEnabled}function Ki(e){return e.gatingModel===`company+user+project`&&e.projectEnabled===!1}var $=`popup-discovery-status`;function qi({tabId:e,project:t}){let{t:n}=F();return t===void 0?/* @__PURE__ */ (0,U.jsx)(Zi,{status:/* @__PURE__ */ (0,U.jsx)(Yi,{}),control:/* @__PURE__ */ (0,U.jsx)(Xi,{})}):t===null?/* @__PURE__ */ (0,U.jsx)(Zi,{status:/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.noProject`)}),control:null}):/* @__PURE__ */ (0,U.jsx)(Ji,{tabId:e,project:t})}function Ji({tabId:e,project:t}){let{t:n}=F(),r=Ui(O(t.id),e),i,a=null;switch(r.status){case`loading`:i=/* @__PURE__ */ (0,U.jsx)(Yi,{}),a=/* @__PURE__ */ (0,U.jsx)(Xi,{});break;case`readFailed`:i=/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(Vi,{onRetry:r.retry}),children:n(`popup.settings.discoveryStatus.readFailed`)});break;case`ready`:{let{settings:e}=r;i=r.saving?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.saving`)}):r.saveFailed?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(Vi,{onRetry:r.retrySave}),children:n(`popup.settings.discoveryStatus.saveFailed`)}):Gi(e)?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`warning`,children:n(`popup.settings.discoveryStatus.companyOff`)}):Ki(e)?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`warning`,children:n(`popup.settings.discoveryStatus.projectOff`,{project:t.name})}):e.effectiveEnabled?/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`on`,children:n(`popup.settings.discoveryStatus.on`,{project:t.name})}):/* @__PURE__ */ (0,U.jsx)(Q,{"data-testid":$,tone:`neutral`,children:n(`popup.settings.discoveryStatus.off`)}),a=/* @__PURE__ */ (0,U.jsx)(o,{"aria-label":n(`popup.settings.discovery`),checked:r.checked,onChange:r.toggle,"data-testid":`popup-discovery-toggle`});break}}return/* @__PURE__ */ (0,U.jsx)(Zi,{status:i,control:a})}function Yi(){return/* @__PURE__ */ (0,U.jsx)(P,{className:`mt-1 h-3 w-40`})}function Xi(){return/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5 w-9 rounded-full`})}function Zi({status:e,control:t}){let{t:n}=F();return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[n(`popup.settings.discovery`),/* @__PURE__ */ (0,U.jsx)(B,{name:n(`popup.site.more`,{about:n(`popup.settings.discovery`)}),text:n(`popup.settings.discoveryHint`),placement:`bottom-start`})]}),below:e,alignStart:!0,"data-testid":`popup-discovery`,children:t})}function Qi({children:e}){return/* @__PURE__ */ (0,U.jsx)(`kbd`,{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.75 font-sans text-(length:--text-micro) leading-none font-medium whitespace-nowrap text-fg-muted shadow-[inset_0_0_0_1px_var(--color-border-hairline)]`,children:e})}var $i=/* @__PURE__ */ new Set([`Control`,`Alt`,`Shift`,`Meta`]);function ea(e){if($i.has(e.key))return null;let t=[];return(e.ctrlKey||e.metaKey)&&t.push(`Ctrl`),e.altKey&&t.push(`Alt`),e.shiftKey&&t.push(`Shift`),e.key===` `?t.push(`Space`):t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join(`+`)}function ta(){let{t:e}=F(),t=W(`selectionHotkey`),n=G(),[r,i]=(0,H.useState)(!1);return t===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-(--control-height-sm) w-12 rounded-(--input-radius)`}):/* @__PURE__ */ (0,U.jsx)(T,{size:`sm`,active:r,"aria-label":e(`popup.settings.hotkeyName`,{hotkey:t}),onClick:()=>i(!0),onBlur:()=>i(!1),onKeyDown:e=>{if(!r)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=ea(e);t!==null&&(i(!1),n(`selectionHotkey`,t))},"data-testid":`popup-hotkey`,children:r?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`text-xs text-(--color-primary-text) animate-pulse-dot`,children:e(`popup.settings.hotkeyCapture`)}):/* @__PURE__ */ (0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:t.split(`+`).map((e,t)=>/* @__PURE__ */ (0,U.jsx)(Qi,{children:e},`${e}-${t}`))})})}function na(e,t){return t?`element`:e?`window`:`off`}function ra(e){return{isolationWindow:e===`window`,isolationElement:e===`element`}}var ia=Promise.resolve();function aa(e){let t=()=>Ze(ra(e)),n=ia.then(t,t);return ia=n,n}var oa=V(`pgs-fed3bb0e75`),sa={managed:null,company:`popup.settings.modelKeyCompany`,personal:`popup.settings.modelKeyPersonal`};function ca(){let{t:e}=F(),t=x(),n=G(),i=W(`modelPick`),a=(0,H.useMemo)(()=>zt({http:pt(),logger:oa}),[]),o=st(),{data:s,error:c,reload:l}=k({key:r(o,`chat-model-capabilities`),read:()=>a.load(),freshness:`screen`});if((0,H.useEffect)(()=>{c!==null&&(oa.error(`pgm-9665648376`,{error:c.message}),t.show({id:`popup-models`,variant:`error`,message:e(`popup.settings.modelLoadFailed`),action:{label:e(`common.retry`),onAction:()=>void l()}}))},[c,l,e,t]),i===void 0||s===void 0&&c===null)return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.model`),children:/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8 w-37.5 rounded-md`})});let u=s===void 0?[]:s.groups,d=s===void 0||i===null?null:kt(s,i),f=s===void 0?null:Lt(s,d,null);return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.model`),"data-testid":`popup-model`,children:/* @__PURE__ */ (0,U.jsx)(Xe,{size:`sm`,"aria-label":e(`popup.settings.model`),placeholder:e(`popup.settings.modelNone`),value:f===null?null:f.model.selectionId,onValueChange:r=>{for(let i of u){let a=i.models.find(e=>e.selectionId===r);if(a!==void 0){n(`modelPick`,{keySource:i.source,modelId:a.id}),z.aiSettings.updateUser({selectedProvider:i.source,selectedModel:a.id}).catch(n=>{oa.error(`pgm-573d3af0bc`,{error:n instanceof Error?n.message:String(n)}),t.show({id:`popup-model-save`,variant:`error`,message:e(`popup.settings.saveFailed`)})});return}}throw Error(`The AI model Select picked a row it did not render: ${r}`)},className:`w-37.5`,options:u.flatMap(t=>t.models.map(n=>{let r=sa[t.source];return{value:n.selectionId,label:r===null?n.name:`${n.name} \u00B7 ${e(r)}`,disabled:!Pt(n)}}))})})}var la=V(`pgs-cdc66fba2a`),ua={permissions:[`notifications`]};function da(e){return e instanceof Error?e.message:String(e)}function fa(){return[chrome.permissions.onAdded,chrome.permissions.onRemoved]}function pa(e){var t;return((t=e.permissions)==null?void 0:t.includes(`notifications`))===!0}function ma(){let{t:e}=F(),[t,n]=(0,H.useState)(`reading`),r=(0,H.useRef)(!0),i=(0,H.useCallback)(()=>{chrome.permissions.contains(ua).then(e=>{r.current&&n(t=>e?`on`:t===`denied`?`denied`:`off`)},e=>{la.error(`pgm-cbfb085fbb`,{error:da(e)}),r.current&&n(`readFailed`)})},[]);(0,H.useEffect)(()=>{r.current=!0;let e=e=>{pa(e)&&i()},t=fa();for(let n of t)n.addListener(e);return i(),()=>{r.current=!1;for(let n of t)n.removeListener(e)}},[i]);let a=()=>{n(`reading`),i()},s=e=>{if(e){n(`asking`),chrome.permissions.request(ua).then(e=>n(e?`on`:`denied`),e=>{la.error(`pgm-67efc28caa`,{error:da(e)}),n(`off`)});return}chrome.permissions.remove(ua).then(e=>{e||la.error(`pgm-2cbfb59188`),n(e?`off`:`on`)},e=>{la.error(`pgm-ac8845b9f5`,{error:da(e)})})},c=e(`popup.settings.osNotifications`);return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[c,/* @__PURE__ */ (0,U.jsx)(B,{name:e(`popup.site.more`,{about:c}),text:e(`popup.settings.osNotificationsHint`),placement:`bottom-start`})]}),below:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(`small`,{className:`text-xs leading-(--leading-caption) text-fg-muted`,children:e(`popup.settings.osNotificationsWhen`)}),t===`denied`&&/* @__PURE__ */ (0,U.jsx)(Q,{tone:`neutral`,announce:!0,"data-testid":`popup-os-notifications-denied`,children:e(`popup.settings.osNotificationsDenied`)}),t===`readFailed`&&/* @__PURE__ */ (0,U.jsx)(Q,{tone:`error`,action:/* @__PURE__ */ (0,U.jsx)(Vi,{onRetry:a}),"data-testid":`popup-os-notifications-read-failed`,children:e(`popup.settings.osNotificationsReadFailed`)})]}),alignStart:!0,"data-testid":`popup-os-notifications`,children:t===`reading`?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5 w-9 rounded-full`}):t===`readFailed`?null:/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-fg-muted`,children:[t===`asking`&&/* @__PURE__ */ (0,U.jsx)(_e,{}),/* @__PURE__ */ (0,U.jsx)(o,{"aria-label":c,checked:t===`on`,onChange:s,"data-testid":`popup-os-notifications-switch`})]})})}var ha=V(`pgs-7fed4be7cb`);function ga(){let{t:e}=F(),t=W(`notificationsEnabled`),n=G(),r=e(`popup.settings.notifications`);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(X,{title:e(`popup.settings.groups.notifications`),hint:e(`popup.settings.groups.notificationsHint`),"data-testid":`popup-notification-groups`,children:/* @__PURE__ */ (0,U.jsx)(Tt,{api:z.notifications,locale:A(),t:e,logger:ha,onChanged:()=>Ot(`group_changed`)})}),/* @__PURE__ */ (0,U.jsxs)(X,{title:e(`popup.settings.groups.thisBrowser`),children:[/* @__PURE__ */ (0,U.jsx)(ma,{}),/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[r,/* @__PURE__ */ (0,U.jsx)(B,{name:e(`popup.site.more`,{about:r}),text:e(`popup.settings.notificationsHint`),placement:`bottom-start`})]}),children:t===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-5 w-9 rounded-full`}):/* @__PURE__ */ (0,U.jsx)(o,{"aria-label":r,checked:t,onChange:e=>n(`notificationsEnabled`,e),"data-testid":`popup-notifications`})})]})]})}var _a=/^\d+$/;function va(e){let t=e.trim();return _a.test(t)?Number(t)>qe?`tooLong`:null:`notWholeNumber`}function ya(){let{t:e,i18n:n}=F(),r=W(`autoplayStepPauseMs`),i=G(),[a,o]=(0,H.useState)(null),s=a===null?null:va(a),c=s!==null,l=()=>{if(a===null||c)return;let e=Number(a.trim());o(null),e!==r&&i(`autoplayStepPauseMs`,e)};return/* @__PURE__ */ (0,U.jsx)(Z,{label:e(`popup.settings.pause`),alignStart:!0,below:c?/* @__PURE__ */ (0,U.jsxs)(`span`,{role:`alert`,className:`mt-0.5 flex items-start gap-1.5 text-xs leading-(--leading-caption) text-fg-error`,children:[/* @__PURE__ */ (0,U.jsx)(t,{"aria-hidden":`true`,className:`mt-px size-3.5 shrink-0`}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:s===`tooLong`?e(`popup.settings.pauseTooLong`,{max:new Intl.NumberFormat(n.language).format(qe)}):e(`popup.settings.pauseInvalid`)})]}):void 0,"data-testid":`popup-step-pause`,children:r===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8 w-26 rounded-md`}):/* @__PURE__ */ (0,U.jsx)(Ye,{size:`sm`,inputMode:`numeric`,"aria-label":e(`popup.settings.pauseName`),value:a??String(r),onValueChange:o,onBlur:l,onKeyDown:e=>{e.key===`Enter`&&l()},invalid:c,trailing:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e(`popup.settings.ms`)}),className:`w-26 [&_input]:text-right [&_input]:tabular-nums`})})}function ba({tabId:e,project:t,onBack:n}){let{t:r}=F(),i=W(`theme`),a=G();return/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col ${Ct}`,"data-testid":`popup-settings`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-12 flex-none items-center gap-1.5 border-b border-stroke-light pr-3 pl-1.5`,children:[/* @__PURE__ */ (0,U.jsx)(I,{relationship:`label`,content:r(`popup.settings.back`),placement:`bottom-start`,children:/* @__PURE__ */ (0,U.jsx)(E,{icon:/* @__PURE__ */ (0,U.jsx)(Nt,{"aria-hidden":`true`}),onClick:n,autoFocus:!0,"data-testid":`popup-settings-back`})}),/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`m-0 text-body-md font-semibold tracking-(--tracking-title) text-fg-primary`,children:r(`popup.settings.title`)})]}),/* @__PURE__ */ (0,U.jsxs)(gn,{children:[/* @__PURE__ */ (0,U.jsx)(ga,{}),/* @__PURE__ */ (0,U.jsxs)(X,{title:r(`popup.settings.groups.view`),children:[/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.theme`),stacked:!0,children:i===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8.5 w-full rounded-md`}):/* @__PURE__ */ (0,U.jsx)(Ri,{value:i,onChange:e=>a(`theme`,e),labels:{group:r(`popup.settings.theme`),light:r(`popup.settings.themeLight`),dark:r(`popup.settings.themeDark`),system:r(`popup.settings.themeSystem`)},fullWidth:!0})}),/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.language`),stacked:!0,children:/* @__PURE__ */ (0,U.jsx)(jn,{fullWidth:!0})})]}),/* @__PURE__ */ (0,U.jsxs)(X,{title:r(`popup.settings.groups.recording`),children:[/* @__PURE__ */ (0,U.jsx)(Z,{label:r(`popup.settings.hotkey`),children:/* @__PURE__ */ (0,U.jsx)(ta,{})}),/* @__PURE__ */ (0,U.jsx)(ya,{}),/* @__PURE__ */ (0,U.jsx)(xa,{})]}),/* @__PURE__ */ (0,U.jsx)(X,{title:r(`popup.settings.groups.assistant`),children:/* @__PURE__ */ (0,U.jsx)(ca,{})}),/* @__PURE__ */ (0,U.jsx)(X,{title:r(`popup.settings.groups.pages`),children:/* @__PURE__ */ (0,U.jsx)(qi,{tabId:e,project:t},t==null?``:t.id)})]})]})}function xa(){let{t:e}=F(),t=An(),n=W(`isolationWindow`),r=W(`isolationElement`),i=n=>{t({id:`popup-isolation`,run:()=>aa(n),log:{message:`Input isolation was not stored`,context:{isolation:n}},message:e(`popup.settings.saveFailed`)})},a=n===void 0||r===void 0?void 0:na(n,r);return/* @__PURE__ */ (0,U.jsx)(Z,{label:/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[e(`popup.settings.isolation`),/* @__PURE__ */ (0,U.jsx)(B,{name:e(`popup.site.more`,{about:e(`popup.settings.isolation`)}),text:e(`popup.settings.isolationHint`),placement:`bottom-start`})]}),stacked:!0,"data-testid":`popup-isolation`,children:a===void 0?/* @__PURE__ */ (0,U.jsx)(P,{className:`h-8.5 w-full rounded-md`}):/* @__PURE__ */ (0,U.jsx)(g,{value:a,onValueChange:i,"aria-label":e(`popup.settings.isolation`),fullWidth:!0,options:[{value:`off`,label:e(`popup.settings.isolationOff`)},{value:`window`,label:e(`popup.settings.isolationWindow`)},{value:`element`,label:e(`popup.settings.isolationElement`)}]})})}var Sa=V(`pgs-b5906754fa`);function Ca({user:e}){let t=j(),n=Ni(),r=W(`enabled`),i=vt(e.id),a=Et(),[o,s]=(0,H.useState)({name:`main`,back:!1});if((0,H.useEffect)(()=>{Ot(`surface_opened`)},[]),a===void 0)return/* @__PURE__ */ (0,U.jsx)(_n,{});let c=n.state===`ready`?wa(t,n.byId):null,l=i.status===`ready`?i.snapshot:null,u=i.status===`ready`?i.revision:0,d=()=>s({name:`settings`,back:!1}),f=()=>s({name:`feed`,back:!1}),p=()=>s({name:`main`,back:!0}),m=/* @__PURE__ */ (0,U.jsx)(In,{user:e,onOpenSettings:d,notificationCounts:l,onOpenNotifications:f}),h=r===!0&&l!==null?/* @__PURE__ */ (0,U.jsx)(Li,{windowId:a,waitingCount:l.waitingCount,revision:u,onOpenFeed:f}):null;switch(o.name){case`settings`:{let r=/* @__PURE__ */ (0,U.jsx)(ba,{tabId:t.tabId,project:n.state===`loading`?void 0:c,onBack:p});return c===null?r:/* @__PURE__ */ (0,U.jsx)(At,{user:e,project:{id:O(c.id),number:ie(c.number)},children:r})}case`feed`:return/* @__PURE__ */ (0,U.jsx)(Fi,{windowId:a,revision:u,back:o.back,onBack:p,onOpenSettings:d});case`main`:return/* @__PURE__ */ (0,U.jsx)(ji,{user:e,header:m,back:o.back,strip:h,snapshot:t,projects:n,tabProject:c})}}function wa(e,t){let{projectId:n}=e.state;if(n===null)return null;let r=t.get(n);return r===void 0?(Sa.warn(`pgm-cb1ec83f44`,{tabId:e.tabId}),null):r}function Ta(){return/* @__PURE__ */ (0,U.jsx)(D,{loading:/* @__PURE__ */ (0,U.jsx)(_n,{}),signedOut:/* @__PURE__ */ (0,U.jsx)(Mn,{}),children:e=>/* @__PURE__ */ (0,U.jsx)(wn,{user:e,children:/* @__PURE__ */ (0,U.jsx)(H.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(_n,{}),children:/* @__PURE__ */ (0,U.jsx)(Ca,{user:e})})})})}var Ea=V(`pgs-2e3f74b175`),Da=document.getElementById(`popup-root`);Da===null?Ea.error(`pgm-f13077b9ed`):ot({surface:`popup`,root:Da,followedTab:yt(),editorNavigation:it(`popup`),render:()=>/* @__PURE__ */ (0,U.jsx)(Ta,{})}).catch(e=>{Ea.error(`pgm-f4cc990f36`,e)});
|
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
<title data-i18n="sidepanel.title">Progon AI Assistant</title>
|
|
7
7
|
<script type="module" crossorigin src="../sidepanel/sidepanel.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="../chunks/shared-hePW80VL.js">
|
|
9
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="../chunks/shared-
|
|
17
|
-
<link rel="
|
|
18
|
-
<link rel="stylesheet" crossorigin href="../chunks/shared-
|
|
9
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C05lJ8nQ.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C5qHe-zg.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-BBv6J4oP.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-CNYvsh0O.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-Dbbjj01C.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-BAuQl9-k.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-B5dGSIVr.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-C0apd10a.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="../chunks/shared-BROt3HHj.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="../chunks/shared-BQbdfGz-.css">
|
|
19
|
+
<link rel="stylesheet" crossorigin href="../chunks/shared-CdFf-X4Y.css">
|
|
19
20
|
<link rel="stylesheet" crossorigin href="../sidepanel/sidepanel.css">
|
|
20
21
|
</head>
|
|
21
22
|
<body>
|