xaq-cli 0.0.0 → 0.1.0-nightly.71
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/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/admin-5gThRwgj.js +162 -0
- package/dist/admin-5gThRwgj.js.map +1 -0
- package/dist/admin-Btrm8mCd.js +218 -0
- package/dist/admin-Btrm8mCd.js.map +1 -0
- package/dist/admin-CWofnT_Q.js +2 -0
- package/dist/api-BFpElwqK.js +89 -0
- package/dist/api-BFpElwqK.js.map +1 -0
- package/dist/audit-BB7jK9Z5.js +2 -0
- package/dist/audit-BVYknW2i.js +79 -0
- package/dist/audit-BVYknW2i.js.map +1 -0
- package/dist/auth-CXmBdMqw.js +2 -0
- package/dist/auth-D-GmwNv-.js +550 -0
- package/dist/auth-D-GmwNv-.js.map +1 -0
- package/dist/brand--ZB8jTn1.js +32 -0
- package/dist/brand--ZB8jTn1.js.map +1 -0
- package/dist/bus-Cz0flS37.js +12 -0
- package/dist/bus-Cz0flS37.js.map +1 -0
- package/dist/bus-OKIGut72.js +2 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands-BNVLjYXA.js +167 -0
- package/dist/commands-BNVLjYXA.js.map +1 -0
- package/dist/commands-CdA6-WE7.js +112 -0
- package/dist/commands-CdA6-WE7.js.map +1 -0
- package/dist/config-C9XmYZWO.js +94 -0
- package/dist/config-C9XmYZWO.js.map +1 -0
- package/dist/config-CNVi0v5t.js +2 -0
- package/dist/connect-TtJ9n0Rw.js +362 -0
- package/dist/connect-TtJ9n0Rw.js.map +1 -0
- package/dist/content-C1lKMxFS.js +1170 -0
- package/dist/content-C1lKMxFS.js.map +1 -0
- package/dist/content-worker.js +28 -0
- package/dist/content-worker.js.map +1 -0
- package/dist/crypto-fv2fj3S8.js +75 -0
- package/dist/crypto-fv2fj3S8.js.map +1 -0
- package/dist/db-BEUEUPyP.js +561 -0
- package/dist/db-BEUEUPyP.js.map +1 -0
- package/dist/db-Q5BQuwga.js +2 -0
- package/dist/errors-FbMS3QBo.js +39 -0
- package/dist/errors-FbMS3QBo.js.map +1 -0
- package/dist/filter-Ck6OMxvu.js +158 -0
- package/dist/filter-Ck6OMxvu.js.map +1 -0
- package/dist/hermes-CKyzt1mH.js +3 -0
- package/dist/hermes-DHnDTYJp.js +1023 -0
- package/dist/hermes-DHnDTYJp.js.map +1 -0
- package/dist/import-DsN5NZT3.js +910 -0
- package/dist/import-DsN5NZT3.js.map +1 -0
- package/dist/instance-CwWbFbJ8.js +2 -0
- package/dist/instance-Dj9TpJB2.js +195 -0
- package/dist/instance-Dj9TpJB2.js.map +1 -0
- package/dist/listen-B9iO7HgQ.js +1568 -0
- package/dist/listen-B9iO7HgQ.js.map +1 -0
- package/dist/listen-CXVKG9XD.js +2 -0
- package/dist/manage-Bo6COB4p.js +477 -0
- package/dist/manage-Bo6COB4p.js.map +1 -0
- package/dist/manage-DoXqvjnU.js +2 -0
- package/dist/mcpheader-B8c5YO1B.js +2 -0
- package/dist/mcpheader-C9H4vudu.js +185 -0
- package/dist/mcpheader-C9H4vudu.js.map +1 -0
- package/dist/mcpsetup-BnHudwpq.js +2 -0
- package/dist/mcpsetup-DXXo2qjf.js +1053 -0
- package/dist/mcpsetup-DXXo2qjf.js.map +1 -0
- package/dist/node-check-CjTk6VNL.js +24 -0
- package/dist/node-check-CjTk6VNL.js.map +1 -0
- package/dist/paths-d-C2kdjo.js +2 -0
- package/dist/paths-yzOKD6ow.js +46 -0
- package/dist/paths-yzOKD6ow.js.map +1 -0
- package/dist/profile-CcMZ4hn7.js +2 -0
- package/dist/profile-NmMKAczz.js +222 -0
- package/dist/profile-NmMKAczz.js.map +1 -0
- package/dist/prompt-CKMQx_MJ.js +114 -0
- package/dist/prompt-CKMQx_MJ.js.map +1 -0
- package/dist/recipes-C7TIDlRj.js +3 -0
- package/dist/recipes-DG_-doGq.js +314 -0
- package/dist/recipes-DG_-doGq.js.map +1 -0
- package/dist/send-Dk-t8ia-.js +108 -0
- package/dist/send-Dk-t8ia-.js.map +1 -0
- package/dist/server-CDqDp1q3.js +20640 -0
- package/dist/server-CDqDp1q3.js.map +1 -0
- package/dist/service-BVn3soZZ.js +766 -0
- package/dist/service-BVn3soZZ.js.map +1 -0
- package/dist/service-BaWGPmSd.js +2 -0
- package/dist/service-C7jfo-Ex.js +457 -0
- package/dist/service-C7jfo-Ex.js.map +1 -0
- package/dist/service-DxDyKDQ-.js +2 -0
- package/dist/settings-B5qSHxRM.js +134 -0
- package/dist/settings-B5qSHxRM.js.map +1 -0
- package/dist/settings-DQvZaMN1.js +2 -0
- package/dist/setup-token-CwuSzfLK.js +48 -0
- package/dist/setup-token-CwuSzfLK.js.map +1 -0
- package/dist/skill/SKILL.md +445 -0
- package/dist/skill-1UQj3qgW.js +69 -0
- package/dist/skill-1UQj3qgW.js.map +1 -0
- package/dist/skill-pelq18JQ.js +2 -0
- package/dist/ssrf-BlVpGZ7C.js +181 -0
- package/dist/ssrf-BlVpGZ7C.js.map +1 -0
- package/dist/types-BhJDbSzE.js +135 -0
- package/dist/types-BhJDbSzE.js.map +1 -0
- package/dist/ui-B8Sd4Y7Y.js +81 -0
- package/dist/ui-B8Sd4Y7Y.js.map +1 -0
- package/dist/urls-Dp8pBGMU.js +2 -0
- package/dist/urls-U_LfYV61.js +27 -0
- package/dist/urls-U_LfYV61.js.map +1 -0
- package/dist/version-BxH7OuWD.js +20 -0
- package/dist/version-BxH7OuWD.js.map +1 -0
- package/dist/web/assets/_agentId-DonOCOlC.js +1 -0
- package/dist/web/assets/_app-B7t5lEia.js +1 -0
- package/dist/web/assets/_app-DMTGqYpM.js +65 -0
- package/dist/web/assets/_connectionId-DR5vFXOg.js +1 -0
- package/dist/web/assets/_webhookId-LfUlsULp.js +1 -0
- package/dist/web/assets/account-status-CEszs13C.js +1 -0
- package/dist/web/assets/accounts-5m7aiXuZ.js +1 -0
- package/dist/web/assets/accounts-list-YfJzThZa.js +1 -0
- package/dist/web/assets/activity-DOIe7SAg.js +1 -0
- package/dist/web/assets/add-connection-C8JR-13R.js +1 -0
- package/dist/web/assets/agent-create-form-CPxnPYH4.js +1 -0
- package/dist/web/assets/agents-B2Qj5KxT.js +1 -0
- package/dist/web/assets/approvals-BGaVaoFy.js +1 -0
- package/dist/web/assets/approve._id-BLrQnzPM.js +1 -0
- package/dist/web/assets/arrow-left-DZVAXoKj.js +1 -0
- package/dist/web/assets/arrow-right-C2zcqRr2.js +1 -0
- package/dist/web/assets/attention-gO9Nw5uW.js +1 -0
- package/dist/web/assets/audit-BPXXre8S.js +1 -0
- package/dist/web/assets/audit-bits-CGyIprzK.js +1 -0
- package/dist/web/assets/bell-ring-ig3zn1iS.js +1 -0
- package/dist/web/assets/bot-Zk76q_39.js +1 -0
- package/dist/web/assets/calendar-notice-DsCfq3VJ.js +1 -0
- package/dist/web/assets/calendar-plus-Cycfkk0y.js +1 -0
- package/dist/web/assets/calendar-setup-Pn61Wj1n.js +2 -0
- package/dist/web/assets/card-GSO5o-Ug.js +1 -0
- package/dist/web/assets/check-check-Ds1bPIGv.js +1 -0
- package/dist/web/assets/checkbox-B937U-Fd.js +1 -0
- package/dist/web/assets/chevron-right-Cqh4mDk1.js +1 -0
- package/dist/web/assets/chips-input-2xWDofmE.js +1 -0
- package/dist/web/assets/choice-cards-CgAIqBGX.js +1 -0
- package/dist/web/assets/circle-x-DcU-0zVh.js +1 -0
- package/dist/web/assets/command-khhto70y.js +1 -0
- package/dist/web/assets/common-BPZV8TFb.js +1 -0
- package/dist/web/assets/connect-agent-guide-CJdw31p2.js +1 -0
- package/dist/web/assets/connect-host-lr2c3xWh.js +6 -0
- package/dist/web/assets/connection-row-DYx_5o0c.js +1 -0
- package/dist/web/assets/connections-C4NOFb5R.js +1 -0
- package/dist/web/assets/data-table-kW1pkRB5.js +1 -0
- package/dist/web/assets/empty-DzTDioBP.js +1 -0
- package/dist/web/assets/events-C9zJnPKK.js +1 -0
- package/dist/web/assets/eye-B9gT1QSq.js +1 -0
- package/dist/web/assets/eye-off-Diktqz_g.js +1 -0
- package/dist/web/assets/field-C6ejurju.js +1 -0
- package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/web/assets/get-started-C38bq1gZ.js +2 -0
- package/dist/web/assets/hidden-chars-Dr9TxfvF.js +1 -0
- package/dist/web/assets/index-DGzo3kGh.js +11 -0
- package/dist/web/assets/index-zKOCQLGX.css +2 -0
- package/dist/web/assets/input-CWwJgozn.js +1 -0
- package/dist/web/assets/input-group-HG8OXcJ4.js +1 -0
- package/dist/web/assets/label-multi-select-sH8mllw8.js +1 -0
- package/dist/web/assets/labels-B5UqVwFo.js +1 -0
- package/dist/web/assets/laptop-BxJ4Nbj7.js +1 -0
- package/dist/web/assets/last-call-D-O5O94z.js +1 -0
- package/dist/web/assets/listener-handled-HNCuVrQ7.js +1 -0
- package/dist/web/assets/login-DaeKclcf.js +1 -0
- package/dist/web/assets/mail-C5fm2pTC.js +1 -0
- package/dist/web/assets/mcp-call-UoOTPFyh.js +1 -0
- package/dist/web/assets/mcp-call-card-Cr-OEDX2.js +3 -0
- package/dist/web/assets/message-square-quote-se8Bf3RP.js +1 -0
- package/dist/web/assets/mutations-CLPqJ6cj.js +1 -0
- package/dist/web/assets/network-igNw0VVx.js +1 -0
- package/dist/web/assets/pairing-XjuaVr2u.js +1 -0
- package/dist/web/assets/pairing-notifier-KPzOEZSO.js +1 -0
- package/dist/web/assets/paperclip-znS4iTrg.js +1 -0
- package/dist/web/assets/password-input-DV3aqcNf.js +1 -0
- package/dist/web/assets/pause-o-dK3khK.js +1 -0
- package/dist/web/assets/pencil-DkPFAhEq.js +1 -0
- package/dist/web/assets/play-DvCHND93.js +1 -0
- package/dist/web/assets/plug-CXAniEiR.js +1 -0
- package/dist/web/assets/plug-zap-BwR-l5wb.js +1 -0
- package/dist/web/assets/plus-B_TUslu3.js +1 -0
- package/dist/web/assets/preload-helper-Cc_aKyUb.js +1 -0
- package/dist/web/assets/public-url-rF2Xjyel.js +1 -0
- package/dist/web/assets/queries-Cv3nXx0U.js +42 -0
- package/dist/web/assets/refresh-cw-Ch5FNrby.js +1 -0
- package/dist/web/assets/revealed-keys-C_9NtJPY.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/rotate-ccw-B-mzPDk0.js +1 -0
- package/dist/web/assets/search-CTVKGomS.js +1 -0
- package/dist/web/assets/select-Bb806bpq.js +1 -0
- package/dist/web/assets/send-DuMVuYs1.js +1 -0
- package/dist/web/assets/settings-BWauhfFf.js +1 -0
- package/dist/web/assets/setup-B7bNKQOp.js +1 -0
- package/dist/web/assets/sheet-CYPwpUsH.js +1 -0
- package/dist/web/assets/shield-alert-CSYB-ThV.js +1 -0
- package/dist/web/assets/shield-check-BulpsYqK.js +1 -0
- package/dist/web/assets/sparkles-CUTiob4K.js +1 -0
- package/dist/web/assets/stamp-BNXUGNa3.js +1 -0
- package/dist/web/assets/step-url-51aMNak-.js +1 -0
- package/dist/web/assets/stream-Du7fY5_Y.js +1 -0
- package/dist/web/assets/tag-I5_-1jFL.js +1 -0
- package/dist/web/assets/terminal-BvxDFTJc.js +1 -0
- package/dist/web/assets/test-email-button-DYi7V_6X.js +1 -0
- package/dist/web/assets/toggle-group-Bdo1gmQ1.js +1 -0
- package/dist/web/assets/trash-Ci0aICEl.js +1 -0
- package/dist/web/assets/use-delivery-speed-BBh7W2q6.js +1 -0
- package/dist/web/assets/use-label-names-BXicesnP.js +1 -0
- package/dist/web/assets/use-sign-out-CPrY_oVO.js +1 -0
- package/dist/web/assets/useInfiniteQuery-DJLIM8yJ.js +1 -0
- package/dist/web/assets/useQuery-MrTwwNy5.js +1 -0
- package/dist/web/assets/useRouterState-D4OBK8l5.js +1 -0
- package/dist/web/assets/webhook-DjeeZiNC.js +1 -0
- package/dist/web/assets/webhook-bits-jw-y2D3u.js +1 -0
- package/dist/web/assets/webhook-sheet-B8h0skDe.js +34 -0
- package/dist/web/assets/webhooks-Cfsdpoyd.js +1 -0
- package/dist/web/assets/x-MF2TZ9aG.js +1 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +27 -0
- package/package.json +98 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,Ht as n,N as r,T as i,Ut as a,Wt as o,_t as s,at as c,bt as l,ft as u,gt as d,it as f,n as p,t as m,w as h,yt as g}from"./queries-Cv3nXx0U.js";import{t as _}from"./useQuery-MrTwwNy5.js";import{t as v}from"./useRouterState-D4OBK8l5.js";import{t as ee}from"./arrow-left-DZVAXoKj.js";import{t as y}from"./arrow-right-C2zcqRr2.js";import{i as b,n as x,o as te,s as S,t as C}from"./select-Bb806bpq.js";import{t as w}from"./chevron-right-Cqh4mDk1.js";import{c as ne,l as re,r as T,t as E,u as ie}from"./card-GSO5o-Ug.js";import{R as D,a as O,i as ae,n as oe,p as se,r as ce,t as le}from"./common-BPZV8TFb.js";import{t as k}from"./eye-B9gT1QSq.js";import{t as ue}from"./refresh-cw-Ch5FNrby.js";import{t as A}from"./terminal-BvxDFTJc.js";import{t as j}from"./checkbox-B937U-Fd.js";import{a as M,l as de,n as N,r as fe,t as P}from"./field-C6ejurju.js";import{n as F,t as pe}from"./toggle-group-Bdo1gmQ1.js";import{Dt as me,Et as I,Ot as he,S as L,T as R,d as z,f as B,kt as ge,l as V,u as H,w as _e,x as U}from"./index-DGzo3kGh.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./mutations-CLPqJ6cj.js";import{n as we}from"./stream-Du7fY5_Y.js";import{n as Te,t as Ee}from"./input-CWwJgozn.js";var De={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};De.node;var Oe=s(De),ke={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};ke.node;var Ae=s(ke),W=e(o(),1),G=a(),je=Object.defineProperty,K=(e,t)=>je(e,`name`,{value:t,configurable:!0}),Me=`Progress`,Ne=100,[Pe,Fe]=f(Me),[Ie,Le]=Pe(Me),Re=W.forwardRef(K(function(e,t){let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=Ve,...o}=e;(i||i===0)&&!Ue(i)&&console.error(Ge(`${i}`,`Progress`));let s=Ue(i)?i:Ne;r!==null&&!We(r,s)&&console.error(Ke(`${r}`,`Progress`));let l=We(r,s)?r:null,u=q(l)?a(l,s):void 0;return(0,G.jsx)(Ie,{scope:n,value:l,max:s,children:(0,G.jsx)(c.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":q(l)?l:void 0,"aria-valuetext":u,role:`progressbar`,"data-state":He(l,s),"data-value":l??void 0,"data-max":s,...o,ref:t})})},`Progress`)),ze=`ProgressIndicator`,Be=W.forwardRef(K(function(e,t){let{__scopeProgress:n,...r}=e,i=Le(ze,n);return(0,G.jsx)(c.div,{"data-state":He(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})},`ProgressIndicator`));function Ve(e,t){return`${Math.round(e/t*100)}%`}K(Ve,`defaultGetValueLabel`);function He(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}K(He,`getProgressState`);function q(e){return typeof e==`number`}K(q,`isNumber`);function Ue(e){return q(e)&&!isNaN(e)&&e>0}K(Ue,`isValidMaxNumber`);function We(e,t){return q(e)&&!isNaN(e)&&e<=t&&e>=0}K(We,`isValidValueNumber`);function Ge(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ne}\`.`}K(Ge,`getInvalidMaxError`);function Ke(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
|
+
- a positive number
|
|
3
|
+
- less than the value passed to \`max\` (or ${Ne} if no \`max\` prop is set)
|
|
4
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
|
+
|
|
6
|
+
Defaulting to \`null\`.`}K(Ke,`getInvalidValueError`);function qe({className:e,value:t,...n}){return(0,G.jsx)(Re,{"data-slot":`progress`,className:u(`relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted`,e),...n,children:(0,G.jsx)(Be,{"data-slot":`progress-indicator`,className:`size-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}function Je({index:e,status:t,current:n}){return(0,G.jsx)(`span`,{className:u(`flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium tabular transition-colors`,t===`done`&&`border-success bg-success text-white`,t===`skipped`&&`border-muted-foreground/40 bg-muted text-muted-foreground`,t===`todo`&&n&&`border-primary bg-primary text-primary-foreground`,t===`todo`&&!n&&`bg-background text-muted-foreground`),"aria-hidden":!0,children:t===`done`?(0,G.jsx)(d,{className:`size-3.5`}):t===`skipped`?(0,G.jsx)(Oe,{className:`size-3.5`}):e+1})}var Ye={done:`done`,skipped:`skipped`,todo:`to do`};function Xe({current:e,statuses:t,onSelect:n}){let r=z.filter(e=>t[e]!==`todo`).length,i=z.indexOf(e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-3 lg:hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Step `,i+1,` of `,z.length]}),(0,G.jsxs)(`span`,{children:[r,` done`]})]}),(0,G.jsx)(qe,{value:r/z.length*100,"aria-label":`Setup progress`}),(0,G.jsxs)(C,{value:e,onValueChange:e=>n(e),children:[(0,G.jsx)(te,{className:`w-full`,"aria-label":`Jump to step`,children:(0,G.jsx)(S,{})}),(0,G.jsx)(x,{children:z.map((e,n)=>(0,G.jsxs)(b,{value:e,children:[n+1,`. `,B[e].short,t[e]===`done`?` ✓`:t[e]===`skipped`?` (skipped)`:``]},e))})]})]}),(0,G.jsx)(`nav`,{"aria-label":`Setup steps`,className:`hidden lg:block`,children:(0,G.jsx)(`ol`,{className:`space-y-1`,children:z.map((r,i)=>{let a=r===e;return(0,G.jsxs)(`li`,{className:`relative`,children:[i<z.length-1&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:u(`absolute top-9 left-[1.4rem] h-[calc(100%-1.75rem)] w-px`,t[r]===`done`?`bg-success/50`:`bg-border`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(r),"aria-current":a?`step`:void 0,className:u(`relative flex w-full items-center gap-3 rounded-lg px-2 py-1.5 text-left text-sm outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring`,a&&`bg-muted`),children:[(0,G.jsx)(Je,{index:i,status:t[r],current:a}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:u(`block truncate`,a?`font-medium`:`text-muted-foreground`),children:B[r].short}),B[r].optional&&(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Optional`})]}),(0,G.jsxs)(`span`,{className:`sr-only`,children:[`(`,Ye[t[r]],`)`]})]})]},r)})})})]})}var Ze=null;function Qe({index:e,title:t,description:n,children:r,footer:i,total:a}){let o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{Ze!==null&&Ze!==e&&o.current?.focus({preventScroll:!0}),Ze=e},[e]),(0,G.jsxs)(E,{className:`gap-0 py-0`,"aria-labelledby":`wizard-step-title`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5 border-b p-5 sm:p-6`,children:[(0,G.jsxs)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:[`Step `,e+1,` of `,a??z.length]}),(0,G.jsx)(`h2`,{id:`wizard-step-title`,ref:o,tabIndex:-1,className:`rounded-sm text-xl font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:t}),(0,G.jsx)(`div`,{className:`max-w-2xl text-sm text-muted-foreground`,children:n})]}),(0,G.jsx)(T,{className:`space-y-6 p-5 sm:p-6`,children:r}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t bg-muted/20 p-4 sm:px-6`,children:i})]})}function $e({onBack:e,onNext:t,nextLabel:n=`Continue`,nextDisabled:i,nextVariant:a=`default`,pending:o,extra:s,hint:c}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{children:e&&(0,G.jsxs)(r,{variant:`ghost`,onClick:e,children:[(0,G.jsx)(ee,{}),` Back`]})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[c&&(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:c}),s,(0,G.jsxs)(r,{onClick:t,disabled:i||o,variant:a,children:[o&&(0,G.jsx)(h,{}),n,` `,!o&&(0,G.jsx)(y,{})]})]})]})}function J({children:e}){return(0,G.jsx)(`ol`,{className:`space-y-6 [counter-reset:guide]`,children:e})}function Y({title:e,children:t,done:n,expect:r}){return(0,G.jsxs)(`li`,{className:`relative flex gap-3 [counter-increment:guide]`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:u(`flex size-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-medium tabular before:content-[counter(guide)]`,n&&`border-success bg-success text-white before:content-['✓']`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium`,children:[e,n&&(0,G.jsx)(`span`,{className:`sr-only`,children:` (done)`})]}),t&&(0,G.jsx)(`div`,{className:`space-y-2.5 text-sm text-muted-foreground`,children:t}),r&&(0,G.jsx)(et,{children:r})]})]})}function et({children:e}){return(0,G.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-dashed px-2.5 py-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(k,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:`You should see: `}),e]})]})}function X({items:e}){return(0,G.jsx)(`span`,{className:`text-foreground`,children:e.map((e,t)=>(0,G.jsxs)(W.Fragment,{children:[t>0&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`px-1 text-muted-foreground`,children:`→`}),t>0&&(0,G.jsx)(`span`,{className:`sr-only`,children:`, then `}),(0,G.jsx)(`strong`,{className:`font-medium`,children:e})]},e))})}function tt({rows:e}){return(0,G.jsx)(`dl`,{className:`divide-y rounded-lg border text-sm`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2 sm:grid-cols-[11rem_1fr] sm:items-center sm:gap-3`,children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,G.jsxs)(`dd`,{className:`min-w-0 space-y-1 text-foreground`,children:[e.value!==void 0&&(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,G.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto font-mono text-[13px] whitespace-pre-wrap select-all`,children:(0,G.jsx)(se,{text:e.value})}),(0,G.jsx)(oe,{value:e.value,label:e.copyLabel??`Copy ${e.label.toLowerCase()}`})]}),e.note&&(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.note})]})]},e.label))})}function Z({summary:e,children:t,defaultOpen:n,className:r,badge:i}){return(0,G.jsxs)(`details`,{className:u(`group rounded-lg border`,r),open:n,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-foreground outline-none select-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[(0,G.jsx)(w,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-90`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),i]}),(0,G.jsx)(`div`,{className:`space-y-3 border-t px-3 py-3 text-sm text-muted-foreground`,children:t})]})}function nt(){return(0,G.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg bg-muted/50 px-3 py-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(D,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:`Links open Google Cloud in a new tab; come back to this tab when you're done. Sign in with the Google account that will own the project (check the avatar at the top right).`})]})}function Q({href:e,children:t,disabled:n,disabledReason:i,variant:a=`outline`}){return n?(0,G.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(r,{variant:a,size:`sm`,disabled:!0,children:[t,(0,G.jsx)(D,{})]}),i&&(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]}):(0,G.jsx)(r,{variant:a,size:`sm`,asChild:!0,children:(0,G.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:[t,(0,G.jsx)(D,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`(opens Google Cloud in a new tab)`})]})})}var rt={pending:`No new account yet. Finish signing in with Google, or use the paste option below if the window ended on an error page.`,"pending-reauth":`Google hasn't sent you back yet. Finish signing in with Google, or use the paste option below if the window ended on an error page.`,unreachable:`Couldn't reach xaq to check. Make sure it's still running, then try again.`,"already-connected":`This account was already connected, so there's nothing new to detect from here. If Google's window said it worked, close this dialog.`,expired:`This sign-in may have expired (links last 15 minutes) or xaq restarted. Open Google sign-in again to start a fresh one.`};function it(e,t){return e===`connected`||e===`failed`?{kind:`stop`}:e===null?{kind:`note`,note:`unreachable`}:e===`pending`?{kind:`note`,note:t.reauth?`pending-reauth`:`pending`}:t.scopes?{kind:`finish-unconfirmed`}:t.reauth&&!t.reauthFromBroken?{kind:`note`,note:`already-connected`}:{kind:`check-list`}}function at(e,t){return t.reauthAccountId?t.reauthFromBroken?e.find(e=>e.id===t.reauthAccountId&&e.status===`active`):void 0:e.find(e=>!t.known.has(e.id))}function ot(e,t){return!t.reauthAccountId||e===t.reauthAccountId||!t.known.has(e)}function st(e,t){return e?.kind===`waiting`&&e.res?.state===t}var ct=e=>e===`oauth_calendar_not_granted`||e===`oauth_access_denied`;function lt(e,t,n){return e===`oauth_admin_policy_enforced`&&!t.scopes?.length&&!t.mailOnly&&(n||!!t.reauthAccountId)}function ut(e){let{state:t}=H();return t?.gcpProjectId?(0,G.jsx)(dt,{...e,projectId:t.gcpProjectId}):(0,G.jsx)(ft,{...e})}function dt({index:e,onBack:t,onNext:n,projectId:r}){return(0,G.jsxs)(Qe,{index:e,title:B.project.title,description:`xaq signs in to Gmail through your own Google Cloud project.`,footer:(0,G.jsx)($e,{onBack:t,onNext:n}),children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`xaq uses the project `,(0,G.jsx)(`code`,{className:`font-mono font-medium`,children:r}),` (saved with the OAuth client in step 4).`]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Q,{href:U.dashboard(r),children:`Open the project`}),(0,G.jsx)(Q,{href:U.enableGmail(r),children:`Check the Gmail API is enabled`}),(0,G.jsx)(Q,{href:U.enableCalendar(r),children:`Check the Calendar API is enabled`})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`To move to another project, create an OAuth client there and import it in step 4; the project ID comes with it.`})]})}function ft({index:e,onBack:t,onNext:n}){let{state:i,draft:a}=H(),o=a.projectMode??`new`,s=a.projectMethod??`shell`,c=!!a.projectInOrg;(0,W.useEffect)(()=>{a.newProjectId||V({newProjectId:L()})},[a.newProjectId]);let l=a.newProjectId??``,[u,d]=(0,W.useState)(a.existingProjectId??(o===`existing`?i?.gcpProjectId??a.projectId??``:``)),[f,p]=(0,W.useState)(!1),m=o===`new`?l.trim():u.trim(),h=R(m),g=!h,_=_e(m,c),v=()=>{p(!0),g&&(V({projectId:m,projectConfirmed:!0,projectMode:o}),n())};return(0,G.jsxs)(Qe,{index:e,title:B.project.title,description:`xaq signs in to Gmail through your own Google Cloud project, so your mail never passes through anyone else's. Free; no billing account needed.`,footer:(0,G.jsx)($e,{onBack:t,onNext:v,nextDisabled:f&&!g,nextLabel:o===`new`?`I've created it`:`Continue`,hint:f&&h?`Fix the project ID first`:void 0}),children:[(0,G.jsx)(nt,{}),o===`new`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(P,{"data-invalid":!!h,className:`max-w-md`,children:[(0,G.jsx)(M,{htmlFor:`new-project-id`,children:`Project ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Ee,{id:`new-project-id`,className:`font-mono`,spellCheck:!1,autoComplete:`off`,value:l,onChange:e=>V({newProjectId:e.target.value.trim()}),"aria-invalid":!!h,"aria-describedby":`new-project-id-hint`}),(0,G.jsxs)(r,{type:`button`,variant:`outline`,onClick:()=>V({newProjectId:L()}),children:[(0,G.jsx)(ue,{}),` New ID`]})]}),(0,G.jsx)(`div`,{id:`new-project-id-hint`,children:h?(0,G.jsx)(fe,{children:h}):(0,G.jsx)(N,{children:`Project IDs are unique across Google and permanent. If Google says this one is taken, click New ID and run the command again. The project name (xaq) is just a label.`})})]}),(0,G.jsxs)(pe,{type:`single`,variant:`outline`,className:`flex-wrap`,value:s,onValueChange:e=>e&&V({projectMethod:e}),"aria-label":`How to create the project`,children:[(0,G.jsxs)(F,{value:`shell`,children:[(0,G.jsx)(A,{}),` One command (recommended)`]}),(0,G.jsxs)(F,{value:`console`,children:[(0,G.jsx)(Ae,{}),` Click through the console`]})]}),s===`shell`?(0,G.jsxs)(J,{children:[(0,G.jsxs)(Y,{title:`Open Cloud Shell`,expect:`Cloud Shell in a new tab, filled by a terminal. The first time it can take a minute to start, and Google may ask you to pick your country and accept the terms.`,children:[(0,G.jsx)(`p`,{children:`A free terminal in your browser, already signed in to Google Cloud. Nothing to install.`}),(0,G.jsx)(Q,{href:U.cloudShell,children:`Open Cloud Shell`})]}),(0,G.jsxs)(Y,{title:`Paste this command and press Enter`,children:[(0,G.jsx)(`p`,{children:`It creates the project and turns on the Gmail and Google Calendar APIs in it.`}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(j,{id:`project-in-org`,checked:c,onCheckedChange:e=>V({projectInOrg:e===!0}),className:`mt-0.5`}),(0,G.jsx)(de,{htmlFor:`project-in-org`,className:`flex-1 text-sm leading-snug font-normal text-foreground`,children:`I use Google Workspace and want only my organization's accounts to connect (creates the project inside your organization, so “Internal” is available in the next step)`})]}),_?(0,G.jsx)(le,{code:_,wrap:!0,copyLabel:`Copy command`}):(0,G.jsx)(`p`,{className:`text-critical`,children:`Fix the project ID above first.`}),(0,G.jsxs)(et,{children:[`maybe an “Authorize Cloud Shell” prompt (click `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Authorize`}),`), then after about a minute`,` `,(0,G.jsxs)(`code`,{className:`font-mono text-foreground`,children:[`xaq: project `,m||`…`,` is ready`]}),`.`]}),(0,G.jsx)(Z,{summary:`The command printed an error?`,children:(0,G.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`strong`,{className:`text-foreground`,children:`“already in use” or “already exists”`}),`: someone has this ID. Click`,` `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`New ID`}),` above, copy the command again and run it.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Terms of Service`}),` or `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`country`}),`: open`,` `,(0,G.jsx)(`a`,{className:`underline`,href:`https://console.cloud.google.com/`,target:`_blank`,rel:`noopener noreferrer`,children:`console.cloud.google.com`}),` `,`once, accept, then run the command again.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`strong`,{className:`text-foreground`,children:`quota`}),` (too many projects): Google limits how many projects you can create, and deleted projects still count for 30 days. Reuse a project you already have (`,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Use an existing project instead (advanced)`}),` below), or`,` `,(0,G.jsx)(`a`,{className:`underline`,href:`https://support.google.com/code/contact/project_quota_increase`,target:`_blank`,rel:`noopener noreferrer`,children:`request more quota`}),c&&` or your organization's Quotas page`,`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`strong`,{className:`text-foreground`,children:`--organization`}),` errors: untick the Workspace box above, or ask your Workspace admin for the “Project Creator” role.`]}),(0,G.jsxs)(`li`,{children:[`The project was created but enabling failed: run only the second part again, or use the enable links for`,` `,(0,G.jsx)(`a`,{className:`underline`,href:U.enableGmail(m),target:`_blank`,rel:`noopener noreferrer`,children:`Gmail`}),` `,`and`,` `,(0,G.jsx)(`a`,{className:`underline`,href:U.enableCalendar(m),target:`_blank`,rel:`noopener noreferrer`,children:`Calendar`}),`.`]})]})})]})]}):(0,G.jsxs)(J,{children:[(0,G.jsxs)(Y,{title:`Create the project`,expect:(0,G.jsxs)(G.Fragment,{children:[`a notification “Create Project: xaq”, then `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Select project`}),`.`]}),children:[(0,G.jsx)(`p`,{children:`Open the form and fill it in like this:`}),(0,G.jsx)(tt,{rows:[{label:`Project name`,value:`xaq`},{label:`Project ID`,value:m,note:`Click Edit under the name to change the suggested ID, and paste this one.`},{label:`Location / Organization`,note:`Personal @gmail.com: “No organization” is fine. Google Workspace: keep your organization (needed for Internal).`}]}),(0,G.jsxs)(`p`,{children:[`Click `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Create`}),`. Ignore “Start free trial” or billing banners: billing isn't needed.`]}),(0,G.jsx)(Q,{href:U.createProject,children:`Open Create a project`})]}),(0,G.jsx)(pt,{id:m,valid:g,disabledReason:`Fix the project ID above first`})]}),(0,G.jsxs)(Z,{summary:`Use an existing project instead (advanced)`,children:[(0,G.jsx)(`p`,{children:`A dedicated project is safer: xaq shares a project's sign-in screen, limits and settings with every other app in it. Only reuse a project if you can't create one.`}),(0,G.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>V({projectMode:`existing`}),children:`Use an existing project`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(mt,{}),(0,G.jsxs)(J,{children:[(0,G.jsxs)(Y,{title:`Enter the existing project's ID`,done:g,children:[(0,G.jsxs)(`p`,{children:[`Find it in Google Cloud's project picker (the `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`ID`}),` column) or on the project's Dashboard under `,(0,G.jsx)(X,{items:[`Project info`,`Project ID`]}),`. Not the name, not the number.`]}),(0,G.jsxs)(P,{"data-invalid":f&&!!h,className:`max-w-sm`,children:[(0,G.jsx)(M,{htmlFor:`gcp-project`,children:`Project ID`}),(0,G.jsx)(Ee,{id:`gcp-project`,className:`font-mono`,placeholder:`my-project-123456`,spellCheck:!1,autoComplete:`off`,value:u,onChange:e=>{d(e.target.value),V({existingProjectId:e.target.value.trim()})},onBlur:()=>u.trim()&&p(!0),onKeyDown:e=>e.key===`Enter`&&v(),"aria-invalid":f&&!!h,"aria-describedby":`gcp-project-hint`}),(0,G.jsx)(`div`,{id:`gcp-project-hint`,children:(f||u.trim())&&h?(0,G.jsx)(fe,{children:h}):(0,G.jsx)(N,{children:`The links in the next steps open in this project.`})})]})]}),(0,G.jsx)(pt,{id:m,valid:g,disabledReason:`Enter the project ID first`,existing:!0})]}),(0,G.jsx)(r,{variant:`link`,className:`h-auto px-0`,onClick:()=>V({projectMode:`new`}),children:`Create a new project instead (recommended)`})]})]})}function pt({id:e,valid:t,disabledReason:n,existing:r}){return(0,G.jsxs)(Y,{title:`Turn on the Gmail and Google Calendar APIs`,expect:r?`a confirmation that each API is enabled (or that it already was).`:`a confirmation that each API is enabled.`,children:[(0,G.jsxs)(`p`,{children:[r?`Each link opens in that project.`:`Each link opens in your new project.`,` Confirm the project, then click`,` `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Next`}),` and `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Enable`}),`. Do both.`]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Q,{href:t?U.enableGmail(e):`#`,disabled:!t,children:`Enable the Gmail API`}),(0,G.jsx)(Q,{href:t?U.enableCalendar(e):`#`,disabled:!t,disabledReason:n,children:`Enable the Calendar API`})]})]})}function mt(){return(0,G.jsxs)(ne,{variant:`warning`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(ie,{children:`Reusing a project: what xaq shares with the other apps in it`}),(0,G.jsxs)(re,{children:[(0,G.jsxs)(`ul`,{className:`list-disc space-y-1 pl-4`,children:[(0,G.jsx)(`li`,{children:`One sign-in screen: its name, logo and support email, audience (Internal/External) and publishing status.`}),(0,G.jsx)(`li`,{children:`Switching it back to Testing makes every app's sign-ins expire after 7 days.`}),(0,G.jsx)(`li`,{children:`Unverified apps are capped at 100 users per project, shared by all its apps.`}),(0,G.jsx)(`li`,{children:`Users see one entry for the project under their Google account's third-party access: removing it cuts off both apps.`}),(0,G.jsx)(`li`,{children:`API quotas, and deleting or locking the project, affect both.`})]}),(0,G.jsx)(`p`,{className:`pt-1 font-medium text-foreground`,children:`If you reuse it:`}),(0,G.jsxs)(`ul`,{className:`list-disc space-y-1 pl-4`,children:[(0,G.jsx)(`li`,{children:`Don't rename or rebrand the existing sign-in screen; leave it as it is.`}),(0,G.jsx)(`li`,{children:`Create a separate OAuth client for xaq, and don't touch the other app's client.`}),(0,G.jsx)(`li`,{children:`Prefer polling over Pub/Sub for new mail (step 6).`})]})]})]})}function ht({defaultOpen:e}){let t=_(p.googleClient()).data,n=t?.projectId??``,r=t?.appType===`internal`;return(0,G.jsx)(Z,{summary:`Seeing an error or a warning on Google's page?`,defaultOpen:e,children:(0,G.jsxs)(`dl`,{className:`space-y-3`,children:[!r&&(0,G.jsxs)($,{title:`“Google hasn't verified this app”`,children:[`Expected: it's your own app. Click `,(0,G.jsx)(X,{items:[`Advanced`,`Go to xaq (unsafe)`]}),`, then continue.`]}),(0,G.jsxs)($,{title:`A list of permissions with checkboxes`,children:[`Click `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Select all`}),` (or tick each box), then `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Continue`}),`. Gmail is required: without it xaq can't read mail. Calendar's boxes are optional: unticked, mail still works and you can add Calendar later.`]}),(0,G.jsxs)($,{title:`“Error 400: redirect_uri_mismatch”`,children:[(0,G.jsx)(`p`,{children:`The OAuth client doesn't list this exact redirect URI. Add it, save, wait a few minutes, then open sign-in again:`}),t&&(0,G.jsx)(ce,{value:t.redirectUri,label:`Copy redirect URI`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(X,{items:[`Google Auth Platform`,`Clients`,`your client`,`Authorized redirect URIs`,`Add URI`]}),n&&(0,G.jsxs)(G.Fragment,{children:[` `,`· `,(0,G.jsx)(O,{href:U.clients(n),children:`Open Clients`})]})]})]}),(0,G.jsxs)($,{title:`“Access blocked: xaq can only be used within its organization” (org_internal)`,children:[`The app is Internal, and this account isn't in its Google Workspace. Sign in with an account of that organization, or make the app External (`,(0,G.jsx)(X,{items:[`Audience`,`Make external`]}),`), publish it, and set the audience to External in step 3.`]}),(0,G.jsxs)($,{title:`“Access blocked: xaq has not completed the Google verification process” (Error 403: access_denied on Google's page)`,children:[`The app is still in Testing. Publish it: `,(0,G.jsx)(X,{items:[`Audience`,`Publish app`,`Push to production?`,`Confirm`]}),n&&(0,G.jsxs)(G.Fragment,{children:[` `,`(`,(0,G.jsx)(O,{href:U.authAudience(n),children:`Open Audience`}),`)`]}),`, then open sign-in again.`]}),(0,G.jsxs)($,{title:`“Error 400: admin_policy_enforced” or “This app is blocked”`,children:[`A Google Workspace admin must trust the app: admin.google.com →`,` `,(0,G.jsx)(X,{items:[`Security`,`Access and data control`,`API controls`,`Manage Third-Party App Access`,`Configure new app`]}),`, search for the client ID`,t?.clientId?(0,G.jsxs)(`span`,{className:`font-mono break-all`,children:[` `,t.clientId]}):``,`, and set it to`,` `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Trusted`}),`. If the admin blocks only Google Calendar, connect with mail only (the connect dialog offers it), or turn Calendar off in `,(0,G.jsx)(X,{items:[`Settings`,`Google Calendar`,`Turn off`]}),`.`]}),(0,G.jsx)($,{title:`“Error 401: invalid_client” or “deleted_client”`,children:`The client ID is wrong, or the client was deleted (Google deletes clients unused for 6 months). Create a new client and import it in step 4.`}),(0,G.jsx)($,{title:`Can't sign in with a shared address (like ops@)`,children:`Groups and aliases can't sign in to Google. Use a mailbox with its own Google account (a licensed user).`})]})})}function $({title:e,children:t}){return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`dt`,{className:`font-medium text-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`space-y-1.5`,children:t})]})}function gt(e,t){let n;try{n=new URL(e.trim())}catch{return`That isn't a full address. Copy everything in the address bar, starting with http.`}let r=n.searchParams.get(`error`);if(r)return r===`access_denied`?`This address says you clicked Cancel (or denied access) on Google's screen. Nothing needs fixing: start again and click Continue.`:`Google returned an error: ${r}`;if(!n.searchParams.get(`code`))return`This address has no authorization code. Make sure you copied it after clicking Allow.`;let i=n.searchParams.get(`state`);return i&&i!==t?`This address belongs to an older sign-in attempt. Use the newest one.`:null}function _t({res:e,onConnected:n,compact:a}){let o=`${_(p.googleClient()).data?.redirectUri??`http://localhost:8425/oauth/callback`}?state=…&code=…`,[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(),[m,g]=(0,W.useState)(!1),v=l.trim()?gt(l,e.state):null,ee=async e=>{if(e.preventDefault(),l.trim()&&!v){g(!0),f(void 0);try{n((await t(`/api/accounts/connect/complete`,{body:{url:l.trim()}})).email)}catch(e){e instanceof i&&e.code===`oauth_already_connected`?n(e.email??`The account`):f(e)}finally{g(!1)}}},y=e=>(0,G.jsxs)(P,{className:`min-w-0 flex-1`,"data-invalid":!!v,children:[(0,G.jsx)(M,{htmlFor:a?`pasted-url-fallback`:`pasted-url`,children:e}),(0,G.jsx)(Te,{id:a?`pasted-url-fallback`:`pasted-url`,rows:3,spellCheck:!1,placeholder:o,className:`font-mono text-xs break-all`,value:l,onChange:e=>u(e.target.value),"aria-invalid":!!v}),v?(0,G.jsx)(fe,{children:v}):(0,G.jsx)(N,{children:`It contains a one-time code; it can't be reused.`})]}),b=(0,G.jsxs)(r,{type:`submit`,disabled:!l.trim()||!!v||m,variant:a?`outline`:`default`,children:[m&&(0,G.jsx)(h,{}),`Finish connecting`]});return a?(0,G.jsxs)(`form`,{onSubmit:ee,className:`space-y-3`,children:[y(`Copy the full address from the sign-in window's address bar and paste it here`),d!==void 0&&(0,G.jsx)(ae,{error:d,title:`Couldn't finish connecting`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:b})]}):(0,G.jsxs)(`form`,{onSubmit:ee,className:`space-y-4`,children:[(0,G.jsxs)(`ol`,{className:`space-y-4 text-sm`,children:[(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[(0,G.jsx)(vt,{n:1}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,G.jsx)(`p`,{children:`Open Google sign-in and allow access.`}),(0,G.jsx)(r,{asChild:!0,variant:s?`outline`:`default`,size:`sm`,children:(0,G.jsxs)(`a`,{href:e.authUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>c(!0),children:[(0,G.jsx)(D,{}),` `,s?`Open sign-in again`:`Open Google sign-in`]})})]})]}),(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[(0,G.jsx)(vt,{n:2}),(0,G.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[`After you click `,(0,G.jsx)(`strong`,{children:`Allow`}),`, the tab lands on a page that probably won't load (like "This site can't be reached"). That's expected.`]})]}),(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[(0,G.jsx)(vt,{n:3}),y(`Copy the full address from that tab's address bar and paste it here`)]})]}),d!==void 0&&(0,G.jsx)(ae,{error:d,title:`Couldn't finish connecting`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:b}),(0,G.jsx)(ht,{})]})}function vt({n:e}){return(0,G.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-medium tabular`,"aria-hidden":!0,children:e})}var yt=e=>!!e&&typeof e==`object`&&e.type===`agentinbox:oauth`,bt=null;function xt(e={}){bt?.(e)}function St(){let e=Math.max(0,window.screenX+(window.outerWidth-520)/2),t=Math.max(0,window.screenY+(window.outerHeight-700)/2),n=window.open(``,`agentinbox-oauth`,`popup,width=520,height=700,left=${e},top=${t}`);try{n?.document.write(`<title>Connecting…</title><body style="font:14px system-ui;display:grid;place-items:center;height:90vh;color:#666">Opening Google sign-in…</body>`)}catch{}return n}function Ct(){let e=n(),a=_(p.googleClient()),o=_({...p.calendarSetup(),retry:!1}).data?.enabled??!1,[s,c]=(0,W.useState)(null),u=(0,W.useRef)(null),[d,f]=(0,W.useState)(null),ee=v({select:e=>e.location.pathname===`/get-started`}),y=l(),b=(0,W.useRef)(null),[x,te]=(0,W.useState)({}),S=(0,W.useRef)(new Set),C=(0,W.useRef)({}),w=(0,W.useRef)(!1),T=(t,n=!0)=>{let{onDone:r,handBack:i}=C.current;C.current={...C.current,onDone:void 0,onCancel:void 0},r&&setTimeout(()=>r(n),0),c(e=>(e?.kind===`waiting`&&e.popup?.close(),i?null:{kind:`done`,email:t})),e.invalidateQueries({queryKey:m.accounts}),e.invalidateQueries({queryKey:m.setupState}),e.invalidateQueries({queryKey:m.overview})},E=(0,W.useRef)(T),O=e=>{let{handBack:t,onCancel:n}=C.current;if(!t||!ct(e.code))return c({kind:`error`,error:e});C.current={...C.current,onDone:void 0,onCancel:void 0},n&&setTimeout(()=>n(e),0),c(e=>(e?.kind===`waiting`&&e.popup?.close(),null))},oe=(0,W.useRef)(O),se=(0,W.useRef)(!1),le=(0,W.useRef)(null);(0,W.useEffect)(()=>{E.current=T,oe.current=O,u.current=s,se.current=s?.kind===`starting`||s?.kind===`waiting`;try{le.current=a.data?new URL(a.data.redirectUri).origin:null}catch{le.current=null}});let k=async n=>{f(null),te(n),C.current=n;let r=a.data,i=r?.callbackMode===`paste`?null:St();c({kind:`starting`});let o=r??await e.fetchQuery(p.googleClient()).catch(()=>void 0);if(o&&(!o.clientId||!o.hasSecret)){i?.close(),c({kind:`not-configured`});return}let s=e.getQueryData(m.accounts)??await e.fetchQuery(p.accounts()).catch(()=>[]);S.current=new Set(s.map(e=>e.id)),w.current=!!n.reauthAccountId&&s.some(e=>e.id===n.reauthAccountId&&e.status===`needs_reauth`);try{let e=await t(`/api/accounts/connect`,{body:{...n.reauthAccountId?{reauthAccountId:n.reauthAccountId}:{},...n.scopes?.length?{scopes:n.scopes}:{},...n.mailOnly?{mailOnly:!0}:{}}});i&&e.callbackMode===`direct`?i.location.href=e.authUrl:i?.close(),c({kind:`waiting`,res:e,popup:e.callbackMode===`direct`?i:null,closed:!1})}catch(e){i?.close(),c({kind:`error`,error:e})}},ue=(0,W.useRef)(k);(0,W.useEffect)(()=>{ue.current=k}),(0,W.useEffect)(()=>(bt=e=>void ue.current(e),()=>{bt=null}),[]),(0,W.useEffect)(()=>{let e=e=>{yt(e.data)&&se.current&&(e.origin&&e.origin!==window.location.origin&&e.origin!==le.current||(e.data.ok?E.current(e.data.email??`Your account`):oe.current(new i(400,e.data.code??`oauth_error`,e.data.error??`Google sign-in failed`,e.data.hint??void 0))))};window.addEventListener(`message`,e);let t=`BroadcastChannel`in window?new BroadcastChannel(`agentinbox-oauth`):void 0;return t&&(t.onmessage=e),()=>{window.removeEventListener(`message`,e),t?.close()}},[]);let A=(0,W.useRef)(null),j=()=>{let e=u.current;if(e?.kind!==`waiting`)return Promise.resolve(null);let n=e.res.state,r=A.current;if(r?.state===n)return r.followUp??=r.answer.then(e=>e===`connected`||e===`failed`?e:M.current()),r.followUp;let a=(async()=>{let e;try{e=await t(`/api/accounts/connect/status`,{body:{state:n}})}catch{return null}finally{A.current?.state===n&&(A.current=null)}return st(u.current,n)&&(e.status===`connected`?E.current(e.email):e.status===`failed`&&oe.current(new i(400,e.code,e.error,e.hint??void 0))),e.status})();return A.current={state:n,answer:a},a},M=(0,W.useRef)(j);(0,W.useEffect)(()=>{M.current=j}),we(e=>{if(e.kind!==`account`||s?.kind!==`waiting`&&s?.kind!==`starting`)return;let t=e.data,n=x.reauthAccountId;(n?w.current&&t.id===n&&t.status===`active`:!S.current.has(t.id))?T(t.email):ot(t.id,{reauthAccountId:n,known:S.current})&&j()});let de=s?.kind===`waiting`?s.res.state:null;(0,W.useEffect)(()=>{if(!de)return;let e=()=>void M.current();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[de]);let N=s?.kind===`waiting`?s.popup:null;(0,W.useEffect)(()=>{if(!N)return;let e=setInterval(()=>{N.closed&&(clearInterval(e),c(e=>e?.kind===`waiting`?{...e,closed:!0}:e),M.current())},600);return()=>clearInterval(e)},[N]);let fe=async()=>{f(null);let t=u.current;if(t?.kind!==`waiting`)return;let n=await j();if(!st(u.current,t.res.state))return;let r=x.reauthAccountId,i=it(n,{scopes:!!x.scopes?.length,reauth:!!r,reauthFromBroken:w.current});if(i.kind===`stop`)return;if(i.kind===`note`)return f(i.note);if(i.kind===`finish-unconfirmed`)return T(x.email??`Your account`,!1);let a=t.res.state;try{let t=await e.fetchQuery({...p.accounts(),staleTime:0});if(!st(u.current,a))return;let n=at(t,{reauthAccountId:r,reauthFromBroken:w.current,known:S.current});n?T(n.email):f(`expired`)}catch{st(u.current,a)&&f(`unreachable`)}},P=()=>{s?.kind===`waiting`&&s.popup?.close();let e=C.current.onCancel;C.current={...C.current,onDone:void 0,onCancel:void 0},e&&setTimeout(e,0),c(null)},F=()=>void k(x),pe=()=>void k({...x,mailOnly:!0}),I=x.email,L=!!x.scopes?.includes(`pubsub`),R=!!x.scopes?.includes(`calendar`),z=()=>{P(),y({to:`/get-started`,search:{step:`pubsub`}})},B=s?.kind;(0,W.useEffect)(()=>{(B===`done`||B===`error`||B===`not-configured`)&&requestAnimationFrame(()=>b.current?.focus())},[B]);let V=s?.kind===`error`&&s.error instanceof i?s.error.code:void 0,H=lt(V,x,o),_e=V===`oauth_invalid_client`||V===`oauth_unauthorized_client`||V===`oauth_redirect_uri_mismatch`||V===`google_client_missing`;return(0,G.jsx)(be,{open:!!s,onOpenChange:e=>!e&&P(),children:(0,G.jsxs)(Se,{className:`max-h-[90vh] overflow-y-auto sm:max-w-lg`,children:[(0,G.jsxs)(xe,{children:[(0,G.jsx)(Ce,{children:L?`Grant Pub/Sub access${x.email?` for ${x.email}`:``}`:R?`Add Google Calendar${x.email?` to ${x.email}`:``}`:I?`Reconnect ${I}`:`Connect a Google account`}),(0,G.jsx)(ye,{children:s?.kind===`waiting`&&s.res.callbackMode===`paste`?`Sign in with Google in a new tab, then paste back the address you land on.`:L?`Sign in as ${x.email??`the account xaq sets up Pub/Sub with`} (another account won't work) and tick the Pub/Sub box. xaq only uses it for its own topic and subscription in ${a.data?.projectId??`your project`}.`:R?`Sign in as ${x.email??`the account`} (another account won't work). Gmail stays connected and keeps working while you do this.`:I?`Sign in as ${I} and allow access again.`:o?`Sign in with Google and allow xaq to manage the mailbox and calendar.`:`Sign in with Google and allow xaq to manage the mailbox.`})]}),s?.kind===`starting`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-muted-foreground`,role:`status`,children:[(0,G.jsx)(h,{}),` Preparing Google sign-in…`]}),s?.kind===`not-configured`&&(0,G.jsxs)(ne,{variant:`warning`,children:[(0,G.jsx)(he,{}),(0,G.jsx)(ie,{children:`Set up the Google OAuth client first`}),(0,G.jsx)(re,{children:`xaq signs in to Gmail through your own Google OAuth client. Import its JSON (step 4 of Get started), then come back here.`})]}),s?.kind===`error`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(ae,{error:s.error,title:V===`oauth_access_denied`?`Sign-in was cancelled`:V===`oauth_wrong_account`?`Signed in with a different Google account`:R?`Couldn't add Google Calendar`:`Couldn't connect the account`}),H&&(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`If the admin blocks only Google Calendar, connect with mail only now and add Calendar once it's allowed.`}),V===`oauth_redirect_uri_mismatch`&&a.data&&(0,G.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[(0,G.jsx)(`p`,{children:`Add this exact redirect URI to the OAuth client, save, wait a few minutes, then try again:`}),(0,G.jsx)(ce,{value:a.data.redirectUri,label:`Copy redirect URI`})]})]}),s?.kind===`done`&&(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,role:`status`,children:[(0,G.jsx)(ge,{className:`size-10 text-success`}),L?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`font-medium`,children:`Back from Google`}),(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Finishing real-time setup with `,s.email,`…`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`font-medium`,children:[s.email,` is connected`]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mail starts syncing now.`})]})]}),s?.kind===`waiting`&&R&&(0,G.jsx)(wt,{email:x.email,external:a.data?.appType!==`internal`}),s?.kind===`waiting`&&s.res.callbackMode===`direct`&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border bg-muted/40 p-3 text-sm`,role:`status`,children:[s.popup&&!s.closed?(0,G.jsx)(h,{className:`mt-0.5`}):(0,G.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:s.popup?s.closed?`Closed the Google window?`:`Waiting for Google…`:`Your browser blocked the sign-in window`}),(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:s.popup?s.closed?`Open it again with the button below. If you finished signing in, this updates in a moment.`:`Finish signing in in the pop-up window. This updates on its own when you're done.`:`Open it with the button below.`})]})]}),d&&(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:rt[d]}),(0,G.jsx)(Z,{summary:`Sign-in ended on an error or a page that can't be reached? Paste its address`,children:(0,G.jsx)(_t,{res:s.res,onConnected:T,compact:!0})}),(0,G.jsx)(ht,{})]}),s?.kind===`waiting`&&s.res.callbackMode===`paste`&&(0,G.jsx)(_t,{res:s.res,onConnected:T}),(0,G.jsxs)(ve,{children:[s?.kind===`not-configured`&&(0,G.jsx)(r,{asChild:!0,onClick:P,children:(0,G.jsx)(g,{to:`/get-started`,search:{step:`client`},ref:b,children:`Set up the OAuth client`})}),s?.kind===`error`&&(0,G.jsxs)(G.Fragment,{children:[_e&&(0,G.jsx)(r,{variant:`outline`,asChild:!0,onClick:P,children:(0,G.jsx)(g,{to:`/get-started`,search:{step:`client`},children:`Check the OAuth client`})}),H&&(0,G.jsx)(r,{variant:`outline`,onClick:pe,children:`Connect with mail only`}),(0,G.jsxs)(r,{onClick:F,ref:b,children:[(0,G.jsx)(me,{}),` Try again`]})]}),s?.kind===`waiting`&&s.res.callbackMode===`direct`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(r,{variant:`ghost`,onClick:fe,children:`I'm done, check again`}),d===`expired`?(0,G.jsxs)(r,{onClick:F,children:[(0,G.jsx)(D,{}),` Open Google sign-in again`]}):(0,G.jsx)(r,{variant:!s.popup||s.closed?`default`:`outline`,asChild:!0,children:(0,G.jsxs)(`a`,{href:s.res.authUrl,target:`agentinbox-oauth`,rel:`opener`,children:[(0,G.jsx)(D,{}),` `,s.popup?`Open Google sign-in again`:`Open Google sign-in`]})})]}),s?.kind===`done`&&(0,G.jsxs)(G.Fragment,{children:[!I&&!x.scopes?.length&&(0,G.jsx)(r,{variant:`outline`,onClick:()=>xt(),children:`Connect another`}),ee&&!L?(0,G.jsx)(r,{onClick:z,ref:b,children:`Continue setup`}):(0,G.jsx)(r,{onClick:P,ref:b,children:`Done`})]})]})]})})}function wt({email:e,external:t}){return(0,G.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,G.jsxs)(`li`,{children:[`Choose `,e??`the account`,`.`]}),t&&(0,G.jsxs)(`li`,{children:[`“Google hasn't verified this app”: expected for your own app. Click `,(0,G.jsx)(X,{items:[`Advanced`,`Go to xaq (unsafe)`]}),`.`]}),(0,G.jsxs)(`li`,{children:[`Google lists only the new Calendar permissions (events, calendar list, free/busy), each with a checkbox. Tick all three, or`,` `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Select all`}),`, then `,(0,G.jsx)(`strong`,{className:`text-foreground`,children:`Continue`}),`.`]}),(0,G.jsx)(`li`,{children:`The window closes and this dialog shows the result. Unticking or cancelling changes nothing: mail keeps working.`})]})}export{Oe as _,Q as a,tt as c,Y as d,X as f,qe as g,Xe as h,ut as i,nt as l,$e as m,xt as n,Z as o,Qe as p,ht as r,et as s,Ct as t,J as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,Ht as n,N as r,Ut as i,Wt as a,_t as o,h as s,s as c,t as l,v as u,w as d,y as f,yt as p}from"./queries-Cv3nXx0U.js";import{F as m,L as h,R as g,f as _,i as v}from"./common-BPZV8TFb.js";import{n as y,t as b}from"./trash-Ci0aICEl.js";import{t as x}from"./network-igNw0VVx.js";import{t as S}from"./pause-o-dK3khK.js";import{a as C,n as w,r as T,t as E}from"./field-C6ejurju.js";import{Dt as D,Et as O,Tt as k,ct as A,dt as ee,ft as te,it as j,kt as ne,lt as re,ut as M}from"./index-DGzo3kGh.js";import{a as N,i as P,n as F,o as I,r as L,s as R,t as z}from"./mutations-CLPqJ6cj.js";import{n as B,t as ie}from"./input-CWwJgozn.js";import{t as ae}from"./password-input-DV3aqcNf.js";var V={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};V.node;var H=o(V),U=e(a(),1),W=i(),G=null;function K(e){G?.(e)}function oe(e){let t=Math.max(0,window.screenX+(window.outerWidth-520)/2),n=Math.max(0,window.screenY+(window.outerHeight-700)/2),r=window.open(``,`agentinbox-connection-oauth`,`popup,width=520,height=700,left=${t},top=${n}`);try{r&&(r.opener=null)}catch{}try{let t=r?.document;t&&(t.title=`Connecting…`,t.body.style.cssText=`font:14px system-ui;display:grid;place-items:center;height:90vh;color:#666`,t.body.textContent=`Opening ${e} sign-in…`)}catch{}return r}var q=e=>t(`/api/connections/${encodeURIComponent(e)}`),J=e=>`${e.status}|${e.updatedAt}|${e.expiresAt??``}`;function se(){let e=n(),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(null),[c,f]=(0,U.useState)(!1),p=(0,U.useRef)(null),m=(0,U.useRef)(null);(0,U.useEffect)(()=>{p.current=i,m.current=o});let h=()=>{for(let t of[l.connections,l.setupState,l.overview,[`agent-connections`]])e.invalidateQueries({queryKey:t})},g=e=>{a(t=>(t?.kind===`waiting`&&t.popup?.close(),{kind:`done`,connection:e})),h();let t=m.current?.onDone;t&&setTimeout(()=>t(e),0)},_=e=>{a(t=>(t?.kind===`waiting`&&t.popup?.close(),{kind:`error`,error:e})),h()},y=async e=>{s(e),f(!1),m.current=e;let t=oe(e.name);a({kind:`starting`});try{let{connectionId:n,result:r}=await e.run();if(r.status===`connected`)return t?.close(),g(r.connection);if(r.status===`error`)return t?.close(),_(Error(r.message));let i=r.callbackMode===`paste`;i?t?.close():t&&(t.location.href=r.authorizeUrl);let o=await q(n).catch(()=>null);a({kind:`waiting`,connectionId:n,authorizeUrl:r.authorizeUrl,popup:i?null:t,baseline:o?J(o):null,paste:i,redirectUri:r.redirectUri??null})}catch(e){t?.close(),_(e)}},b=(0,U.useRef)(y);(0,U.useEffect)(()=>{b.current=y}),(0,U.useEffect)(()=>(G=e=>void b.current(e),()=>{G=null}),[]);let x=async(e,t)=>{let n=p.current;if(n?.kind!==`waiting`)return;let r;try{r=await q(n.connectionId)}catch(t){e&&_(t);return}let i=p.current;if(i?.kind===`waiting`&&i.connectionId===n.connectionId){if(r.status===`active`&&(e||J(r)!==n.baseline))return g(r);e&&_(Error(t??r.statusReason??`${r.name} didn't finish connecting. Try again.`))}},S=(0,U.useRef)(x),C=(0,U.useRef)(_);(0,U.useEffect)(()=>{S.current=x,C.current=_});let w=async e=>{let n=await t(`/api/connections/finish`,{body:{url:e}});if(n.status===`connected`)g(n.connection);else if(n.status===`error`)throw Error(n.message);else throw Error(`The sign-in needs another step. Start again from Reconnect.`)};(0,U.useEffect)(()=>{let e=e=>{let t=p.current;if(t?.kind!==`waiting`||e.origin&&e.origin!==window.location.origin)return;let n=u(e.data,t.connectionId);n&&(n.ok?S.current(!0):C.current(Error(n.error??`The sign-in didn't complete. Try again.`)))};window.addEventListener(`message`,e);let t=`BroadcastChannel`in window?new BroadcastChannel(`agentinbox-oauth`):void 0;return t&&(t.onmessage=e),()=>{window.removeEventListener(`message`,e),t?.close()}},[]);let T=i?.kind===`waiting`?i:null,E=T?.popup??null,O=T?.connectionId??null;(0,U.useEffect)(()=>{if(!O)return;let e=()=>void S.current(!1);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[O]),(0,U.useEffect)(()=>{if(!E)return;let e=setInterval(()=>{E.closed&&(clearInterval(e),S.current(!1))},600);return()=>clearInterval(e)},[E]);let k=()=>{i?.kind===`waiting`&&i.popup?.close(),a(null),h()},A=i?.kind===`done`?i.connection.name:o?.name??`the server`;return(0,W.jsx)(F,{open:!!i,onOpenChange:e=>!e&&k(),children:(0,W.jsxs)(L,{className:`sm:max-w-md`,children:[(0,W.jsxs)(I,{children:[(0,W.jsx)(R,{children:i?.kind===`done`?`${A} is connected`:i?.kind===`error`?`Couldn't connect ${A}`:`Connecting ${A}`}),(0,W.jsx)(P,{children:i?.kind===`done`?`Agents with access see its tools on their next request.`:i?.kind===`waiting`&&i.paste?`Sign in to ${A} in a new tab, then paste the address you land on.`:i?.kind===`waiting`?`Finish signing in to ${A} in the window that opened.`:i?.kind===`error`?`Fix what's below, then try again.`:`One moment…`})]}),i?.kind===`starting`&&(0,W.jsx)(`div`,{className:`flex justify-center py-6`,children:(0,W.jsx)(d,{className:`size-6`})}),i?.kind===`waiting`&&i.paste&&(0,W.jsx)(Y,{authorizeUrl:i.authorizeUrl,redirectUri:i.redirectUri,name:A,onSubmit:w}),i?.kind===`waiting`&&!i.paste&&(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,W.jsx)(d,{}),` Waiting for `,A,`…`]}),(0,W.jsxs)(`p`,{className:`text-muted-foreground`,children:[`No window?`,` `,(0,W.jsx)(`a`,{href:i.authorizeUrl,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-4`,children:`Open the sign-in`}),`.`]}),c?(0,W.jsx)(Y,{authorizeUrl:i.authorizeUrl,redirectUri:i.redirectUri,name:A,onSubmit:w}):(0,W.jsx)(r,{variant:`link`,size:`sm`,className:`h-auto px-0`,onClick:()=>f(!0),children:`Ended on an error page? Paste its address`})]}),i?.kind===`done`&&(0,W.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-success/30 bg-success/[0.06] p-3 text-sm`,children:[(0,W.jsx)(ne,{className:`mt-0.5 size-4 shrink-0 text-success`}),(0,W.jsxs)(`p`,{children:[i.connection.tools.total>0?`${i.connection.tools.total} tool${i.connection.tools.total===1?``:`s`} found and pinned.`:`Its tools are being listed now.`,` `,`If a tool's definition changes later, xaq holds that tool until you accept the change.`]})]}),i?.kind===`error`&&(0,W.jsx)(v,{error:i.error}),(0,W.jsxs)(N,{children:[i?.kind===`error`&&o&&(0,W.jsxs)(r,{variant:`outline`,onClick:()=>void y(o),children:[(0,W.jsx)(D,{}),` Try again`]}),i?.kind===`waiting`&&!i.paste&&(0,W.jsx)(r,{variant:`outline`,onClick:()=>void x(!0),children:`I'm done, check again`}),(0,W.jsx)(r,{variant:i?.kind===`done`?`default`:`ghost`,onClick:k,children:i?.kind===`done`?`Done`:`Close`})]})]})})}function Y({authorizeUrl:e,redirectUri:t,name:n,onSubmit:i}){let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(),[l,u]=(0,U.useState)(!1),p=a.trim()?f(a):null;return(0,W.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),a.trim()&&!p){u(!0),c(void 0);try{await i(a.trim()),o(``)}catch(e){c(e)}finally{u(!1)}}},className:`space-y-3`,children:[(0,W.jsx)(r,{asChild:!0,className:`w-full`,children:(0,W.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(g,{}),` Sign in to `,n]})}),(0,W.jsxs)(E,{children:[(0,W.jsx)(C,{htmlFor:`connection-paste`,children:`Address after signing in`}),(0,W.jsx)(B,{id:`connection-paste`,rows:3,value:a,onChange:e=>o(e.target.value),placeholder:`${t??`http://…/oauth/connections/callback`}?code=…&state=…`,className:`font-mono text-xs break-all`,"aria-invalid":!!p}),(0,W.jsx)(w,{children:`The page won't load, that's expected: copy its whole address from the address bar.`}),p&&(0,W.jsx)(T,{children:p})]}),s!==void 0&&(0,W.jsx)(v,{error:s}),(0,W.jsxs)(r,{type:`submit`,variant:`outline`,className:`w-full`,disabled:!a.trim()||!!p||l,children:[l&&(0,W.jsx)(d,{}),` Finish connecting`]})]})}var X=(e,t=``)=>`/api/connections/${encodeURIComponent(e.id)}${t}`;function Z(e,n={}){let r=n;K({name:e.name,run:async()=>{let n=r??{};return r=null,{connectionId:e.id,result:await t(X(e,`/connect`),{body:n})}}})}function Q(){let[e,t]=(0,U.useState)(null);return{reconnect:e=>e.authType===`header`?t(e):Z(e),dialog:(0,W.jsx)(ce,{connection:e,onClose:()=>t(null)})}}function ce({connection:e,onClose:t}){let[n,i]=(0,U.useState)(`Authorization`),[a,o]=(0,U.useState)(``),s=()=>{o(``),t()};return(0,W.jsx)(F,{open:!!e,onOpenChange:e=>!e&&s(),children:(0,W.jsx)(L,{className:`sm:max-w-md`,children:(0,W.jsxs)(`form`,{onSubmit:r=>{if(r.preventDefault(),!e||!a.trim())return;let i=n.trim()||`Authorization`,s=a.trim();t(),o(``),Z(e,{header:{name:i,value:i.toLowerCase()===`authorization`&&!/^\w+\s/.test(s)?`Bearer ${s}`:s}})},className:`space-y-4`,children:[(0,W.jsxs)(I,{children:[(0,W.jsxs)(R,{children:[`Reconnect `,e?.name]}),(0,W.jsx)(P,{children:`Paste the new API key or token. The old one is replaced.`})]}),(0,W.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[9rem_1fr]`,children:[(0,W.jsxs)(E,{children:[(0,W.jsx)(C,{htmlFor:`reconnect-name`,children:`Header`}),(0,W.jsx)(ie,{id:`reconnect-name`,className:`font-mono`,value:n,onChange:e=>i(e.target.value)})]}),(0,W.jsxs)(E,{children:[(0,W.jsx)(C,{htmlFor:`reconnect-key`,children:`API key or token`}),(0,W.jsx)(ae,{id:`reconnect-key`,autoFocus:!0,autoComplete:`off`,value:a,onChange:e=>o(e.target.value)})]}),(0,W.jsx)(w,{className:`sm:col-span-2`,children:`Stored encrypted; agents never see it.`})]}),(0,W.jsxs)(N,{children:[(0,W.jsx)(r,{type:`button`,variant:`ghost`,onClick:s,children:`Cancel`}),(0,W.jsx)(r,{type:`submit`,disabled:!a.trim(),children:`Reconnect`})]})]})})})}function $(){let e=[l.connections,[`agent-connections`],l.approvals,l.overview],n=z({mutationFn:e=>t(X(e,`/kill`),{body:{}}),invalidate:e,success:(e,t)=>`${t.name} is disabled and signed out`,errorTitle:`Couldn't disable it`}),r=z({mutationFn:e=>t(X(e),{method:`DELETE`}),invalidate:e,success:(e,t)=>`${t.name} is removed`,errorTitle:`Couldn't remove it`}),i=e=>(0,W.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5`,children:[(0,W.jsx)(`li`,{children:`stops every agent from using its tools,`}),(0,W.jsx)(`li`,{children:`cancels its calls waiting for approval,`}),(0,W.jsxs)(`li`,{children:[`signs out of `,e.name,` and deletes the stored credentials.`]})]});return{askDisable:e=>j({title:`Disable ${e.name}?`,destructive:!0,confirmLabel:`Disable now`,description:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:`This is the kill switch. Right away, xaq:`}),i(e),(0,W.jsx)(`p`,{children:`The connection, its access settings and the audit log stay. Reconnect to use it again.`})]}),onConfirm:()=>n.mutateAsync(e)}),askRemove:(e,t)=>j({title:`Remove ${e.name}?`,destructive:!0,confirmLabel:`Remove now`,description:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:`Right away, xaq:`}),i(e),(0,W.jsx)(`p`,{children:`Then the connection and its access settings are deleted. The audit log keeps what happened.`})]}),onConfirm:async()=>{await r.mutateAsync(e),t?.()}})}}function le({connection:e}){let t=m(6e4),n=c(e,t),{askDisable:i,askRemove:a}=$(),{reconnect:o,dialog:l}=Q(),u=e.tools.held;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,W.jsx)(p,{to:`/connections/$connectionId`,params:{connectionId:e.id},className:`truncate font-medium hover:underline`,children:e.name}),(0,W.jsx)(_,{tone:n.tone,children:n.label}),e.privateTarget&&(0,W.jsxs)(h,{variant:`outline`,title:`Allowed on your private network: ${s(e.privateTarget)}`,children:[(0,W.jsx)(x,{}),` Private network`]})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{className:`font-mono`,children:e.slug}),(0,W.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(H,{className:`size-3`}),` `,e.tools.active,` tool`,e.tools.active===1?``:`s`]}),(0,W.jsxs)(`span`,{children:[e.agents,` agent`,e.agents===1?``:`s`]}),e.url&&(0,W.jsx)(`span`,{className:`max-w-64 truncate`,children:e.url})]}),u>0&&(0,W.jsxs)(p,{to:`/connections/$connectionId`,params:{connectionId:e.id},className:`mt-2 flex max-w-3xl items-start gap-1.5 rounded-md bg-warning/[0.08] px-2.5 py-1.5 text-xs text-foreground/90 hover:bg-warning/15`,children:[(0,W.jsx)(O,{className:`mt-px size-3.5 shrink-0 text-warning`}),(0,W.jsxs)(`span`,{children:[e.name,` changed `,u,` tool`,u===1?``:`s`,`. `,u===1?`It's`:`They're`,` on hold until you review the change.`]})]}),n.tone===`bad`&&(0,W.jsxs)(`p`,{className:`mt-2 flex max-w-3xl items-start gap-1.5 rounded-md bg-critical/[0.06] px-2.5 py-1.5 text-xs text-foreground/90`,children:[(0,W.jsx)(O,{className:`mt-px size-3.5 shrink-0 text-critical`}),(0,W.jsx)(`span`,{className:`break-words`,children:n.description})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end sm:self-center`,children:[n.action===`reconnect`&&(0,W.jsxs)(r,{size:`sm`,variant:e.status===`disabled`?`outline`:`default`,onClick:()=>o(e),children:[(0,W.jsx)(k,{}),` Reconnect`]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(te,{asChild:!0,children:(0,W.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${e.name}`,children:(0,W.jsx)(y,{})})}),(0,W.jsxs)(re,{align:`end`,className:`w-48`,children:[(0,W.jsxs)(M,{onSelect:()=>o(e),children:[(0,W.jsx)(k,{}),` Reconnect`]}),e.status!==`disabled`&&(0,W.jsxs)(M,{onSelect:()=>i(e),children:[(0,W.jsx)(S,{}),` Disable…`]}),(0,W.jsx)(ee,{}),(0,W.jsxs)(M,{variant:`destructive`,onSelect:()=>a(e),children:[(0,W.jsx)(b,{}),` Remove…`]})]})]})]}),l]})}export{se as a,Q as i,Z as n,K as o,$ as r,H as s,le as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as e,Ut as t,n}from"./queries-Cv3nXx0U.js";import{t as r}from"./useQuery-MrTwwNy5.js";import{t as i}from"./card-GSO5o-Ug.js";import{I as a,o,s}from"./common-BPZV8TFb.js";import{t as c}from"./plus-B_TUslu3.js";import{t as l}from"./plug-CXAniEiR.js";import{t as u}from"./connection-row-DYx_5o0c.js";import{n as d}from"./add-connection-C8JR-13R.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./empty-DzTDioBP.js";var v=t(),y=({variant:t})=>(0,v.jsxs)(e,{variant:t,onClick:()=>d(),children:[(0,v.jsx)(c,{}),` Add connection`]});function b(){let e=r(n.connections());return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o,{title:`Connections`,description:`MCP servers and apps your agents use through xaq, like Notion. xaq holds every sign-in; agents get the tools you allow.`,actions:(0,v.jsx)(y,{})}),e.isPending?(0,v.jsx)(a,{className:`h-40 rounded-xl`}):e.isError?(0,v.jsx)(s,{error:e.error,onRetry:()=>void e.refetch()}):e.data.length===0?(0,v.jsx)(i,{children:(0,v.jsxs)(_,{children:[(0,v.jsxs)(p,{children:[(0,v.jsx)(f,{variant:`icon`,children:(0,v.jsx)(l,{})}),(0,v.jsx)(h,{children:`No connections yet`}),(0,v.jsx)(g,{children:`Add Notion, WHOOP or any MCP server. Every agent then reaches it through its one xaq connection.`})]}),(0,v.jsx)(m,{children:(0,v.jsx)(y,{variant:`outline`})})]})}):(0,v.jsx)(i,{className:`gap-0 py-0`,children:(0,v.jsx)(`div`,{className:`divide-y`,children:e.data.map(e=>(0,v.jsx)(u,{connection:e},e.id))})})]})}export{b as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ct as t,Ut as n,Wt as r,ft as i}from"./queries-Cv3nXx0U.js";import{t as a}from"./chevron-right-Cqh4mDk1.js";import{Mt as o,jt as s}from"./index-DGzo3kGh.js";function c(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=l(e);if(n.length!==l(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function l(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var u=e(r(),1);function d(e){return f(e)||typeof e==`function`||p(e)}function f(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function p(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function m(e,t){return e==null?null:d(e)?u.createElement(e,t):e}function h(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?m(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:m(n.cell,t.getContext())}return`header`in e&&e.header?m(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?m(e.footer.column.columnDef.footer,e.footer.getContext()):null}function ee(e){let n=t(e.source,e.selector,{compare:c});return typeof e.children==`function`?e.children(n):e.children}function g(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function te(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function _(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function v(){return te({createAtom:o,batch:s})}function y(e,t){return typeof e==`function`?e(t):e}function b(e){if(Array.isArray(e))return e.map(b);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?x():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:b(e[i]),writable:!0})}return n}return e}function x(){return Object.create(null)}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ne(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var re=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u&&(o=l,a?.(),s=e(...l??[]),r?.(s)),s}};function ie(e){let t=!1;return()=>{t?e():t=!0}}function C({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return re({...a,...o})}function w(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function T(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=w(r);t[n]=a?C({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function E(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=w(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=C({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function ae(e){return e.row.getValue(e.column.id)}function oe(e){return e.getValue()??e.table.options.renderFallbackValue}function se(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var ce={assignCellPrototype:(e,t)=>{E(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>ae(e)},cell_renderValue:{fn:e=>oe(e)},cell_getContext:{fn:e=>se(e),memoDeps:e=>[e]}})}};function le(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function ue(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=le(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function D(e){return e.getIsVisible?.()??!0}function de(e){return e.getVisibleLeafColumns?.()??e.getAllLeafColumns()}function O(e,t){let n=e,r=t;return n.getOrderColumnsFn?.()(r)??n._orderGroupedColumns?.(r)??t}function fe(e,t,n,r){return e._orderByColumnPinning?.(t,n,r)??t}function pe(e,t){return e._expandRows?.(t)??t}function me(e){e.autoResetExpanded?.()}function k(e){e.autoResetPageIndex?.()}function A(e){e.autoResetSorting?.()}function j(e){e.autoResetCellSelection?.()}function M(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function N(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return O(e.table,t)}return[e]}function P(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function F(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=ue(e,o,r,n),c=o;s.columns=c.columns?F(e,c.columns,s,r+1):[],i[a]=s}return i}function I(e){return F(e,e.options.columns)}function L(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function R(e){let t=x(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function z(e){return O(e,e.getAllColumns().flatMap(e=>e.getLeafColumns()))}function he(e){let t=x(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function ge(e,t){return e.getAllFlatColumnsById()[t]}var _e={assignColumnPrototype:(e,t)=>{E(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>M(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>N(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{T(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>P(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>I(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>L(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>R(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>z(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>he(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>ge(e,t)}})}};function ve(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function B(e,t,n){let r=ve(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function V(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];D(i)&&i.columns.length&&(n=Math.max(n,V(i.columns,t+1)))}return n}function ye(e,t){return e?`${e}_${t}`:String(t)}function be(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function xe(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function H(e,t,n,r,i,a){let o={depth:t,id:ye(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=B(n,u,{id:be(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(xe(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&H(s,t-1,n,r,i,a)}function U(e){for(let t=0;t<e.length;t++){let n=e[t];if(!D(n.column))continue;let r=0;if(n.subHeaders.length){U(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];D(t.column)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function Se(e,t,n,r){let i=V(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=B(n,t[e],{depth:i,index:e}));return H(s,i-1,n,r,a,o),a.reverse(),U(a[0]?.headers??[]),a}function W(e,t){for(let n=0;n<e.subHeaders.length;n++)W(e.subHeaders[n],t);t.push(e)}function Ce(e){let t=[];return W(e,t),t}function we(e){return{column:e.column,header:e,table:e.column.table}}function Te(e){return Se(e.getAllColumns(),fe(e,de(e),e=>e.id),e)}function Ee(e){return[...e.getHeaderGroups()].reverse()}function De(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function Oe(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var ke={assignHeaderPrototype:(e,t)=>{E(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>Ce(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>we(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{T(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>Te(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>Ee(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>De(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>Oe(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function Ae(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var je=(e,t,n,r,i,a,o)=>{let s=Ae(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=x(),c._valuesCache=x(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c};function Me(){return e=>C({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>Ne(e,e.options.data),onAfterUpdate:ie(()=>{me(e),k(e),A(e),j(e)})})}function G(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=je(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=G(e,t,c.originalSubRows,r+1,c)))}return a}function Ne(e,t){let n={rows:[],flatRows:[],rowsById:x()};return n.rows=G(e,n,t),n}function K(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??Me()(e)),e._rowModels.coreRowModel()}function Pe(e){return e.getCoreRowModel()}function Fe(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function Ie(e){return e.getFilteredRowModel()}function Le(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function Re(e){return e.getGroupedRowModel()}function ze(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function Be(e){return e.getSortedRowModel()}function Ve(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function He(e){return e.getExpandedRowModel()}function Ue(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function We(e){return e.getPaginatedRowModel()}var Ge={constructTableAPIs:e=>{T(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>K(e)},table_getPreFilteredRowModel:{fn:()=>Pe(e)},table_getFilteredRowModel:{fn:()=>Fe(e)},table_getPreGroupedRowModel:{fn:()=>Ie(e)},table_getGroupedRowModel:{fn:()=>Le(e)},table_getPreSortedRowModel:{fn:()=>Re(e)},table_getSortedRowModel:{fn:()=>ze(e)},table_getPreExpandedRowModel:{fn:()=>Be(e)},table_getExpandedRowModel:{fn:()=>Ve(e)},table_getPrePaginatedRowModel:{fn:()=>He(e)},table_getPaginatedRowModel:{fn:()=>Ue(e)},table_getRowModel:{fn:()=>We(e)}})}};function Ke(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function qe(e,t,n){let r=Ke(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Je(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function Ye(e){let t=e.getPrePaginatedRowModel(),n=e.options.paginateExpandedRows===!1?pe(e,t).rows:t.rows;for(let e=0;e<n.length;e++)n[e]._displayIndexCache=e;return n}function Xe(e,t){if(S(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function Ze(e,t){if(S(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function Qe(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function $e(e){return ne(e.subRows,e=>e.subRows)}function et(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function tt(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function nt(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function rt(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=qe(a,e,e.table),n.set(a,o)),r[i]=o}return r}function it(e){let t=x(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function at(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function ot(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var st={assignRowPrototype:(e,t)=>{E(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Je(e)},row_getAllCellsByColumnId:{fn:e=>it(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>rt(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>$e(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>tt(e)},row_getParentRows:{fn:e=>nt(e)},row_getUniqueValues:{fn:(e,t)=>Ze(e,t)},row_getValue:{fn:(e,t)=>Xe(e,t)},row_renderValue:{fn:(e,t)=>Qe(e,t)}})},constructTableAPIs:e=>{T(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>Ye(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>at(t,e,n,r)},table_getRow:{fn:(t,n)=>ot(e,t,n)},table_getMaxSubRowDepth:{fn:()=>et(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function q(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function J(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{q(e,t,n),e._reactivity.commit?.()})}function ct(e){let t=b(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function lt(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function Y(e,t,n){let r=lt(e,y(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&J(e,r.state??null)}var ut={coreCellsFeature:ce,coreColumnsFeature:_e,coreHeadersFeature:ke,coreRowModelsFeature:Ge,coreRowsFeature:st,coreTablesFeature:{constructTableAPIs:e=>{T(`coreTablesFeature`,e,{table_reset:{fn:()=>ct(e)},table_setOptions:{fn:t=>Y(e,t)}})}}};function dt(){return{accessor:(e,t)=>typeof e==`function`?{...t,accessorFn:e}:{...t,accessorKey:e},columns:e=>e,display:e=>e,group:e=>e}}function ft(e){return e}function pt(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),b(t)}function mt(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:l,filterFns:u,filterMeta:d,filteredRowModel:f,groupedRowModel:p,paginatedRowModel:m,sortFns:h,sortedRowModel:ee,tableMeta:te,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...ut,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:u,sortFns:h},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=pt(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&S(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}q(v),v.store=g(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:c,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}var ht=typeof window>`u`?u.useEffect:u.useLayoutEffect;function gt(e,n){let[{table:r,rootSource:i}]=(0,u.useState)(()=>{let t=mt({...e,features:{coreReactivityFeature:v(),...e.features}});return t.Subscribe=(e=>ee({...e,source:e.source??t.store})),t.FlexRender=h,{table:t,rootSource:_(t.store,c)}}),a=r;Y(a,t=>({...t,...e}),{syncExternalState:!1});let o=a.options.state,s=i.get(),l=t(i,n,{compare:c});return ht(()=>{i.markCommitted(s),J(a,o??null,c)}),(0,u.useMemo)(()=>({...r,options:e,state:l}),[r,e,l])}var X=n();function _t({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,X.jsx)(`table`,{"data-slot":`table`,className:i(`w-full caption-bottom text-sm`,e),...t})})}function vt({className:e,...t}){return(0,X.jsx)(`thead`,{"data-slot":`table-header`,className:i(`[&_tr]:border-b`,e),...t})}function yt({className:e,...t}){return(0,X.jsx)(`tbody`,{"data-slot":`table-body`,className:i(`[&_tr:last-child]:border-0`,e),...t})}function Z({className:e,...t}){return(0,X.jsx)(`tr`,{"data-slot":`table-row`,className:i(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function Q({className:e,...t}){return(0,X.jsx)(`th`,{"data-slot":`table-head`,className:i(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function $({className:e,...t}){return(0,X.jsx)(`td`,{"data-slot":`table-cell`,className:i(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}var bt=ft({columnMeta:{}}),xt=()=>dt();function St({columns:e,data:t,getRowId:n,renderExpanded:r,rowClassName:o,empty:s,className:c}){let l=gt({features:bt,columns:e,data:t,getRowId:e=>n(e)}),[d,f]=(0,u.useState)(()=>new Set),p=e=>f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m=e.length+ +!!r,h=l.getRowModel().rows;return(0,X.jsx)(`div`,{className:i(`overflow-hidden rounded-xl border`,c),children:(0,X.jsxs)(_t,{children:[(0,X.jsx)(vt,{className:`bg-muted/40`,children:l.getHeaderGroups().map(e=>(0,X.jsxs)(Z,{className:`hover:bg-transparent`,children:[r&&(0,X.jsx)(Q,{className:`w-8 pr-0`,"aria-label":`Expand`}),e.headers.map(e=>(0,X.jsx)(Q,{className:i(`text-xs`,e.column.columnDef.meta?.className),children:e.isPlaceholder?null:(0,X.jsx)(l.FlexRender,{header:e})},e.id))]},e.id))}),(0,X.jsxs)(yt,{children:[h.length===0&&(0,X.jsx)(Z,{className:`hover:bg-transparent`,children:(0,X.jsx)($,{colSpan:m,className:`h-32 text-center text-sm whitespace-normal text-muted-foreground`,children:s??`Nothing here.`})}),h.map(e=>{let t=d.has(e.id);return(0,X.jsxs)(u.Fragment,{children:[(0,X.jsxs)(Z,{"data-state":t?`selected`:void 0,className:i(r&&`cursor-pointer`,o?.(e.original)),onClick:r?t=>{t.target.closest(`button, a, input, [role=switch]`)||p(e.id)}:void 0,children:[r&&(0,X.jsx)($,{className:`w-8 pr-0`,children:(0,X.jsx)(`button`,{type:`button`,className:`flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,"aria-expanded":t,"aria-label":t?`Hide details`:`Show details`,onClick:()=>p(e.id),children:(0,X.jsx)(a,{className:i(`size-4 transition-transform`,t&&`rotate-90`)})})}),e.getAllCells().map(e=>(0,X.jsx)($,{className:e.column.columnDef.meta?.className,children:(0,X.jsx)(l.FlexRender,{cell:e})},e.id))]}),t&&r&&(0,X.jsx)(Z,{className:`bg-muted/20 hover:bg-muted/20`,children:(0,X.jsx)($,{colSpan:m,className:`p-0 whitespace-normal`,children:(0,X.jsx)(`div`,{className:`p-4`,children:r(e.original)})})})]},e.id)})]})]})})}export{xt as n,St as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ut as e,ft as t,pt as n}from"./queries-Cv3nXx0U.js";var r=e();function i({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`empty`,className:t(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...n})}function a({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`empty-header`,className:t(`flex max-w-sm flex-col items-center gap-2`,e),...n})}var o=n(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function s({className:e,variant:n=`default`,...i}){return(0,r.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":n,className:t(o({variant:n,className:e})),...i})}function c({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`empty-title`,className:t(`font-heading text-sm font-medium tracking-tight`,e),...n})}function l({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`empty-description`,className:t(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...n})}function u({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`empty-content`,className:t(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,e),...n})}export{s as a,a as i,u as n,c as o,l as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{N as t,Ut as n,Wt as r,bt as i,n as a,w as o}from"./queries-Cv3nXx0U.js";import{t as s}from"./useQuery-MrTwwNy5.js";import{t as c}from"./useInfiniteQuery-DJLIM8yJ.js";import{t as l}from"./activity-DOIe7SAg.js";import{n as u,t as d}from"./test-email-button-DYi7V_6X.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./select-Bb806bpq.js";import{t as y}from"./card-GSO5o-Ug.js";import{I as b,o as x,s as S,u as C}from"./common-BPZV8TFb.js";import{t as w}from"./pause-o-dK3khK.js";import{t as T}from"./play-DvCHND93.js";import{B as E,J as D,U as O,V as k}from"./index-DGzo3kGh.js";import{n as ee,r as te}from"./stream-Du7fY5_Y.js";import{a as ne,i as A,n as j,o as M,r as N,t as P}from"./empty-DzTDioBP.js";import{u as F}from"./labels-B5UqVwFo.js";var I=e(r()),L=n(),R=500,z=[{label:`Mail and account`,types:O.filter(e=>!D(e))},{label:`Calendar`,types:k}];function B(){let{accountId:e,type:n}=E.useSearch(),r=i({from:E.fullPath}),D=s(a.accounts());s({...a.agents(),refetchInterval:3e4});let O=c(a.eventHistory({accountId:e,type:n})),k=te(),[B,V]=(0,I.useState)([]),[H,U]=(0,I.useState)([]),[W,G]=(0,I.useState)(!1),[K,q]=(0,I.useState)(()=>new Set);ee(e=>{e.kind===`event`&&(W?U(t=>[e.data,...t].slice(0,R)):(V(t=>[e.data,...t].slice(0,R)),q(t=>new Set(t).add(e.data.id))))});let J=()=>{V(e=>[...H,...e].slice(0,R)),q(new Set(H.map(e=>e.id))),U([]),G(!1)},Y=t=>(!e||t.accountId===e)&&(!n||t.type===n),X=new Set,Z=[...B.filter(Y),...O.data?.pages.flatMap(e=>e.items)??[]].filter(e=>!X.has(e.id)&&(X.add(e.id),!0)).sort((e,t)=>t.seq-e.seq),Q=H.filter(Y).length,$=!!(e||n);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(x,{title:`Live events`,description:`Mail and calendar activity across your accounts as xaq sees it: what listeners, webhooks and wait_for_events deliver to agents.`,actions:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(C,{tone:W?`idle`:k===`open`?`good`:`warn`,pulse:!W&&k===`open`}),W?`Paused`:k===`open`?`Streaming`:`Reconnecting…`]}),W?(0,L.jsxs)(t,{variant:`outline`,onClick:J,children:[(0,L.jsx)(T,{}),` Resume`,Q>0&&` (${Q} new)`]}):(0,L.jsxs)(t,{variant:`outline`,onClick:()=>G(!0),children:[(0,L.jsx)(w,{}),` Pause`]})]})}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(v,{value:e??`all`,onValueChange:e=>void r({search:t=>({...t,accountId:e===`all`?void 0:e}),replace:!0}),children:[(0,L.jsx)(h,{className:`w-full sm:w-64`,"aria-label":`Account`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(m,{children:[(0,L.jsx)(p,{value:`all`,children:`All accounts`}),D.data?.map(e=>(0,L.jsx)(p,{value:e.id,children:e.email},e.id))]})]}),(0,L.jsxs)(v,{value:n??`all`,onValueChange:e=>void r({search:t=>({...t,type:e===`all`?void 0:e}),replace:!0}),children:[(0,L.jsx)(h,{className:`w-full sm:w-56`,"aria-label":`Event type`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(m,{children:[(0,L.jsx)(p,{value:`all`,children:`All event types`}),z.map(e=>(0,L.jsxs)(g,{children:[(0,L.jsx)(f,{children:e.label}),e.types.map(e=>(0,L.jsx)(p,{value:e,children:F[e]?.label??e},e))]},e.label))]})]}),$&&(0,L.jsx)(t,{variant:`ghost`,onClick:()=>void r({search:{},replace:!0}),children:`Clear filters`})]}),O.isPending?(0,L.jsx)(y,{className:`gap-0 divide-y py-0`,children:Array.from({length:6},(e,t)=>(0,L.jsxs)(`div`,{className:`flex gap-3 p-4`,children:[(0,L.jsx)(b,{className:`size-8`}),(0,L.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,L.jsx)(b,{className:`h-3 w-40`}),(0,L.jsx)(b,{className:`h-4 w-3/4`})]})]},t))}):O.isError?(0,L.jsx)(S,{error:O.error,onRetry:()=>void O.refetch()}):Z.length===0?(0,L.jsx)(y,{children:(0,L.jsxs)(P,{children:[(0,L.jsxs)(A,{children:[(0,L.jsx)(ne,{variant:`icon`,children:(0,L.jsx)(l,{})}),(0,L.jsx)(M,{children:$?`No events match these filters`:`No events yet`}),(0,L.jsx)(N,{children:$?`Try another account or event type.`:`Events appear here live as mail arrives, is sent or relabeled, and as calendar events change.`})]}),!$&&(0,L.jsx)(j,{children:(0,L.jsx)(d,{accounts:D.data??[]})})]})}):(0,L.jsx)(y,{className:`gap-0 py-0`,children:(0,L.jsx)(`ul`,{className:`divide-y`,"aria-live":`polite`,"aria-relevant":`additions`,children:Z.map(e=>(0,L.jsx)(u,{event:e,fresh:K.has(e.id)},e.id))})}),O.hasNextPage&&(0,L.jsx)(`div`,{className:`flex justify-center`,children:(0,L.jsxs)(t,{variant:`outline`,onClick:()=>void O.fetchNextPage(),disabled:O.isFetchingNextPage,children:[O.isFetchingNextPage&&(0,L.jsx)(o,{}),` Load older events`]})})]})}export{B as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_t as e}from"./queries-Cv3nXx0U.js";var t={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ut as t,Wt as n,at as r,ft as i,pt as a}from"./queries-Cv3nXx0U.js";var o=e(n(),1),s=t(),c=Object.defineProperty,l=o.forwardRef(((e,t)=>c(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,s.jsx)(r.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),u=Object.defineProperty,d=(e,t)=>u(e,`name`,{value:t,configurable:!0}),f={Horizontal:`horizontal`,Vertical:`vertical`},p=f.Horizontal,m=Object.values(f),h=o.forwardRef(d(function(e,t){let{decorative:n,orientation:i=p,...a}=e,o=g(i)?i:p,c=o===f.Vertical?o:void 0,l=n?{role:`none`}:{"aria-orientation":c,role:`separator`};return(0,s.jsx)(r.div,{"data-orientation":o,...l,...a,ref:t})},`Separator`));function g(e){return m.includes(e)}d(g,`isValidOrientation`);function _({className:e,...t}){return(0,s.jsx)(l,{"data-slot":`label`,className:i(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function v({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,s.jsx)(h,{"data-slot":`separator`,decorative:n,orientation:t,className:i(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function y({className:e,...t}){return(0,s.jsx)(`fieldset`,{"data-slot":`field-set`,className:i(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function b({className:e,variant:t=`legend`,...n}){return(0,s.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:i(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function x({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`field-group`,className:i(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var S=a(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function C({className:e,orientation:t=`vertical`,...n}){return(0,s.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:i(S({orientation:t}),e),...n})}function w({className:e,...t}){return(0,s.jsx)(_,{"data-slot":`field-label`,className:i(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function T({className:e,...t}){return(0,s.jsx)(`p`,{"data-slot":`field-description`,className:i(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function E({className:e,children:t,errors:n,...r}){let a=(0,o.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,s.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,s.jsx)(`li`,{children:e.message},t))})},[t,n]);return a?(0,s.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:i(`text-sm font-normal text-destructive`,e),...r,children:a}):null}export{w as a,v as c,x as i,_ as l,T as n,b as o,E as r,y as s,C as t};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{D as t,Ht as n,M as r,N as i,O as a,Ut as o,Wt as s,_t as c,bt as l,ft as u,n as d,t as f,w as p,yt as m}from"./queries-Cv3nXx0U.js";import{t as h}from"./useQuery-MrTwwNy5.js";import{t as g}from"./arrow-right-C2zcqRr2.js";import{l as _}from"./pairing-XjuaVr2u.js";import{c as v,i as y,o as ee,s as te,t as ne}from"./connect-agent-guide-CJdw31p2.js";import{t as b}from"./bot-Zk76q_39.js";import{t as re}from"./calendar-plus-Cycfkk0y.js";import{n as ie,t as x}from"./listener-handled-HNCuVrQ7.js";import{c as S,i as C,n as ae,o as w,s as oe,t as T}from"./select-Bb806bpq.js";import{c as E,d as D,l as O,r as se,t as ce,u as k}from"./card-GSO5o-Ug.js";import{a as le,c as ue,i as de,l as A,o as fe,r as pe,s as me,t as he,u as ge}from"./step-url-51aMNak-.js";import{F as _e,I as j,L as ve,a as ye,d as M,i as be,n as xe,o as Se,s as Ce,t as we}from"./common-BPZV8TFb.js";import{n as Te}from"./shield-check-BulpsYqK.js";import{n as Ee,t as De}from"./send-DuMVuYs1.js";import{r as Oe,t as ke}from"./accounts-list-YfJzThZa.js";import{t as Ae}from"./mail-C5fm2pTC.js";import{a as N,c as je,d as P,f as F,h as Me,i as Ne,l as Pe,m as I,n as Fe,o as Ie,p as L,r as Le,u as Re}from"./connect-host-lr2c3xWh.js";import{t as ze}from"./plus-B_TUslu3.js";import{t as Be}from"./rotate-ccw-B-mzPDk0.js";import{t as Ve}from"./connection-row-DYx_5o0c.js";import{t as He}from"./checkbox-B937U-Fd.js";import{l as Ue}from"./field-C6ejurju.js";import{t as We}from"./choice-cards-CgAIqBGX.js";import{n as Ge}from"./chips-input-2xWDofmE.js";import{Dt as Ke,Et as qe,F as Je,L as Ye,M as Xe,Ot as R,R as Ze,_ as Qe,b as $e,c as et,d as z,f as B,g as tt,h as nt,j as rt,kt as it,l as V,m as at,s as H,u as U,v as ot,x as W,z as st}from"./index-DGzo3kGh.js";import{t as G}from"./mutations-CLPqJ6cj.js";import{i as ct,r as lt}from"./calendar-setup-Pn61Wj1n.js";import{n as ut}from"./add-connection-C8JR-13R.js";import{m as dt}from"./labels-B5UqVwFo.js";import{i as ft,r as pt,t as mt}from"./last-call-D-O5O94z.js";import{t as ht}from"./use-delivery-speed-BBh7W2q6.js";import{n as K}from"./hidden-chars-Dr9TxfvF.js";import{t as q}from"./command-khhto70y.js";import{t as gt}from"./agent-create-form-CPxnPYH4.js";var _t={name:`building`,size:24,node:[[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M12 6h.01`,key:`1vi96p`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M16 6h.01`,key:`1x0f13`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M8 6h.01`,key:`1dz90k`}],[`path`,{d:`M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`,key:`cabbwy`}],[`rect`,{x:`4`,y:`2`,width:`16`,height:`20`,rx:`2`,key:`1uxh74`}]]};_t.node;var vt=c(_t),yt={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};yt.node;var bt=c(yt),xt={name:`heart-pulse`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]};xt.node;var St=c(xt),Ct={name:`notebook`,size:24,node:[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M16 2v20`,key:`rotuqe`}]]};Ct.node;var wt=c(Ct),Tt={name:`party-popper`,size:24,node:[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]};Tt.node;var Et=c(Tt),J=e(s(),1),Y=o(),Dt={notion:wt,whoop:St,custom:Te,google:ie};function Ot({onChosen:e}){let[t,n]=(0,J.useState)();return(0,Y.jsxs)(ce,{className:`gap-0 py-0`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1.5 border-b p-5 sm:p-6`,children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:`What do you want to connect first?`}),(0,Y.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:`You can add the others any time. Only Gmail & Calendar needs a Google Cloud project.`})]}),(0,Y.jsx)(se,{className:`p-5 sm:p-6`,children:(0,Y.jsx)(We,{"aria-label":`What to connect first`,value:t,onChange:n,columns:2,choices:Ye.map(e=>({value:e,title:Ze[e].title,description:Ze[e].description,icon:Dt[e]}))})}),(0,Y.jsx)(`div`,{className:`flex justify-end border-t bg-muted/20 p-4 sm:px-6`,children:(0,Y.jsxs)(i,{disabled:!t,onClick:()=>{t&&(V({firstConnect:t}),e(t))},children:[`Continue `,(0,Y.jsx)(g,{})]})})]})}function kt({choice:e,onNext:t}){let n=h(d.connections()),r=(n.data?.length??0)>0,a=Ze[e];return(0,Y.jsx)(L,{index:0,total:2,title:e===`custom`?`Add your MCP server`:`Connect ${a.title}`,description:`xaq keeps the sign-in. You choose what agents may do with it; risky actions ask you first by default.`,footer:(0,Y.jsx)(I,{onNext:t,nextDisabled:!r,nextVariant:r?`default`:`outline`,hint:r?void 0:`Add a connection to continue`,extra:(0,Y.jsx)(i,{variant:`ghost`,onClick:()=>V({firstConnect:void 0}),children:`Connect something else`})}),children:r?(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`div`,{className:`divide-y rounded-lg border`,children:n.data.map(e=>(0,Y.jsx)(Ve,{connection:e},e.id))}),(0,Y.jsxs)(i,{variant:`outline`,size:`sm`,onClick:()=>ut(),children:[(0,Y.jsx)(ze,{}),` Add another`]})]}):(0,Y.jsxs)(i,{size:`lg`,onClick:()=>ut({start:a.presetId??`custom`,onDone:()=>t()}),children:[(0,Y.jsx)(ze,{}),` `,e===`custom`?`Add a server`:`Connect ${a.title}`]})})}var At={error:D,warning:qe,info:R},jt={error:`destructive`,warning:`warning`,info:`info`},Mt=[`the OAuth app was still in Testing (Google ends sign-ins after 7 days)`,`the account's password changed`,`access was removed at myaccount.google.com/connections`,`it wasn't used for 6 months`,`a Google Workspace session policy ended it`];function Nt({filter:e,className:n}){let r=h(d.setupState()),a=h(d.accounts()),o=h(d.googleClient()),s=G({mutationFn:({v:e,appType:n})=>t(`/api/google/client`,{method:`PUT`,body:{clientId:e.clientId,projectId:e.projectId??``,appType:n}}),invalidate:[f.googleClient,f.setupState],success:(e,{appType:t})=>`Audience set to ${t===`internal`?`Internal`:`External`}`,errorTitle:`Couldn't change the audience`,onSuccess:(e,{appType:t})=>V({appType:t,productionConfirmed:t!==`external`&&void 0})}),c=G({mutationFn:()=>t(`/api/google/calendar/check`,{method:`POST`}),invalidate:[f.setupState,f.calendarSetup,f.accounts],success:e=>e.api===`disabled`?`Google still says the Calendar API is off`:`The Calendar API is on`,errorTitle:`Couldn't check Google Calendar`}),l=(r.data?.warnings??[]).filter(t=>!e||e(t));return l.length?(0,Y.jsx)(`div`,{className:n?`space-y-3 ${n}`:`space-y-3`,children:l.map((e,t)=>{let n=At[e.severity],r=e.accountId?a.data?.find(t=>t.id===e.accountId):void 0,l=r&&(e.code===`testing_mode`||e.code===`sign_in_expires`||e.code===`needs_reauth`),u=Pt(e,r,()=>c.mutate()),d=e.code===`app_type_mismatch`&&o.data?.clientId?o.data.appType===`internal`?`external`:`internal`:null;return(0,Y.jsxs)(E,{variant:jt[e.severity],children:[(0,Y.jsx)(n,{}),(0,Y.jsx)(k,{children:e.message}),(0,Y.jsxs)(O,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{children:e.hint}),e.code===`needs_reauth`&&(0,Y.jsxs)(`p`,{className:`text-xs`,children:[`Common causes: `,Mt.join(`; `),`.`]}),(e.url||l||d||u)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.url&&(0,Y.jsx)(ye,{href:e.url,children:e.code===`testing_mode`||e.code===`app_type_mismatch`?`Open Audience in Google Cloud`:e.code===`calendar_api_disabled`?`Enable the Calendar API`:`Open in Google Cloud`}),l&&(0,Y.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>Fe({reauthAccountId:r.id,email:r.email}),children:[(0,Y.jsx)(Ke,{}),` Reconnect `,r.email]}),u&&(0,Y.jsxs)(i,{size:`sm`,variant:`outline`,onClick:u.run,children:[e.code===`calendar_api_disabled`?(0,Y.jsx)(Ke,{}):(0,Y.jsx)(re,{}),` `,u.label]}),d&&e.severity!==`info`&&(0,Y.jsxs)(i,{size:`sm`,variant:`outline`,disabled:s.isPending,onClick:()=>s.mutate({v:o.data,appType:d}),children:[`Set the audience to `,d===`external`?`External`:`Internal`,` here`]})]})]})]},`${e.code}-${e.accountId??t}`)})}):null}function Pt(e,t,n){switch(e.code){case`calendar_not_added`:return{label:`Add Google Calendar`,run:()=>ct()};case`calendar_scope_missing`:return t?{label:`Add Calendar to ${t.email}`,run:()=>lt(t)}:null;case`calendar_api_disabled`:return{label:`Check again`,run:n};default:return null}}var Ft=new Set([`testing_mode`,`sign_in_expires`,`needs_reauth`,`app_type_mismatch`,`calendar_api_disabled`,`calendar_scope_missing`,`calendar_sync_failing`]);function It({index:e,onBack:t,onNext:n}){let r=h(d.accounts()),a=h(d.googleClient()),o=r.data?.length??0,s=a.data?.callbackMode===`paste`,c=a.data?.appType===`internal`,l=h({...d.calendarSetup(),retry:!1}),u=l.data?.enabled??!1;return(0,Y.jsxs)(L,{index:e,title:B.accounts.title,description:u?`Sign in with Google for each mailbox your agents should work with: one sign-in covers its Gmail and Google Calendar. xaq keeps the sign-in; agents never see it.`:`Sign in with Google for each mailbox your agents should work with. xaq keeps the sign-in; agents never see it.`,footer:(0,Y.jsx)(I,{onBack:t,onNext:n,nextDisabled:o===0,nextVariant:o===0?`outline`:`default`,hint:o===0?`Connect at least one account`:void 0,extra:o>0&&(0,Y.jsxs)(i,{variant:`outline`,onClick:()=>Fe(),children:[(0,Y.jsx)(Oe,{}),` Connect another`]})}),children:[(0,Y.jsx)(ue,{}),(0,Y.jsx)(Nt,{filter:e=>Ft.has(e.code)}),o===0&&(0,Y.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-dashed p-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`A Google window opens. What you'll see there:`}),(0,Y.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-muted-foreground`,children:[(0,Y.jsxs)(`li`,{children:[`Choose the account`,c?` (only accounts in your Google Workspace organization can connect)`:``,`. Shared addresses like groups or aliases can't sign in.`]}),!c&&(0,Y.jsxs)(`li`,{children:[`“Google hasn't verified this app”: expected for your own app. Click `,(0,Y.jsx)(F,{items:[`Advanced`,`Go to xaq (unsafe)`]}),`.`]}),u?(0,Y.jsxs)(`li`,{children:[`A list of permissions, each with its own checkbox: Gmail, then three for Google Calendar (events, calendar list, free/busy). Click`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Select all`}),` (or tick each), then `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Continue`}),`. Gmail is required; if Calendar is unticked, mail still works and you can add Calendar later.`]}):(0,Y.jsxs)(`li`,{children:[`Tick the Gmail box (or `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Select all`}),`), then `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Continue`}),`.`]}),(0,Y.jsx)(`li`,{children:s?`The window lands on a localhost page that may not load: copy its address and paste it into xaq (the dialog walks you through it).`:`The window closes and the account shows up here as Active.`})]})]}),(0,Y.jsxs)(i,{onClick:()=>Fe(),children:[(0,Y.jsx)(Oe,{}),` Connect a Google account`]})]}),l.data&&(0,Y.jsx)(Lt,{setup:l.data}),o>0&&(0,Y.jsx)(ke,{}),(0,Y.jsx)(Le,{})]})}function Lt({setup:e}){let r=n(),i=G({mutationFn:e=>t(`/api/google/calendar`,{method:`PATCH`,body:{enabled:e}}),invalidate:[f.setupState],errorTitle:`Couldn't change the Calendar setting`,onSuccess:e=>r.setQueryData(f.calendarSetup,e)}),a=i.isPending?!!i.variables:e.enabled;return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border p-3`,children:[(0,Y.jsx)(Ge,{id:`connect-calendar`,checked:a,disabled:i.isPending,onCheckedChange:e=>i.mutate(e),className:`mt-0.5`}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(Ue,{htmlFor:`connect-calendar`,children:`Also add Google Calendar`}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a?`Connecting asks for Gmail and Calendar in one sign-in. Agents get Calendar only once you add it to their access.`:`Off: connecting asks for Gmail only. Add Google Calendar later from Settings or Accounts; mail is never interrupted.`,` `,`Turn it off if your Google Workspace admin blocks Calendar for this app.`]})]})]})}var Rt=`xaq test: your setup works`,zt=new Set([`search_threads`,`get_thread`,`get_message`,`list_events`,`wait_for_events`]);function Bt(e,t){return e&&t-Date.parse(e.sentAt)<36e5?e:void 0}function Vt({test:e,events:t,listeners:n,calls:r,skipListen:i}){if(!e)return{sent:!1,received:void 0,delivered:!1,resendForListener:!1,readIt:!1,typesExcludeIt:null};let a=t.filter(t=>t.accountId===e.accountId&&(t.message?.id===e.messageId||t.message?.subject===`xaq test: your setup works`&&t.createdAt>=e.sentAt)),o=a.find(e=>e.type===`message.received`)??a[0],s=new Set(e.listenersAtSend??[]),c=!!o&&n.some(e=>s.has(e.consumer)&&x(e,o)),l=n.filter(e=>s.has(e.consumer));return{typesExcludeIt:o?.type===`message.received`&&!c&&l.length>0&&l.every(e=>e.types&&!e.types.includes(o.type))?[...new Set(l.flatMap(e=>e.types??[]))].sort():null,sent:!0,received:o,delivered:c,resendForListener:!!o&&!i&&!c&&!n.some(e=>s.has(e.consumer)&&e.connected)&&n.some(e=>e.connected),readIt:r.some(t=>t.outcome===`ok`&&zt.has(t.action)&&t.ts>=e.sentAt)}}function Ht({mcpDone:e,listenDone:t,skipListen:n,sent:r,received:i,delivered:a}){return e&&(t||n)&&r&&i&&(a||n)}function Ut(e,t){return e&&!t?`complete`:`checks`}function Wt(e,t){return e||t?{nextDisabled:!1,hint:null,skip:!1}:{nextDisabled:!0,hint:`Finish turns on when every check is green`,skip:!0}}function Gt({serverVerified:e,test:t,calls:n,connectedAt:r,listeners:i,skipListen:a,verifiedBy:o}){let s=[];o===`checks`&&s.push({id:`checked`});let c=n.find(e=>e.outcome===`ok`);(c||r)&&s.push({id:`mcp`,at:c?.ts??r,action:c?.action??null});let l=i.find(e=>e.connected)??[...i].sort((e,t)=>(t.lastSeenAt??``).localeCompare(e.lastSeenAt??``))[0];return l?s.push({id:`listener`,connected:l.connected,hostname:l.client.hostname??null,at:l.lastSeenAt}):a&&s.push({id:`mcpOnly`}),t&&s.push({id:`test`,at:t.sentAt}),o===`skip`?s.push({id:`skipped`}):!o&&!e&&s.push({id:`unchecked`}),s}var Kt=`xaq.verify:${typeof window>`u`?``:window.location.host}`,qt=new Set,X=null;function Jt(){if(X)return X;try{X=JSON.parse(localStorage.getItem(Kt)??`{}`)}catch{X={}}return X}function Z(e){X={...Jt(),...e};try{localStorage.setItem(Kt,JSON.stringify(X))}catch{}for(let e of qt)e()}function Yt(e){Z({agentId:e,skipListen:void 0,test:void 0})}function Xt(){return(0,J.useSyncExternalStore)(e=>(qt.add(e),()=>qt.delete(e)),Jt)}function Zt(e){let[t,n]=(0,J.useState)(e);return e&&!t&&n(!0),t||e}function Qt({index:e,onBack:t,onNext:n}){let r=h({...d.agents(),refetchInterval:3e4}),i=Xt(),a=r.data??[],o=a.find(e=>e.id===i.agentId)??[...a].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0],s=U(),c=s.statuses.verify===`done`,[l]=(0,J.useState)(c),[u,f]=(0,J.useState)(!1),p=Ut(l,u),m=Qe(s.statuses);return(0,Y.jsx)(L,{index:e,title:`Check that it works`,description:p===`complete`?m.nextStep?`This check is done. Here's what was checked.`:`Setup is complete. Here's what was checked and what to do next.`:`Each line turns green on its own as your agent connects. Then send a test email and watch it arrive.`,footer:(0,Y.jsx)(rn,{agent:o,stepDone:c,onBack:t,onFinish:()=>{et().verified||V({verified:!0}),n()},onSkip:()=>{V(at(et())),n()}}),children:r.isPending?(0,Y.jsx)(j,{className:`h-72 rounded-xl`}):r.isError?(0,Y.jsx)(be,{error:r.error,title:`Couldn't load your agents`}):p===`complete`&&o?(0,Y.jsx)(un,{agent:o,state:i,serverVerified:!!s.state?.verified,verifiedBy:s.draft.verifiedBy,onRunAgain:()=>{Z({test:void 0}),f(!0)}},o.id):o?(0,Y.jsxs)(Y.Fragment,{children:[a.length>1&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`verify-agent`,className:`text-muted-foreground`,children:`Checking`}),(0,Y.jsxs)(T,{value:o.id,onValueChange:e=>Yt(e),children:[(0,Y.jsx)(w,{id:`verify-agent`,className:`w-auto min-w-48`,children:(0,Y.jsx)(oe,{})}),(0,Y.jsx)(ae,{children:a.map(e=>(0,Y.jsx)(C,{value:e.id,children:e.name},e.id))})]})]}),u&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(R,{className:`mt-0.5 size-4 shrink-0`}),`This step stays done whatever these checks show.`]}),(0,Y.jsx)(on,{agent:o,state:i,severalAgents:a.length>1},o.id)]}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed p-4 text-sm text-muted-foreground`,children:[`No agent yet. Go back one step, run `,(0,Y.jsx)(`code`,{className:`font-mono text-foreground`,children:`connect`}),` and approve the request.`]})})}var $t=new Set,en=null;function tn(e){if(en!==e){en=e;for(let e of $t)e()}}var nn=()=>(0,J.useSyncExternalStore)(e=>($t.add(e),()=>$t.delete(e)),()=>en);function rn({agent:e,stepDone:t,onBack:n,onFinish:r,onSkip:a}){let o=Wt(t,nn()===e?.id&&!!e);return(0,Y.jsx)(I,{onBack:n,onNext:r,nextLabel:`Finish setup`,nextDisabled:o.nextDisabled,hint:o.hint??void 0,extra:o.skip&&(0,Y.jsx)(i,{variant:`ghost`,onClick:a,children:`Finish without checking`})})}function Q({state:e,title:t,detail:n,children:r,optional:i}){return(0,Y.jsxs)(`li`,{className:`relative grid grid-cols-[1.5rem_1fr] gap-x-3 pb-5 last:pb-0`,children:[(0,Y.jsx)(`span`,{className:`absolute top-7 bottom-0 left-3 w-px bg-border [li:last-child>&]:hidden`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`relative flex size-6 items-center justify-center bg-card`,children:e===`done`?(0,Y.jsx)(it,{className:`size-5 text-success`}):e===`current`?(0,Y.jsx)(p,{className:`size-5 text-chart-1`,"aria-hidden":!0}):(0,Y.jsx)(bt,{className:u(`size-5`,e===`skipped`?`text-muted-foreground/40`:`text-muted-foreground`)})}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-2 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`text-sm`,children:[(0,Y.jsx)(`span`,{className:u(`font-medium`,(e===`todo`||e===`skipped`)&&`text-muted-foreground`),children:t}),(0,Y.jsxs)(`span`,{className:`sr-only`,children:[` (`,e===`current`?`waiting`:e===`todo`?`not yet`:e,`)`]}),i&&e!==`done`&&(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` (optional)`})]}),n&&(0,Y.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:n}),r&&(0,Y.jsx)(`div`,{className:`space-y-2`,children:r})]})]})}function an({text:e,label:t}){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border bg-background py-1 pr-1 pl-3`,children:[(0,Y.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm break-words text-foreground`,children:[`“`,e,`”`]}),(0,Y.jsx)(xe,{value:e,label:`Copy ${t}`})]})}function on({agent:e,state:t,severalAgents:n}){let r=pt(e),{publicUrl:o}=te(),s=r.tool??`other`,c=r.tool?ee(r.tool):e.name,l=c[0].toUpperCase()+c.slice(1),u=rt(o,s),d=ft(e,{since:e.createdAt}),p=mt(d.calls,dt),g=_e(6e4),v=Bt(t.test,g),ne=r.paired,b=!!t.skipListen||r.known&&!ne,re=h({queryKey:[...f.events,`verify`,v?.accountId??``],queryFn:()=>a(`/api/events`,{accountId:v.accountId}),enabled:!!v,refetchInterval:3e4}),ie=e.listeners.find(e=>e.connected)??e.listeners[0],x=Zt(!!d.seenAt),S=Zt(e.listeners.some(e=>e.connected)),{sent:C,received:ae,delivered:w,resendForListener:oe,readIt:T,typesExcludeIt:E}=Vt({test:v,events:re.data?.items??[],listeners:e.listeners,calls:d.calls,skipListen:b}),D=!!ae,O=Ht({mcpDone:x,listenDone:S,skipListen:b,sent:C,received:D,delivered:w});(0,J.useEffect)(()=>(tn(O?e.id:null),()=>tn(null)),[O,e.id]),(0,J.useEffect)(()=>{let e=tt(O,et());e&&V(e)},[O]);let[se,ce]=(0,J.useState)(``),k=(0,J.useRef)({mcpDone:x,listenDone:S,receivedDone:D,delivered:w,readIt:T});(0,J.useEffect)(()=>{let e=k.current,t=[!e.mcpDone&&x&&`${l} called xaq.`,!e.listenDone&&S&&`The listener is connected.`,!e.receivedDone&&D&&`The test email arrived.`,!e.delivered&&w&&`The listener handled the test email.`,!e.readIt&&T&&`${l} read your mail.`].filter(Boolean).join(` `);k.current={mcpDone:x,listenDone:S,receivedDone:D,delivered:w,readIt:T},t&&ce(t)},[x,S,D,w,T,l]);let le=(0,J.useRef)(null),ue=(0,J.useRef)(O);(0,J.useEffect)(()=>{O&&!ue.current&&le.current?.focus(),ue.current=O},[O]);let de=[[`mcp`,x],[`listen`,S||b],[`send`,C],[`received`,D],[`delivered`,w||b]].find(([,e])=>!e)?.[0],A=(e,t,n=!1)=>t?`done`:n?`skipped`:e===de?`current`:`todo`;return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:se}),O&&(0,Y.jsx)(pn,{agent:e,label:c,tool:s,listening:!b,readIt:T,headingRef:le,serviceCmd:u.listenService,accountId:v?.accountId}),(0,Y.jsxs)(`ol`,{"aria-label":`Setup checks`,children:[(0,Y.jsx)(Q,{state:`done`,title:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{text:e.name}),` is approved`]}),detail:(0,Y.jsxs)(Y.Fragment,{children:[e.grants.length?e.grants.map(e=>_(e)).join(` · `):`It has no mailbox access yet: add some on its page.`,n&&r.paired&&(0,Y.jsxs)(`span`,{className:`mt-1 block`,children:[(0,Y.jsx)(y,{}),` The commands below act on the default profile.`]})]})}),(0,Y.jsx)(Q,{state:A(`mcp`,x),title:x?`${l} is connected to xaq`:`Waiting for ${c} to call xaq`,detail:x?p?(0,Y.jsxs)(Y.Fragment,{children:[`Last tool call `,(0,Y.jsx)(M,{date:p.call.ts}),` (`,p.call.action,p.note&&(0,Y.jsxs)(`span`,{className:`text-warning`,children:[`, `,p.note]}),`).`]}):(0,Y.jsxs)(Y.Fragment,{children:[`Connected `,(0,Y.jsx)(M,{date:d.connectedAt}),`.`]}):void 0,children:!x&&(0,Y.jsx)(cn,{tool:s,label:c,paired:r.paired,c:u,agentId:e.id,publicUrl:o})}),(0,Y.jsx)(Q,{state:A(`listen`,S,b),title:S?(0,Y.jsxs)(Y.Fragment,{children:[`Listener connected`,ie?.client.hostname&&(0,Y.jsxs)(Y.Fragment,{children:[` `,`on `,(0,Y.jsx)(K,{text:ie.client.hostname})]})]}):b?`No listener: MCP only`:`Start the listener so new mail wakes your agent`,detail:b&&!S?ne?(0,Y.jsxs)(Y.Fragment,{children:[`Your agent checks mail when you ask it.`,` `,(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-foreground underline underline-offset-4`,onClick:()=>Z({skipListen:!1}),children:`Use a listener after all`})]}):`Agents created with a copied key can't run a listener. Use a webhook from the agent's page instead.`:S?`It keeps a connection open and runs your command for each new email you receive.`:void 0,children:!S&&!b&&(0,Y.jsxs)(Y.Fragment,{children:[u.hermesRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On the machine where you ran connect, create the Hermes route once (use the platform Hermes should tell you on):`}),(0,Y.jsx)(q,{code:u.hermesRoute,label:`hermes route command`})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On the machine where you ran connect (Ctrl-C stops it):`}),(0,Y.jsx)(q,{code:u.listenTry,label:`listen command`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s===`other`?`This test command only confirms each email (a ✓ line per email); it starts nothing.`:(0,Y.jsxs)(Y.Fragment,{children:[s===`hermes`?`Forwards each new email you receive (not mail you send) to ${c}, which triages it.`:`Starts ${c} for each new email you receive (not mail you send), with only the xaq tools.`,` `,`Add`,` `,(0,Y.jsx)(`code`,{className:`font-mono whitespace-nowrap text-foreground`,children:`--types`}),` to wake it for other events too. Just testing delivery?`,` `,(0,Y.jsxs)(`code`,{className:`font-mono whitespace-nowrap text-foreground`,children:[`--exec `,Xe(`cat > /dev/null`)]}),` only confirms each email.`]})}),(0,Y.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>Z({skipListen:!0}),children:`I'll use MCP only`})]})}),(0,Y.jsx)(Q,{state:A(`send`,C),title:C?`Test email sent`:`Send a test email`,detail:v?(0,Y.jsxs)(Y.Fragment,{children:[`From `,(0,Y.jsx)(sn,{id:v.accountId}),` to itself, `,(0,Y.jsx)(M,{date:v.sentAt}),`.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`xaq sends `,(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[`“`,Rt,`”`]}),` from your Gmail account to itself. Nobody else gets it.`]}),children:(0,Y.jsx)(ln,{agent:e,sent:C,blocked:!S&&!b})}),(0,Y.jsx)(Q,{state:A(`received`,D),title:D?`xaq saw it arrive`:de===`received`?`Waiting for the test email to arrive`:`xaq sees it arrive`,detail:D?(0,Y.jsxs)(Y.Fragment,{children:[`New mail event `,(0,Y.jsx)(M,{date:ae.createdAt}),`.`,` `,(0,Y.jsx)(m,{to:`/events`,className:`font-medium text-foreground underline underline-offset-4`,children:`See it in Live events`})]}):C?`Usually a few seconds; with polling (no real-time delivery) up to the poll interval.`:void 0}),(0,Y.jsx)(Q,{state:A(`delivered`,w,b),title:w?`Your listener handled it`:b?`Delivery to a listener: skipped`:de===`delivered`?`Waiting for your listener to handle it`:`Your listener handles it`,detail:w?`Its terminal shows one ✓ line for the email.`:!b&&D?E?(0,Y.jsxs)(Y.Fragment,{children:[`Your listener only runs its command for `,E.join(`, `),`, so it skipped this email. Stop it and start it again with the default types (no `,(0,Y.jsx)(`code`,{className:`font-mono text-foreground`,children:`--types`}),`) or with`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-foreground`,children:`--types message.received`}),`, then send another test email.`]}):oe?`The listener wasn't running when this email was sent, so it starts after it. Send another test email now that the listener is running.`:`Look for one ✓ line in the listener's terminal. If it shows an error, the command failed and is retried.`:void 0}),(0,Y.jsx)(Q,{state:T?`done`:`todo`,optional:!0,title:T?`${l} read your mail`:`Ask ${c} to read it`,children:!T&&D&&(0,Y.jsx)(an,{text:`Use xaq to summarize my latest email.`,label:`prompt`})})]})]})}function sn({id:e}){let t=h(d.accounts());return(0,Y.jsx)(`span`,{className:`text-foreground`,children:t.data?.find(t=>t.id===e)?.email??`your account`})}function cn({tool:e,label:t,paired:n,c:r,agentId:i,publicUrl:a}){return(0,Y.jsxs)(`div`,{className:`space-y-2 text-sm text-muted-foreground`,children:[n&&e!==`other`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{children:[`If you ran connect with `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`--setup-mcp`}),`, restart `,t,`. If not, run this on the same machine, then restart`,` `,t,`:`]}),(0,Y.jsx)(q,{code:r.setupMcp,label:`setup-mcp command`}),r.mcpCheck&&(0,Y.jsxs)(`p`,{children:[`To check: `,(0,Y.jsx)(`code`,{className:`font-mono text-foreground`,children:r.mcpCheck}),` should list xaq.`]})]}):n?(0,Y.jsxs)(`p`,{children:[`Point your agent's MCP client at `,(0,Y.jsxs)(`code`,{className:`font-mono break-all text-foreground`,children:[a,`/mcp`]}),` with the header`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-foreground`,children:`Authorization: Bearer <key>`}),`. The key is the "apiKey" field in`,` `,(0,Y.jsx)(`code`,{className:`font-mono break-all text-foreground`,children:`~/.config/xaq/profiles/default.json`}),` on the machine where you ran connect.`]}):(0,Y.jsxs)(`p`,{children:[`Add xaq to your agent with the snippet from the previous step, or from`,` `,(0,Y.jsx)(m,{to:`/agents/$agentId`,params:{agentId:i},className:`font-medium text-foreground underline underline-offset-4`,children:`the agent's page`}),`.`]}),(0,Y.jsxs)(`p`,{children:[`Then ask `,t,`:`]}),(0,Y.jsx)(an,{text:`Use xaq to list my email accounts.`,label:`prompt`}),(0,Y.jsx)(`p`,{children:`Also teach it the rules once, with the xaq skill:`}),(0,Y.jsx)(q,{code:r.skillInstall,label:`skill install command`})]})}function ln({agent:e,sent:n,blocked:r}){let a=h(d.accounts()),o=(a.data??[]).filter(e=>e.status===`active`),s=o.filter(t=>e.grants.some(e=>e.accountId===t.id&&e.capabilities.includes(`read`))),c=s.length?s:o,[l,u]=(0,J.useState)(),f=l&&c.some(e=>e.id===l)?l:c[0]?.id,[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null),ee=(0,J.useId)(),te=U().statuses.verify===`todo`,ne=async()=>{if(f){_(!0),y(null);try{Z({test:{...await t(`/api/accounts/${encodeURIComponent(f)}/test-email`,{method:`POST`}),accountId:f,listenersAtSend:e.listeners.map(e=>e.consumer)}}),te&&!et().verifyStarted&&V({verifyStarted:!0})}catch(e){y(e)}finally{_(!1)}}};return a.isPending?(0,Y.jsx)(j,{className:`h-9 w-48`}):o.length?(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c.length>1&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:`Account to send from`}),(0,Y.jsxs)(T,{value:f,onValueChange:u,children:[(0,Y.jsx)(w,{id:ee,className:`w-auto min-w-56`,children:(0,Y.jsx)(oe,{})}),(0,Y.jsx)(ae,{children:c.map(e=>(0,Y.jsx)(C,{value:e.id,children:e.email},e.id))})]})]}),(0,Y.jsxs)(i,{variant:n?`outline`:`default`,onClick:()=>void ne(),disabled:g||!f||r,children:[g?(0,Y.jsx)(p,{}):n?(0,Y.jsx)(Ae,{}):(0,Y.jsx)(De,{}),n?`Send another`:`Send a test email`]})]}),r&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Start the listener first, or choose MCP only above.`}),!s.length&&(0,Y.jsx)(`p`,{className:`text-xs text-warning`,children:`This agent can't read any connected account yet, so the email won't reach it. Add access on its page.`}),v!=null&&(0,Y.jsx)(be,{error:v,title:`Couldn't send the test email`})]}):(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No active Gmail account.`,` `,(0,Y.jsx)(m,{to:`/accounts`,className:`font-medium text-foreground underline underline-offset-4`,children:`Connect or resume one`}),` `,`first.`]})}function un({agent:e,state:t,serverVerified:n,verifiedBy:r,onRunAgain:a}){let o=pt(e),{publicUrl:s}=te(),c=o.tool??`other`,l=o.tool?ee(o.tool):e.name,u=l[0].toUpperCase()+l.slice(1),d=rt(s,c),f=ft(e),p=!!t.skipListen||o.known&&!o.paired,m=Gt({serverVerified:n,test:t.test,calls:f.calls,connectedAt:e.lastMcpAt,listeners:e.listeners,skipListen:p,verifiedBy:r}),h=f.calls.some(e=>e.outcome===`ok`&&zt.has(e.action)),g=(0,J.useRef)(null);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(pn,{agent:e,label:l,tool:c,listening:!p&&e.listeners.length>0,readIt:h,headingRef:g,serviceCmd:d.listenService,accountId:t.test?.accountId,summary:(0,Y.jsxs)(`ul`,{"aria-label":`What was checked`,className:`space-y-1.5 text-sm`,children:[(0,Y.jsxs)($,{ok:!0,children:[(0,Y.jsx)(K,{text:e.name}),` is approved`,` `,(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.grants.length?e.grants.map(e=>_(e)).join(` · `):`no mailbox access yet`,`)`]})]}),m.map(e=>(0,Y.jsx)(dn,{line:e,Label:u},e.id))]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Y.jsxs)(i,{variant:`outline`,size:`sm`,onClick:a,children:[(0,Y.jsx)(Be,{}),`Run the checks again`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional: sends a new test email. This step stays done.`})]})]})}function $({ok:e,children:t}){return(0,Y.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e?(0,Y.jsx)(it,{className:`mt-0.5 size-4 shrink-0 text-success`}):(0,Y.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0`,children:t})]})}function dn({line:e,Label:t}){switch(e.id){case`mcp`:return(0,Y.jsxs)($,{ok:!0,children:[t,` reached xaq`,` `,(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.action?(0,Y.jsxs)(Y.Fragment,{children:[`last tool call `,e.action,`, `]}):(0,Y.jsx)(Y.Fragment,{children:`connected `}),(0,Y.jsx)(M,{date:e.at}),`)`]})]});case`listener`:return(0,Y.jsxs)($,{ok:e.connected,children:[e.connected?`Listener connected`:`Listener not connected now`,e.hostname&&(0,Y.jsxs)(Y.Fragment,{children:[` `,`on `,(0,Y.jsx)(K,{text:e.hostname})]}),!e.connected&&e.at&&(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`(last seen `,(0,Y.jsx)(M,{date:e.at}),`)`]})]});case`checked`:return(0,Y.jsx)($,{ok:!0,children:`Every check passed in this browser`});case`skipped`:return(0,Y.jsx)($,{ok:!1,children:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`You finished without running every check. Run them again below to make sure.`})});case`mcpOnly`:return(0,Y.jsx)($,{ok:!0,children:`No listener: MCP only`});case`test`:return(0,Y.jsxs)($,{ok:!0,children:[`Test email sent `,(0,Y.jsx)(M,{date:e.at})]});case`unchecked`:return(0,Y.jsx)($,{ok:!1,children:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Finished without every check: xaq hasn't seen a successful tool call yet.`})})}}function fn({command:e}){return(0,Y.jsxs)(`li`,{className:`space-y-1.5`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Keep xaq itself running.`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`It runs in a terminal now: closing that stops everything. On the computer running xaq, run:`})]}),(0,Y.jsx)(q,{code:e,label:`xaq service command`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stop the one in your terminal first (Ctrl-C): the service can't start while it runs. This page reconnects once the service is up.`})]})}function pn({agent:e,label:t,tool:n,listening:r,readIt:i,headingRef:a,serviceCmd:o,accountId:s,summary:c}){let l=h(d.system()),u=Qe(U().statuses),f=u.nextStep?it:Et;return(0,Y.jsxs)(`section`,{"aria-labelledby":`verify-done`,className:`space-y-4 rounded-xl border border-success/40 bg-success/5 p-4 sm:p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`h3`,{id:`verify-done`,ref:a,tabIndex:-1,className:`font-semibold outline-none`,children:u.title}),u.nextStep&&(0,Y.jsxs)(`p`,{className:`text-sm`,children:[`Setup isn't finished yet:`,` `,(0,Y.jsxs)(m,{to:`/get-started`,search:{step:u.nextStep},className:`font-medium underline underline-offset-4`,children:[`step `,z.indexOf(u.nextStep)+1,`, `,B[u.nextStep].short]}),` `,`is still to do.`]}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`New mail reaches `,(0,Y.jsx)(K,{text:e.name}),r?(0,Y.jsxs)(Y.Fragment,{children:[` `,(0,Y.jsx)(ht,{of:`arriving`,neutral:`when it arrives`,accountId:s})]}):` whenever you ask it`,`.`]})]})]}),c,(0,Y.jsxs)(`ul`,{className:`space-y-3 text-sm`,children:[r&&(0,Y.jsxs)(`li`,{className:`space-y-1.5`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Keep the listener running`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`after you close its terminal (starts at login):`})]}),(0,Y.jsx)(q,{code:o,label:`listener service command`}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n===`other`?`Replace /path/to/handle-email.sh with your script. `:``,`Stop the one in your terminal first (Ctrl-C).`]})]}),l.data?.service===!1&&(0,Y.jsx)(fn,{command:l.data.serviceCommand}),!i&&(0,Y.jsxs)(`li`,{className:`text-muted-foreground`,children:[`Try it: ask `,t,` to `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`“use xaq to summarize my latest email.”`})]}),(0,Y.jsxs)(`li`,{className:`text-muted-foreground`,children:[`Change what it may do on`,` `,(0,Y.jsx)(m,{to:`/agents/$agentId`,params:{agentId:e.id},className:`font-medium text-foreground underline underline-offset-4`,children:`its page`}),`; sends that need your OK and new agents asking for access wait in`,` `,(0,Y.jsx)(m,{to:`/approvals`,className:`font-medium text-foreground underline underline-offset-4`,children:`Approvals`}),`.`]})]})]})}function mn({index:e,onBack:t,onNext:n,total:r,nextLabel:a}){let o=h(d.agents()).data??[],[s,c]=(0,J.useState)(),[l,f]=(0,J.useState)(!1),[p,g]=(0,J.useState)(!1),_=!s&&(o.length===0||l),y=o.length>0||!!s;return(0,Y.jsx)(L,{index:e,total:r,title:s?`${s.agent.name} is ready`:`Connect your first agent`,description:s?`Save its key and add xaq to your agent with a snippet below. The next step checks that it works.`:`Your agent is the AI tool that will read your mail, like Claude Code or Codex. It asks for access from its own terminal and you approve it here. It only gets the access you choose.`,footer:(0,Y.jsx)(I,{onBack:t,onNext:n,nextLabel:a??`Check that it works`,nextDisabled:!y,hint:s?`Make sure you've saved the key`:y?void 0:`Approve a request to continue`,extra:!y&&(0,Y.jsx)(i,{variant:`ghost`,onClick:n,children:`Skip for now`})}),children:s?(0,Y.jsx)(v,{res:s}):_?(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(ne,{variant:`wizard`,onApproved:e=>{Yt(e.id),n()}}),(0,Y.jsxs)(`div`,{className:`border-t pt-4`,children:[(0,Y.jsxs)(i,{variant:`ghost`,size:`sm`,className:`-ml-2 text-muted-foreground`,"aria-expanded":p,onClick:()=>g(!p),children:[(0,Y.jsx)(Ee,{}),` Advanced: create it here and copy a key instead`,(0,Y.jsx)(S,{className:u(`transition-transform`,p&&`rotate-180`)})]}),p&&(0,Y.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`For agents that can't run `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`npx`}),`, like a hosted app. You paste the key into its MCP settings yourself, and it can't use a listener (use a webhook instead).`]}),(0,Y.jsx)(gt,{defaultName:o.length?``:`My first agent`,onCreated:e=>{Yt(e.agent.id),c(e)},onCancel:()=>g(!1)})]})]}),l&&(0,Y.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>f(!1),children:`Cancel`})]}):(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`p`,{className:`text-sm`,children:[`You have `,o.length,` agent`,o.length===1?``:`s`,` already. Continue to check that`,` `,o.length===1?`it works`:`one works`,`, or connect another.`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o.slice(0,4).map(e=>(0,Y.jsx)(i,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(m,{to:`/agents/$agentId`,params:{agentId:e.id},children:[(0,Y.jsx)(b,{}),` `,e.name]})},e.id)),(0,Y.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>f(!0),children:`Connect another`})]})]})})}function hn({index:e,onBack:t,onNext:n}){let{state:r,draft:i}=U(),a=h(d.googleClient()),o=r?.gcpProjectId??a.data?.projectId??i.projectId??``,s=r?.googleAppType??a.data?.appType??i.appType??void 0,c=!!a.data?.clientId&&!!a.data.hasSecret,[l,u]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),m=i.projectMode===`existing`,g=a.data;return(0,Y.jsx)(L,{index:e,title:B.client.title,description:`The OAuth client is xaq's ID card at Google: it's what you sign in through when you connect Gmail.`,footer:(0,Y.jsx)(I,{onBack:t,onNext:n,nextDisabled:!c,hint:c?void 0:`Import the client JSON first`}),children:a.isPending?(0,Y.jsx)(j,{className:`h-64`}):a.isError?(0,Y.jsx)(be,{error:a.error,title:`Couldn't load the OAuth client`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Pe,{}),m&&(0,Y.jsxs)(E,{variant:`warning`,children:[(0,Y.jsx)(qe,{}),(0,Y.jsx)(k,{children:`Create a new client, even if the project has one`}),(0,Y.jsx)(O,{children:`Don't reuse the other app's client ID or secret: rotating or deleting it would break both apps, and Google limits how many sign-ins each client keeps per account.`})]}),(0,Y.jsx)(ue,{}),(0,Y.jsxs)(Re,{children:[(0,Y.jsxs)(P,{title:`Open the Create OAuth client form and fill it in`,expect:(0,Y.jsxs)(Y.Fragment,{children:[`a dialog “`,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`OAuth client created`}),`” with the client ID and secret.`]}),children:[(0,Y.jsx)(N,{href:W.createClient(o),disabled:!o,disabledReason:`Enter the project ID in step 2 first`,children:`Open Create OAuth client`}),(0,Y.jsx)(je,{rows:[{label:`Application type`,note:(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Web application`})},{label:`Name`,value:`xaq`,copyLabel:`Copy client name`},{label:`Authorized JavaScript origins`,note:`Leave empty.`},{label:`Authorized redirect URIs`,value:g.redirectUri,copyLabel:`Copy redirect URI`,note:`Click Add URI and paste exactly this (no trailing slash).`},{label:`“Use this client for an AI-powered agent”`,note:`Leave it unticked: xaq calls Gmail itself.`}]}),g.callbackMode===`paste`&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs`,children:[(0,Y.jsx)(R,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:`Why localhost? Your address is plain http, and Google only returns to https or localhost. After you sign in, the browser lands on this localhost address and you paste it back into xaq.`})]}),(0,Y.jsxs)(`p`,{children:[`Then click `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Create`}),`.`]})]}),(0,Y.jsx)(P,{title:`Click Download JSON in that dialog`,children:(0,Y.jsxs)(`p`,{children:[`Google shows the secret only in this dialog, so download it before you close it. The file is called`,` `,(0,Y.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:`client_secret_….json`}),` (in your Downloads folder).`]})}),(0,Y.jsxs)(P,{title:`Give xaq the JSON file`,done:c,children:[c&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-foreground`,children:[(0,Y.jsx)(it,{className:`mt-0.5 size-4 shrink-0 text-success`}),(0,Y.jsxs)(`span`,{children:[`Saved: client `,(0,Y.jsx)(`span`,{className:`font-mono text-xs break-all`,children:g.clientId}),me(g)?` (secret ending in …${me(g)})`:``,`. Import another file only to replace it.`]})]}),(0,Y.jsx)(de,{appType:s,expectedProjectId:o||void 0,onNeedsManual:()=>u(!0),onImported:e=>p(e.check),quiet:!0}),c&&(0,Y.jsx)(le,{check:f,view:g,onChecked:p}),!f&&(0,Y.jsx)(Nt,{filter:e=>e.code===`client_invalid`||e.code===`client_secret_invalid`}),(0,Y.jsxs)(Ie,{defaultOpen:l,summary:`Closed the dialog without downloading? Enter the client ID and secret by hand`,children:[(0,Y.jsxs)(`p`,{children:[`Open `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Google Auth Platform → Clients`}),` → your client. The client ID is on that page. The secret isn't shown again: click `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Add secret`}),`, copy the new one, and paste both here.`]}),(0,Y.jsx)(N,{href:W.clients(o),disabled:!o,children:`Open Clients`}),(0,Y.jsx)(`div`,{className:`max-w-xl pt-1 text-foreground`,children:(0,Y.jsx)(fe,{view:g,projectId:o||void 0,appType:s,submitLabel:c?`Replace client`:`Save client`,onSaved:e=>p(e.check)})})]},l?`open`:`closed`)]})]})]})})}function gn({index:e,onBack:n,onNext:r}){let{state:i,draft:a}=U(),o=h(d.googleClient()),s=i?.gcpProjectId??a.projectId??``,c=i?.googleAppType??a.appType??void 0,l=a.productionConfirmed??(i?.googleAppType===`external`&&!i.warnings?.some(e=>e.code===`testing_mode`)),u=a.projectMode===`existing`,p=!c||c===`external`&&!l,m=G({mutationFn:e=>t(`/api/google/client`,{method:`PUT`,body:{clientId:e.client.clientId,projectId:e.client.projectId??``,appType:e.appType}}),invalidate:[f.googleClient,f.setupState],errorTitle:`Couldn't change the audience`});return(0,Y.jsxs)(L,{index:e,title:B.consent.title,description:`Google shows this screen when you connect a Google account to xaq. You set it up once: who may connect, and the name they see.`,footer:(0,Y.jsx)(I,{onBack:n,onNext:r,nextDisabled:p,hint:c?c===`external`&&!l?`Publish the app, then tick the box`:void 0:`Choose who can connect`}),children:[(0,Y.jsx)(Pe,{}),u&&(0,Y.jsxs)(E,{variant:`warning`,children:[(0,Y.jsx)(qe,{}),(0,Y.jsx)(k,{children:`Reused project: don't change its existing sign-in screen`}),(0,Y.jsxs)(O,{children:[`If Google Auth Platform opens on an `,(0,Y.jsx)(`strong`,{children:`Overview`}),` page (not “Get started”), the screen already exists for the other app. Leave its name, logo and support email alone, skip step 2 below, and just check its Audience page: pick the option here that matches it.`]})]}),(0,Y.jsxs)(Re,{children:[(0,Y.jsxs)(P,{title:`Choose who can connect`,done:!!c,children:[(0,Y.jsx)(`p`,{children:`You'll pick the same option in Google Cloud. Saved as soon as you choose.`}),(0,Y.jsx)(We,{"aria-label":`Who can connect`,value:c,onChange:e=>{V({appType:e}),o.data?.clientId&&o.data.appType!==e&&m.mutate({client:o.data,appType:e})},columns:2,choices:[{value:`external`,icon:Te,title:`External`,badge:(0,Y.jsx)(ve,{variant:`secondary`,children:`@gmail.com`}),description:`Any Google account, including personal @gmail.com. You publish the app once (below), or sign-ins expire after 7 days. Google shows an “unverified app” notice when you connect: expected for your own app.`},{value:`internal`,icon:vt,title:`Internal`,badge:(0,Y.jsx)(ve,{variant:`secondary`,children:`Workspace`}),description:`Only accounts in your Google Workspace organization. Nothing to publish, no unverified-app notice. Sign-ins still end on a password change, after 6 months unused, or by admin policy (reconnect then).`}]}),c===`internal`&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs`,children:[(0,Y.jsx)(R,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:`Internal is only offered when the project belongs to your organization. Greyed out in Google Cloud? The project was created under “No organization”: choose External instead.`})]})]}),(0,Y.jsxs)(P,{title:`Open Google Auth Platform and click Get started`,expect:(0,Y.jsxs)(Y.Fragment,{children:[`the Overview page with a `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Create OAuth client`}),` button.`]}),children:[(0,Y.jsx)(N,{href:W.authOverview(s),disabled:!s,disabledReason:`Enter the project ID in step 2 first`,children:`Open Google Auth Platform`}),(0,Y.jsx)(`p`,{children:`Google asks four things, one page each:`}),(0,Y.jsx)(je,{rows:[{label:`1. App information`,value:`xaq`,copyLabel:`Copy app name`,note:`Paste as the App name. User support email: your own address. Then Next.`},{label:`2. Audience`,note:(0,Y.jsxs)(Y.Fragment,{children:[`Choose `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:c===`internal`?`Internal`:c===`external`?`External`:`the option you picked above`}),`, then Next.`]})},{label:`3. Contact information`,note:`Your email address, then Next.`},{label:`4. Finish`,note:(0,Y.jsxs)(Y.Fragment,{children:[`Tick “I agree to the Google API Services: User Data Policy”, then `,(0,Y.jsx)(F,{items:[`Continue`,`Create`]}),`.`]})}]})]}),c===`external`&&(0,Y.jsxs)(P,{title:`Publish the app`,done:l,expect:(0,Y.jsxs)(Y.Fragment,{children:[`“Publishing status: `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`In production`}),`” and a “Back to testing” button.`]}),children:[(0,Y.jsx)(`p`,{children:`New apps start in Testing, where Google ends every sign-in after 7 days. Publishing fixes that; you don't submit anything to Google.`}),(0,Y.jsxs)(`p`,{children:[`On the Audience page: `,(0,Y.jsx)(F,{items:[`Publish app`,`Push to production?`,`Confirm`]}),`. If the dialog mentions verification, ignore it: that's for apps used by the public, not your own.`]}),(0,Y.jsx)(N,{href:W.authAudience(s),disabled:!s,disabledReason:`Enter the project ID in step 2 first`,children:`Open Audience`}),u&&(0,Y.jsx)(`p`,{className:`text-xs`,children:`Already “In production”? Nothing to change.`}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 pt-1`,children:[(0,Y.jsx)(He,{id:`in-production`,checked:l,onCheckedChange:e=>V({productionConfirmed:e===!0}),className:`mt-0.5`}),(0,Y.jsx)(Ue,{htmlFor:`in-production`,className:`flex-1 text-sm leading-snug font-normal text-foreground`,children:`The Audience page says “Publishing status: In production”`})]})]})]}),(0,Y.jsx)(vn,{project:s,appType:c})]})}var _n=[$e.gmail,...$e.calendar].join(`
|
|
2
|
+
`);function vn({project:e,appType:t}){return(0,Y.jsxs)(Ie,{summary:`List Gmail and Google Calendar on the Data access page`,badge:(0,Y.jsx)(ve,{variant:`outline`,children:t===`external`?`Recommended`:`Optional`}),children:[(0,Y.jsxs)(`p`,{children:[`xaq asks for this access when you connect an account and works the same either way. Listing it here makes Google Cloud show what the app uses`,t===`external`?`, and the sign-in screen name it`:``,`. Google calls Gmail a “restricted” scope and the Calendar ones “sensitive”; for your own app that just means the unverified-app notice.`]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(F,{items:[`Data access`,`Add or remove scopes`]}),`, paste these under “Manually add scopes”, then`,` `,(0,Y.jsx)(F,{items:[`Add to table`,`Update`,`Save`]}),`. The first is Gmail; the other three are Calendar's events, calendar list and free/busy.`]}),(0,Y.jsx)(we,{code:_n,wrap:!0,copyLabel:`Copy scopes`}),(0,Y.jsx)(N,{href:W.authScopes(e),disabled:!e,children:`Open Data access`})]})}function yn({index:e,onBack:r,onNext:i}){let a=n(),{statuses:o,state:s,draft:c}=U(),l=h(d.settings()),u=h(d.accounts()),p=o.pubsub===`done`,m=c.projectMode===`existing`,g=(u.data??[]).some(e=>e.workspaceDomain),_=l.data?.pollIntervalSeconds??30,v=s?.gcpProjectId??``,y=G({mutationFn:async()=>{l.data?.ingestMode===`pubsub`&&await t(`/api/settings`,{method:`PATCH`,body:{ingestMode:`poll`}})},invalidate:[f.settings,f.setupState,f.system],errorTitle:`Couldn't switch to polling`,onSuccess:()=>{V({pubsubSkipped:!0}),a.invalidateQueries({queryKey:f.setupState}),i()}});return(0,Y.jsxs)(L,{index:e,title:B.pubsub.title,description:`Optional. Without this, xaq checks for new mail every ${_} seconds, which works fine. With it, Google tells xaq about new mail within seconds.`,footer:(0,Y.jsx)(I,{onBack:r,onNext:()=>p?i():y.mutate(),pending:y.isPending,nextVariant:p?`default`:`outline`,nextLabel:p?`Continue`:`Skip: check every ${_} seconds`}),children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1.5 rounded-lg border p-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 font-medium`,children:[(0,Y.jsx)(A,{className:`size-4 text-chart-1`,"aria-hidden":!0}),` Within seconds`]}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Uses Google Cloud Pub/Sub, Google's notification service, in your project. xaq sets it up for you in one click; works even when this machine isn't reachable from the internet. No cost at this volume.`})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 rounded-lg border p-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 font-medium`,children:[(0,Y.jsx)(ge,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),` Every `,_,` seconds`,m&&(0,Y.jsx)(ve,{variant:`secondary`,children:`Recommended for a shared project`})]}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Called polling: xaq asks Gmail for changes on a timer. Nothing to set up, no billing account, and the automatic fallback.`})]})]}),m&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(R,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:`You reused a project. The Pub/Sub permission xaq would ask for reaches every Pub/Sub topic that account can manage, including the other apps'. Polling avoids that.`})]}),g&&(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(R,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:`Google Workspace: if your admin set a Google Cloud session length, the Pub/Sub permission makes Google ask you to sign in again regularly. An admin can exempt the app (Admin console → Security → Access and data control → Google Cloud session control → mark xaq trusted and tick “Exempt trusted apps”), or stay on polling.`})]}),(0,Y.jsx)(pe,{compact:!0}),(0,Y.jsxs)(Ie,{summary:`Didn't create the Google Cloud project yourself?`,children:[(0,Y.jsx)(`p`,{children:`Setting this up needs the project's Owner or Pub/Sub Admin role (Editor isn't enough). Whoever created the project is Owner already. If that's someone else, ask them to give your account the Pub/Sub Admin role in IAM, or connect their Gmail account and set up with it.`}),v&&(0,Y.jsxs)(`a`,{className:`text-foreground underline underline-offset-4`,href:W.iam(v),target:`_blank`,rel:`noopener noreferrer`,children:[`Open IAM in Google Cloud`,(0,Y.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})]})]})}function bn(){let e=h(d.settings()),t=U(),{step:n}=H.useSearch();if(e.isPending||t.query.isPending)return(0,Y.jsx)(xn,{});let r=st(t.view,n);return r===`google`?(0,Y.jsx)(wn,{}):(0,Y.jsx)(Sn,{view:r})}function xn(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(j,{className:`h-14 w-72`}),(0,Y.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[14rem_1fr]`,children:[(0,Y.jsx)(j,{className:`hidden h-80 lg:block`}),(0,Y.jsx)(j,{className:`h-96`})]})]})}function Sn({view:e}){let{path:t}=H.useSearch(),n=l({from:H.fullPath}),i=U(),a=i.draft.firstConnect,o=e=>{r.dismiss(),n({search:{path:e}}),window.scrollTo({top:0,behavior:`smooth`})},s=t??i.brokerTodo??`agent`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{title:`Get started`,description:`A few minutes. Progress is saved.`}),(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-3xl min-w-0`,children:e===`choose`||!a||a===`google`?(0,Y.jsx)(Ot,{onChosen:e=>e===`google`?void n({search:{}}):o(`connect`)}):s===`connect`?(0,Y.jsx)(kt,{choice:a,onNext:()=>o(`agent`)}):(0,Y.jsx)(mn,{index:1,total:Je.length,onBack:()=>o(`connect`),onNext:()=>{r.success(`Setup complete`,{description:`Your agent can use its connections now. The overview shows what it's up to.`}),n({to:`/`})},nextLabel:`Finish setup`})})]})}var Cn={url:he,project:Ne,consent:gn,client:hn,accounts:It,pubsub:yn,agent:mn,verify:Qt};function wn(){let{step:e,from:t}=H.useSearch(),n=l({from:H.fullPath}),i=U(),{shown:a,pin:o}=ot(e,{loaded:i.query.isSuccess,firstTodo:i.firstTodo});(0,J.useEffect)(()=>{o&&n({search:e=>({...e,step:o}),replace:!0})},[o,n]);let s=i.state!==void 0&&nt(a,i.statuses,i.draft);if((0,J.useEffect)(()=>{s&&V({verifyStarted:!0})},[s]),i.query.isPending)return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(j,{className:`h-14 w-72`}),(0,Y.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[14rem_1fr]`,children:[(0,Y.jsx)(j,{className:`hidden h-80 lg:block`}),(0,Y.jsx)(j,{className:`h-96`})]})]});if(i.query.isError)return(0,Y.jsx)(Ce,{error:i.query.error,onRetry:()=>void i.query.refetch()});let c=a,u=z.indexOf(c),d=(e,t)=>{r.dismiss(),n({search:{step:e,...t?{from:t}:{}}}),window.scrollTo({top:0,behavior:`smooth`})},f=e=>{let n=z.indexOf(e)<u?t&&z.indexOf(t)>u?t:c:void 0;d(e,n)},p=t&&z.indexOf(t)>u?t:void 0,m=()=>{let e=p??z[u+1],t=Qe({...i.statuses,[c]:`done`}).nextStep;e?d(e):t?d(t):(r.success(`Setup complete`,{description:`Your agents can use Gmail now. The overview shows what they're up to.`}),n({to:`/`}))},h=u>0?()=>d(z[u-1],p):void 0,g=Cn[c];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{title:`Get started`,description:`About 10 minutes, mostly in Google Cloud (opens in new tabs). Progress is saved.`}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-[14rem_1fr]`,children:[(0,Y.jsx)(`div`,{className:`lg:sticky lg:top-20`,children:(0,Y.jsx)(Me,{current:c,statuses:i.statuses,onSelect:f})}),(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(g,{index:u,onBack:h,onNext:m,returnTo:p},c)})]})]})}export{bn as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ut as e,ft as t}from"./queries-Cv3nXx0U.js";import{c as n,l as r,u as i}from"./card-GSO5o-Ug.js";import{t as a}from"./eye-off-Diktqz_g.js";var o=e(),s=/\u034F|\uFE0F{2,}|[\u00AD\u061C\u115F\u1160\u17B4\u17B5\u180E\u200B-\u200F\u2028-\u202E\u2060-\u206F\u3164\uFEFF\uFFA0\u{E0000}-\u{E007F}\u{E0100}-\u{E01EF}\uFE00-\uFE0E]/gu;function c(...e){return e.some(e=>!!e&&new RegExp(s.source,`u`).test(e))}var l=e=>{let t=[...e].length;return`U+${e.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}${t>1?` ×${t}`:``}`};function u({text:e,className:n}){if(!c(e))return(0,o.jsx)(o.Fragment,{children:e});let r=[],i=0;for(let a of e.matchAll(s))a.index>i&&r.push(e.slice(i,a.index)),r.push((0,o.jsxs)(`mark`,{title:`Hidden character`,className:t(`mx-px rounded-sm bg-critical/15 px-0.5 font-mono text-[0.8em] text-critical not-italic`,n),children:[`⟨`,l(a[0]),`⟩`]},a.index)),i=a.index+a[0].length;return i<e.length&&r.push(e.slice(i)),(0,o.jsx)(o.Fragment,{children:r})}function d({what:e=`This message`}){return(0,o.jsxs)(n,{variant:`destructive`,children:[(0,o.jsx)(a,{}),(0,o.jsxs)(i,{children:[e,` contains hidden characters`]}),(0,o.jsx)(r,{children:`Invisible or text-reordering characters are shown below as ⟨U+…⟩. They can hide words or make text read differently than it will be sent. Reject unless you know why they're there.`})]})}export{u as n,c as r,d as t};
|