@p4code/cli 0.0.43 → 0.0.44
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 +248 -176
- package/dist/client/assets/DiffPanel-DD3E29O7.js +98 -0
- package/dist/client/assets/FilePreviewPanel-fBOIzVAm.js +1778 -0
- package/dist/client/assets/PreviewPanel-BXyhScZZ.js +2 -0
- package/dist/client/assets/{angular-html-D2LtifxG.js → angular-html-BwUZQlj7.js} +2 -2
- package/dist/client/assets/{angular-ts-oVDpKJb2.js → angular-ts-8EX8ZNeQ.js} +2 -2
- package/dist/client/assets/{apl-2vnm7rdp.js → apl-DYm7AarA.js} +2 -2
- package/dist/client/assets/arrow-right-BNeeftk2.js +2 -0
- package/dist/client/assets/{astro-CDbEfI_f.js → astro-DFaFMvm9.js} +2 -2
- package/dist/client/assets/{blade-B1MwvSO0.js → blade-D9aigeeZ.js} +2 -2
- package/dist/client/assets/{c-Bi5eHJiI.js → c-BvAsa11Y.js} +2 -2
- package/dist/client/assets/{cobol-BxESWi7D.js → cobol-BZwY3--F.js} +2 -2
- package/dist/client/assets/{coffee-s151wUsp.js → coffee-vNqcHwuy.js} +2 -2
- package/dist/client/assets/{cpp-B51xjAkw.js → cpp-D3Xet0_6.js} +2 -2
- package/dist/client/assets/{crystal-BW0dq2Rw.js → crystal-D-UW0VhN.js} +2 -2
- package/dist/client/assets/{css-Czn5ycv4.js → css-B1CDNsy0.js} +2 -2
- package/dist/client/assets/{edge-DPtVbjt1.js → edge-B_geUcoi.js} +2 -2
- package/dist/client/assets/{elixir-381Dy51E.js → elixir-BzK0Ks1B.js} +2 -2
- package/dist/client/assets/{elm-Bpu_ckb9.js → elm-BvlMiaGz.js} +2 -2
- package/dist/client/assets/{erb-u1vpMXOw.js → erb-OFCHFHP8.js} +2 -2
- package/dist/client/assets/fileCommentAnnotations-DI_Ec6DZ.js +2 -0
- package/dist/client/assets/{git-rebase-ShzdQ6mA.js → git-rebase-Xc_wijNW.js} +2 -2
- package/dist/client/assets/{glimmer-js-DI4_LeGA.js → glimmer-js-D-GpFszK.js} +2 -2
- package/dist/client/assets/{glimmer-ts-BrA1R4ia.js → glimmer-ts-_MmK7qB5.js} +2 -2
- package/dist/client/assets/{glsl--BAUZuR7.js → glsl-Cm_ctoze.js} +2 -2
- package/dist/client/assets/{graphql-XmtNe4tX.js → graphql-De_-LrEt.js} +2 -2
- package/dist/client/assets/{hack-ZPcuqt6I.js → hack-qUzK29KK.js} +2 -2
- package/dist/client/assets/{haml-BLmOYSAV.js → haml-mqyUpOBj.js} +2 -2
- package/dist/client/assets/{handlebars-BxR19vQc.js → handlebars-DS3jjsXS.js} +2 -2
- package/dist/client/assets/{html-derivative-CLJquIOq.js → html-derivative-BPRW_sHn.js} +2 -2
- package/dist/client/assets/{html-Do3TWS07.js → html-ippoHerj.js} +2 -2
- package/dist/client/assets/{http-C6M7KGrt.js → http-xrFfvFRg.js} +2 -2
- package/dist/client/assets/{hurl-AFYDoSjV.js → hurl-DSL-wjHh.js} +2 -2
- package/dist/client/assets/index-BAsvpSiM.js +636 -0
- package/dist/client/assets/index-CGyzLTcp.css +1 -0
- package/dist/client/assets/{java-DoRNyNZ_.js → java-B8xLHoVB.js} +2 -2
- package/dist/client/assets/{javascript-Dd-zEQJs.js → javascript-DkxetjtW.js} +2 -2
- package/dist/client/assets/{jinja-TJRtEusk.js → jinja-DrlmZXOI.js} +2 -2
- package/dist/client/assets/{jison-bG9mcEJe.js → jison-CBYMCWiZ.js} +2 -2
- package/dist/client/assets/{json-DY6EaQUk.js → json-aobk_LSd.js} +2 -2
- package/dist/client/assets/{jsx-BuL0_m-Z.js → jsx-BTcIKPoF.js} +2 -2
- package/dist/client/assets/{julia-4bcuyKPV.js → julia-BwUvFb1K.js} +2 -2
- package/dist/client/assets/{just-F3UNctxi.js → just-2GL8m28O.js} +2 -2
- package/dist/client/assets/{latex-DCJY-Aag.js → latex-BwWZNh8B.js} +2 -2
- package/dist/client/assets/{liquid-M906bGYJ.js → liquid-j8UWR5fn.js} +2 -2
- package/dist/client/assets/{lua-CeupCtSb.js → lua-BiEJazUk.js} +2 -2
- package/dist/client/assets/{marko-D_3SsXZn.js → marko-BrkuG9X9.js} +2 -2
- package/dist/client/assets/{mdc-DRUaGPVE.js → mdc-CbE9Gm1n.js} +2 -2
- package/dist/client/assets/{nginx-B_DJSFb0.js → nginx-C-gcDf_H.js} +2 -2
- package/dist/client/assets/{nim-BxoRFkNd.js → nim-9X20IMJZ.js} +2 -2
- package/dist/client/assets/{perl-CjLiNsGL.js → perl-Dqj-SUzY.js} +2 -2
- package/dist/client/assets/{php-DcklQON0.js → php-CQymwCam.js} +2 -2
- package/dist/client/assets/{pug-DHYHUkbl.js → pug-DIOYJ7Tj.js} +2 -2
- package/dist/client/assets/{qml-Cggn-sFR.js → qml-BpdlPbMh.js} +2 -2
- package/dist/client/assets/{r-BhkOaKoM.js → r-BdXpML7C.js} +2 -2
- package/dist/client/assets/{razor-DksRt091.js → razor-CmGIbQUz.js} +2 -2
- package/dist/client/assets/{regexp-CVeVJKpO.js → regexp-udR9FXf8.js} +2 -2
- package/dist/client/assets/{rst-B8gnyB7p.js → rst-C81pNvVo.js} +2 -2
- package/dist/client/assets/{ruby-B7aYI7EY.js → ruby-D5xBAIVx.js} +2 -2
- package/dist/client/assets/{sas-DmDsVHsr.js → sas-pegDgwhF.js} +2 -2
- package/dist/client/assets/{scss-Cf0hFbmP.js → scss-Dx_Aq9w8.js} +2 -2
- package/dist/client/assets/{shellscript-CJ2l7Ljo.js → shellscript-Bl-HTaUh.js} +2 -2
- package/dist/client/assets/{shellsession-CE-6mg0T.js → shellsession-CezqakSW.js} +2 -2
- package/dist/client/assets/{soy-eTwUOhLL.js → soy-DclELXc7.js} +2 -2
- package/dist/client/assets/{sql-DaTGJ1E1.js → sql-DAsY-zzx.js} +2 -2
- package/dist/client/assets/{stata-DCqqmU-V.js → stata-DjQ16uuy.js} +2 -2
- package/dist/client/assets/{surrealql-DJuyQLb6.js → surrealql-BLzgjzgE.js} +2 -2
- package/dist/client/assets/{svelte-DZfElFr5.js → svelte-DFGwC3eP.js} +2 -2
- package/dist/client/assets/{templ-BeuT7j1S.js → templ-BiFbdCJD.js} +2 -2
- package/dist/client/assets/{tex-CUjxQ3iG.js → tex-DQCF2PEO.js} +2 -2
- package/dist/client/assets/textarea-lBMORu4g.js +46 -0
- package/dist/client/assets/{ts-tags-C00W--Ve.js → ts-tags-CkQC6ekt.js} +2 -2
- package/dist/client/assets/{tsx-h-kXP2gA.js → tsx-m7HWHXfL.js} +2 -2
- package/dist/client/assets/{twig-DhMoAQY-.js → twig-B5P5jotH.js} +2 -2
- package/dist/client/assets/{typescript-DwJdYtiC.js → typescript-DmGwuo7e.js} +2 -2
- package/dist/client/assets/{vue-CvLnzHbi.js → vue-Rn_gU7Px.js} +2 -2
- package/dist/client/assets/{vue-html-fj2AgeR4.js → vue-html-DbKQF2OX.js} +2 -2
- package/dist/client/assets/{vue-vine-D1-Lx9ZR.js → vue-vine-C13tIrLE.js} +2 -2
- package/dist/client/assets/{xml-CDkXSKu_.js → xml-D7fQm-eG.js} +2 -2
- package/dist/client/assets/{xsl-BkotjMT0.js → xsl-Bv743my_.js} +2 -2
- package/dist/client/assets/{yaml-BssI7mmn.js → yaml--h7pPfkH.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-D8nVXZ0Y.js +0 -98
- package/dist/client/assets/FilePreviewPanel-CFKCFyJ3.js +0 -1778
- package/dist/client/assets/PreviewPanel-VQey9906.js +0 -2
- package/dist/client/assets/arrow-right-DmJqM7J1.js +0 -2
- package/dist/client/assets/fileCommentAnnotations-BwnrRpfq.js +0 -2
- package/dist/client/assets/index-XxxL_T8f.js +0 -635
- package/dist/client/assets/index-mqpX0B5G.css +0 -1
- package/dist/client/assets/textarea-BM2z9WNB.js +0 -46
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$l as e,Br as t,Ec as n,Go as r,Gr as i,Hf as a,Hr as o,Ir as s,Is as c,Jr as l,Jt as u,Kr as d,Ls as f,Mr as p,Nf as m,Ps as h,Pt as g,T as _,Ts as v,Ur as y,Vr as b,Ws as x,Zs as S,ap as C,b as w,cp as T,g as E,ls as D,m as O,o as k,p as A,qr as ee,qs as j,rs as M,tu as te,v as N,y as ne,zr as P,zs as F}from"./textarea-BM2z9WNB.js";import{t as re}from"./arrow-right-DmJqM7J1.js";import{$n as I,A as L,An as R,Cr as ie,Dr as ae,Er as oe,F as z,Jn as B,M as V,Mn as H,Mr as U,N as se,O as W,On as G,Or as ce,P as K,Pr as le,Qn as q,Rr as ue,Xn as de,Zn as J,a as fe,ar as pe,c as me,cr as he,dr as Y,er as ge,g as _e,i as ve,ir as ye,j as be,jn as xe,k as Se,kn as Ce,kr as we,lr as Te,n as Ee,nr as De,o as Oe,or as ke,r as Ae,rr as je,s as Me,sr as Ne,t as Pe,tr as Fe,ur as X,wr as Ie}from"./index-XxxL_T8f.js";var Le=r(`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`}]]),Re=r(`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`}]]),ze=r(`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`}]]),Be=r(`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=T(C(),1),Q=m(),$=a();function Ve(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=g(`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 He=M(`[&_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 Ue(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=g(He({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:We,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function We(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 Ge(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)(B,{className:n,unstyled:!0,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Ke=()=>{};function qe(e){let t=(0,Q.c)(98),{url:n,displayUrl:r,loading:i,loadProgress:a,canGoBack:o,canGoForward:s,refreshDisabled:c,inputDisabled:l,focusUrlNonce:u,onBack:d,onForward:f,onRefresh:m,onSubmit:h,onOpenInBrowser:_,onCapture:v,captureDisabled:y,recording:b,onPictureInPicture:x,pictureInPicture:S,pictureInPictureDisabled:C,onPickElement:w,pickActive:T,pickDisabled:D,pickDisabledReason:k,trailingActions:ee}=e,j=(0,Z.useRef)(null),[M,te]=(0,Z.useState)(n),[N,ne]=(0,Z.useState)(!1),P,F;t[0]===u?(P=t[1],F=t[2]):(P=()=>{if(u==null)return;let e=j.current;e&&e.focus()},F=[u],t[0]=u,t[1]=P,t[2]=F),(0,Z.useEffect)(P,F);let I;t[3]!==M||t[4]!==h?(I=e=>{e?.preventDefault();let t=M.trim();t.length!==0&&(h(t),j.current?.blur())},t[3]=M,t[4]=h,t[5]=I):I=t[5];let L=I,R=o?d:Ke,oe=!o,z;t[6]!==R||t[7]!==oe?(z=(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,onClick:R,disabled:oe,"aria-label":`Back`,type:`button`}),t[6]=R,t[7]=oe,t[8]=z):z=t[8];let B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ue,{}),t[9]=B):B=t[9];let V;t[10]===z?V=t[11]:(V=(0,$.jsx)(E,{render:z,children:B}),t[10]=z,t[11]=V);let H;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(O,{children:`Back`}),t[12]=H):H=t[12];let U;t[13]===V?U=t[14]:(U=(0,$.jsxs)(A,{children:[V,H]}),t[13]=V,t[14]=U);let se=s?f:Ke,W=!s,G;t[15]!==se||t[16]!==W?(G=(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,onClick:se,disabled:W,"aria-label":`Forward`,type:`button`}),t[15]=se,t[16]=W,t[17]=G):G=t[17];let K;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(re,{}),t[18]=K):K=t[18];let q;t[19]===G?q=t[20]:(q=(0,$.jsx)(E,{render:G,children:K}),t[19]=G,t[20]=q);let de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(O,{children:`Forward`}),t[21]=de):de=t[21];let J;t[22]===q?J=t[23]:(J=(0,$.jsxs)(A,{children:[q,de]}),t[22]=q,t[23]=J);let fe=c?Ke:m,pe=i?`Stop`:`Refresh`,me;t[24]!==c||t[25]!==fe||t[26]!==pe?(me=(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,onClick:fe,disabled:c,"aria-label":pe,type:`button`}),t[24]=c,t[25]=fe,t[26]=pe,t[27]=me):me=t[27];let he=i&&`animate-spin`,Y;t[28]===he?Y=t[29]:(Y=g(he),t[28]=he,t[29]=Y);let ge;t[30]===Y?ge=t[31]:(ge=(0,$.jsx)(ie,{className:Y}),t[30]=Y,t[31]=ge);let _e;t[32]!==me||t[33]!==ge?(_e=(0,$.jsx)(E,{render:me,children:ge}),t[32]=me,t[33]=ge,t[34]=_e):_e=t[34];let ve=i?`Loading…`:`Refresh`,ye;t[35]===ve?ye=t[36]:(ye=(0,$.jsx)(O,{children:ve}),t[35]=ve,t[36]=ye);let be;t[37]!==_e||t[38]!==ye?(be=(0,$.jsxs)(A,{children:[_e,ye]}),t[37]=_e,t[38]=ye,t[39]=be):be=t[39];let xe;t[40]!==U||t[41]!==J||t[42]!==be?(xe=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[U,J,be]}),t[40]=U,t[41]=J,t[42]=be,t[43]=xe):xe=t[43];let Se=N?M:r??n,Ce=_&&!N&&`group-hover/address:pe-7 transition-[padding]`,we;t[44]===Ce?we=t[45]:(we=g(Ce),t[44]=Ce,t[45]=we);let Te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>te(e.target.value),t[46]=Te):Te=t[46];let Ee;t[47]===n?Ee=t[48]:(Ee=()=>{te(n),ne(!0),queueMicrotask(()=>j.current?.select())},t[47]=n,t[48]=Ee);let De;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{ne(!1)},t[49]=De):De=t[49];let Oe;t[50]!==L||t[51]!==n?(Oe=e=>{e.key===`Enter`&&L(e),e.key===`Escape`&&(e.preventDefault(),te(n),j.current?.blur())},t[50]=L,t[51]=n,t[52]=Oe):Oe=t[52];let ke;t[53]!==l||t[54]!==Se||t[55]!==we||t[56]!==Ee||t[57]!==Oe?(ke=(0,$.jsx)(E,{render:(0,$.jsx)(Ge,{ref:j,value:Se,className:we,onChange:Te,onFocus:Ee,onBlur:De,onKeyDown:Oe,placeholder:`Search or enter URL`,spellCheck:!1,disabled:l,"data-preview-url-input":!0,size:`sm`})}),t[53]=l,t[54]=Se,t[55]=we,t[56]=Ee,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]!==r||t[60]!==N||t[61]!==n?(Ae=!N&&r?(0,$.jsx)(O,{children:n}):null,t[59]=r,t[60]=N,t[61]=n,t[62]=Ae):Ae=t[62];let je;t[63]!==ke||t[64]!==Ae?(je=(0,$.jsxs)(A,{children:[ke,Ae]}),t[63]=ke,t[64]=Ae,t[65]=je):je=t[65];let Me;t[66]!==N||t[67]!==_?(Me=_&&!N?(0,$.jsx)(Ue,{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)(A,{children:[(0,$.jsx)(E,{render:(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,onClick:_,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(le,{})}),(0,$.jsx)(O,{children:`Open in system browser`})]})}):null,t[66]=N,t[67]=_,t[68]=Me):Me=t[68];let Ne;t[69]!==je||t[70]!==Me?(Ne=(0,$.jsxs)(Ve,{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:[je,Me]}),t[69]=je,t[70]=Me,t[71]=Ne):Ne=t[71];let Pe;t[72]!==w||t[73]!==T||t[74]!==D||t[75]!==k?(Pe=w?(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{render:(0,$.jsx)(p,{variant:T?`secondary`:`ghost`,size:`icon-xs`,onClick:w,disabled:D,"aria-label":T?`Cancel annotation`:`Annotate preview`,"aria-pressed":T?`true`:`false`,type:`button`}),children:(0,$.jsx)(ce,{className:g(T&&`text-primary`)})}),(0,$.jsx)(O,{children:D&&k?k:T?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[72]=w,t[73]=T,t[74]=D,t[75]=k,t[76]=Pe):Pe=t[76];let Fe;t[77]!==y||t[78]!==v||t[79]!==b?(Fe=v?(0,$.jsxs)(A,{children:[(0,$.jsxs)(E,{render:(0,$.jsx)(p,{variant:b?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>v(e.shiftKey),"aria-label":b?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:y}),children:[(0,$.jsx)(Le,{className:g(b&&`text-destructive`)}),b?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(O,{children:b?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[77]=y,t[78]=v,t[79]=b,t[80]=Fe):Fe=t[80];let X;t[81]!==x||t[82]!==S||t[83]!==C?(X=x?(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{render:(0,$.jsx)(p,{variant:S?`secondary`:`ghost`,size:`icon-xs`,onClick:x,"aria-label":S?`Close floating preview`:`Float preview over chat`,"aria-pressed":S?`true`:`false`,type:`button`,disabled:C}),children:(0,$.jsx)(ae,{className:g(S&&`text-primary`)})}),(0,$.jsx)(O,{children:S?`Close floating preview`:`Float preview over chat`})]}):null,t[81]=x,t[82]=S,t[83]=C,t[84]=X):X=t[84];let Ie;t[85]!==L||t[86]!==xe||t[87]!==Ne||t[88]!==Pe||t[89]!==Fe||t[90]!==X||t[91]!==ee?(Ie=(0,$.jsxs)(`form`,{onSubmit:L,className:`surface-subheader gap-1 px-2`,"data-surface-subheader":!0,children:[xe,Ne,Pe,Fe,X,ee]}),t[85]=L,t[86]=xe,t[87]=Ne,t[88]=Pe,t[89]=Fe,t[90]=X,t[91]=ee,t[92]=Ie):Ie=t[92];let Re;t[93]===a?Re=t[94]:(Re=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]=Re);let ze;return t[95]!==Ie||t[96]!==Re?(ze=(0,$.jsxs)(`div`,{className:`relative`,children:[Ie,Re]}),t[95]=Ie,t[96]=Re,t[97]=ze):ze=t[97],ze}function Je(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 Ye(e){let t=(0,Q.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=g(`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 Xe(e){let t=(0,Q.c)(17),{server:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=Ze(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Ye,{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)(Qe,{}):(0,$.jsx)($e,{}),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 Ze(e){return e.processName?e.processName:e.listening?`Listening`:e.source===`configured`?`Configured`:`Recently seen`}function Qe(){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 $e(){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 et(e){let t=(0,Q.c)(7),n=he(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:pe(e.environmentId,t.url)}),t[5]=e.environmentId,t[6]=i),r=tt({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 tt(e){let t=new Map;for(let n of e.configuredUrls){let e=rt(n);if(!e)continue;let r=nt(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=nt(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=rt(n);if(!e)continue;let r=nt(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 nt(e,t){return`${e.toLowerCase()}:${t}`}function rt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!ke(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 it(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=et(o);if(s.length===0){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(G,{children:[(0,$.jsx)(R,{variant:`icon`,children:(0,$.jsx)(U,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(xe,{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)(Be,{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)(Xe,{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 at=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ot(e){let n=(0,Q.c)(74),{tabId:r,hasWebContents:a,zoomFactor:o,colorScheme:c,deviceToolbarVisible:u,onToggleDeviceToolbar:f,nativePictureInPicture:m,onNativePictureInPicture:h}=e;if(!L)return null;let g=!r||!a,_;n[0]===r?_=n[1]:(_=e=>()=>{r&&e(r).catch(mt)},n[0]=r,n[1]=_);let v=_,x;n[2]===o?x=n[3]:(x=Math.round(o*100),n[2]=o,n[3]=x);let S=`${x}%`,C;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{render:(0,$.jsx)(l,{render:(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(Re,{})}),(0,$.jsx)(O,{children:`More`})]}),n[4]=C):C=n[4];let w;n[5]===v?w=n[6]:(w=v(L.hardReload),n[5]=v,n[6]=w);let T;n[7]!==w||n[8]!==g?(T=(0,$.jsx)(P,{onClick:w,disabled:g,children:`Hard reload`}),n[7]=w,n[8]=g,n[9]=T):T=n[9];let D;n[10]===v?D=n[11]:(D=v(L.openDevTools),n[10]=v,n[11]=D);let k;n[12]!==D||n[13]!==g?(k=(0,$.jsx)(P,{onClick:D,disabled:g,children:`Open DevTools`}),n[12]=D,n[13]=g,n[14]=k):k=n[14];let j=m?`Close separate preview window`:`Open separate preview window`,M;n[15]!==h||n[16]!==j||n[17]!==g?(M=(0,$.jsx)(P,{onClick:h,disabled:g,children:j}),n[15]=h,n[16]=j,n[17]=g,n[18]=M):M=n[18];let te=u?`Hide device toolbar`:`Show device toolbar`,N;n[19]!==f||n[20]!==te||n[21]!==g?(N=(0,$.jsx)(P,{onClick:f,disabled:g,children:te}),n[19]=f,n[20]=te,n[21]=g,n[22]=N):N=n[22];let ne;n[23]===g?ne=n[24]:(ne=(0,$.jsx)(ee,{disabled:g,children:`Appearance`}),n[23]=g,n[24]=ne);let F;n[25]===r?F=n[26]:(F=e=>{r&&L.setColorScheme(r,e).catch(pt)},n[25]=r,n[26]=F);let re;n[27]===Symbol.for(`react.memo_cache_sentinel`)?(re=at.map(ft),n[27]=re):re=n[27];let I;n[28]!==c||n[29]!==F?(I=(0,$.jsx)(d,{className:`min-w-32`,children:(0,$.jsx)(b,{value:c,onValueChange:F,children:re})}),n[28]=c,n[29]=F,n[30]=I):I=n[30];let R;n[31]!==ne||n[32]!==I?(R=(0,$.jsxs)(i,{children:[ne,I]}),n[31]=ne,n[32]=I,n[33]=R):R=n[33];let ie;n[34]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(y,{}),n[34]=ie):ie=n[34];let ae;n[35]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(`span`,{children:`Zoom`}),n[35]=ae):ae=n[35];let z;n[36]===v?z=n[37]:(z=v(L.zoomOut),n[36]=v,n[37]=z);let B;n[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(we,{}),n[38]=B):B=n[38];let V;n[39]!==z||n[40]!==g?(V=(0,$.jsx)(p,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:z,"aria-label":`Zoom out`,disabled:g,children:B}),n[39]=z,n[40]=g,n[41]=V):V=n[41];let H;n[42]===S?H=n[43]:(H=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:S}),n[42]=S,n[43]=H);let U;n[44]===v?U=n[45]:(U=v(L.zoomIn),n[44]=v,n[45]=U);let se;n[46]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(oe,{}),n[46]=se):se=n[46];let W;n[47]!==U||n[48]!==g?(W=(0,$.jsx)(p,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:U,"aria-label":`Zoom in`,disabled:g,children:se}),n[47]=U,n[48]=g,n[49]=W):W=n[49];let G;n[50]===v?G=n[51]:(G=v(L.resetZoom),n[50]=v,n[51]=G);let ce;n[52]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(Ie,{}),n[52]=ce):ce=n[52];let K;n[53]!==G||n[54]!==g?(K=(0,$.jsx)(p,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:G,"aria-label":`Reset zoom`,disabled:g,children:ce}),n[53]=G,n[54]=g,n[55]=K):K=n[55];let le;n[56]!==V||n[57]!==H||n[58]!==W||n[59]!==K?(le=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[V,H,W,K]}),n[56]=V,n[57]=H,n[58]=W,n[59]=K,n[60]=le):le=n[60];let q;n[61]!==le||n[62]!==g?(q=(0,$.jsxs)(P,{closeOnClick:!1,onClick:dt,className:`justify-between`,disabled:g,children:[ae,le]}),n[61]=le,n[62]=g,n[63]=q):q=n[63];let ue,de,J;n[64]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(y,{}),de=(0,$.jsx)(P,{onClick:lt,children:`Clear cookies`}),J=(0,$.jsx)(P,{onClick:st,children:`Clear cache`}),n[64]=ue,n[65]=de,n[66]=J):(ue=n[64],de=n[65],J=n[66]);let fe;return n[67]!==N||n[68]!==R||n[69]!==q||n[70]!==T||n[71]!==k||n[72]!==M?(fe=(0,$.jsxs)(s,{children:[C,(0,$.jsxs)(t,{align:`end`,sideOffset:6,className:`min-w-56`,children:[T,k,M,N,R,ie,q,ue,de,J]})]}),n[67]=N,n[68]=R,n[69]=q,n[70]=T,n[71]=k,n[72]=M,n[73]=fe):fe=n[73],fe}function st(){L.clearCache().catch(ct)}function ct(){}function lt(){L.clearCookies().catch(ut)}function ut(){}function dt(e){return e.preventDefault()}function ft(e){return(0,$.jsx)(o,{value:e.value,children:e.label},e.value)}function pt(){}function mt(){}function ht(e){return ye[e]||(e.length>0?e:`Network error`)}function gt(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=yt(n)??n,t[0]=n,t[1]=c);let l=c,u;t[2]===i?u=t[3]:(u=ht(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 m=f,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(vt,{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 _;t[9]===l?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=_);let v;t[11]!==d||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,d,`.`]}),t[11]=d,t[12]=_,t[13]=v):v=t[13];let y;t[14]===o?y=t[15]:(y=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]=y);let b;t[16]===m?b=t[17]:(b=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:m}),t[16]=m,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>s(_t),t[18]=x):x=t[18];let S=o?`Hide details`:`Details`,C;t[19]===S?C=t[20]:(C=(0,$.jsx)(p,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:S}),t[19]=S,t[20]=C);let w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=w):w=t[21];let T;t[22]===a?T=t[23]:(T=(0,$.jsx)(p,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=T);let E;t[24]!==C||t[25]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[C,w,T]}),t[24]=C,t[25]=T,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==v||t[29]!==y||t[30]!==b?(D=(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,b,E]})}),t[27]=E,t[28]=v,t[29]=y,t[30]=b,t[31]=D):D=t[31],D}function _t(e){return!e}function vt(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 yt(e){try{return new URL(e).host}catch{return null}}function bt(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}var xt=120,St=220,Ct=4,wt=90,Tt=.08,Et=.5;function Dt(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),St);return()=>window.clearTimeout(e)}n(e=>e>0&&e<95?e:Ct);let t=window.setInterval(()=>{let e=r.current;if(e>=wt)return;let t=wt-e,i=Math.max(Et,t*Tt);n(Math.min(wt,e+i))},xt);return()=>window.clearInterval(t)},[e]),t}var Ot=class extends te()(`PreviewSessionThreadKeyParseError`,{threadKey:e}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},kt=h(e=>{let t=j(e);if(t===null)throw new Ot({threadKey:e});let n=Te.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=Te.events({environmentId:t.environmentId,input:{}});return c(e=>{let i=!1,a=0,o=e=>{x(e)&&ge(t,e.value)},s=r=>{if(!x(r)||r.value.threadId!==t.threadId)return;let i=I(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}J(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(f(1e3),F(`preview:session-sync:${e}`))});function At(e){let t=(0,Q.c)(2),n;t[0]===e?n=t[1]:(n=kt(S(e)),t[0]=e,t[1]=n),D(n)}var jt=1500,Mt=.001;function Nt(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)<Mt))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},jt),()=>{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=g(`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 Pt(e,t){return e?1:t===`human`?.18:.35}var Ft=700;function It(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=z(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(Lt,{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 Lt(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),Ft);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=Pt(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)(ze,{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 Rt=typeof window>`u`?null:_();function zt({threadRef:e,tabId:t,configuredUrls:r,visible:i}){let[a,o]=(0,Z.useState)(void 0),[s,c]=(0,Z.useState)(!1),l=Oe(),d=(0,Z.useRef)(!1),f=(0,Z.useRef)(!0),p=je(e),m=V(t=>be(t.byThreadKey,e)),h=u(e=>e.addPreviewAnnotation),g=u(e=>e.addImage),_=ne(e.environmentId),y=w(e.environmentId),b=N(Te.open),x=N(Te.resize,`preview viewport resize`);At(e),(0,Z.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let C=t??p.activeTabId,T=C?se(e,p.serverEpoch,C):null,E=C&&T?l.has(T)?T:Ae(e,C):null,D=C?p.sessions[C]??null:null,O=C?p.desktopByTabId[C]??null:null,A=D?.navStatus??{_tag:`Idle`},ee=A._tag===`Idle`?``:A.url,j=O?.loading??A._tag===`Loading`,M=O?.canGoBack??D?.canGoBack??!1,te=O?.canGoForward??D?.canGoForward??!1,P=A._tag===`Idle`,F=A._tag===`LoadFailed`,re=Se(D),I=O?.controller??`none`,R=Dt(j),ie=ee&&_&&y?Je({url:ee,environmentLabel:_.label,environmentHttpBaseUrl:y})??void 0:void 0,ae=D?.viewport??n,oe=z(e=>T?e.byTabId[T]?.rect??null:null),B=(0,Z.useCallback)(async t=>{T&&L?(await L.navigate(T,t),Fe(e,t)):await de({openPreview:b,threadRef:e,url:t})},[b,T,e]),U=(0,Z.useCallback)(async e=>{try{await B(Ne(e))}catch{}},[B]),W=(0,Z.useCallback)(async t=>{try{await B(pe(e.environmentId,t))}catch{}},[B,e.environmentId]),G=(0,Z.useCallback)(()=>{L&&T&&L.refresh(T)},[T]),ce=(0,Z.useCallback)(()=>{L&&T&&L.zoomIn(T)},[T]),le=(0,Z.useCallback)(()=>{L&&T&&L.zoomOut(T)},[T]),q=(0,Z.useCallback)(()=>{L&&T&&L.resetZoom(T)},[T]),ue=(0,Z.useCallback)(async t=>{if(!C)return;let n=await x({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:C,viewport:t}});if(n._tag===`Failure`){let e=v(n);throw X.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}De(e,n.value)},[x,C,e]),J=()=>{if(!T)return;if(ae._tag!==`fill`){Pe(T,n).catch(()=>void 0);return}let e=oe?Me(oe,O?.zoomFactor):{width:1024,height:768};Pe(T,{_tag:`freeform`,...e}).catch(()=>void 0)};(0,Z.useEffect)(()=>{if(T)return Ee(T,ue)},[ue,T]);let me=(0,Z.useCallback)(()=>{L&&T&&L.goBack(T)},[T]),he=(0,Z.useCallback)(()=>{L&&T&&L.goForward(T)},[T]),ge=(0,Z.useCallback)(()=>{!Rt||!ee||Rt.shell.openExternal(ee).catch(()=>void 0)},[ee]),ye=(0,Z.useCallback)(()=>{if(C){if(m?.tabId===C){V.getState().close(e);return}V.getState().open(e,C),k.getState().close(e)}},[m?.tabId,C,e]),xe=(0,Z.useCallback)(()=>{!L||!T||(O?.pictureInPicture?L.pictureInPicture.close:L.pictureInPicture.open)(T).catch(e=>{X.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[O?.pictureInPicture,T]),Ce=(0,Z.useCallback)(t=>{if(!L||!T||!C)return;let n=L;if(E){fe(E).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:bt(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){ve(T,e,C).catch(e=>{X.add({type:`error`,title:`Unable to start recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}n.captureScreenshot(T).then(e=>{let t={children:bt(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.`})})},[E,T,C,e]),we=(0,Z.useCallback)(()=>{if(!L||!T)return;if(d.current){L.cancelPickElement(T).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null;d.current=!0,c(!0),(async()=>{try{let t=await L.pickElement(T);if(!t)return;h(e,t);let n=await _e(t);n&&t.screenshot&&g(e,{type:`image`,id:t.id,name:n.name,mimeType:n.type,sizeBytes:n.size,previewUrl:t.screenshot.dataUrl,file:n})}catch{}finally{if(d.current=!1,f.current&&c(!1),t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[g,h,T,e]);return(0,Z.useEffect)(()=>()=>{d.current&&(d.current=!1,L&&T&&L.cancelPickElement(T).catch(()=>void 0),f.current&&c(!1))},[T]),(0,Z.useEffect)(()=>{if(i)return H(e=>{switch(e){case`refresh`:G();return;case`focus-url`:o(e=>(e??0)+1);return;case`zoom-in`:ce();return;case`zoom-out`:le();return;case`reset-zoom`:q();return;case`toggle-panel`:return}})},[G,q,ce,le,i]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":S(e),children:[(0,$.jsx)(qe,{url:ee,displayUrl:ie,loading:j,loadProgress:R,canGoBack:M,canGoForward:te,refreshDisabled:P,focusUrlNonce:a,onBack:me,onForward:he,onRefresh:G,onSubmit:e=>void U(e),onOpenInBrowser:C?ge:void 0,onCapture:L&&C?Ce:void 0,captureDisabled:!O||F,recording:E!==null,onPictureInPicture:L&&C?ye:void 0,pictureInPicture:m?.tabId===C,pictureInPictureDisabled:!O?.hasWebContents||F,onPickElement:L&&C?we:void 0,pickActive:s,pickDisabled:!C||F,pickDisabledReason:F?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:L?(0,$.jsx)(ot,{tabId:T,hasWebContents:O?.hasWebContents??!1,zoomFactor:O?.zoomFactor??1,colorScheme:O?.colorScheme??`system`,deviceToolbarVisible:ae._tag!==`fill`,onToggleDeviceToolbar:J,nativePictureInPicture:O?.pictureInPicture??!1,onNativePictureInPicture:xe}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[T&&D&&!re?(0,$.jsx)(K,{tabId:T,visible:i&&!F,className:`absolute inset-0 h-full w-full`},T):null,re?(0,$.jsx)(it,{environmentId:e.environmentId,configuredUrls:r,recentlySeenUrls:p.recentlySeenUrls,onOpenUrl:e=>void W(e)}):null,D&&O?(0,$.jsx)(Nt,{zoomFactor:O.zoomFactor}):null,T&&O&&!re&&!F?(0,$.jsx)(It,{tabId:T,zoomFactor:O.zoomFactor,controller:I}):null,I===`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:I===`agent`?`Agent controlling browser`:`Human control`}),A._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(gt,{url:A.url,code:A.code,description:A.description,onReload:G})}):null]})]})}function Bt(e){let t=(0,Q.c)(13),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o}=e;if(!q()){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)(W,{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)(zt,{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)(W,{mode:n,children:c}),t[10]=n,t[11]=c,t[12]=l):l=t[12],l}export{Bt as PreviewPanel};
|
|
2
|
-
//# sourceMappingURL=PreviewPanel-VQey9906.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Hf as e,Mr as t,Nf as n,ap as r,cp as i,t as a}from"./textarea-BM2z9WNB.js";import{$t as o,Ar as s,Bt as c,Cn as l,Ct as u,Dt as d,E as f,Et as p,Ft as m,Ht as h,It as g,Jt as _,Lt as v,Mt as y,Nt as b,Ot as x,Pt as S,Qt as C,Rt as w,Sn as T,St as E,Tt as D,Ut as O,Vt as k,Wt as A,Xt as j,Yt as M,Zt as N,_t as P,an as F,br as I,bt as ee,ct as te,dn as L,dt as R,en as z,ft as ne,gn as B,gt as V,ht as re,jt as H,kt as ie,ln as U,lt as W,mn as G,mt as ae,nn as K,on as oe,ot as q,pt as se,qt as J,sn as ce,st as Y,tn as X,ut as le,vn as ue,vt as de,wt as fe,xn as pe,xt as me,yt as he,zt as Z}from"./index-XxxL_T8f.js";var ge=-1,_e=class{__id=`file-renderer:${++ge}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;textDoucmentCache=new WeakMap;constructor(e={theme:B},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=k(e.theme??B)?O():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=Q(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Z(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!u(e),result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??S(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=B,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:E(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||!K(e,n.file)||!Z(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,H(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:H(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){return this.textDoucmentCache.get(e)?.lineCount??this.getOrCreateLineCache(e).length}updateRenderCache(e,t){if(this.renderCache==null)return;let{result:n}=this.renderCache;if(n!=null){for(let[r,i]of e)n.code[r]={type:`element`,tagName:`div`,properties:{"data-line":r+1,"data-line-type":`context`,"data-line-index":r},children:i.map(([e,n,r])=>e===0&&n===``?r===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:r}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`--diffs-token-${t}:${n};`},children:[{type:`text`,value:r}]})};n.baseThemeType=t,this.renderCache.isDirty=!0}}applyDocumentChange(e){if(this.renderCache==null)return;let{file:t,result:n}=this.renderCache;if(n!=null&&n.code.length!==e.lineCount){for(let t=n.code.length;t<e.lineCount;t++)n.code.push({type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]});this.renderCache.isDirty=!0}this.textDoucmentCache.set(t,e)}renderFile(e=this.renderCache?.file,t=G){if(e==null)return;let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||u(e)||Q(a.length,this.getTokenizeMaxLength()),c=!K(e,this.renderCache.file),l=!w(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??S(e.name);let t=this.highlighter!=null&&k(n.theme),i=this.highlighter!=null&&J(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=G){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Q(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??S(e.name);let n=this.highlighter!=null&&c(h(this.options.theme)),r=t||this.highlighter!=null&&J(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ie(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:s=!1}=this.options,c=[],l=z(),u=Math.min(t.startingLine+t.totalLines,a),d=0,f=x(t)?p(this.lineAnnotations):void 0;f!=null&&(l.children.push(C(`context`,`annotation`,1)),c.push(v({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:f.map(e=>y(e))})),d++);for(let r=t.startingLine;r<u;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}l.children.push(o(`context`,t,`${r}`)),c.push(i),d++;let a=this.lineAnnotations[t];a!=null&&(l.children.push(C(`context`,`annotation`,1)),c.push(v({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>y(e))})),d++)}return l.properties.style=`grid-row: span ${d}`,{gutterAST:l.children??[],contentAST:c,preAST:this.createPreElement(a),headerAST:s?void 0:this.renderHeader(e),totalLines:a,rowCount:d,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return g({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return N(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(X({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=z();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,fe(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return N(t?X({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await A(b(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!K(e,this.renderCache.file)||!this.renderCache.highlighted||!Z(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Z(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&K(e,n.file)&&Z(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return m({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Q(e,t){return e>t}function ve(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function ye(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var be=[``],xe=-1,Se=class{static LoadedCustomComponent=!0;__id=`file:${++xe}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:B},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new _e(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new _,this.interactionManager=new M(`file`,j(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(j(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!oe(this.appliedThemeCSS.theme,this.options.theme??B)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,e===`wrap`),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1,this.editor?.cleanUp(),this.editor=void 0}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;this.hydrateElements(t,n),Ce(this.pre,i,this.options.collapsed)||we(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),R(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(ye(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?be:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderView=()=>{let e=this.editor,t=this.fileContainer,n=this.file;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(r=>{e.__syncRenderView(r,t,n,this.lineAnnotations,this.renderRange)})};attachEditor(e){return this.editor?.cleanUp(),this.editor=e,U(this.syncRenderView),()=>{this.editor=void 0}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t){this.fileRenderer.updateRenderCache(e,t)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBackgroundTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!K(this.file,e);if(!c&&!n&&w(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(ye(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,pe);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.managersDirty=!0,a||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility(),this.editor!=null&&U(this.syncRenderView)}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||u(e)||this.fileRenderer.getOrCreateLineCache(e).length>(this.options.tokenizeMaxLength??1e5)||t.primeFileHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${y(r)}`,a=this.annotationCache.get(i);if(a==null||!ve(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:he(y(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=de();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=P(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=re(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??B,s=typeof o==`string`?o:{...o},c=V(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=te({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:ae(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=se(this.themeCSSStyle.textContent??``,V(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=ne({code:this.code});let n=this.fileRenderer.renderCodeAST(e);if(this.code.childElementCount>=2)for(let e=0;e<2;e++){let t=this.code.children[e],r=n[e];t.innerHTML=N(r.children),t.style.cssText=r.properties.style}else this.code.innerHTML=N(n);t.contains(this.code)||t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l||!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))return!1;let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??N(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderCustomHeader:a,renderHeaderMetadata:o}=this.options;if(a!=null){let e=a(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,L,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,l,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,T,r),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:W(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):W(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=me;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};ee(i,this.appliedPreAttributes)||(le(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ce(e,t,n=!1){return!n&&e==null&&t!=null}function we(e,t,n=!1){return e==null&&t!=null&&!n}var Te=5e3,Ee=-1;function De(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Oe=class extends Se{__id=`virtualized-file:${++Ee}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=ue,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&ce(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!F(t,e),r=De(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=d(this.lineAnnotations);if(this.renderRange!=null&&r&&x(this.renderRange)){let t=ke(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=n?.resetFileLayoutCache===!0||i;n?.metrics!=null&&(this.metrics=n.metrics,a=!0);let{collapsed:o=!1}=this.options;return this.currentCollapsed!==o&&(this.currentCollapsed=o,a=!0),a&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=this.fileRenderer.getLineCount(this.file)-1,i=q(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(this.file)-1;if(i<0)return;let a=q(this.metrics,t),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(r===`scroll`&&!this.hasLineAnnotations()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1,overflow:a=`scroll`}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(this.file),c=q(this.metrics,r),l=Y(this.metrics);if(this.height+=c,i){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,a===`scroll`&&!this.hasLineAnnotations())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&t&&!n){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:this.file.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{heights:r,checkpoints:i}=this.cache,a=this.renderRange;if(super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.layoutDirty=!0,r.size>0&&r.clear(),i.length>0&&(i.length=0),this.isSimpleMode()&&this.computeApproximateSize(),n&&a!==void 0&&this.file!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.file,this.top??0,e);t.bufferAfter!==a.bufferAfter&&this.updateBuffers(t)}}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=this.file==null||!K(this.file,t),{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;let c=this.syncLineAnnotations(r);if(c&&this.resetLayoutCache(),this.file=t,e=this.getOrCreateFileContainerNode(e),this.file==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(s)this.top??=this.getVirtualizedTop(),a&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!0));else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let l=this.virtualizer.getWindowSpecs(),u=this.top??0,d=this.computeRenderRangeFromWindow(this.file,u,l);return super.render({file:this.file,fileContainer:e,renderRange:d,lineAnnotations:r,forceRender:(o??n)||c,...i})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%Te===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(e),l=this.height,u=q(this.metrics,i),f=c>0?Y(this.metrics):0,{fileAnnotationHeight:p}=this.cache,m=u+p,h=Math.max(0,l-u-p-f),g=d(this.lineAnnotations),_=t+u,v=p>0&&g&&_<r&&_+p>n;if(t<n-l||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-f};if(c<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let y=Math.ceil(Math.max(r-n,0)/s),b=Math.ceil(y/o)*o+o*2,x=b/o,S=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+m,i=e+h;if(!v&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-f};let a=Math.floor(v&&S<t+m?0:(S-(t+m))/s),d=Math.floor(a/o)-Math.floor(x/2),g=Math.ceil(c/o),_=Math.max(0,Math.min(d,g))*o,y=d<0?b+d*o:b,C=_===0?0:p+_*s,w=Math.min(y,c-_);return{startingLine:_,totalLines:y,bufferBefore:C,bufferAfter:Math.max(0,(c-_-w)*s)}}let C=x,w=[],T=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-b*s*2),o),E=t+(T?.top??m),D=T?.lineIndex??0,O,k,A,j=T?.lineIndex??0;for(let e=j;e<c;e++){let i=D%o===0,a=Math.floor(D/o);if(i&&(w[a]=E-(t+m),A!=null)){if(A<=0)break;A--}let s=this.getLineHeight(e,!1);E>n-s&&E<r&&(O??=a),E+s>S&&(k??=a),A==null&&E>=r&&i&&(A=C),D++,E+=s}if(O==null)if(v)O=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-f};k??=O;let M=Math.round(k-x/2),N=Math.max(0,Math.ceil(c/o)-x),P=Math.max(0,Math.min(M,N)),F=P*o,I=M<0?b+M*o:b,ee=w[P]??0,te=F===0?0:p+ee,L=P+I/o,R=L<w.length?h-w[L]:h-(E-t-m);return{startingLine:F,totalLines:I,bufferBefore:te,bufferAfter:Math.max(0,R)}}};function ke(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===D&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}var $=e();function Ae({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,lineAnnotations:a,renderGutterUtility:o,getHoveredLine:s}){let c=t?.(e),l=n?.(e),u=r?.(e);return(0,$.jsxs)($.Fragment,{children:[c==null?(0,$.jsxs)($.Fragment,{children:[l!=null&&(0,$.jsx)(`div`,{slot:`header-prefix`,children:l}),u!=null&&(0,$.jsx)(`div`,{slot:`header-metadata`,children:u})]}):(0,$.jsx)(`div`,{slot:L,children:c}),i!=null&&a?.map((e,t)=>(0,$.jsx)(`div`,{slot:y(e),children:i(e)},t)),o!=null&&(0,$.jsx)(`div`,{slot:`gutter-utility-slot`,style:f,children:o(s)})]})}var je=n(),Me=i(r(),1);function Ne(e){let n=(0,je.c)(44),{kind:r,rangeLabel:i,text:o,onCancel:c,onComment:l,onDelete:u}=e,[d,f]=(0,Me.useState)(``);if(r===`comment`){let e,r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(s,{className:`size-4 text-muted-foreground`}),r=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:`Local comment`}),n[0]=e,n[1]=r):(e=n[0],r=n[1]);let a;n[2]===i?a=n[3]:(a=(0,$.jsx)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:i}),n[2]=i,n[3]=a);let c;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(I,{className:`size-3.5`}),n[4]=c):c=n[4];let l;n[5]===u?l=n[6]:(l=(0,$.jsx)(t,{variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:u,children:c}),n[5]=u,n[6]=l);let d;n[7]!==a||n[8]!==l?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,r,a,l]}),n[7]=a,n[8]=l,n[9]=d):d=n[9];let f;n[10]===o?f=n[11]:(f=(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-foreground`,children:o}),n[10]=o,n[11]=f);let p;return n[12]!==d||n[13]!==f?(p=(0,$.jsxs)(`div`,{"data-file-comment-annotation":!0,className:`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-sm`,contentEditable:!1,onPointerDown:Fe,children:[d,f]}),n[12]=d,n[13]=f,n[14]=p):p=n[14],p}let p;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(s,{className:`size-4 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:`Local comment`})]}),n[15]=p):p=n[15];let m;n[16]===i?m=n[17]:(m=(0,$.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Comment on lines `,i]}),n[16]=i,n[17]=m);let h=`Comment on lines ${i}`,g;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>f(e.target.value),n[18]=g):g=n[18];let _;n[19]!==c||n[20]!==l||n[21]!==d?(_=e=>{e.key===`Escape`&&(e.preventDefault(),c()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&d.trim()&&(e.preventDefault(),l(d.trim()))},n[19]=c,n[20]=l,n[21]=d,n[22]=_):_=n[22];let v;n[23]!==h||n[24]!==_||n[25]!==d?(v=(0,$.jsx)(a,{autoFocus:!0,className:`mt-3`,size:`sm`,value:d,placeholder:`Request change`,"aria-label":h,onChange:g,onKeyDown:_}),n[23]=h,n[24]=_,n[25]=d,n[26]=v):v=n[26];let y;n[27]===c?y=n[28]:(y=(0,$.jsx)(t,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),n[27]=c,n[28]=y);let b;n[29]===d?b=n[30]:(b=d.trim(),n[29]=d,n[30]=b);let x=!b,S;n[31]!==l||n[32]!==d?(S=()=>l(d.trim()),n[31]=l,n[32]=d,n[33]=S):S=n[33];let C;n[34]!==S||n[35]!==x?(C=(0,$.jsx)(t,{size:`sm`,disabled:x,onClick:S,children:`Comment`}),n[34]=S,n[35]=x,n[36]=C):C=n[36];let w;n[37]!==C||n[38]!==y?(w=(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[y,C]}),n[37]=C,n[38]=y,n[39]=w):w=n[39];let T;return n[40]!==w||n[41]!==m||n[42]!==v?(T=(0,$.jsxs)(`div`,{"data-file-comment-annotation":!0,className:`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-lg`,contentEditable:!1,onPointerDown:Pe,children:[p,m,v,w]}),n[40]=w,n[41]=m,n[42]=v,n[43]=T):T=n[43],T}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}var Ie=0;function Le(){return Ie+=1,`file-comment-${Date.now()}-${Ie}`}function Re(e){return{startLine:Math.min(e.start,e.end),endLine:Math.max(e.start,e.end)}}function ze(e,t){return e===t?`L${e}`:`L${e} to L${t}`}function Be(e){return e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(t=>{let n=t.endLine-t.startLine;return{...t,endLine:e.lineNumber,startLine:Math.max(1,e.lineNumber-n)}})}}))}export{Ne as a,Se as c,Be as i,Le as n,Ae as o,Re as r,Oe as s,ze as t};
|
|
2
|
-
//# sourceMappingURL=fileCommentAnnotations-BwnrRpfq.js.map
|