1import{r,j as e}from"./jsx-runtime-C2UBfbyc.js";import{u as D}from"./index-Ctn5E0jf.js";import{R as xt,a as vt}from"./contract-C8_2XbhZ.js";import{w as c,h as gt,j as yt}from"./workbench-DVZ8UPcc.js";import{c as Ve}from"./chat-YAQO4n_L.js";import{t as Pt}from"./stripIndent-OpH14_i6.js";import{B as le}from"./react-toastify.esm-DcR-pTER.js";import{a as Rt}from"./agenticDataBridge-BzBJ6muP.js";import"./amplify_outputs-ByhBuvRU.js";import"./logger-AqfA_hXV.js";import"./index-DgoachrA.js";import"./artifactTitle-DNRdmHz0.js";import"./authenticated-chat-Yvg3yA_B.js";import"./resume-DQ2pc8eQ.js";import"./aiWorkspace-DNQ8NOJn.js";import"./auth-BYwTrny6.js";import"./API-DAFHaofH.js";import"./sync-DtNvzS6k.js";import"./preload-helper-CLcXU_4U.js";import"./chatMode-nkbEUJmy.js";import"./chatMedia-Bm3yTEDP.js";import"./networkQuality-MoaFJ23-.js";import"./clientImageAssets-BwBgCWfG.js";import"./index-D-j07sr6.js";import"./router-CdSor0Tc.js";import"./index-DG0jpFbZ.js";import"./index-SgDwteQq.js";import"./index-CHoi3jgE.js";import"./clsx-B-dksMZM.js";const jt=r.memo(({isSelectionMode:i,setIsSelectionMode:o,containerRef:m})=>{const[w,a]=r.useState(!1),[u,g]=r.useState(null),[y,L]=r.useState(null),R=r.useRef(null),f=r.useRef(null);r.useEffect(()=>()=>{f.current&&(f.current.pause(),f.current.srcObject=null,f.current.remove(),f.current=null),R.current&&(R.current.getTracks().forEach(n=>n.stop()),R.current=null)},[]);const xe=async()=>{if(!R.current)try{const n=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:{displaySurface:"window",preferCurrentTab:!0,surfaceSwitching:"include",systemAudio:"exclude"}});if(n.addEventListener("inactive",()=>{f.current&&(f.current.pause(),f.current.srcObject=null,f.current.remove(),f.current=null),R.current&&(R.current.getTracks().forEach(p=>p.stop()),R.current=null),o(!1),g(null),L(null),a(!1)}),R.current=n,!f.current){const p=document.createElement("video");p.style.opacity="0",p.style.position="fixed",p.style.pointerEvents="none",p.style.zIndex="-1",document.body.appendChild(p),f.current=p}f.current.srcObject=n,await f.current.play()}catch(n){console.error("Failed to initialize stream:",n),o(!1),le.error("Failed to initialize screen capture")}return R.current},ce=r.useCallback(async()=>{if(!(!i||!u||!y||!m.current)){a(!0);try{if(!await xe()||!f.current)return;await new Promise(K=>setTimeout(K,300));const p=document.createElement("canvas");p.width=f.current.videoWidth,p.height=f.current.videoHeight;const I=p.getContext("2d");if(!I)throw new Error("Failed to get temporary canvas context");I.drawImage(f.current,0,0);const U=f.current.videoWidth/window.innerWidth,te=f.current.videoHeight/window.innerHeight,M=window.scrollX,Q=window.scrollY+40,ue=m.current.getBoundingClientRect(),ve=-9,H=-14,ge=Math.round((ue.left+Math.min(u.x,y.x)+M+ve)*U),E=Math.round((ue.top+Math.min(u.y,y.y)+Q+H)*te),X=Math.round(Math.abs(y.x-u.x)*U),B=Math.round(Math.abs(y.y-u.y)*te),_=document.createElement("canvas");_.width=Math.round(Math.abs(y.x-u.x)),_.height=Math.round(Math.abs(y.y-u.y));const pe=_.getContext("2d");if(!pe)throw new Error("Failed to get canvas context");pe.drawImage(p,ge,E,X,B,0,0,_.width,_.height);const ee=await new Promise((K,N)=>{_.toBlob(re=>{re?K(re):N(new Error("Failed to create blob"))},"image/png")}),q=window.__BOLT_ATTACH_IMAGE_FILES__;if(q){const K=new File([ee],"screenshot.png",{type:"image/png"});Promise.resolve(q([K])).then(()=>{le.success("Screenshot captured and added to chat")}).catch(N=>{console.error("Failed to add screenshot to chat",N),le.error("Could not add screenshot to chat")})}else le.error("Could not add screenshot to chat")}catch(n){console.error("Failed to capture screenshot:",n),le.error("Failed to capture screenshot"),R.current&&(R.current.getTracks().forEach(p=>p.stop()),R.current=null)}finally{a(!1),g(null),L(null),o(!1)}}},[i,u,y,m,o]),S=r.useCallback(n=>{if(n.preventDefault(),n.stopPropagation(),!i)return;const p=n.currentTarget.getBoundingClientRect(),I=n.clientX-p.left,U=n.clientY-p.top;g({x:I,y:U}),L({x:I,y:U})},[i]),de=r.useCallback(n=>{if(n.preventDefault(),n.stopPropagation(),!i||!u)return;const p=n.currentTarget.getBoundingClientRect(),I=n.clientX-p.left,U=n.clientY-p.top;L({x:I,y:U})},[i,u]);return i?e.jsx("div",{className:"absolute inset-0 cursor-crosshair",onMouseDown:S,onMouseMove:de,onMouseUp:ce,onMouseLeave:()=>{u&&g(null)},style:{backgroundColor:w?"transparent":"rgba(0, 0, 0, 0.1)",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"all",opacity:w?0:1,zIndex:50,transition:"opacity 0.1s ease-in-out"},children:u&&y&&!w&&e.jsx("div",{className:"absolute border-2 border-blue-500 bg-blue-200 bg-opacity-20",style:{left:Math.min(u.x,y.x),top:Math.min(u.y,y.y),width:Math.abs(y.x-u.x),height:Math.abs(y.y-u.
1y)}})}):null}),kt={phone:"i-ph:device-mobile",tablet:"i-ph:device-tablet",laptop:"i-ph:laptop",desktop:"i-ph:monitor"},Y=xt.flatMap(i=>i.id==="responsive"||i.width===null||i.height===null?[]:[{id:i.id,name:i.label,width:i.width,height:i.height,icon:kt[i.id],hasFrame:!0,frameType:i.id==="phone"?"mobile":i.id}]),ze=/\.local-credentialless\.webcontainer-api\.io$/i,He=/^\/webcontainer\/preview\/[^/]+$/i,Et=/^\/api(?:\/|$)/i,Nt=/^\/(?:login|signup|signin|sign-in|sign-up|register)(?:\/|$)/i,Tt=/^\/(?:src|@fs|@id|@vite|node_modules\/\.vite)(?:\/|$)/i,St=/\.[A-Za-z0-9]+(?:$|[?#])/,we=i=>{if(!i)return!1;const o=i.split(/[?#]/,1)[0]||"/";return!Et.test(o)&&!Tt.test(o)&&!St.test(o)},It=(i,o)=>{const m=`${i} 2${o||""}`.toLowerCase();return/(?:^|[/:])(?:src|app)\/[^\s"'?#]+\.(?:[cm]?[jt]sx?|css|scss|sass|html)/i.test(m)||m.includes("[plugin:vite")||m.includes("vite:import-analysis")||m.includes("pre-transform error")||m.includes("internal server error")||m.includes("failed to resolve import")||m.includes("does not provide an export")||m.includes("failed to load module script")||m.includes("expected a javascript module script")},$t=i=>{const o=i.toLowerCase();return o.includes("serviceworker intercepted")||o.includes("credentialless")||o.includes("cors header")||o.includes("opaque browser response")||o.includes("preview root probe timed out")||o.includes("preview startup failed")||o.includes("no ready preview")},Ct=(i,o)=>["*Auto-repair this preview error now.*","Repair the generated project so the Vite preview loads. Use the full current workspace and stream complete corrected file contents for every generated app file needed.","Use the preview error as diagnostic evidence, then inspect the project and fix the root cause instead of targeting only the first mentioned source path.","Do not rewrite CloudMySite platform infrastructure unless the error explicitly requires it.","```text",`Preview location: ${o}`,i,"```"].join(` 3`);function Wt(i,o,m,w){const a=i.toLowerCase(),u=String(o||"/"),g=`${u}${m||""}${w||""}`,y=(a.includes("unexpected token '<'")||a.includes("not valid json"))&&(a.includes("doctype")||a.includes("/api/check-auth")||a.includes("/api/auth/")||a.includes("json")),L=Nt.test(u);if(y||L)return{title:"Authentication Preview Needs Generated App Fix",description:"The generated app expected auth JSON but received an HTML page. Keep auth UI presentation-only and let the builder own the real auth routes and runtime.",content:`Authentication preview issue at ${g} 4 5${i}`,autoAskGeniePrompt:"The generated app authentication flow is misconfigured. Qwen must generate only the GUI/presentation for auth screens. Do not create custom auth routes, auth logic, session logic, password hashing, cookies, tokens, auth API handlers, or a custom auth backend. Keep auth UI in src/components/auth/AuthScreens.tsx or presentation-only subcomponents imported by it, preserving the named LoginScreen, SignupScreen, and AccountScreen exports. The builder owns the real /login, /signup, /account, and /logout routes plus the D1 auth runtime, and it should mount the generated auth UI there only after Admin -> Authentication is enabled. Until auth is enabled, keep the main app public and show a clear setup-needed message instead of throwing a JSON parse error or calling legacy auth endpoints."};const R=It(i,u)&&!$t(i);return{title:"Preview Build Failed",description:i.split(` 6`)[0]||"Preview build failed",content:`Error occurred at ${g} 7 8${i}`,autoAskGeniePrompt:R?Ct(i,g):void 0}}const At=i=>{if(i)try{const o=i.startsWith("http")?new URL(i):new URL(i,window.location.origin);if(ze.test(o.hostname)){const m=`${o.pathname||"/"}${o.search}${o.hash}`;return we(m)?m:"/"}if(He.test(o.pathname)){const m=o.searchParams.get("path")?.trim(),w=m?m.startsWith("/")?m:`/${m}`:"/";return we(w)?w:"/"}}catch{return}},Dt=(i,o)=>{const m=o.startsWith("/")?o:`/${o}`,w=new URL(m,i.origin);i.pathname=w.pathname,i.search=w.search,i.hash=w.hash},ke=(i,o,m)=>{try{const w=new URL(i),a=m?m.startsWith("/")?m:`/${m}`:At(o),u=we(a)?a:void 0;if(u)return Dt(w,u),w.toString();if(!o)return w.toString();const g=new URL(o);return!ze.test(g.hostname)||!we(`${g.pathname||"/"}${g.search}${g.hash}`)||(w.pathname=g.pathname||"/",w.search=g.search,w.hash=g.hash),w.toString()}catch{return i}},Ee=i=>{if(!i)return"/";try{const o=typeof window<"u"?i.startsWith("http")?new URL(i):new URL(i,window.location.origin):new URL(i,"https://preview.local");return He.test(o.pathname)?Ee(o.searchParams.get("path")||"/"):o.pathname.replace(/\/+$/,"")||"/"}catch{return String(i).trim().split(/[?#]/,1)[0]?.replace(/\/+$/,"")||"/"}},Lt=(i,o)=>o?i?Ee(i)===Ee(o):!1:!0,Be=({setSelectedElement:i,onControlsStateChange:o,projectId:m},w)=>{const a=r.useRef(null),u=r.useRef(null),g=r.useRef(""),y=r.useRef(0),[L,R]=r.useState(0),[f,xe]=r.useState(!1),ce=D(Pt),S=D(c.previews),de=S.some(t=>t.ready),n=r.useMemo(()=>{const t=S[L];return t?.ready?t:S.find(s=>s.ready)},[L,S]),[p,I]=r.useState(),U=r.useRef(),te=r.useCallback(t=>{U.current?.(),U.current=void 0,a.current=t,t?.contentWindow&&p&&m&&(U.current=Rt(t.contentWindow,new URL(p).origin,m))},[p,m]),M=r.useRef(!1),Q=r.useRef(null),[ue,ve]=r.useState(!1),[H,ge]=r.useState(!1),[E,X]=r.useState(!1),[B,_]=r.useState(37.5),[pe,ee]=r.useState(0),[q,K]=r.useState(100),N=r.useRef({isResizing:!1,side:null,startX:0,startWidthPercent:37.5,windowWidth:window.innerWidth,pointerId:null}),re=1,[ye,ne]=r.useState(!1),[x,me]=r.useState(Y[0]),[d,Ge]=r.useState(!1),[se,Ye]=r.useState(!0),[he,fe]=r.useState(!1),[W,F]=r.useState(0),[Ut,C]=r.useState(null),ie=D(c.previewDevice),oe=D(c.previewRefreshNonce),Z=D(c.previewNavigationRequest),v=D(c.previewVisible),Xe=D(c.previewStarting),Ne=D(c.previewEverReady),qe=D(c.builderLifecyclePhase),Pe=D(c.actionAlert),Te=D(c.files),O=r.useMemo(()=>gt(Te),[Te]),Se=r.useRef(""),{previewLocked:P,historyRestoring:Ke,previewAuthNotice:Re}=D(Ve);r.useEffect(()=>{!n?.ready||O.issues.length===0||!O.fingerprint||Pe||Se.current===O.fingerprint||(Se.current=O.fingerprint,c.actionAlert.set({type:"responsive-warning",title:"Responsive layout needs review",description:`${O.errorCount} high-risk and ${O.warningCount} advisory issue${O.issues.length===1?"":"s"} detected. Publishing remains available.`,content:yt(O),source:"responsive",autoAskGeniePrompt:vt}))},[Pe,n?.ready,O]);const V=5,Ie=2e3,Ze=1200,Je=2200,$=r.useRef(null),T=r.useRef(null),j=r.useRef(null),J=r.useRef(null),ae=r.useRef(!1);r.useEffect(()=>{if($.current&&(clearTimeout($.current),$.current=null),!(!n?.ready||v||W>=V)&&!P)return console.info("[Preview] Setting up retry timer for preview load",{currentRetries:W,maxRetries:V,baseUrl:n.baseUrl}),$.current=setTimeout(()=>{if(!v&&a.current&&n.baseUrl){console.info("[Preview] Retrying iframe reload after server ready",{retryCount:W+1,maxRetries:V,baseUrl:n.baseUrl}),F(s=>{const h=s+1;return C(`Waiting for server to respond... (attempt ${h}/${V})`),h});const t=`?retry=${Date.now()}`;a.current.src=n.baseUrl+t}$.current=null},Ie),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[n?.ready,v,W,n?.baseUrl,P]),r.useEffect(()=>{v&&(F(0),C(null),$.current&&(clearTimeout($.current),$.current=null),T.current&&(clearTimeout(T.current),T.current=null),j.current&&(clearTimeout(j.current),j.current=null))},[v]),r.useEffect(()=>{n?.ready&&!v&&W===0&&!P&&(console.info("[Preview] Server is ready, starting preview load retries"),C("Connecting to server..."))},[n?.ready,v,W,P]),r.useEffect(()=>{v&&(J.current=null)},[v]),r.useEffect(()=>{P&&($.current&&(clearTimeout($.current),$.current=null),T.current&&(clearTimeout(T.current),T.current=null),j.current&&(clearTimeout(j.current),j.current=null),J.current=null,ae.current=!1,M.current=!1,Q.current=null,F(0),C(null),I(void 0),a.current&&(a.current.src="about:blank"),c.setPreviewStarting(!1),c.setPreviewVisible(!1))},[P]),r.useCallback(()=>{P||(console.warn("[Preview] Iframe encountered an error, will retry"),!v&&W<V&&C("Connection failed. Retrying..."))},[v,W,P]),r.useEffect(()=>{if(!n){S.length===0?(M.current=!1,Q.current=null,I(void 0),F(0),C(null)):(a.current?.src||p)&&(M.current=!0),c.setPreviewStarting(S.length>0),c.setPreviewVisible(!1);return}if(P){console.info("[Preview] Iframe update suppressed: preview is locked during build/repair cycle"),c.setPreviewStarting(!1),c.setPreviewVisible(!1),I(void 0),a.current&&(a.current.src="about:blank");return}if(!n.ready){c.setPreviewStarting(S.length>0),c.setPreviewVisible(!1);return}const t=a.current?.src??p,s=ke(n.baseUrl,t,Z?.path);if(!s){M.current=!1,I(void 0),F(0),C(null),c.setPreviewStarting(S.length>0),c.setPreviewVisible(!1);return}const h=`${n.port}:${n.baseUrl}:${n.refreshRevision??0}:${oe}:${Z?.revision??0}:${s}`,l=!!a.current&&(M.current||Q.current!==h),b=t!==s;c.setPreviewStarting(!0),(b||l)&&(c.setPreviewVisible(!1),F(0),C(null)),I(z=>z===s?z:s),l&&a.current&&(M.current=!1,Q.current=h,F(0),C(null),requestAnimationFrame(()=>{a.current&&(a.current.src=s)}))},[n,p,P,Z?.path,Z?.revision,oe,S.length]),r.useEffect(()=>{if(!n?.ready||v||W>=V||P)return;const t=setTimeout(()=>{console.info("[Preview] Retrying preview load",{attempt:W+1,maxRetries:V,baseUrl:n.baseUrl}),F(s=>{const h=s+1;return C(`Connecting to server... (attempt ${h}/${V})`),h}),a.current&&n.baseUrl&&(a.current.src=n.baseUrl)},Ie);return()=>clearTimeout(t)},[n?.ready,v,W,n?.baseUrl,P]),r.useEffect(()=>{if(T.current&&(clearTimeout(T.current),T.current=null),!n?.ready||v||P)return;const t=a.current?.src||p||"";if(!(!t||t==="about:blank"))return T.current=setTimeout(()=>{const s=a.current?.src||p||"";!s||s==="about:blank"||(console.info("[Preview] Marking preview visible after ready iframe fallback",{baseUrl:n.baseUrl,iframeSrc:s}),M.current=!1,c.setPreviewVisible(!0),c.setPreviewStarting(!1),F(0),C(null))},Ze),()=>{T.current&&(clearTimeout(T.current),T.current=null)}},[n?.ready,n?.baseUrl,v,P,p,oe,Z?.revision]),r.useEffect(()=>{if(j.current&&(clearTimeout(j.current),j.current=null),!n?.ready||!n.baseUrl||P||v)return;const t=`${n.port}:${n.baseUrl}:${Z?.revision??0}`;if(J.current===t||ae.current)return;const s=n.baseUrl,h=n.port;return j.current=setTimeout(()=>{j.current=null,!(J.current===t||ae.current)&&(J.current=t,ae.current=!0,(async()=>
8{if(console.info("[Preview] Verifying ready preview before relying on iframe load",{baseUrl:s,port:h}),await c.ensureReadyPreviewResponsive({timeoutMs:6e3,maxRetries:2,retryDelayMs:750,triggerRefresh:!0,surfaceFailure:!1})){console.info("[Preview] Ready preview health check passed",{baseUrl:s,port:h}),C(null),c.setPreviewVisible(!0),c.setPreviewStarting(!1);return}if(!c.previews.get().some(k=>k.ready&&k.port===h&&k.baseUrl===s)||Ve.get().previewLocked)return;console.warn("[Preview] Ready preview did not respond; restarting preview server",{baseUrl:s,port:h}),C("Restarting preview server..."),c.setPreviewStarting(!0),c.setPreviewVisible(!1),await c.ensurePreviewRunningFromWorkspace({allowInitialStart:!0,reason:"preview-health-check-restart",maxAttempts:1,retryDelayMs:0,waitForActiveStartMs:15e3,waitForPreviewMs:15e3,forceRestart:!0,skipSetupCommand:!0})||(J.current=null)})().catch(l=>{console.warn("[Preview] Ready preview health check failed unexpectedly",l),J.current=null}).finally(()=>{ae.current=!1}))},Je),()=>{j.current&&(clearTimeout(j.current),j.current=null)}},[n?.ready,n?.baseUrl,n?.port,P,v,Z?.revision]);const $e=r.useCallback(()=>{M.current=!1,T.current&&(clearTimeout(T.current),T.current=null),j.current&&(clearTimeout(j.current),j.current=null),c.setPreviewVisible(!0),c.setPreviewStarting(!1);const t=c.previewNavigationRequest.get();t&&Lt(a.current?.src,t.path)&&c.clearPreviewNavigationRequest(t.revision)},[]),Qe=!!n&&!v,Ce=!!n?.ready&&!v&&W>=V&&!P,et=S.length>0||Xe||qe==="READY_FOR_PREVIEW"||P||Ke||!!Pe,tt=!n&&et,We=r.useCallback(t=>{const s=de?t.filter(l=>l.ready):t;if(s.length===0)return-1;const h=s[s.length-1];return t.findIndex(l=>l.port===h.port)},[de]);r.useEffect(()=>{if(S.length===0){R(0);return}const t=We(S);t>=0&&t!==L&&R(t)},[L,We,S]);const rt=()=>{if(a.current){const t=c.previewNavigationRequest.get(),s=n?.baseUrl?ke(n.baseUrl,a.current.src??p,t?.path):a.current.src??p;if(c.setPreviewStarting(!0),c.setPreviewVisible(!1),s){I(h=>h===s?h:s),a.current.src=s;return}a.current.src=a.current.src}};r.useEffect(()=>{oe>0&&rt()},[oe]);const Ae=r.useCallback(async()=>{!f&&u.current?await u.current.requestFullscreen():document.fullscreenElement&&await document.exitFullscreen()},[f]);r.useEffect(()=>{const t=()=>{xe(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",t),()=>{document.removeEventListener("fullscreenchange",t)}},[]),r.useEffect(()=>{if(ie==="responsive"){X(!0),fe(!1),_(100);return}if(X(!0),fe(!0),ie==="mobile"){me(Y.find(t=>t.id==="phone")??Y[0]);return}if(ie==="tablet"){me(Y.find(t=>t.id==="tablet")??Y[0]);return}if(ie==="desktop"){me(Y.find(t=>t.id==="desktop")??Y[0]);return}},[ie]);const De=r.useCallback(()=>{X(t=>!t)},[]),Le=r.useCallback(()=>{const t=!H;ge(t),a.current?.contentWindow&&a.current.contentWindow.postMessage({type:"INSPECTOR_ACTIVATE",active:t},"*")},[H]),Ue=r.useCallback(()=>{ne(t=>!t)},[]);r.useImperativeHandle(w,()=>({toggleDeviceMode:De,toggleFullscreen:()=>{Ae()},toggleWindowOptions:Ue,toggleInspectorMode:Le,closeWindowOptions:()=>ne(!1)}),[De,Ae,Le,Ue]),r.useEffect(()=>{o?.({isDeviceModeOn:E,isFullscreen:f,isWindowOptionsOpen:ye,isInspectorMode:H})},[E,f,H,ye,o]);const nt=(t,s)=>{if(!E)return;t.currentTarget.setPointerCapture(t.pointerId),document.body.style.userSelect="none",document.body.style.cursor="ew-resize",N.current={isResizing:!0,side:s,startX:t.clientX,startWidthPercent:B,windowWidth:window.innerWidth,pointerId:t.pointerId}},Me=({side:t})=>t?e.jsx("div",{className:`resize-handle-${t}`,onPointerDown:s=>nt(s,t),style:{position:"absolute",top:0,...t==="left"?{left:0,marginLeft:"-7px"}:{right:0,marginRight:"-7px"},width:"15px",height:"100%",cursor:"ew-resize",background:"var(--bolt-elements-background-depth-4, rgba(0,0,0,.3))",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.2s",userSelect:"none",touchAction:"none",zIndex:10},onMouseOver:s=>s.currentTarget.style.background="var(--bolt-elements-background-depth-4, rgba(0,0,0,.3))",onMouseOut:s=>s.currentTarget.style.background="var(--bolt-elements-background-depth-3, rgba(0,0,0,.15))",title:"Drag to resize width",children:e.jsx(st,{})}):null;r.useEffect(()=>{if(!E)return;const t=l=>{const b=N.current;if(!b.isResizing||l.pointerId!==b.pointerId)return;const k=(l.clientX-b.startX)/b.windowWidth*100*re;let A=b.startWidthPercent;if(b.side==="right"?A=b.startWidthPercent+k:b.side==="left"&&(A=b.startWidthPercent-k),A=Math.max(10,Math.min(A,90)),_(A),u.current){const G=u.current.clientWidth,je=Math.round(G*A/100);ee(je);const be=u.current.querySelector('div[style*="width"]');be&&(be.style.width=`${A}%`)}},s=l=>{const b=N.current;if(!b.isResizing||l.pointerId!==b.pointerId)return;document.querySelectorAll(".resize-handle-left, .resize-handle-right").forEach(k=>{k.hasPointerCapture?.(l.pointerId)&&k.releasePointerCapture(l.pointerId)}),N.current={...N.current,isResizing:!1,side:null,pointerId:null},document.body.style.userSelect="",document.body.style.cursor=""};document.addEventListener("pointermove",t,{passive:!1}),document.addEventListener("pointerup",s),document.addEventListener("pointercancel",s);function h(){document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",s),document.removeEventListener("pointercancel",s),N.current.pointerId!==null&&(document.querySelectorAll(".resize-handle-left, .resize-handle-right").forEach(b=>{b.hasPointerCapture?.(N.current.pointerId)&&b.releasePointerCapture(N.current.pointerId)}),N.current={...N.current,isResizing:!1,side:null,pointerId:null},document.body.style.userSelect="",document.body.style.cursor="")}return h},[E,re]),r.useEffect(()=>{const t=()=>{if(N.current.windowWidth=window.innerWidth,u.current&&E){const s=u.current.clientWidth;ee(Math.round(s*B/100))}};if(window.addEventListener("resize",t),u.current&&E){const s=u.current.clientWidth;ee(Math.round(s*B/100))}return()=>{window.removeEventListener("resize",t)}},[E,B]),r.useEffect(()=>{if(u.current&&E){const t=u.current.clientWidth;ee(Math.round(t*B/100))}},[E]);const st=()=>e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",pointerEvents:"none"},children:e.jsx("div",{style:{color:"var(--bolt-elements-textSecondary, rgba(0,0,0,0.5))",fontSize:"10px",lineHeight:"5
8px",userSelect:"none",marginLeft:"1px"},children:"â¢â¢â¢ â¢â¢â¢"})}),_e=t=>{if(n?.baseUrl)return ke(n.baseUrl,a.current?.src??p,t)},it=t=>{const s=_e();if(!s){console.warn("[Preview] No active preview available");return}let h=t.width,l=t.height;if(d&&(t.frameType==="mobile"||t.frameType==="tablet")&&(h=t.height,l=t.width),se&&t.hasFrame){const b=t.frameType==="mobile"?d?120:40:60,z=t.frameType==="mobile"?80:d?60:100,k=window.open("","_blank",`width=${h+b},height=${l+z+40},menubar=no,toolbar=no,location=no,status=no`);if(!k){console.error("Failed to open new window");return}const A=Oe(),G=t.frameType==="mobile"?"36px":"20px",je=t.frameType==="mobile"?d?"40px 60px":"40px 20px":d?"30px 50px":"50px 30px",be=d?"50%":"20px",lt=d?"30px":"50%",ct=d?"translateY(-50%)":"translateX(-50%)",dt=d?"8px":t.frameType==="mobile"?"60px":"80px",ut=d?t.frameType==="mobile"?"60px":"80px":"8px",pt=d?"50%":"15px",mt=d?"30px":"50%",ht=d?"translateY(50%)":"translateX(50%)",ft=d?"4px":"40px",bt=d?"40px":"4px",wt=` 9 <!DOCTYPE html> 10 <html> 11 <head> 12 <meta charset="utf-8"> 13 <title>${t.name} Preview</title> 14 <style> 15 body { 16 margin: 0; 17 padding: 0; 18 display: flex; 19 justify-content: center; 20 align-items: center; 21 height: 100vh; 22 background: #f0f0f0; 23 overflow: hidden; 24 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 25 } 26 27 .device-container { 28 position: relative; 29 } 30 31 .device-name { 32 position: absolute; 33 top: -30px; 34 left: 0; 35 right: 0; 36 text-align: center; 37 font-size: 14px; 38 color: #333; 39 } 40 41 .device-frame { 42 position: relative; 43 border-radius: ${G}; 44 background: ${A}; 45 padding: ${je}; 46 box-shadow: 0 10px 30px rgba(0,0,0,0.2); 47 overflow: hidden; 48 } 49 50 /* Notch */ 51 .device-frame:before { 52 content: ''; 53 position: absolute; 54 top: ${be}; 55 left: ${lt}; 56 transform: ${ct}; 57 width: ${dt}; 58 height: ${ut}; 59 background: #333; 60 border-radius: 4px; 61 z-index: 2; 62 } 63 64 /* Home button */ 65 .device-frame:after { 66 content: ''; 67 position: absolute; 68 bottom: ${pt}; 69 right: ${mt}; 70 transform: ${ht}; 71 width: ${ft}; 72 height: ${bt}; 73 background: #333; 74 border-radius: 50%; 75 z-index: 2; 76 } 77 78 iframe { 79 border: none; 80 width: ${h}px; 81 height: ${l}px; 82 background: white; 83 display: block; 84 } 85 </style> 86 </head> 87 <body> 88 <div class="device-container"> 89 <div class="device-name">${t.name} ${d?"(Landscape)":"(Portrait)"}</div> 90 <div class="device-frame"> 91 <iframe src="${s}" sandbox="allow-scripts allow-forms allow-popups allow-modals allow-storage-access-by-user-activation allow-same-origin" allow="cross-origin-isolated"></iframe> 92 </div> 93 </div> 94 </body> 95 </html> 96 `;k.document.open(),k.document.write(wt),k.document.close()}else{const b=window.open(s,"_blank",`width=${h},height=${l},menubar=no,toolbar=no,location=no,status=no`);
96b&&b.focus()}},ot=()=>{const t=_e();t&&window.open(t,"_blank")},at=r.useCallback(()=>{if(!x)return"40px 20px";const t=x.frameType==="mobile";return d?t?"40px 60px":"30px 50px":t?"40px 20px":"50px 30px"},[d,x]),Fe=r.useCallback(()=>q/100,[q]);r.useEffect(()=>()=>{},[E,he,Fe,d,x]);const Oe=r.useCallback(()=>ce==="dark"?"#555":"#111",[ce]);return r.useEffect(()=>{const t=s=>{if(!(a.current?.contentWindow&&s.source!==a.current.contentWindow)){if(s.data.type==="INSPECTOR_READY")a.current?.contentWindow&&a.current.contentWindow.postMessage({type:"INSPECTOR_ACTIVATE",active:H},"*");else if(s.data.type==="INSPECTOR_CLICK"){const h=s.data.elementInfo;navigator.clipboard.writeText(h.displayText).then(()=>{i?.(h)})}else if(s.data.type==="GENIE_PREVIEW_ERROR"){const h=String(s.data.message||"").trim(),l=h.toLowerCase(),b=l.includes("failed to load module script")&&l.includes('mime type of "text/html"')&&(l.includes("/src/")||l.includes("/app/")||l.includes(".tsx")||l.includes(".ts")||l.includes(".jsx")||l.includes(".js")||l.includes(".css")),z=(l.includes("failed to load resource")||l.includes("internal server error"))&&(l.includes("/src/")||l.includes(".tsx")||l.includes(".ts")||l.includes(".jsx"))&&!b&&!l.includes("[plugin:vite")&&!l.includes("vite:import-analysis")&&!l.includes("unterminated")&&!l.includes("expected corresponding jsx closing tag")&&!l.includes("failed to resolve import")&&!l.includes("unexpected token");if(!h||z)return;const k=`${s.data.source||"unknown"}:${h.replace(/([?&]t=)\d+/g,"$1<ts>").replace(/\b\d+:\d+\b/g,"<loc>").replace(/\s+/g," ").slice(0,500)}`,A=Date.now();if(k===g.current&&A-y.current<5e3)return;g.current=k,y.current=A;const G=Wt(h,s.data.pathname,s.data.search,s.data.hash);c.actionAlert.set({type:"preview",title:G.title,description:G.description,content:G.content,source:"preview",autoAskGeniePrompt:G.autoAskGeniePrompt})}}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[H]),e.jsxs("div",{ref:u,className:"w-full h-full flex flex-col relative",children:[ye&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",onClick:()=>ne(!1)}),e.jsxs("div",{className:"absolute right-2 top-2 z-50 min-w-[240px] max-h-[400px] overflow-y-auto bg-white dark:bg-black rounded-xl shadow-2xl border border-[#E5E7EB] dark:border-[rgba(255,255,255,0.1)] overflow-hidden",children:[e.jsxs("div",{className:"p-3 border-b border-[#E5E7EB] dark:border-[rgba(255,255,255,0.1)]",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("span",{className:"text-sm font-medium text-[#111827] dark:text-gray-300",children:"Window Options"})}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("button",{className:"flex w-full items-center justify-between bg-transparent text-start text-xs text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary",onClick:()=>{c.setPreviewDevice("responsive"),X(!0),fe(!1),_(100),ne(!1)},children:[e.jsx("span",{children:"Responsive / free resize"}),e.jsx("div",{className:"i-ph:arrows-out-line-horizontal h-5 w-4"})]}),e.jsxs("button",{className:"flex w-full justify-between items-center text-start bg-transparent text-xs text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary",onClick:()=>{ot()},children:[e.jsx("span",{children:"Open in new tab"}),e.jsx("div",{className:"i-ph:arrow-square-out h-5 w-4"})]}),e.jsxs("button",{className:"flex w-full justify-between items-center text-start bg-transparent text-xs text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary",onClick:()=>it(x),children:[e.jsx("span",{children:"Open in new window"}),e.jsx("div",{className:"i-ph:browser h-5 w-4"})]}),e.jsxs("label",{className:"flex flex-col gap-1 text-xs text-bolt-elements-textTertiary",children:[e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Preview zoom"}),e.jsxs("output",{children:[q,"%"]})]}),e.jsx("input",{"aria-label":"Preview zoom",type:"range",min:"50",max:"125",step:"5",value:q,onChange:t=>K(Number(t.target.value))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-bolt-elements-textTertiary",children:"Show Device Frame"}),e.jsx("button",{className:`w-10 h-5 rounded-full transition-colors duration-200 ${se?"bg-[#6D28D9]":"bg-gray-300 dark:bg-gray-700"} relative`,onClick:t=>{t.stopPropagation(),Ye(!se)},children:e.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform duration-200 ${se?"transform translate-x-5":""}`})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-bolt-elements-textTertiary",children:"Landscape Mode"}),e.jsx("button",{className:`w-10 h-5 rounded-full transition-colors duration-200 ${d?"bg-[#6D28D9]":"bg-gray-300 dark:bg-gray-700"} relative`,onClick:t=>{t.stopPropagation(),Ge(!d)},children:e.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform duration-200 ${d?"transform translate-x-5":""}`})})]})]})]}),Y.map(t=>e.jsxs("button",{className:"w-full px-4 py-3.5 text-left text-[#111827] dark:text-gray-300 text-sm whitespace-nowrap flex items-center gap-3 group hover:bg-[#F5EEFF] dark:hover:bg-gray-900 bg-white dark:bg-black",onClick:()=>{me(t),X(!0),fe(!0),ne(!1)},children:[e.jsx("div",{className:`${t.icon} w-5 h-5 text-[#6B7280] dark:text-gray-400 group-hover:text-[#6D28D9] dark:group-hover:text-[#6D28D9] transition-colors duration-200`}),e.jsxs("div",{className:"flex-grow flex flex-col",children:[e.jsx("span",{className:"font-medium group-hover:text-[#6D28D9] dark:group-hover:text-[#6D28D9] transition-colors duration-200",children:t.name}),e.jsxs("span",{className:"text-xs text-[#6B7280] dark:text-gray-400 group-hover:text-[#6D28D9] dark:group-hover:text-[#6D28D9] transition-colors duration-200",children:[d&&(t.frameType==="mobile"||t.frameType==="tablet")?`${t.height} Ã ${t.width}`:`${t.width} Ã ${t.height}`,t.hasFrame&&se?" (with frame)":""]})]}),x.name===t.name&&e.jsx("div",{className:"text-[#6D28D9] dark:text-[#6D28D9]",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]},t.name))]})]}),e.jsx("div",{className:"flex-1 border-bolt-elements-borderColor flex justify-center items-center overflow-auto",children:e.jsxs("div",{style:{width:E?he?"100%":`${B}%`:"100%",height:"100%",overflow:"auto",background:"var(--bolt-elements-background-depth-1)",position:"relative",display:"flex",justifyContent:"center",alignItems:"center"},children:[n?e.jsxs(e.Fragment,{children:[E&&he?e.jsx("div",{className:"device-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",padding:"0",overflow:"auto",transition:"all 0.3s ease",position:"relative"},children:e.jsxs("div",{className:"device-frame-container",style:{position:"relative",borderRadius:x.frameType==="mobile"?"36px":"20px",background:Oe(),padding:at(),boxSh
96adow:"0 10px 30px rgba(0,0,0,0.2)",overflow:"hidden",transform:`scale(${Fe()})`,transformOrigin:"center center",transition:"all 0.3s ease",margin:"40px",width:d?`${x.height+(x.frameType==="mobile"?120:60)}px`:`${x.width+(x.frameType==="mobile"?40:60)}px`,height:d?`${x.width+(x.frameType==="mobile"?80:60)}px`:`${x.height+(x.frameType==="mobile"?80:100)}px`},children:[e.jsx("div",{style:{position:"absolute",top:d?"50%":"20px",left:d?"30px":"50%",transform:d?"translateY(-50%)":"translateX(-50%)",width:d?"8px":x.frameType==="mobile"?"60px":"80px",height:d?x.frameType==="mobile"?"60px":"80px":"8px",background:"#333",borderRadius:"4px",zIndex:2}}),e.jsx("div",{style:{position:"absolute",bottom:d?"50%":"15px",right:d?"30px":"50%",transform:d?"translateY(50%)":"translateX(50%)",width:d?"4px":"40px",height:d?"40px":"4px",background:"#333",borderRadius:"50%",zIndex:2}}),e.jsx("iframe",{ref:te,title:"preview",style:{border:"none",width:d?`${x.height}px`:`${x.width}px`,height:d?`${x.width}px`:`${x.height}px`,background:"white",display:"block",opacity:v?1:0,transition:"opacity 0.2s ease"},src:p,onLoad:$e,sandbox:"allow-scripts allow-forms allow-popups allow-modals allow-storage-access-by-user-activation allow-same-origin allow-downloads",allow:"cross-origin-isolated"})]})}):e.jsx("iframe",{ref:te,title:"preview",className:"border-none w-full h-full bg-bolt-elements-background-depth-1 transition-opacity duration-200",style:{opacity:v?1:0},src:p,onLoad:$e,sandbox:"allow-scripts allow-forms allow-popups allow-modals allow-storage-access-by-user-activation allow-same-origin allow-downloads",allow:"geolocation; ch-ua-full-version-list; cross-origin-isolated; screen-wake-lock; publickey-credentials-get; shared-storage-select-url; ch-ua-arch; bluetooth; compute-pressure; ch-prefers-reduced-transparency; deferred-fetch; usb; ch-save-data; publickey-credentials-create; shared-storage; deferred-fetch-minimal; run-ad-auction; ch-ua-form-factors; ch-downlink; otp-credentials; payment; ch-ua; ch-ua-model; ch-ect; autoplay; camera; private-state-token-issuance; accelerometer; ch-ua-platform-version; idle-detection; private-aggregation; interest-cohort; ch-viewport-height; local-fonts; ch-ua-platform; midi; ch-ua-full-version; xr-spatial-tracking; clipboard-read; gamepad; display-capture; keyboard-map; join-ad-interest-group; ch-width; ch-prefers-reduced-motion; browsing-topics; encrypted-media; gyroscope; serial; ch-rtt; ch-ua-mobile; window-management; unload; ch-dpr; ch-prefers-color-scheme; ch-ua-wow64; attribution-reporting; fullscreen; identity-credentials-get; private-state-token-redemption; hid; ch-ua-bitness; storage-access; sync-xhr; ch-device-memory; ch-viewport-width; picture-in-picture; magnetometer; clipboard-write; microphone"}),Qe&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-gradient-to-br from-bolt-elements-background-depth-1 via-bolt-elements-background-depth-1/95 to-bolt-elements-background-depth-1/90",children:e.jsxs("div",{className:"max-w-md px-8 text-center",children:[e.jsxs("div",{className:"relative mx-auto mb-6 w-48",children:[e.jsxs("div",{className:"rounded-xl border-2 border-bolt-elements-border bg-bolt-elements-background-depth-2 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-bolt-elements-border px-3 py-2",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-red-400/80"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-yellow-400/80"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-400/80"}),e.jsx("div",{className:"ml-2 flex-1 rounded bg-bolt-elements-background-depth-1 px-2 py-0.5 text-xs text-bolt-elements-textTertiary opacity-60",children:"localhost:5173"})]}),e.jsxs("div",{className:"relative h-28 overflow-hidden rounded-b-xl bg-bolt-elements-background-depth-1 p-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 w-3/4 animate-pulse rounded bg-gradient-to-r from-bolt-elements-textTertiary/20 via-bolt-elements-textTertiary/30 to-bolt-elements-textTertiary/20"}),e.jsx("div",{className:"h-2 w-full animate-pulse rounded bg-gradient-to-r from-bolt-elements-textTertiary/15 via-bolt-elements-textTertiary/25 to-bolt-elements-textTertiary/15"}),e.jsx("div",{className:"h-2 w-5/6 animate-pulse rounded bg-gradient-to-r from-bolt-elements-textTertiary/15 via-bolt-elements-textTertiary/25 to-bolt-elements-textTertiary/15"}),e.jsx("div",{className:"mt-3 h-8 w-1/3 animate-pulse rounded-lg bg-gradient-to-r from-bolt-elements-accent/20 via-bolt-elements-accent/30 to-bolt-elements-accent/20"})]}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 animate-bounce rounded-full bg-bolt-elements-accent/60",style:{animationDelay:"0s"}}),e.jsx("div",{className:"absolute -left-1 top-8 h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent/40",style:{animationDelay:"0.3s"}}),e.jsx("div",{className:"absolute right-2 top-16 h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent/50",style:{animationDelay:"0.6s"}})]})]}),e.jsx("div",{className:"absolute -inset-4 -z-10 rounded-2xl bg-gradient-to-r from-bolt-elements-accent/10 via-bolt-elements-accent/5 to-bolt-elements-accent/10 blur-xl"})]}),e.jsx("div",{className:"mb-4 text-lg font-semibold text-bolt-elements-textPrimary",children:Ce?"Loading live preview":"Building your app preview"}),e.jsx("div",{className:"mb-5 text-sm leading-relaxed text-bolt-elements-textSecondary",children:Ce?"The dev server is ready. Genie is connecting the preview, and it will appear automatically.":"Genie is setting up your workspace and connecting the live preview. This usually takes just a moment."}),e.jsxs("div",{className:"mx-auto flex items-center justify-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0s"}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0.15s"}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0.3s"}})]}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3 text-xs text-bolt-elements-textTertiary",children:[e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full bg-bolt-elements-background-depth-2 px-3 py-1.5",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-400"}),"Dependencies"]}
96),e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full bg-bolt-elements-background-depth-2 px-3 py-1.5",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-blue-400"}),"Bundling"]}),e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full bg-bolt-elements-background-depth-2 px-3 py-1.5",children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-purple-400"}),"Preview"]})]})]})}),e.jsx(jt,{isSelectionMode:ue,setIsSelectionMode:ve,containerRef:a})]}):tt?e.jsx("div",{className:"flex w-full h-full justify-center items-center bg-gradient-to-br from-bolt-elements-background-depth-1 via-bolt-elements-background-depth-1/95 to-bolt-elements-background-depth-1/90 text-bolt-elements-textPrimary",children:e.jsxs("div",{className:"max-w-md px-8 text-center",children:[e.jsxs("div",{className:"relative mx-auto mb-6",children:[e.jsx("div",{className:"mx-auto flex h-24 w-24 items-center justify-center rounded-full bg-gradient-to-br from-bolt-elements-accent/20 to-bolt-elements-accent/5",children:e.jsx("div",{className:"text-5xl text-bolt-elements-accent i-ph:rocket-launch-duotone"})}),e.jsx("div",{className:"absolute -inset-2 animate-spin rounded-full border-2 border-dashed border-bolt-elements-accent/20",style:{animationDuration:"8s"},children:e.jsx("div",{className:"absolute -top-1 left-1/2 h-2 w-2 -translate-x-1/2 rounded-full bg-bolt-elements-accent/60"})}),e.jsx("div",{className:"absolute -inset-4 animate-spin rounded-full border border-dashed border-bolt-elements-accent/10",style:{animationDuration:"12s",animationDirection:"reverse"},children:e.jsx("div",{className:"absolute -bottom-1 left-1/2 h-1.5 w-1.5 -translate-x-1/2 rounded-full bg-bolt-elements-accent/40"})})]}),e.jsx("div",{className:"mb-3 text-lg font-semibold text-bolt-elements-textPrimary",children:Ne?"Reconnecting to live preview":"Your preview will appear here"}),e.jsx("div",{className:"mb-5 text-sm leading-relaxed text-bolt-elements-textSecondary",children:Ne?"Genie is reconnecting the live app preview after your recent changes.":"Genie is preparing the preview environment for your app."}),e.jsxs("div",{className:"mx-auto flex items-center justify-center gap-2",children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0s"}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0.15s"}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-bolt-elements-accent",style:{animationDelay:"0.3s"}})]}),e.jsxs("div",{className:"mt-5 rounded-lg border border-bolt-elements-border/50 bg-bolt-elements-background-depth-2 px-4 py-2.5 text-xs text-bolt-elements-textTertiary",children:[e.jsx("span",{className:"font-medium text-bolt-elements-textSecondary",children:"Tip:"})," Your changes are being compiled and the preview will load automatically."]})]})}):e.jsx("div",{className:"flex w-full h-full justify-center items-center bg-bolt-elements-background-depth-1 text-bolt-elements-textPrimary",children:"No preview available"}),Re&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gradient-to-br from-bolt-elements-background-depth-1/95 via-bolt-elements-background-depth-1/95 to-bolt-elements-background-depth-1/90 px-6",children:e.jsxs("div",{className:"w-full max-w-md rounded-3xl border border-bolt-elements-borderColor bg-bolt-elements-background-depth-2 p-6 text-left shadow-2xl",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-amber-500/10 text-amber-500",children:e.jsx("div",{className:"i-ph:lock-key-duotone text-2xl"})}),e.jsx("div",{className:"mt-4 text-lg font-semibold text-bolt-elements-textPrimary",children:Re.title}),e.jsx("div",{className:"mt-2 text-sm leading-relaxed text-bolt-elements-textSecondary",children:Re.description}),e.jsx("div",{className:"mt-4 rounded-2xl border border-bolt-elements-borderColor bg-bolt-elements-background-depth-1 px-4 py-3 text-xs leading-relaxed text-bolt-elements-textTertiary",children:"The sign-in flow will reopen automatically, and Genie will resend your saved prompt after you log in."})]})}),E&&!he&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{position:"absolute",top:"-25px",left:"50%",transform:"translateX(-50%)",background:"var(--bolt-elements-background-depth-3, rgba(0,0,0,0.7))",color:"var(--bolt-elements-textPrimary, white)",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",pointerEvents:"none",opacity:N.current.isResizing?1:0,transition:"opacity 0.3s"},children:[pe,"px"]}),e.jsx(Me,{side:"left"}),e.jsx(Me,{side:"right"})]})]})})]})};Be.displayName="Preview";
96const mr=r.memo(r.forwardRef(Be));export{mr as Preview};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.