@puddle-code/cli 0.2.2 → 0.2.4
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/CHANGELOG.md +7 -10
- package/dist/host-control.mjs +38 -0
- package/dist/index.js +43 -3
- package/dist/public/assets/App-C2IQg_6K.js +2 -0
- package/dist/public/assets/Dashboard-DUFOyL1_.js +1 -0
- package/dist/public/assets/EditorTabClose-C3wpMhYL.js +1 -0
- package/dist/public/assets/FindWidget-Dt1gfA70.js +1 -0
- package/dist/public/assets/LazyTerminal-B9HzmRBx.js +2 -0
- package/dist/public/assets/{ModelRefcount-BNtD7p2m.js → ModelRefcount-CxzQ3w05.js} +1 -1
- package/dist/public/assets/NewProjectDialog-Cq_1po_h.js +1 -0
- package/dist/public/assets/PaneEditorBody-zS2BI5Fn.js +553 -0
- package/dist/public/assets/{PdfViewer-DhO008IQ.js → PdfViewer-ckjWE_TR.js} +2 -2
- package/dist/public/assets/SettingsDialog-Cb2fdV1D.js +8 -0
- package/dist/public/assets/Terminal-BqbjwcMi.js +60 -0
- package/dist/public/assets/Workspace-B6mgQyIM.css +1 -0
- package/dist/public/assets/Workspace-BVDgHkML.js +20 -0
- package/dist/public/assets/{abnfDiagram-VCTEODGH-CTMUfqGq.js → abnfDiagram-VCTEODGH-JZdwYDGF.js} +1 -1
- package/dist/public/assets/architecture-7GRP2DOG-RMEcXYv9.js +1 -0
- package/dist/public/assets/{architectureDiagram-5GKGNRK7-B-L0EtRZ.js → architectureDiagram-5GKGNRK7-CYoRlLvs.js} +1 -1
- package/dist/public/assets/{blockDiagram-I7D4REHJ-CnmmDFsq.js → blockDiagram-I7D4REHJ-DjPQ4-5b.js} +1 -1
- package/dist/public/assets/{buffer-store-DzO77p-K.js → buffer-store-GUPJI8Wy.js} +2 -2
- package/dist/public/assets/button-CKes3Qwq.js +1 -0
- package/dist/public/assets/{c4Diagram-7LVT6UL2-DU4HXNd-.js → c4Diagram-7LVT6UL2-BvwPGpk0.js} +1 -1
- package/dist/public/assets/channel-BheYsxDc.js +1 -0
- package/dist/public/assets/{chunk-2E4U76K2-B8o6iRzd.js → chunk-2E4U76K2-DcsuTdxj.js} +1 -1
- package/dist/public/assets/{chunk-4HAMMTFA-CfxkhHyC.js → chunk-4HAMMTFA-BGEaVxkg.js} +1 -1
- package/dist/public/assets/{chunk-75Z2AOVW-D8v_0vko.js → chunk-75Z2AOVW-BOvbyaVc.js} +1 -1
- package/dist/public/assets/{chunk-CLGD4ZFX-DPBjX4jg.js → chunk-CLGD4ZFX-8fG7spZS.js} +1 -1
- package/dist/public/assets/{chunk-DU6HZSFF-CuwQaNw0.js → chunk-DU6HZSFF-C94gDWXH.js} +1 -1
- package/dist/public/assets/{chunk-F27PBJKO-lg02cTVZ.js → chunk-F27PBJKO-CZD-A2b3.js} +1 -1
- package/dist/public/assets/{chunk-GMAD6QVW-DICB0y-D.js → chunk-GMAD6QVW-C7KK3kiY.js} +1 -1
- package/dist/public/assets/{chunk-GVQU2GXP-9ghjwcoq.js → chunk-GVQU2GXP-CDFKc0sW.js} +1 -1
- package/dist/public/assets/{chunk-IMKFNOWR-i_YIFBJX.js → chunk-IMKFNOWR-BWQiE1Cp.js} +1 -1
- package/dist/public/assets/{chunk-L3NEJ4N5-gR7gj1U0.js → chunk-L3NEJ4N5-DqP3WOXV.js} +1 -1
- package/dist/public/assets/{chunk-OSK3NFVY-DHyaWigk.js → chunk-OSK3NFVY-BlmYDJRN.js} +1 -1
- package/dist/public/assets/{chunk-P2QGCYS3-ykV2meK0.js → chunk-P2QGCYS3-v7eQ-UQT.js} +1 -1
- package/dist/public/assets/{chunk-POPQ4Y6H-BfpRTc3s.js → chunk-POPQ4Y6H-D_gxItFL.js} +1 -1
- package/dist/public/assets/{chunk-PWAF6VOD-gWIwGh8g.js → chunk-PWAF6VOD-Ds90M0Eb.js} +1 -1
- package/dist/public/assets/{chunk-SHT3W25Y-BQ_pTF0Z.js → chunk-SHT3W25Y-B8oepiFw.js} +1 -1
- package/dist/public/assets/{chunk-SVP7TREG-SQwLD6DT.js → chunk-SVP7TREG-DjFxplBp.js} +1 -1
- package/dist/public/assets/{chunk-TICWLB2K-B2zBy15L.js → chunk-TICWLB2K-GEeYOgw4.js} +1 -1
- package/dist/public/assets/{chunk-TLUHSLCS-Bd2UG2tZ.js → chunk-TLUHSLCS-CEnN9wOB.js} +2 -2
- package/dist/public/assets/classDiagram-ZZMXUADV-CDDLBiV5.js +1 -0
- package/dist/public/assets/classDiagram-v2-VYDZK3BY-CDDLBiV5.js +1 -0
- package/dist/public/assets/context-menu-CmSSwq3B.js +1 -0
- package/dist/public/assets/copy-CGsu8426.js +1 -0
- package/dist/public/assets/{cssMode-DqPCL8gS.js → cssMode-BEaREsxj.js} +1 -1
- package/dist/public/assets/{cynefin-OW5HDTMX-CSAZrmjo.js → cynefin-OW5HDTMX-C_sl2wZ-.js} +1 -1
- package/dist/public/assets/{cynefinDiagram-5FMLGOSQ-CGKlzaPC.js → cynefinDiagram-5FMLGOSQ-CPpFUPl3.js} +1 -1
- package/dist/public/assets/{dagre-GXQ25YYZ-CgRwIpkl.js → dagre-GXQ25YYZ-BryapOat.js} +1 -1
- package/dist/public/assets/{diagram-S7CK7UJ4-BMP1KOBu.js → diagram-S7CK7UJ4-dIdCar-k.js} +1 -1
- package/dist/public/assets/{diagram-UQ7AKVKN-DNcOIF4W.js → diagram-UQ7AKVKN-EcAWwfjf.js} +1 -1
- package/dist/public/assets/{diagram-VSXAHHWV-BGdHvK5Q.js → diagram-VSXAHHWV-Dpl4gvkd.js} +1 -1
- package/dist/public/assets/{diagram-VX7I27RA-F7PfwNlr.js → diagram-VX7I27RA-CJtemv3e.js} +1 -1
- package/dist/public/assets/{diagram-Z3DM3KII-CPE4T9mi.js → diagram-Z3DM3KII-CPSnQEgD.js} +1 -1
- package/dist/public/assets/dialog-Dam8WdmS.js +41 -0
- package/dist/public/assets/disclosure-Ex-68BU4.js +1 -0
- package/dist/public/assets/dist-ByY6lqkl.js +1 -0
- package/dist/public/assets/dist-CxMnSex-.js +1 -0
- package/dist/public/assets/{ebnfDiagram-PWID7BFC-CqTR9kTI.js → ebnfDiagram-PWID7BFC-uXsUC0ll.js} +1 -1
- package/dist/public/assets/{erDiagram-RLTQ6QDP-CVqix4AT.js → erDiagram-RLTQ6QDP-D5vJ6ZLT.js} +1 -1
- package/dist/public/assets/eventmodeling-NTZA5JFV-WlMCgowE.js +1 -0
- package/dist/public/assets/flowDiagram-HODETNUW-DJ99l88N.js +1 -0
- package/dist/public/assets/{ganttDiagram-EL5Y4UJY-CFSX0WK6.js → ganttDiagram-EL5Y4UJY-C6yTyvpx.js} +1 -1
- package/dist/public/assets/{gitGraph-4MIJSDKK-Doy-w5G0.js → gitGraph-4MIJSDKK-C7nVbcZ1.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-WWUBYQGX-fQM29HOw.js → gitGraphDiagram-WWUBYQGX-DByBzF_5.js} +1 -1
- package/dist/public/assets/{hotkeys-DQNqRgOb.js → hotkeys-MSGaeY2m.js} +1 -1
- package/dist/public/assets/{htmlMode-DE4OLLtJ.js → htmlMode-DirKEo5j.js} +1 -1
- package/dist/public/assets/index-C1a3rCk2.js +82 -0
- package/dist/public/assets/index-Ctw2P0rY.css +2 -0
- package/dist/public/assets/{info-A6RAGUB7-DPiPYEQe.js → info-A6RAGUB7-BCEGc_J2.js} +1 -1
- package/dist/public/assets/{infoDiagram-27XIBGKW-DY5LKiBl.js → infoDiagram-27XIBGKW-DDVeVGK9.js} +1 -1
- package/dist/public/assets/input-i-kiT55N.js +1 -0
- package/dist/public/assets/{ishikawaDiagram-5VMMS53U-DwSURfQE.js → ishikawaDiagram-5VMMS53U-CTZvKcdI.js} +1 -1
- package/dist/public/assets/{journeyDiagram-3NMN7TZE-B0OCkFis.js → journeyDiagram-3NMN7TZE-CwFCP_8e.js} +1 -1
- package/dist/public/assets/{jsonMode-F58eqVfl.js → jsonMode-BLMO7T1W.js} +1 -1
- package/dist/public/assets/{kanban-definition-UXKFOSKX-CAQw3qWz.js → kanban-definition-UXKFOSKX-BCdCN6ov.js} +1 -1
- package/dist/public/assets/{line-Bcu_KJDQ.js → line-e7ifLbsv.js} +1 -1
- package/dist/public/assets/{media-refresh-store-B8Wdlks-.js → media-refresh-store-d6Ihz_Yj.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-PSjhnHbq.js → mermaid-parser.core-DfmtQ5si.js} +3 -3
- package/dist/public/assets/{mermaid.core-CVDKsXhB.js → mermaid.core-B0Ceo892.js} +3 -3
- package/dist/public/assets/{mindmap-definition-YA3MSWOX-CVAY5896.js → mindmap-definition-YA3MSWOX-BKWZ0hGZ.js} +1 -1
- package/dist/public/assets/notification-permission-DThcB8rO.js +1 -0
- package/dist/public/assets/{packet-AYTQ26CC-CTdFnPq7.js → packet-AYTQ26CC-C_WSBR7W.js} +1 -1
- package/dist/public/assets/{pdf-CNnH2qu8.js → pdf-CW6jyF4i.js} +1 -1
- package/dist/public/assets/{pegDiagram-XKGWAZYB-DjAvebfq.js → pegDiagram-XKGWAZYB-CQw-vxyv.js} +1 -1
- package/dist/public/assets/{pie-WAS4IAKB-DGj7H0HD.js → pie-WAS4IAKB-CyAolSkk.js} +1 -1
- package/dist/public/assets/{pieDiagram-E7YTZNPT-ZsMHxQiN.js → pieDiagram-E7YTZNPT-fEikc7gQ.js} +1 -1
- package/dist/public/assets/{project-abbrev-CaGbOWtr.js → project-abbrev-0K47Phcy.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-AXDQQJYC-DVxSJgm4.js → quadrantDiagram-AXDQQJYC-BLZF9CN6.js} +1 -1
- package/dist/public/assets/{radar-RG4KPBEZ-D7tOXZhy.js → radar-RG4KPBEZ-DZj09Z3T.js} +1 -1
- package/dist/public/assets/{railroad-74A4TZTK-EI9jAf_f.js → railroad-74A4TZTK-DrrM4RhH.js} +1 -1
- package/dist/public/assets/railroad-abnf-HS5TGJTU-lXe6u3FO.js +1 -0
- package/dist/public/assets/railroad-ebnf-LZEXJU2U-C7R4jvUV.js +1 -0
- package/dist/public/assets/railroad-peg-WCYAUIDC-B24HGcGJ.js +1 -0
- package/dist/public/assets/{railroadDiagram-O6MQD6OU-uqpSPQV1.js → railroadDiagram-O6MQD6OU-BjnjeLPo.js} +1 -1
- package/dist/public/assets/{requirementDiagram-BXWQKSXE-BlP0G3V7.js → requirementDiagram-BXWQKSXE-CJnHoVjp.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-P5KCCOFB-BcxykWWD.js → sankeyDiagram-P5KCCOFB-BFBAycgU.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-WJ2MYXX4-BleK5ON1.js → sequenceDiagram-WJ2MYXX4-IgIUmdp2.js} +1 -1
- package/dist/public/assets/{stateDiagram-D77RDMKH-C3Ojitqe.js → stateDiagram-D77RDMKH-C8ragRoI.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-MP3YSRHH-AU0bFC0Z.js +1 -0
- package/dist/public/assets/{swimlanes-42K2YHIH-Bebu_xn2.js → swimlanes-42K2YHIH-mm0BJE0h.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-VR7AAH4N-cBVuNXB5.js +8 -0
- package/dist/public/assets/switch-TfZl8YQu.js +1 -0
- package/dist/public/assets/{timeline-definition-24CTP7MA-BKUpL8jk.js → timeline-definition-24CTP7MA-CLtACXsf.js} +1 -1
- package/dist/public/assets/{treeView-Q6P3EWNA-C7zCIwpV.js → treeView-Q6P3EWNA-B_s8YnCD.js} +1 -1
- package/dist/public/assets/{treemap-WGGIJYW6-6M3fRwft.js → treemap-WGGIJYW6-CiyeynoG.js} +1 -1
- package/dist/public/assets/{tsMode-DQRFLRMD.js → tsMode-BJ9DHdAB.js} +1 -1
- package/dist/public/assets/use-ui-state-2bNBLDPU.js +1 -0
- package/dist/public/assets/{vennDiagram-4TSXK5OY-DxK4ozKb.js → vennDiagram-4TSXK5OY-C9rcT-1u.js} +1 -1
- package/dist/public/assets/{wardley-WFR3VGLG-B2zERAcS.js → wardley-WFR3VGLG-D_hqUvOM.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-VM6X3IG4-Ctiwf9vH.js → wardleyDiagram-VM6X3IG4-Dfn7mGAc.js} +1 -1
- package/dist/public/assets/{ws-DK8JadaZ.js → ws-CDXqi1pN.js} +1 -1
- package/dist/public/assets/{xychartDiagram-S5SC5T6Z-CxqvnL8v.js → xychartDiagram-S5SC5T6Z-vwVJPUe2.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/public/preview.html +18 -0
- package/package.json +1 -1
- package/dist/public/assets/App-DYF0TQ7N.js +0 -2
- package/dist/public/assets/Dashboard-BLWy1kHm.js +0 -1
- package/dist/public/assets/EditorTabClose-CtInp1cT.js +0 -1
- package/dist/public/assets/LazyTerminal-BrJnGoEX.js +0 -2
- package/dist/public/assets/NewProjectDialog-BHIvFpCo.js +0 -1
- package/dist/public/assets/PaneEditorBody--HKVd4ce.js +0 -553
- package/dist/public/assets/SettingsDialog-rfDhJoO1.js +0 -8
- package/dist/public/assets/Terminal-CttD7XcZ.js +0 -60
- package/dist/public/assets/Workspace-BB4IS8EP.js +0 -20
- package/dist/public/assets/Workspace-DgLBQU_0.css +0 -1
- package/dist/public/assets/architecture-7GRP2DOG-D65OB2im.js +0 -1
- package/dist/public/assets/channel-DDYJkwWS.js +0 -1
- package/dist/public/assets/classDiagram-ZZMXUADV-DiYOyJFb.js +0 -1
- package/dist/public/assets/classDiagram-v2-VYDZK3BY-DiYOyJFb.js +0 -1
- package/dist/public/assets/context-menu-Brk2htuk.js +0 -1
- package/dist/public/assets/dialog-B08M5Cgz.js +0 -41
- package/dist/public/assets/disclosure-Bc6Ydabz.js +0 -1
- package/dist/public/assets/dist-CE40EiFY.js +0 -1
- package/dist/public/assets/dist-w0M7y9KX.js +0 -1
- package/dist/public/assets/eventmodeling-NTZA5JFV-BoPTLqKJ.js +0 -1
- package/dist/public/assets/flowDiagram-HODETNUW-2TNtc6rJ.js +0 -1
- package/dist/public/assets/index-CQ-7fSnd.css +0 -2
- package/dist/public/assets/index-CmEI98Do.js +0 -82
- package/dist/public/assets/input-CRHttNr9.js +0 -1
- package/dist/public/assets/notification-permission-CbLpN3ev.js +0 -1
- package/dist/public/assets/railroad-abnf-HS5TGJTU-DnezvAFa.js +0 -1
- package/dist/public/assets/railroad-ebnf-LZEXJU2U-DHOzgi4x.js +0 -1
- package/dist/public/assets/railroad-peg-WCYAUIDC-C28W4OGa.js +0 -1
- package/dist/public/assets/stateDiagram-v2-MP3YSRHH-KLRu_NXG.js +0 -1
- package/dist/public/assets/swimlanesDiagram-VR7AAH4N-BmvrlXmd.js +0 -8
- package/dist/public/assets/switch-CaIM4dwn.js +0 -1
- package/dist/public/assets/use-find-controls-SI1t9mHH.js +0 -1
- package/dist/public/assets/use-ui-state-D-3P_8P_.js +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{C as r,D as i,G as a,J as o,K as s,O as c,W as l,Y as u,_ as d,c as f,g as p,h as m,k as h,m as g,n as _,p as v,q as y,r as b,w as x}from"./index-CmEI98Do.js";import{i as S,n as C,r as w}from"./dist-CE40EiFY.js";import{A as T,E as ee,G as te,H as ne,I as re,Q as E,St as ie,T as ae,Tt as oe,W as se,Y as ce,Z as le,a as ue,at as D,ct as de,et as fe,f as pe,g as me,i as he,j as ge,mt as _e,n as ve,ot as ye,pt as be,q as xe,rt as Se,t as Ce,tt as O,v as k,z as we}from"./hotkeys-DQNqRgOb.js";import{a as Te,h as A,i as j,n as M,o as N,r as P,t as F}from"./dialog-B08M5Cgz.js";import{a as I,c as Ee,l as L,o as De,r as Oe,s as ke,u as R}from"./LazyTerminal-BrJnGoEX.js";import{a as Ae,c as je,d as Me,i as Ne,l as Pe,o as Fe,r as Ie,t as z,u as Le}from"./switch-CaIM4dwn.js";import{n as B}from"./x-CZCUod6A.js";import{t as V}from"./createLucideIcon-DyMAgLa3.js";import{a as Re,c as ze,d as Be,f as Ve,g as He,i as Ue,l as We,m as Ge,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as Ze,u as Qe,v as $e}from"./notification-permission-CbLpN3ev.js";import{a as H,c as et,i as U,n as tt,o as W,r as G,s as nt,t as rt}from"./disclosure-Bc6Ydabz.js";import{t as it}from"./use-debounced-value-C86N-mOK.js";var at=V(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ot=V(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),st=V(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ct=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),lt=V(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ut=V(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),dt=V(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),K=e(n(),1),q=_();function J({id:e,value:t,min:n,max:r,step:i,className:a,onCommit:o}){let[s,c]=(0,K.useState)(String(t));return(0,K.useEffect)(()=>c(String(t)),[t]),(0,q.jsx)(L,{id:e,type:`number`,min:n,max:r,step:i,className:a,value:s,onChange:e=>c(e.target.value),onBlur:()=>{let e=Number(s);if(s.trim()===``||!Number.isFinite(e)){c(String(t));return}let i=Math.min(r??e,Math.max(n??e,e));c(String(i)),i!==t&&o(i)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()}})}function Y({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,q.jsxs)(`div`,{className:B(`flex items-center gap-4 py-2.5`,a),children:[(0,q.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:B(`text-xs text-fg-muted`,n),children:t})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function X({children:e,note:t}){return(0,q.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function ft(){let e=p(),[t,n]=(0,K.useState)(f());return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Appearance`}),(0,q.jsx)(Y,{label:`Theme`,children:(0,q.jsxs)(G,{value:t,onValueChange:e=>{n(e),b(e)},children:[(0,q.jsx)(W,{className:`w-32`,children:(0,q.jsx)(nt,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(H,{value:`dark`,children:`Dark`}),(0,q.jsx)(H,{value:`light`,children:`Light`}),(0,q.jsx)(H,{value:`system`,children:`System`})]})]})}),(0,q.jsx)(Y,{label:`Cursor style`,children:(0,q.jsxs)(G,{value:e.cursorPackage,onValueChange:e=>m({cursorPackage:e}),children:[(0,q.jsx)(W,{className:`w-36`,children:(0,q.jsx)(nt,{})}),(0,q.jsx)(U,{children:d.map(e=>(0,q.jsx)(H,{value:e.id,children:e.label},e.id))})]})}),(0,q.jsx)(Y,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,q.jsx)(J,{id:`ui-font-size`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onCommit:e=>m({uiFontSize:e})})}),(0,q.jsx)(Y,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,q.jsx)(J,{id:`terminal-font-size`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onCommit:e=>m({terminalFontSize:e})})}),(0,q.jsx)(Y,{label:`Editor font size`,htmlFor:`editor-font-size`,children:(0,q.jsx)(J,{id:`editor-font-size`,min:9,max:32,step:.5,className:`w-20 tabular-nums`,value:e.editorFontSize,onCommit:e=>m({editorFontSize:e})})}),(0,q.jsx)(Y,{label:`Density`,children:(0,q.jsxs)(G,{value:e.density,onValueChange:e=>m({density:e}),children:[(0,q.jsx)(W,{className:`w-36`,children:(0,q.jsx)(nt,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(H,{value:`compact`,children:`Compact`}),(0,q.jsx)(H,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,q.jsx)(Y,{label:`Project-based layout`,description:`Editor layouts are separated across projects.`,htmlFor:`project-based-layout`,children:(0,q.jsx)(z,{id:`project-based-layout`,checked:e.projectBasedLayout,onCheckedChange:e=>m({projectBasedLayout:e})})}),(0,q.jsx)(Y,{label:`All projects in the session list`,description:`Right sidebar displays sessions from all projects.`,htmlFor:`show-all-project-sessions`,children:(0,q.jsx)(z,{id:`show-all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>m({showAllProjectSessions:e})})})]})}function pt({profile:e}){let t=fe(),[n,r]=(0,K.useState)(!1),i=n=>{t.mutate({id:e.id,icon:n},{onError:e=>I(e)}),r(!1)},a=n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>I(e)});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{label:`Icon`,children:(0,q.jsxs)(We,{open:n,onOpenChange:r,children:[(0,q.jsx)(Be,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(Ve,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,q.jsx)(Qe,{align:`end`,className:`w-72`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>i(null),className:B(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,q.jsx)(Ve,{icon:null,colour:null,className:`size-4`})}),Ge.map(({name:t,Icon:n})=>(0,q.jsx)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:B(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,q.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,q.jsx)(Y,{label:`Icon colour`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,q.jsxs)(`button`,{type:`button`,title:`Default`,onClick:()=>a(null),className:B(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,!e.icon_colour&&`bg-elevated`),children:[(0,q.jsx)(`span`,{className:`size-3.5 rounded-full bg-fg-muted`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Default colour`})]}),o.map(t=>(0,q.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:B(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,e.icon_colour===t&&`bg-elevated`),children:[(0,q.jsx)(`span`,{className:B(`size-3.5 rounded-full bg-current`,Je(t))}),(0,q.jsx)(`span`,{className:`sr-only`,children:t})]},t))]})})]})}var mt=`__none__`;function ht(){let e=k(),t=ye().data?.find(t=>t.id===e),n=ae(e??void 0),r=D(e??void 0),i=fe(),a=O(e??``),o=ne(),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(``),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(``);if((0,K.useEffect)(()=>{t&&(c(t.name),u(t.branch_prefix))},[t]),!t)return null;let h=r.data?.default_account_id;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Profile`}),(0,q.jsxs)(Y,{label:`Name`,description:`Letters, digits, dot, underscore and hyphen.`,htmlFor:`profile-name`,children:[(0,q.jsx)(L,{id:`profile-name`,value:s,onChange:e=>c(e.target.value),className:`w-44`}),(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:s===t.name||s.trim()===``||i.isPending,onClick:()=>i.mutate({id:t.id,name:s},{onError:e=>I(e)}),children:`Save`})]}),(0,q.jsxs)(Y,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,q.jsx)(L,{id:`branch-prefix`,value:l,onChange:e=>u(e.target.value),placeholder:`no prefix`,className:`w-44`}),(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:l===t.branch_prefix||i.isPending,onClick:()=>i.mutate({id:t.id,branch_prefix:l},{onError:e=>I(e)}),children:`Save`})]}),(0,q.jsx)(pt,{profile:t}),(0,q.jsx)(Y,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,q.jsxs)(G,{value:typeof h==`number`?String(h):mt,onValueChange:e=>a.mutate({default_account_id:e===mt?null:Number(e)},{onError:e=>I(e)}),children:[(0,q.jsx)(W,{className:`w-56`,children:(0,q.jsx)(nt,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(H,{value:mt,children:`First available`}),n.data?.map(e=>(0,q.jsx)(H,{value:String(e.id),children:(0,q.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,q.jsx)(Y,{label:`Delete profile`,description:`Non-archived sessions block deletion.`,className:`mt-4`,children:(0,q.jsx)(A,{variant:`danger`,size:`sm`,onClick:()=>f(!0),children:`Delete…`})}),(0,q.jsx)(F,{open:d,onOpenChange:e=>{e||(f(!1),m(``))},children:(0,q.jsxs)(M,{children:[(0,q.jsxs)(Te,{children:[(0,q.jsxs)(N,{children:[`Delete profile `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),`?`]}),(0,q.jsx)(P,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(Ee,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),` to confirm`]}),(0,q.jsx)(L,{id:`delete-confirm-name`,value:p,onChange:e=>m(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,onClick:()=>{f(!1),m(``)},children:`Cancel`}),(0,q.jsx)(A,{variant:`danger`,disabled:p!==t.name||o.isPending,onClick:()=>o.mutate(t.id,{onSuccess:()=>{Ne(),me.set(null)},onError:e=>{f(!1),m(``),I(e)}}),children:`Delete profile`})]})]})})]})}function gt({agent:e,profileId:t,onClose:n,onCreated:r}){let i=ge(),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),l=se(it(s,150)),u=s.trim(),d=u===``||u.startsWith(`/`)||u.startsWith(`~`),f=a.trim()!==``&&d,p=()=>{!f||i.isPending||i.mutate({profile_id:t,agent_type:e.id,label:a.trim(),...u===``?{}:{import_dir:u}},{onSuccess:e=>{n(),r(e,u!==``)},onError:e=>I(e)})};return(0,q.jsx)(F,{open:!0,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(M,{children:[(0,q.jsxs)(Te,{children:[(0,q.jsxs)(N,{children:[`Add a `,e.display_name,` account`]}),(0,q.jsxs)(P,{children:[`Accounts are isolated config dirs under this profile. Naming one is enough — Puddle creates it and takes you straight to `,e.display_name,`’s login. To reuse an account you already have on this machine, give its config directory: it is copied in and the original is never touched.`]})]}),(0,q.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,q.jsx)(L,{autoFocus:!0,placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value)}),(0,q.jsx)(Oe,{value:s,onValueChange:c,placeholder:`(optional) existing config dir, e.g. ~/.claude`,hints:(l.data?.entries??[]).map(e=>({value:e.path,label:e.name}))})]}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,q.jsxs)(A,{disabled:!f||i.isPending,onClick:p,children:[(0,q.jsx)(Me,{}),`Add account`]})]})]})})}function _t({account:e,gateOpen:t,installed:n}){let r=ce(),i=le(),a=we(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(e.label),f=(0,K.useRef)(null);return(0,K.useEffect)(()=>d(e.label),[e.label]),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`input`,{ref:f,value:u,onChange:e=>d(e.target.value),onBlur:()=>{let t=u.trim();if(t!==e.label){if(t===``){d(e.label);return}i.mutate({id:e.id,label:t},{onError:t=>{I(t),d(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(d(e.label),t.currentTarget.blur())},"aria-label":`Account name`,className:`-mx-1 block w-full min-w-0 truncate rounded-sm bg-transparent px-1 py-0.5 text-sm text-fg transition-colors hover:bg-elevated focus:bg-elevated focus:outline-none`}),(0,q.jsxs)(`button`,{type:`button`,title:`Rename account`,onClick:()=>{f.current?.focus(),f.current?.select()},className:`shrink-0 rounded-sm p-0.5 text-fg-muted transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(De,{className:`size-3`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Rename account`})]})]}),(0,q.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-success`:`text-warning`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,q.jsx)(z,{checked:e.skip_permissions_default,onCheckedChange:t=>i.mutate({id:e.id,skip_permissions_default:t},{onError:e=>I(e)})})]}),(0,q.jsxs)(A,{size:`sm`,variant:`secondary`,disabled:r.isPending||!n,onClick:()=>r.mutate(e.id,{onSuccess:e=>s({stream:e.stream,hint:e.hint}),onError:e=>I(e)}),children:[(0,q.jsx)($e,{}),e.logged_in?`Re-login`:`Login`]}),(0,q.jsxs)(A,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>l(!0),children:[(0,q.jsx)(Pe,{}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),o&&(0,q.jsx)(ze,{stream:o.stream,hint:o.hint,label:`${e.agent_type}/${e.label}`,onClose:()=>s(null)}),(0,q.jsx)(F,{open:c,onOpenChange:l,children:(0,q.jsxs)(M,{children:[(0,q.jsxs)(Te,{children:[(0,q.jsxs)(N,{children:[`Delete `,(0,q.jsx)(`span`,{className:`text-fg`,children:e.label}),`?`]}),(0,q.jsx)(P,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,q.jsx)(A,{variant:`danger`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>l(!1),onError:e=>{l(!1),I(e)}}),children:`Delete account`})]})]})})]})}function vt(){let e=k(),t=ee(),n=ae(e??void 0),r=D(e??void 0),i=ce(),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(null),l=r.data?.allowSkipPermissions===!0;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[],r=e.available!==!1;return(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(Y,{label:e.display_name,description:r?`Accounts are initialised in config dirs owned by this profile.`:`No ${e.binary??e.id} on the daemon’s PATH. Install it or add its directory to the agent search path in Sessions.`,className:`py-1`,children:(0,q.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e.id})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,q.jsx)(_t,{account:t,gateOpen:l&&e.capabilities.skip_permissions,installed:r},t.id)),(0,q.jsx)(`div`,{className:`flex`,children:(0,q.jsxs)(A,{type:`button`,size:`sm`,variant:`secondary`,disabled:!r,onClick:()=>c(e),children:[(0,q.jsx)(Me,{}),`Add account`]})})]})]},e.id)}),a&&(0,q.jsx)(ze,{stream:a.stream,label:a.label,hint:a.hint,onClose:()=>o(null)}),s!==null&&e!==null&&(0,q.jsx)(gt,{agent:s,profileId:e,onClose:()=>c(null),onCreated:(e,t)=>{if(t){e.logged_in||C.info(`Imported without credentials — press Login to authenticate.`);return}i.mutate(e.id,{onSuccess:t=>o({stream:t.stream,label:`${e.agent_type}/${e.label}`,hint:t.hint}),onError:e=>I(e)})}})]})}function yt(){let e=T(),t=E(),[n,r]=(0,K.useState)(``);return(0,K.useEffect)(()=>{e.data&&r(e.data.agentPath)},[e.data]),(0,q.jsx)(Y,{label:`Agent search path (host-wide)`,description:`Colon-separated dirs the daemon prepends to PATH; helps find agent CLIs like claude (e.g. ~/.local/bin).`,htmlFor:`agent-path`,children:(0,q.jsx)(L,{id:`agent-path`,type:`text`,className:`w-64 text-2xs`,value:n,onChange:e=>r(e.target.value),onBlur:()=>{e.data&&n!==e.data.agentPath&&t.mutate({agentPath:n})}})})}function bt({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=tt(e,n),o=n.sessionDefaults??{},[s,c]=(0,K.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,q.jsx)(Y,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,q.jsx)(L,{id:`${e}-default-base`,type:`text`,placeholder:`repository default`,className:`w-48`,value:s,onChange:e=>c(e.target.value),onBlur:()=>{s.trim()!==a.baseBranch&&l({baseBranch:s.trim()})}})}),(0,q.jsx)(Y,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,q.jsx)(z,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,q.jsx)(Y,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`Start on working copy of the selected branch instead of sharing one directory.`,htmlFor:`${e}-default-dir`,children:(0,q.jsx)(z,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function xt(){return(0,q.jsx)(Y,{label:`Terminal scrollback`,htmlFor:`scrollback`,children:(0,q.jsx)(J,{id:`scrollback`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:p().terminalScrollback,onCommit:e=>m({terminalScrollback:e})})})}function St({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,K.useState)(r);return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,q.jsx)(R,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,q.jsx)(A,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var Ct={id:`4f3c2b1a-7e6d-5c4b-3a2f-1e0d9c8b7a6f`,title:null,agent_title:`Refactor the auth flow`,osc_title:`claude`,branch:`alice/refactor-auth`,worktree_path:`/home/alice/code/app--refactor-auth`,status:`waiting_input`,agent_type:`claude-code`};function wt({initial:e,onSave:t,pending:n}){let[r,i]=(0,K.useState)(e),a=r.length>0?r:y;return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,q.jsx)(L,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:y}),(0,q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,q.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:Ie(Ct,a)})]}),(0,q.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:u.map(([e,t])=>(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,q.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,q.jsx)(A,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(y),t(y)},children:`Reset to default`})]})]})}function Tt(){let e=k(),t=ye().data?.find(t=>t.id===e),n=D(e??void 0),r=O(e??``),[i,o]=(0,K.useState)(!1),[c,u]=(0,K.useState)(``),d=n.data?.allowSkipPermissions===!0,f=e=>r.mutate({allowSkipPermissions:e},{onSuccess:()=>{o(!1),u(``)},onError:e=>I(e)}),p=e=>t=>r.mutate({[e]:t},{onError:e=>I(e)});return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Sessions`}),(0,q.jsx)(Y,{label:`Skip permission prompts`,htmlFor:`gate`,children:(0,q.jsx)(z,{id:`gate`,checked:d,onCheckedChange:e=>{e?o(!0):f(!1)}})}),(0,q.jsx)(Y,{label:`Capture exported env variables`,description:n.data?.captureSessionEnv===!1?`No variables are captured or injected; already-captured variabless are kept for when this is re-enabled.`:`Variables exported in a session persist and are re-injected upon terminal and agent restarts.`,htmlFor:`capture-env`,children:(0,q.jsx)(z,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:r.isPending,onCheckedChange:e=>r.mutate({captureSessionEnv:e},{onError:e=>I(e)})})}),(0,q.jsx)(yt,{}),(0,q.jsx)(xt,{}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(X,{children:`New session defaults`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(bt,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>I(e)}),pending:r.isPending},`${e}:agent-seed`),(0,q.jsx)(bt,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>I(e)}),pending:r.isPending},`${e}:terminal-seed`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(X,{note:`Sent to agent as opening message when a session (re)starts. You can make this empty.`,children:`Launch text`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(St,{id:`onboarding-template`,label:`New worktree`,description:`Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??a,defaultText:a,onSave:p(`onboardingTemplate`),pending:r.isPending},`${e}:onboarding`),(0,q.jsx)(St,{id:`concurrent-template`,label:`Existing / shared worktree`,description:`For a session joining a worktree other agents may already be working in.`,initial:n.data.concurrentTemplate??l,defaultText:l,onSave:p(`concurrentTemplate`),pending:r.isPending},`${e}:concurrent`),(0,q.jsx)(St,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot.`,initial:n.data.restartTemplate??s,defaultText:s,onSave:p(`restartTemplate`),pending:r.isPending},`${e}:restart`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(X,{children:`Tab title`}),n.data&&(0,q.jsx)(wt,{initial:n.data.tabTitleTemplate||"${name}",onSave:p(`tabTitleTemplate`),pending:r.isPending},`${e}:tab-title`)]}),(0,q.jsx)(F,{open:i,onOpenChange:e=>{e||(o(!1),u(``))},children:(0,q.jsxs)(M,{children:[(0,q.jsxs)(Te,{children:[(0,q.jsxs)(N,{className:`flex items-center gap-2`,children:[(0,q.jsx)(lt,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,q.jsx)(P,{asChild:!0,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,q.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,q.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,q.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,q.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,q.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,q.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,q.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,q.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(Ee,{htmlFor:`confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t?.name}),` to confirm`]}),(0,q.jsx)(L,{id:`confirm-name`,value:c,onChange:e=>u(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,onClick:()=>{o(!1),u(``)},children:`Cancel`}),(0,q.jsx)(A,{variant:`danger`,disabled:c!==t?.name||r.isPending,onClick:()=>f(!0),children:`Open the gate`})]})]})})]})}var Et={desktop:!0,sound:!1,muted_projects:[]};function Dt(){let[e,t]=(0,K.useState)(Ze);return(0,K.useEffect)(()=>{let e=()=>t(Ze());return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),[e,()=>t(Ze())]}function Ot({permission:e,onRequest:t}){return e===`granted`?null:(0,q.jsxs)(`p`,{className:`pb-2 text-xs text-warning`,children:[e==="default"&&(0,q.jsxs)(q.Fragment,{children:[`The browser has not been asked for permission yet, so nothing will show —`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:t,className:`underline underline-offset-2 transition-colors hover:text-fg`,children:`request it now`}),`.`]}),e===`denied`&&`Blocked by the browser — allow notifications for this site in its site settings, then return here.`,e===`unsupported`&&`This browser cannot show desktop notifications.`]})}function kt(){let e=k(),t=D(e??void 0),n=O(e??``),r=de(e??void 0),[i,a]=Dt(),o={...Et,...t.data?.notifications??{}},s=e=>n.mutate({notifications:e},{onError:e=>I(e)}),c=()=>{typeof Notification>`u`||Notification.requestPermission().then(a)};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Notifications`}),(0,q.jsx)(Y,{label:`Desktop notification on waiting`,htmlFor:`notify-desktop`,children:(0,q.jsx)(z,{id:`notify-desktop`,checked:o.desktop,onCheckedChange:e=>{e&&c(),s({...o,desktop:e})}})}),o.desktop&&(0,q.jsx)(Ot,{permission:i,onRequest:c}),(0,q.jsx)(Y,{label:`Sound`,htmlFor:`notify-sound`,children:(0,q.jsx)(z,{id:`notify-sound`,checked:o.sound,onCheckedChange:e=>s({...o,sound:e})})}),(0,q.jsx)(Y,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,q.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[o.muted_projects.length,` muted`]})}),(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.data?.map(e=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,q.jsx)(z,{checked:o.muted_projects.includes(e.id),onCheckedChange:t=>s({...o,muted_projects:t?[...o.muted_projects,e.id]:o.muted_projects.filter(t=>t!==e.id)})}),e.name]},e.id))})]})}function At(){let e=p();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Editor`}),(0,q.jsx)(Y,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,q.jsx)(J,{id:`tab-size`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onCommit:e=>m({editorTabSize:e})})}),(0,q.jsx)(Y,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,q.jsx)(z,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>m({editorWordWrap:e})})}),(0,q.jsx)(Y,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,q.jsx)(L,{id:`editor-link-host`,type:`text`,placeholder:v.get()??`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>m({editorLinkSshHost:e.target.value})})})]})}function jt({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=he(e.nativeEvent);t&&(n(t),a(!1))},className:B(`min-w-24 rounded-md px-2 py-1 text-center font-mono text-xs transition-colors`,i?`bg-action text-action-ink`:`bg-elevated text-fg hover:bg-border/70`),children:i?`Press keys…`:ue(e)}),!t&&(0,q.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(st,{className:`size-3.5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function Mt(){let e=k(),t=D(e??void 0),n=O(e??``),r=t.data?.hotkeys??{},i=(e,t)=>r[e]||t,a=new Map;for(let e of Ce){let t=i(e.id,pe(e));a.set(t,(a.get(t)??0)+1)}let o=(e,t)=>n.mutate({hotkeys:{...r,[e]:t}},{onError:e=>I(e)}),s=e=>{let t={...r};delete t[e],n.mutate({hotkeys:t},{onError:e=>I(e)})};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Hotkeys`}),(0,q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed.`}),(0,q.jsx)(Y,{label:`App shortcuts in terminals`,description:t.data?.terminalAppShortcuts===!1?`A focused terminal receives these keys instead.`:`The shortcuts below work while a terminal is focused.`,htmlFor:`terminal-app-shortcuts`,className:`mb-4`,children:(0,q.jsx)(z,{id:`terminal-app-shortcuts`,checked:t.data?.terminalAppShortcuts!==!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({terminalAppShortcuts:e},{onError:e=>I(e)})})}),ve.map(e=>{let t=Ce.filter(t=>t.group===e);return t.length===0?null:(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=i(e.id,pe(e)),n=(a.get(t)??0)>1?`Conflicts with another shortcut.`:void 0;return(0,q.jsx)(Y,{label:e.label,description:n,descriptionClassName:n?`text-interrupted`:void 0,children:(0,q.jsx)(jt,{value:t,isDefault:!r[e.id],onRecord:t=>o(e.id,t),onReset:()=>s(e.id)})},e.id)})]},e)})]})}var Nt=e=>[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);function Pt(e,t){let[n,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(!1),[s,l]=(0,K.useState)(``),u=(0,K.useRef)(0);(0,K.useEffect)(()=>()=>{u.current+=1},[]);let d=(0,K.useRef)(t);return(0,K.useEffect)(()=>{d.current=t},[t]),(0,K.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{u.current+=1,i(null),l(`Sign-in expired. Try again.`)},Math.max(0,n.request.expires-Date.now()));return()=>clearTimeout(e)},[n]),(0,K.useEffect)(()=>{if(!n||e)return;let t=u.current,r=!1,a,o=async()=>{try{if(n.request.expires<=Date.now())throw Error(`Sign-in expired. Try again.`);let{ready:e}=x.parse(await S(`POST`,`/cockpit/remote/registration`,{service:n.request.service,code:n.code}));if(r||t!==u.current)return;if(n.request.expires<=Date.now())throw Error(`Sign-in expired. Try again.`);e?(i(null),await d.current({t:`enable`,registration:{service:n.request.service,app:n.request.app,code:n.code}})):a=setTimeout(()=>void o(),2e3)}catch(e){if(r||t!==u.current)return;i(null),l(e instanceof Error?e.message:`Sign-in failed. Try again.`)}};return a=setTimeout(()=>void o(),2e3),()=>{r=!0,clearTimeout(a)}},[n,e]),{attempt:n,preparing:a,error:s,begin:async(e,t,n)=>{let a=++u.current;o(!0),l(``);try{let o=Nt(crypto.getRandomValues(new Uint8Array(32))),s=Nt(new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(o))));if(a!==u.current)return;let l=r.safeParse({service:e.trim(),app:t.trim(),label:n.trim(),challenge:s,expires:Date.now()+c.invitationMs});if(!l.success)throw Error(`Enter a host name and exact HTTPS application and relay origins.`);let d=l.data,f=`${d.app}/#register=${encodeURIComponent(JSON.stringify(d))}`;i({request:d,code:o,url:f}),window.open(f,`_blank`,`noopener,noreferrer`)}catch(e){l(e instanceof Error?e.message:`Could not start sign-in.`)}finally{o(!1)}},cancel:()=>{u.current+=1,i(null)}}}function Ft({service:e=`https://charles.waddlelabs.ai`,app:t=`https://puddle.waddlelabs.ai`,hostName:n,busy:r,disabled:i,enable:a,cancel:o}){let[s,c]=(0,K.useState)(e),[l,u]=(0,K.useState)(t),[d,f]=(0,K.useState)(n),p=Pt(i,a),m=i||p.preparing||!!p.attempt;return(0,q.jsxs)(`form`,{className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),m||p.begin(s,l,d)},children:[(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Application origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`https://app.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Relay origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://relay.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Host name`,(0,q.jsx)(L,{required:!0,maxLength:80,value:d,onChange:e=>f(e.target.value),disabled:m})]}),o&&(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saving a new registration revokes existing browser approvals and invitations.`}),p.error&&(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p.error}),p.attempt?(0,q.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,q.jsxs)(`p`,{role:`status`,children:[`Confirm this host in your browser. Match request`,` `,(0,q.jsx)(`strong`,{className:`font-mono`,children:p.attempt.request.challenge.slice(0,8).toUpperCase()}),`. Sign-in expires in five minutes.`]}),(0,q.jsx)(`a`,{href:p.attempt.url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:opacity-80`,children:`Continue in browser ↗`}),(0,q.jsx)(A,{type:`button`,variant:`ghost`,onClick:p.cancel,children:`Cancel sign-in`})]}):(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(A,{type:`submit`,disabled:m||!d.trim()||!s||!l,children:r?`Enabling…`:p.preparing?`Opening browser…`:`Sign in and enable`}),o&&(0,q.jsx)(A,{type:`button`,variant:`ghost`,disabled:m,onClick:o,children:`Cancel`})]})]})}var It=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),Z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),Lt=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Rt=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),zt=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Bt=t((e=>{var t=Z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Vt=t((e=>{var t=Z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ht=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Ut=t((e=>{var t=Lt(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Wt=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Gt=t((e=>{var t=Wt();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Kt=t(((e,t)=>{var n=Gt();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),qt=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Jt=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Q=t((e=>{var t=qt(),n=Jt();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Yt=t((e=>{var t=Z(),n=Ut(),r=Lt(),i=Q(),a=qt(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Xt=t((e=>{var t=Z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Zt=t(((e,t)=>{var n=Q();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Qt=t(((e,t)=>{var n=Q(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),$t=t(((e,t)=>{var n=Q();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),en=t(((e,t)=>{var n=Q(),r=Z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),tn=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),nn=t((e=>{var t=Q(),n=Zt(),r=Qt(),i=$t(),a=en(),o=Jt(),s=Z(),c=tn();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),rn=t((e=>{var t=Z(),n=Lt(),r=Rt(),i=zt(),a=Bt(),o=Vt(),s=Ht(),c=Ut(),l=Kt(),u=Yt(),d=Xt(),f=Q(),p=nn();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
5
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+c+`.
|
|
7
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),an=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),on=t((e=>{var t=an();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),sn=t((e=>{var t=an();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
-
`;return typeof a==`function`&&a(null,p),p}})),cn=e(t((e=>{var t=It(),n=rn(),r=on(),i=sn();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function ln({value:e,label:t}){let n=(0,K.useMemo)(()=>{try{let{modules:t}=cn.create(e),n=[];for(let e=0;e<t.size;e+=1)for(let r=0;r<t.size;r+=1)t.get(e,r)&&n.push(`M${r+4} ${e+4}h1v1h-1z`);return{size:t.size+8,path:n.join(``)}}catch{return null}},[e]);return n?(0,q.jsx)(`svg`,{role:`img`,"aria-label":t,"data-theme":`light`,className:`block h-auto max-w-full rounded-lg bg-paper text-fg`,xmlns:`http://www.w3.org/2000/svg`,width:280,height:280,viewBox:`0 0 ${n.size} ${n.size}`,shapeRendering:`crispEdges`,children:(0,q.jsx)(`path`,{fill:`currentColor`,d:n.path})}):(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`QR code unavailable. Use the pairing link.`})}function un({url:e,expires:t,dismiss:n}){let[r,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let e=setTimeout(n,Math.max(0,t-Date.now()));return()=>clearTimeout(e)},[t,n]),(0,q.jsxs)(`section`,{className:`mt-5 space-y-3`,"aria-label":`Pairing invitation`,children:[(0,q.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Scan or open this link on the new browser, then approve its exact identity below. Expires`,` `,new Date(t).toLocaleTimeString(),`.`]}),(0,q.jsx)(ln,{value:e,label:`Pairing invitation QR code`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(A,{variant:`secondary`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>i(`Pairing link copied.`)).catch(()=>i(`Could not copy. Open the pairing link or scan the QR code.`))},children:`Copy pairing link`}),(0,q.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`px-2 text-sm text-fg hover:opacity-80`,children:`Open pairing link ↗`}),(0,q.jsx)(A,{variant:`ghost`,onClick:n,children:`Hide invitation`})]}),r&&(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:r})]})}function dn({devices:e,now:t,busy:n,act:r}){return(0,q.jsxs)(`section`,{className:`mt-6 space-y-4`,"aria-label":`Browsers`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Browsers`}),(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Approval grants terminal control of this host.`}),e.length===0&&(0,q.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No browsers yet. Create a pairing invitation to add one.`}),[...e].sort((e,t)=>Number(t.status===`pending`)-Number(e.status===`pending`)).map(e=>{let i=e.status===`approved`?Math.min(e.expires,e.lastUsed+c.idleMs):e.expires,a=i<=t,o=e.status===`revoked`?`Revoked`:a?`Expired`:e.status===`pending`?`Awaiting approval`:`Approved`;return(0,q.jsxs)(`div`,{className:`space-y-1.5 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium`,children:e.label}),(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o})]}),(0,q.jsx)(`code`,{className:`block break-all text-xs text-fg-secondary`,children:e.peer}),(0,q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a?`Expired`:`Expires`,` `,new Date(i).toLocaleString()]}),e.status!==`revoked`&&(0,q.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[e.status===`pending`&&!a&&(0,q.jsx)(A,{size:`sm`,disabled:n,onClick:()=>void r({t:`approve`,id:e.id}),children:`Approve this identity`}),(0,q.jsx)(A,{size:`sm`,variant:`ghost`,disabled:n,"aria-label":`Revoke ${e.label}`,onClick:()=>void r({t:`revoke`,id:e.id}),children:`Revoke`})]})]},e.id)})]})}function fn({open:e,busy:t,error:n,onOpenChange:r,onConfirm:i}){return(0,q.jsx)(F,{open:e,onOpenChange:e=>!t&&r(e),children:(0,q.jsxs)(M,{children:[(0,q.jsx)(N,{children:`Delete this host’s remote registration?`}),(0,q.jsx)(P,{children:`Disable remote access, remove the saved registration from this host and revoke every browser approval and invitation. Agents keep running. Connecting again requires a new registration code and fresh browser approvals.`}),(0,q.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`To also remove this host from the relay’s account list, choose Unregister in the web app.`}),n&&(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,disabled:t,onClick:()=>r(!1),children:`Cancel`}),(0,q.jsx)(A,{variant:`danger`,disabled:t,onClick:i,children:t?`Deleting…`:`Delete registration`})]})]})})}function pn(){let e=oe(),t=xe(),[n,r]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=(0,K.useCallback)(()=>_(null),[]),y=ie({queryKey:[`cockpit-remote`],queryFn:async()=>i.parse(await S(`GET`,`/cockpit/remote`)),refetchInterval:!n&&5e3,refetchOnWindowFocus:!n,refetchOnReconnect:!n,retry:!1,gcTime:0}),b=async t=>{if(n)return!1;r(!0),c(``),o(``);try{if(e.isFetching({queryKey:[`cockpit-remote`],exact:!0})){let e=await y.refetch({cancelRefetch:!1});if(e.isError)throw e.error}let n=h.parse(await S(`POST`,`/cockpit/remote`,t));return t.t===`pair`&&n.url&&n.invitation?_({url:n.url,expires:n.invitation.expires}):(o({enable:`Remote access enabled.`,approve:`Browser approved.`,revoke:`Browser revoked.`,disable:`Remote access disabled. Agents continue running.`,delete_registration:`Registration deleted from this host. Agents continue running.`,reset:`Host identity rotated and all browsers revoked. Enable access and pair again.`,status:`Status refreshed.`,devices:`Browsers refreshed.`,pair:`Invitation created.`}[t.t]),(t.t===`disable`||t.t===`reset`||t.t===`enable`||t.t===`delete_registration`)&&v()),(t.t===`enable`||t.t===`delete_registration`)&&u(!1),f(!1),m(!1),await y.refetch(),!0}catch(e){return c(e instanceof Error?e.message:`Host operation failed. Refresh status before retrying.`),await y.refetch(),!1}finally{r(!1)}},x=y.data,C=y.error instanceof w&&y.error.status===404,T=n||y.isError;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{note:`Applies to ${t.data?.displayName||t.data?.hostname||`the host open in this window`}, across all profiles`,children:`Remote access`}),(0,q.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,q.jsx)(`span`,{role:`status`,className:`text-sm font-medium`,children:y.isError?`Status unavailable`:x?x.availability===`ready`?x.configured?x.enabled?x.connected?`Connected to relay`:`Enabled · relay disconnected`:`Disabled`:`Not configured`:`Daemon upgrade required`:`Checking remote access…`}),(0,q.jsxs)(A,{variant:`ghost`,size:`sm`,disabled:n,onClick:()=>void y.refetch({cancelRefetch:!1}),children:[(0,q.jsx)(Le,{}),`Refresh status`]})]}),y.isError&&(0,q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:C?`This cockpit does not provide remote controls. Update Puddle and reopen this window.`:y.error.message}),s&&!p&&(0,q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:s}),a&&(0,q.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-secondary`,children:a}),x?.availability!==void 0&&x.availability!==`ready`&&(0,q.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:`Update the daemon on this host, then refresh status to set up mobile access.`}),x?.availability===`ready`&&(0,q.jsxs)(q.Fragment,{children:[!x.enabled&&x.supervisor&&(!x.configured||l)?(0,q.jsx)(Ft,{service:x.service,app:x.app,hostName:t.data?.displayName||t.data?.hostname||`My host`,busy:n,disabled:T,enable:b,cancel:x.configured?()=>u(!1):void 0},x.host??`new`):x.configured?(0,q.jsxs)(`dl`,{className:`mt-4 space-y-2 text-xs text-fg-secondary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{className:`text-fg-muted`,children:`Application`}),(0,q.jsx)(`dd`,{className:`break-all`,children:(0,q.jsxs)(`a`,{href:x.app,target:`_blank`,rel:`noreferrer`,className:`hover:text-fg`,children:[x.app,` ↗`]})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{className:`text-fg-muted`,children:`Relay`}),(0,q.jsx)(`dd`,{className:`break-all`,children:x.service})]}),x.peer&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{className:`text-fg-muted`,children:`Host identity`}),(0,q.jsx)(`dd`,{className:`break-all font-mono`,children:x.peer})]})]}):null,!x.enabled&&!x.supervisor&&(0,q.jsx)(`p`,{className:`mt-4 text-sm text-fg-secondary`,children:`This host needs persistent systemd or launchd supervision before access can be enabled here. For another supervisor, configure both the daemon and connector using the remote CLI commands.`}),!x.enabled&&x.supervisor&&x.configured&&!l&&(0,q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,q.jsx)(A,{disabled:T,onClick:()=>void b({t:`enable`}),children:`Enable remote access`}),(0,q.jsx)(A,{variant:`ghost`,disabled:T,onClick:()=>u(!0),children:`Change registration`})]}),x.enabled&&(0,q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,q.jsx)(A,{disabled:T,onClick:()=>void b({t:`pair`}),children:`Pair a browser`}),(0,q.jsx)(A,{variant:`ghost`,disabled:T,onClick:()=>void b({t:`disable`}),children:`Disable remote access`})]}),g&&x.enabled&&(0,q.jsx)(un,{...g,dismiss:v}),x.configured&&(0,q.jsxs)(q.Fragment,{children:[x.canDeleteRegistration&&(0,q.jsx)(A,{className:`mt-4`,variant:`ghost`,disabled:T,onClick:()=>{c(``),m(!0)},children:`Delete registration…`}),(0,q.jsx)(dn,{devices:x.devices,now:y.dataUpdatedAt,busy:T,act:b}),(0,q.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:`Revocation and disabling detach remote viewers; agents continue running. Browsers expire after 30 days of inactivity or 90 days overall.`}),(0,q.jsxs)(rt,{className:`mt-6 text-sm`,summary:`Host identity recovery`,summaryClassName:`py-2`,children:[(0,q.jsx)(`p`,{className:`my-3 text-xs text-fg-muted`,children:`Rotate a lost or compromised host identity. All browser approvals and invitations will be revoked.`}),(0,q.jsx)(A,{variant:`ghost`,disabled:T,onClick:()=>f(!0),children:`Reset host identity…`})]})]})]}),(0,q.jsx)(F,{open:d,onOpenChange:e=>!n&&f(e),children:(0,q.jsxs)(M,{children:[(0,q.jsx)(N,{children:`Reset this host’s remote identity?`}),(0,q.jsx)(P,{children:`Disable remote access, rotate the host identity and revoke every paired browser and invitation. Agents keep running. Enable access and pair each browser again afterwards.`}),(0,q.jsxs)(j,{children:[(0,q.jsx)(A,{variant:`ghost`,disabled:n,onClick:()=>f(!1),children:`Cancel`}),(0,q.jsx)(A,{variant:`danger`,disabled:n,onClick:()=>void b({t:`reset`}),children:`Reset host identity`})]})]})}),(0,q.jsx)(fn,{open:p,busy:n,error:s,onOpenChange:m,onConfirm:()=>void b({t:`delete_registration`})})]})}var mn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,$=65,hn=Object.fromEntries([...mn].map((e,t)=>[e,t])),gn=`H`,_n=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function vn(e){let t=4294967295;for(let n of e)t=_n[(t^n)&255]^t>>>8;return((t^4294967295)>>>0).toString(16).padStart(8,`0`)}function yn(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function bn(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}async function xn(e){let t=new Blob([new TextEncoder().encode(e)]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function Sn(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(t).text()}function Cn(e,t){let n=(t%$+$)%$,r=``;for(let t of e){let e=hn[t];r+=e===void 0?t:mn[(e+n)%$]}return r}async function wn(e){let t=await xn(JSON.stringify(e));return Cn(yn(t)+vn(t),1+Math.floor(Math.random()*($-1)))}async function Tn(e){let t=e.trim(),n=t[0];if(!n||hn[n]===void 0)throw Error(`Not a settings export.`);let r=Cn(t,-((hn[n]-hn[gn]+$)%$));if(r.length<9||r[0]!==gn)throw Error(`Not a settings export.`);let i=r.slice(0,-8),a=r.slice(-8),o=bn(i);if(vn(o)!==a)throw Error(`Settings export is corrupt (checksum mismatch).`);return JSON.parse(await Sn(o))}var En=`puddle.sync-selection`;function Dn(){try{let e=JSON.parse(localStorage.getItem(En)??`null`);if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}catch{}return Re.map(e=>e.id)}function On({selected:e,onToggle:t}){return(0,q.jsx)(`div`,{className:`flex flex-col gap-2 pl-1`,children:Re.map(n=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,q.jsx)(z,{checked:e.includes(n.id),onCheckedChange:e=>t(n.id,e)}),n.label]},n.id))})}function kn(){let e=k(),t=D(e??void 0),n=ye().data?.find(t=>t.id===e),r=_e(e??void 0,void 0),i=O(e??``),a=fe(),o=re(),s=Ye(),c=Ue(),[l,u]=(0,K.useState)(``),[d,p]=(0,K.useState)(``),[h,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(Dn),x=n&&s.data?Ke(s.data.file,n.name):void 0,S=x?.enabled===!0,w=S&&x?x.groups:v,T=()=>({client:g(),theme:f(),profileSettings:t.data??{},profile:n??{},scratchpad:r.data??[]}),ee={setClient:e=>m(e),setTheme:e=>{typeof e==`string`&&b(e)},patchProfileSettings:e=>i.mutate(e,{onError:e=>I(e)}),patchProfileColumns:t=>{e&&a.mutate({id:e,...t},{onError:e=>I(e)})},createScratchpad:t=>{if(e)for(let n of t)o.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},te=(e,t)=>{n&&c.mutate({profile:n.name,entry:{enabled:e.enabled??S,groups:t,doc:Xe(t,T()),updatedAt:new Date().toISOString()}},{onError:e=>I(e)})},ne=(e,t)=>{let n=t?[...w,e]:w.filter(t=>t!==e);y(n),localStorage.setItem(En,JSON.stringify(n)),S&&te({},n)},E=async()=>{_(!0);try{let e=qe(await Tn(l.trim()),ee,{profileSettings:t.data??{},scratchpad:r.data??[]});e.length===0?C.error(`Nothing recognised to import.`):(C.success(`Imported ${e.join(`, `)}.`),u(``))}catch(e){C.error(e.message)}finally{_(!1)}},ie=async()=>{_(!0);try{let e=await wn(Xe(w,T()));p(e),await navigator.clipboard?.writeText(e),C.success(`Copied to clipboard`)}finally{_(!1)}};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Sync`}),(0,q.jsx)(`p`,{className:`mb-5 text-xs text-fg-muted`,children:`Carry your settings between machines. Accounts, repositories, and anything host-specific are never included. Applies to this profile.`}),(0,q.jsxs)(`div`,{className:`mb-6`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Sync locally`}),s.data?.available===!1?(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Not available in this cockpit — start the UI with the Puddle CLI to sync across windows.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:[`Sync selected groups through this machine’s`,` `,(0,q.jsx)(`span`,{className:`text-fg-secondary`,children:`~/.puddle`}),`, so every Puddle window stays in step for profiles named`,` `,(0,q.jsx)(`span`,{className:`text-fg-secondary`,children:n?.name??`…`}),`.`]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,q.jsx)(z,{checked:S,disabled:!n||s.isLoading||c.isPending,onCheckedChange:e=>te({enabled:e},w)}),`Sync locally`]})]})]}),(0,q.jsx)(rt,{className:`mb-6`,summary:`Choose what to sync`,summaryClassName:`text-xs`,children:(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(On,{selected:w,onToggle:ne})})}),(0,q.jsxs)(`div`,{className:`mb-6`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Export`}),(0,q.jsx)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:`Builds a Puddle magic string that encodes settings from the checklist above.`}),(0,q.jsx)(A,{size:`sm`,disabled:h,onClick:()=>void ie(),children:`Export & copy`}),d&&(0,q.jsx)(R,{readOnly:!0,value:d,rows:3,spellCheck:!1,onFocus:e=>e.currentTarget.select(),className:`mt-2 resize-y font-mono text-xs`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Import`}),(0,q.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Paste a Puddle magic string to import its settings.`}),(0,q.jsx)(R,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Paste a settings export…`,rows:3,spellCheck:!1,className:`resize-y font-mono text-xs`}),(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(A,{size:`sm`,disabled:!l.trim()||h,onClick:()=>void E(),children:`Import`})})]})]})}function An(){return(0,q.jsxs)(`div`,{className:`space-y-8`,children:[(0,q.jsx)(pn,{}),(0,q.jsx)(kn,{})]})}function jn({repo:e}){let t=Se(),n=te(),[r,i]=(0,K.useState)(e.default_base_branch),[a,o]=(0,K.useState)(e.onboarding_notes??``),s=e=>I(e);return(0,q.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface p-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:e.path}),(0,q.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted tabular-nums`,children:e.last_fetched_at?`fetched ${new Date(e.last_fetched_at).toLocaleString()}`:`never fetched`}),(0,q.jsxs)(A,{size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:()=>C.success(`Fetched.`),onError:s}),children:[(0,q.jsx)(Le,{}),`Fetch now`]})]}),(0,q.jsxs)(Y,{label:`Default base branch`,htmlFor:`base-${e.id}`,className:`py-1.5`,children:[(0,q.jsx)(L,{id:`base-${e.id}`,value:r,onChange:e=>i(e.target.value),className:`w-40`}),(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:r===e.default_base_branch||t.isPending,onClick:()=>t.mutate({id:e.id,default_base_branch:r},{onError:s}),children:`Save`})]}),(0,q.jsx)(Y,{label:`Periodic fetch`,description:`Fetched on open and on the daemon's interval while sessions are active.`,htmlFor:`fetch-${e.id}`,className:`py-1.5`,children:(0,q.jsx)(z,{id:`fetch-${e.id}`,checked:e.fetch_enabled,onCheckedChange:n=>t.mutate({id:e.id,fetch_enabled:n},{onError:s})})}),(0,q.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`notes-${e.id}`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Onboarding notes`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Standing setup rules, injected into every fresh worktree. Agents update them via .puddle/onboarding-notes.md.`})]}),(0,q.jsx)(R,{id:`notes-${e.id}`,value:a,onChange:e=>o(e.target.value),rows:4}),(0,q.jsx)(`div`,{children:(0,q.jsx)(A,{size:`sm`,variant:`secondary`,disabled:a===(e.onboarding_notes??``)||t.isPending,onClick:()=>t.mutate({id:e.id,onboarding_notes:a},{onError:s}),children:`Save notes`})})]}),e.orphan_worktrees.length>0&&(0,q.jsxs)(`div`,{className:`mt-3 rounded-md bg-elevated p-2`,children:[(0,q.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:`Orphan worktrees — directories no session claims. Puddle never deletes these automatically; remove them by hand if unwanted.`}),(0,q.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,children:e.orphan_worktrees.map(e=>(0,q.jsx)(`li`,{className:`truncate text-2xs text-fg-muted`,children:e},e))})]})]})}function Mn(){let e=be();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{children:`Projects`}),e.data?.length===0&&(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No projects yet — create one from the dashboard, pointing at a repository.`}),e.data?.map(e=>(0,q.jsx)(jn,{repo:e},e.id))]})}function Nn({label:e,description:t,field:n,config:r,min:i,step:a=1}){let o=E();return(0,q.jsx)(Y,{label:e,description:t,htmlFor:`host-${n}`,children:(0,q.jsx)(L,{id:`host-${n}`,type:`number`,min:i,step:a,className:`w-32 tabular-nums`,defaultValue:r[n],onBlur:e=>{if(e.target.value.trim()===``){e.target.value=String(r[n]);return}let t=Number(e.target.value);Number.isFinite(t)&&t!==r[n]&&o.mutate({[n]:t},{onError:e=>I(e)})}})})}function Pn(){let e=T(),t=E(),n=xe();return e.data?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(X,{note:`Affects all profiles on this host`,children:`Host`}),(0,q.jsx)(Y,{label:`Display name`,description:`Shown in place of the hostname across the UI. Leave blank for the hostname.`,htmlFor:`host-displayName`,children:(0,q.jsx)(L,{id:`host-displayName`,type:`text`,maxLength:64,className:`w-48`,placeholder:n.data?.hostname,defaultValue:e.data.displayName,onBlur:n=>{let r=n.target.value.trim();r!==e.data.displayName&&t.mutate({displayName:r},{onError:e=>I(e)})}})}),(0,q.jsx)(Nn,{label:`Fetch interval (minutes)`,description:`Periodic git fetch for repos with active sessions.`,field:`fetchIntervalMinutes`,config:e.data,min:1}),(0,q.jsx)(Nn,{label:`Log size cap (bytes)`,description:`Per-terminal on-disk log cap.`,field:`logMaxBytes`,config:e.data,min:65536,step:1048576}),(0,q.jsx)(Nn,{label:`Replay size (bytes)`,description:`Log tail sent to a terminal on attach.`,field:`replayBytes`,config:e.data,min:1024,step:65536}),(0,q.jsx)(Nn,{label:`UI-state retention (days)`,description:`Stale workspace snapshots are swept at boot.`,field:`uiStateRetentionDays`,config:e.data,min:1}),(0,q.jsx)(Y,{label:`Auto-resume`,description:`Resume interrupted sessions automatically after a daemon restart.`,htmlFor:`host-autoResume`,children:(0,q.jsx)(z,{id:`host-autoResume`,checked:e.data.autoResume,onCheckedChange:e=>t.mutate({autoResume:e},{onError:e=>I(e)})})})]}):null}var Fn=[{id:`appearance`,label:`Appearance`,icon:He,render:()=>(0,q.jsx)(ft,{})},{id:`profile`,label:`Profile`,icon:je,render:()=>(0,q.jsx)(ht,{})},{id:`accounts`,label:`Accounts`,icon:dt,render:()=>(0,q.jsx)(vt,{})},{id:`sessions`,label:`Sessions`,icon:ut,render:()=>(0,q.jsx)(Tt,{})},{id:`editor`,label:`Editor`,icon:ot,render:()=>(0,q.jsx)(At,{})},{id:`hotkeys`,label:`Hotkeys`,icon:et,render:()=>(0,q.jsx)(Mt,{})},{id:`notifications`,label:`Notifications`,icon:at,render:()=>(0,q.jsx)(kt,{})},{id:`projects`,label:`Projects`,icon:ke,render:()=>(0,q.jsx)(Mn,{})},{id:`host`,label:`Host`,icon:ct,render:()=>(0,q.jsx)(Pn,{})},{id:`remote-sync`,label:`Remote & Sync`,icon:Le,render:()=>(0,q.jsx)(An,{})}],In={terminal:`sessions`,repositories:`projects`,remote:`remote-sync`,sync:`remote-sync`};function Ln(){let e=Fe(),t=e===null?null:In[e]??e,n=Fn.find(e=>e.id===t)??Fn[0];return(0,q.jsx)(F,{open:e!==null,onOpenChange:e=>!e&&Ne(),children:(0,q.jsxs)(M,{wide:!0,className:`grid h-[34rem] grid-cols-[14rem_1fr] gap-0 overflow-hidden p-0`,children:[(0,q.jsx)(N,{className:`sr-only`,children:`Settings`}),(0,q.jsxs)(`nav`,{className:`flex flex-col gap-1 bg-surface p-2.5 pr-6`,children:[(0,q.jsx)(`span`,{className:`px-2.5 py-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`Settings`}),Fn.map(({id:e,label:t,icon:r})=>(0,q.jsxs)(`button`,{onClick:()=>Ae(e),className:B(`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors`,e===n.id?`bg-elevated text-fg`:`text-fg-secondary hover:bg-elevated hover:text-fg`),children:[(0,q.jsx)(r,{className:`size-4 shrink-0`}),t]},e))]}),(0,q.jsx)(`div`,{className:`overflow-y-auto p-5`,children:n.render()})]})})}export{Ln as SettingsDialog};
|