@p4code/cli 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +127 -25
- package/dist/client/assets/{DiffPanel-DGEBwIDZ.js → DiffPanel-Ijopbelf.js} +3 -3
- package/dist/client/assets/{FilePreviewPanel-CoQWRSoe.js → FilePreviewPanel-C7sNX4dx.js} +7 -7
- package/dist/client/assets/PreviewPanel-CRwar_cp.js +2 -0
- package/dist/client/assets/arrow-right-BnQZ60ie.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-C-wWopty.js → fileCommentAnnotations-CbfdaFFi.js} +2 -2
- package/dist/client/assets/index-C97EL4Np.js +965 -0
- package/dist/client/assets/terminal-links-B2KXT7CK.js +46 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/PreviewPanel-fmAW4iEw.js +0 -2
- package/dist/client/assets/arrow-right-DTy7s06V.js +0 -2
- package/dist/client/assets/index-Cwuc4uKy.js +0 -952
- package/dist/client/assets/terminal-links-B1K-cj6g.js +0 -46
package/dist/client/index.html
CHANGED
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
does not flash a stage label the client will not use.
|
|
91
91
|
-->
|
|
92
92
|
<title>P4Code</title>
|
|
93
|
-
<script type="module" crossorigin src="/assets/index-
|
|
93
|
+
<script type="module" crossorigin src="/assets/index-C97EL4Np.js"></script>
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/compiler-runtime-CLAvuQ-D.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-CEhsl8MR.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/terminal-links-
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/terminal-links-B2KXT7CK.js">
|
|
98
98
|
<link rel="stylesheet" crossorigin href="/assets/index-BTvaMCkl.css">
|
|
99
99
|
</head>
|
|
100
100
|
<body>
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$r as i,A as a,Bs as o,C as s,E as c,I as l,O as u,Oc as d,Ps as f,Vu as p,Wr as m,Wt as h,ai as g,ci as ee,dc as _,di as v,g as y,gc as b,ii as x,in as S,k as C,li as w,ll as T,mc as E,nc as te,ni as D,oi as ne,pc as O,ri as k,u as re,ui as A,w as j,wc as M,xc as N,xs as P,zu as ie}from"./terminal-links-B1K-cj6g.js";import{t as F}from"./arrow-right-DTy7s06V.js";import{A as I,An as L,Ar as ae,Dr as oe,F as R,G as se,Gr as ce,M as z,Mn as B,Mr as le,N as V,Nn as H,Nr as ue,O as U,Or as de,P as W,Pn as G,Qn as K,Rr as q,Vr as fe,a as pe,ar as J,c as me,cr as he,dr as ge,er as _e,fr as ve,g as ye,hr as Y,i as be,ir as xe,j as Se,jn as Ce,jr as we,k as Te,lr as Ee,mr as X,n as De,nr as Oe,o as ke,or as Ae,pr as je,r as Me,rr as Ne,s as Pe,sr as Fe,t as Ie,tr as Le,ur as Re}from"./index-Cwuc4uKy.js";var ze=P(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Be=P(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ve=P(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),He=P(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Z=e(n(),1),Q=r(),$=t();function Ue(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-autofill:bg-foreground/4 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{className:i,"data-slot":`input-group`,role:`group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var We=f(`[&_svg]:-mx-0.5 flex h-auto cursor-text select-none items-center justify-center gap-2 leading-none [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80`,{defaultVariants:{align:`inline-start`},variants:{align:{"block-end":`order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"block-start":`order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"inline-end":`has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]`,"inline-start":`has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]`}}});function Ge(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=h(We({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,$.jsx)(`div`,{className:o,"data-align":a,"data-slot":`input-group-addon`,onMouseDown:Ke,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Ke(e){if(e.target.closest(`button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']`))return;e.preventDefault();let t=e.currentTarget.parentElement,n=t?.querySelector(`input, textarea`);n&&!t?.querySelector(`input:focus, textarea:focus`)&&n.focus()}function qe(e){let t=(0,Q.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(K,{className:n,unstyled:!0,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Je=()=>{};function Ye(e){let t=(0,Q.c)(98),{url:n,displayUrl:r,loading:i,loadProgress:a,canGoBack:o,canGoForward:l,refreshDisabled:u,inputDisabled:d,focusUrlNonce:f,onBack:p,onForward:g,onRefresh:ee,onSubmit:_,onOpenInBrowser:v,onCapture:y,captureDisabled:b,recording:x,onPictureInPicture:S,pictureInPicture:C,pictureInPictureDisabled:w,onPickElement:T,pickActive:E,pickDisabled:te,pickDisabledReason:D,trailingActions:ne}=e,O=(0,Z.useRef)(null),[k,re]=(0,Z.useState)(n),[A,M]=(0,Z.useState)(!1),N,P;t[0]===f?(N=t[1],P=t[2]):(N=()=>{if(f==null)return;let e=O.current;e&&e.focus()},P=[f],t[0]=f,t[1]=N,t[2]=P),(0,Z.useEffect)(N,P);let ie;t[3]!==k||t[4]!==_?(ie=e=>{e?.preventDefault();let t=k.trim();t.length!==0&&(_(t),O.current?.blur())},t[3]=k,t[4]=_,t[5]=ie):ie=t[5];let I=ie,L=o?p:Je,ae=!o,R;t[6]!==L||t[7]!==ae?(R=(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:L,disabled:ae,"aria-label":`Back`,type:`button`}),t[6]=L,t[7]=ae,t[8]=R):R=t[8];let se;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(ce,{}),t[9]=se):se=t[9];let z;t[10]===R?z=t[11]:(z=(0,$.jsx)(c,{render:R,children:se}),t[10]=R,t[11]=z);let B;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(j,{children:`Back`}),t[12]=B):B=t[12];let V;t[13]===z?V=t[14]:(V=(0,$.jsxs)(s,{children:[z,B]}),t[13]=z,t[14]=V);let H=l?g:Je,ue=!l,U;t[15]!==H||t[16]!==ue?(U=(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:H,disabled:ue,"aria-label":`Forward`,type:`button`}),t[15]=H,t[16]=ue,t[17]=U):U=t[17];let de;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(F,{}),t[18]=de):de=t[18];let W;t[19]===U?W=t[20]:(W=(0,$.jsx)(c,{render:U,children:de}),t[19]=U,t[20]=W);let G;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(j,{children:`Forward`}),t[21]=G):G=t[21];let K;t[22]===W?K=t[23]:(K=(0,$.jsxs)(s,{children:[W,G]}),t[22]=W,t[23]=K);let q=u?Je:ee,pe=i?`Stop`:`Refresh`,J;t[24]!==u||t[25]!==q||t[26]!==pe?(J=(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:q,disabled:u,"aria-label":pe,type:`button`}),t[24]=u,t[25]=q,t[26]=pe,t[27]=J):J=t[27];let me=i&&`animate-spin`,he;t[28]===me?he=t[29]:(he=h(me),t[28]=me,t[29]=he);let ge;t[30]===he?ge=t[31]:(ge=(0,$.jsx)(oe,{className:he}),t[30]=he,t[31]=ge);let _e;t[32]!==J||t[33]!==ge?(_e=(0,$.jsx)(c,{render:J,children:ge}),t[32]=J,t[33]=ge,t[34]=_e):_e=t[34];let ve=i?`Loading…`:`Refresh`,ye;t[35]===ve?ye=t[36]:(ye=(0,$.jsx)(j,{children:ve}),t[35]=ve,t[36]=ye);let Y;t[37]!==_e||t[38]!==ye?(Y=(0,$.jsxs)(s,{children:[_e,ye]}),t[37]=_e,t[38]=ye,t[39]=Y):Y=t[39];let be;t[40]!==V||t[41]!==K||t[42]!==Y?(be=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[V,K,Y]}),t[40]=V,t[41]=K,t[42]=Y,t[43]=be):be=t[43];let xe=A?k:r??n,Se=v&&!A&&`group-hover/address:pe-7 transition-[padding]`,Ce;t[44]===Se?Ce=t[45]:(Ce=h(Se),t[44]=Se,t[45]=Ce);let Te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>re(e.target.value),t[46]=Te):Te=t[46];let Ee;t[47]===n?Ee=t[48]:(Ee=()=>{re(n),M(!0),queueMicrotask(()=>O.current?.select())},t[47]=n,t[48]=Ee);let X;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>{M(!1)},t[49]=X):X=t[49];let De;t[50]!==I||t[51]!==n?(De=e=>{e.key===`Enter`&&I(e),e.key===`Escape`&&(e.preventDefault(),re(n),O.current?.blur())},t[50]=I,t[51]=n,t[52]=De):De=t[52];let Oe;t[53]!==d||t[54]!==xe||t[55]!==Ce||t[56]!==Ee||t[57]!==De?(Oe=(0,$.jsx)(c,{render:(0,$.jsx)(qe,{ref:O,value:xe,className:Ce,onChange:Te,onFocus:Ee,onBlur:X,onKeyDown:De,placeholder:`Search or enter URL`,spellCheck:!1,disabled:d,"data-preview-url-input":!0,size:`sm`})}),t[53]=d,t[54]=xe,t[55]=Ce,t[56]=Ee,t[57]=De,t[58]=Oe):Oe=t[58];let ke;t[59]!==r||t[60]!==A||t[61]!==n?(ke=!A&&r?(0,$.jsx)(j,{children:n}):null,t[59]=r,t[60]=A,t[61]=n,t[62]=ke):ke=t[62];let Ae;t[63]!==Oe||t[64]!==ke?(Ae=(0,$.jsxs)(s,{children:[Oe,ke]}),t[63]=Oe,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==A||t[67]!==v?(je=v&&!A?(0,$.jsx)(Ge,{align:`inline-end`,className:`pointer-events-none absolute inset-y-0 right-0 opacity-0 transition-opacity group-hover/address:pointer-events-auto group-hover/address:opacity-100`,children:(0,$.jsxs)(s,{children:[(0,$.jsx)(c,{render:(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:v,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(fe,{})}),(0,$.jsx)(j,{children:`Open in system browser`})]})}):null,t[66]=A,t[67]=v,t[68]=je):je=t[68];let Me;t[69]!==Ae||t[70]!==je?(Me=(0,$.jsxs)(Ue,{className:`group/address h-7 flex-1 rounded-md border-transparent bg-transparent shadow-none before:shadow-none hover:bg-muted/40 focus-within:bg-background`,children:[Ae,je]}),t[69]=Ae,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]!==T||t[73]!==E||t[74]!==te||t[75]!==D?(Ne=T?(0,$.jsxs)(s,{children:[(0,$.jsx)(c,{render:(0,$.jsx)(m,{variant:E?`secondary`:`ghost`,size:`icon-xs`,onClick:T,disabled:te,"aria-label":E?`Cancel annotation`:`Annotate preview`,"aria-pressed":E?`true`:`false`,type:`button`}),children:(0,$.jsx)(le,{className:h(E&&`text-primary`)})}),(0,$.jsx)(j,{children:te&&D?D:E?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[72]=T,t[73]=E,t[74]=te,t[75]=D,t[76]=Ne):Ne=t[76];let Pe;t[77]!==b||t[78]!==y||t[79]!==x?(Pe=y?(0,$.jsxs)(s,{children:[(0,$.jsxs)(c,{render:(0,$.jsx)(m,{variant:x?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>y(e.shiftKey),"aria-label":x?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:b}),children:[(0,$.jsx)(ze,{className:h(x&&`text-destructive`)}),x?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(j,{children:x?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[77]=b,t[78]=y,t[79]=x,t[80]=Pe):Pe=t[80];let Fe;t[81]!==S||t[82]!==C||t[83]!==w?(Fe=S?(0,$.jsxs)(s,{children:[(0,$.jsx)(c,{render:(0,$.jsx)(m,{variant:C?`secondary`:`ghost`,size:`icon-xs`,onClick:S,"aria-label":C?`Close floating preview`:`Float preview over chat`,"aria-pressed":C?`true`:`false`,type:`button`,disabled:w}),children:(0,$.jsx)(we,{className:h(C&&`text-primary`)})}),(0,$.jsx)(j,{children:C?`Close floating preview`:`Float preview over chat`})]}):null,t[81]=S,t[82]=C,t[83]=w,t[84]=Fe):Fe=t[84];let Ie;t[85]!==I||t[86]!==be||t[87]!==Me||t[88]!==Ne||t[89]!==Pe||t[90]!==Fe||t[91]!==ne?(Ie=(0,$.jsxs)(`form`,{onSubmit:I,className:`surface-subheader gap-1 px-2`,"data-surface-subheader":!0,children:[be,Me,Ne,Pe,Fe,ne]}),t[85]=I,t[86]=be,t[87]=Me,t[88]=Ne,t[89]=Pe,t[90]=Fe,t[91]=ne,t[92]=Ie):Ie=t[92];let Le;t[93]===a?Le=t[94]:(Le=a>0?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-r-full bg-primary transition-all duration-150 ease-out`,style:{width:`${a}%`,boxShadow:`0 0 6px 1px var(--color-ring)`}}):null,t[93]=a,t[94]=Le);let Re;return t[95]!==Ie||t[96]!==Le?(Re=(0,$.jsxs)(`div`,{className:`relative`,children:[Ie,Le]}),t[95]=Ie,t[96]=Le,t[97]=Re):Re=t[97],Re}function Xe(e){try{let t=new URL(e.url),n=new URL(e.environmentHttpBaseUrl);if(t.origin===n.origin&&t.pathname.startsWith(`/api/assets/`)){let n=t.pathname.split(`/`).at(-1);if(!n)return null;let r=decodeURIComponent(n);return!r||r===`.`||r===`..`?null:`${e.environmentLabel} · ${r}`}return t.protocol===`http:`||t.protocol===`https:`?t.host:null}catch{return null}}function Ze(e){let t=(0,Q.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=h(`relative flex flex-col gap-0.5 overflow-hidden rounded-[5px] border border-border/60 bg-card p-1 shadow-xs/5`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:r,children:[i,a]}),t[4]=r,t[5]=o),o}function Qe(e){let t=(0,Q.c)(17),{server:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=$e(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Ze,{className:`size-7 shrink-0`}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:a}),t[3]=a,t[4]=s);let c;t[5]!==n.host||t[6]!==n.port?(c=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[n.host,`:`,n.port]}),t[5]=n.host,t[6]=n.port,t[7]=c):c=t[7];let l;t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u;t[11]===n.listening?u=t[12]:(u=n.listening?(0,$.jsx)(et,{}):(0,$.jsx)(tt,{}),t[11]=n.listening,t[12]=u);let d;return t[13]!==r||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex w-full items-center gap-3 px-3 py-3 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[o,l,u]}),t[13]=r,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function $e(e){return e.processName?e.processName:e.listening?`Listening`:e.source===`configured`?`Configured`:`Recently seen`}function et(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`span`,{"aria-label":`Listening`,className:`relative inline-flex size-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`absolute inset-0 animate-status-ping rounded-full bg-success opacity-60`}),(0,$.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-success`})]}),e[0]=t):t=e[0],t}function tt(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`span`,{"aria-label":`Not currently listening`,className:`size-2 shrink-0 rounded-full bg-muted-foreground/40`}),e[0]=t):t=e[0],t}function nt(e){let t=(0,Q.c)(7),n=ve(e.environmentId),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==e.recentlySeenUrls||t[3]!==n){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:Ee(e.environmentId,t.url)}),t[5]=e.environmentId,t[6]=i),r=rt({scanner:n.map(i),configuredUrls:e.configuredUrls??[],recentlySeenUrls:e.recentlySeenUrls??[]}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=e.recentlySeenUrls,t[3]=n,t[4]=r}else r=t[4];return r}function rt(e){let t=new Map;for(let n of e.configuredUrls){let e=at(n);if(!e)continue;let r=it(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`configured`,listening:!1})}for(let n of e.scanner){let e=it(n.host,n.port),r=t.get(e);if(r){t.set(e,{...r,processName:n.processName??r.processName,pid:n.pid??r.pid,terminal:n.terminal??r.terminal,listening:!0});continue}t.set(e,{...n,source:`scanner`,listening:!0})}for(let n of e.recentlySeenUrls){let e=at(n);if(!e)continue;let r=it(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`recent`,listening:!1})}return Array.from(t.values()).toSorted((e,t)=>{let n={configured:0,scanner:1,recent:2};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function it(e,t){return`${e.toLowerCase()}:${t}`}function at(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!Re(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function ot(e){let t=(0,Q.c)(16),{environmentId:n,configuredUrls:r,recentlySeenUrls:i,onOpenUrl:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o={environmentId:n,configuredUrls:r,recentlySeenUrls:i},t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=nt(o);if(s.length===0){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(L,{children:[(0,$.jsx)(B,{variant:`icon`,children:(0,$.jsx)(q,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(H,{children:`No preview yet`}),(0,$.jsx)(Ce,{children:`Type a URL above, or run a dev script. Listening localhost ports will show up here automatically.`})]}),t[4]=e):e=t[4],e}let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(He,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),t[5]=c):c=t[5];let l;if(t[6]!==a||t[7]!==s){let e;t[9]===a?e=t[10]:(e=e=>(0,$.jsx)(Qe,{server:e,onOpen:()=>a(e.url)},`${e.host}:${e.port}`),t[9]=a,t[10]=e),l=s.map(e),t[6]=a,t[7]=s,t[8]=l}else l=t[8];let u;t[11]===l?u=t[12]:(u=(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background`,children:l}),t[11]=l,t[12]=u);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a listening port to open it in this browser tab.`}),t[13]=d):d=t[13];let f;return t[14]===u?f=t[15]:(f=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 overflow-y-auto px-5 py-8`,children:(0,$.jsxs)(`div`,{className:`m-auto flex w-full max-w-xl flex-col gap-3`,children:[c,u,d]})}),t[14]=u,t[15]=f),f}var st=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ct(e){let t=(0,Q.c)(74),{tabId:n,hasWebContents:r,zoomFactor:a,colorScheme:o,deviceToolbarVisible:l,onToggleDeviceToolbar:u,nativePictureInPicture:d,onNativePictureInPicture:f}=e;if(!I)return null;let p=!n||!r,h;t[0]===n?h=t[1]:(h=e=>()=>{n&&e(n).catch(gt)},t[0]=n,t[1]=h);let g=h,_;t[2]===a?_=t[3]:(_=Math.round(a*100),t[2]=a,t[3]=_);let y=`${_}%`,b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(s,{children:[(0,$.jsx)(c,{render:(0,$.jsx)(v,{render:(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(Be,{})}),(0,$.jsx)(j,{children:`More`})]}),t[4]=b):b=t[4];let S;t[5]===g?S=t[6]:(S=g(I.hardReload),t[5]=g,t[6]=S);let C;t[7]!==S||t[8]!==p?(C=(0,$.jsx)(D,{onClick:S,disabled:p,children:`Hard reload`}),t[7]=S,t[8]=p,t[9]=C):C=t[9];let T;t[10]===g?T=t[11]:(T=g(I.openDevTools),t[10]=g,t[11]=T);let E;t[12]!==T||t[13]!==p?(E=(0,$.jsx)(D,{onClick:T,disabled:p,children:`Open DevTools`}),t[12]=T,t[13]=p,t[14]=E):E=t[14];let te=d?`Close separate preview window`:`Open separate preview window`,O;t[15]!==f||t[16]!==te||t[17]!==p?(O=(0,$.jsx)(D,{onClick:f,disabled:p,children:te}),t[15]=f,t[16]=te,t[17]=p,t[18]=O):O=t[18];let re=l?`Hide device toolbar`:`Show device toolbar`,M;t[19]!==u||t[20]!==re||t[21]!==p?(M=(0,$.jsx)(D,{onClick:u,disabled:p,children:re}),t[19]=u,t[20]=re,t[21]=p,t[22]=M):M=t[22];let N;t[23]===p?N=t[24]:(N=(0,$.jsx)(A,{disabled:p,children:`Appearance`}),t[23]=p,t[24]=N);let P;t[25]===n?P=t[26]:(P=e=>{n&&I.setColorScheme(n,e).catch(ht)},t[25]=n,t[26]=P);let ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=st.map(mt),t[27]=ie):ie=t[27];let F;t[28]!==o||t[29]!==P?(F=(0,$.jsx)(w,{className:`min-w-32`,children:(0,$.jsx)(x,{value:o,onValueChange:P,children:ie})}),t[28]=o,t[29]=P,t[30]=F):F=t[30];let L;t[31]!==N||t[32]!==F?(L=(0,$.jsxs)(ee,{children:[N,F]}),t[31]=N,t[32]=F,t[33]=L):L=t[33];let oe;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ne,{}),t[34]=oe):oe=t[34];let R;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{children:`Zoom`}),t[35]=R):R=t[35];let se;t[36]===g?se=t[37]:(se=g(I.zoomOut),t[36]=g,t[37]=se);let ce;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ue,{}),t[38]=ce):ce=t[38];let z;t[39]!==se||t[40]!==p?(z=(0,$.jsx)(m,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:se,"aria-label":`Zoom out`,disabled:p,children:ce}),t[39]=se,t[40]=p,t[41]=z):z=t[41];let B;t[42]===y?B=t[43]:(B=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:y}),t[42]=y,t[43]=B);let le;t[44]===g?le=t[45]:(le=g(I.zoomIn),t[44]=g,t[45]=le);let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(ae,{}),t[46]=V):V=t[46];let H;t[47]!==le||t[48]!==p?(H=(0,$.jsx)(m,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:le,"aria-label":`Zoom in`,disabled:p,children:V}),t[47]=le,t[48]=p,t[49]=H):H=t[49];let U;t[50]===g?U=t[51]:(U=g(I.resetZoom),t[50]=g,t[51]=U);let W;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(de,{}),t[52]=W):W=t[52];let G;t[53]!==U||t[54]!==p?(G=(0,$.jsx)(m,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:U,"aria-label":`Reset zoom`,disabled:p,children:W}),t[53]=U,t[54]=p,t[55]=G):G=t[55];let K;t[56]!==z||t[57]!==B||t[58]!==H||t[59]!==G?(K=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[z,B,H,G]}),t[56]=z,t[57]=B,t[58]=H,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==K||t[62]!==p?(q=(0,$.jsxs)(D,{closeOnClick:!1,onClick:pt,className:`justify-between`,disabled:p,children:[R,K]}),t[61]=K,t[62]=p,t[63]=q):q=t[63];let fe,pe,J;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(ne,{}),pe=(0,$.jsx)(D,{onClick:dt,children:`Clear cookies`}),J=(0,$.jsx)(D,{onClick:lt,children:`Clear cache`}),t[64]=fe,t[65]=pe,t[66]=J):(fe=t[64],pe=t[65],J=t[66]);let me;return t[67]!==M||t[68]!==L||t[69]!==q||t[70]!==C||t[71]!==E||t[72]!==O?(me=(0,$.jsxs)(i,{children:[b,(0,$.jsxs)(k,{align:`end`,sideOffset:6,className:`min-w-56`,children:[C,E,O,M,L,oe,q,fe,pe,J]})]}),t[67]=M,t[68]=L,t[69]=q,t[70]=C,t[71]=E,t[72]=O,t[73]=me):me=t[73],me}function lt(){I.clearCache().catch(ut)}function ut(){}function dt(){I.clearCookies().catch(ft)}function ft(){}function pt(e){return e.preventDefault()}function mt(e){return(0,$.jsx)(g,{value:e.value,children:e.label},e.value)}function ht(){}function gt(){}function _t(e){return he[e]||(e.length>0?e:`Network error`)}function vt(e){let t=(0,Q.c)(32),{url:n,code:r,description:i,onReload:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===n?c=t[1]:(c=xt(n)??n,t[0]=n,t[1]=c);let l=c,u;t[2]===i?u=t[3]:(u=_t(i),t[2]=i,t[3]=u);let d=u,f;t[4]!==r||t[5]!==i?(f=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=f):f=t[6];let p=f,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(bt,{className:`mb-6 size-12 text-muted-foreground/70`}),g=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let ee;t[9]===l?ee=t[10]:(ee=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=ee);let _;t[11]!==d||t[12]!==ee?(_=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[ee,`: `,d,`.`]}),t[11]=d,t[12]=ee,t[13]=_):_=t[13];let v;t[14]===o?v=t[15]:(v=o?(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[(0,$.jsx)(`li`,{children:`Checking your connection`}),(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`})]})]}):null,t[14]=o,t[15]=v);let y;t[16]===p?y=t[17]:(y=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:p}),t[16]=p,t[17]=y);let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(yt),t[18]=b):b=t[18];let x=o?`Hide details`:`Details`,S;t[19]===x?S=t[20]:(S=(0,$.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:b,children:x}),t[19]=x,t[20]=S);let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=C):C=t[21];let w;t[22]===a?w=t[23]:(w=(0,$.jsx)(m,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=w);let T;t[24]!==S||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[S,C,w]}),t[24]=S,t[25]=w,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==_||t[29]!==v||t[30]!==y?(E=(0,$.jsx)(`div`,{className:`relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[h,g,_,v,y,T]})}),t[27]=T,t[28]=_,t[29]=v,t[30]=y,t[31]=E):E=t[31],E}function yt(e){return!e}function bt(e){let t=(0,Q.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function xt(e){try{return new URL(e).host}catch{return null}}function St(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}var Ct=120,wt=220,Tt=4,Et=90,Dt=.08,Ot=.5;function kt(e){let[t,n]=(0,Z.useState)(0),r=(0,Z.useRef)(0);return r.current=t,(0,Z.useEffect)(()=>{if(!e){if(r.current===0)return;n(100);let e=window.setTimeout(()=>n(0),wt);return()=>window.clearTimeout(e)}n(e=>e>0&&e<95?e:Tt);let t=window.setInterval(()=>{let e=r.current;if(e>=Et)return;let t=Et-e,i=Math.max(Ot,t*Dt);n(Math.min(Et,e+i))},Ct);return()=>window.clearInterval(t)},[e]),t}var At=class extends p()(`PreviewSessionThreadKeyParseError`,{threadKey:ie}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},jt=_(e=>{let t=M(e);if(t===null)throw new At({threadKey:e});let n=je.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=je.events({environmentId:t.environmentId,input:{}});return O(e=>{let i=!1,a=0,o=e=>{N(e)&&xe(t,e.value)},s=r=>{if(!N(r)||r.value.threadId!==t.threadId)return;let i=Ne(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}Le(t,r.value)};e.addFinalizer(()=>{i=!0});let c=e.once(r);e.subscribe(n,e=>{o(e)}),e.subscribe(r,e=>{a+=1,s(e)}),queueMicrotask(()=>{i||(e.refresh(n),a===0&&s(c))})}).pipe(E(1e3),b(`preview:session-sync:${e}`))});function Mt(e){let t=(0,Q.c)(2),n;t[0]===e?n=t[1]:(n=jt(d(e)),t[0]=e,t[1]=n),o(n)}var Nt=1500,Pt=.001;function Ft(e){let t=(0,Q.c)(11),{zoomFactor:n}=e,[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(n),o=(0,Z.useRef)(null),s,c;t[0]===n?(s=t[1],c=t[2]):(s=()=>{if(!(Math.abs(a.current-n)<Pt))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},Nt),()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Z.useEffect)(s,c);let l;t[3]===n?l=t[4]:(l=Math.round(n*100),t[3]=n,t[4]=l);let u=`${l}%`,d=!r,f=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,p;t[5]===f?p=t[6]:(p=h(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,f),t[5]=f,t[6]=p);let m;return t[7]!==u||t[8]!==d||t[9]!==p?(m=(0,$.jsx)(`div`,{"aria-hidden":d,className:p,children:u}),t[7]=u,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}function It(e,t){return e?1:t===`human`?.18:.35}var Lt=700;function Rt(e){let t=(0,Q.c)(9),{tabId:n,zoomFactor:r,controller:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.byTabId[n]??null,t[0]=n,t[1]=a);let o=me(a),s;t[2]===n?s=t[3]:(s=e=>e.byTabId[n]?.content??null,t[2]=n,t[3]=s);let c=R(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(zt,{event:o,content:c,zoomFactor:r,controller:i},o.sequence),t[4]=c,t[5]=i,t[6]=o,t[7]=r,t[8]=l):l=t[8],l}function zt(e){let t=(0,Q.c)(15),{event:n,content:r,zoomFactor:i,controller:a}=e,[o,s]=(0,Z.useState)(!0),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.setTimeout(()=>s(!1),Lt);return()=>window.clearTimeout(e)},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Z.useEffect)(c,l);let u;t[2]!==o||t[3]!==a?(u=It(o,a),t[2]=o,t[3]=a,t[4]=u):u=t[4];let d=`translate3d(${n.x*i*(r?.scale??1)+(r?.x??0)-(r?.scrollLeft??0)}px, ${n.y*i*(r?.scale??1)+(r?.y??0)-(r?.scrollTop??0)}px, 0)`,f;t[5]!==u||t[6]!==d?(f={opacity:u,transform:d},t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==n.phase||t[9]!==n.sequence?(p=n.phase===`click`?(0,$.jsx)(`span`,{className:`absolute left-0.5 top-0.5 size-4 animate-status-ping rounded-full bg-primary/25 motion-reduce:animate-none`},n.sequence):null,t[8]=n.phase,t[9]=n.sequence,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ve,{className:`relative size-5 -translate-x-0.5 -translate-y-0.5 fill-background text-primary drop-shadow-sm`,strokeWidth:2}),t[11]=m):m=t[11];let h;return t[12]!==f||t[13]!==p?(h=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute left-0 top-0 z-40 transition-[transform,opacity] duration-150 ease-out motion-reduce:transition-none`,style:f,"aria-hidden":`true`,"data-agent-browser-cursor":!0,children:[p,m]}),t[12]=f,t[13]=p,t[14]=h):h=t[14],h}var Bt=typeof window>`u`?null:l();function Vt({threadRef:e,tabId:t,configuredUrls:n,visible:r}){let[i,o]=(0,Z.useState)(void 0),[s,c]=(0,Z.useState)(!1),l=ke(),f=(0,Z.useRef)(!1),p=(0,Z.useRef)(!0),m=Fe(e),h=z(t=>Se(t.byThreadKey,e)),g=S(e=>e.addPreviewAnnotation),ee=S(e=>e.addImage),_=C(e.environmentId),v=a(e.environmentId),b=u(je.open),x=u(je.resize,`preview viewport resize`),{resolvedTheme:w}=re();Mt(e),(0,Z.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let E=t??m.activeTabId,D=E?V(e,m.serverEpoch,E):null,ne=E&&D?l.has(D)?D:Me(e,E):null,O=E?m.sessions[E]??null:null,k=E?m.desktopByTabId[E]??null:null,A=O?.navStatus??{_tag:`Idle`},j=A._tag===`Idle`?``:A.url,M=k?.loading??A._tag===`Loading`,N=k?.canGoBack??O?.canGoBack??!1,P=k?.canGoForward??O?.canGoForward??!1,ie=A._tag===`Idle`,F=A._tag===`LoadFailed`,L=Te(O),ae=k?.controller??`none`,oe=kt(M),ce=j&&_&&v?Xe({url:j,environmentLabel:_.label,environmentHttpBaseUrl:v})??void 0:void 0,B=O?.viewport??T,le=R(e=>D?e.byTabId[D]?.rect??null:null),H=(0,Z.useCallback)(async t=>{D&&I?(await I.navigate(D,t),J(e,t)):await _e({openPreview:b,threadRef:e,url:t})},[b,D,e]),ue=(0,Z.useCallback)(async e=>{try{await H(ge(e))}catch{}},[H]),U=(0,Z.useCallback)(async t=>{try{await H(Ee(e.environmentId,t))}catch{}},[H,e.environmentId]),de=(0,Z.useCallback)(()=>{I&&D&&I.refresh(D)},[D]),K=(0,Z.useCallback)(()=>{I&&D&&I.zoomIn(D)},[D]),q=(0,Z.useCallback)(()=>{I&&D&&I.zoomOut(D)},[D]),fe=(0,Z.useCallback)(()=>{I&&D&&I.resetZoom(D)},[D]),me=(0,Z.useCallback)(async t=>{if(!E)return;let n=await x({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:E,viewport:t}});if(n._tag===`Failure`){let e=te(n);throw X.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}Ae(e,n.value)},[x,E,e]),he=()=>{if(!D)return;if(B._tag!==`fill`){Ie(D,T).catch(()=>void 0);return}let e=le?Pe(le,k?.zoomFactor):{width:1024,height:768};Ie(D,{_tag:`freeform`,...e}).catch(()=>void 0)};(0,Z.useEffect)(()=>{if(D)return De(D,me)},[me,D]);let ve=(0,Z.useCallback)(()=>{I&&D&&I.goBack(D)},[D]),xe=(0,Z.useCallback)(()=>{I&&D&&I.goForward(D)},[D]),Ce=(0,Z.useCallback)(()=>{!Bt||!j||Bt.shell.openExternal(j).catch(()=>void 0)},[j]),we=(0,Z.useCallback)(()=>{if(E){if(h?.tabId===E){z.getState().close(e);return}z.getState().open(e,E),y.getState().close(e)}},[h?.tabId,E,e]),Oe=(0,Z.useCallback)(()=>{!I||!D||(k?.pictureInPicture?I.pictureInPicture.close:I.pictureInPicture.open)(D).catch(e=>{X.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[k?.pictureInPicture,D]),Ne=(0,Z.useCallback)(t=>{if(!I||!D||!E)return;let n=I;if(ne){pe(ne).then(e=>{if(!e)return;let t=!1,r,i=()=>{if(!navigator.clipboard?.writeText){X.update(r,Y({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{X.update(r,Y({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:St(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{X.update(r,Y({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i},secondaryActionVariant:`outline`}}))};r=X.add(Y({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{X.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(t){be(D,e,E).catch(e=>{X.add({type:`error`,title:`Unable to start recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}n.captureScreenshot(D).then(e=>{let t={children:St(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{X.update(a,Y({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},s=()=>{if(!navigator.clipboard?.writeText){o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`);return}navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)})},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=X.add(Y({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},e=>{X.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[ne,D,E,e]),Le=(0,Z.useCallback)(()=>{if(!I||!D)return;if(f.current){I.cancelPickElement(D).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null;f.current=!0,c(!0),(async()=>{try{let t=await I.pickElement(D);if(!t)return;g(e,t);let n=await ye(t);n&&t.screenshot&&ee(e,{type:`image`,id:t.id,name:n.name,mimeType:n.type,sizeBytes:n.size,previewUrl:t.screenshot.dataUrl,file:n})}catch{}finally{if(f.current=!1,p.current&&c(!1),t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[ee,g,D,e]);return(0,Z.useEffect)(()=>{let e=se(j,w);e&&H(e).catch(()=>void 0)},[H,w,j]),(0,Z.useEffect)(()=>()=>{f.current&&(f.current=!1,I&&D&&I.cancelPickElement(D).catch(()=>void 0),p.current&&c(!1))},[D]),(0,Z.useEffect)(()=>{if(r)return G(e=>{switch(e){case`refresh`:de();return;case`focus-url`:o(e=>(e??0)+1);return;case`zoom-in`:K();return;case`zoom-out`:q();return;case`reset-zoom`:fe();return;case`toggle-panel`:return}})},[de,fe,K,q,r]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":d(e),children:[(0,$.jsx)(Ye,{url:j,displayUrl:ce,loading:M,loadProgress:oe,canGoBack:N,canGoForward:P,refreshDisabled:ie,focusUrlNonce:i,onBack:ve,onForward:xe,onRefresh:de,onSubmit:e=>void ue(e),onOpenInBrowser:E?Ce:void 0,onCapture:I&&E?Ne:void 0,captureDisabled:!k||F,recording:ne!==null,onPictureInPicture:I&&E?we:void 0,pictureInPicture:h?.tabId===E,pictureInPictureDisabled:!k?.hasWebContents||F,onPickElement:I&&E?Le:void 0,pickActive:s,pickDisabled:!E||F,pickDisabledReason:F?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:I?(0,$.jsx)(ct,{tabId:D,hasWebContents:k?.hasWebContents??!1,zoomFactor:k?.zoomFactor??1,colorScheme:k?.colorScheme??`system`,deviceToolbarVisible:B._tag!==`fill`,onToggleDeviceToolbar:he,nativePictureInPicture:k?.pictureInPicture??!1,onNativePictureInPicture:Oe}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[D&&O&&!L?(0,$.jsx)(W,{tabId:D,visible:r&&!F,className:`absolute inset-0 h-full w-full`},D):null,L?(0,$.jsx)(ot,{environmentId:e.environmentId,configuredUrls:n,recentlySeenUrls:m.recentlySeenUrls,onOpenUrl:e=>void U(e)}):null,O&&k?(0,$.jsx)(Ft,{zoomFactor:k.zoomFactor}):null,D&&k&&!L&&!F?(0,$.jsx)(Rt,{tabId:D,zoomFactor:k.zoomFactor,controller:ae}):null,ae===`none`?null:(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-3 z-40 rounded-full border border-border/70 bg-background/90 px-2.5 py-1 text-[11px] font-medium shadow-sm backdrop-blur`,children:ae===`agent`?`Agent controlling browser`:`Human control`}),A._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(vt,{url:A.url,code:A.code,description:A.description,onReload:de})}):null]})]})}function Ht(e){let t=(0,Q.c)(13),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o}=e;if(!Oe()){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Preview is only available in the P4Code desktop app.`})}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,$.jsx)(U,{mode:n,children:e}),t[1]=n,t[2]=r),r}let s;t[3]===i?s=t[4]:(s=i===void 0?{}:{tabId:i},t[3]=i,t[4]=s);let c;t[5]!==a||t[6]!==s||t[7]!==r||t[8]!==o?(c=(0,$.jsx)(Vt,{threadRef:r,...s,configuredUrls:a,visible:o}),t[5]=a,t[6]=s,t[7]=r,t[8]=o,t[9]=c):c=t[9];let l;return t[10]!==n||t[11]!==c?(l=(0,$.jsx)(U,{mode:n,children:c}),t[10]=n,t[11]=c,t[12]=l):l=t[12],l}export{Ht as PreviewPanel};
|
|
2
|
-
//# sourceMappingURL=PreviewPanel-fmAW4iEw.js.map
|