PageSourceSearch

https://app.blackbox.ai/_next/static/chunks/8882-824b7c0dd5b5c410.js

js blackbox.ai collected 2026-09-24 08:40:57 UTC 50,943 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8882],{78882:function(e,n,t){t.r(n),t.d(n,{default:function(){return Header}});var i=t(19745),s=t(54705),l=t(70210),o=t(80833),a=t(20288),r=t(56831),c=t(74454),d=t(697),u=t(58471),h=t(3531);function NewChatMobileButton(e){var n,t,s,l,o,m,x,v,p,f,w,g,j,b,y;let{text:N="",showNewChatIcon:k=!0,className:S,...C}=e,{resetAllChats:_,allEmpty:z,stopAllActiveChats:I}=(0,d.a)(),{reset:E}=(0,u.p)(),F=new URL(window.location.href).pathname,{push:O}=(0,h.useRouter)();if("/tasks"===F||(null===(n=window.location.href)||void 0===n?void 0:n.includes("/room"))||(null===(t=window.location.href)||void 0===t?void 0:t.includes("/builder"))||(null===(s=window.location.href)||void 0===s?void 0:s.includes("/login"))||(null===(l=window.location.href)||void 0===l?void 0:l.includes("/signup"))||(null===(o=window.location.href)||void 0===o?void 0:o.includes("/pricing"))||(null===(m=window.location.href)||void 0===m?void 0:m.includes("/app-store"))||(null===(x=window.location.href)||void 0===x?void 0:x.includes("/artifacts"))||(null===(v=window.location.href)||void 0===v?void 0:v.includes("/features"))||(null===(p=window.location.href)||void 0===p?void 0:p.includes("/terms"))||(null===(f=window.location.href)||void 0===f?void 0:f.includes("/privacy"))||(null===(w=window.location.href)||void 0===w?void 0:w.includes("/dashboard"))||(null===(g=window.location.href)||void 0===g?void 0:g.includes("/manage")))return(0,i.jsx)(i.Fragment,{});let A=window.matchMedia("(max-width: 768px)").matches;if((null===(j=window.location.href)||void 0===j?void 0:j.includes("/screenshot"))&&!A)return(0,i.jsx)(i.Fragment,{});let D=(null===(b=window.location.href)||void 0===b?void 0:b.includes("/agent"))||(null===(y=window.location.href)||void 0===y?void 0:y.includes("/room"))?"Home":"New";return"/"===new URL(window.location.href).pathname&&z||"/chat"===F&&z?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(a.z,{onClick:e=>{var n;let t=new URLSearchParams(null===(n=window.location)||void 0===n?void 0:n.search),i=t.get("mobile"),s=t.get("chrome"),l=t.get("vscode");(()=>{let e=document.querySelector(".blackbox-chat-area");e&&(e.innerHTML=""),I()})();let o=(()=>{if(window.location.href.includes("/tasks/"))return"/tasks";if(window.location.href.includes("/screenshot")){var e;return"/screenshot".concat((null===(e=window.location.href)||void 0===e?void 0:e.includes("mobile=true"))?"?mobile=true":"")}if(i)return"/?mobile=true";if(s)return"/?chrome=true&frameurl=1";if(l)try{let e=window.location.href.match(/version=([^&]*)/),n=e?e[1]:null;return"/?vscode=true"+(n?"&version=".concat(n):"")}catch(e){return console.error(e),"/?vscode=true"}return window.location.href.includes("/editor")||window.location.href.includes(c._.id)?window.location.pathname+window.location.search:"/chat"===F?"/chat":"/"})();window.history.pushState(null,"",o),O(o),requestAnimationFrame(()=>{_(),setTimeout(()=>{E()},100)})},variant:"outline",className:"rounded-full h-10 w-10 p-2","aria-label":"New"===D?"New chat":"Home",children:(0,i.jsx)(r.Mw,{className:"w-5 h-5"})})}var m=t(5217),x=t(15856),v=t(51384),p=t(65249),f=t(40153);let w=(0,o.lazy)(()=>Promise.all([t.e(1743),t.e(6416)]).then(t.bind(t,6416))),g=(0,o.lazy)(()=>Promise.all([t.e(1743),t.e(140)]).then(t.bind(t,10140))),j=(0,o.lazy)(()=>Promise.all([t.e(1743),t.e(6416),t.e(9750)]).then(t.bind(t,39750))),b=(0,o.lazy)(()=>Promise.resolve().then(t.bind(t,24839)));function VscodeButton(e){var n,t,l,c;let{position:d="header",text:u="",showNewChatIcon:h=!0,session:y,currentAccount:N,className:k,...S}=e,C=(0,v.e)(),{state:_}=(0,s.useSidebar)(),z=window.location.href.includes("vscode=");if(window.location.href.includes("/screenshot")||(null===(n=window.location.href)||void 0===n?void 0:n.includes("/chat/"))||window.location.href.includes("room")||(null===(t=window.location.href)||void 0===t?void 0:t.includes("/app-store")))return(0,i.jsx)(i.Fragment,{});let[I,E]=(0,o.useState)(!1),[F,O]=(0,o.useState)(!1),[A,D]=(0,o.useState)(!1),[T,B]=(0,o.useState)(!1),[P,L]=(0,o.useState)(!1),[R,M]=(0,o.useState)("signup"),[V,U]=(0,o.useState)(!1),{checkSubscription:H,subscriptionCache:G}=(0,p.v)();return(0,o.useEffect)(()=>{let checkUserStatus=async()=>{var e;if(N&&(null==y?void 0:null===(e=y.user)||void 0===e?void 0:e.email))try{let e=await H(N,!1,N!==y.user.email,y.user.email),n="PREMIUM"===e.status&&!!(null==e?void 0:e.customerId);U(n)}catch(e){console.error("Error checking subscription:",e),U(!1)}};checkUserStatus()},[y,N,H]),(0,i.jsxs)(i.Fragment,{children:[z&&(0,i.jsx)(i.Fragment,{}),!z&&(0,i.jsx)(i.Fragment,{children:"header"===d?(0,i.jsxs)("div",{className:"relative w-full flex items-center",children:[(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(i.Fragment,{}),children:(0,i.jsx)(w,{showDialog:F,setShowDialog:O,sessionId:C})}),(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(i.Fragment,{}),children:(0,i.jsx)(j,{showDialog:I,setShowDialog:E})})}),!(null===(l=window.location.href)||void 0===l?void 0:l.includes("/pricing"))&&(0,i.jsxs)("div",{className:"ml-auto flex gap-2 items-center",children:[(0,i.jsx)(f.h_,{children:(0,i.jsx)(a.z,{variant:"ghost",className:"mobile-hide-item px-3 text-sm hover:bg-transparent",onClick:()=>{(0,x.X)("Other Engagement",C,{tag:"click-header-pricing-btn"}),window.location.href="https://www.blackbox.ai/pricing"},children:(0,i.jsx)("span",{className:"hidden md:flex text-ellipsis whitespace-nowrap overflow-hidden",children:"Pricing"})})}),"/chat"===window.location.pathname&&(0,i.jsx)(a.z,{variant:"ghost",className:"mobile-hide-item px-3 text-sm hover:bg-transparent",onClick:()=>{(0,x.X)("Other Engagement",C,{tag:"click-header-vscode-btn"}),window.open("https://marketplace.visualstudio.com/items?itemName=Blackboxapp.blackbox")},children:(0,i.jsx)("span",{className:"hidden md:flex text-ellipsis whitespace-nowrap overflow-hidden",children:"VSCode"})}),!(null==y?void 0:null===(c=y.user)||void 0===c?void 0:c.email)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.z,{variant:"ghost",className:"mobile-hide-item px-3 text-sm",onClick:()=>{(0,x.X)("Other Engagement",C,{tag:"click-header-signin",position:d}),window.location.href="/login"},children:(0,i.jsx)("span",{className:"hidden md:flex text-ellipsis whitespace-nowrap overflow-hidden",children:"Sign In"})}),(0,i.jsxs)(a.z,{onClick:()=>{(0,x.X)("Other Engagement",C,{tag:"click-header-get-started",position:d}),window.location.href="/signup"},className:"rounded-full h-10 px-4 py-2 gap-2 border border-input -mr-2 ".concat("/chat"!==window.location.pathname?"mobile-hide-item":""),children:[(0,i.jsx)("span",{className:"font-semibold md:hidden",children:"Sign Up"}),(0,i.jsx)("span",{className:"font-semibold hidden md:inline",children:"Get Started for Free"})]})]}),(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(i.Fragment,{}),children:(0,i.jsx)(b,{showLoginDialog:P,setShowLoginDialog:L,defaultPageMode:R})}),(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(i.Fragment,{}),children:(0,i.jsx)(g,{showDialog:T,setShowDialog:B,sessionId:C})})]})]}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.z,{onClick:()=>{(0,x.X)("Other Engagement",C,{tag:"vscode",position:d}),window.open(m.$f)},className:"h-10 w-full justify-start bg-zinc-50 px-4 shadow-none transition-colors hover:bg-zinc-200/40 dark:bg-zinc-900 dark:hover:bg-zinc-300/10 ".concat(h?"md:flex":"hidden md:flex"),variant:"outline",children:[(0,i.jsx)(r.DI,{className:"-translate-x-2 stroke-2"}),(0,i.jsx)("span",{className:"ml-2 md:flex",children:"VSCode2"})]})})}),(0,i.jsx)(w,{showDialog:A,setShowDialog:D,sessionId:C})]})}var y=t(20863),N=t(51268),k=t(2416);function recordPageVisit(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={tag:"web",...n},i=JSON.stringify({userId:e,eventName:"page visit",eventMetadata:t});try{if(navigator.sendBeacon){let n=new Blob([i],{type:"application/json"});navigator.sendBeacon("/api/tlm",n)||(0,x.X)("page visit",e,t)}else(0,x.X)("page visit",e,t)}catch(n){console.error("Error sending page visit event:",n),(0,x.X)("page visit",e,t)}}var S=t(34481),C=t(51893),_=t(48838);let z=(0,C.ZF)({apiKey:"AIzaSyDTxsBzN8HE4S4qX_xo_Bue07o3cBTdoSA",authDomain:"blackbox-6a4e3.firebaseapp.com",projectId:"blackbox-6a4e3",storageBucket:"blackbox-6a4e3.appspot.com",messagingSenderId:"90115057799",appId:"1:90115057799:web:3bd148181a0421988b3022",measurementId:"G-3EYV3XKBGK"});(0,_.ad)(z);let messaging=async()=>{let e=await (0,S.Gb)();return e?(0,S.KL)(z):null},fetchToken=async()=>{try{let e=await messaging();if(e){let n=await (0,S.LP)(e,{vapidKey:"BH0OulIf0ewxmCkM1aE2pv8kttheR46x8068h0jcadZjaBC3mTgCphA3bdPffWxrraQekTqv6zyC-PhsBT1fHVA"});return n}return null}catch(e){return console.error("An error occurred while fetching the token:",e),null}};var I=t(38216),E=t(49055),F=t(42730);async function getNotificationPermissionAndToken(){return"Notification"in window?"granted"===Notification.permission?await fetchToken():(console.info("Push notifications disabled - skipping permission prompt."),null):(console.info("This browser does not support desktop notification"),null)}var use_fcm_token=()=>{try{let e=(0,h.useRouter)(),[n,t]=(0,o.useState)("Notification"in window?Notification.permission:null),[i,s]=(0,o.useState)(null),[l,a]=(0,F.i)("fcm-token",null,{listen:!0}),r=(0,o.useRef)(0),c=(0,o.useRef)(!1),loadToken=async()=>
1{if(c.current)return null;c.current=!0;let e=await getNotificationPermissionAndToken();return"Notification"in window?"denied"===Notification.permission?(t("denied"),console.info("%cPush Notifications issue - permission denied","color: green; background: #c7c7c7; padding: 8px; font-size: 20px"),c.current=!1,null):e?(t("Notification"in window?Notification.permission:null),s(e),c.current=!1,e):r.current>=5?(console.log("Unable to load token, refresh the browser"),console.info("%cPush Notifications issue - unable to load token after 3 retries","color: green; background: #c7c7c7; padding: 8px; font-size: 20px"),c.current=!1,null):(r.current+=1,console.error("An error occurred while retrieving token. Retrying..."),c.current=!1,loadToken()):(t(null),c.current=!1,null)},d=(0,h.usePathname)();return(0,o.useEffect)(()=>{let setupListener=async()=>{if(!i)return;let n=await messaging();if(!n)return;let t=(0,S.ps)(n,n=>{var t,i,s,l,o,a;console.log("Foreground push notification received:",n);let r=(null===(t=n.fcmOptions)||void 0===t?void 0:t.link)||(null===(i=n.data)||void 0===i?void 0:i.link);new Audio("/bell.mp3").play(),r?I.Am.info("".concat(null===(s=n.notification)||void 0===s?void 0:s.title,": ").concat(null===(l=n.notification)||void 0===l?void 0:l.body),{closeButton:!0,duration:1e3,action:d!==r?{label:"Visit",onClick:()=>{e.push(r)}}:void 0}):I.Am.info("".concat(null===(o=n.notification)||void 0===o?void 0:o.title,": ").concat(null===(a=n.notification)||void 0===a?void 0:a.body),{closeButton:!0})});return t},n=null;return setupListener().then(e=>{e&&(n=e)}),()=>null==n?void 0:n()},[i,e,I.Am]),(0,o.useEffect)(()=>{"granted"!==n||i?i&&l!==i&&(0,E.NC)(i).then(async e=>{e&&a(i)}):loadToken()},[n,i]),{token:i,notificationPermissionStatus:n,loadToken}}catch(e){return console.error("Error setting up notification listener:",e),null}},O=t(38079);function ChromeNotificationDialog(){if(!window.location.href.includes("tag")||window.innerWidth<768)return(0,i.jsx)(i.Fragment,{});let[e,n]=(0,o.useState)(!1),[t,s]=(0,o.useState)(""),l=(0,h.useSearchParams)();return(0,o.useEffect)(()=>{let e=null==l?void 0:l.get("tag");if("chromenotification"===e){n(!0);let e="",t=null==l?void 0:l.get("content");t&&(e+=" ".concat(t,"\n\n"));let i=null==l?void 0:l.get("videoId");i&&(e+="[YouTube Video](https://www.youtube.com/watch?v=".concat(i,")\n\n")),s(e)}},[l]),(0,i.jsx)(N.Vq,{open:e,onOpenChange:n,children:(0,i.jsx)(N.cZ,{className:"ml-12 mr-12 max-w-[60vw] mx-auto h-[90vh] overflow-y-auto",children:(0,i.jsx)("div",{className:"fixed group w-full overflow-auto pl-0 animate-in duration-300 ease-in-out",style:{height:"-webkit-fill-available"},children:(0,i.jsx)("div",{className:"px-20% mx-auto",style:{width:"80%"},children:(0,i.jsx)(O.MemoizedReactMarkdown,{className:"px-6 mt-16 prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 fix-max-with-100",components:{a(e){let{children:n,href:t}=e;if(t.includes("youtube.com")){let e=t.split("v=")[1];return(0,i.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(e,"?controls=0"),width:"100%",height:"460",allowFullScreen:!0,style:{borderRadius:"10px"}})}return t.includes("type=button")&&t.includes("button-text")?(0,i.jsx)(a.z,{className:"block mx-auto py-0",onClick:()=>{window.open(t)},size:"lg",children:decodeURIComponent(null==t?void 0:t.split("button-text=")[1])}):(0,i.jsx)("a",{href:t,style:{cursor:"pointer",color:"rgb(50, 134, 255, 1)",textDecoration:"none"},children:n})},p(e){let{children:n}=e;return(0,i.jsx)("p",{className:"mb-2 last:mb-0",children:n})},h2(e){let{children:n,...t}=e,s=null==n?void 0:n.toString().toLowerCase().replace(/\s+/g,"-");return(0,i.jsx)("h2",{id:s,...t,children:n})},h3(e){let{children:n,...t}=e,s=null==n?void 0:n.toString().toLowerCase().replace(/\s+/g,"-");return(0,i.jsx)("h3",{id:s,...t,children:n})}},children:t})})})})})}function UpgradeVscodeAgent(e){let{upgradeVscodeConnect:n,setUpgradeVscodeConnect:t}=e;return window.location.href.includes("stripeRedirect")?(0,i.jsx)(N.Vq,{open:n,onOpenChange:t,children:(0,i.jsxs)(N.cZ,{className:"sm:max-w-[625px]",children:[(0,i.jsxs)(N.fK,{children:[(0,i.jsx)(N.$N,{children:"CLICK BELOW TO CONNECT TO VSCODE"}),(0,i.jsx)(N.Be,{children:(0,i.jsxs)(N.Be,{className:"mt-4",children:["You can link your pro account to vscode by clicking the button below.",(0,i.jsx)("div",{className:"flex justify-center py-4",children:(0,i.jsx)("div",{className:"w-full max-w-3xl aspect-video",children:(0,i.jsx)("iframe",{src:"https://www.youtube.com/embed/Vt_HWVHu2Ic",className:"w-full h-full rounded-xl shadow-lg",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})]})})]}),(0,i.jsx)(a.z,{size:"lg",onClick:()=>{let e="";window.location.href.includes("stripeRedirect")&&(e=decodeURIComponent(e=window.location.href.split("stripeRedirect=")[1]),window.open(e))},type:"submit",className:"w-full",children:"CLICK TO CONNECT TO VSCODE"})]})}):(0,i.jsx)(i.Fragment,{})}let getDeviceType=()=>{try{if(!window.navigator)return"unknown";let e=navigator.userAgent.toLowerCase(),n=/mobile|iphone|ipad|android|windows phone/i.test(e);return n?"mobile":"desktop"}catch(e){return console.error("Error detecting device type:",e),"unknown"}};function datesAreOnSameDay(e,n){let t=e.getFullYear()===n.getFullYear();if(!t)return!1;let i=e.getMonth()===n.getMonth();if(!i)return!1;let s=e.getDate()===n.getDate();return s}function isNextDay(e,n){let t=new Date(e.getTime());return t.setDate(t.getDate()+1),datesAreOnSameDay(n,t)}let A=[{label:"Personal",teams:[{label:"Personal",value:"personal"}]},{label:"Teams",teams:[]}];function Tracker(){var e,n;let t=(0,v.e)(),s=null,l=use_fcm_token();if(!l)return(0,i.jsx)(i.Fragment,{});({loadToken:s}=l);let[a,r]=(0,k._)("appOpens",[]),[c,d]=(0,o.useState)(!1),u=JSON.parse(JSON.stringify(A)),[h,m]=(0,k._)("groups",u),[x,p]=(0,k._)("is_beast_mode",!1),f=(0,o.useRef)(!1);(0,o.useEffect)(()=>{var e,n,i,l,o,r,c;if((null===(e=window.location.href)||void 0===e?void 0:e.includes("stripeRedirect"))&&d(!0),!f.current&&window.location.href&&!window.location.href.includes("vscode")){let e={tag:"web"},a="direct";(null===(n=document)||void 0===n?void 0:n.referrer)&&(a=null===(o=document)||void 0===o?void 0:o.referrer),e.referrer=a;try{let n=Intl.DateTimeFormat().resolvedOptions().timeZone;e.timezone=n||"unknown"}catch(n){console.error("Error detecting timezone:",n),e.time="unknown"}e.device=getDeviceType();let d=new URLSearchParams(null===(i=window.location)||void 0===i?void 0:i.search);d.get("tag")&&(null===(l=d.get("tag"))||void 0===l?void 0:l.length)<50&&(e.from=d.get("tag")),window.location.href.includes("mobile")&&(e.device="mobile"),recordPageVisit(t,e);try{if((null===(r=localStorage)||void 0===r?void 0:r.getItem("model-selection"))&&(null===(c=localStorage)||void 0===c||c.removeItem("model-selection")),window.innerWidth>768){let e=navigator.userAgent.includes("Edg"),n=navigator.userAgent.includes("Chrome"),t=-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome");!n||e||t||s()}}catch(e){console.error("Error:",e)}}f.current=!0;let h=new Date;if(0===a.length){m(u);return}let x=new Date(a.slice(-1)[0]),v=datesAreOnSameDay(h,x);if(v)return;let p=isNextDay(x,h);!p&&localStorage.getItem("is_beast_mode")&&localStorage.removeItem("is_beast_mode")},[a]);let[w,g]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{var e;if(null===(e=window.location.href)||void 0===e?void 0:e.includes("showPricing")){let e="true"===new URLSearchParams(window.location.search).get("showPricing");g(e)}},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ChromeNotificationDialog,{}),(null===(e=window.location.href)||void 0===e?void 0:e.includes("stripeRedirect"))&&(0,i.jsx)(UpgradeVscodeAgent,{upgradeVscodeConnect:c,setUpgradeVscodeConnect:d}),(null===(n=window.location.href)||void 0===n?void 0:n.includes("showPricing"))&&(0,i.jsx)(N.Vq,{open:w,onOpenChange:g,children:(0,i.jsx)(N.cZ,{className:"ml-12 mr-12 max-w-[60vw] mx-auto h-[90vh] overflow-y-auto",children:(0,i.jsx)(y.E,{setShowPricing:g})})})]})}var D=t(10185),T=t(76517);function InviteButton(e){let{position:n="header",text:t="",showNewChatIcon:s=!0,setSuccessfullEmailInviteSent:l,className:r,...c}=e;if(!window.location.href.includes("/screenshot"))return(0,i.jsx)(i.Fragment,{});(0,v.e)();
1let[d,u]=o.useState(""),[h,x]=o.useState(!1);return(0,i.jsxs)(i.Fragment,{children:[window.location.href.includes("screenshot/")&&(0,i.jsxs)(a.z,{className:"mobile-hide-item shadow-none border-none",variant:"outline",disabled:!window.location.href.includes("screenshot/"),onClick:()=>{let e="".concat(window.location.href,"?share=true");navigator.clipboard.writeText(e.toString()),window.open(e,"_blank"),T.toast.success("Share link copied to clipboard",{style:{borderRadius:"10px",background:"#333",color:"#fff",fontSize:"14px"},iconTheme:{primary:"white",secondary:"black"}})},children:[(0,i.jsx)(D.n9J,{className:"text-zinc-600 dark:text-white"}),(0,i.jsx)("span",{className:"text-zinc-600 dark:text-white ml-2 md:flex",children:"Publish"})]}),window.location.href.includes("screenshot/")&&(0,i.jsxs)(a.z,{className:"mobile-hide-item shadow-none border-none",variant:"outline",disabled:!window.location.href.includes("screenshot/"),onClick:()=>{navigator.clipboard.writeText("".concat(window.location.href).toString()),T.toast.success("Share link copied to clipboard",{style:{borderRadius:"10px",background:"#333",color:"#fff",fontSize:"14px"},iconTheme:{primary:"white",secondary:"black"}})},children:[(0,i.jsx)(D.eA8,{className:"text-zinc-600 dark:text-white"}),(0,i.jsx)("span",{className:(0,m.cn)("ml-2","hidden sm:flex","md:flex text-zinc-600 dark:text-white"),children:"Share"})]}),window.location.href.includes("screenshot")&&(0,i.jsxs)(a.z,{className:"mobile-hide-item shadow-none border-none",variant:"outline",onClick:()=>{window.location.href="/screenshot"},children:[(0,i.jsx)(D.pOD,{className:"text-zinc-600 dark:text-white"}),(0,i.jsx)("span",{className:"text-zinc-600 dark:text-white ml-2 md:flex",children:"New"})]})]})}var B=t(20457),P=t(66092);let login_button_getDeviceType=()=>{let e=window.navigator.userAgent.toLowerCase();return/android/.test(e)?"android":/iphone|ipad|ipod/.test(e)?"ios":"unknown"};function LoginButton(e){var n,t,s;let{text:l="Continue with Google",showGithubIcon:c=!0,className:d,...u}=e;if((null===(n=window.location.href)||void 0===n?void 0:n.includes("mobile"))||(null===(t=window.location.href)||void 0===t?void 0:t.includes("/chat/"))||(null===(s=window.location.href)||void 0===s?void 0:s.includes("/pricing")))return(0,i.jsx)(i.Fragment,{});let[f,w]=o.useState(!1),g=(0,v.e)(),j=(0,h.useRouter)(),b=(0,h.useSearchParams)(),{invalidateSubscriptionCache:y}=(0,p.v)(),cacheChatToLocalStorage=e=>{localStorage.setItem("clicked_join_new_room",e)};function verifyIfLoginFromRoomSharedLink(){if(window.location.href.includes("next=")&&window.location.href.includes("/chat/")){let e=window.location.href.split("/chat/")[1];cacheChatToLocalStorage(e)}}let N=b&&(null==b?void 0:b.get("mobile"))||"false",k=window.location.href.includes("frameurl="),S=window.location.href.includes("vscode="),C=(0,P.ac)({query:"(min-width: 768px)"}),[_,z]=o.useState("unknown"),[I,E]=o.useState(!1);return(o.useEffect(()=>{z(login_button_getDeviceType()),E((0,m.Np)())},[]),"unknown"!==_||I)?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(i.Fragment,{children:"true"!==N&&!k&&!S&&(0,i.jsxs)(a.z,{variant:C?"outline":"default",onClick:async()=>{if(window.innerWidth<550)return;try{localStorage.getItem("firstClickGmail")?localStorage.setItem("laterClickGmail","true"):localStorage.setItem("firstClickGmail","true")}catch(e){console.log(e)}w(!0),verifyIfLoginFromRoomSharedLink(),y();let e=await (0,B.zB)("google",{redirect:!1,callbackUrl:window.location.origin});(null==e?void 0:e.url)&&j.push(e.url),(0,x.X)("Other Engagement",g,{tag:"signup",position:"header"})},disabled:f,className:(0,m.cn)("text-ellipsis whitespace-nowrap overflow-hidden shadow-none",d),...u,children:[f?(0,i.jsx)(r.vM,{className:"mr-2 animate-spin"}):c?(0,i.jsx)(r.vY,{className:"mobile-hide-item mr-2"}):null,(0,i.jsx)("span",{className:"hidden sm:block md:flex",children:l}),(0,i.jsx)("span",{className:"sm:hidden",children:"Login"})]})})}var L=t(266),R=t(57644),M=t(25308),V=t(47258),U=t(50654),H=t(90925);let mobile_download_app_getDeviceType=()=>{let e=window.navigator.userAgent.toLowerCase();return/android/.test(e)?"android":/iphone|ipad|ipod/.test(e)?"ios":"unknown"};function DownloadAppButton(e){var n,t;let{session:s,isLoggedIn:l,isPremiumUser:d,...u}=e,h=(0,L.G)(),v=null!==h&&h<=L.a.sm;if(null===(n=window.location.href)||void 0===n?void 0:n.includes("/pricing"))return(0,i.jsx)(i.Fragment,{});let[f,w]=o.useState("unknown"),[g,j]=(0,o.useState)(!1),[b,y]=(0,o.useState)(!1),{checkSubscription:k,invalidateSubscriptionCache:S}=(0,p.v)(),{currentAccount:C,isCollaboratorMode:_}=(0,V.M)(),{openLoginDialog:z}=(0,H.O)(),[I,E]=(0,o.useState)(!1);(0,o.useEffect)(()=>{!async function(){var e,n,t,i;if((null==s?void 0:null===(e=s.user)||void 0===e?void 0:e.email)&&(null==s?void 0:null===(n=s.user)||void 0===n?void 0:n.email)){let e=await k(C||(null==s?void 0:null===(t=s.user)||void 0===t?void 0:t.email),!1,_,(null==s?void 0:null===(i=s.user)||void 0===i?void 0:i.email)||void 0);E("PREMIUM"===e.status)}}()},[null==s?void 0:null===(t=s.user)||void 0===t?void 0:t.email,k]);let cacheChatToLocalStorage=()=>{localStorage.setItem("clicked_app_builder_mobile","1")};function initiate_vscode(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";n&&e&&(0,U.Oq)().then(i=>{(null==i?void 0:i.url)&&(window.location.href="".concat(i.url,"&prompt=").concat(encodeURIComponent(e),"&customerId=").concat(n).concat(t))})}return(o.useEffect(()=>{w(mobile_download_app_getDeviceType())},[]),o.useEffect(()=>{(async function(){var e;if(!(null==s?void 0:s.user)||!localStorage.getItem("clicked_app_builder_mobile"))return;if(null===(e=window.location.href)||void 0===e?void 0:e.includes("clickedBackUpgrade")){localStorage.removeItem("clicked_app_builder_mobile");return}localStorage.removeItem("clicked_app_builder_mobile");let n=await k(C||(null==s?void 0:s.user.email),!1,_,(null==s?void 0:s.user.email)||void 0);if(E(!!("PREMIUM"===n.status&&(null==n?void 0:n.customerId))),I){initiate_vscode(" ","123","");return}!I&&(cacheChatToLocalStorage(),S(),(0,R.DP)("".concat(m.cV,"?source=app-builder")))})()},[s]),window.location.href.includes("/screenshot")||window.location.href.includes("room")||window.location.href.includes("vscode")||window.location.href.includes("/agent")||window.location.href.includes(c._.id)||"unknown"===f)?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(i.Fragment,{children:"/"===new URL(window.location.href).pathname&&(0,i.jsxs)(i.Fragment,{children:[I||!v||(null==s?void 0:s.isEnterprise)?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(a.z,{variant:"default",className:"rounded-full h-10 px-4 py-2",onClick:()=>
1{if((0,x.X)(m.uS.other,"",{tag:"mobile-upgrade-header"}),!(null==s?void 0:s.user)){window.location.href="/signup";return}(0,R.Mz)({source:"phone-home-tooltip"})},children:(0,i.jsx)("span",{className:"font-semibold whitespace-nowrap",children:(null==s?void 0:s.user)?"Upgrade":"Sign Up"})}),(0,i.jsx)(N.Vq,{open:g,onOpenChange:j,children:(0,i.jsxs)(N.cZ,{className:"sm:max-w-[625px]",children:[(0,i.jsxs)(N.fK,{children:[(0,i.jsx)(N.$N,{children:"AI App Builder"}),(0,i.jsx)(N.Be,{className:"mt-4",children:"Build complete apps with BLACKBOXAI Agents. The Front End agent lets you build the complete interface and functionality of your app. The Full-stack agent lets you build the complete app backend and front end."})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-md font-semibold leading-none tracking-tight",children:"Front End Agent"}),(0,i.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Best for building build fast interfaces by uploading an image or just text description."}),(0,i.jsx)(a.z,{onClick:()=>{(0,x.X)(m.uS.other,"",{tag:"click-frontend"}),window.location.href="/screenshot",j(!1)},type:"submit",variant:"outline",className:"mt-4 w-full ",children:"Open Front End Agent"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-md font-semibold leading-none tracking-tight",children:"Full-stack Agent"}),(0,i.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Best for building complete apps with a backend and frontend."}),(0,i.jsxs)(a.z,{onClick:async()=>{if((0,x.X)(m.uS.other,"",{tag:"click-backend"}),!(null==s?void 0:s.user)){(0,M.o)("Sign in required."),cacheChatToLocalStorage(),S(),(0,B.zB)("google");return}try{var e,n;let t=await k(C||(null==s?void 0:null===(e=s.user)||void 0===e?void 0:e.email),!1,_,(null==s?void 0:null===(n=s.user)||void 0===n?void 0:n.email)||void 0),i="PREMIUM"===t.status&&(null==t?void 0:t.customerId);if(!i){S(),(0,R.DP)("".concat(m.cV,"?source=mobile-builder"));return}y(!0),(0,U.Oq)().then(e=>{if(y(!1),null==e?void 0:e.url){let n=(null==t?void 0:t.customerId)?"&customerId=".concat(t.customerId):"";window.location.href="".concat(e.url,"&prompt=").concat(encodeURIComponent("")).concat(n)}})}catch(e){console.error("Error checking subscription:",e),(0,M.o)("Error checking subscription status");return}},type:"submit",variant:"outline",className:"mt-4 w-full ",children:[b&&(0,i.jsx)(r.tx,{}),(0,i.jsx)("span",{className:b?"ml-2":"",children:"Open Full Stack Agent"})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-md font-semibold leading-none tracking-tight",children:"History"}),(0,i.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Visualise your all full stack builder history."}),(0,i.jsx)(a.z,{onClick:()=>{(0,x.X)(m.uS.other,"",{tag:"click-history"}),window.open("/apps"),j(!1)},type:"submit",variant:"outline",className:"mt-4 w-full ",children:"Open Full Stack History"})]})]})})]})})}var G=t(86699),X=t(38265),edit_agent_button=()=>{var e;let n=(0,G.E)(),t=(0,v.e)(),s=(0,h.useParams)(),l=null==s?void 0:s.id,[r,c]=(0,o.useState)(!1),handleEditClick=async()=>{if(c(!0),(0,x.X)("Chat Request",t,{tag:"click edit agent",position:"sidenav"}),l===n.agentId){n.setOpenMode("edit"),c(!1),n.setCreateAgentOpen(!0);return}try{let e=await fetch("/api/getagent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l})}),t=await e.json();n.setAgentId(t.id),n.setAgentName(t.name),n.setProfilePrompt(t.imagePrompt||""),n.setInstructions(t.rawUserSysPrompt||t.sysprompt),n.setBehaviorImg(t.cover||"/chatbot-avatar.png"),n.setWebSearch(t.webSearch||!1),n.setPublishPreference(!1!==t.publishPreference),n.setInputFiles(t.inputFiles||[]),n.setDemonstrations(t.demonstrations||[]),n.setOpenMode("edit"),n.setCreateAgentOpen(!0)}catch(e){console.error("Error fetching agent:",e)}finally{c(!1)}};return(null===(e=window.location.href)||void 0===e?void 0:e.includes("/agent/"))?(0,i.jsxs)(a.z,{id:"edit-agent-header-button",onClick:handleEditClick,className:"justify-start px-4 transition-colors shadow-none",variant:"outline",disabled:r,children:[r?(0,i.jsx)(X.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,i.jsx)(D.oqE,{className:"mr-2 h-4 w-4"}),(0,i.jsx)("span",{className:"text-sm text-zinc-600 !text-left dark:text-white hidden sm:block md:flex text-ellipsis whitespace-nowrap overflow-hidden",children:"Edit Agent"}),(0,i.jsx)("span",{className:"sm:hidden -m-3",children:"Edit"})]}):null};function ShareHeaderButton(e){var n,t,s;let{position:l="header",text:o="",showNewChatIcon:r=!0,className:c,...u}=e,h=(0,v.e)(),{chatObject:m,chats:p}=(0,d.a)();if(window.location.href.includes("/screenshot")||window.location.href.includes("room"))return(0,i.jsx)(i.Fragment,{});let f=null==p?void 0:p[0],w="/"===window.location.pathname,g=null===(n=window.location.href)||void 0===n?void 0:n.includes("/chat/"),j="/chat"===window.location.pathname;return(g||j||w&&f&&(null==m?void 0:null===(t=m[f])||void 0===t?void 0:t.hasMessages))&&(!j&&!w||f&&(null==m?void 0:null===(s=m[f])||void 0===s?void 0:s.hasMessages))?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.z,{className:"rounded-full h-10 px-4 py-2 gap-2",variant:"default",onClick:()=>{(0,x.X)("Other Engagement",h,{tag:"clicked-share-header"});let e=document.getElementById("click-share-chat");e?null==e||e.click():I.Am.info("Link is being generated. Try again shortly")}
1,children:[(0,i.jsx)(D.rG2,{className:"w-5 h-5"}),(0,i.jsx)("span",{className:"font-semibold",children:"Share"})]})}):(0,i.jsx)(i.Fragment,{})}var q=t(72532),Z=t(11108),share_rec_session_header=()=>{let e=window.location.href;if(!e.includes("/recorded-sessions"))return(0,i.jsx)(i.Fragment,{});let[n,t]=(0,o.useState)(""),{isCopied:s,copyToClipboard:l}=(0,q.m)({timeout:2e3});return(0,o.useEffect)(()=>{let n=e.split("/recorded-sessions/")[1],i="".concat(window.location.origin,"/recorded-sessions/").concat(n);t(i)},[e]),(0,i.jsxs)(a.z,{onClick:()=>{l(n),I.Am.success("Video link has been copied to clipboard")},className:"flex items-center gap-2",children:[s?(0,i.jsx)(r.NO,{}):(0,i.jsx)(Z.Z,{className:"w-4 h-4"}),s?"Copied!":"Share"]})},K=t(7203),W=t(18993),Y=t(23117),J=t(69171),$=t(74193),Q=t(2837),ee=t(11141),en=t(95203),et=t(32475),environment_setup=()=>{let{createEnv:e,setView:n,isLoading:t}=(0,K.m)(),{subscriptionCache:s}=(0,p.v)(),[l,c]=(0,o.useState)(null),[d,u]=(0,o.useState)({organization:"",repository:"",name:"",description:"",setupScript:"",variables:{},secrets:{}}),[h,m]=(0,o.useState)({key:"",value:""}),[x,v]=(0,o.useState)({key:"",value:""}),{isAuthenticated:f,repositories:w,selectedRepo:g,handleGitHubSignIn:j,initializeAuth:b,selectRepository:y,disconnect:N}=(0,$.w)(),[k,S]=(0,o.useState)(!0),[C,_]=(0,o.useState)(""),[z,E]=(0,o.useState)(""),[F,O]=(0,o.useState)("private");(0,o.useEffect)(()=>{let checkAuth=async()=>{try{await b()}catch(e){console.error("Failed to initialize GitHub auth:",e),I.Am.error("Failed to connect to GitHub. Please try again.")}finally{S(!1)}};checkAuth()},[b]);let A=Array.from(new Set(w.map(e=>e.full_name.split("/")[0]))).sort();(0,o.useEffect)(()=>{if("private"===F&&g){let[e,n]=g.split("/");u(t=>({...t,organization:e,repository:n})),E(e)}},[g,F]);let D=w.filter(e=>{let[n,t]=e.full_name.split("/"),i=e.full_name.toLowerCase().includes(C.toLowerCase());return(!z||n===z)&&i}),handleOrgSelect=e=>{E(e),_(""),g&&!g.startsWith(e+"/")&&y("")},handleSubmit=async t=>{if(t.preventDefault(),c(null),!(null==s?void 0:s.customerId)){c("No customer ID found");return}if("private"===F&&!f){c("Please connect to GitHub first");return}try{let t={...d};h.key&&h.value&&(t.variables={...t.variables,[h.key]:h.value}),x.key&&x.value&&(t.secrets={...t.secrets,[x.key]:x.value}),await e(s.customerId,t),I.Am.success("Environment created successfully"),u({organization:"",repository:"",name:"",description:"",setupScript:"",variables:{},secrets:{}}),m({key:"",value:""}),v({key:"",value:""}),n("list")}catch(e){c(e instanceof Error?e.message:"Failed to create environment")}},handleGitHubConnect=async()=>{try{f||j()}catch(e){console.error("GitHub sign in error:",e),I.Am.error("Failed to connect to GitHub. Please try again.")}};return(0,i.jsx)("div",{className:"flex flex-col h-full max-h-full overflow-hidden",children:(0,i.jsxs)("form",{onSubmit:handleSubmit,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[(0,i.jsx)(et.x,{className:"flex-1 overflow-auto",children:(0,i.jsxs)("div",{className:"p-6 space-y-6",children:[(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)("h3",{className:"text-lg font-semibold",children:"Connect to GitHub"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(a.z,{type:"button",variant:"private"===F?"secondary":"outline",onClick:()=>O("private"),children:"Private"}),(0,i.jsx)(a.z,{type:"button",variant:"public"===F?"secondary":"outline",onClick:()=>O("public"),children:"Public"})]}),"public"===F&&(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{htmlFor:"repo-url",children:"Public Repository URL"}),(0,i.jsx)(W.I,{id:"repo-url",placeholder:"https://github.com/user/repo",value:d.repository,onChange:e=>{let n=e.target.value,t=n.split("/"),i=t.pop()||"",s=t.pop()||"";u(e=>({...e,repository:n,organization:s,name:i}))}})]}),"private"===F&&(0,i.jsx)(i.Fragment,{children:k?(0,i.jsx)("div",{className:"flex items-center justify-center h-24",children:(0,i.jsx)(r.tx,{})}):f?(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connected to GitHub."}),(0,i.jsx)(a.z,{variant:"outline",size:"sm",onClick:N,children:"Disconnect"})]}),(0,i.jsxs)("div",{className:"grid grid-cols-[120px_1fr] gap-4",children:[(0,i.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,i.jsx)(Y._,{children:"Organization"}),(0,i.jsx)(et.x,{className:"h-64 border rounded-md",children:(0,i.jsxs)("div",{className:"p-2 space-y-1",children:[(0,i.jsx)(a.z,{variant:z?"ghost":"secondary",className:"w-full justify-start text-left overflow-hidden",onClick:()=>handleOrgSelect(""),type:"button",children:(0,i.jsx)("span",{className:"truncate block",children:"All"})}),A.map(e=>(0,i.jsx)(a.z,{variant:z===e?"secondary":"ghost",className:"w-full justify-start text-left overflow-hidden",onClick:()=>handleOrgSelect(e),type:"button",children:(0,i.jsx)("span",{className:"truncate block",children:e})},e))]})})]}),(0,i.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,i.jsx)(Y._,{children:"Repository"}),(0,i.jsx)(W.I,{placeholder:"Search repositories...",value:C,onChange:e=>_(e.target.value),className:"mb-2"}),(0,i.jsx)(et.x,{className:"h-[232px] border rounded-md",children:(0,i.jsx)("div",{className:"p-2 space-y-1",children:D.map(e=>(0,i.jsx)(a.z,{variant:g===e.full_name?"secondary":"ghost",className:"w-full justify-start text-left overflow-hidden",onClick:()=>y(e.full_name),type:"button",children:(0,i.jsx)("span",{className:"truncate block",children:e.full_name})},e.id))})})]})]})]}):(0,i.jsxs)(a.z,{onClick:handleGitHubConnect,className:"w-full",children:[(0,i.jsx)(Q.Z,{className:"w-4 h-4 mr-2"}),"Connect to GitHub"]})})]}),(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)("h3",{className:"text-lg font-semibold",children:"Configure Environment"}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{htmlFor:"name",children:"Environment Name"}),(0,i.jsx)(W.I,{id:"name",placeholder:"e.g., My Production Server",value:d.name,onChange:e=>u({...d,name:e.target.value}),required:!0})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{htmlFor:"description",children:"Description"}),(0,i.jsx)(J.g,{id:"description",placeholder:"A brief description of the environment",value:d.description,onChange:e=>u({...d,description:e.target.value})})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{htmlFor:"setup-script",children:"Setup Script"}),(0,i.jsx)(J.g,{id:"setup-script",placeholder:"e.g., npm install && npm run build",value:d.setupScript,onChange:e=>u({...d,setupScript:e.target.value}),className:"font-mono"})]})]})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{children:"Environment Variables"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:"These variables will be available in your tasks."}),(0,i.jsxs)("div",{className:"space-y-2",children:[Object.entries(d.variables||{}).map(e=>{let[n,t]=e;return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(W.I,{value:n,disabled:!0,className:"flex-1"}),(0,i.jsx)(W.I,{value:t,disabled:!0,className:"flex-1"}),(0,i.jsx)(a.z,{type:"button",variant:"ghost",size:"icon",onClick:()=>{let e={...d.variables};delete e[n],u({...d,variables:e})},children:(0,i.jsx)(ee.Z,{className:"h-4 w-4"})})]},n)}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(W.I,{placeholder:"Variable name",value:h.key,onChange:e=>m({...h,key:e.target.value}),className:"flex-1"}),(0,i.jsx)(W.I,{placeholder:"Value",value:h.value,onChange:e=>m({...h,value:e.target.value}),className:"flex-1"}),(0,i.jsx)(a.z,{type:"button",variant:"outline",size:"icon",onClick:()=>{h.key&&h.value&&(u({...d,variables:{...d.variables,[h.key]:h.value}}),m({key:"",value:""}))},disabled:!h.key||!h.value,children:(0,i.jsx)(en.Z,{className:"h-4 w-4"})})]})]})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(Y._,{children:"Secrets"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:"Secrets are encrypted and stored securely. They will be available as environment variables in your tasks."}),(0,i.jsxs)("div",{className:"space-y-2",children:[Object.entries(d.secrets||{}).map(e=>{let[n,t]=e;return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(W.I,{value:n,disabled:!0,className:"flex-1"}),(0,i.jsx)(W.I,{value:"••••••••",disabled:!0,className:"flex-1",type:"password"}),(0,i.jsx)(a.z,{type:"button",variant:"ghost",size:"icon",onClick:()=>{let e={...d.secrets};delete e[n],u({...d,secrets:e})},children:(0,i.jsx)(ee.Z,{className:"h-4 w-4"})})]},n)}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(W.I,{placeholder:"Secret name",value:x.key,onChange:e=>v({...x,key:e.target.value}),className:"flex-1"}),(0,i.jsx)(W.I,{placeholder:"Secret value",type:"password",value:x.value,onChange:e=>v({...x,value:e.target.value}),className:"flex-1"}),(0,i.jsx)(a.z,{type:"button",variant:"outline",size:"icon",onClick:()=>{x.key&&x.value&&(u({...d,secrets:{...d.secrets,[x.key]:x.value}}),v({key:"",value:""}))},disabled:!x.key||!x.value,children:(0,i.jsx)(en.Z,{className:"h-4 w-4"})})]})]})]})]})}),(0,i.jsxs)("div",{className:"flex-shrink-0 flex justify-end space-x-2 pt-4 border-t",children:[(0,i.jsx)(a.z,{variant:"outline",type:"button",onClick:()=>n("list"),children:"Cancel"}),(0,i.jsx)(a.z,{type:"submit",disabled:t||"private"===F&&!f,children:t?(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(r.tx,{}),(0,i.jsx)("span",{children:"Creating..."})]}):"Create Environment"})]})]})})},environment_detail=e=>{let{selectedEnvironment:n,onDelete:t,onBack:s}=e;return(0,i.jsxs)("div",{className:"p-4 space-y-4",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:n.name}),(0,i.jsx)("div",{className:"space-x-2",children:(0,i.jsx)(a.z,{variant:"outline",onClick:s,children:"Back"})})]}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Creator"}),(0,i.jsx)("p",{children:n.creator})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Image"}),(0,i.jsx)("p",{children:n.image||"universal"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Description"}),(0,i.jsx)("p",{children:n.description||"-"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Agent internet access"}),(0,i.jsx)("p",{children:n.agentInternetAccess?"On":"Off"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Environment variables"}),(0,i.jsx)("p",{children:n.variables?Object.keys(n.variables).length:0})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Secrets"}),(0,i.jsx)("p",{children:n.secrets?Object.keys(n.secrets).length:0})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Created at"}),(0,i.jsx)("p",{children:new Date(n.createdAt).toLocaleDateString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Setup script"}),(0,i.jsx)("p",{children:n.setupScript||"-"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"Repository"}),(0,i.jsxs)("p",{children:[n.organization,"/",n.repository]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-semibold",children:"No. of tasks"}),(0,i.jsx)("p",{children:n.numberOfTasks})]})]}),(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)(a.z,{variant:"destructive",onClick:t,children:"Delete Environment"})})]})},environment_list=e=>{let{environments:n,isLoading:t,onEnvironmentClick:s}=e;return t?(0,i.jsxs)("div",{className:"flex flex-col justify-center items-center min-h-[40vh] my-auto text-center text-muted-foreground",children:[(0,i.jsx)(r.vM,{className:"w-6 h-6"}),(0,i.jsx)("p",{className:"mt-2",children:"Fetching environments ..."})]}):0===n.length?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[40vh] text-center text-muted-foreground",children:[(0,i.jsx)("p",{className:"font-semibold text-lg",children:"No environments"}),(0,i.jsx)("p",{children:"Create an environment for Blackbox to work in"})]}):(0,i.jsxs)("div",{className:"flex flex-col h-full min-h-[40vh]",children:[(0,i.jsxs)("div",{className:"relative flex items-center select-none rounded-sm py-2 text-xs font-semibold text-muted-foreground border-b px-2 grid grid-cols-[auto_1fr_1fr_1fr_1fr_1fr] gap-4",children:[(0,i.jsx)("div",{}),(0,i.jsx)("div",{children:"Name / Repo"}),(0,i.jsx)("div",{children:"Description"}),(0,i.jsx)("div",{children:"Tasks"}),(0,i.jsx)("div",{children:"Created"}),(0,i.jsx)("div",{children:"Organization"})]}),(0,i.jsx)(et.x,{className:"flex-1",children:(0,i.jsx)("div",{className:"space-y-0",children:n.map(e=>(0,i.jsxs)("div",{onClick:()=>s(e),className:"relative flex items-center cursor-pointer select-none rounded-sm py-3 text-sm hover:bg-accent px-2 border-b",children:[(0,i.jsx)("span",{className:"relative flex h-10 shrink-0 overflow-hidden rounded-full items-center",children:(0,i.jsx)(r.Sr,{})}
1),(0,i.jsxs)("div",{className:"ml-2 flex-1 grid grid-cols-5 gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-medium",children:e.name}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:e.repository})]}),(0,i.jsx)("div",{children:(0,i.jsx)("p",{className:"truncate",children:e.description||"-"})}),(0,i.jsx)("div",{children:(0,i.jsx)("p",{children:e.numberOfTasks})}),(0,i.jsx)("div",{children:(0,i.jsx)("p",{children:new Date(e.createdAt).toLocaleDateString()})}),(0,i.jsx)("div",{children:(0,i.jsx)("p",{children:e.organization||"-"})})]})]},e.id))})})]})},ei=t(70278),remote_environments=()=>{let{isDialogOpen:e,setDialogOpen:n,environments:t,view:s,setView:l,searchQuery:r,setSearchQuery:c,selectedEnvironment:d,setSelectedEnvironment:u,isLoading:h,fetchEnvironments:x,deleteEnv:v}=(0,K.m)(),{subscriptionCache:f}=(0,p.v)(),[w,g]=(0,o.useState)(r);(0,o.useEffect)(()=>{e&&(null==f?void 0:f.customerId)&&x(f.customerId)},[e,x,null==f?void 0:f.customerId]),(0,o.useEffect)(()=>{let e=setTimeout(()=>{c(w)},300);return()=>clearTimeout(e)},[w,c]);let j=t.filter(e=>{let n=r.toLowerCase();return e.name.toLowerCase().includes(n)||e.repository.toLowerCase().includes(n)||e.organization&&e.organization.toLowerCase().includes(n)}),handleDelete=async()=>{if(d&&(null==f?void 0:f.customerId))try{await v(f.customerId,d.id),u(null),l("list")}catch(e){console.error("Failed to delete environment:",e)}};return(0,i.jsx)(N.Vq,{open:e,onOpenChange:n,children:(0,i.jsx)(N.cZ,{className:(0,m.cn)("max-w-[80vw] max-h-[90vh] grid-rows-[1fr] overflow-hidden"),children:(0,i.jsxs)("div",{className:"flex flex-col h-full gap-4 overflow-hidden",children:[(0,i.jsx)(N.fK,{className:"flex-shrink-0",children:(0,i.jsxs)(N.$N,{children:["list"===s&&"Environments","create"===s&&"Create Environment","detail"===s&&"Environment Details"]})}),"list"===s&&(0,i.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between border-b flex-shrink-0 pb-2",children:[(0,i.jsxs)("div",{className:"flex items-center flex-1",children:[(0,i.jsx)(ei.Z,{className:"w-4 h-4 mr-2 opacity-50"}),(0,i.jsx)("input",{onChange:e=>g(e.target.value),className:"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground",placeholder:"Search environments...",value:w})]}),(0,i.jsx)(a.z,{onClick:()=>l("create"),className:"ml-4",children:"Create Environment"})]}),(0,i.jsx)("div",{className:"flex-1 min-h-0 mt-4",children:(0,i.jsx)(environment_list,{environments:j,isLoading:h,onEnvironmentClick:e=>{u(e),l("detail")}})})]}),"create"===s&&(0,i.jsx)(environment_setup,{}),"detail"===s&&d&&(0,i.jsx)(environment_detail,{selectedEnvironment:d,onDelete:handleDelete,onBack:()=>l("list")})]})})})};function RemoteEnvSetupButton(){let{setDialogOpen:e}=(0,K.m)(),{subscriptionCache:n}=(0,p.v)();return(null==n?void 0:n.customerId)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.z,{onClick:()=>e(!0),className:"h-8 px-4 mr-2 mobile-hide-item",variant:"outline",children:(0,i.jsx)("span",{className:"md:flex text-ellipsis whitespace-nowrap overflow-hidden text-sm text-zinc-600 !text-left dark:text-white",children:"Environments"})}),(0,i.jsx)(remote_environments,{})]}):(0,i.jsx)(i.Fragment,{})}var es=t(47509),el=t(30297);function HeaderNavButtons(){var e,n,t,a,r,c,u,m;let x=(0,L.G)(),{data:v,status:f}=(0,B.kP)(),[w,g]=(0,o.useState)(!0),j=(0,h.usePathname)(),[b,y]=(0,o.useState)(""),{allEmpty:N}=(0,d.a)(),{currentAccount:k,isCollaboratorMode:S}=(0,V.M)(),{state:C}=(0,s.useSidebar)(),{subscriptionCache:_,checkSubscription:z}=(0,p.v)(),[I,E]=(0,o.useState)((null==_?void 0:_.previouslySubscribed)&&!!(null==_?void 0:_.customerId));(0,o.useEffect)(()=>{"loading"!==f&&g(!1)},[f]),(0,o.useEffect)(()=>{var e;y(null===(e=window.location)||void 0===e?void 0:e.pathname);let handleUrlChange=()=>{var e;y(null===(e=window.location)||void 0===e?void 0:e.pathname)};window.addEventListener("popstate",handleUrlChange);let n=window.history.pushState;return window.history.pushState=function(){n.apply(this,arguments),handleUrlChange()},()=>{window.removeEventListener("popstate",handleUrlChange),window.history.pushState=n}},[j]);let F=!!("authenticated"===f&&v.user),O=(0,o.useMemo)(()=>!N&&x&&x<=L.a.sm&&!(null==b?void 0:b.includes("/chat/"))&&!F,[x,F,b,N]),A="/connect-vscode"===b;return(0,o.useEffect)(()=>{let e=!1,determineCreditsVisibility=async()=>{var n;if(!F||!(null==v?void 0:null===(n=v.user)||void 0===n?void 0:n.email)){e||E(!1);return}let t=k||v.user.email;if(!t){e||E(!1);return}if((null==_?void 0:_.previouslySubscribed)&&_.customerId){e||E(!0);return}try{let n=await z(t,!1,!!S,v.user.email);if(!e){let e=!!n.previouslySubscribed&&!!n.customerId;E(e)}}catch(n){e||E(!1)}};return determineCreditsVisibility(),()=>{e=!0}},[F,null==v?void 0:null===(e=v.user)||void 0===e?void 0:e.email,k,S,null==_?void 0:_.status,null==_?void 0:_.customerId,null==_?void 0:_.previouslySubscribed]),(0,i.jsxs)("div",{className:"flex items-center space-x-2 transition-all duration-200 justify-end -mr-1 ".concat("expanded"===C?"mr-2":"mr-0"," ").concat(""),children:[(0,i.jsx)(Tracker,{}),!w&&(0,i.jsxs)(i.Fragment,{children:["/"===b&&N&&(0,i.jsx)(i.Fragment,{}),(0,i.jsx)(InviteButton,{position:"header"}),O?(0,i.jsxs)(i.Fragment,{children:[((null===(n=window.location.href)||void 0===n?void 0:n.includes("/agent"))||(null===(t=window.location.href)||void 0===t?void 0:t.includes("/screenshot")))&&!A&&(0,i.jsx)(NewChatMobileButton,{}),(0,i.jsx)(LoginButton,{text:"Login"})]}):!A&&!(null===(a=window.location.href)||void 0===a?void 0:a.includes("/playground"))&&(0,i.jsx)(NewChatMobileButton,{}),"/tasks"===b&&(null==v?void 0:v.user)&&(0,i.jsx)(RemoteEnvSetupButton,{}),(null===(r=window.location.href)||void 0===r?void 0:r.includes("/agent/"))&&!((null===(c=window.location.href)||void 0===c?void 0:c.includes("/new"))||(null===(u=window.location.href)||void 0===u?void 0:u.includes("/edit")))&&(0,i.jsx)(edit_agent_button,{}),("/"===b||"/chat"===b)&&N&&(0,i.jsx)(VscodeButton,{session:v,currentAccount:k}),(0,i.jsx)(DownloadAppButton,{session:v}),(0,i.jsx)(ShareHeaderButton,{}),(0,i.jsx)(share_rec_session_header,{}),!F||(null===(m=window.location.href)||void 0===m?void 0:m.includes("/pricing"))?(0,i.jsx)(i.Fragment,{}):x>L.a.sm?(0,i.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:[I&&(0,i.jsx)(es.j,{user:v.user}),!I&&!v.isEnterprise&&(0,i.jsx)(el.Y,{user:v.user}),(0,i.jsx)(l.I,{user:v.user})]}):(0,i.jsx)(i.Fragment,{})]})]})}var eo=t(9183),ea=t.n(eo);function Header(e){let{showLogo:n=!1,useContainer:t=!1}=e;return t?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("header",{className:(0,m.cn)("ml-0 top-0 flex items-center justify-between w-full h-16 px-6 md:px-10 shrink-0 from-background/10 via-background/50 transition-all duration-200 sticky z-50"),children:(0,i.jsxs)("div",{className:"container mx-auto flex items-center justify-between w-full h-full",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(s.SidebarTrigger,{className:"md:hidden flex size-4 mr-2"}),n&&(0,i.jsx)(ea(),{src:"/logo-white.svg",alt:"Blackbox AI Logo",width:100,height:24,className:"h-6 w-auto",priority:!0})]}),(0,i.jsx)(HeaderNavButtons,{})]})})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("header",{className:(0,m.cn)("ml-0 top-0 flex items-center justify-between w-full h-16 px-4 shrink-0 from-background/10 via-background/50 transition-all duration-200 sticky z-50 bg-background"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(s.SidebarTrigger,{className:"md:hidden flex size-4 mr-2"}),n&&(0,i.jsx)(ea(),{src:"/logo-white.svg",alt:"Blackbox AI Logo",width:100,height:24,className:"h-6 w-auto",priority:!0})]}),(0,i.jsx)(HeaderNavButtons,{})]})})}}}]);

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.