@soba-so/react 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +6 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client"
2
- var wr={ready:{arc:!0},serving:{arc:!0,slot:"stream"},paused:{arc:!1,slot:"zzz"},thinking:{arc:!1,slot:"dots"},connecting:{arc:!1,slot:"orbit"},attention:{arc:!1,slot:"bang"},gone:{arc:!1,slot:"cross"},snap:{arc:!1,slot:"snap"},listening:{arc:!1,slot:"bars"},permission:{arc:!1,slot:"ring"},ai:{arc:!1,slot:"sparks"}};var vr="105 162 420 420",kr="M407.1 308.9 A158 158 0 1 0 407.1 491.1 A116 116 0 0 1 407.1 308.9 Z",Pn="M448.5 320 A110 110 0 0 1 448.5 480";import{Fragment as mt,jsx as F,jsxs as fn}from"react/jsx-runtime";function mn({kind:e,size:n=44,className:t}){let r=wr[e];return fn("svg",{className:`bx${t?` ${t}`:""}`,"data-expression":e,viewBox:vr,overflow:"visible",width:n,height:n,"aria-hidden":"true",children:[F("path",{d:kr,fill:"currentColor"}),F("path",{className:"bx-arc",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),r.slot==="stream"&&F(Ma,{}),r.slot==="zzz"&&F(Na,{}),r.slot==="dots"&&F(xa,{}),r.slot==="bang"&&F(Sa,{}),r.slot==="orbit"&&F(Ra,{}),r.slot==="cross"&&F(Pa,{}),r.slot==="snap"&&F(Ea,{}),r.slot==="bars"&&F(Ia,{}),r.slot==="ring"&&F(La,{}),r.slot==="sparks"&&F(Oa,{})]})}function Ma(){return F("path",{className:"bx-st",d:"M475.3 290.3 A150 150 0 0 1 475.3 509.7",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"0.1 31"})}function Na(){return fn(mt,{children:[F("g",{className:"bx-z1",children:F("path",{d:"M444 372 H496 L444 436 H496",fill:"none",stroke:"currentColor",strokeWidth:"20",strokeLinecap:"round",strokeLinejoin:"round"})}),F("g",{className:"bx-z2",children:F("path",{d:"M492 300 H522 L492 338 H522",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function xa(){return fn(mt,{children:[F("circle",{className:"bx-th",cx:"463.1",cy:"336.9",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th2",cx:"483",cy:"400",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th3",cx:"463.1",cy:"463.1",r:"21",fill:"currentColor"})]})}function Sa(){return fn("g",{className:"bx-at",children:[F("line",{x1:"490",y1:"312",x2:"490",y2:"414",stroke:"currentColor",strokeWidth:"46",strokeLinecap:"round"}),F("circle",{cx:"490",cy:"484",r:"28",fill:"currentColor"})]})}function Ra(){return fn("g",{className:"bx-ob",children:[F("path",{d:Pn,fill:"none",stroke:"var(--tile-bg, transparent)",strokeWidth:41,strokeLinecap:"round"}),F("path",{d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})]})}function Pa(){return fn(mt,{children:[F("path",{className:"bx-xa",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),F("g",{className:"bx-xx",children:F("path",{d:"M442 364 L514 436 M514 364 L442 436",fill:"none",stroke:"currentColor",strokeWidth:"24",strokeLinecap:"round"})})]})}function Ea(){return F("path",{className:"bx-snap",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})}function Ia(){return fn("g",{stroke:"currentColor",strokeWidth:"17",strokeLinecap:"round",children:[F("line",{className:"bx-vb",x1:"452",y1:"370",x2:"452",y2:"430"}),F("line",{className:"bx-vb bx-vb2",x1:"482",y1:"330",x2:"482",y2:"470"}),F("line",{className:"bx-vb bx-vb3",x1:"512",y1:"355",x2:"512",y2:"445"})]})}function La(){return F(mt,{children:[[450,366],[474,376],[484,400],[474,424],[450,434],[426,424],[416,400],[426,376]].map(([n,t],r)=>F("circle",{className:"bx-w",cx:n,cy:t,r:"11",fill:"currentColor",style:{animationDelay:`${-1.2+r*.15}s`}},r))})}function Oa(){return fn(mt,{children:[F("g",{className:"bx-sp",children:F("path",{d:"M460 300 Q465.4 324.6 490 330 Q465.4 335.4 460 360 Q454.6 335.4 430 330 Q454.6 324.6 460 300 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp2",children:F("path",{d:"M486 356 Q493.92 392.08 530 400 Q493.92 407.92 486 444 Q478.08 407.92 442 400 Q478.08 392.08 486 356 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp3",children:F("path",{d:"M460 440 Q465.4 464.6 490 470 Q465.4 475.4 460 500 Q454.6 475.4 430 470 Q454.6 464.6 460 440 Z",fill:"currentColor"})})]})}var is={"claude-code":{small:"haiku",large:"opus"}};function ls(e){return e==="small"||e==="large"}function cs(e,n){return is[e]?.[n]}function Zt(e){let n=is[e];return!!(n?.small||n?.large)}var nu=512*1024;import{useEffect as ks,useRef as ui,useState as $n}from"react";var Zn=class extends Error{status;constructor(n,t){super(n),this.name="ConnectError",this.status=t}},Ta=5*6e4,ft=class{session;baseUrl;doFetch;lastMachines=null;lastModelOptions=null;machinesUrl=null;gatewayBackUntil=0;constructor(n){this.session=n.session,this.baseUrl=(n.baseUrl??"").replace(/\/+$/,""),this.doFetch=n.fetchImpl??fetch.bind(globalThis)}async context(){let n=await this.request("GET","/v1/connect");return this.setMachinesUrl(n.machines_url),n}setMachinesUrl(n){typeof n=="string"&&/^https?:\/\//.test(n)&&(this.machinesUrl=n)}async machines(){let n=this.lastMachines,t=n?`?v=${encodeURIComponent(n.version)}`:"",r;if(this.machinesUrl&&Date.now()>=this.gatewayBackUntil)try{r=await this.request("GET",`${this.machinesUrl}${t}`)}catch(a){if(a instanceof Zn&&a.status===401)throw a;this.gatewayBackUntil=Date.now()+Ta}if(r??=await this.request("GET",`/v1/machines${t}`),r.unchanged&&n)return n.machines;let o=Array.isArray(r.machines)?r.machines:[];return this.lastMachines=typeof r.version=="string"?{version:r.version,machines:o}:null,o}async modelOptions(){let n=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!n)return null;let t=this.lastModelOptions,r=t?`?v=${encodeURIComponent(t.version)}`:"",o=await this.request("GET",`${n}/v1/model-options${r}`);if(o.unchanged&&t)return t.options;let a={route:o.route??{allow:[],prefer:[]},providers:Array.isArray(o.providers)?o.providers:[],names:Array.isArray(o.names)?o.names:[],layout:o.layout??"providers"};return this.lastModelOptions=typeof o.version=="string"?{version:o.version,options:a}:null,a}async runs(){let n=await this.request("GET","/v1/machines/runs");return Array.isArray(n.runs)?n.runs:[]}async stopRun(n){let t=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!t)throw new Zn("This page can't stop runs yet: it hasn't been told where Soba's gateway is.",501);await this.request("POST",`${t}/v1/runs/${encodeURIComponent(n)}/stop`,{})}lookup(n){return this.request("GET",`/v1/device/lookup?code=${encodeURIComponent(n)}`)}approve(n){return this.request("POST","/v1/device/approve",{user_code:n})}claim(n){return this.request("POST","/v1/device/claim",{pairing_nonce:n})}deny(n){return this.request("POST","/v1/device/deny",{user_code:n})}plans(){return this.request("GET","/v1/plans")}selectPlan(n){return this.request("POST","/v1/plans/select",{plan:n})}checkoutPlan(n,t){return this.request("POST","/v1/plans/checkout",{plan:n,...t?.successUrl?{success_url:t.successUrl}:{},...t?.cancelUrl?{cancel_url:t.cancelUrl}:{}})}redeemCode(n){return this.request("POST","/v1/rewards/redeem",{code:n})}leavePlan(){return this.request("DELETE","/v1/plans/select")}hosted(){return this.request("GET","/v1/hosted")}startHosted(){return this.request("POST","/v1/hosted/start")}disconnectHosted(n){return this.request("DELETE",n?`/v1/hosted?provider=${encodeURIComponent(n)}`:"/v1/hosted")}approveRuntime(n,t){return this.request("POST","/v1/runtimes/approve",{machine_id:n,runtime_id:t})}preferRuntime(n,t){return this.request("POST","/v1/runtimes/prefer",{machine_id:n,runtime_id:t})}async request(n,t,r){let o=await this.doFetch(/^https?:\/\//.test(t)?t:`${this.baseUrl}${t}`,{method:n,headers:{authorization:`Bearer ${this.session}`,...r?{"content-type":"application/json"}:{}},...r?{body:JSON.stringify(r)}:{}}),a={};try{a=await o.json()}catch{}if(!o.ok){let s=typeof a.error=="string"?a.error:`Request failed (${o.status})`;throw new Zn(s,o.status)}return a}};function ht(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return"#ffffff";let t=n[1].length===3?[...n[1]].map(a=>a+a).join(""):n[1],r=a=>{let s=Number.parseInt(t.slice(a*2,a*2+2),16)/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(1)+.0722*r(2)>.45?"#101012":"#ffffff"}function Cr(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return null;let t=n[1].length===3?[...n[1]].map(r=>r+r).join(""):n[1];return[0,1,2].map(r=>Number.parseInt(t.slice(r*2,r*2+2),16))}function qn(e,n,t){let r=Cr(e),o=Cr(n);return!r||!o?e:`#${r.map((s,c)=>Math.round(s+(o[c]-s)*t)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function En(e,n){if(!Cr(e))return{};let t=ht(e),r=n?.trim();return{"--sc-ground":e,"--sc-shell":e,"--sc-sheet":qn(e,t,.07),"--sc-raised":qn(e,t,.13),"--sc-line":qn(e,t,.18),"--sc-line-2":qn(e,t,.28),"--sc-text":t,"--sc-text-2":qn(t,e,.15),"--sc-muted":qn(t,e,.38),...r?{"--sc-accent":r,"--sc-accent-fg":ht(r)}:{"--sc-accent":t,"--sc-accent-fg":e}}}function Ke(e){return e.authenticated===!0?{tone:"ok",text:"signed in"}:e.authenticated===!1?{tone:"warn",text:e.auth_hint??"signed out on that machine"}:{tone:"unknown",text:"could not tell"}}function gt(e){let{platform:n,arch:t}=e;if(!n)return null;let r=n==="darwin"||n==="macos",o=r?"Mac":n==="win32"||n==="windows"?"Windows PC":"Linux machine";return r?`${t==="aarch64"||t==="arm64"?"Apple silicon ":""}${o}`:o}function In(e){return e.find(n=>n.state==="offline")??null}function Mr(e){return e.state==="busy"?{tone:"busy",text:`serving ${e.active} of ${e.capacity}`}:e.state==="online"?{tone:"ok",text:"connected"}:{tone:"off",text:"asleep or offline"}}function le(e){let n=e.label?.trim(),t=e.name?.trim();return n&&(!t||n!==t)?n:(t??n??"").replace(/\.(local|lan|home|internal)$/i,"").replace(/[-_]+/g," ").trim()||n||"This machine"}function Xn(e,n){let t=o=>o.state==="busy"?0:o.state==="online"?1:2,r=o=>o.last_seen_at?Date.parse(o.last_seen_at):0;return t(e)-t(n)||r(n)-r(e)}function _e(e){return[...e].sort(Xn)[0]??null}function Ln(e){return e?e.state==="busy"?{tone:"busy",word:"Serving"}:e.state==="online"?{tone:"ok",word:"Connected"}:e.pairing_lost?{tone:"off",word:"Not connected"}:{tone:"off",word:"Asleep"}:{tone:"off",word:"No compute"}}function Kn(e){let n=Ln(e);return{label:e?n.word:"Connect compute",ariaLabel:e?e.pairing_lost?`${le(e)} is not connected`:`${n.word} on ${le(e)}`:"Connect compute",connected:e!==null,state:n}}function on(e){return e.state==="online"||e.state==="busy"}function bt(e){if(!e)return"never seen";let n=Date.parse(e);if(Number.isNaN(n))return"never seen";let t=Date.now()-n,r=6e4;return t<2*r?"just now":t<60*r?`${Math.floor(t/r)} min ago`:t<24*60*r?`${Math.floor(t/(60*r))} hr ago`:`${Math.floor(t/(24*60*r))} days ago`}function Nr(e){return e.runtimes.filter(n=>n.id!=="shell")}function we(e){return e.runtimes.filter(n=>n.id!=="shell"&&!n.quarantined&&!n.absent)}function Fe(e){let n=s=>s?e.runtimes.find(c=>c.id===s)??null:null;if(e.requested_runtime)return{by:"app",runtimeId:e.requested_runtime,runtime:n(e.requested_runtime)};let t=we(e),r=t.find(s=>s.id===e.preferred_runtime);if(r)return{by:"you",runtimeId:r.id,runtime:r};let o=s=>s.id==="claude-code"?0:s.id==="codex"?1:2,a=[...t].sort((s,c)=>o(s)-o(c))[0]??null;return{by:"default",runtimeId:a?.id??null,runtime:a}}var xr="soba";function On(){return`${xr}://show`}function At(e,n,t){let r=`${xr}://connect?url=${encodeURIComponent(e)}`;return n&&(r+=`&nonce=${encodeURIComponent(n)}`),t&&(r+=`&want=${encodeURIComponent(t)}`),r}function yt(){let e=globalThis.crypto;if(!e?.getRandomValues)return null;let n=e.getRandomValues(new Uint8Array(32)),t="";for(let r of n)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Ba=1600;function Sr(e={}){return Pr(e)}async function Rr(e,n={}){if(typeof window>"u"||typeof document>"u")return"unknown";let t=Pr(n);try{window.location.href=At(e,n.nonce,n.want)}catch{return"absent"}return t}async function Tn(e={}){if(typeof window>"u"||typeof document>"u")return"unknown";let n=Pr(e);try{window.location.href=On()}catch{return"absent"}return n}async function Pr(e){if(typeof window>"u"||typeof document>"u")return"unknown";let n=e.graceMs??Ba,t=document.visibilityState==="visible"&&document.hasFocus(),r=!1,o=()=>{r=!0},a=()=>{document.visibilityState==="hidden"&&(r=!0)};return window.addEventListener("blur",o),window.addEventListener("pagehide",o),document.addEventListener("visibilitychange",a),await new Promise(s=>setTimeout(s,n)),window.removeEventListener("blur",o),window.removeEventListener("pagehide",o),document.removeEventListener("visibilitychange",a),t?r?"opened":"absent":"unknown"}var $e={"claude-code":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAARGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABAoAMABAAAAAEAAABAAAAAAEZRQrAAAAHLaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtb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Ye+yCnB3kPeGZiJkLwBzq+EZK2GxGe7nRW12PSGeADM/EmtjG4qej4OQ90YuRN/rYcWzMU8ZPuWbyCHPgbYT3vQ4Pp0/OM7QYx6VGXgMbdGN/AVNIT3cAadkl50K7+QtmgFGBskwuuGBL+EfnaxNQFH3ihDqM12j6lTyyVn4H4E6hAx4NkYwy1G0DlAmsUN8ESX6/+H/GpiUBv4FSyLhydRRp0cAAAAASUVORK5CYII="};import{useEffect as us,useRef as Ga}from"react";import{Fragment as Da,jsx as Ge,jsxs as Er}from"react/jsx-runtime";function Ir({anchor:e,label:n,options:t,current:r,onClose:o,onPick:a}){let s=Ga(null);return us(()=>{let i=s.current,l=e.current;if(!i||!l)return;try{typeof i.showPopover=="function"&&i.showPopover()}catch{}let d=l.getBoundingClientRect();d.width>i.offsetWidth&&(i.style.width=`${Math.round(d.width)}px`);let h=i.offsetWidth,b=i.offsetHeight,y=d.width>248?d.left:d.right-h,m=Math.max(8,Math.min(y,window.innerWidth-h-8)),v=d.bottom+6,A=v+b>window.innerHeight-8&&d.top-6-b>8?d.top-6-b:v;i.style.left=`${Math.round(m)}px`,i.style.top=`${Math.round(A)}px`,i.querySelector('[aria-checked="true"]')?.focus()},[e]),us(()=>{let i=l=>{let d=l.target;!d||s.current?.contains(d)||e.current?.contains(d)||o()};return document.addEventListener("pointerdown",i,!0),()=>document.removeEventListener("pointerdown",i,!0)},[e,o]),Ge("div",{ref:s,role:"menu","aria-label":n,className:"sc-menu",popover:"manual",onKeyDown:i=>{let l=[...s.current?.querySelectorAll("[role=menuitemradio]")??[]],d=l.indexOf(document.activeElement);if(i.key==="Escape")i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),o(),e.current?.focus();else if(i.key==="ArrowDown"||i.key==="ArrowUp"){i.preventDefault();let h=i.key==="ArrowDown"?1:-1;l[(d+h+l.length)%l.length]?.focus()}else i.key==="Tab"&&o()},children:t.map(i=>Ge(Wa,{option:i,checked:r===i.id,onClose:o,onPick:a},i.id??""))})}function Wa({option:e,checked:n,onClose:t,onPick:r}){return Er(Da,{children:[e.heading?Ge("div",{className:"sc-menu-head",role:"presentation",children:e.heading}):e.rule?Ge("div",{className:"sc-menu-sep"}):null,Er("button",{type:"button",role:"menuitemradio","aria-checked":n,className:"sc-menu-item",onClick:()=>{e.onChoose?(e.onChoose(),t()):n?t():r(e.id)},children:[e.glyph,Er("span",{className:"sc-menu-text",children:[Ge("span",{className:"sc-menu-label",children:e.label}),e.note&&Ge("span",{className:"sc-menu-note",children:e.note})]}),e.trailing?Ge("span",{className:"sc-menu-act",children:e.trailing}):n&&Ge(Lr,{})]})]})}function Lr(){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-menu-check",children:Ge("path",{d:"M5 12.5l4.5 4.5L19 7.5",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function hn({open:e}){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-chev sc-chev-open":"sc-chev",children:Ge("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{useEffect as Xt,useId as Fa,useLayoutEffect as za,useMemo as Kt,useRef as kt,useState as Ct}from"react";var ds={haiku:"Haiku",sonnet:"Sonnet",opus:"Opus",fable:"Fable"};function en(e){return ds[e]??e}function wt(e,n=[],t=[],r){let o=A=>!r||r.includes(A.cost_class),a=[...e].sort(Xn),s=_e([...e]),c=s?Fe(s):null,l=[{id:"auto",kind:"auto",label:"Automatic",model:"auto",...c?.runtime?{note:c.runtime.default_model?`Uses ${en(c.runtime.default_model)}`:`Uses ${c.runtime.display_name}`}:{}}];a.some(A=>we(A).some(k=>o(k)&&Zt(k.id)))&&l.push({id:"small",kind:"size",label:"Fast",note:"quick and cheap",model:"small"},{id:"large",kind:"size",label:"Best",note:"the most capable",model:"large"});let h=new Map,y=new Set(a.flatMap(A=>we(A).filter(o).map(k=>k.id))).size>1||n.some(A=>A.models.length>0);for(let A of a)for(let k of we(A))if(o(k)){!k.models.some(Boolean)&&y&&!h.has(`${k.id}/auto`)?h.set(`${k.id}/auto`,{option:{id:`${k.id}/auto`,kind:"named",label:k.display_name,note:k.default_model?`Uses ${en(k.default_model)}`:"its default model",model:"auto",runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])}):h.has(`${k.id}/auto`)&&h.get(`${k.id}/auto`)?.machines.add(le(A));for(let S of k.models){if(!S)continue;let W=`${k.id}/${S}`,L=h.get(W);if(L){L.machines.add(le(A));continue}h.set(W,{option:{id:W,kind:"named",label:en(S),model:S,runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])})}}let m=new Set;for(let{machines:A}of h.values())for(let k of A)m.add(k);let v=m.size>1;for(let{option:A,machines:k}of h.values()){let S=v&&k.size===1?[...k][0]:void 0;l.push(S?{...A,machine:S}:A)}for(let A of n)for(let{model:k}of A.models)k&&l.push({id:`@${A.id}/${k}`,kind:"provider",label:k,model:k,costClass:A.cost_class,providerId:A.id,providerName:A.name,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{}});for(let A of t)!A.alias||!A.cost_classes.length||l.push({id:`alias:${A.alias}`,kind:"provider",label:A.label,...A.note?{note:A.note}:{},...A.icon?{icon:A.icon}:{},model:A.alias,costClass:A.cost_classes[0],costClasses:A.cost_classes,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{},choice:A.alias});return l}function ps(e,n){let t=[];for(let r of n){let o=r.provider?.toLowerCase(),a=e.filter(l=>l.model!==r.model?!1:r.runtime?l.kind==="named"&&l.runtime===r.runtime:l.kind!=="provider"?!1:!o||l.providerMark===o||l.providerId?.toLowerCase()===o||l.providerName?.toLowerCase()===o),s=a.find(l=>!l.locked)??a[0];if(!s)continue;let{machine:c,...i}=s;t.push({...i,id:`choice:${r.id}`,label:r.label,...r.note?{note:r.note}:{},choice:r.id})}return t}function Or(e,n,t=[]){if(n==="automatic")return e.filter(c=>c.kind==="auto"||c.kind==="size");if(n!=="choices")return[...e];let r=e.filter(c=>c.choice),o=ps(e.filter(c=>!c.choice),t),a=e.filter(c=>c.kind!=="provider");return[...a.filter(c=>c.kind==="auto"||c.kind==="size"),...r,...o,...a.filter(c=>c.kind==="named")]}function Tr(e,n){return e.filter(t=>t.kind!=="size"||(t.model==="small"?n?.fast!==!1:n?.best!==!1))}function Br(e,n,t){return t?.auto!==!1||n==="automatic"?[...e]:e.filter(r=>r.kind!=="auto")}function vt(e,n="providers",t=!1){let r=[],o=[],a=new Map;for(let s of e){if(s.kind!=="named"&&s.kind!=="provider"||s.choice){r.push(s);continue}if(n==="models"&&(s.kind==="provider"||t)){let l=a.get("@models");if(l)l.options.push(s);else{let d={heading:"Models",options:[s]};a.set("@models",d),o.push(d)}continue}let c=s.runtime??`@${s.providerId}`,i=a.get(c);if(i)i.options.push(s);else{let l={heading:s.runtimeName??s.providerName??s.runtime??"",options:[s]};a.set(c,l),o.push(l)}}for(let s of o)s.options.some(c=>c.model in ds)||s!==a.get("@models")&&s.options.sort((c,i)=>c.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}));return r.length?[{heading:null,options:r},...o]:o}function Gr(e,n){let t=e.find(o=>o.kind==="auto")??{id:"auto",kind:"auto",label:"Automatic",model:"auto"};if(!n||n==="auto")return{selected:t,unavailable:null};let r=e.find(o=>o.id===n);return r&&!r.locked?{selected:r,unavailable:null}:{selected:t,unavailable:n}}function Wr(e){return e.kind==="provider"&&e.costClass?{model:e.model,route:{allow:e.costClasses??[e.costClass]}}:e.runtime?{model:e.model,runtime:e.runtime}:{model:e.model}}function gn(e){return e.length>1}var Ha={opus:"Most capable. Best for hard, multi-step work.",sonnet:"Balanced speed and quality for everyday runs.",haiku:"Fastest. Best for quick, simple runs."};function Dr(e){if(e.kind==="auto"){let t=e.note?.replace(/^Uses /,"");return t?`Soba picks the model for each run. Currently using ${t}.`:"Soba picks the model for each run."}if(e.kind==="size")return e.id==="small"?"Quick and cheap. Whichever small model the agent serving has.":"The most capable model the agent serving has.";if(e.kind==="provider")return e.locked==="plan"?"Not included in your plan.":e.locked==="allowance"?"Your plan's allowance is used up.":e.providerName?`Through ${e.providerName}. Counts toward your plan.`:void 0;let n=Ha[e.model];return n?e.machine?`${n} On ${e.machine}.`:n:e.machine?`On ${e.machine}.`:void 0}var Hr={openai:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path>'},anthropic:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path>'},gemini:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-0)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-1)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-0" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-1" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-2" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs>'},azure:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#azure-soba-pm-azure-0)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#azure-soba-pm-azure-1)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#azure-soba-pm-azure-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-0" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-1" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-2" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs>'},openrouter:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z"></path>'},groq:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path>'},together:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z" fill="#EF2CC1"></path><path d="M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z" fill="#CAAEF5"></path><path d="M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z" fill="#FC4C02"></path>'},fireworks:{viewBox:"0 0 24 24",mono:!1,svg:'<path clip-rule="evenodd" d="M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z" fill="#5019C5" fill-rule="evenodd"></path>'}};import{jsx as Ua}from"react/jsx-runtime";function Bn({provider:e,className:n}){let t=Hr[e];return t?Ua("svg",{className:n,viewBox:t.viewBox,fill:t.mono?"currentColor":void 0,fillRule:"evenodd","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:t.svg}}):null}import{Fragment as gs,jsx as z,jsxs as We}from"react/jsx-runtime";function Mt({options:e,layout:n="providers",ownInList:t=!1,search:r=!0,selected:o,appName:a,onPick:s,caption:c,onOpen:i,disabled:l,className:d}){let[h,b]=Ct(!1),y=kt(null);if(!gn(e))return null;let m=d?`sc-mp ${d}`:"sc-mp";return We("span",{className:m,children:[c&&z("span",{className:"sc-mp-cap",children:c}),We("button",{ref:y,type:"button",className:"sc-mp-btn",...i?{}:{"aria-haspopup":"dialog","aria-expanded":h},"aria-label":`Model: ${o.label}. Change`,title:o.label,disabled:l,onClick:i??(()=>b(v=>!v)),children:[z("span",{className:"sc-mp-label",children:o.label}),z(hn,{open:!i})]}),h&&!i&&z(Qa,{anchor:y,options:e,layout:n,ownInList:t,search:r,appName:a,current:o.id,onClose:()=>b(!1),onPick:v=>{b(!1),v!==o.id&&s(v)}})]})}var Va=9,_t=6,bn=8,ms=380;var Ur=220;function Qa({anchor:e,options:n,layout:t,ownInList:r,search:o,current:a,inline:s=!1,appName:c,onClose:i,onPick:l}){let d=kt(null),h=kt(null),b=kt(null),y=Fa(),[m,v]=Ct(""),A=m.trim().length>0,k=kt(!1),S=o&&n.length>=Va,W=Kt(()=>vt(n,t,r),[n,t,r]),L=Kt(()=>{let u=[];for(let R of W){let I=Fr(R),J=R.options.length===1&&R.options[0]?.model==="auto";if(I==="head"||I==="@models"||J||t==="models"&&I.startsWith("@"))for(let B of R.options)u.push({kind:"option",key:B.id,option:B});else u.push({kind:"group",key:`g:${I}`,group:R,section:I.startsWith("@")?"providers":"agents"})}return u},[W,t]),D=Kt(()=>qa(W,m),[W,m]),O=Kt(()=>D.flatMap(u=>u.options),[D]),U=u=>u.kind==="group"&&u.group.options.some(R=>R.id===a),[w,$]=Ct(()=>L.find(u=>u.kind==="option"?u.option.id===a:U(u))?.key??"auto"),[j,ee]=Ct(null),[ae,me]=Ct(null);Xt(()=>{A&&O.length&&!O.some(u=>u.id===w)&&$(O[0]?.id??a)},[O,w,a,A]),za(()=>{let u=d.current,R=e.current;if(!u||!R||s)return;try{typeof u.showPopover=="function"&&u.showPopover()}catch{}let I=R.getBoundingClientRect(),J=window.innerHeight-I.bottom-_t-bn,B=I.top-_t-bn,te=J<Math.min(ms,u.scrollHeight)&&B>J,N=Math.min(ms,te?B:J);u.style.maxHeight=`${Math.max(160,Math.round(N))}px`;let H=u.offsetWidth,ie=Math.max(bn,Math.min(I.left,window.innerWidth-H-bn));u.style.left=`${Math.round(ie)}px`,te?(u.style.top="auto",u.style.bottom=`${Math.round(window.innerHeight-I.top+_t)}px`):(u.style.bottom="auto",u.style.top=`${Math.round(I.bottom+_t)}px`),(b.current??u).focus({preventScroll:!0})},[e,s]),Xt(()=>{k.current&&(k.current=!1,h.current?.querySelector(`[data-id="${CSS.escape(w)}"]`)?.scrollIntoView({block:"nearest"}))},[w]),Xt(()=>{if(s)return;let u=R=>{let I=R.target;!I||d.current?.contains(I)||e.current?.contains(I)||i()};return document.addEventListener("pointerdown",u,!0),()=>document.removeEventListener("pointerdown",u,!0)},[e,i,s]),Xt(()=>{if(!j)return;let u=R=>{R.target instanceof Element&&R.target.closest(".sc-mm-flyout")||ee(null)};return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[j]);let fe=(u,R=!1)=>{let I=h.current?.querySelector(`[data-id="${CSS.escape(u)}"]`),J=d.current;if(!I||!J)return;let B=I.getBoundingClientRect(),te=J.getBoundingClientRect(),N=te.right+4+Ur<=window.innerWidth-bn,H=Math.max(bn,Math.min(B.top-5,window.innerHeight-bn-160));ee({key:u,top:H,left:N?te.right+4:te.left-4-Ur,maxHeight:Math.min(320,window.innerHeight-H-bn)});let ie=L.find(Ee=>Ee.key===u);ie?.kind==="group"&&me(R?ie.group.options.find(Ee=>Ee.id===a)?.id??ie.group.options[0]?.id??null:null)},P=j?L.find(u=>u.key===j.key):void 0,q=P?.kind==="group"?P.group.options:[],V=u=>{let R=L[(u+L.length)%L.length];R&&(k.current=!0,$(R.key),ee(null))},Z=u=>{let R=O[(u+O.length)%O.length];R&&(k.current=!0,$(R.id))},be=u=>{if(u.key==="Escape"){if(u.preventDefault(),u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),j){ee(null);return}i(),e.current?.focus();return}if(u.key==="Tab"){i();return}if(j&&ae!==null){let J=q.findIndex(B=>B.id===ae);if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault();let B=u.key==="ArrowDown"?1:-1;me(q[(J+B+q.length)%q.length]?.id??null)}else if(u.key==="ArrowLeft")u.preventDefault(),ee(null);else if(u.key==="Enter"){u.preventDefault();let B=q[J];B&&!B.locked&&l(B.id)}return}if(A){let J=O.findIndex(B=>B.id===w);u.key==="ArrowDown"||u.key==="ArrowUp"?(u.preventDefault(),Z(J+(u.key==="ArrowDown"?1:-1))):u.key==="Enter"&&(u.preventDefault(),O.some(B=>B.id===w&&!B.locked)&&l(w));return}let R=L.findIndex(J=>J.key===w),I=L[R];switch(u.key){case"ArrowDown":u.preventDefault(),V(R+1);return;case"ArrowUp":u.preventDefault(),V(R-1);return;case"ArrowRight":I?.kind==="group"&&(u.preventDefault(),fe(I.key,!0));return;case"Enter":u.preventDefault(),I?.kind==="group"?fe(I.key,!0):I&&!I.option.locked&&l(I.option.id);return;default:if(!S&&u.key.length===1&&!u.metaKey&&!u.ctrlKey){let J=u.key.toLowerCase(),B=ie=>(ie.kind==="option"?ie.option.label:ie.group.heading??"").toLowerCase(),te=L.findIndex((ie,Ee)=>Ee>R&&B(ie).startsWith(J)),N=L.findIndex(ie=>B(ie).startsWith(J)),H=te>=0?te:N;H>=0&&V(H)}}},Y=u=>`${y}-${u}`,he=L.filter(u=>u.kind==="group"&&u.section==="agents"||u.kind==="option"&&u.option.kind==="named"),Ae=L.filter(u=>u.kind==="group"&&u.section==="providers"),Te=L.filter(u=>u.kind==="group"||!(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")),Pe=L.some(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice),ne=(u,R,I,J=!1)=>We("div",{id:Y(u.id),"data-id":u.id,role:"option","aria-selected":u.id===a,...u.locked?{"aria-disabled":!0}:{},"data-active":u.id===R||void 0,"data-locked":u.locked,className:"sc-mm-item",onPointerMove:I,onPointerDown:B=>B.preventDefault(),onClick:()=>!u.locked&&l(u.id),children:[z(Ya,{option:u,bare:J}),z("span",{className:"sc-mm-label",children:u.label}),u.locked?!J&&z("span",{className:"sc-mm-pill",children:fs[u.locked]}):hs(u)&&u.id!==a&&z("span",{className:"sc-mm-note",children:hs(u)}),u.id===a&&z(Lr,{})]},u.id),de=u=>{let R=u.group.options[0],I=u.group.options.every(B=>B.locked)?R?.locked:void 0,J=R?.runtime?$e[R.runtime]:void 0;return We("div",{id:Y(u.key),"data-id":u.key,role:"option","aria-selected":!1,"data-active":u.key===w||void 0,"data-locked":I,className:"sc-mm-item sc-mm-sub",onPointerMove:()=>{w!==u.key&&$(u.key),j?.key!==u.key&&fe(u.key)},onPointerDown:B=>B.preventDefault(),onClick:()=>fe(u.key),children:[J?z("img",{className:"sc-mm-tile",src:J,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:R?.providerMark&&z(Bn,{provider:R.providerMark,className:"sc-mm-tile-glyph"})}),z("span",{className:"sc-mm-label",children:u.group.heading}),I&&z("span",{className:"sc-mm-pill",children:fs[I]}),U(u)&&z("span",{className:"sc-mm-dot","aria-hidden":"true",title:"In use"}),z(hn,{open:!1})]},u.key)};return We("div",{ref:d,role:"dialog","aria-label":"Choose a model",className:s?"sc-mm sc-mm-inline":"sc-mm",...s?{}:{popover:"manual"},tabIndex:-1,onKeyDown:be,onPointerLeave:()=>!s&&ee(null),...S?{}:{"aria-activedescendant":Y(w)},children:[S&&We("div",{className:"sc-mm-search",children:[z(Za,{}),z("input",{ref:b,type:"text",role:"combobox","aria-expanded":"true","aria-controls":`${y}-list`,"aria-activedescendant":Y(w),"aria-autocomplete":"list",placeholder:"Search models",autoComplete:"off",spellCheck:!1,value:m,onChange:u=>{v(u.target.value),ee(null)}})]}),z("div",{ref:h,id:`${y}-list`,role:"listbox","aria-label":"Models",className:"sc-mm-list",onScroll:()=>ee(null),children:A?We(gs,{children:[D.map((u,R)=>We("div",{role:"group",...u.heading?{"aria-labelledby":`${y}-g${R}`}:{},className:"sc-mm-group",children:[u.heading&&z(ja,{id:`${y}-g${R}`,group:u}),u.options.map(I=>ne(I,w,()=>I.id!==w&&$(I.id),!!u.heading))]},Fr(u))),!O.length&&We("div",{className:"sc-mm-empty",children:["No models match \u201C",m.trim(),"\u201D"]})]}):We(gs,{children:[L.filter(u=>u.kind==="option"&&(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null),r&&Te.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),r&&Te.map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&he.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&he.length>0&&z("div",{className:"sc-mm-label-row",role:"presentation",children:"Your own AI"}),(r?[]:he).map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-label-row",role:"presentation",children:c?`${c} models`:"Included models"}),(r?[]:Ae).map(u=>u.kind==="group"?de(u):null),(r?[]:L).filter(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null)]})}),j&&q.length>0&&z("div",{role:"listbox","aria-label":P?.kind==="group"?P.group.heading??"Models":"Models",className:"sc-mm-flyout",style:{top:j.top,left:j.left,width:Ur,maxHeight:j.maxHeight},children:q.map(u=>ne(u,ae,()=>u.id!==ae&&me(u.id),!0))})]})}var fs={plan:"Upgrade",allowance:"Limit reached"},Ja={auto:"M8 1c.5 3.6 2 5 7 7-5 2-6.5 3.4-7 7-.5-3.6-2-5-7-7 5-2 6.5-3.4 7-7Z",fast:"M9.4.5 2.6 9.1c-.3.4 0 .9.4.9H7l-.9 5.1c-.1.5.5.8.8.4l6.8-8.6c.3-.4 0-.9-.4-.9H9.3l.9-5.1c.1-.5-.5-.8-.8-.4Z",best:"M4.5 2h7l3.5 4.2L8 14.5 1 6.2Z"};function Ya({option:e,bare:n=!1}){if(e.icon)return/^https?:\/\//.test(e.icon)?z("img",{className:"sc-mm-tile",src:e.icon,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box sc-mm-emoji","aria-hidden":"true",children:e.icon});if(e.kind==="named"&&e.runtime&&!n){let t=$e[e.runtime];return t?z("img",{className:"sc-mm-tile",src:t,alt:"","aria-hidden":"true"}):null}return e.kind==="auto"||e.kind==="size"?z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z("svg",{viewBox:"0 0 16 16",className:"sc-mm-tile-glyph",fill:"currentColor","aria-hidden":"true",focusable:"false",children:z("path",{d:Ja[e.kind==="auto"?"auto":e.id==="small"?"fast":"best"]})})}):e.kind==="provider"&&e.providerMark&&!n?z("span",{className:e.locked?"sc-mm-tile sc-mm-tile-box sc-mm-tile-dim":"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z(Bn,{provider:e.providerMark,className:"sc-mm-tile-glyph"})}):null}function Fr(e){let n=e.options[0];return!n||n.choice||n.kind==="auto"||n.kind==="size"?"head":n.runtime&&e.options.every(t=>t.runtime===n.runtime)?n.runtime:!n.runtime&&e.options.every(t=>t.providerId===n.providerId)?`@${n.providerId}`:"@models"}function ja({id:e,group:n}){let t=n.options[0],r=Fr(n),o=t?.runtime&&r===t.runtime?$e[t.runtime]:void 0,a=r.startsWith("@")&&r!=="@models"?t?.providerMark:void 0;return We("div",{id:e,className:"sc-mm-head",role:"presentation",children:[o&&z("img",{className:"sc-mm-logo",src:o,alt:"","aria-hidden":"true"}),a&&z(Bn,{provider:a,className:"sc-mm-logo"}),n.heading]})}function qa(e,n){let t=n.trim().toLowerCase();if(!t)return e;let r=[];for(let o of e){let s=o.heading?.toLowerCase().includes(t)?o.options:o.options.filter(c=>[c.label,c.model,c.note??""].some(i=>i.toLowerCase().includes(t)));s.length&&r.push({...o,options:s})}return r}function hs(e){return e.kind==="provider"?e.locked==="plan"?"Upgrade":e.locked==="allowance"?"Limit reached":e.choice?e.note:void 0:e.kind!=="named"?e.note:e.machine?`on ${e.machine}`:e.model==="auto"?e.note:void 0}function Za(){return We("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-mm-find",children:[z("circle",{cx:"11",cy:"11",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),z("path",{d:"M16 16l4 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}import{useEffect as Xa,useRef as Ka}from"react";import{jsx as Re,jsxs as $t}from"react/jsx-runtime";function zr({options:e,selected:n,onPick:t,onClose:r,busy:o}){let a=Ka(null);return Xa(()=>{(a.current?.querySelector('[aria-checked="true"]')??a.current?.querySelector("[role=radio]"))?.focus()},[]),$t("div",{className:"sc-tray sc-screen",onKeyDown:i=>{i.key==="Escape"&&(i.stopPropagation(),r())},children:[$t("div",{className:"sc-screen-head",children:[Re("button",{type:"button",className:"sc-back","aria-label":"Back",onClick:r,disabled:o,children:Re(_a,{})}),Re("h2",{className:"sc-screen-title",children:"Model"})]}),Re("div",{ref:a,role:"radiogroup","aria-label":"Model",className:"sc-group-card sc-mopts",onKeyDown:i=>{if(!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft"].includes(i.key)||o)return;i.preventDefault();let d=e.findIndex(y=>y.id===n),h=i.key==="ArrowDown"||i.key==="ArrowRight"?1:-1,b=e[((d<0?0:d)+h+e.length)%e.length];b&&t(b.id)},children:e.map(i=>{let l=i.id===n,d=Dr(i);return $t("button",{type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,className:"sc-mopt",disabled:o,onClick:()=>t(i.id),children:[$t("span",{className:"sc-mopt-say",children:[Re("span",{className:"sc-mopt-name",children:i.label}),d&&Re("span",{className:"sc-mopt-desc",children:d})]}),Re("span",{className:l?"sc-ring sc-ring-on":"sc-ring","aria-hidden":"true",children:l&&Re($a,{})})]},i.id)})}),Re("p",{className:"sc-screen-foot",children:"Applies to new runs. Runs already in progress keep the model they started with."}),Re("button",{type:"button",className:"sc-act-go",onClick:r,disabled:o,children:"Done"})]})}function _a(){return Re("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:Re("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function $a(){return Re("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-ring-tick",children:Re("path",{d:"M5 10.5l3.2 3.2L15 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as De,jsxs as ni}from"react/jsx-runtime";function Me({className:e}){return ni("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:[De("path",{d:"M18.125 7.039A8.6 8.6 0 1 0 18.125 16.961A6 6 0 0 1 18.125 7.039Z",fill:"currentColor"}),De("path",{d:"M19.925 7.039A8.6 8.6 0 0 1 19.925 16.961A6 6 0 0 0 19.925 7.039Z",fill:"currentColor"})]})}function bs({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function Gn({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function er({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M4 5h16v11H4zM9 20h6M12 16v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ei({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 7l5 5-5 5M12 18h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vr({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 6h14v10H5zM2.5 19.5h19",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var An={claude:bs,chatgpt:Gn,local:er},As={shell:ei};function ws(e,n){return n<2*6e4?e:n<10*6e4?Math.max(e,6e4):n<30*6e4?Math.max(e,3*6e4):Math.max(e,10*6e4)}var ti=3e3,ri=2*6e4,nr=Date.now(),tr=new Set,ys=!1;function oi(){if(ys||typeof window>"u")return;ys=!0;let e=()=>{let t=nr;if(nr=Date.now(),nr-t>ri)for(let r of tr)r()};for(let t of["pointerdown","keydown","wheel","touchstart"])window.addEventListener(t,e,{capture:!0,passive:!0});let n=()=>{if(!document.hidden)for(let t of tr)t()};window.addEventListener("focus",n),document.addEventListener("visibilitychange",n)}function He(e,n,t={}){oi();let r,o=t.immediate===!1?Date.now():0,a=!1,s=!1,c=()=>{s||(r=setTimeout(i,t.idle===!1?n:ws(n,Date.now()-nr)))},i=async()=>{if(clearTimeout(r),!(s||a)){if(typeof document>"u"||!document.hidden){a=!0,o=Date.now();try{await e()}catch{}finally{a=!1}}c()}},l=()=>{Date.now()-o>Math.min(n,ti)&&i()};return tr.add(l),t.immediate===!1?c():i(),()=>{s=!0,clearTimeout(r),tr.delete(l)}}import{useEffect as si,useRef as ai,useState as ii}from"react";function _n(e){if(e.label)return e.label;if(e.task){let n=e.task.replace(/[_-]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}return"A run"}function rr(e){if(e.status==="queued")return"Waiting for a free slot";if(e.step)return e.step;switch(e.phase?.kind){case"thinking":return"Thinking";case"writing":return"Writing";case"tool":return e.phase.tool?`Using ${e.phase.tool}`:"Using a tool";case"approval":return e.phase.tool?`Waiting for you to allow ${e.phase.tool}`:"Waiting for your approval";default:return e.first_output_at?"Working":"Starting"}}function Nt(e){let n=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/1e3));if(n<60)return`${n}s`;let t=Math.floor(n/60);return t<60?`${t}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,"0")}m`}function Qr(e){let n=new Date(e);return Number.isNaN(n.getTime())?"\u2014":n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}import{jsx as X,jsxs as ve}from"react/jsx-runtime";function Yr({run:e,machine:n,appName:t,onClose:r,onStop:o,busy:a}){let s=ai(null),[c,i]=ii(!1);si(()=>{s.current?.focus()},[]);let l=v=>{v.key==="Escape"&&(v.stopPropagation(),r())},d=async()=>{i(!0);try{await o?.(e.id)}catch{i(!1)}},h=_n(e),b=e.status==="running"&&!c,m=[n?.runtimes.find(v=>v.id===e.runtime_id)?.display_name??e.runtime_id,n?le(n):null].filter(Boolean).join(", ");return ve("div",{className:"sc-tray sc-screen",onKeyDown:l,children:[ve("div",{className:"sc-screen-head",children:[X("button",{ref:s,type:"button",className:"sc-back","aria-label":"Back to active runs",onClick:r,children:X(ci,{})}),X("span",{className:"sc-screen-from",children:"Active runs"})]}),ve("div",{className:"sc-rd-head",children:[X("h2",{className:"sc-rd-name",children:h}),ve("p",{className:"sc-rd-state",children:[X("span",{className:b?"sc-rd-dot sc-rd-dot-live":"sc-rd-dot","aria-hidden":"true"}),c?"Stopping\u2026":e.status==="queued"?`Queued for ${Nt(e.started_at)}`:`Running for ${Nt(e.started_at)}`]})]}),ve("div",{className:"sc-group-card sc-rd-facts",children:[t&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Source"}),X("span",{className:"sc-rd-val",children:t})]}),ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Model"}),X("span",{className:"sc-rd-val",children:li(e.model)})]}),m&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Runs on"}),X("span",{className:"sc-rd-val",children:m})]})]}),ve("section",{className:"sc-group",children:[X("div",{className:"sc-group-cap",children:X("p",{className:"sc-group-title",children:"Activity"})}),ve("div",{className:"sc-group-card sc-rd-steps",children:[ve("p",{className:"sc-rd-step",children:[X(Jr,{state:"done"}),X("span",{className:"sc-rd-say",children:"Started"}),X("span",{className:"sc-rd-when",children:Qr(e.started_at)})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:e.first_output_at?"done":"todo"}),X("span",{className:e.first_output_at?"sc-rd-say":"sc-rd-say sc-rd-wait",children:"First output"}),X("span",{className:"sc-rd-when",children:e.first_output_at?Qr(e.first_output_at):"Not yet"})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:b?"now":"todo"}),X("span",{className:"sc-rd-say",children:c?"Stopping":rr(e)})]})]})]}),ve("div",{className:"sc-acts",children:[o&&X("button",{type:"button",className:"sc-act-stop",onClick:()=>void d(),disabled:a||c,children:c?"Stopping\u2026":"Stop run"}),X("a",{className:"sc-act-quiet",href:On(),children:"Open Soba"})]})]})}function li(e){return!e||e==="auto"?"Automatic":e==="small"?"Fast":e==="large"?"Best":en(e)}function Jr({state:e}){return e==="done"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-done",children:[X("circle",{cx:"10",cy:"10",r:"9",fill:"currentColor"}),X("path",{d:"M5.8 10.3l2.8 2.8 5.6-5.8",fill:"none",stroke:"var(--sc-tray-card, #ffffff)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="now"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-now",children:[X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"var(--sc-line-2, #dcdce0)",strokeWidth:"2.4"}),X("path",{d:"M10 2a8 8 0 018 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})]}):X("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark",children:X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}function ci(){return X("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:X("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ie=[{id:"claude",costClass:"user-subscription",short:"Claude Code",label:"Continue with Claude",title:"The Claude plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Claude Code installed and signed in",hint:"Install it from claude.ai/code, then run `claude` once and sign in.",install:"https://claude.com/product/claude-code",expects:["claude-code"]},{id:"chatgpt",costClass:"user-subscription",short:"Codex",label:"Continue with ChatGPT",title:"The ChatGPT plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Codex installed and signed in",hint:"Install Codex, then run `codex` once and sign in.",install:"https://learn.chatgpt.com/codex/cli",expects:["codex"]},{id:"local",costClass:"user-hardware",short:"Local models",label:"Use a model on this machine",title:"A model on your own machine",cost:"Free. You bought the hardware",prerequisite:"Ollama running, with a model pulled",hint:"Install Ollama, then `ollama pull` a model before pairing.",install:"https://ollama.com",expects:["ollama","openai-api"]}],vs=["claude","chatgpt"];function jr(){return Ie.filter(e=>vs.includes(e.id))}function qr(e){return Ie.filter(n=>n.costClass===e)}function Zr(e){return Ie.find(n=>n.expects.includes(e))??null}import{Fragment as et,jsx as f,jsxs as x}from"react/jsx-runtime";function Wn({machines:e,hosted:n=[],onApproveRuntime:t,onPreferRuntime:r,onDisconnectHosted:o,onPair:a,onWake:s,onOpenApp:c,onRefresh:i,refreshing:l,busy:d,appName:h,model:b,onPickModel:y,error:m,runs:v,loadRuns:A,loading:k,machineMenu:S,machineNote:W,onReconnect:L,openApp:D=!0,children:O,onStopRun:U}){let w=_e(e),$=e.filter(E=>E.id!==w?.id),j=w?.state==="online",[ee,ae]=$n(()=>j?[]:null),[me,fe]=$n("no"),[P,q]=$n(!1),[V,Z]=$n(null),be=v===void 0&&!!A,Y=be?ee:v??(j?[]:null),he=v!==void 0||!!A;ks(()=>{V&&Y&&!Y.some(E=>E.id===V)&&Z(null)},[V,Y]);let Ae=!!(w&&on(w));ks(()=>{if(!be||!A||!Ae)return;let E=!0,Cn=He(async()=>{let G=await A();E&&ae(G)},3e3);return()=>{E=!1,Cn()}},[be,A,Ae]);let Pe=(w?Nr(w):[]).filter(E=>E.quarantined&&!E.absent),ne=sr(w,b).runtime,de=ne?.cost_class==="user-hardware"?ne:null,u=de?Ni(Mi(de,b)):null,R=!!w&&!on(w),I=(()=>{if(!w||R||!ne||Ke(ne).tone!=="warn")return null;let Cn=le(w);return{title:`${ne.display_name} is signed out`,detail:`Sign in on ${Cn} so Soba can start runs.`}})(),J=()=>{c?.(),fe("going"),Tn().then(E=>fe(E==="absent"?"absent":"no"))},B=()=>{J(),s?.()},te={label:me==="going"?"Opening Soba\u2026":"Open Soba",onPress:J,spin:me==="going"},N=w?te:a?{label:"Connect to Soba",onPress:a}:null,H=!!w&&N===te,ie=H&&!!i,Ee=i&&f("button",{type:"button",className:"sc-disc",onClick:i,disabled:l,"aria-label":"Refresh",title:"Refresh",children:f(Pi,{spinning:!!l})});if(!w&&n.length===0&&!a)return f("p",{className:"sc-note",children:"Nothing connected yet."});if(P&&w&&b&&y){let E=Ns(w,b);if(gn(E.options))return f(zr,{options:E.options,selected:b.id,onPick:y,onClose:()=>q(!1),...d?{busy:d}:{}})}let je=V?Y?.find(E=>E.id===V):void 0;return je?f(Yr,{run:je,onClose:()=>Z(null),...w?{machine:w}:{},...h?{appName:h}:{},...U?{onStop:U}:{},...d?{busy:d}:{}}):x("div",{className:"sc-tray",children:[w&&x(ze,{title:"This machine",action:(i&&!ie||D||S)&&x("span",{className:"sc-cap-acts",children:[!ie&&Ee,D&&f(Ai,{}),S]}),children:[f(di,{machine:w}),W]}),w&&R&&!w.pairing_lost&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"paused",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Wake it up"}),x("span",{className:"sc-away-body",children:["Soba on ",le(w)," is not answering. Waking it opens the app there."]})]}),f("button",{type:"button",className:"sc-away-go",onClick:B,disabled:d||me==="going",children:me==="going"?"Waking\u2026":"Wake"})]})}),w?.pairing_lost&&!on(w)&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"gone",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Connect it again"}),f("span",{className:"sc-away-body",children:"Its pairing has ended, so it cannot take runs until it is connected again."})]}),L&&f("button",{type:"button",className:"sc-away-go",onClick:L,disabled:d,children:"Connect"})]})}),w&&!R&&f(ze,{title:"Runs on",children:ne?f(vi,{machine:w,appName:h,busy:d,...b?{model:b}:{},...y?{onPickModel:y,onOpenModels:()=>q(!0)}:{},...r?{onPick:E=>r(w.id,E)}:{},...t?{onApprove:E=>t(w.id,E)}:{}}):x("div",{className:"sc-blank",children:[f("span",{className:"sc-blank-mark","aria-hidden":"true",children:f(fi,{})}),x("span",{className:"sc-blank-say",children:[f("span",{className:"sc-blank-title",children:k?"Looking\u2026":"No agent on this machine"}),f("span",{className:"sc-blank-body",children:k?"Reading what it can run.":"Install Claude Code, Codex or Ollama there and it will appear here."})]}),!k&&D&&x("a",{className:"sc-blank-act",href:On(),children:[f("span",{children:"Add agents"}),f(Xr,{})]})]})}),w&&(I||u)&&x(ze,{title:"Needs attention",children:[I&&x("div",{className:"sc-alarm",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:I.title}),f("span",{className:"sc-alarm-body",children:I.detail})]})]}),u&&x("div",{className:"sc-alarm sc-alarm-warn",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:"A large model on this computer"}),x("span",{className:"sc-alarm-body",children:["Your ",u," model can take all this computer's memory while it answers."]})]})]})]}),w&&he&&!R&&f(mi,{machine:w,runs:Y,onOpen:E=>Z(E),...U?{onStop:U}:{}}),w&&f(et,{children:Pe.length>0&&!R&&!(r&&t&&!["app","model"].includes(sr(w,b).by))&&f(ze,{title:"New on this machine",children:Pe.map(E=>f(wi,{runtime:E,...t?{onApprove:()=>t(w.id,E.id)}:{}},E.id))})}),n.length>0&&f(ze,{title:n.length>1?"Connected plans":"Connected plan",children:n.map(E=>f(Si,{credential:E,appName:h,busy:d,...o?{onDisconnect:()=>o(E.provider)}:{}},E.provider))}),$.length>0&&f(ze,{title:"Your other machines",children:$.map(E=>f(yi,{machine:E},E.id))}),!w&&a&&f(ze,{title:"Your machines",children:x("button",{type:"button",className:"sc-pair",onClick:a,children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Ri,{})}),f("span",{className:"sc-oname",children:"Connect a machine"})]})}),N&&x("div",{className:"sc-acts",children:[H&&N?x("div",{className:"sc-acts-row",children:[ie?Ee:f("span",{}),x("button",{type:"button",className:"sc-act-small",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label,!N.spin&&f(Xr,{})]})]}):N&&x("button",{type:"button",className:"sc-act-go",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label]}),me==="absent"&&x("p",{className:"sc-act-miss",children:["Nothing opened here. ",w?le(w):"That machine"," may be a different computer, or the Soba app is not installed on this one."]})]}),O,m&&f("p",{className:"sc-error sc-tray-error",children:m})]})}function ze({title:e,action:n,children:t}){return x("section",{className:"sc-group",children:[x("div",{className:"sc-group-cap",children:[f("p",{className:"sc-group-title",children:e}),n]}),f("div",{className:"sc-group-card",children:t})]})}function di({machine:e,onToggle:n,open:t}){let r=on(e),o=[r?null:e.pairing_lost?"Not connected to Soba":"Soba is asleep",r?gt(e):null,e.always_on?"always on":null].filter(Boolean),a=r&&e.capacity>0?e.active>0?`${e.active} of ${e.capacity} running`:null:bt(e.last_seen_at),s=x(et,{children:[x("span",{className:"sc-mtile","aria-hidden":"true",children:[f(xs,{}),f("span",{className:`sc-mbadge sc-mbadge-${r?Ln(e).tone:e.pairing_lost?"off":"away"}`})]}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:le(e)}),x("span",{className:"sc-mmeta",children:[f("span",{className:"sc-mmeta-is",children:o.map((c,i)=>x("span",{children:[i>0&&f("span",{className:"sc-mmeta-sep",children:"\xB7"}),c]},c))}),a&&f("span",{className:"sc-mmeta-now",children:a})]})]})]});return!n||!r?f("div",{className:"sc-mrow",children:s}):x("button",{type:"button",className:"sc-mrow sc-mrow-btn",onClick:n,"aria-expanded":!!t,title:t?"Hide what it is running":"See what it is running",children:[s,f(hn,{open:!!t})]})}function pi(e,n){return e.filter(t=>t.machine_id===n.id||t.machine_id===null)}function mi({machine:e,runs:n,onStop:t,onOpen:r}){let o=n?pi(n,e):[],[a,s]=$n(new Set),c=async l=>{s(d=>new Set(d).add(l));try{await t?.(l)}catch{s(d=>{let h=new Set(d);return h.delete(l),h})}},i=()=>{for(let l of o)c(l.id)};return f(ze,{title:"Active runs",...t&&o.length>1?{action:f("button",{type:"button",className:"sc-cap-link",onClick:i,children:"Stop all"})}:{},children:n===null?f("p",{className:"sc-row-note",children:"Looking\u2026"}):o.length===0?x("p",{className:"sc-nilrow",children:[f("span",{className:"sc-nilrow-mark","aria-hidden":"true",children:f(hi,{})}),"Nothing running"]}):o.map(l=>f(gi,{run:l,stopping:a.has(l.id),...t?{onStop:()=>void c(l.id)}:{},...r?{onOpen:()=>r(l.id)}:{}},l.id))})}function fi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M7.5 10l2.5 2.2-2.5 2.2M12.5 14.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function hi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M9 12.5l2.2 2.2L15.5 9.8",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gi({run:e,stopping:n,onStop:t,onOpen:r}){let o=x(et,{children:[f("span",{className:n?"sc-rdot":"sc-rdot sc-rdot-live","aria-hidden":"true"}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-rtitle",children:_n(e)}),f("span",{className:"sc-rstep",children:n?"Stopping\u2026":`${rr(e)} \xB7 ${Nt(e.started_at)}`})]})]});return x("div",{className:"sc-rrow",children:[r?x("button",{type:"button",className:"sc-rgo",onClick:r,"aria-label":`${_n(e)} \u2014 open this run`,children:[o,f(hn,{open:!1})]}):o,t&&f("button",{type:"button",className:"sc-rstop",onClick:t,disabled:n,"aria-label":`Stop ${_n(e)}`,children:f("span",{className:"sc-rstop-ring",children:f(Ei,{})})})]})}function bi(e){let n=Zr(e);return(n?An[n.id]:null)??As[e]??null}function Ai(){return f("a",{className:"sc-disc sc-open-app",href:On(),"aria-label":"Open Soba",title:"Open Soba",children:f(Xr,{})})}function Xr(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-dglyph",children:f("path",{d:"M14 4h6v6M20 4l-8.5 8.5M18 14.5V19a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h4.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function yi({machine:e}){let n=Ln(e);return x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(xs,{})}),f("span",{className:"sc-oname",children:le(e)}),f("span",{className:"sc-oword",children:n.word}),f("span",{className:`sc-dot sc-dot-${n.tone}`,"aria-hidden":"true"})]})}function wi({runtime:e,onApprove:n}){return x("div",{className:"sc-mrow",children:[f("span",{className:"sc-mtile sc-atile","aria-hidden":"true",children:f(or,{id:e.id,name:e.display_name})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:e.display_name}),f("span",{className:"sc-mmeta",children:e.version??"waiting to be let in"})]}),n?f("button",{type:"button",className:"sc-row-act",onClick:n,children:"Let it serve"}):f("span",{className:"sc-averdict sc-tone-warn",children:"not serving yet"})]})}function Kr({id:e,name:n}){return f("span",{className:"sc-runtime-tile","aria-hidden":"true",children:f(or,{id:e,...n?{name:n}:{}})})}function or({id:e,name:n}){if(!e)return null;let t=$e[e];if(t)return f("img",{src:t,alt:"",className:"sc-runtime-logo"});let r=bi(e);return r?f(r,{className:"sc-runtime-mark"}):n?f("span",{className:"sc-runtime-letter",children:n.slice(0,1).toUpperCase()}):null}function Ns(e,n){if(!n)return{options:[]};let t=sr(e,n),r=t.runtime?.id??t.runtimeId,o=wt([e]).filter(c=>c.kind==="named"?c.runtime===r:c.kind==="size"?!!r&&Zt(r):!0),a=t.runtime?.default_model;if(n.kind!=="auto"||!a)return{options:o,shown:n};let s=en(a);return{options:o,shown:{...n,label:s.length>16?s:`${n.label} \xB7 ${s}`}}}function vi({machine:e,appName:n,busy:t,onPick:r,model:o,onPickModel:a,onOpenModels:s,onApprove:c}){let i=sr(e,o),l=we(e),d=c?e.runtimes.filter(U=>U.quarantined&&!U.absent):[],[h,b]=$n(!1),y=ui(null);if(i.by!=="app"&&l.length===0)return null;let m=U=>U?f(Kr,{id:U.id,name:U.display_name}):null,v=i.runtime?.display_name??i.runtimeId??"\u2014",A=i.by!=="app"&&i.by!=="model"&&!!r&&(l.length>=2||d.length>0),k=i.runtime?.id??i.runtimeId,S=!on(e),W=i.runtime&&Ke(i.runtime).tone==="warn"?"Signed out":null,{options:L,shown:D}=Ns(e,o),O=i.by==="app"?`Set by ${n??"the app"}`:i.runtime?Ci(i.runtime):null;return x(et,{children:[A?x("button",{ref:y,type:"button",className:S?"sc-runs-agent sc-runs-dim":"sc-runs-agent","aria-haspopup":"menu","aria-expanded":h,"aria-label":`Runs go to ${v}. Change`,disabled:t,onClick:()=>b(U=>!U),children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),f(hn,{open:!1})]}):x("span",{className:S?"sc-runs-agent sc-runs-fixed sc-runs-dim":"sc-runs-agent sc-runs-fixed",children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),i.by==="app"&&x("span",{className:"sc-runs-told",children:["set by ",n??"the app"]}),i.by==="model"&&f("span",{className:"sc-runs-told",children:"set by the model"})]}),D&&a&&gn(L)?x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),f(Mt,{options:L,selected:D,onPick:a,caption:"Model",...s?{onOpen:s}:{},className:S?"sc-runs-model sc-runs-dim":"sc-runs-model",...t?{disabled:t}:{}})]}):O&&x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),x("span",{className:"sc-runs-said",children:[f("span",{className:"sc-runs-key",children:"Model"}),f("span",{className:"sc-runs-val",children:O})]})]}),h&&r&&f(ki,{anchor:y,machine:e,tile:m,waiting:d,...c?{onApprove:c}:{},onClose:()=>b(!1),onPick:U=>{b(!1),r(U)}})]})}function ki({anchor:e,machine:n,tile:t,waiting:r,onApprove:o,onClose:a,onPick:s}){let c={...n,requested_runtime:null},i=Fe(c),l=Fe({...c,preferred_runtime:null}).runtime,d=i.by==="you"?i.runtimeId:null,h=[{id:null,label:"Automatic",...l?{note:`Uses ${l.display_name}`}:{},glyph:t(l)},...we(n).map((b,y)=>{let m=xi(b);return{id:b.id,label:b.display_name,glyph:t(b),...m?{note:m}:{},...y===0?{rule:!0}:{}}}),...o?r.map((b,y)=>({id:`waiting:${b.id}`,label:b.display_name,glyph:t(b),...b.version?{note:b.version}:{},trailing:"Let it serve",onChoose:()=>o(b.id),...y===0?{heading:"New on this machine"}:{}})):[]];return f(Ir,{anchor:e,label:"Which agent runs go to",options:h,current:d,onClose:a,onPick:s})}function Ci(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):"Automatic"}function sr(e,n){if(!e)return{by:"default",runtimeId:null,runtime:null};let t=Fe(n?{...e,requested_runtime:null}:e);if(t.by==="app"||n?.kind!=="named"||!n.runtime)return t;let r=we(e).find(o=>o.id===n.runtime);return!r||r.id===t.runtimeId?t:{by:"model",runtimeId:r.id,runtime:r}}function Mi(e,n){return!n||n.kind==="auto"?e.default_model:n.kind==="size"?(ls(n.model)?cs(e.id,n.model):void 0)??e.default_model:n.runtime===e.id?n.model:e.default_model}function Ni(e){if(!e)return null;let n=/(\d+(?:\.\d+)?)\s*b\b/i.exec(e),t=n?.[1]?Number(n[1]):Number.NaN;return!Number.isFinite(t)||t<20?null:`${n?.[1]}B`}function xi(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):e.cost_class==="user-hardware"?"In this machine's memory":n.tone!=="ok"?n.text:e.version??void 0}function Si({credential:e,appName:n,busy:t,onDisconnect:r}){return x("div",{className:"sc-hrow",children:[x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Gn,{className:"sc-omark"})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-oname",children:e.provider==="openai-chatgpt"?"ChatGPT plan":e.provider}),f("span",{className:"sc-mmeta",children:e.account_label??"signed in"})]}),r&&f("button",{type:"button",className:"sc-row-act",onClick:r,disabled:t,children:"Disconnect"})]}),r&&x("p",{className:"sc-row-note",children:[n??"This app"," stops using it. To withdraw the grant entirely, remove it in your OpenAI settings."]})]})}function xs(){return x("svg",{viewBox:"0 0 32 24","aria-hidden":"true",focusable:"false",className:"sc-mglyph",children:[f("rect",{x:"4",y:"1.5",width:"24",height:"15",rx:"2.5",fill:"var(--sc-sheet, #ffffff)",stroke:"currentColor",strokeWidth:"2"}),f("rect",{x:"1",y:"19.5",width:"30",height:"2.5",rx:"1.25",fill:"currentColor"})]})}function Ri(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-oglyph",children:f("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Cs(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-hglyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),f("path",{d:"M12 7.5v5.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),f("circle",{cx:"12",cy:"16.5",r:"1.15",fill:"currentColor"})]})}function Ms(){return x("svg",{className:"sc-act-glyph sc-spin",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[f("circle",{cx:"8",cy:"8",r:"6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),f("path",{d:"M8 1.8a6.2 6.2 0 0 1 6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Pi({spinning:e}){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-dglyph sc-spin":"sc-dglyph",children:f("path",{d:"M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ei(){return f("svg",{className:"sc-dglyph",viewBox:"0 0 14 14","aria-hidden":"true",children:f("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}import{jsx as Ii}from"react/jsx-runtime";function _r({machines:e,onApproveRuntime:n,model:t,onPickModel:r}){return Ii(Wn,{machines:e,...n?{onApproveRuntime:n}:{},...t?{model:t}:{},...r?{onPickModel:r}:{}})}import{useCallback as Ne,useEffect as Le,useId as Bi,useMemo as yn,useRef as nt,useState as ce}from"react";var xt=[{slug:"mac-arm",label:"macOS, Apple silicon"},{slug:"mac-intel",label:"macOS, Intel"},{slug:"windows",label:"Windows"},{slug:"linux",label:"Linux"}];function St(e){if(!e)return"";try{return new URL(e).origin}catch{return""}}var Ss="soba.connect.choice",Li=180*24*60*60*1e3;function $r(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function eo(e,n){return e?n?`${Ss}.${e}.${$r(n)}`:`${Ss}.${e}`:null}function no(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Li)return null;let r=Ie.find(o=>o.id===t.choice);return r?r.id:null}catch{return null}}function to(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Rs="soba.connect.model",Oi=180*24*60*60*1e3;function ro(e,n){return e?n?`${Rs}.${e}.${$r(n)}`:`${Rs}.${e}`:null}function ar(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Oi)return null;let r=t.choice;return typeof r!="string"||!r||r.length>120?null:/^[\w.:@+-]+(\/[\w.:@+-]+)?$/.test(r)?r:null}catch{return null}}function oo(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Ps="soba.connect.dismissed",Ti=30*24*60*60*1e3;function so(e,n){return e?n?`${Ps}.${e}.${$r(n)}`:`${Ps}.${e}`:null}function ao(e){if(!e||typeof localStorage>"u")return!1;try{let n=localStorage.getItem(e);if(!n)return!1;let t=JSON.parse(n);return Date.now()-Date.parse(t.at)<Ti}catch{return!1}}function io(e){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({at:new Date().toISOString()}))}catch{}}import{Fragment as rt,jsx as g,jsxs as T}from"react/jsx-runtime";var lo=2e3,Gi=1e4,Wi=9e4,Di=6e4;function co(e,n,t,r=[],o){return e?"code":n&&(t.length>0||r.length>0)?"manage":o?"launch":"choose"}function Es(e){return on(e)&&!e.pairing_lost}function ir(e){return new Map(e.map(n=>[n.id,Es(n)]))}function Hi(e){let n=Math.max(0,Math.round(e/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function mo({client:e,initialCode:n,initialChoice:t,onConnected:r,showStatus:o=!0,initialContext:a=null,initialMachines:s,onClose:c,headingId:i,theme:l,reason:d,active:h=!0}){let b=!!a&&s!==void 0,[y,m]=ce(b?co(n,o,s??[],[],t):"loading"),[v,A]=ce(a),[k,S]=ce(s??[]),[W,L]=ce(n??""),[D,O]=ce(null),[U,w]=ce(null),[$,j]=ce(!1),[ee,ae]=ce(0),[me,fe]=ce("app"),[P,q]=ce(()=>Date.now()),[V,Z]=ce(null),[be,Y]=ce(!1),[he,Ae]=ce(!1),[Te,Pe]=ce("browser"),[ne,de]=ce(null),[u,R]=ce([]),[I,J]=ce(0),[B,te]=ce(null),N=nt(null),[H,ie]=ce(t??null),[Ee,je]=ce(null),E=yn(()=>{let p=v?.accent?.trim(),M=v?.background?.trim();if(!(!p&&!M))return M?{...En(M,p),background:M,borderRadius:"inherit"}:{"--sc-accent":p,"--sc-accent-fg":ht(p)}},[v?.accent,v?.background]),Cn=Bi(),G=i??Cn,cn=nt(null);Le(()=>{if(!e||b)return;let p=!0;return Promise.all([e.context(),e.machines()]).then(([M,Q])=>{p&&(A(M),S(Q),m(co(n,o,Q)))}).catch(M=>{p&&(w(M.message),m("choose"))}),()=>{p=!1}},[e,n,o,b]),Le(()=>{y!=="loading"||!b||m(co(n,o,s??[]))},[y,b,n,o,s]),Le(()=>{s&&S(s)},[s]),Le(()=>{a&&A(a)},[a]);let tn=nt(!1),ke=nt(y);ke.current=y;let Mn=nt(u);Mn.current=u;let Nn=!!v?.hosted_available;Le(()=>{!o&&ke.current==="manage"&&m("choose")},[o]),Le(()=>{if(!e||!h||y!=="manage")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=!Nn||tn.current;Q.length===0&&Mn.current.length===0&&oe&&ke.current==="manage"&&m("choose")}catch{}},Gi,{immediate:!1});return()=>{p=!1,M()}},[y,e,Nn,h]);let xn=eo(v?.publishable_key??null);Le(()=>{je(no(xn))},[xn]),Le(()=>{if(!e||!Nn)return;let p=!0;return e.hosted().then(M=>{p&&(R(M.credentials),!tn.current&&(tn.current=!0,M.credentials.length>0&&o&&ke.current==="choose"&&m("manage")))}).catch(()=>{}),()=>{p=!1}},[e,Nn,o]),Le(()=>{if(!e||!h||y!=="hosted")return;let p=!0,M=async()=>{try{let pe=await e.hosted();if(!p)return!1;if(R(pe.credentials),pe.credentials.length>0)return m("hosted_connected"),te(null),!0}catch{}return!1},Q=async()=>{N.current?.closed&&(N.current=null,!await M()&&p&&m("choose"))},oe=He(M,lo,{immediate:!1}),ye=setInterval(Q,400),rn=pe=>{let Xe=pe.data;Xe?.source==="soba"&&Xe.type==="hosted_result"&&M()};return window.addEventListener("message",rn),()=>{p=!1,oe(),clearInterval(ye),window.removeEventListener("message",rn),N.current=null}},[e,y,h]);let ss=Ne(()=>{if(!e)return;let p=window.open("","soba-connect-plan","width=520,height=760,noopener=no");N.current=p,m("hosted"),J(Date.now()),te(null),w(null),e.startHosted().then(({url:M})=>{if(p&&!p.closed){p.location.href=M;return}te(M)}).catch(M=>{p?.close(),N.current=null,w(M.message),m("choose")})},[e]),un=Ne(async p=>{if(e){j(!0);try{await e.disconnectHosted(p),R((await e.hosted()).credentials)}catch(M){w(M.message)}finally{j(!1)}}},[e]);Le(()=>{if(!e||!h||y!=="waiting")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=cn.current;if(!oe)return;let ye=Q.filter(pe=>!oe.has(pe.id)||oe.get(pe.id)===!1&&Es(pe)),rn=ye.find(pe=>pe.state!=="offline")??ye[0];if(rn){de(rn.id),H&&to(xn,H);let pe=Ie.find(dt=>dt.id===H)?.expects??[],Xe=we(rn).find(dt=>pe.includes(dt.id));Xe&&e.preferRuntime(rn.id,Xe.id).catch(()=>{}),m("connected"),r?.(Q)}}catch{}},lo,{immediate:!1});return()=>{p=!1,M()}},[y,e,r,H,xn,h]);let Vt=Ne(async()=>{if(e){w(null),j(!0);try{let p=await e.lookup(W);O(p),m("confirm")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),dn=Ne(async()=>{if(e){w(null),j(!0);try{try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}await e.approve(W),fe("code"),m("waiting"),ae(Date.now())}catch(p){w(p.message)}finally{j(!1)}}},[e,W,k]),Jn=Ne(async()=>{if(e){j(!0);try{await e.deny(W),Pe("browser"),m("denied")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),ge=yn(()=>v?.connect_url??null,[v]),[qe,ut]=ce(()=>yt()),Yn=yn(()=>ge?At(ge,qe??void 0,H??void 0):null,[ge,qe,H]),Qt=yn(()=>St(ge),[ge]),Jt=Ne(p=>{if(k.length===0)return null;let M=Ie.find(oe=>oe.id===p);if(!M)return null;let Q=k.flatMap(oe=>oe.runtimes??[]).filter(oe=>M.expects.includes(oe.id));return Q.length===0?{tone:"dim",text:"not installed"}:Q.some(oe=>oe.authenticated===!0)?{tone:"ok",text:"ready"}:Q.every(oe=>oe.authenticated===!1)?{tone:"warn",text:"needs signing in"}:{tone:"dim",text:"installed"}},[k]),Yt=Ne((p=null)=>{ie(p),w(null),Z(null),Y(!1),Ae(!1),jn.current=!1,ut(yt()),m("launch")},[]),jn=nt(!!t);Le(()=>{y!=="launch"||!ge||jn.current||(jn.current=!0,Y(!0),Rr(ge,{...qe?{nonce:qe}:{},...H?{want:H}:{}}).then(Z))},[y,ge,qe,H]);let Sn=Ne(()=>{Y(!0),Sr().then(Z)},[]),jt=Ne(p=>{if(he){let M=yt();Ae(!1),ut(M),ge&&(p.preventDefault(),window.location.href=At(ge,M??void 0,H??void 0))}Sn()},[he,Sn,ge,H]),Rn=yn(()=>{let p=v?.runtimes;return p?Ie.filter(M=>p.includes(M.id)):jr()},[v?.runtimes]),Be=yn(()=>{let p=Ie.find(M=>M.id===H);return p?{choice:p,Mark:An[p.id]??null}:null},[H]),Ce=yn(()=>k.find(p=>p.id===ne),[k,ne]),pn=Ne(()=>{m("manage"),c?.()},[c]);Le(()=>{let p=qe;if(!e||!h||y!=="launch"||!p)return;let M=!1,Q=Date.now()+15e4,oe=()=>{};return oe=He(async()=>{if(Date.now()>Q){oe(),Ae(!0);return}try{let ye=await e.claim(p);if(M)return;if(ye.declined){oe(),Z(null),Pe("machine"),m("denied");return}if(!ye.claimed)return;oe();try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}fe("app"),m("waiting"),ae(Date.now())}catch{}},lo,{immediate:!1,idle:!1}),()=>{M=!0,oe()}},[e,y,k,qe,h]);let Ze=yn(()=>{if(!D)return null;if(D.approved||D.denied)return"answered";let p=D.expires_at?Date.parse(D.expires_at):Number.NaN;return Number.isFinite(p)&&p<=P?"expired":"live"},[D,P]);Le(()=>{if(!(y==="confirm"&&Ze==="live"||y==="waiting"||y==="hosted"))return;let M=setInterval(()=>q(Date.now()),1e3);return()=>clearInterval(M)},[y,Ze]);let qt=Ne(async(p,M)=>{if(e)try{await e.approveRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]),yr=Ne(async(p,M)=>{if(e)try{await e.preferRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]);return y==="loading"?g("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:g("div",{className:"sc-card",children:g("p",{className:"sc-note",children:"Loading\u2026"})})}):T("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:[c&&g("button",{type:"button",className:"sc-modal-close",onClick:c,"aria-label":"Close",children:"\xD7"}),y==="manage"&&T("div",{className:"sc-card",children:[g("h2",{className:"sc-title",id:G,children:"Your compute"}),T("p",{className:"sc-sub",children:[g(lr,{context:v})," ",k.length>0&&u.length>0?"runs on your connected plan, and on these machines while they are awake.":u.length>0?"runs on the plan you connected. Nothing here is charged to you.":"runs on these machines, while they are awake."]}),g(Wn,{machines:k,hosted:u,onApproveRuntime:qt,onPreferRuntime:(p,M)=>void yr(p,M),onDisconnectHosted:p=>void un(p),onPair:()=>m("choose"),busy:$,...v?.app.name?{appName:v.app.name}:{}}),U&&g("p",{className:"sc-error",children:U})]}),y==="choose"&&T("div",{className:"sc-card",children:[g(Fi,{context:v}),g("h2",{className:"sc-h",id:G,children:d==="payment_required"?"Carry on with your own AI":d==="no_compute"?"This run needs a machine":"Connect your AI"}),g("p",{className:"sc-p",children:"Use compute you already have."}),ge&&Rn.length>0&&T(rt,{children:[g("div",{className:"sc-opts",children:Rn.map(p=>{let M=An[p.id];return T("button",{type:"button",className:"sc-opt",onClick:()=>Yt(p.id),children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:M&&g(M,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:p.label})}),(()=>{let Q=Jt(p.id);return Q?g("span",{className:`sc-opt-has sc-opt-has-${Q.tone}`,children:Q.text}):Ee===p.id?g("span",{className:"sc-opt-last",children:"last used"}):g(uo,{className:"sc-opt-go"})})()]},p.id)})}),T("p",{className:"sc-opt-note",children:["Your accounts stay there. ",Is(v)," never sees them."]})]}),(!ge||Rn.length===0)&&g("p",{className:"sc-error",style:{marginTop:16},children:"This app has no publishable key yet, so there is nothing to pair against."}),U&&g("p",{className:"sc-error",children:U}),ge&&v?.show_code===!0&&g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>m("code"),children:"I have a code"})})]}),y==="launch"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g(cr,{mark:Be?.Mark??Me,still:he||!be&&V===null}),g("h2",{className:"sc-h",id:G,children:he?"No answer from this machine":V==="absent"?"Nothing opened":V===null?"Opening Soba\u2026":"Approve it on this machine"}),he?g("p",{className:"sc-p",children:"The Soba app did not answer. It may not be open, or nobody was there. Try again when you are ready."}):V==="absent"?g("p",{className:"sc-p",children:"Nothing opened on this machine. Open it yourself below, or install it if it is not here yet."}):g("p",{className:"sc-p",children:V===null?"Approve it there and this page does the rest.":"This page finishes on its own."}),Be&&T("p",{className:"sc-prereq",children:[Be.Mark&&g(Be.Mark,{className:"sc-rt-mark"}),"Needs ",Be.choice.prerequisite]}),T("div",{className:"sc-stack",style:{marginTop:18},children:[g("a",{className:V==="absent"||he?"sc-btn sc-btn-primary":"sc-btn",href:Yn??"#",onClick:jt,children:he?"Try again":V==="absent"?"Open Soba":"Open it again"}),g("p",{className:"sc-note",children:V===null?"Your browser will ask permission first.":"Your browser asks permission the first time."}),Be&&V==="absent"&&g("p",{className:"sc-note",children:g(Vi,{text:Be.choice.hint})}),T("div",{className:"sc-foot-strip",children:[g("span",{children:"Not installed on this machine?"}),T("button",{type:"button",className:"sc-foot-go",onClick:()=>m("get"),children:["Get it",g(uo,{})]})]})]})]}),y==="get"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("launch")}),g("p",{className:"sc-head-title",children:"Get Soba"})]}),g("div",{className:"sc-opts",children:xt.map(p=>T("a",{className:"sc-opt",href:`${Qt}/download/${p.slug}`,target:"_blank",rel:"noreferrer noopener",children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:g(Vr,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:p.label})}),g(uo,{className:"sc-opt-go"})]},p.slug))}),g("p",{className:"sc-opt-note",children:"Install it, then come back here and press the row you started with."})]}),y==="code"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-h",id:G,children:"Enter the code from that machine"}),g("p",{className:"sc-p",children:"Eight characters, shown by the Soba app once you paste the link."}),T("form",{className:"sc-stack",style:{marginTop:16},onSubmit:p=>{p.preventDefault(),Vt()},children:[g("input",{className:"sc-input",value:W,onChange:p=>L(p.target.value),placeholder:"ACDE-F234",autoComplete:"off",autoFocus:!0,"aria-label":"Pairing code"}),U&&g("p",{className:"sc-error",children:U}),g("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:$||W.length<8,children:$?"Checking\u2026":"Continue"})]})]}),y==="confirm"&&D&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("code")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-title",children:"Attach this machine to your account?"}),T("p",{className:"sc-sub",children:[g(lr,{context:v})," may send your runs to it once you approve. It can never see the account or the keys on it."]}),T("ul",{className:"sc-facts",children:[g(Rt,{k:"Code",v:D.user_code}),g(Rt,{k:"Machine",v:D.hostname??"not stated"}),g(Rt,{k:"System",v:[D.platform,D.arch].filter(Boolean).join(" / ")||"not stated"}),g(Rt,{k:"Asked by",v:D.client??"not stated"}),D.labels.length>0&&g(Rt,{k:"Labels",v:D.labels.join(", ")})]}),g("p",{className:"sc-note",style:{marginTop:12},children:"Every line above is what that machine said about itself. If none of it looks like a computer of yours, say no."}),Ze==="expired"&&g("p",{className:"sc-error",children:"That code has expired. Ask the machine for a new one. It prints a fresh code each time it starts."}),Ze==="answered"&&g("p",{className:"sc-error",children:"That code has already been answered. If it was not you, deny the next one."}),U&&g("p",{className:"sc-error",children:U}),T("div",{className:"sc-row",style:{marginTop:16},children:[g("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void dn(),disabled:$||Ze!=="live",children:"Approve"}),g("button",{type:"button",className:"sc-btn",onClick:()=>void Jn(),disabled:$||Ze==="answered",children:"No, deny it"})]}),Ze==="live"&&D.expires_at&&T("p",{className:"sc-note",style:{marginTop:10},children:["This code expires in ",Hi(Date.parse(D.expires_at)-P),"."]})]}),y==="waiting"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:Be?.choice.short??"Soba"})]}),g(cr,{mark:Be?.Mark??Me}),g("h2",{className:"sc-h",id:G,children:"Approved. Waiting for it to connect"}),g("p",{className:"sc-p",children:"Nothing more to do here. This page changes when it arrives."}),ee>0&&P-ee>Wi&&T("ol",{className:"sc-stall",children:[me==="app"?T(rt,{children:[g(ur,{done:!0,title:"Soba Connect opened",line:"On this machine"}),g(ur,{done:!0,title:"You approved it",line:"In Soba Connect"})]}):g(ur,{done:!0,title:"You approved the code",line:"On this page"}),g(ur,{title:`Still nothing from ${D?.hostname??"that machine"}`,line:"Look at Soba Connect on that machine: it says what it is doing. This keeps watching either way.",children:g("button",{type:"button",className:"sc-btn sc-stall-act",onClick:()=>void Tn(),children:"Open Soba Connect"})})]})]}),y==="connected"&&T("div",{className:"sc-card",children:[g(po,{tone:"ok"}),g("h2",{className:"sc-h",id:G,children:Ce?.label?`${Ce.label} is connected`:"Connected"}),T("p",{className:"sc-p",children:[g(lr,{context:v})," will use ",Ce?.label?"it":"this machine"," from now on, while it is awake."]}),o&&T(rt,{children:[Ce&&g(zi,{machine:Ce}),g("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-wide",style:{marginTop:14},onClick:pn,children:"Done"})]})]}),y==="hosted"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"ChatGPT"})]}),B?g(cr,{mark:Gn,still:!0}):g(cr,{mark:Gn}),g("h2",{className:"sc-h",id:G,children:B?"Your browser blocked the window":"Finish signing in to ChatGPT"}),g("p",{className:"sc-p",children:B?"Nothing opened. Open the sign-in yourself below. A link you click is allowed where a window we open is not.":"Approve it in the window that opened."}),T("div",{className:"sc-stack",style:{marginTop:18},children:[B&&g("a",{className:"sc-btn sc-btn-primary",href:B,target:"soba-connect-plan",rel:"noreferrer",children:"Open the ChatGPT sign-in"}),U&&g("p",{className:"sc-error",children:U}),I>0&&P-I>Di&&g("p",{className:"sc-note sc-tone-warn",children:"Still nothing. The window may have been closed before it finished, or the sign-in may have been declined. This keeps watching either way."})]})]}),y==="hosted_connected"&&T("div",{className:"sc-card",children:[g(po,{tone:"ok"}),g("h2",{className:"sc-h",id:G,children:"ChatGPT is connected"}),T("p",{className:"sc-p",children:[g(lr,{context:v})," will run on your ChatGPT plan",u[0]?.account_label?` (${u[0].account_label})`:"",". Nothing more to pay, nothing to install."]}),g("p",{className:"sc-opt-note",style:{textAlign:"center"},children:"It runs on our side, so it has no access to your files or your terminal."}),o&&T(rt,{children:[g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:pn,children:"Done"}),g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>m("choose"),children:"Connect a machine too"})})]})]}),y==="denied"&&T("div",{className:"sc-card",children:[g(po,{tone:"off"}),g("h2",{className:"sc-h",id:G,children:"Declined"}),g("p",{className:"sc-p",children:Te==="machine"?"Nothing was connected. You can ask again whenever you like.":"That machine was not attached to your account, and the terminal has been told so."}),g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:()=>m("choose"),children:"Back to the start"})]})]})}function Is(e){return e?.app.name??"this app"}function Ui(e){let n=e?.app.icon_urls;if(n?.length)return n;let t=e?.app.icon_url;return t?[t]:[]}function Ls(e){let n=Ui(e),[t,r]=ce([]),o=Ne(c=>{c&&r(i=>i.includes(c)?i:[...i,c])},[]),a=Ne(c=>o(c.currentTarget.getAttribute("src")),[o]),s=Ne(c=>{c?.complete&&c.naturalWidth===0&&o(c.getAttribute("src"))},[o]);return{icon:n.find(c=>!t.includes(c)),onError:a,ref:s}}function Fi({context:e}){let{icon:n,onError:t,ref:r}=Ls(e);return e?.app.mark==="soba"?g(Me,{className:"sc-app-mark"}):n?g("img",{className:"sc-app-mark",src:n,alt:"","aria-hidden":"true",ref:r,onError:t}):null}function lr({context:e}){let{icon:n,onError:t,ref:r}=Ls(e),o=e?.app.mark==="soba";return T("span",{className:"sc-app",children:[o&&g(Me,{className:"sc-app-icon"}),!o&&n&&g("img",{className:"sc-app-icon",src:n,alt:"",ref:r,onError:t}),Is(e)]})}function tt({onClick:e}){return g("button",{type:"button",className:"sc-head-back",onClick:e,"aria-label":"Back",children:g("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M15 5 8 12l7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function uo({className:e}){return g("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M9 5l7 7-7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function cr({mark:e,still:n}){return T("span",{className:"sc-waiting","aria-hidden":"true",children:[!n&&g("svg",{className:"sc-waiting-orbit",viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:g("circle",{className:"sc-waiting-arc",cx:"50",cy:"50",r:"46"})}),g(e,{className:"sc-waiting-mark"})]})}function po({tone:e}){return g("span",{className:`sc-result sc-result-${e}`,"aria-hidden":"true",children:g(mn,{kind:e==="ok"?"snap":"gone",size:84})})}function zi({machine:e}){let{runtime:n}=Fe(e);if(!n)return null;let t=Ke(n);return T("div",{className:"sc-arrived",children:[g(Kr,{id:n.id,name:n.display_name}),g("span",{className:"sc-arrived-name",children:n.display_name}),T("span",{className:`sc-arrived-auth${t.tone==="warn"?" sc-tone-warn":""}`,children:[t.tone==="ok"&&g("i",{className:"sc-arrived-dot","aria-hidden":"true"}),t.tone==="ok"?"Signed in":t.tone==="warn"?"Signed out":"Could not tell"]})]})}function ur({done:e,title:n,line:t,children:r}){return T("li",{className:"sc-stall-step",children:[T("svg",{viewBox:"0 0 20 20",className:e?"sc-stall-ok":"sc-stall-open","aria-hidden":"true",children:[g("circle",{cx:"10",cy:"10",r:"9"}),e?g("path",{d:"M6 10.3 8.7 13 14 7.5"}):T(rt,{children:[g("path",{d:"M10 5.5v5.5"}),g("circle",{className:"sc-stall-pt",cx:"10",cy:"14.3",r:"1.2"})]})]}),g("span",{className:"sc-stall-title",children:n}),g("span",{className:"sc-stall-line",children:t}),r&&g("span",{className:"sc-stall-more",children:r})]})}function Vi({text:e}){return g(rt,{children:e.split("`").map((n,t)=>t%2===1?g("code",{className:"sc-inline-code",children:n},t):n)})}function Rt({k:e,v:n}){return T("li",{className:"sc-fact",children:[g("span",{className:"sc-fact-key",children:e}),g("span",{children:n})]})}import{forwardRef as Qi}from"react";import{jsx as fo,jsxs as ho}from"react/jsx-runtime";var go=Qi(function({machine:n,className:t,...r},o){if(!n)return null;let{ariaLabel:a,state:s}=Kn(n);return ho("button",{ref:o,type:"button","aria-label":a,className:["sc-btn","sc-btn-connected",t].filter(Boolean).join(" "),...r,children:[fo("span",{className:"sc-pill-tile","aria-hidden":"true",children:fo(mn,{kind:s.tone==="busy"?"serving":s.tone==="ok"?"ready":n.pairing_lost?"gone":"paused",size:16,className:"sc-pill-mark"})}),ho("span",{className:"sc-btn-connected-text",children:[s.word,!n.pairing_lost&&ho("span",{className:"sc-btn-connected-where",children:[" on ",le(n)]})]}),fo("i",{className:`sc-dot sc-dot-${s.tone}`,"aria-hidden":"true"})]})});function Os(e){if(e.type==="boolean")return e.name;if(e.type==="text")return`${e.name}: ${String(e.value??"").trim()}`;let n=e.unit?.trim()||e.name.toLowerCase();if(e.price){let r=Ji(e.price.amountMicros),o=n.endsWith("s")?n.slice(0,-1):n,a=e.price.included>0?`${e.price.included.toLocaleString("en-US")} ${n} included, then ${r} per ${o}`:`${r} per ${o}`;return e.value===null?a:`${a}, up to ${e.value.toLocaleString("en-US")}`}let t=e.resets==="month"?" a month":"";return e.value===null?`Unlimited ${n}${t}`:`${e.value.toLocaleString("en-US")} ${n}${t}`}var Ji=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD"});function dr(e){let n=[];for(let t of e??[])!t.name?.trim()&&!t.unit?.trim()||n.push({text:Os(t),included:!(t.type==="boolean"&&t.value!==!0)});return n}function bo(e,n,t=1){let r=e.quantities?.[n]??0,o=(i,l=null)=>({feature:n,allowed:!1,reason:i,limit:l,used:r,remaining:l===null?null:Math.max(0,l-r),unlimited:!1});if(e.features===null)return o("no_plan");if(e.ended)return o("plan_ended",0);if(!(n in e.features))return o("not_included");let a=e.features[n];if(typeof a=="string")return a.trim()?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(typeof a=="boolean")return a?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(a==null)return{feature:n,allowed:!0,reason:null,limit:null,used:r,remaining:null,unlimited:!0};let s=Math.max(0,t),c=Math.max(0,a-r);return a===0?o("not_included",0):r+s>a?o("limit_reached",a):{feature:n,allowed:!0,reason:null,limit:a,used:r,remaining:c,unlimited:!1}}import{useEffect as Yi,useRef as yo}from"react";var pr=0,Ao=null;function Ts(){if(typeof document>"u")return()=>{};pr===0&&(Ao=document.body.style.overflow,document.body.style.overflow="hidden"),pr+=1;let e=!1;return()=>{e||(e=!0,pr-=1,pr===0&&(document.body.style.overflow=Ao??"",Ao=null))}}import{jsx as Bs}from"react/jsx-runtime";function Pt({open:e,onClose:n,labelledBy:t,theme:r,style:o,children:a}){let s=yo(null),c=yo(null),i=yo(null);return Yi(()=>{let l=s.current;if(l){if(!e){l.open&&l.close();return}return l.open||l.showModal(),document.activeElement===l&&c.current?.focus(),Ts()}},[e]),Bs("dialog",{ref:s,className:"soba-connect sc-modal","aria-labelledby":t,...r?{"data-theme":r}:{},style:o,onCancel:l=>{l.preventDefault(),n()},onPointerDown:l=>{i.current=l.target},onClick:l=>{l.target===l.currentTarget&&i.current===l.currentTarget&&n()},children:Bs("div",{className:"sc-modal-sheet",ref:c,tabIndex:-1,children:a})})}import{useEffect as wo,useRef as ji}from"react";import{jsx as qi}from"react/jsx-runtime";var Dn=8;function vo({open:e,onClose:n,anchor:t,label:r,theme:o,style:a,children:s}){let c=ji(null);return wo(()=>{let i=c.current;if(!(!i||!(typeof i.showPopover=="function")))try{e?i.showPopover():i.hidePopover()}catch{}},[e]),wo(()=>{if(!e)return;let i=()=>{let d=c.current,h=t.current;if(!d||!h)return;let b=h.getBoundingClientRect(),y=d.offsetWidth,m=d.offsetHeight,v=window.innerWidth-y-Dn,A=Math.max(Dn,Math.min(b.right-y,Math.max(Dn,v))),k=b.bottom+Dn,S=b.top-Dn-m,W=k+m>window.innerHeight-Dn&&S>Dn?S:k;d.style.left=`${Math.round(A)}px`,d.style.top=`${Math.round(W)}px`};i();let l=requestAnimationFrame(i);return window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{cancelAnimationFrame(l),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[e,t]),wo(()=>{if(!e)return;let i=d=>{d.key==="Escape"&&n()},l=d=>{let h=d.target;h&&(c.current?.contains(h)||t.current?.contains(h)||n())};return document.addEventListener("keydown",i),document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("keydown",i),document.removeEventListener("pointerdown",l,!0)}},[e,n,t]),qi("div",{ref:c,role:"dialog","aria-label":r,className:"soba-connect sc-pop",...o?{"data-theme":o}:{},popover:"manual",hidden:!e,style:a,children:s})}var Et=new Map,ot=new Map,Gs=!1;function Zi(){Gs||typeof window>"u"||(Gs=!0,window.addEventListener("storage",e=>{!e.key||!Et.has(e.key)||(ot.set(e.key,ar(e.key)),ko(e.key))}))}function ko(e){for(let n of Et.get(e)??[])n()}function It(e){return e??""}function Co(e,n){let t=It(e);Zi();let r=Et.get(t)??new Set;return r.add(n),Et.set(t,r),()=>{r.delete(n),r.size===0&&Et.delete(t)}}function mr(e){let n=It(e),t=ot.get(n);if(t!==void 0)return t;let r=e?ar(e):null;return ot.set(n,r),r}function Mo(){return null}function No(e,n){mr(e)===null&&(ot.set(It(e),n),ko(It(e)))}function xo(e,n){let t=It(e);ot.get(t)!==n&&(ot.set(t,n),oo(e,n),ko(t))}var Xi=e=>e.toLocaleString("en-US");function Oe(e,n){if(e==="cost")return`${(n/1e4).toLocaleString("en-US",{style:"currency",currency:"USD"})} of usage`;let t=e==="token"?"token":e;return`${Xi(n)} ${t}${n===1?"":"s"}`}function Hn(e){return e==="token"?"1M tokens":e==="cost"?"$1 of usage":e==="credit"?"1,000 credits":e}function Lt(e){return e==="cost"?"usage":`${e}s`}function Ot(e,n,t){let r=t?.trim();if(!r||e!=="run"&&e!=="task"&&e!=="message")return Oe(e,n);let o=r.endsWith("s")?r.slice(0,-1):r;return`${n.toLocaleString("en-US")} ${n===1?o:r}`}function sn(e){return e.reward==="included"&&e.includedUnits!==null?`${Oe(e.unit,e.includedUnits)} a month once you connect`:e.reward==="credit"&&e.creditMicros>0?`${Ki(e.creditMicros)} back each month you stay connected`:null}function an(e){return e==="included"}function Un(e){if(!e.routePrefer.some(t=>So.has(t)||t==="user-api-key"))return null;let n=e.ownUnit??e.unit;return e.ownIncludedUnits===null?e.includedUnits!==null?`Unlimited ${n==="cost"?"usage":(n==="run"||n==="task")&&e.taskNoun?.trim()?e.taskNoun.trim():`${n}s`} on your own AI`:null:`${Ot(n,e.ownIncludedUnits,e.taskNoun)} a month on your own AI`}var So=new Set(["user-hardware","user-subscription"]),Ws=new Set(["open-weights","frontier"]);function Ve(e){return e===null||e.length===0?!1:e.every(n=>So.has(n))}var Ki=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function Ro(e,n){if(!(n===null||n.some(a=>Ws.has(a))))return!1;let r=e.findIndex(a=>So.has(a));if(r===-1)return!1;let o=e.findIndex(a=>Ws.has(a));return o===-1||r<o}import{createContext as Ds,useContext as Hs}from"react";var Po=Ds(null);function wn(){return Hs(Po)}var Eo=Ds({context:null,machines:void 0,theme:"light"});function _(){return Hs(Eo)}import{useMemo as el}from"react";import{createContext as _i,useContext as $i}from"react";var Io=_i(null);function K(){let e=$i(Io);if(!e)throw new Error("useSoba() must be used inside a <SobaProvider>.");return e}function Tt(){let{compute:e}=K();return el(()=>{let n=e.machines,t=[...n].sort((a,s)=>_e([a,s])===a?-1:1).map(nl),r=_e([...n]),o=In(n);return{view:t.length?"machines":e.loading?"loading":e.error?"error":"empty",machines:t,primary:r?t.find(a=>a.machine.id===r.id)??null:null,connected:e.connected,online:e.online,stalled:e.connected&&!e.online&&o?t.find(a=>a.machine.id===o.id)??null:null,loading:e.loading,error:e.error,refresh:e.refresh}},[e])}function nl(e){let n=Fe(e);return{machine:e,name:le(e),state:Ln(e),status:Mr(e),hardware:gt(e),lastSeen:e.state==="offline"?bt(e.last_seen_at):null,runtimes:we(e).map(t=>({runtime:t,name:t.display_name,auth:Ke(t),quarantined:!!t.quarantined})),runsOn:{by:n.by,name:n.runtime?.display_name??null}}}import{useCallback as Lo,useEffect as tl,useMemo as Qe,useSyncExternalStore as rl}from"react";function Fn(e={}){let{compute:n,connect:t,models:r}=K(),{value:o,onChange:a,defaultValue:s,remember:c=!0,user:i}=e,l=e.layout??(e.choices?.length?"choices":r.layout??"providers"),d=JSON.stringify(e.choices??[]),h=o!==void 0,b=c&&!h?ro(t.publishableKey,i):null,y=Lo(P=>Co(b,P),[b]),m=rl(y,Lo(()=>mr(b),[b]),Mo),v=Qe(()=>r.rowsByLayout[l]??(r.sizes===!1?{auto:!0,fast:!1,best:!1}:void 0),[r.rowsByLayout,r.sizes,l]),A=Qe(()=>Tr(wt(n.machines,r.providers,r.names,r.route?.allow),v),[n.machines,r.providers,r.names,r.route,v]),k=Qe(()=>Or(A,l,JSON.parse(d)),[A,l,d]),S=Qe(()=>Br(k,l,v),[k,l,v]),W=l==="models"&&v?.own===!0,L=Qe(()=>vt(S,l,W),[S,l,W]),D=Qe(()=>[...A,...k.filter(P=>!A.some(q=>q.id===P.id))],[A,k]),O=Qe(()=>{let P=[];for(let V of[...n.machines].sort(Xn))for(let Z of we(V)){if(P.some(Y=>Y.id===Z.id)||r.route&&!r.route.allow.includes(Z.cost_class))continue;let be=$e[Z.id];P.push({id:Z.id,name:Z.display_name,...be?{logo:be}:{},options:S.filter(Y=>Y.kind==="named"&&Y.runtime===Z.id)})}let q=L.flatMap(V=>V.options.map(Z=>Z.id));for(let V of P)V.options.sort((Z,be)=>q.indexOf(Z.id)-q.indexOf(be.id));return P},[n.machines,S,L,r.route]),U=Qe(()=>r.providers.map(P=>{let q=`@${P.id}/`;return{id:P.id,name:P.name,...P.provider?{mark:P.provider}:{},costClass:P.cost_class,...P.locked?{locked:P.locked}:{},options:A.filter(V=>V.id.startsWith(q))}}),[r.providers,A]);tl(()=>{h||!s||No(b,s)},[h,s,b]);let w=Qe(()=>{let P=r.names.find(q=>q.default);if(P&&l==="choices")return`alias:${P.alias}`;for(let q of r.providers){let V=q.models.find(Z=>Z.default);if(V&&l!=="choices")return`@${q.id}/${V.model}`}return null},[r.names,r.providers,l]),$=h?o:l==="automatic"?s??null:m??s??w,j=Qe(()=>S.some(P=>P.kind==="auto")?null:L.flatMap(P=>P.options).find(P=>!P.locked)?.id??null,[S,L]),ee=!$||$==="auto"?j??$:$,{selected:ae,unavailable:me}=Qe(()=>Gr(D,ee??null),[D,ee]),fe=Lo(P=>{h||xo(b,P),a?.(P)},[h,b,a]);return{options:S,groups:L,selected:ae,select:fe,agents:O,providers:U,models:A.filter(P=>P.kind==="provider"),choices:S.filter(P=>P.choice!==void 0),layout:l,ownInList:W,search:v?.search!==!1,run:Wr(ae),unavailable:me,pickable:gn(S),loading:n.loading&&!n.machines.length||r.loading&&!r.providers.length&&!n.machines.length}}function ol(e){return e.runtime?$e[e.runtime]:void 0}import{jsx as Bt}from"react/jsx-runtime";function sl({className:e}){let{theme:n}=_(),t=e?`soba-connect ${e}`:"soba-connect";return Bt("div",{className:t,"data-theme":n,children:Bt(Oo,{})})}function Oo(){let e=Tt(),n=Fn();return e.view==="loading"?Bt("p",{className:"sc-note",children:"Loading\u2026"}):e.view==="error"?Bt("p",{className:"sc-error",children:e.error?.message}):Bt(_r,{machines:e.machines.map(t=>t.machine),model:n.selected,onPickModel:n.select})}import{useCallback as Wt,useEffect as Wo,useMemo as ml,useRef as Do,useState as at}from"react";import{useId as al}from"react";import{jsx as st,jsxs as fr}from"react/jsx-runtime";function Gt({open:e,onOpenChange:n,initialCode:t,onConnected:r,showStatus:o,reason:a}){let{error:s}=K(),c=wn(),i=_(),l=()=>n(!1),d=al(),h=i.context?.background?.trim(),b=h?En(h,i.context?.accent):void 0;return fr(Pt,{open:e,onClose:l,labelledBy:d,theme:i.theme,style:b,children:[s?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"Could not start"}),st("p",{className:"sc-error",children:s.message})]}):!c&&!i.context?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"One moment"}),st("p",{className:"sc-note",children:"Getting your compute\u2026"})]}):st(mo,{client:c,active:e,onClose:l,headingId:d,theme:i.theme,initialContext:i.context,...i.machines!==void 0?{initialMachines:i.machines}:{},...t?{initialCode:t}:{},...r?{onConnected:r}:{},...o===void 0?{}:{showStatus:o},...a?{reason:a}:{}}),fr("p",{className:"sc-modal-foot",children:[st(Me,{className:"sc-foot-mark"}),"Secured by Soba"]})]})}import{forwardRef as il}from"react";import{jsx as ll}from"react/jsx-runtime";var To=il(function(n,t){let{theme:r}=_();return ll(go,{ref:t,"data-theme":r,...n})});import{useCallback as cl}from"react";function ul(){let{connect:e}=K(),n=Tt(),t=cl(()=>e.open("manual"),[e]);return{...Kn(n.primary?.machine??null),machine:n.primary,open:t,canOpen:e.hasModal,loading:n.view==="loading"}}function Bo(e){return Kn(e)}import{useCallback as Us,useEffect as dl,useState as pl}from"react";function Go({enabled:e=!0,intervalMs:n=3e3}={}){let t=wn(),[r,o]=pl(null),a=Us(async()=>{t&&o(await t.runs())},[t]);dl(()=>{if(!e||!t)return;let c=!0,i=He(async()=>{let l=await t.runs();c&&o(l)},n);return()=>{c=!1,i()}},[e,t,n]);let s=Us(async c=>{if(!t)throw new Error("Stopping a run needs <SobaProvider>.");await t.stopRun(c),await a().catch(()=>{})},[t,a]);return{runs:r,refresh:a,stop:s}}import{Fragment as Fs,jsx as it,jsxs as zs}from"react/jsx-runtime";function zn({children:e,variant:n,className:t,initialCode:r,onConnected:o,defaultOpen:a,open:s,onOpenChange:c,showConnected:i=!0}){let{compute:l,connect:d}=K(),h=_(),{theme:b}=h,y=wn(),[m,v]=at(a??!!r),A=Do(null),k=s!==void 0,S=!k&&!a&&!r&&d.hasModal,W=k?s:S?d.isOpen:m,L=N=>{S?N?d.open("manual"):d.close():k||v(N),c?.(N)},D=Do(W);Wo(()=>{D.current&&!W&&A.current?.focus(),D.current=W},[W]);let[O,U]=at(!1),{runs:w,stop:$}=Go({enabled:O}),j=Fn(),ee=ml(()=>O&&w?fl(l.machines,w):l.machines,[l.machines,O,w]),ae=_e(ee),me=i&&Bo(ae).connected,fe=Wt(()=>U(!1),[]),[P,q]=at(!1),V=Wt(async()=>{q(!0);try{await l.refresh()}finally{q(!1)}},[l]),Z=Do(V);Z.current=V,Wo(()=>{O&&Z.current()},[O]);let[be,Y]=at(!1),[he,Ae]=at([]),Te=!!h.context?.hosted_available;Wo(()=>{if(!O||!y||!Te)return;let N=!0;return y.hosted().then(H=>{N&&Ae(H.credentials)}).catch(()=>{}),()=>{N=!1}},[O,y,Te]);let[Pe,ne]=at(null),de=Wt(async(N,H)=>{if(y){ne(null);try{await y.approveRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),u=Wt(async(N,H)=>{if(y){ne(null);try{await y.preferRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),R=Wt(async N=>{if(y){ne(null);try{await y.disconnectHosted(N),Ae((await y.hosted()).credentials)}catch(H){ne(H.message)}}},[y]),I=h.context?.background?.trim(),J=I?En(I,h.context?.accent):void 0,B=me&&!e,te=()=>{if(B&&!k&&!a&&!r){U(N=>!N);return}L(!0)};return zs(Fs,{children:[B?it(To,{ref:A,machine:ae,"aria-haspopup":"dialog","aria-expanded":O,onClick:te,...t?{className:t}:{}}):it("button",{ref:A,type:"button","data-theme":b,className:["sc-btn","sc-btn-icon",n==="primary"?"sc-btn-primary":"",t].filter(Boolean).join(" "),onClick:te,children:e??zs(Fs,{children:[it(Me,{className:"sc-btn-mark"}),"Connect compute"]})}),it(vo,{open:O,onClose:fe,anchor:A,label:"Your compute",theme:b,...J?{style:J}:{},children:it(Wn,{machines:ee,hosted:he,onApproveRuntime:(N,H)=>void de(N,H),onPreferRuntime:(N,H)=>void u(N,H),onDisconnectHosted:N=>void R(N),onRefresh:()=>void V(),refreshing:P,model:j.selected,onPickModel:j.select,error:Pe,runs:w,onStopRun:async N=>{ne(null);try{await $(N)}catch(H){throw ne(H.message),H}},onPair:()=>{U(!1),S?d.open("pair"):(Y(!0),L(!0))},...h.context?.app.name?{appName:h.context.app.name}:{}})}),!S&&it(Gt,{open:W,onOpenChange:N=>{N||Y(!1),L(N)},...be?{showStatus:!1}:{},...r?{initialCode:r}:{},...o?{onConnected:o}:{}})]})}function fl(e,n){return e.map(t=>{if(t.state==="offline")return t;let r=n.filter(o=>o.machine_id===t.id).length;return{...t,active:r,state:r>0?"busy":"online"}})}import{jsx as Ho,jsxs as gl}from"react/jsx-runtime";function hl({initialCode:e,onConnected:n,className:t,showStatus:r=!0}){let{theme:o}=_();return gl("div",{className:t?`soba-connect ${t}`:"soba-connect","data-theme":o,children:[r&&Ho(Oo,{}),Ho("div",{className:"sc-compute-act",children:Ho(zn,{...e?{initialCode:e}:{},...n?{onConnected:n}:{}})})]})}import{useId as Rl,useState as Pl}from"react";import{useCallback as Fo,useEffect as js,useState as qs}from"react";import{useCallback as bl,useState as Al}from"react";function Dt(){let[e,n]=Al(null);return{open:bl(()=>{n(null),Tn().then(n)},[]),launch:e,note:e==="absent"?"Nothing opened here. That machine may be a different computer, or asleep.":null}}import{useCallback as Vs,useMemo as Qs}from"react";function Vn(e){if(!e)return null;if(typeof e=="string")return e;if(typeof Response<"u"&&e instanceof Response)return Js(e.status);let n=e,t=n.error;return typeof t?.code=="string"?t.code:typeof t?.type=="string"?t.type:typeof n.code=="string"?n.code:typeof n.status=="number"?Js(n.status):n.cause&&n.cause!==e?Vn(n.cause):null}function Js(e){return e===402?"payment_required":e===409?"no_compute":null}function Uo(...e){let[n,t]=e,{plan:r,compute:o,connect:a}=K(),s=t?.predict??e.length===0,c=wl(yl(n),o)??(s?vl(r,o):null),i=r.plan,l=r.plans,d=Qs(()=>{if(c!=="payment_required")return null;let m=i?.price??0,v=i?.included_units??0;return l.find(A=>A.id!==i?.id&&A.price>m&&(A.included_units===null||A.included_units>v))??null},[c,l,i]),h=Vs(async()=>{if(!d)return;if(d.selectable){await r.select(d.id);return}let m=await r.checkout(d.id);window.location.assign(m)},[d,r]),b=a.open,y=Vs(()=>{c&&b(c)},[b,c]);return Qs(()=>{if(!c)return null;let m=i?sn({unit:i.unit,reward:i.connected_reward,includedUnits:i.connected_included_units,creditMicros:i.connected_credit*1e6}):null,v=i?an(i.connected_reward)?m:Un({unit:i.unit,ownUnit:i.own_unit??null,includedUnits:i.included_units,ownIncludedUnits:i.own_included_units??null,routePrefer:i.route_prefer}):null;return{reason:c,...kl(c,{connectOffer:v,connected:o.connected,online:o.online,machine:In(o.machines)?.label??null,unit:i?.unit??"message",interval:i?.interval??"month",upgrade:d!==null,resets:r.current?.period_end??null}),connectOffer:v,upgradeTo:d,connect:y,upgrade:h}},[c,i,o,d,y,h,r.current?.period_end])}function yl(e){let n=Vn(e);return n==="payment_required"||n==="no_compute"?n:null}function wl(e,n){return e==="no_compute"&&n.connected&&n.online?null:e}function vl(e,n){let t=e.plan;return!t||n.loading?null:Ve(t.route_allow)&&!n.online?"no_compute":e.remaining===0&&t.overage==="stop"?"payment_required":null}function kl(e,n){if(e==="payment_required"){let t=`No ${Lt(n.unit)} left this ${n.interval}`;return n.connectOffer&&!n.connected?{title:t,body:`${n.connectOffer}. Connecting takes a minute and costs nothing.`}:n.connectOffer&&!n.online?{title:t,body:`${n.connectOffer}. Waking ${n.machine??"your machine"} is enough.`}:n.upgrade?{title:t,body:n.resets?`A larger plan carries on now. This one comes back on ${Ys(n.resets)}.`:"A larger plan carries on now, or wait for this one to renew."}:{title:t,body:n.resets?`Your allowance comes back on ${Ys(n.resets)}.`:"Your allowance comes back at the start of the next period."}}return n.connected&&!n.online?{title:`${n.machine??"Your machine"} can't be reached`,body:"This run needs it awake and connected. Open Soba on that machine, or connect another one."}:{title:"Nothing connected yet",body:"This app runs on AI you already pay for, on a machine of your own. Connect one and this run has somewhere to go."}}function Ys(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function Cl(e){let{plan:n,allowance:t,connected:r,online:o,quiet:a,error:s,predict:c,at:i,waved:l}=e;if(!n)return null;let d=e.allow!==void 0?e.allow:n.route_allow;if(r){if(o)return null;let v=Ve(d);return{reason:"stalled",title:`${a??"Your machine"} can\u2019t be reached`,detail:v?"The Soba app there has stopped reporting in, so runs have nowhere to go until it is back.":"The Soba app there has stopped reporting in, so nothing will run on your own AI until it is back.",meter:null,dismissible:!1,atTheWall:!1,ownCompute:v}}let h=Vn(s),b=h==="payment_required"||h==="no_compute",y=n.ask_to_connect!==!1&&Ro(n.route_prefer,d);if(!c&&!b&&!y)return null;let m=Ve(d)?Ml(n.unit,Ve(n.route_allow)):an(n.connected_reward)||Zs(n,t.included)!==null?xl(t,n,i):y?Nl(n.unit):null;return!m||m.dismissible&&l?null:{...m,dismissible:!!m.dismissible,ownCompute:!1,atTheWall:!m.dismissible&&(!c||m.meter!==null&&m.meter.left===0)}}function zo(e={}){let{at:n=.25,error:t,allow:r}=e,o=e.predict??!(e.errorGiven??t!==void 0),{plan:a,compute:s,connect:c}=K(),i=so(c.publishableKey),[l,d]=qs(!1);js(()=>{d(ao(i))},[i]);let h=Fo(()=>{d(!0),io(i)},[i]),b=Fo(()=>c.open("manual"),[c]),y=Fo(()=>c.open("no_compute"),[c]),m=Dt(),[v,A]=qs(!1),{refresh:k}=s,{launch:S}=m;js(()=>{if(S===null||S==="absent")return;A(!1);let U=setInterval(()=>void k(),3e3),w=setTimeout(()=>{clearInterval(U),A(!0)},2e4);return()=>{clearInterval(U),clearTimeout(w)}},[S,k]);let W=Sl(c.app?.name,St(c.connectUrl)),L=a.loading||s.loading,D=In(s.machines),O=L?null:Cl({plan:a.plan,allowance:{remaining:a.remaining,included:a.included},connected:s.connected,online:s.online,quiet:D?le(D):null,error:t,predict:o,...r!==void 0?{allow:r}:{},at:n,waved:l});return{reason:O?.reason??null,visible:O!==null,title:O?.title??null,detail:O?.detail??null,meter:O?.meter??null,dismissible:O?.dismissible??!1,dismissed:l,dismiss:h,open:b,atTheWall:O?.atTheWall??!1,steps:W,stalled:O?.reason==="stalled"?{machine:D?le(D):null,ownCompute:O.ownCompute,wake:m.open,launch:m.launch,note:m.note,stuck:v,connectAnother:y}:null,loading:L}}function Ml(e,n){return{reason:"needed",title:n?"This plan runs on your own AI.":`These ${e}s run on your own AI.`,detail:`Connect a machine and your ${e}s run there, free, on access you already have.`,meter:null}}function Nl(e){return{reason:"preferred",title:"This plan prefers your own AI.",detail:`Connect a machine and your ${e}s run there instead, on access you already have.`,meter:null,dismissible:!0}}function Zs(e,n){return Un({unit:e.unit,ownUnit:e.own_unit??null,includedUnits:n,ownIncludedUnits:e.own_included_units??null,routePrefer:e.route_prefer})}function xl(e,n,t){let{remaining:r,included:o}=e;if(r===null||o===null||o===0||r>Math.ceil(o*t))return null;let a=sn({unit:n.unit,reward:n.connected_reward,includedUnits:n.connected_included_units,creditMicros:n.connected_credit*1e6})??Zs(n,o);return a?{reason:"running",title:r===0?`No ${Lt(n.unit)} left this month.`:`${Oe(n.unit,r)} left this month.`,detail:`${a}.`,meter:{left:r,of:o}}:null}function Sl(e,n){return[{lead:"Download Soba",detail:"",...n?{linksLead:"Get it for"}:{},links:n?xt.map(t=>({label:t.label,href:`${n}/download/${t.slug}`})):[]},{lead:"Connect compute",detail:"Press this, then approve the pairing when the app asks.",opens:!0,links:[]},{lead:"Let your AIs serve",detail:`It finds what is installed on that machine. Allow one, and ${e??"this app"} sends every run there.`,linksLead:"Nothing on it yet?",links:Ie.map(t=>({label:t.short,href:t.install}))}]}import{Fragment as Ks,jsx as re,jsxs as vn}from"react/jsx-runtime";function El(e){let{className:n,fallback:t=null}=e,r=zo({...e.at===void 0?{}:{at:e.at},...e.predict===void 0?{}:{predict:e.predict},...e.allow===void 0?{}:{allow:e.allow},error:e.error,errorGiven:"error"in e}),{connect:o}=K(),{theme:a}=_(),[s,c]=Pl(null),i=Rl(),l=re(Ks,{children:t});if(!r.visible)return l;if(r.stalled)return re(Xs,{className:n,theme:a,stalled:!0,children:re(Il,{title:r.title??"",detail:r.detail??"",stalled:r.stalled})});let d=s??r.atTheWall;return vn(Xs,{className:n,theme:a,children:[vn("div",{className:"sc-nudge-top",children:[vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:r.title}),re("p",{className:"sc-nudge-detail",children:r.detail}),vn("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more","aria-expanded":d,"aria-controls":i,onClick:()=>c(!d),children:[d?"Hide the details":"How it works",re(Ol,{})]})]}),r.dismissible?re("button",{type:"button",className:"sc-nudge-dismiss","aria-label":"Dismiss",title:"Dismiss",onClick:r.dismiss,children:re(Ll,{})}):null]}),d?re("ol",{className:"sc-nudge-steps",id:i,children:r.steps.map(h=>vn("li",{children:[h.opens?re("button",{type:"button",className:"sc-step-lead",onClick:()=>o.open("manual"),children:h.lead}):re("strong",{children:h.lead}),h.detail?re("span",{children:h.detail}):null,h.links.length>0?vn("span",{className:"sc-step-links",children:[h.linksLead,h.links.map(b=>re("a",{href:b.href,target:"_blank",rel:"noreferrer noopener",children:b.label},b.href))]}):null]},h.lead))}):null,re(zn,{variant:"primary"})]})}function Xs({className:e,theme:n,stalled:t,children:r}){return re("div",{className:e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill","data-theme":n,children:re("div",{className:t?"sc-nudge sc-nudge-stalled":"sc-nudge",children:r})})}function Il({title:e,detail:n,stalled:t}){return vn(Ks,{children:[re("div",{className:"sc-nudge-top",children:vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:e}),re("p",{className:"sc-nudge-detail",children:n}),t.note&&re("p",{className:"sc-nudge-note",children:t.note}),t.stuck&&re("p",{className:"sc-nudge-note",children:"The Soba app is open, but this machine still isn\u2019t reporting in. It may no longer be connected to this app."}),(t.launch==="absent"||t.stuck)&&re("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more",onClick:t.connectAnother,children:t.stuck?"Connect it again":"Connect another machine"})]})}),re("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:t.wake,children:"Open Soba"})]})}function Ll(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-x",children:re("path",{d:"m4.8 4.8 6.4 6.4M11.2 4.8l-6.4 6.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function Ol(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-chev",children:re("path",{d:"M4.5 6.5 8 10l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}var Tl=new Set(["delta","thinking","status","done","error"]);function lt(e){let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!="object")return null;let t=n,r=t.type==="event"?t.event:t;if(!r||typeof r!="object")return null;let o=r;if(typeof o.type!="string"||!Tl.has(o.type))return null;let a={type:o.type};return typeof o.text=="string"&&(a.text=o.text),typeof o.message=="string"&&(a.message=o.message),typeof o.tool=="string"&&(a.tool=o.tool),typeof o.tier=="string"&&(a.tier=o.tier),o.usage&&typeof o.usage=="object"&&(a.usage=o.usage),typeof o.session=="string"&&(a.session=o.session),typeof o.toolInput=="string"&&(a.toolInput=o.toolInput),o.git&&typeof o.git=="object"&&(a.git=o.git),o.turn&&typeof o.turn=="object"&&typeof o.turn.text=="string"&&(a.turn={text:o.turn.text}),typeof o.reason=="string"&&(a.reason=o.reason),typeof o.retryable=="boolean"&&(a.retryable=o.retryable),(o.state==="interrupted"||o.state==="resumed")&&(a.state=o.state),a}async function*Vo(e){let n=e.body;if(!n)throw new Error("That run response had no body to stream.");let t=(e.headers.get("content-type")??"").includes("ndjson"),r=n.getReader(),o=new TextDecoder,a="",s=[];try{for(;;){let i=await r.read();if(i.done)break;for(a+=o.decode(i.value,{stream:!0});;){let l=a.indexOf(`
3
- `);if(l===-1)break;let d=$s(a.slice(0,l));if(a=a.slice(l+1),t){let h=d.trim()?lt(d):null;h&&(yield h);continue}if(d===""){let h=s.join(`
4
- `);if(s=[],h==="[DONE]")return;let b=h?lt(h):null;b&&(yield b);continue}_s(d,s)}}!t&&a&&_s($s(a),s);let c=t?a.trim():s.join(`
5
- `);if(c&&c!=="[DONE]"){let i=lt(c);i&&(yield i)}}finally{r.cancel().catch(()=>{})}}function _s(e,n){if(!e||e.startsWith(":"))return;let t=e.indexOf(":");if(t===-1||e.slice(0,t)!=="data")return;let r=e.slice(t+1);n.push(r.startsWith(" ")?r.slice(1):r)}function $s(e){return e.endsWith("\r")?e.slice(0,-1):e}async function Bl(e){let n="";for await(let t of e)if(t.type==="delta"&&t.text&&(n+=t.text),t.type==="error")throw new Error(t.message??"The run ended with an error.");return n}import{jsx as ea}from"react/jsx-runtime";function Gl({caption:e,disabled:n,className:t,...r}){let{theme:o}=_(),{options:a,selected:s,select:c,pickable:i,layout:l,ownInList:d,search:h}=Fn(r),b=K().connect.app;return i?ea("span",{className:"soba-connect sc-inline","data-theme":o,children:ea(Mt,{options:a,layout:l,ownInList:d,search:h,selected:s,onPick:c,...b?.name?{appName:b.name}:{},...e?{caption:e}:{},...n?{disabled:n}:{},...t?{className:t}:{}})}):null}import{jsx as Dl}from"react/jsx-runtime";function Wl(e){return Dl(Bn,{...e})}import{useState as Ul}from"react";import{useCallback as Hl,useState as Qo}from"react";function Jo(){let e=wn(),{plan:n}=K(),[t,r]=Qo(!1),[o,a]=Qo(null),[s,c]=Qo(null);return{redeem:Hl(async l=>{if(!e)return a("No session yet."),null;r(!0),a(null);try{let{reward:d}=await e.redeemCode(l);return c(d),await n.refresh(),d}catch(d){return a(d.message),null}finally{r(!1)}},[e,n]),busy:t,error:o,reward:s}}import{jsx as hr,jsxs as na}from"react/jsx-runtime";function Fl(e){return e.kind==="discount"?`${e.name} applied. It comes off at checkout.`:e.kind==="grant"?`${e.name} applied. The extra usage is yours now.`:`${e.name} applied. You're on it now.`}function zl({label:e="Apply",placeholder:n="Promo code",onRedeemed:t,className:r}){let{theme:o}=_(),{redeem:a,busy:s,error:c,reward:i}=Jo(),[l,d]=Ul(""),h=async()=>{if(!l.trim()||s)return;let b=await a(l);b&&(d(""),t?.(b))};return na("div",{className:r?`soba-connect ${r}`:"soba-connect","data-theme":o,children:[na("form",{className:"sc-redeem",onSubmit:b=>{b.preventDefault(),h()},children:[hr("input",{className:"sc-input",value:l,onChange:b=>d(b.target.value),placeholder:n,"aria-label":n,autoComplete:"off",spellCheck:!1}),hr("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:s||!l.trim(),children:s?"Checking\u2026":e})]}),c&&hr("p",{className:"sc-error",children:c}),!c&&i&&hr("p",{className:"sc-note",children:Fl(i)})]})}import{useEffect as Vl}from"react";var ta="data-soba-react",ra=!1;function Ht(){if(ra||typeof document>"u"||(ra=!0,document.querySelector(`style[${ta}]`)))return;let e=document.createElement("style");e.setAttribute(ta,""),e.textContent=`.soba-connect {
2
+ var wr={ready:{arc:!0},serving:{arc:!0,slot:"stream"},paused:{arc:!1,slot:"zzz"},thinking:{arc:!1,slot:"dots"},connecting:{arc:!1,slot:"orbit"},attention:{arc:!1,slot:"bang"},gone:{arc:!1,slot:"cross"},snap:{arc:!1,slot:"snap"},listening:{arc:!1,slot:"bars"},permission:{arc:!1,slot:"ring"},ai:{arc:!1,slot:"sparks"}};var vr="105 162 420 420",kr="M407.1 308.9 A158 158 0 1 0 407.1 491.1 A116 116 0 0 1 407.1 308.9 Z",Pn="M448.5 320 A110 110 0 0 1 448.5 480";import{Fragment as mt,jsx as F,jsxs as fn}from"react/jsx-runtime";function mn({kind:e,size:n=44,className:t}){let r=wr[e];return fn("svg",{className:`bx${t?` ${t}`:""}`,"data-expression":e,viewBox:vr,overflow:"visible",width:n,height:n,"aria-hidden":"true",children:[F("path",{d:kr,fill:"currentColor"}),F("path",{className:"bx-arc",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),r.slot==="stream"&&F(Ma,{}),r.slot==="zzz"&&F(Na,{}),r.slot==="dots"&&F(xa,{}),r.slot==="bang"&&F(Sa,{}),r.slot==="orbit"&&F(Ra,{}),r.slot==="cross"&&F(Pa,{}),r.slot==="snap"&&F(Ea,{}),r.slot==="bars"&&F(Ia,{}),r.slot==="ring"&&F(La,{}),r.slot==="sparks"&&F(Oa,{})]})}function Ma(){return F("path",{className:"bx-st",d:"M475.3 290.3 A150 150 0 0 1 475.3 509.7",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"0.1 31"})}function Na(){return fn(mt,{children:[F("g",{className:"bx-z1",children:F("path",{d:"M444 372 H496 L444 436 H496",fill:"none",stroke:"currentColor",strokeWidth:"20",strokeLinecap:"round",strokeLinejoin:"round"})}),F("g",{className:"bx-z2",children:F("path",{d:"M492 300 H522 L492 338 H522",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function xa(){return fn(mt,{children:[F("circle",{className:"bx-th",cx:"463.1",cy:"336.9",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th2",cx:"483",cy:"400",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th3",cx:"463.1",cy:"463.1",r:"21",fill:"currentColor"})]})}function Sa(){return fn("g",{className:"bx-at",children:[F("line",{x1:"490",y1:"312",x2:"490",y2:"414",stroke:"currentColor",strokeWidth:"46",strokeLinecap:"round"}),F("circle",{cx:"490",cy:"484",r:"28",fill:"currentColor"})]})}function Ra(){return fn("g",{className:"bx-ob",children:[F("path",{d:Pn,fill:"none",stroke:"var(--tile-bg, transparent)",strokeWidth:41,strokeLinecap:"round"}),F("path",{d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})]})}function Pa(){return fn(mt,{children:[F("path",{className:"bx-xa",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),F("g",{className:"bx-xx",children:F("path",{d:"M442 364 L514 436 M514 364 L442 436",fill:"none",stroke:"currentColor",strokeWidth:"24",strokeLinecap:"round"})})]})}function Ea(){return F("path",{className:"bx-snap",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})}function Ia(){return fn("g",{stroke:"currentColor",strokeWidth:"17",strokeLinecap:"round",children:[F("line",{className:"bx-vb",x1:"452",y1:"370",x2:"452",y2:"430"}),F("line",{className:"bx-vb bx-vb2",x1:"482",y1:"330",x2:"482",y2:"470"}),F("line",{className:"bx-vb bx-vb3",x1:"512",y1:"355",x2:"512",y2:"445"})]})}function La(){return F(mt,{children:[[450,366],[474,376],[484,400],[474,424],[450,434],[426,424],[416,400],[426,376]].map(([n,t],r)=>F("circle",{className:"bx-w",cx:n,cy:t,r:"11",fill:"currentColor",style:{animationDelay:`${-1.2+r*.15}s`}},r))})}function Oa(){return fn(mt,{children:[F("g",{className:"bx-sp",children:F("path",{d:"M460 300 Q465.4 324.6 490 330 Q465.4 335.4 460 360 Q454.6 335.4 430 330 Q454.6 324.6 460 300 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp2",children:F("path",{d:"M486 356 Q493.92 392.08 530 400 Q493.92 407.92 486 444 Q478.08 407.92 442 400 Q478.08 392.08 486 356 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp3",children:F("path",{d:"M460 440 Q465.4 464.6 490 470 Q465.4 475.4 460 500 Q454.6 475.4 430 470 Q454.6 464.6 460 440 Z",fill:"currentColor"})})]})}var is={"claude-code":{small:"haiku",large:"opus"}};function ls(e){return e==="small"||e==="large"}function cs(e,n){return is[e]?.[n]}function Zt(e){let n=is[e];return!!(n?.small||n?.large)}var nu=512*1024;import{useEffect as ks,useRef as ui,useState as $n}from"react";var Zn=class extends Error{status;constructor(n,t){super(n),this.name="ConnectError",this.status=t}},Ta=5*6e4,ft=class{session;baseUrl;doFetch;lastMachines=null;lastModelOptions=null;machinesUrl=null;gatewayBackUntil=0;constructor(n){this.session=n.session,this.baseUrl=(n.baseUrl??"").replace(/\/+$/,""),this.doFetch=n.fetchImpl??fetch.bind(globalThis)}async context(){let n=await this.request("GET","/v1/connect");return this.setMachinesUrl(n.machines_url),n}setMachinesUrl(n){typeof n=="string"&&/^https?:\/\//.test(n)&&(this.machinesUrl=n)}async machines(){let n=this.lastMachines,t=n?`?v=${encodeURIComponent(n.version)}`:"",r;if(this.machinesUrl&&Date.now()>=this.gatewayBackUntil)try{r=await this.request("GET",`${this.machinesUrl}${t}`)}catch(a){if(a instanceof Zn&&a.status===401)throw a;this.gatewayBackUntil=Date.now()+Ta}if(r??=await this.request("GET",`/v1/machines${t}`),r.unchanged&&n)return n.machines;let o=Array.isArray(r.machines)?r.machines:[];return this.lastMachines=typeof r.version=="string"?{version:r.version,machines:o}:null,o}async modelOptions(){let n=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!n)return null;let t=this.lastModelOptions,r=t?`?v=${encodeURIComponent(t.version)}`:"",o=await this.request("GET",`${n}/v1/model-options${r}`);if(o.unchanged&&t)return t.options;let a={route:o.route??{allow:[],prefer:[]},providers:Array.isArray(o.providers)?o.providers:[],names:Array.isArray(o.names)?o.names:[],layout:o.layout??"providers"};return this.lastModelOptions=typeof o.version=="string"?{version:o.version,options:a}:null,a}async runs(){let n=await this.request("GET","/v1/machines/runs");return Array.isArray(n.runs)?n.runs:[]}async stopRun(n){let t=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!t)throw new Zn("This page can't stop runs yet: it hasn't been told where Soba's gateway is.",501);await this.request("POST",`${t}/v1/runs/${encodeURIComponent(n)}/stop`,{})}lookup(n){return this.request("GET",`/v1/device/lookup?code=${encodeURIComponent(n)}`)}approve(n){return this.request("POST","/v1/device/approve",{user_code:n})}claim(n){return this.request("POST","/v1/device/claim",{pairing_nonce:n})}deny(n){return this.request("POST","/v1/device/deny",{user_code:n})}plans(){return this.request("GET","/v1/plans")}selectPlan(n){return this.request("POST","/v1/plans/select",{plan:n})}checkoutPlan(n,t){return this.request("POST","/v1/plans/checkout",{plan:n,...t?.successUrl?{success_url:t.successUrl}:{},...t?.cancelUrl?{cancel_url:t.cancelUrl}:{}})}redeemCode(n){return this.request("POST","/v1/rewards/redeem",{code:n})}leavePlan(){return this.request("DELETE","/v1/plans/select")}hosted(){return this.request("GET","/v1/hosted")}startHosted(){return this.request("POST","/v1/hosted/start")}disconnectHosted(n){return this.request("DELETE",n?`/v1/hosted?provider=${encodeURIComponent(n)}`:"/v1/hosted")}approveRuntime(n,t){return this.request("POST","/v1/runtimes/approve",{machine_id:n,runtime_id:t})}preferRuntime(n,t){return this.request("POST","/v1/runtimes/prefer",{machine_id:n,runtime_id:t})}async request(n,t,r){let o=await this.doFetch(/^https?:\/\//.test(t)?t:`${this.baseUrl}${t}`,{method:n,headers:{authorization:`Bearer ${this.session}`,...r?{"content-type":"application/json"}:{}},...r?{body:JSON.stringify(r)}:{}}),a={};try{a=await o.json()}catch{}if(!o.ok){let s=typeof a.error=="string"?a.error:`Request failed (${o.status})`;throw new Zn(s,o.status)}return a}};function gt(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return"#ffffff";let t=n[1].length===3?[...n[1]].map(a=>a+a).join(""):n[1],r=a=>{let s=Number.parseInt(t.slice(a*2,a*2+2),16)/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(1)+.0722*r(2)>.45?"#101012":"#ffffff"}function Cr(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return null;let t=n[1].length===3?[...n[1]].map(r=>r+r).join(""):n[1];return[0,1,2].map(r=>Number.parseInt(t.slice(r*2,r*2+2),16))}function qn(e,n,t){let r=Cr(e),o=Cr(n);return!r||!o?e:`#${r.map((s,c)=>Math.round(s+(o[c]-s)*t)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function En(e,n){if(!Cr(e))return{};let t=gt(e),r=n?.trim();return{"--sc-ground":e,"--sc-shell":e,"--sc-sheet":qn(e,t,.07),"--sc-raised":qn(e,t,.13),"--sc-line":qn(e,t,.18),"--sc-line-2":qn(e,t,.28),"--sc-text":t,"--sc-text-2":qn(t,e,.15),"--sc-muted":qn(t,e,.38),...r?{"--sc-accent":r,"--sc-accent-fg":gt(r)}:{"--sc-accent":t,"--sc-accent-fg":e}}}function Ke(e){return e.authenticated===!0?{tone:"ok",text:"signed in"}:e.authenticated===!1?{tone:"warn",text:e.auth_hint??"signed out on that machine"}:{tone:"unknown",text:"could not tell"}}function ht(e){let{platform:n,arch:t}=e;if(!n)return null;let r=n==="darwin"||n==="macos",o=r?"Mac":n==="win32"||n==="windows"?"Windows PC":"Linux machine";return r?`${t==="aarch64"||t==="arm64"?"Apple silicon ":""}${o}`:o}function In(e){return e.find(n=>n.state==="offline")??null}function Mr(e){return e.state==="busy"?{tone:"busy",text:`serving ${e.active} of ${e.capacity}`}:e.state==="online"?{tone:"ok",text:"connected"}:{tone:"off",text:"asleep or offline"}}function le(e){let n=e.label?.trim(),t=e.name?.trim();return n&&(!t||n!==t)?n:(t??n??"").replace(/\.(local|lan|home|internal)$/i,"").replace(/[-_]+/g," ").trim()||n||"This machine"}function Xn(e,n){let t=o=>o.state==="busy"?0:o.state==="online"?1:2,r=o=>o.last_seen_at?Date.parse(o.last_seen_at):0;return t(e)-t(n)||r(n)-r(e)}function _e(e){return[...e].sort(Xn)[0]??null}function Ln(e){return e?e.state==="busy"?{tone:"busy",word:"Serving"}:e.state==="online"?{tone:"ok",word:"Connected"}:e.pairing_lost?{tone:"off",word:"Not connected"}:{tone:"off",word:"Asleep"}:{tone:"off",word:"No compute"}}function Kn(e){let n=Ln(e);return{label:e?n.word:"Connect compute",ariaLabel:e?e.pairing_lost?`${le(e)} is not connected`:`${n.word} on ${le(e)}`:"Connect compute",connected:e!==null,state:n}}function on(e){return e.state==="online"||e.state==="busy"}function bt(e){if(!e)return"never seen";let n=Date.parse(e);if(Number.isNaN(n))return"never seen";let t=Date.now()-n,r=6e4;return t<2*r?"just now":t<60*r?`${Math.floor(t/r)} min ago`:t<24*60*r?`${Math.floor(t/(60*r))} hr ago`:`${Math.floor(t/(24*60*r))} days ago`}function Nr(e){return e.runtimes.filter(n=>n.id!=="shell")}function we(e){return e.runtimes.filter(n=>n.id!=="shell"&&!n.quarantined&&!n.absent)}function Fe(e){let n=s=>s?e.runtimes.find(c=>c.id===s)??null:null;if(e.requested_runtime)return{by:"app",runtimeId:e.requested_runtime,runtime:n(e.requested_runtime)};let t=we(e),r=t.find(s=>s.id===e.preferred_runtime);if(r)return{by:"you",runtimeId:r.id,runtime:r};let o=s=>s.id==="claude-code"?0:s.id==="codex"?1:2,a=[...t].sort((s,c)=>o(s)-o(c))[0]??null;return{by:"default",runtimeId:a?.id??null,runtime:a}}var xr="soba";function On(){return`${xr}://show`}function At(e,n,t){let r=`${xr}://connect?url=${encodeURIComponent(e)}`;return n&&(r+=`&nonce=${encodeURIComponent(n)}`),t&&(r+=`&want=${encodeURIComponent(t)}`),r}function yt(){let e=globalThis.crypto;if(!e?.getRandomValues)return null;let n=e.getRandomValues(new Uint8Array(32)),t="";for(let r of n)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Ba=1600;function Sr(e={}){return Pr(e)}async function Rr(e,n={}){if(typeof window>"u"||typeof document>"u")return"unknown";let t=Pr(n);try{window.location.href=At(e,n.nonce,n.want)}catch{return"absent"}return t}async function Tn(e={}){if(typeof window>"u"||typeof document>"u")return"unknown";let n=Pr(e);try{window.location.href=On()}catch{return"absent"}return n}async function Pr(e){if(typeof window>"u"||typeof document>"u")return"unknown";let n=e.graceMs??Ba,t=document.visibilityState==="visible"&&document.hasFocus(),r=!1,o=()=>{r=!0},a=()=>{document.visibilityState==="hidden"&&(r=!0)};return window.addEventListener("blur",o),window.addEventListener("pagehide",o),document.addEventListener("visibilitychange",a),await new Promise(s=>setTimeout(s,n)),window.removeEventListener("blur",o),window.removeEventListener("pagehide",o),document.removeEventListener("visibilitychange",a),t?r?"opened":"absent":"unknown"}var $e={"claude-code":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdB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guIgdoz8sWQSMR3A0hMCPb5owh4whw+YR7MJ6ktMo+EciiobYAFJqDE4zPhtDRKVwF5DSuQcnOKR2AP8Cui93e4Bz9uMXV0/FBGGZ/BaqmGMFGWMFNw7QyOZML4XaHNc3OnIDZkE7cOUzf5QfCGN8C6GkgqwSeXP8HIxHP4MmOI/a321n07gV9IjNBy7QnyZrED37ivv4/PQyO8w10e8KcphEWKSNuIPY8QfKrR4Ye+yCnB3kPeGZiJkLwBzq+EZK2GxGe7nRW12PSGeADM/EmtjG4qej4OQ90YuRN/rYcWzMU8ZPuWbyCHPgbYT3vQ4Pp0/OM7QYx6VGXgMbdGN/AVNIT3cAadkl50K7+QtmgFGBskwuuGBL+EfnaxNQFH3ihDqM12j6lTyyVn4H4E6hAx4NkYwy1G0DlAmsUN8ESX6/+H/GpiUBv4FSyLhydRRp0cAAAAASUVORK5CYII="};import{useEffect as us,useRef as Ga}from"react";import{Fragment as Da,jsx as Ge,jsxs as Er}from"react/jsx-runtime";function Ir({anchor:e,label:n,options:t,current:r,onClose:o,onPick:a}){let s=Ga(null);return us(()=>{let i=s.current,l=e.current;if(!i||!l)return;try{typeof i.showPopover=="function"&&i.showPopover()}catch{}let d=l.getBoundingClientRect();d.width>i.offsetWidth&&(i.style.width=`${Math.round(d.width)}px`);let g=i.offsetWidth,b=i.offsetHeight,y=d.width>248?d.left:d.right-g,m=Math.max(8,Math.min(y,window.innerWidth-g-8)),v=d.bottom+6,A=v+b>window.innerHeight-8&&d.top-6-b>8?d.top-6-b:v;i.style.left=`${Math.round(m)}px`,i.style.top=`${Math.round(A)}px`,i.querySelector('[aria-checked="true"]')?.focus()},[e]),us(()=>{let i=l=>{let d=l.target;!d||s.current?.contains(d)||e.current?.contains(d)||o()};return document.addEventListener("pointerdown",i,!0),()=>document.removeEventListener("pointerdown",i,!0)},[e,o]),Ge("div",{ref:s,role:"menu","aria-label":n,className:"sc-menu",popover:"manual",onKeyDown:i=>{let l=[...s.current?.querySelectorAll("[role=menuitemradio]")??[]],d=l.indexOf(document.activeElement);if(i.key==="Escape")i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),o(),e.current?.focus();else if(i.key==="ArrowDown"||i.key==="ArrowUp"){i.preventDefault();let g=i.key==="ArrowDown"?1:-1;l[(d+g+l.length)%l.length]?.focus()}else i.key==="Tab"&&o()},children:t.map(i=>Ge(Wa,{option:i,checked:r===i.id,onClose:o,onPick:a},i.id??""))})}function Wa({option:e,checked:n,onClose:t,onPick:r}){return Er(Da,{children:[e.heading?Ge("div",{className:"sc-menu-head",role:"presentation",children:e.heading}):e.rule?Ge("div",{className:"sc-menu-sep"}):null,Er("button",{type:"button",role:"menuitemradio","aria-checked":n,className:"sc-menu-item",onClick:()=>{e.onChoose?(e.onChoose(),t()):n?t():r(e.id)},children:[e.glyph,Er("span",{className:"sc-menu-text",children:[Ge("span",{className:"sc-menu-label",children:e.label}),e.note&&Ge("span",{className:"sc-menu-note",children:e.note})]}),e.trailing?Ge("span",{className:"sc-menu-act",children:e.trailing}):n&&Ge(Lr,{})]})]})}function Lr(){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-menu-check",children:Ge("path",{d:"M5 12.5l4.5 4.5L19 7.5",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function gn({open:e}){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-chev sc-chev-open":"sc-chev",children:Ge("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{useEffect as Xt,useId as Fa,useLayoutEffect as za,useMemo as Kt,useRef as kt,useState as Ct}from"react";var ds={haiku:"Haiku",sonnet:"Sonnet",opus:"Opus",fable:"Fable"};function en(e){return ds[e]??e}function wt(e,n=[],t=[],r){let o=A=>!r||r.includes(A.cost_class),a=[...e].sort(Xn),s=_e([...e]),c=s?Fe(s):null,l=[{id:"auto",kind:"auto",label:"Automatic",model:"auto",...c?.runtime?{note:c.runtime.default_model?`Uses ${en(c.runtime.default_model)}`:`Uses ${c.runtime.display_name}`}:{}}];a.some(A=>we(A).some(k=>o(k)&&Zt(k.id)))&&l.push({id:"small",kind:"size",label:"Fast",note:"quick and cheap",model:"small"},{id:"large",kind:"size",label:"Best",note:"the most capable",model:"large"});let g=new Map,y=new Set(a.flatMap(A=>we(A).filter(o).map(k=>k.id))).size>1||n.some(A=>A.models.length>0);for(let A of a)for(let k of we(A))if(o(k)){!k.models.some(Boolean)&&y&&!g.has(`${k.id}/auto`)?g.set(`${k.id}/auto`,{option:{id:`${k.id}/auto`,kind:"named",label:k.display_name,note:k.default_model?`Uses ${en(k.default_model)}`:"its default model",model:"auto",runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])}):g.has(`${k.id}/auto`)&&g.get(`${k.id}/auto`)?.machines.add(le(A));for(let S of k.models){if(!S)continue;let W=`${k.id}/${S}`,L=g.get(W);if(L){L.machines.add(le(A));continue}g.set(W,{option:{id:W,kind:"named",label:en(S),model:S,runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])})}}let m=new Set;for(let{machines:A}of g.values())for(let k of A)m.add(k);let v=m.size>1;for(let{option:A,machines:k}of g.values()){let S=v&&k.size===1?[...k][0]:void 0;l.push(S?{...A,machine:S}:A)}for(let A of n)for(let{model:k}of A.models)k&&l.push({id:`@${A.id}/${k}`,kind:"provider",label:k,model:k,costClass:A.cost_class,providerId:A.id,providerName:A.name,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{}});for(let A of t)!A.alias||!A.cost_classes.length||l.push({id:`alias:${A.alias}`,kind:"provider",label:A.label,...A.note?{note:A.note}:{},...A.icon?{icon:A.icon}:{},model:A.alias,costClass:A.cost_classes[0],costClasses:A.cost_classes,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{},choice:A.alias});return l}function ps(e,n){let t=[];for(let r of n){let o=r.provider?.toLowerCase(),a=e.filter(l=>l.model!==r.model?!1:r.runtime?l.kind==="named"&&l.runtime===r.runtime:l.kind!=="provider"?!1:!o||l.providerMark===o||l.providerId?.toLowerCase()===o||l.providerName?.toLowerCase()===o),s=a.find(l=>!l.locked)??a[0];if(!s)continue;let{machine:c,...i}=s;t.push({...i,id:`choice:${r.id}`,label:r.label,...r.note?{note:r.note}:{},choice:r.id})}return t}function Or(e,n,t=[]){if(n==="automatic")return e.filter(c=>c.kind==="auto"||c.kind==="size");if(n!=="choices")return[...e];let r=e.filter(c=>c.choice),o=ps(e.filter(c=>!c.choice),t),a=e.filter(c=>c.kind!=="provider");return[...a.filter(c=>c.kind==="auto"||c.kind==="size"),...r,...o,...a.filter(c=>c.kind==="named")]}function Tr(e,n){return e.filter(t=>t.kind!=="size"||(t.model==="small"?n?.fast!==!1:n?.best!==!1))}function Br(e,n,t){return t?.auto!==!1||n==="automatic"?[...e]:e.filter(r=>r.kind!=="auto")}function vt(e,n="providers",t=!1){let r=[],o=[],a=new Map;for(let s of e){if(s.kind!=="named"&&s.kind!=="provider"||s.choice){r.push(s);continue}if(n==="models"&&(s.kind==="provider"||t)){let l=a.get("@models");if(l)l.options.push(s);else{let d={heading:"Models",options:[s]};a.set("@models",d),o.push(d)}continue}let c=s.runtime??`@${s.providerId}`,i=a.get(c);if(i)i.options.push(s);else{let l={heading:s.runtimeName??s.providerName??s.runtime??"",options:[s]};a.set(c,l),o.push(l)}}for(let s of o)s.options.some(c=>c.model in ds)||s!==a.get("@models")&&s.options.sort((c,i)=>c.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}));return r.length?[{heading:null,options:r},...o]:o}function Gr(e,n){let t=e.find(o=>o.kind==="auto")??{id:"auto",kind:"auto",label:"Automatic",model:"auto"};if(!n||n==="auto")return{selected:t,unavailable:null};let r=e.find(o=>o.id===n);return r&&!r.locked?{selected:r,unavailable:null}:{selected:t,unavailable:n}}function Wr(e){return e.kind==="provider"&&e.costClass?{model:e.model,route:{allow:e.costClasses??[e.costClass]}}:e.runtime?{model:e.model,runtime:e.runtime}:{model:e.model}}function hn(e){return e.length>1}var Ha={opus:"Most capable. Best for hard, multi-step work.",sonnet:"Balanced speed and quality for everyday runs.",haiku:"Fastest. Best for quick, simple runs."};function Dr(e){if(e.kind==="auto"){let t=e.note?.replace(/^Uses /,"");return t?`Soba picks the model for each run. Currently using ${t}.`:"Soba picks the model for each run."}if(e.kind==="size")return e.id==="small"?"Quick and cheap. Whichever small model the agent serving has.":"The most capable model the agent serving has.";if(e.kind==="provider")return e.locked==="plan"?"Not included in your plan.":e.locked==="allowance"?"Your plan's allowance is used up.":e.providerName?`Through ${e.providerName}. Counts toward your plan.`:void 0;let n=Ha[e.model];return n?e.machine?`${n} On ${e.machine}.`:n:e.machine?`On ${e.machine}.`:void 0}var Hr={openai:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path>'},anthropic:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path>'},gemini:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-0)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-1)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-0" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-1" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-2" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs>'},azure:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#azure-soba-pm-azure-0)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#azure-soba-pm-azure-1)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#azure-soba-pm-azure-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-0" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-1" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-2" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs>'},openrouter:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z"></path>'},groq:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path>'},together:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z" fill="#EF2CC1"></path><path d="M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z" fill="#CAAEF5"></path><path d="M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z" fill="#FC4C02"></path>'},fireworks:{viewBox:"0 0 24 24",mono:!1,svg:'<path clip-rule="evenodd" d="M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z" fill="#5019C5" fill-rule="evenodd"></path>'}};import{jsx as Ua}from"react/jsx-runtime";function Bn({provider:e,className:n}){let t=Hr[e];return t?Ua("svg",{className:n,viewBox:t.viewBox,fill:t.mono?"currentColor":void 0,fillRule:"evenodd","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:t.svg}}):null}import{Fragment as hs,jsx as z,jsxs as We}from"react/jsx-runtime";function Mt({options:e,layout:n="providers",ownInList:t=!1,search:r=!0,selected:o,appName:a,onPick:s,caption:c,onOpen:i,disabled:l,className:d}){let[g,b]=Ct(!1),y=kt(null);if(!hn(e))return null;let m=d?`sc-mp ${d}`:"sc-mp";return We("span",{className:m,children:[c&&z("span",{className:"sc-mp-cap",children:c}),We("button",{ref:y,type:"button",className:"sc-mp-btn",...i?{}:{"aria-haspopup":"dialog","aria-expanded":g},"aria-label":`Model: ${o.label}. Change`,title:o.label,disabled:l,onClick:i??(()=>b(v=>!v)),children:[z("span",{className:"sc-mp-label",children:o.label}),z(gn,{open:!i})]}),g&&!i&&z(Qa,{anchor:y,options:e,layout:n,ownInList:t,search:r,appName:a,current:o.id,onClose:()=>b(!1),onPick:v=>{b(!1),v!==o.id&&s(v)}})]})}var Va=9,_t=6,bn=8,ms=380;var Ur=220;function Qa({anchor:e,options:n,layout:t,ownInList:r,search:o,current:a,inline:s=!1,appName:c,onClose:i,onPick:l}){let d=kt(null),g=kt(null),b=kt(null),y=Fa(),[m,v]=Ct(""),A=m.trim().length>0,k=kt(!1),S=o&&n.length>=Va,W=Kt(()=>vt(n,t,r),[n,t,r]),L=Kt(()=>{let u=[];for(let R of W){let I=Fr(R),J=R.options.length===1&&R.options[0]?.model==="auto";if(I==="head"||I==="@models"||J||t==="models"&&I.startsWith("@"))for(let B of R.options)u.push({kind:"option",key:B.id,option:B});else u.push({kind:"group",key:`g:${I}`,group:R,section:I.startsWith("@")?"providers":"agents"})}return u},[W,t]),D=Kt(()=>qa(W,m),[W,m]),O=Kt(()=>D.flatMap(u=>u.options),[D]),U=u=>u.kind==="group"&&u.group.options.some(R=>R.id===a),[w,$]=Ct(()=>L.find(u=>u.kind==="option"?u.option.id===a:U(u))?.key??"auto"),[j,ee]=Ct(null),[ae,me]=Ct(null);Xt(()=>{A&&O.length&&!O.some(u=>u.id===w)&&$(O[0]?.id??a)},[O,w,a,A]),za(()=>{let u=d.current,R=e.current;if(!u||!R||s)return;try{typeof u.showPopover=="function"&&u.showPopover()}catch{}let I=R.getBoundingClientRect(),J=window.innerHeight-I.bottom-_t-bn,B=I.top-_t-bn,te=J<Math.min(ms,u.scrollHeight)&&B>J,N=Math.min(ms,te?B:J);u.style.maxHeight=`${Math.max(160,Math.round(N))}px`;let H=u.offsetWidth,ie=Math.max(bn,Math.min(I.left,window.innerWidth-H-bn));u.style.left=`${Math.round(ie)}px`,te?(u.style.top="auto",u.style.bottom=`${Math.round(window.innerHeight-I.top+_t)}px`):(u.style.bottom="auto",u.style.top=`${Math.round(I.bottom+_t)}px`),(b.current??u).focus({preventScroll:!0})},[e,s]),Xt(()=>{k.current&&(k.current=!1,g.current?.querySelector(`[data-id="${CSS.escape(w)}"]`)?.scrollIntoView({block:"nearest"}))},[w]),Xt(()=>{if(s)return;let u=R=>{let I=R.target;!I||d.current?.contains(I)||e.current?.contains(I)||i()};return document.addEventListener("pointerdown",u,!0),()=>document.removeEventListener("pointerdown",u,!0)},[e,i,s]),Xt(()=>{if(!j)return;let u=R=>{R.target instanceof Element&&R.target.closest(".sc-mm-flyout")||ee(null)};return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[j]);let fe=(u,R=!1)=>{let I=g.current?.querySelector(`[data-id="${CSS.escape(u)}"]`),J=d.current;if(!I||!J)return;let B=I.getBoundingClientRect(),te=J.getBoundingClientRect(),N=te.right+4+Ur<=window.innerWidth-bn,H=Math.max(bn,Math.min(B.top-5,window.innerHeight-bn-160));ee({key:u,top:H,left:N?te.right+4:te.left-4-Ur,maxHeight:Math.min(320,window.innerHeight-H-bn)});let ie=L.find(Ee=>Ee.key===u);ie?.kind==="group"&&me(R?ie.group.options.find(Ee=>Ee.id===a)?.id??ie.group.options[0]?.id??null:null)},P=j?L.find(u=>u.key===j.key):void 0,q=P?.kind==="group"?P.group.options:[],V=u=>{let R=L[(u+L.length)%L.length];R&&(k.current=!0,$(R.key),ee(null))},Z=u=>{let R=O[(u+O.length)%O.length];R&&(k.current=!0,$(R.id))},be=u=>{if(u.key==="Escape"){if(u.preventDefault(),u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),j){ee(null);return}i(),e.current?.focus();return}if(u.key==="Tab"){i();return}if(j&&ae!==null){let J=q.findIndex(B=>B.id===ae);if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault();let B=u.key==="ArrowDown"?1:-1;me(q[(J+B+q.length)%q.length]?.id??null)}else if(u.key==="ArrowLeft")u.preventDefault(),ee(null);else if(u.key==="Enter"){u.preventDefault();let B=q[J];B&&!B.locked&&l(B.id)}return}if(A){let J=O.findIndex(B=>B.id===w);u.key==="ArrowDown"||u.key==="ArrowUp"?(u.preventDefault(),Z(J+(u.key==="ArrowDown"?1:-1))):u.key==="Enter"&&(u.preventDefault(),O.some(B=>B.id===w&&!B.locked)&&l(w));return}let R=L.findIndex(J=>J.key===w),I=L[R];switch(u.key){case"ArrowDown":u.preventDefault(),V(R+1);return;case"ArrowUp":u.preventDefault(),V(R-1);return;case"ArrowRight":I?.kind==="group"&&(u.preventDefault(),fe(I.key,!0));return;case"Enter":u.preventDefault(),I?.kind==="group"?fe(I.key,!0):I&&!I.option.locked&&l(I.option.id);return;default:if(!S&&u.key.length===1&&!u.metaKey&&!u.ctrlKey){let J=u.key.toLowerCase(),B=ie=>(ie.kind==="option"?ie.option.label:ie.group.heading??"").toLowerCase(),te=L.findIndex((ie,Ee)=>Ee>R&&B(ie).startsWith(J)),N=L.findIndex(ie=>B(ie).startsWith(J)),H=te>=0?te:N;H>=0&&V(H)}}},Y=u=>`${y}-${u}`,ge=L.filter(u=>u.kind==="group"&&u.section==="agents"||u.kind==="option"&&u.option.kind==="named"),Ae=L.filter(u=>u.kind==="group"&&u.section==="providers"),Te=L.filter(u=>u.kind==="group"||!(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")),Pe=L.some(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice),ne=(u,R,I,J=!1)=>We("div",{id:Y(u.id),"data-id":u.id,role:"option","aria-selected":u.id===a,...u.locked?{"aria-disabled":!0}:{},"data-active":u.id===R||void 0,"data-locked":u.locked,className:"sc-mm-item",onPointerMove:I,onPointerDown:B=>B.preventDefault(),onClick:()=>!u.locked&&l(u.id),children:[z(Ya,{option:u,bare:J}),z("span",{className:"sc-mm-label",children:u.label}),u.locked?!J&&z("span",{className:"sc-mm-pill",children:fs[u.locked]}):gs(u)&&u.id!==a&&z("span",{className:"sc-mm-note",children:gs(u)}),u.id===a&&z(Lr,{})]},u.id),de=u=>{let R=u.group.options[0],I=u.group.options.every(B=>B.locked)?R?.locked:void 0,J=R?.runtime?$e[R.runtime]:void 0;return We("div",{id:Y(u.key),"data-id":u.key,role:"option","aria-selected":!1,"data-active":u.key===w||void 0,"data-locked":I,className:"sc-mm-item sc-mm-sub",onPointerMove:()=>{w!==u.key&&$(u.key),j?.key!==u.key&&fe(u.key)},onPointerDown:B=>B.preventDefault(),onClick:()=>fe(u.key),children:[J?z("img",{className:"sc-mm-tile",src:J,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:R?.providerMark&&z(Bn,{provider:R.providerMark,className:"sc-mm-tile-glyph"})}),z("span",{className:"sc-mm-label",children:u.group.heading}),I&&z("span",{className:"sc-mm-pill",children:fs[I]}),U(u)&&z("span",{className:"sc-mm-dot","aria-hidden":"true",title:"In use"}),z(gn,{open:!1})]},u.key)};return We("div",{ref:d,role:"dialog","aria-label":"Choose a model",className:s?"sc-mm sc-mm-inline":"sc-mm",...s?{}:{popover:"manual"},tabIndex:-1,onKeyDown:be,onPointerLeave:()=>!s&&ee(null),...S?{}:{"aria-activedescendant":Y(w)},children:[S&&We("div",{className:"sc-mm-search",children:[z(Za,{}),z("input",{ref:b,type:"text",role:"combobox","aria-expanded":"true","aria-controls":`${y}-list`,"aria-activedescendant":Y(w),"aria-autocomplete":"list",placeholder:"Search models",autoComplete:"off",spellCheck:!1,value:m,onChange:u=>{v(u.target.value),ee(null)}})]}),z("div",{ref:g,id:`${y}-list`,role:"listbox","aria-label":"Models",className:"sc-mm-list",onScroll:()=>ee(null),children:A?We(hs,{children:[D.map((u,R)=>We("div",{role:"group",...u.heading?{"aria-labelledby":`${y}-g${R}`}:{},className:"sc-mm-group",children:[u.heading&&z(ja,{id:`${y}-g${R}`,group:u}),u.options.map(I=>ne(I,w,()=>I.id!==w&&$(I.id),!!u.heading))]},Fr(u))),!O.length&&We("div",{className:"sc-mm-empty",children:["No models match \u201C",m.trim(),"\u201D"]})]}):We(hs,{children:[L.filter(u=>u.kind==="option"&&(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null),r&&Te.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),r&&Te.map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&ge.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&ge.length>0&&z("div",{className:"sc-mm-label-row",role:"presentation",children:"Your own AI"}),(r?[]:ge).map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-label-row",role:"presentation",children:c?`${c} models`:"Included models"}),(r?[]:Ae).map(u=>u.kind==="group"?de(u):null),(r?[]:L).filter(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null)]})}),j&&q.length>0&&z("div",{role:"listbox","aria-label":P?.kind==="group"?P.group.heading??"Models":"Models",className:"sc-mm-flyout",style:{top:j.top,left:j.left,width:Ur,maxHeight:j.maxHeight},children:q.map(u=>ne(u,ae,()=>u.id!==ae&&me(u.id),!0))})]})}var fs={plan:"Upgrade",allowance:"Limit reached"},Ja={auto:"M8 1c.5 3.6 2 5 7 7-5 2-6.5 3.4-7 7-.5-3.6-2-5-7-7 5-2 6.5-3.4 7-7Z",fast:"M9.4.5 2.6 9.1c-.3.4 0 .9.4.9H7l-.9 5.1c-.1.5.5.8.8.4l6.8-8.6c.3-.4 0-.9-.4-.9H9.3l.9-5.1c.1-.5-.5-.8-.8-.4Z",best:"M4.5 2h7l3.5 4.2L8 14.5 1 6.2Z"};function Ya({option:e,bare:n=!1}){if(e.icon)return/^https?:\/\//.test(e.icon)?z("img",{className:"sc-mm-tile",src:e.icon,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box sc-mm-emoji","aria-hidden":"true",children:e.icon});if(e.kind==="named"&&e.runtime&&!n){let t=$e[e.runtime];return t?z("img",{className:"sc-mm-tile",src:t,alt:"","aria-hidden":"true"}):null}return e.kind==="auto"||e.kind==="size"?z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z("svg",{viewBox:"0 0 16 16",className:"sc-mm-tile-glyph",fill:"currentColor","aria-hidden":"true",focusable:"false",children:z("path",{d:Ja[e.kind==="auto"?"auto":e.id==="small"?"fast":"best"]})})}):e.kind==="provider"&&e.providerMark&&!n?z("span",{className:e.locked?"sc-mm-tile sc-mm-tile-box sc-mm-tile-dim":"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z(Bn,{provider:e.providerMark,className:"sc-mm-tile-glyph"})}):null}function Fr(e){let n=e.options[0];return!n||n.choice||n.kind==="auto"||n.kind==="size"?"head":n.runtime&&e.options.every(t=>t.runtime===n.runtime)?n.runtime:!n.runtime&&e.options.every(t=>t.providerId===n.providerId)?`@${n.providerId}`:"@models"}function ja({id:e,group:n}){let t=n.options[0],r=Fr(n),o=t?.runtime&&r===t.runtime?$e[t.runtime]:void 0,a=r.startsWith("@")&&r!=="@models"?t?.providerMark:void 0;return We("div",{id:e,className:"sc-mm-head",role:"presentation",children:[o&&z("img",{className:"sc-mm-logo",src:o,alt:"","aria-hidden":"true"}),a&&z(Bn,{provider:a,className:"sc-mm-logo"}),n.heading]})}function qa(e,n){let t=n.trim().toLowerCase();if(!t)return e;let r=[];for(let o of e){let s=o.heading?.toLowerCase().includes(t)?o.options:o.options.filter(c=>[c.label,c.model,c.note??""].some(i=>i.toLowerCase().includes(t)));s.length&&r.push({...o,options:s})}return r}function gs(e){return e.kind==="provider"?e.locked==="plan"?"Upgrade":e.locked==="allowance"?"Limit reached":e.choice?e.note:void 0:e.kind!=="named"?e.note:e.machine?`on ${e.machine}`:e.model==="auto"?e.note:void 0}function Za(){return We("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-mm-find",children:[z("circle",{cx:"11",cy:"11",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),z("path",{d:"M16 16l4 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}import{useEffect as Xa,useRef as Ka}from"react";import{jsx as Re,jsxs as $t}from"react/jsx-runtime";function zr({options:e,selected:n,onPick:t,onClose:r,busy:o}){let a=Ka(null);return Xa(()=>{(a.current?.querySelector('[aria-checked="true"]')??a.current?.querySelector("[role=radio]"))?.focus()},[]),$t("div",{className:"sc-tray sc-screen",onKeyDown:i=>{i.key==="Escape"&&(i.stopPropagation(),r())},children:[$t("div",{className:"sc-screen-head",children:[Re("button",{type:"button",className:"sc-back","aria-label":"Back",onClick:r,disabled:o,children:Re(_a,{})}),Re("h2",{className:"sc-screen-title",children:"Model"})]}),Re("div",{ref:a,role:"radiogroup","aria-label":"Model",className:"sc-group-card sc-mopts",onKeyDown:i=>{if(!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft"].includes(i.key)||o)return;i.preventDefault();let d=e.findIndex(y=>y.id===n),g=i.key==="ArrowDown"||i.key==="ArrowRight"?1:-1,b=e[((d<0?0:d)+g+e.length)%e.length];b&&t(b.id)},children:e.map(i=>{let l=i.id===n,d=Dr(i);return $t("button",{type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,className:"sc-mopt",disabled:o,onClick:()=>t(i.id),children:[$t("span",{className:"sc-mopt-say",children:[Re("span",{className:"sc-mopt-name",children:i.label}),d&&Re("span",{className:"sc-mopt-desc",children:d})]}),Re("span",{className:l?"sc-ring sc-ring-on":"sc-ring","aria-hidden":"true",children:l&&Re($a,{})})]},i.id)})}),Re("p",{className:"sc-screen-foot",children:"Applies to new runs. Runs already in progress keep the model they started with."}),Re("button",{type:"button",className:"sc-act-go",onClick:r,disabled:o,children:"Done"})]})}function _a(){return Re("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:Re("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function $a(){return Re("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-ring-tick",children:Re("path",{d:"M5 10.5l3.2 3.2L15 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as De,jsxs as ni}from"react/jsx-runtime";function Me({className:e}){return ni("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:[De("path",{d:"M18.125 7.039A8.6 8.6 0 1 0 18.125 16.961A6 6 0 0 1 18.125 7.039Z",fill:"currentColor"}),De("path",{d:"M19.925 7.039A8.6 8.6 0 0 1 19.925 16.961A6 6 0 0 0 19.925 7.039Z",fill:"currentColor"})]})}function bs({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function Gn({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function er({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M4 5h16v11H4zM9 20h6M12 16v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ei({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 7l5 5-5 5M12 18h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vr({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 6h14v10H5zM2.5 19.5h19",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var An={claude:bs,chatgpt:Gn,local:er},As={shell:ei};function ws(e,n){return n<2*6e4?e:n<10*6e4?Math.max(e,6e4):n<30*6e4?Math.max(e,3*6e4):Math.max(e,10*6e4)}var ti=3e3,ri=2*6e4,nr=Date.now(),tr=new Set,ys=!1;function oi(){if(ys||typeof window>"u")return;ys=!0;let e=()=>{let t=nr;if(nr=Date.now(),nr-t>ri)for(let r of tr)r()};for(let t of["pointerdown","keydown","wheel","touchstart"])window.addEventListener(t,e,{capture:!0,passive:!0});let n=()=>{if(!document.hidden)for(let t of tr)t()};window.addEventListener("focus",n),document.addEventListener("visibilitychange",n)}function He(e,n,t={}){oi();let r,o=t.immediate===!1?Date.now():0,a=!1,s=!1,c=()=>{s||(r=setTimeout(i,t.idle===!1?n:ws(n,Date.now()-nr)))},i=async()=>{if(clearTimeout(r),!(s||a)){if(typeof document>"u"||!document.hidden){a=!0,o=Date.now();try{await e()}catch{}finally{a=!1}}c()}},l=()=>{Date.now()-o>Math.min(n,ti)&&i()};return tr.add(l),t.immediate===!1?c():i(),()=>{s=!0,clearTimeout(r),tr.delete(l)}}import{useEffect as si,useRef as ai,useState as ii}from"react";function _n(e){if(e.label)return e.label;if(e.task){let n=e.task.replace(/[_-]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}return"A run"}function rr(e){if(e.status==="queued")return"Waiting for a free slot";if(e.step)return e.step;switch(e.phase?.kind){case"thinking":return"Thinking";case"writing":return"Writing";case"tool":return e.phase.tool?`Using ${e.phase.tool}`:"Using a tool";case"approval":return e.phase.tool?`Waiting for you to allow ${e.phase.tool}`:"Waiting for your approval";default:return e.first_output_at?"Working":"Starting"}}function Nt(e){let n=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/1e3));if(n<60)return`${n}s`;let t=Math.floor(n/60);return t<60?`${t}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,"0")}m`}function Qr(e){let n=new Date(e);return Number.isNaN(n.getTime())?"\u2014":n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}import{jsx as X,jsxs as ve}from"react/jsx-runtime";function Yr({run:e,machine:n,appName:t,onClose:r,onStop:o,busy:a}){let s=ai(null),[c,i]=ii(!1);si(()=>{s.current?.focus()},[]);let l=v=>{v.key==="Escape"&&(v.stopPropagation(),r())},d=async()=>{i(!0);try{await o?.(e.id)}catch{i(!1)}},g=_n(e),b=e.status==="running"&&!c,m=[n?.runtimes.find(v=>v.id===e.runtime_id)?.display_name??e.runtime_id,n?le(n):null].filter(Boolean).join(", ");return ve("div",{className:"sc-tray sc-screen",onKeyDown:l,children:[ve("div",{className:"sc-screen-head",children:[X("button",{ref:s,type:"button",className:"sc-back","aria-label":"Back to active runs",onClick:r,children:X(ci,{})}),X("span",{className:"sc-screen-from",children:"Active runs"})]}),ve("div",{className:"sc-rd-head",children:[X("h2",{className:"sc-rd-name",children:g}),ve("p",{className:"sc-rd-state",children:[X("span",{className:b?"sc-rd-dot sc-rd-dot-live":"sc-rd-dot","aria-hidden":"true"}),c?"Stopping\u2026":e.status==="queued"?`Queued for ${Nt(e.started_at)}`:`Running for ${Nt(e.started_at)}`]})]}),ve("div",{className:"sc-group-card sc-rd-facts",children:[t&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Source"}),X("span",{className:"sc-rd-val",children:t})]}),ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Model"}),X("span",{className:"sc-rd-val",children:li(e.model)})]}),m&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Runs on"}),X("span",{className:"sc-rd-val",children:m})]})]}),ve("section",{className:"sc-group",children:[X("div",{className:"sc-group-cap",children:X("p",{className:"sc-group-title",children:"Activity"})}),ve("div",{className:"sc-group-card sc-rd-steps",children:[ve("p",{className:"sc-rd-step",children:[X(Jr,{state:"done"}),X("span",{className:"sc-rd-say",children:"Started"}),X("span",{className:"sc-rd-when",children:Qr(e.started_at)})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:e.first_output_at?"done":"todo"}),X("span",{className:e.first_output_at?"sc-rd-say":"sc-rd-say sc-rd-wait",children:"First output"}),X("span",{className:"sc-rd-when",children:e.first_output_at?Qr(e.first_output_at):"Not yet"})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:b?"now":"todo"}),X("span",{className:"sc-rd-say",children:c?"Stopping":rr(e)})]})]})]}),ve("div",{className:"sc-acts",children:[o&&X("button",{type:"button",className:"sc-act-stop",onClick:()=>void d(),disabled:a||c,children:c?"Stopping\u2026":"Stop run"}),X("a",{className:"sc-act-quiet",href:On(),children:"Open Soba"})]})]})}function li(e){return!e||e==="auto"?"Automatic":e==="small"?"Fast":e==="large"?"Best":en(e)}function Jr({state:e}){return e==="done"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-done",children:[X("circle",{cx:"10",cy:"10",r:"9",fill:"currentColor"}),X("path",{d:"M5.8 10.3l2.8 2.8 5.6-5.8",fill:"none",stroke:"var(--sc-tray-card, #ffffff)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="now"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-now",children:[X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"var(--sc-line-2, #dcdce0)",strokeWidth:"2.4"}),X("path",{d:"M10 2a8 8 0 018 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})]}):X("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark",children:X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}function ci(){return X("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:X("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ie=[{id:"claude",costClass:"user-subscription",short:"Claude Code",label:"Continue with Claude",title:"The Claude plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Claude Code installed and signed in",hint:"Install it from claude.ai/code, then run `claude` once and sign in.",install:"https://claude.com/product/claude-code",expects:["claude-code"]},{id:"chatgpt",costClass:"user-subscription",short:"Codex",label:"Continue with ChatGPT",title:"The ChatGPT plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Codex installed and signed in",hint:"Install Codex, then run `codex` once and sign in.",install:"https://learn.chatgpt.com/codex/cli",expects:["codex"]},{id:"local",costClass:"user-hardware",short:"Local models",label:"Use a model on this machine",title:"A model on your own machine",cost:"Free. You bought the hardware",prerequisite:"Ollama running, with a model pulled",hint:"Install Ollama, then `ollama pull` a model before pairing.",install:"https://ollama.com",expects:["ollama","openai-api"]}],vs=["claude","chatgpt"];function jr(){return Ie.filter(e=>vs.includes(e.id))}function qr(e){return Ie.filter(n=>n.costClass===e)}function Zr(e){return Ie.find(n=>n.expects.includes(e))??null}import{Fragment as et,jsx as f,jsxs as x}from"react/jsx-runtime";function Wn({machines:e,hosted:n=[],onApproveRuntime:t,onPreferRuntime:r,onDisconnectHosted:o,onPair:a,onWake:s,onOpenApp:c,onRefresh:i,refreshing:l,busy:d,appName:g,model:b,onPickModel:y,error:m,runs:v,loadRuns:A,loading:k,machineMenu:S,machineNote:W,onReconnect:L,openApp:D=!0,children:O,onStopRun:U}){let w=_e(e),$=e.filter(E=>E.id!==w?.id),j=w?.state==="online",[ee,ae]=$n(()=>j?[]:null),[me,fe]=$n("no"),[P,q]=$n(!1),[V,Z]=$n(null),be=v===void 0&&!!A,Y=be?ee:v??(j?[]:null),ge=v!==void 0||!!A;ks(()=>{V&&Y&&!Y.some(E=>E.id===V)&&Z(null)},[V,Y]);let Ae=!!(w&&on(w));ks(()=>{if(!be||!A||!Ae)return;let E=!0,Cn=He(async()=>{let G=await A();E&&ae(G)},3e3);return()=>{E=!1,Cn()}},[be,A,Ae]);let Pe=(w?Nr(w):[]).filter(E=>E.quarantined&&!E.absent),ne=sr(w,b).runtime,de=ne?.cost_class==="user-hardware"?ne:null,u=de?Ni(Mi(de,b)):null,R=!!w&&!on(w),I=(()=>{if(!w||R||!ne||Ke(ne).tone!=="warn")return null;let Cn=le(w);return{title:`${ne.display_name} is signed out`,detail:`Sign in on ${Cn} so Soba can start runs.`}})(),J=()=>{c?.(),fe("going"),Tn().then(E=>fe(E==="absent"?"absent":"no"))},B=()=>{J(),s?.()},te={label:me==="going"?"Opening Soba\u2026":"Open Soba",onPress:J,spin:me==="going"},N=w?te:a?{label:"Connect to Soba",onPress:a}:null,H=!!w&&N===te,ie=H&&!!i,Ee=i&&f("button",{type:"button",className:"sc-disc",onClick:i,disabled:l,"aria-label":"Refresh",title:"Refresh",children:f(Pi,{spinning:!!l})});if(!w&&n.length===0&&!a)return f("p",{className:"sc-note",children:"Nothing connected yet."});if(P&&w&&b&&y){let E=Ns(w,b);if(hn(E.options))return f(zr,{options:E.options,selected:b.id,onPick:y,onClose:()=>q(!1),...d?{busy:d}:{}})}let je=V?Y?.find(E=>E.id===V):void 0;return je?f(Yr,{run:je,onClose:()=>Z(null),...w?{machine:w}:{},...g?{appName:g}:{},...U?{onStop:U}:{},...d?{busy:d}:{}}):x("div",{className:"sc-tray",children:[w&&x(ze,{title:"This machine",action:(i&&!ie||D||S)&&x("span",{className:"sc-cap-acts",children:[!ie&&Ee,D&&f(Ai,{}),S]}),children:[f(di,{machine:w}),W]}),w&&R&&!w.pairing_lost&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"paused",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Wake it up"}),x("span",{className:"sc-away-body",children:["Soba on ",le(w)," is not answering. Waking it opens the app there."]})]}),f("button",{type:"button",className:"sc-away-go",onClick:B,disabled:d||me==="going",children:me==="going"?"Waking\u2026":"Wake"})]})}),w?.pairing_lost&&!on(w)&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"gone",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Connect it again"}),f("span",{className:"sc-away-body",children:"Its pairing has ended, so it cannot take runs until it is connected again."})]}),L&&f("button",{type:"button",className:"sc-away-go",onClick:L,disabled:d,children:"Connect"})]})}),w&&!R&&f(ze,{title:"Runs on",children:ne?f(vi,{machine:w,appName:g,busy:d,...b?{model:b}:{},...y?{onPickModel:y,onOpenModels:()=>q(!0)}:{},...r?{onPick:E=>r(w.id,E)}:{},...t?{onApprove:E=>t(w.id,E)}:{}}):x("div",{className:"sc-blank",children:[f("span",{className:"sc-blank-mark","aria-hidden":"true",children:f(fi,{})}),x("span",{className:"sc-blank-say",children:[f("span",{className:"sc-blank-title",children:k?"Looking\u2026":"No agent on this machine"}),f("span",{className:"sc-blank-body",children:k?"Reading what it can run.":"Install Claude Code, Codex or Ollama there and it will appear here."})]}),!k&&D&&x("a",{className:"sc-blank-act",href:On(),children:[f("span",{children:"Add agents"}),f(Xr,{})]})]})}),w&&(I||u)&&x(ze,{title:"Needs attention",children:[I&&x("div",{className:"sc-alarm",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:I.title}),f("span",{className:"sc-alarm-body",children:I.detail})]})]}),u&&x("div",{className:"sc-alarm sc-alarm-warn",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:"A large model on this computer"}),x("span",{className:"sc-alarm-body",children:["Your ",u," model can take all this computer's memory while it answers."]})]})]})]}),w&&ge&&!R&&f(mi,{machine:w,runs:Y,onOpen:E=>Z(E),...U?{onStop:U}:{}}),w&&f(et,{children:Pe.length>0&&!R&&!(r&&t&&!["app","model"].includes(sr(w,b).by))&&f(ze,{title:"New on this machine",children:Pe.map(E=>f(wi,{runtime:E,...t?{onApprove:()=>t(w.id,E.id)}:{}},E.id))})}),n.length>0&&f(ze,{title:n.length>1?"Connected plans":"Connected plan",children:n.map(E=>f(Si,{credential:E,appName:g,busy:d,...o?{onDisconnect:()=>o(E.provider)}:{}},E.provider))}),$.length>0&&f(ze,{title:"Your other machines",children:$.map(E=>f(yi,{machine:E},E.id))}),!w&&a&&f(ze,{title:"Your machines",children:x("button",{type:"button",className:"sc-pair",onClick:a,children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Ri,{})}),f("span",{className:"sc-oname",children:"Connect a machine"})]})}),N&&x("div",{className:"sc-acts",children:[H&&N?x("div",{className:"sc-acts-row",children:[ie?Ee:f("span",{}),x("button",{type:"button",className:"sc-act-small",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label,!N.spin&&f(Xr,{})]})]}):N&&x("button",{type:"button",className:"sc-act-go",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label]}),me==="absent"&&x("p",{className:"sc-act-miss",children:["Nothing opened here. ",w?le(w):"That machine"," may be a different computer, or the Soba app is not installed on this one."]})]}),O,m&&f("p",{className:"sc-error sc-tray-error",children:m})]})}function ze({title:e,action:n,children:t}){return x("section",{className:"sc-group",children:[x("div",{className:"sc-group-cap",children:[f("p",{className:"sc-group-title",children:e}),n]}),f("div",{className:"sc-group-card",children:t})]})}function di({machine:e,onToggle:n,open:t}){let r=on(e),o=[r?null:e.pairing_lost?"Not connected to Soba":"Soba is asleep",r?ht(e):null,e.always_on?"always on":null].filter(Boolean),a=r&&e.capacity>0?e.active>0?`${e.active} of ${e.capacity} running`:null:bt(e.last_seen_at),s=x(et,{children:[x("span",{className:"sc-mtile","aria-hidden":"true",children:[f(xs,{}),f("span",{className:`sc-mbadge sc-mbadge-${r?Ln(e).tone:e.pairing_lost?"off":"away"}`})]}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:le(e)}),x("span",{className:"sc-mmeta",children:[f("span",{className:"sc-mmeta-is",children:o.map((c,i)=>x("span",{children:[i>0&&f("span",{className:"sc-mmeta-sep",children:"\xB7"}),c]},c))}),a&&f("span",{className:"sc-mmeta-now",children:a})]})]})]});return!n||!r?f("div",{className:"sc-mrow",children:s}):x("button",{type:"button",className:"sc-mrow sc-mrow-btn",onClick:n,"aria-expanded":!!t,title:t?"Hide what it is running":"See what it is running",children:[s,f(gn,{open:!!t})]})}function pi(e,n){return e.filter(t=>t.machine_id===n.id||t.machine_id===null)}function mi({machine:e,runs:n,onStop:t,onOpen:r}){let o=n?pi(n,e):[],[a,s]=$n(new Set),c=async l=>{s(d=>new Set(d).add(l));try{await t?.(l)}catch{s(d=>{let g=new Set(d);return g.delete(l),g})}},i=()=>{for(let l of o)c(l.id)};return f(ze,{title:"Active runs",...t&&o.length>1?{action:f("button",{type:"button",className:"sc-cap-link",onClick:i,children:"Stop all"})}:{},children:n===null?f("p",{className:"sc-row-note",children:"Looking\u2026"}):o.length===0?x("p",{className:"sc-nilrow",children:[f("span",{className:"sc-nilrow-mark","aria-hidden":"true",children:f(gi,{})}),"Nothing running"]}):o.map(l=>f(hi,{run:l,stopping:a.has(l.id),...t?{onStop:()=>void c(l.id)}:{},...r?{onOpen:()=>r(l.id)}:{}},l.id))})}function fi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M7.5 10l2.5 2.2-2.5 2.2M12.5 14.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M9 12.5l2.2 2.2L15.5 9.8",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function hi({run:e,stopping:n,onStop:t,onOpen:r}){let o=x(et,{children:[f("span",{className:n?"sc-rdot":"sc-rdot sc-rdot-live","aria-hidden":"true"}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-rtitle",children:_n(e)}),f("span",{className:"sc-rstep",children:n?"Stopping\u2026":`${rr(e)} \xB7 ${Nt(e.started_at)}`})]})]});return x("div",{className:"sc-rrow",children:[r?x("button",{type:"button",className:"sc-rgo",onClick:r,"aria-label":`${_n(e)} \u2014 open this run`,children:[o,f(gn,{open:!1})]}):o,t&&f("button",{type:"button",className:"sc-rstop",onClick:t,disabled:n,"aria-label":`Stop ${_n(e)}`,children:f("span",{className:"sc-rstop-ring",children:f(Ei,{})})})]})}function bi(e){let n=Zr(e);return(n?An[n.id]:null)??As[e]??null}function Ai(){return f("a",{className:"sc-disc sc-open-app",href:On(),"aria-label":"Open Soba",title:"Open Soba",children:f(Xr,{})})}function Xr(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-dglyph",children:f("path",{d:"M14 4h6v6M20 4l-8.5 8.5M18 14.5V19a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h4.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function yi({machine:e}){let n=Ln(e);return x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(xs,{})}),f("span",{className:"sc-oname",children:le(e)}),f("span",{className:"sc-oword",children:n.word}),f("span",{className:`sc-dot sc-dot-${n.tone}`,"aria-hidden":"true"})]})}function wi({runtime:e,onApprove:n}){return x("div",{className:"sc-mrow",children:[f("span",{className:"sc-mtile sc-atile","aria-hidden":"true",children:f(or,{id:e.id,name:e.display_name})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:e.display_name}),f("span",{className:"sc-mmeta",children:e.version??"waiting to be let in"})]}),n?f("button",{type:"button",className:"sc-row-act",onClick:n,children:"Let it serve"}):f("span",{className:"sc-averdict sc-tone-warn",children:"not serving yet"})]})}function Kr({id:e,name:n}){return f("span",{className:"sc-runtime-tile","aria-hidden":"true",children:f(or,{id:e,...n?{name:n}:{}})})}function or({id:e,name:n}){if(!e)return null;let t=$e[e];if(t)return f("img",{src:t,alt:"",className:"sc-runtime-logo"});let r=bi(e);return r?f(r,{className:"sc-runtime-mark"}):n?f("span",{className:"sc-runtime-letter",children:n.slice(0,1).toUpperCase()}):null}function Ns(e,n){if(!n)return{options:[]};let t=sr(e,n),r=t.runtime?.id??t.runtimeId,o=wt([e]).filter(c=>c.kind==="named"?c.runtime===r:c.kind==="size"?!!r&&Zt(r):!0),a=t.runtime?.default_model;if(n.kind!=="auto"||!a)return{options:o,shown:n};let s=en(a);return{options:o,shown:{...n,label:s.length>16?s:`${n.label} \xB7 ${s}`}}}function vi({machine:e,appName:n,busy:t,onPick:r,model:o,onPickModel:a,onOpenModels:s,onApprove:c}){let i=sr(e,o),l=we(e),d=c?e.runtimes.filter(U=>U.quarantined&&!U.absent):[],[g,b]=$n(!1),y=ui(null);if(i.by!=="app"&&l.length===0)return null;let m=U=>U?f(Kr,{id:U.id,name:U.display_name}):null,v=i.runtime?.display_name??i.runtimeId??"\u2014",A=i.by!=="app"&&i.by!=="model"&&!!r&&(l.length>=2||d.length>0),k=i.runtime?.id??i.runtimeId,S=!on(e),W=i.runtime&&Ke(i.runtime).tone==="warn"?"Signed out":null,{options:L,shown:D}=Ns(e,o),O=i.by==="app"?`Set by ${n??"the app"}`:i.runtime?Ci(i.runtime):null;return x(et,{children:[A?x("button",{ref:y,type:"button",className:S?"sc-runs-agent sc-runs-dim":"sc-runs-agent","aria-haspopup":"menu","aria-expanded":g,"aria-label":`Runs go to ${v}. Change`,disabled:t,onClick:()=>b(U=>!U),children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),f(gn,{open:!1})]}):x("span",{className:S?"sc-runs-agent sc-runs-fixed sc-runs-dim":"sc-runs-agent sc-runs-fixed",children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),i.by==="app"&&x("span",{className:"sc-runs-told",children:["set by ",n??"the app"]}),i.by==="model"&&f("span",{className:"sc-runs-told",children:"set by the model"})]}),D&&a&&hn(L)?x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),f(Mt,{options:L,selected:D,onPick:a,caption:"Model",...s?{onOpen:s}:{},className:S?"sc-runs-model sc-runs-dim":"sc-runs-model",...t?{disabled:t}:{}})]}):O&&x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),x("span",{className:"sc-runs-said",children:[f("span",{className:"sc-runs-key",children:"Model"}),f("span",{className:"sc-runs-val",children:O})]})]}),g&&r&&f(ki,{anchor:y,machine:e,tile:m,waiting:d,...c?{onApprove:c}:{},onClose:()=>b(!1),onPick:U=>{b(!1),r(U)}})]})}function ki({anchor:e,machine:n,tile:t,waiting:r,onApprove:o,onClose:a,onPick:s}){let c={...n,requested_runtime:null},i=Fe(c),l=Fe({...c,preferred_runtime:null}).runtime,d=i.by==="you"?i.runtimeId:null,g=[{id:null,label:"Automatic",...l?{note:`Uses ${l.display_name}`}:{},glyph:t(l)},...we(n).map((b,y)=>{let m=xi(b);return{id:b.id,label:b.display_name,glyph:t(b),...m?{note:m}:{},...y===0?{rule:!0}:{}}}),...o?r.map((b,y)=>({id:`waiting:${b.id}`,label:b.display_name,glyph:t(b),...b.version?{note:b.version}:{},trailing:"Let it serve",onChoose:()=>o(b.id),...y===0?{heading:"New on this machine"}:{}})):[]];return f(Ir,{anchor:e,label:"Which agent runs go to",options:g,current:d,onClose:a,onPick:s})}function Ci(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):"Automatic"}function sr(e,n){if(!e)return{by:"default",runtimeId:null,runtime:null};let t=Fe(n?{...e,requested_runtime:null}:e);if(t.by==="app"||n?.kind!=="named"||!n.runtime)return t;let r=we(e).find(o=>o.id===n.runtime);return!r||r.id===t.runtimeId?t:{by:"model",runtimeId:r.id,runtime:r}}function Mi(e,n){return!n||n.kind==="auto"?e.default_model:n.kind==="size"?(ls(n.model)?cs(e.id,n.model):void 0)??e.default_model:n.runtime===e.id?n.model:e.default_model}function Ni(e){if(!e)return null;let n=/(\d+(?:\.\d+)?)\s*b\b/i.exec(e),t=n?.[1]?Number(n[1]):Number.NaN;return!Number.isFinite(t)||t<20?null:`${n?.[1]}B`}function xi(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):e.cost_class==="user-hardware"?"In this machine's memory":n.tone!=="ok"?n.text:e.version??void 0}function Si({credential:e,appName:n,busy:t,onDisconnect:r}){return x("div",{className:"sc-hrow",children:[x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Gn,{className:"sc-omark"})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-oname",children:e.provider==="openai-chatgpt"?"ChatGPT plan":e.provider}),f("span",{className:"sc-mmeta",children:e.account_label??"signed in"})]}),r&&f("button",{type:"button",className:"sc-row-act",onClick:r,disabled:t,children:"Disconnect"})]}),r&&x("p",{className:"sc-row-note",children:[n??"This app"," stops using it. To withdraw the grant entirely, remove it in your OpenAI settings."]})]})}function xs(){return x("svg",{viewBox:"0 0 32 24","aria-hidden":"true",focusable:"false",className:"sc-mglyph",children:[f("rect",{x:"4",y:"1.5",width:"24",height:"15",rx:"2.5",fill:"var(--sc-sheet, #ffffff)",stroke:"currentColor",strokeWidth:"2"}),f("rect",{x:"1",y:"19.5",width:"30",height:"2.5",rx:"1.25",fill:"currentColor"})]})}function Ri(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-oglyph",children:f("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Cs(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-hglyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),f("path",{d:"M12 7.5v5.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),f("circle",{cx:"12",cy:"16.5",r:"1.15",fill:"currentColor"})]})}function Ms(){return x("svg",{className:"sc-act-glyph sc-spin",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[f("circle",{cx:"8",cy:"8",r:"6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),f("path",{d:"M8 1.8a6.2 6.2 0 0 1 6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Pi({spinning:e}){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-dglyph sc-spin":"sc-dglyph",children:f("path",{d:"M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ei(){return f("svg",{className:"sc-dglyph",viewBox:"0 0 14 14","aria-hidden":"true",children:f("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}import{jsx as Ii}from"react/jsx-runtime";function _r({machines:e,onApproveRuntime:n,model:t,onPickModel:r}){return Ii(Wn,{machines:e,...n?{onApproveRuntime:n}:{},...t?{model:t}:{},...r?{onPickModel:r}:{}})}import{useCallback as Ne,useEffect as Le,useId as Bi,useMemo as yn,useRef as nt,useState as ce}from"react";var xt=[{slug:"mac-arm",label:"macOS, Apple silicon"},{slug:"mac-intel",label:"macOS, Intel"},{slug:"windows",label:"Windows"},{slug:"linux",label:"Linux"}];function St(e){if(!e)return"";try{return new URL(e).origin}catch{return""}}var Ss="soba.connect.choice",Li=180*24*60*60*1e3;function $r(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function eo(e,n){return e?n?`${Ss}.${e}.${$r(n)}`:`${Ss}.${e}`:null}function no(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Li)return null;let r=Ie.find(o=>o.id===t.choice);return r?r.id:null}catch{return null}}function to(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Rs="soba.connect.model",Oi=180*24*60*60*1e3;function ro(e,n){return e?n?`${Rs}.${e}.${$r(n)}`:`${Rs}.${e}`:null}function ar(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Oi)return null;let r=t.choice;return typeof r!="string"||!r||r.length>120?null:/^[\w.:@+-]+(\/[\w.:@+-]+)?$/.test(r)?r:null}catch{return null}}function oo(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Ps="soba.connect.dismissed",Ti=30*24*60*60*1e3;function so(e,n){return e?n?`${Ps}.${e}.${$r(n)}`:`${Ps}.${e}`:null}function ao(e){if(!e||typeof localStorage>"u")return!1;try{let n=localStorage.getItem(e);if(!n)return!1;let t=JSON.parse(n);return Date.now()-Date.parse(t.at)<Ti}catch{return!1}}function io(e){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({at:new Date().toISOString()}))}catch{}}import{Fragment as rt,jsx as h,jsxs as T}from"react/jsx-runtime";var lo=2e3,Gi=1e4,Wi=9e4,Di=6e4;function co(e,n,t,r=[],o){return e?"code":n&&(t.length>0||r.length>0)?"manage":o?"launch":"choose"}function Es(e){return on(e)&&!e.pairing_lost}function ir(e){return new Map(e.map(n=>[n.id,Es(n)]))}function Hi(e){let n=Math.max(0,Math.round(e/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function mo({client:e,initialCode:n,initialChoice:t,onConnected:r,showStatus:o=!0,initialContext:a=null,initialMachines:s,onClose:c,headingId:i,theme:l,reason:d,active:g=!0}){let b=!!a&&s!==void 0,[y,m]=ce(b?co(n,o,s??[],[],t):"loading"),[v,A]=ce(a),[k,S]=ce(s??[]),[W,L]=ce(n??""),[D,O]=ce(null),[U,w]=ce(null),[$,j]=ce(!1),[ee,ae]=ce(0),[me,fe]=ce("app"),[P,q]=ce(()=>Date.now()),[V,Z]=ce(null),[be,Y]=ce(!1),[ge,Ae]=ce(!1),[Te,Pe]=ce("browser"),[ne,de]=ce(null),[u,R]=ce([]),[I,J]=ce(0),[B,te]=ce(null),N=nt(null),[H,ie]=ce(t??null),[Ee,je]=ce(null),E=yn(()=>{let p=v?.accent?.trim(),M=v?.background?.trim();if(!(!p&&!M))return M?{...En(M,p),background:M,borderRadius:"inherit"}:{"--sc-accent":p,"--sc-accent-fg":gt(p)}},[v?.accent,v?.background]),Cn=Bi(),G=i??Cn,cn=nt(null);Le(()=>{if(!e||b)return;let p=!0;return Promise.all([e.context(),e.machines()]).then(([M,Q])=>{p&&(A(M),S(Q),m(co(n,o,Q)))}).catch(M=>{p&&(w(M.message),m("choose"))}),()=>{p=!1}},[e,n,o,b]),Le(()=>{y!=="loading"||!b||m(co(n,o,s??[]))},[y,b,n,o,s]),Le(()=>{s&&S(s)},[s]),Le(()=>{a&&A(a)},[a]);let tn=nt(!1),ke=nt(y);ke.current=y;let Mn=nt(u);Mn.current=u;let Nn=!!v?.hosted_available;Le(()=>{!o&&ke.current==="manage"&&m("choose")},[o]),Le(()=>{if(!e||!g||y!=="manage")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=!Nn||tn.current;Q.length===0&&Mn.current.length===0&&oe&&ke.current==="manage"&&m("choose")}catch{}},Gi,{immediate:!1});return()=>{p=!1,M()}},[y,e,Nn,g]);let xn=eo(v?.publishable_key??null);Le(()=>{je(no(xn))},[xn]),Le(()=>{if(!e||!Nn)return;let p=!0;return e.hosted().then(M=>{p&&(R(M.credentials),!tn.current&&(tn.current=!0,M.credentials.length>0&&o&&ke.current==="choose"&&m("manage")))}).catch(()=>{}),()=>{p=!1}},[e,Nn,o]),Le(()=>{if(!e||!g||y!=="hosted")return;let p=!0,M=async()=>{try{let pe=await e.hosted();if(!p)return!1;if(R(pe.credentials),pe.credentials.length>0)return m("hosted_connected"),te(null),!0}catch{}return!1},Q=async()=>{N.current?.closed&&(N.current=null,!await M()&&p&&m("choose"))},oe=He(M,lo,{immediate:!1}),ye=setInterval(Q,400),rn=pe=>{let Xe=pe.data;Xe?.source==="soba"&&Xe.type==="hosted_result"&&M()};return window.addEventListener("message",rn),()=>{p=!1,oe(),clearInterval(ye),window.removeEventListener("message",rn),N.current=null}},[e,y,g]);let ss=Ne(()=>{if(!e)return;let p=window.open("","soba-connect-plan","width=520,height=760,noopener=no");N.current=p,m("hosted"),J(Date.now()),te(null),w(null),e.startHosted().then(({url:M})=>{if(p&&!p.closed){p.location.href=M;return}te(M)}).catch(M=>{p?.close(),N.current=null,w(M.message),m("choose")})},[e]),un=Ne(async p=>{if(e){j(!0);try{await e.disconnectHosted(p),R((await e.hosted()).credentials)}catch(M){w(M.message)}finally{j(!1)}}},[e]);Le(()=>{if(!e||!g||y!=="waiting")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=cn.current;if(!oe)return;let ye=Q.filter(pe=>!oe.has(pe.id)||oe.get(pe.id)===!1&&Es(pe)),rn=ye.find(pe=>pe.state!=="offline")??ye[0];if(rn){de(rn.id),H&&to(xn,H);let pe=Ie.find(dt=>dt.id===H)?.expects??[],Xe=we(rn).find(dt=>pe.includes(dt.id));Xe&&e.preferRuntime(rn.id,Xe.id).catch(()=>{}),m("connected"),r?.(Q)}}catch{}},lo,{immediate:!1});return()=>{p=!1,M()}},[y,e,r,H,xn,g]);let Vt=Ne(async()=>{if(e){w(null),j(!0);try{let p=await e.lookup(W);O(p),m("confirm")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),dn=Ne(async()=>{if(e){w(null),j(!0);try{try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}await e.approve(W),fe("code"),m("waiting"),ae(Date.now())}catch(p){w(p.message)}finally{j(!1)}}},[e,W,k]),Jn=Ne(async()=>{if(e){j(!0);try{await e.deny(W),Pe("browser"),m("denied")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),he=yn(()=>v?.connect_url??null,[v]),[qe,ut]=ce(()=>yt()),Yn=yn(()=>he?At(he,qe??void 0,H??void 0):null,[he,qe,H]),Qt=yn(()=>St(he),[he]),Jt=Ne(p=>{if(k.length===0)return null;let M=Ie.find(oe=>oe.id===p);if(!M)return null;let Q=k.flatMap(oe=>oe.runtimes??[]).filter(oe=>M.expects.includes(oe.id));return Q.length===0?{tone:"dim",text:"not installed"}:Q.some(oe=>oe.authenticated===!0)?{tone:"ok",text:"ready"}:Q.every(oe=>oe.authenticated===!1)?{tone:"warn",text:"needs signing in"}:{tone:"dim",text:"installed"}},[k]),Yt=Ne((p=null)=>{ie(p),w(null),Z(null),Y(!1),Ae(!1),jn.current=!1,ut(yt()),m("launch")},[]),jn=nt(!!t);Le(()=>{y!=="launch"||!he||jn.current||(jn.current=!0,Y(!0),Rr(he,{...qe?{nonce:qe}:{},...H?{want:H}:{}}).then(Z))},[y,he,qe,H]);let Sn=Ne(()=>{Y(!0),Sr().then(Z)},[]),jt=Ne(p=>{if(ge){let M=yt();Ae(!1),ut(M),he&&(p.preventDefault(),window.location.href=At(he,M??void 0,H??void 0))}Sn()},[ge,Sn,he,H]),Rn=yn(()=>{let p=v?.runtimes;return p?Ie.filter(M=>p.includes(M.id)):jr()},[v?.runtimes]),Be=yn(()=>{let p=Ie.find(M=>M.id===H);return p?{choice:p,Mark:An[p.id]??null}:null},[H]),Ce=yn(()=>k.find(p=>p.id===ne),[k,ne]),pn=Ne(()=>{m("manage"),c?.()},[c]);Le(()=>{let p=qe;if(!e||!g||y!=="launch"||!p)return;let M=!1,Q=Date.now()+15e4,oe=()=>{};return oe=He(async()=>{if(Date.now()>Q){oe(),Ae(!0);return}try{let ye=await e.claim(p);if(M)return;if(ye.declined){oe(),Z(null),Pe("machine"),m("denied");return}if(!ye.claimed)return;oe();try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}fe("app"),m("waiting"),ae(Date.now())}catch{}},lo,{immediate:!1,idle:!1}),()=>{M=!0,oe()}},[e,y,k,qe,g]);let Ze=yn(()=>{if(!D)return null;if(D.approved||D.denied)return"answered";let p=D.expires_at?Date.parse(D.expires_at):Number.NaN;return Number.isFinite(p)&&p<=P?"expired":"live"},[D,P]);Le(()=>{if(!(y==="confirm"&&Ze==="live"||y==="waiting"||y==="hosted"))return;let M=setInterval(()=>q(Date.now()),1e3);return()=>clearInterval(M)},[y,Ze]);let qt=Ne(async(p,M)=>{if(e)try{await e.approveRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]),yr=Ne(async(p,M)=>{if(e)try{await e.preferRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]);return y==="loading"?h("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:h("div",{className:"sc-card",children:h("p",{className:"sc-note",children:"Loading\u2026"})})}):T("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:[c&&h("button",{type:"button",className:"sc-modal-close",onClick:c,"aria-label":"Close",children:"\xD7"}),y==="manage"&&T("div",{className:"sc-card",children:[h("h2",{className:"sc-title",id:G,children:"Your compute"}),T("p",{className:"sc-sub",children:[h(lr,{context:v})," ",k.length>0&&u.length>0?"runs on your connected plan, and on these machines while they are awake.":u.length>0?"runs on the plan you connected. Nothing here is charged to you.":"runs on these machines, while they are awake."]}),h(Wn,{machines:k,hosted:u,onApproveRuntime:qt,onPreferRuntime:(p,M)=>void yr(p,M),onDisconnectHosted:p=>void un(p),onPair:()=>m("choose"),busy:$,...v?.app.name?{appName:v.app.name}:{}}),U&&h("p",{className:"sc-error",children:U})]}),y==="choose"&&T("div",{className:"sc-card",children:[h(Fi,{context:v}),h("h2",{className:"sc-h",id:G,children:d==="payment_required"?"Carry on with your own AI":d==="no_compute"?"This run needs a machine":"Connect your AI"}),h("p",{className:"sc-p",children:"Use compute you already have."}),he&&Rn.length>0&&T(rt,{children:[h("div",{className:"sc-opts",children:Rn.map(p=>{let M=An[p.id];return T("button",{type:"button",className:"sc-opt",onClick:()=>Yt(p.id),children:[h("span",{className:"sc-opt-tile","aria-hidden":"true",children:M&&h(M,{className:"sc-opt-mark"})}),h("span",{className:"sc-opt-text",children:h("span",{className:"sc-opt-label",children:p.label})}),(()=>{let Q=Jt(p.id);return Q?h("span",{className:`sc-opt-has sc-opt-has-${Q.tone}`,children:Q.text}):Ee===p.id?h("span",{className:"sc-opt-last",children:"last used"}):h(uo,{className:"sc-opt-go"})})()]},p.id)})}),T("p",{className:"sc-opt-note",children:["Your accounts stay there. ",Is(v)," never sees them."]})]}),(!he||Rn.length===0)&&h("p",{className:"sc-error",style:{marginTop:16},children:"This app has no publishable key yet, so there is nothing to pair against."}),U&&h("p",{className:"sc-error",children:U}),he&&v?.show_code===!0&&h("div",{className:"sc-opt-alt",children:h("button",{type:"button",className:"sc-alt-link",onClick:()=>m("code"),children:"I have a code"})})]}),y==="launch"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("choose")}),h("p",{className:"sc-head-title",children:"Soba"})]}),h(cr,{mark:Be?.Mark??Me,still:ge||!be&&V===null}),h("h2",{className:"sc-h",id:G,children:ge?"No answer from this machine":V==="absent"?"Nothing opened":V===null?"Opening Soba\u2026":"Approve it on this machine"}),ge?h("p",{className:"sc-p",children:"The Soba app did not answer. It may not be open, or nobody was there. Try again when you are ready."}):V==="absent"?h("p",{className:"sc-p",children:"Nothing opened on this machine. Open it yourself below, or install it if it is not here yet."}):h("p",{className:"sc-p",children:V===null?"Approve it there and this page does the rest.":"This page finishes on its own."}),Be&&T("p",{className:"sc-prereq",children:[Be.Mark&&h(Be.Mark,{className:"sc-rt-mark"}),"Needs ",Be.choice.prerequisite]}),T("div",{className:"sc-stack",style:{marginTop:18},children:[h("a",{className:V==="absent"||ge?"sc-btn sc-btn-primary":"sc-btn",href:Yn??"#",onClick:jt,children:ge?"Try again":V==="absent"?"Open Soba":"Open it again"}),h("p",{className:"sc-note",children:V===null?"Your browser will ask permission first.":"Your browser asks permission the first time."}),Be&&V==="absent"&&h("p",{className:"sc-note",children:h(Vi,{text:Be.choice.hint})}),T("div",{className:"sc-foot-strip",children:[h("span",{children:"Not installed on this machine?"}),T("button",{type:"button",className:"sc-foot-go",onClick:()=>m("get"),children:["Get it",h(uo,{})]})]})]})]}),y==="get"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("launch")}),h("p",{className:"sc-head-title",children:"Get Soba"})]}),h("div",{className:"sc-opts",children:xt.map(p=>T("a",{className:"sc-opt",href:`${Qt}/download/${p.slug}`,target:"_blank",rel:"noreferrer noopener",children:[h("span",{className:"sc-opt-tile","aria-hidden":"true",children:h(Vr,{className:"sc-opt-mark"})}),h("span",{className:"sc-opt-text",children:h("span",{className:"sc-opt-label",children:p.label})}),h(uo,{className:"sc-opt-go"})]},p.slug))}),h("p",{className:"sc-opt-note",children:"Install it, then come back here and press the row you started with."})]}),y==="code"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("choose")}),h("p",{className:"sc-head-title",children:"Soba"})]}),h("h2",{className:"sc-h",id:G,children:"Enter the code from that machine"}),h("p",{className:"sc-p",children:"Eight characters, shown by the Soba app once you paste the link."}),T("form",{className:"sc-stack",style:{marginTop:16},onSubmit:p=>{p.preventDefault(),Vt()},children:[h("input",{className:"sc-input",value:W,onChange:p=>L(p.target.value),placeholder:"ACDE-F234",autoComplete:"off",autoFocus:!0,"aria-label":"Pairing code"}),U&&h("p",{className:"sc-error",children:U}),h("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:$||W.length<8,children:$?"Checking\u2026":"Continue"})]})]}),y==="confirm"&&D&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("code")}),h("p",{className:"sc-head-title",children:"Soba"})]}),h("h2",{className:"sc-title",children:"Attach this machine to your account?"}),T("p",{className:"sc-sub",children:[h(lr,{context:v})," may send your runs to it once you approve. It can never see the account or the keys on it."]}),T("ul",{className:"sc-facts",children:[h(Rt,{k:"Code",v:D.user_code}),h(Rt,{k:"Machine",v:D.hostname??"not stated"}),h(Rt,{k:"System",v:[D.platform,D.arch].filter(Boolean).join(" / ")||"not stated"}),h(Rt,{k:"Asked by",v:D.client??"not stated"}),D.labels.length>0&&h(Rt,{k:"Labels",v:D.labels.join(", ")})]}),h("p",{className:"sc-note",style:{marginTop:12},children:"Every line above is what that machine said about itself. If none of it looks like a computer of yours, say no."}),Ze==="expired"&&h("p",{className:"sc-error",children:"That code has expired. Ask the machine for a new one. It prints a fresh code each time it starts."}),Ze==="answered"&&h("p",{className:"sc-error",children:"That code has already been answered. If it was not you, deny the next one."}),U&&h("p",{className:"sc-error",children:U}),T("div",{className:"sc-row",style:{marginTop:16},children:[h("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void dn(),disabled:$||Ze!=="live",children:"Approve"}),h("button",{type:"button",className:"sc-btn",onClick:()=>void Jn(),disabled:$||Ze==="answered",children:"No, deny it"})]}),Ze==="live"&&D.expires_at&&T("p",{className:"sc-note",style:{marginTop:10},children:["This code expires in ",Hi(Date.parse(D.expires_at)-P),"."]})]}),y==="waiting"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("choose")}),h("p",{className:"sc-head-title",children:Be?.choice.short??"Soba"})]}),h(cr,{mark:Be?.Mark??Me}),h("h2",{className:"sc-h",id:G,children:"Approved. Waiting for it to connect"}),h("p",{className:"sc-p",children:"Nothing more to do here. This page changes when it arrives."}),ee>0&&P-ee>Wi&&T("ol",{className:"sc-stall",children:[me==="app"?T(rt,{children:[h(ur,{done:!0,title:"Soba Connect opened",line:"On this machine"}),h(ur,{done:!0,title:"You approved it",line:"In Soba Connect"})]}):h(ur,{done:!0,title:"You approved the code",line:"On this page"}),h(ur,{title:`Still nothing from ${D?.hostname??"that machine"}`,line:"Look at Soba Connect on that machine: it says what it is doing. This keeps watching either way.",children:h("button",{type:"button",className:"sc-btn sc-stall-act",onClick:()=>void Tn(),children:"Open Soba Connect"})})]})]}),y==="connected"&&T("div",{className:"sc-card",children:[h(po,{tone:"ok"}),h("h2",{className:"sc-h",id:G,children:Ce?.label?`${Ce.label} is connected`:"Connected"}),T("p",{className:"sc-p",children:[h(lr,{context:v})," will use ",Ce?.label?"it":"this machine"," from now on, while it is awake."]}),o&&T(rt,{children:[Ce&&h(zi,{machine:Ce}),h("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-wide",style:{marginTop:14},onClick:pn,children:"Done"})]})]}),y==="hosted"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[h(tt,{onClick:()=>m("choose")}),h("p",{className:"sc-head-title",children:"ChatGPT"})]}),B?h(cr,{mark:Gn,still:!0}):h(cr,{mark:Gn}),h("h2",{className:"sc-h",id:G,children:B?"Your browser blocked the window":"Finish signing in to ChatGPT"}),h("p",{className:"sc-p",children:B?"Nothing opened. Open the sign-in yourself below. A link you click is allowed where a window we open is not.":"Approve it in the window that opened."}),T("div",{className:"sc-stack",style:{marginTop:18},children:[B&&h("a",{className:"sc-btn sc-btn-primary",href:B,target:"soba-connect-plan",rel:"noreferrer",children:"Open the ChatGPT sign-in"}),U&&h("p",{className:"sc-error",children:U}),I>0&&P-I>Di&&h("p",{className:"sc-note sc-tone-warn",children:"Still nothing. The window may have been closed before it finished, or the sign-in may have been declined. This keeps watching either way."})]})]}),y==="hosted_connected"&&T("div",{className:"sc-card",children:[h(po,{tone:"ok"}),h("h2",{className:"sc-h",id:G,children:"ChatGPT is connected"}),T("p",{className:"sc-p",children:[h(lr,{context:v})," will run on your ChatGPT plan",u[0]?.account_label?` (${u[0].account_label})`:"",". Nothing more to pay, nothing to install."]}),h("p",{className:"sc-opt-note",style:{textAlign:"center"},children:"It runs on our side, so it has no access to your files or your terminal."}),o&&T(rt,{children:[h("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:pn,children:"Done"}),h("div",{className:"sc-opt-alt",children:h("button",{type:"button",className:"sc-alt-link",onClick:()=>m("choose"),children:"Connect a machine too"})})]})]}),y==="denied"&&T("div",{className:"sc-card",children:[h(po,{tone:"off"}),h("h2",{className:"sc-h",id:G,children:"Declined"}),h("p",{className:"sc-p",children:Te==="machine"?"Nothing was connected. You can ask again whenever you like.":"That machine was not attached to your account, and the terminal has been told so."}),h("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:()=>m("choose"),children:"Back to the start"})]})]})}function Is(e){return e?.app.name??"this app"}function Ui(e){let n=e?.app.icon_urls;if(n?.length)return n;let t=e?.app.icon_url;return t?[t]:[]}function Ls(e){let n=Ui(e),[t,r]=ce([]),o=Ne(c=>{c&&r(i=>i.includes(c)?i:[...i,c])},[]),a=Ne(c=>o(c.currentTarget.getAttribute("src")),[o]),s=Ne(c=>{c?.complete&&c.naturalWidth===0&&o(c.getAttribute("src"))},[o]);return{icon:n.find(c=>!t.includes(c)),onError:a,ref:s}}function Fi({context:e}){let{icon:n,onError:t,ref:r}=Ls(e);return e?.app.mark==="soba"?h(Me,{className:"sc-app-mark"}):n?h("img",{className:"sc-app-mark",src:n,alt:"","aria-hidden":"true",ref:r,onError:t}):null}function lr({context:e}){let{icon:n,onError:t,ref:r}=Ls(e),o=e?.app.mark==="soba";return T("span",{className:"sc-app",children:[o&&h(Me,{className:"sc-app-icon"}),!o&&n&&h("img",{className:"sc-app-icon",src:n,alt:"",ref:r,onError:t}),Is(e)]})}function tt({onClick:e}){return h("button",{type:"button",className:"sc-head-back",onClick:e,"aria-label":"Back",children:h("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:h("path",{d:"M15 5 8 12l7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function uo({className:e}){return h("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:h("path",{d:"M9 5l7 7-7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function cr({mark:e,still:n}){return T("span",{className:"sc-waiting","aria-hidden":"true",children:[!n&&h("svg",{className:"sc-waiting-orbit",viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:h("circle",{className:"sc-waiting-arc",cx:"50",cy:"50",r:"46"})}),h(e,{className:"sc-waiting-mark"})]})}function po({tone:e}){return h("span",{className:`sc-result sc-result-${e}`,"aria-hidden":"true",children:h(mn,{kind:e==="ok"?"snap":"gone",size:84})})}function zi({machine:e}){let{runtime:n}=Fe(e);if(!n)return null;let t=Ke(n);return T("div",{className:"sc-arrived",children:[h(Kr,{id:n.id,name:n.display_name}),h("span",{className:"sc-arrived-name",children:n.display_name}),T("span",{className:`sc-arrived-auth${t.tone==="warn"?" sc-tone-warn":""}`,children:[t.tone==="ok"&&h("i",{className:"sc-arrived-dot","aria-hidden":"true"}),t.tone==="ok"?"Signed in":t.tone==="warn"?"Signed out":"Could not tell"]})]})}function ur({done:e,title:n,line:t,children:r}){return T("li",{className:"sc-stall-step",children:[T("svg",{viewBox:"0 0 20 20",className:e?"sc-stall-ok":"sc-stall-open","aria-hidden":"true",children:[h("circle",{cx:"10",cy:"10",r:"9"}),e?h("path",{d:"M6 10.3 8.7 13 14 7.5"}):T(rt,{children:[h("path",{d:"M10 5.5v5.5"}),h("circle",{className:"sc-stall-pt",cx:"10",cy:"14.3",r:"1.2"})]})]}),h("span",{className:"sc-stall-title",children:n}),h("span",{className:"sc-stall-line",children:t}),r&&h("span",{className:"sc-stall-more",children:r})]})}function Vi({text:e}){return h(rt,{children:e.split("`").map((n,t)=>t%2===1?h("code",{className:"sc-inline-code",children:n},t):n)})}function Rt({k:e,v:n}){return T("li",{className:"sc-fact",children:[h("span",{className:"sc-fact-key",children:e}),h("span",{children:n})]})}import{forwardRef as Qi}from"react";import{jsx as fo,jsxs as go}from"react/jsx-runtime";var ho=Qi(function({machine:n,className:t,...r},o){if(!n)return null;let{ariaLabel:a,state:s}=Kn(n);return go("button",{ref:o,type:"button","aria-label":a,className:["sc-btn","sc-btn-connected",t].filter(Boolean).join(" "),...r,children:[fo("span",{className:"sc-pill-tile","aria-hidden":"true",children:fo(mn,{kind:s.tone==="busy"?"serving":s.tone==="ok"?"ready":n.pairing_lost?"gone":"paused",size:16,className:"sc-pill-mark"})}),go("span",{className:"sc-btn-connected-text",children:[s.word,!n.pairing_lost&&go("span",{className:"sc-btn-connected-where",children:[" on ",le(n)]})]}),fo("i",{className:`sc-dot sc-dot-${s.tone}`,"aria-hidden":"true"})]})});function Os(e){if(e.type==="boolean")return e.name;if(e.type==="text")return`${e.name}: ${String(e.value??"").trim()}`;let n=e.unit?.trim()||e.name.toLowerCase();if(e.price){let r=Ji(e.price.amountMicros),o=n.endsWith("s")?n.slice(0,-1):n,a=e.price.included>0?`${e.price.included.toLocaleString("en-US")} ${n} included, then ${r} per ${o}`:`${r} per ${o}`;return e.value===null?a:`${a}, up to ${e.value.toLocaleString("en-US")}`}let t=e.resets==="month"?" a month":"";return e.value===null?`Unlimited ${n}${t}`:`${e.value.toLocaleString("en-US")} ${n}${t}`}var Ji=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD"});function dr(e){let n=[];for(let t of e??[])!t.name?.trim()&&!t.unit?.trim()||n.push({text:Os(t),included:!(t.type==="boolean"&&t.value!==!0)});return n}function bo(e,n,t=1){let r=e.quantities?.[n]??0,o=(i,l=null)=>({feature:n,allowed:!1,reason:i,limit:l,used:r,remaining:l===null?null:Math.max(0,l-r),unlimited:!1});if(e.features===null)return o("no_plan");if(e.ended)return o("plan_ended",0);if(!(n in e.features))return o("not_included");let a=e.features[n];if(typeof a=="string")return a.trim()?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(typeof a=="boolean")return a?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(a==null)return{feature:n,allowed:!0,reason:null,limit:null,used:r,remaining:null,unlimited:!0};let s=Math.max(0,t),c=Math.max(0,a-r);return a===0?o("not_included",0):r+s>a?o("limit_reached",a):{feature:n,allowed:!0,reason:null,limit:a,used:r,remaining:c,unlimited:!1}}import{useEffect as Yi,useRef as yo}from"react";var pr=0,Ao=null;function Ts(){if(typeof document>"u")return()=>{};pr===0&&(Ao=document.body.style.overflow,document.body.style.overflow="hidden"),pr+=1;let e=!1;return()=>{e||(e=!0,pr-=1,pr===0&&(document.body.style.overflow=Ao??"",Ao=null))}}import{jsx as Bs}from"react/jsx-runtime";function Pt({open:e,onClose:n,labelledBy:t,theme:r,style:o,children:a}){let s=yo(null),c=yo(null),i=yo(null);return Yi(()=>{let l=s.current;if(l){if(!e){l.open&&l.close();return}return l.open||l.showModal(),document.activeElement===l&&c.current?.focus(),Ts()}},[e]),Bs("dialog",{ref:s,className:"soba-connect sc-modal","aria-labelledby":t,...r?{"data-theme":r}:{},style:o,onCancel:l=>{l.preventDefault(),n()},onPointerDown:l=>{i.current=l.target},onClick:l=>{l.target===l.currentTarget&&i.current===l.currentTarget&&n()},children:Bs("div",{className:"sc-modal-sheet",ref:c,tabIndex:-1,children:a})})}import{useEffect as wo,useRef as ji}from"react";import{jsx as qi}from"react/jsx-runtime";var Dn=8;function vo({open:e,onClose:n,anchor:t,label:r,theme:o,style:a,children:s}){let c=ji(null);return wo(()=>{let i=c.current;if(!(!i||!(typeof i.showPopover=="function")))try{e?i.showPopover():i.hidePopover()}catch{}},[e]),wo(()=>{if(!e)return;let i=()=>{let d=c.current,g=t.current;if(!d||!g)return;let b=g.getBoundingClientRect(),y=d.offsetWidth,m=d.offsetHeight,v=window.innerWidth-y-Dn,A=Math.max(Dn,Math.min(b.right-y,Math.max(Dn,v))),k=b.bottom+Dn,S=b.top-Dn-m,W=k+m>window.innerHeight-Dn&&S>Dn?S:k;d.style.left=`${Math.round(A)}px`,d.style.top=`${Math.round(W)}px`};i();let l=requestAnimationFrame(i);return window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{cancelAnimationFrame(l),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[e,t]),wo(()=>{if(!e)return;let i=d=>{d.key==="Escape"&&n()},l=d=>{let g=d.target;g&&(c.current?.contains(g)||t.current?.contains(g)||n())};return document.addEventListener("keydown",i),document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("keydown",i),document.removeEventListener("pointerdown",l,!0)}},[e,n,t]),qi("div",{ref:c,role:"dialog","aria-label":r,className:"soba-connect sc-pop",...o?{"data-theme":o}:{},popover:"manual",hidden:!e,style:a,children:s})}var Et=new Map,ot=new Map,Gs=!1;function Zi(){Gs||typeof window>"u"||(Gs=!0,window.addEventListener("storage",e=>{!e.key||!Et.has(e.key)||(ot.set(e.key,ar(e.key)),ko(e.key))}))}function ko(e){for(let n of Et.get(e)??[])n()}function It(e){return e??""}function Co(e,n){let t=It(e);Zi();let r=Et.get(t)??new Set;return r.add(n),Et.set(t,r),()=>{r.delete(n),r.size===0&&Et.delete(t)}}function mr(e){let n=It(e),t=ot.get(n);if(t!==void 0)return t;let r=e?ar(e):null;return ot.set(n,r),r}function Mo(){return null}function No(e,n){mr(e)===null&&(ot.set(It(e),n),ko(It(e)))}function xo(e,n){let t=It(e);ot.get(t)!==n&&(ot.set(t,n),oo(e,n),ko(t))}var Xi=e=>e.toLocaleString("en-US");function Oe(e,n){if(e==="cost")return`${(n/1e4).toLocaleString("en-US",{style:"currency",currency:"USD"})} of usage`;let t=e==="token"?"token":e;return`${Xi(n)} ${t}${n===1?"":"s"}`}function Hn(e){return e==="token"?"1M tokens":e==="cost"?"$1 of usage":e==="credit"?"1,000 credits":e}function Lt(e){return e==="cost"?"usage":`${e}s`}function Ot(e,n,t){let r=t?.trim();if(!r||e!=="run"&&e!=="task"&&e!=="message")return Oe(e,n);let o=r.endsWith("s")?r.slice(0,-1):r;return`${n.toLocaleString("en-US")} ${n===1?o:r}`}function sn(e){return e.reward==="included"&&e.includedUnits!==null?`${Oe(e.unit,e.includedUnits)} a month once you connect`:e.reward==="credit"&&e.creditMicros>0?`${Ki(e.creditMicros)} back each month you stay connected`:null}function an(e){return e==="included"}function Un(e){if(!e.routePrefer.some(t=>So.has(t)||t==="user-api-key"))return null;let n=e.ownUnit??e.unit;return e.ownIncludedUnits===null?e.includedUnits!==null?`Unlimited ${n==="cost"?"usage":(n==="run"||n==="task")&&e.taskNoun?.trim()?e.taskNoun.trim():`${n}s`} on your own AI`:null:`${Ot(n,e.ownIncludedUnits,e.taskNoun)} a month on your own AI`}var So=new Set(["user-hardware","user-subscription"]),Ws=new Set(["open-weights","frontier"]);function Ve(e){return e===null||e.length===0?!1:e.every(n=>So.has(n))}var Ki=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function Ro(e,n){if(!(n===null||n.some(a=>Ws.has(a))))return!1;let r=e.findIndex(a=>So.has(a));if(r===-1)return!1;let o=e.findIndex(a=>Ws.has(a));return o===-1||r<o}import{createContext as Ds,useContext as Hs}from"react";var Po=Ds(null);function wn(){return Hs(Po)}var Eo=Ds({context:null,machines:void 0,theme:"light"});function _(){return Hs(Eo)}import{useMemo as el}from"react";import{createContext as _i,useContext as $i}from"react";var Io=_i(null);function K(){let e=$i(Io);if(!e)throw new Error("useSoba() must be used inside a <SobaProvider>.");return e}function Tt(){let{compute:e}=K();return el(()=>{let n=e.machines,t=[...n].sort((a,s)=>_e([a,s])===a?-1:1).map(nl),r=_e([...n]),o=In(n);return{view:t.length?"machines":e.loading?"loading":e.error?"error":"empty",machines:t,primary:r?t.find(a=>a.machine.id===r.id)??null:null,connected:e.connected,online:e.online,stalled:e.connected&&!e.online&&o?t.find(a=>a.machine.id===o.id)??null:null,loading:e.loading,error:e.error,refresh:e.refresh}},[e])}function nl(e){let n=Fe(e);return{machine:e,name:le(e),state:Ln(e),status:Mr(e),hardware:ht(e),lastSeen:e.state==="offline"?bt(e.last_seen_at):null,runtimes:we(e).map(t=>({runtime:t,name:t.display_name,auth:Ke(t),quarantined:!!t.quarantined})),runsOn:{by:n.by,name:n.runtime?.display_name??null}}}import{useCallback as Lo,useEffect as tl,useMemo as Qe,useSyncExternalStore as rl}from"react";function Fn(e={}){let{compute:n,connect:t,models:r}=K(),{value:o,onChange:a,defaultValue:s,remember:c=!0,user:i}=e,l=e.layout??(e.choices?.length?"choices":r.layout??"providers"),d=JSON.stringify(e.choices??[]),g=o!==void 0,b=c&&!g?ro(t.publishableKey,i):null,y=Lo(P=>Co(b,P),[b]),m=rl(y,Lo(()=>mr(b),[b]),Mo),v=Qe(()=>r.rowsByLayout[l]??(r.sizes===!1?{auto:!0,fast:!1,best:!1}:void 0),[r.rowsByLayout,r.sizes,l]),A=Qe(()=>Tr(wt(n.machines,r.providers,r.names,r.route?.allow),v),[n.machines,r.providers,r.names,r.route,v]),k=Qe(()=>Or(A,l,JSON.parse(d)),[A,l,d]),S=Qe(()=>Br(k,l,v),[k,l,v]),W=l==="models"&&v?.own===!0,L=Qe(()=>vt(S,l,W),[S,l,W]),D=Qe(()=>[...A,...k.filter(P=>!A.some(q=>q.id===P.id))],[A,k]),O=Qe(()=>{let P=[];for(let V of[...n.machines].sort(Xn))for(let Z of we(V)){if(P.some(Y=>Y.id===Z.id)||r.route&&!r.route.allow.includes(Z.cost_class))continue;let be=$e[Z.id];P.push({id:Z.id,name:Z.display_name,...be?{logo:be}:{},options:S.filter(Y=>Y.kind==="named"&&Y.runtime===Z.id)})}let q=L.flatMap(V=>V.options.map(Z=>Z.id));for(let V of P)V.options.sort((Z,be)=>q.indexOf(Z.id)-q.indexOf(be.id));return P},[n.machines,S,L,r.route]),U=Qe(()=>r.providers.map(P=>{let q=`@${P.id}/`;return{id:P.id,name:P.name,...P.provider?{mark:P.provider}:{},costClass:P.cost_class,...P.locked?{locked:P.locked}:{},options:A.filter(V=>V.id.startsWith(q))}}),[r.providers,A]);tl(()=>{g||!s||No(b,s)},[g,s,b]);let w=Qe(()=>{let P=r.names.find(q=>q.default);if(P&&l==="choices")return`alias:${P.alias}`;for(let q of r.providers){let V=q.models.find(Z=>Z.default);if(V&&l!=="choices")return`@${q.id}/${V.model}`}return null},[r.names,r.providers,l]),$=g?o:l==="automatic"?s??null:m??s??w,j=Qe(()=>S.some(P=>P.kind==="auto")?null:L.flatMap(P=>P.options).find(P=>!P.locked)?.id??null,[S,L]),ee=!$||$==="auto"?j??$:$,{selected:ae,unavailable:me}=Qe(()=>Gr(D,ee??null),[D,ee]),fe=Lo(P=>{g||xo(b,P),a?.(P)},[g,b,a]);return{options:S,groups:L,selected:ae,select:fe,agents:O,providers:U,models:A.filter(P=>P.kind==="provider"),choices:S.filter(P=>P.choice!==void 0),layout:l,ownInList:W,search:v?.search!==!1,run:Wr(ae),unavailable:me,pickable:hn(S),loading:n.loading&&!n.machines.length||r.loading&&!r.providers.length&&!n.machines.length}}function ol(e){return e.runtime?$e[e.runtime]:void 0}import{jsx as Bt}from"react/jsx-runtime";function sl({className:e}){let{theme:n}=_(),t=e?`soba-connect ${e}`:"soba-connect";return Bt("div",{className:t,"data-theme":n,children:Bt(Oo,{})})}function Oo(){let e=Tt(),n=Fn();return e.view==="loading"?Bt("p",{className:"sc-note",children:"Loading\u2026"}):e.view==="error"?Bt("p",{className:"sc-error",children:e.error?.message}):Bt(_r,{machines:e.machines.map(t=>t.machine),model:n.selected,onPickModel:n.select})}import{useCallback as Wt,useEffect as Wo,useMemo as ml,useRef as Do,useState as at}from"react";import{useId as al}from"react";import{jsx as st,jsxs as fr}from"react/jsx-runtime";function Gt({open:e,onOpenChange:n,initialCode:t,onConnected:r,showStatus:o,reason:a}){let{error:s}=K(),c=wn(),i=_(),l=()=>n(!1),d=al(),g=i.context?.background?.trim(),b=g?En(g,i.context?.accent):void 0;return fr(Pt,{open:e,onClose:l,labelledBy:d,theme:i.theme,style:b,children:[s?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"Could not start"}),st("p",{className:"sc-error",children:s.message})]}):!c&&!i.context?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"One moment"}),st("p",{className:"sc-note",children:"Getting your compute\u2026"})]}):st(mo,{client:c,active:e,onClose:l,headingId:d,theme:i.theme,initialContext:i.context,...i.machines!==void 0?{initialMachines:i.machines}:{},...t?{initialCode:t}:{},...r?{onConnected:r}:{},...o===void 0?{}:{showStatus:o},...a?{reason:a}:{}}),fr("p",{className:"sc-modal-foot",children:[st(Me,{className:"sc-foot-mark"}),"Secured by Soba"]})]})}import{forwardRef as il}from"react";import{jsx as ll}from"react/jsx-runtime";var To=il(function(n,t){let{theme:r}=_();return ll(ho,{ref:t,"data-theme":r,...n})});import{useCallback as cl}from"react";function ul(){let{connect:e}=K(),n=Tt(),t=cl(()=>e.open("manual"),[e]);return{...Kn(n.primary?.machine??null),machine:n.primary,open:t,canOpen:e.hasModal,loading:n.view==="loading"}}function Bo(e){return Kn(e)}import{useCallback as Us,useEffect as dl,useState as pl}from"react";function Go({enabled:e=!0,intervalMs:n=3e3}={}){let t=wn(),[r,o]=pl(null),a=Us(async()=>{t&&o(await t.runs())},[t]);dl(()=>{if(!e||!t)return;let c=!0,i=He(async()=>{let l=await t.runs();c&&o(l)},n);return()=>{c=!1,i()}},[e,t,n]);let s=Us(async c=>{if(!t)throw new Error("Stopping a run needs <SobaProvider>.");await t.stopRun(c),await a().catch(()=>{})},[t,a]);return{runs:r,refresh:a,stop:s}}import{Fragment as Fs,jsx as it,jsxs as zs}from"react/jsx-runtime";function zn({children:e,variant:n,className:t,initialCode:r,onConnected:o,defaultOpen:a,open:s,onOpenChange:c,showConnected:i=!0}){let{compute:l,connect:d}=K(),g=_(),{theme:b}=g,y=wn(),[m,v]=at(a??!!r),A=Do(null),k=s!==void 0,S=!k&&!a&&!r&&d.hasModal,W=k?s:S?d.isOpen:m,L=N=>{S?N?d.open("manual"):d.close():k||v(N),c?.(N)},D=Do(W);Wo(()=>{D.current&&!W&&A.current?.focus(),D.current=W},[W]);let[O,U]=at(!1),{runs:w,stop:$}=Go({enabled:O}),j=Fn(),ee=ml(()=>O&&w?fl(l.machines,w):l.machines,[l.machines,O,w]),ae=_e(ee),me=i&&Bo(ae).connected,fe=Wt(()=>U(!1),[]),[P,q]=at(!1),V=Wt(async()=>{q(!0);try{await l.refresh()}finally{q(!1)}},[l]),Z=Do(V);Z.current=V,Wo(()=>{O&&Z.current()},[O]);let[be,Y]=at(!1),[ge,Ae]=at([]),Te=!!g.context?.hosted_available;Wo(()=>{if(!O||!y||!Te)return;let N=!0;return y.hosted().then(H=>{N&&Ae(H.credentials)}).catch(()=>{}),()=>{N=!1}},[O,y,Te]);let[Pe,ne]=at(null),de=Wt(async(N,H)=>{if(y){ne(null);try{await y.approveRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),u=Wt(async(N,H)=>{if(y){ne(null);try{await y.preferRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),R=Wt(async N=>{if(y){ne(null);try{await y.disconnectHosted(N),Ae((await y.hosted()).credentials)}catch(H){ne(H.message)}}},[y]),I=g.context?.background?.trim(),J=I?En(I,g.context?.accent):void 0,B=me&&!e,te=()=>{if(B&&!k&&!a&&!r){U(N=>!N);return}L(!0)};return zs(Fs,{children:[B?it(To,{ref:A,machine:ae,"aria-haspopup":"dialog","aria-expanded":O,onClick:te,...t?{className:t}:{}}):it("button",{ref:A,type:"button","data-theme":b,className:["sc-btn","sc-btn-icon",n==="primary"?"sc-btn-primary":"",t].filter(Boolean).join(" "),onClick:te,children:e??zs(Fs,{children:[it(Me,{className:"sc-btn-mark"}),"Connect compute"]})}),it(vo,{open:O,onClose:fe,anchor:A,label:"Your compute",theme:b,...J?{style:J}:{},children:it(Wn,{machines:ee,hosted:ge,onApproveRuntime:(N,H)=>void de(N,H),onPreferRuntime:(N,H)=>void u(N,H),onDisconnectHosted:N=>void R(N),onRefresh:()=>void V(),refreshing:P,model:j.selected,onPickModel:j.select,error:Pe,runs:w,onStopRun:async N=>{ne(null);try{await $(N)}catch(H){throw ne(H.message),H}},onPair:()=>{U(!1),S?d.open("pair"):(Y(!0),L(!0))},...g.context?.app.name?{appName:g.context.app.name}:{}})}),!S&&it(Gt,{open:W,onOpenChange:N=>{N||Y(!1),L(N)},...be?{showStatus:!1}:{},...r?{initialCode:r}:{},...o?{onConnected:o}:{}})]})}function fl(e,n){return e.map(t=>{if(t.state==="offline")return t;let r=n.filter(o=>o.machine_id===t.id).length;return{...t,active:r,state:r>0?"busy":"online"}})}import{jsx as Ho,jsxs as hl}from"react/jsx-runtime";function gl({initialCode:e,onConnected:n,className:t,showStatus:r=!0}){let{theme:o}=_();return hl("div",{className:t?`soba-connect ${t}`:"soba-connect","data-theme":o,children:[r&&Ho(Oo,{}),Ho("div",{className:"sc-compute-act",children:Ho(zn,{...e?{initialCode:e}:{},...n?{onConnected:n}:{}})})]})}import{useId as Rl,useState as Pl}from"react";import{useCallback as Fo,useEffect as js,useState as qs}from"react";import{useCallback as bl,useState as Al}from"react";function Dt(){let[e,n]=Al(null);return{open:bl(()=>{n(null),Tn().then(n)},[]),launch:e,note:e==="absent"?"Nothing opened here. That machine may be a different computer, or asleep.":null}}import{useCallback as Vs,useMemo as Qs}from"react";function Vn(e){if(!e)return null;if(typeof e=="string")return e;if(typeof Response<"u"&&e instanceof Response)return Js(e.status);let n=e,t=n.error;return typeof t?.code=="string"?t.code:typeof t?.type=="string"?t.type:typeof n.code=="string"?n.code:typeof n.status=="number"?Js(n.status):n.cause&&n.cause!==e?Vn(n.cause):null}function Js(e){return e===402?"payment_required":e===409?"no_compute":null}function Uo(...e){let[n,t]=e,{plan:r,compute:o,connect:a}=K(),s=t?.predict??e.length===0,c=wl(yl(n),o)??(s?vl(r,o):null),i=r.plan,l=r.plans,d=Qs(()=>{if(c!=="payment_required")return null;let m=i?.price??0,v=i?.included_units??0;return l.find(A=>A.id!==i?.id&&A.price>m&&(A.included_units===null||A.included_units>v))??null},[c,l,i]),g=Vs(async()=>{if(!d)return;if(d.selectable){await r.select(d.id);return}let m=await r.checkout(d.id);window.location.assign(m)},[d,r]),b=a.open,y=Vs(()=>{c&&b(c)},[b,c]);return Qs(()=>{if(!c)return null;let m=i?sn({unit:i.unit,reward:i.connected_reward,includedUnits:i.connected_included_units,creditMicros:i.connected_credit*1e6}):null,v=i?an(i.connected_reward)?m:Un({unit:i.unit,ownUnit:i.own_unit??null,includedUnits:i.included_units,ownIncludedUnits:i.own_included_units??null,routePrefer:i.route_prefer}):null;return{reason:c,...kl(c,{connectOffer:v,connected:o.connected,online:o.online,machine:In(o.machines)?.label??null,unit:i?.unit??"message",interval:i?.interval??"month",upgrade:d!==null,resets:r.current?.period_end??null}),connectOffer:v,upgradeTo:d,connect:y,upgrade:g}},[c,i,o,d,y,g,r.current?.period_end])}function yl(e){let n=Vn(e);return n==="payment_required"||n==="no_compute"?n:null}function wl(e,n){return e==="no_compute"&&n.connected&&n.online?null:e}function vl(e,n){let t=e.plan;return!t||n.loading?null:Ve(t.route_allow)&&!n.online?"no_compute":e.remaining===0&&t.overage==="stop"?"payment_required":null}function kl(e,n){if(e==="payment_required"){let t=`No ${Lt(n.unit)} left this ${n.interval}`;return n.connectOffer&&!n.connected?{title:t,body:`${n.connectOffer}. Connecting takes a minute and costs nothing.`}:n.connectOffer&&!n.online?{title:t,body:`${n.connectOffer}. Waking ${n.machine??"your machine"} is enough.`}:n.upgrade?{title:t,body:n.resets?`A larger plan carries on now. This one comes back on ${Ys(n.resets)}.`:"A larger plan carries on now, or wait for this one to renew."}:{title:t,body:n.resets?`Your allowance comes back on ${Ys(n.resets)}.`:"Your allowance comes back at the start of the next period."}}return n.connected&&!n.online?{title:`${n.machine??"Your machine"} can't be reached`,body:"This run needs it awake and connected. Open Soba on that machine, or connect another one."}:{title:"Nothing connected yet",body:"This app runs on AI you already pay for, on a machine of your own. Connect one and this run has somewhere to go."}}function Ys(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function Cl(e){let{plan:n,allowance:t,connected:r,online:o,quiet:a,error:s,predict:c,at:i,waved:l}=e;if(!n)return null;let d=e.allow!==void 0?e.allow:n.route_allow;if(r){if(o)return null;let v=Ve(d);return{reason:"stalled",title:`${a??"Your machine"} can\u2019t be reached`,detail:v?"The Soba app there has stopped reporting in, so runs have nowhere to go until it is back.":"The Soba app there has stopped reporting in, so nothing will run on your own AI until it is back.",meter:null,dismissible:!1,atTheWall:!1,ownCompute:v}}let g=Vn(s),b=g==="payment_required"||g==="no_compute",y=n.ask_to_connect!==!1&&Ro(n.route_prefer,d);if(!c&&!b&&!y)return null;let m=Ve(d)?Ml(n.unit,Ve(n.route_allow)):an(n.connected_reward)||Zs(n,t.included)!==null?xl(t,n,i):y?Nl(n.unit):null;return!m||m.dismissible&&l?null:{...m,dismissible:!!m.dismissible,ownCompute:!1,atTheWall:!m.dismissible&&(!c||m.meter!==null&&m.meter.left===0)}}function zo(e={}){let{at:n=.25,error:t,allow:r}=e,o=e.predict??!(e.errorGiven??t!==void 0),{plan:a,compute:s,connect:c}=K(),i=so(c.publishableKey),[l,d]=qs(!1);js(()=>{d(ao(i))},[i]);let g=Fo(()=>{d(!0),io(i)},[i]),b=Fo(()=>c.open("manual"),[c]),y=Fo(()=>c.open("no_compute"),[c]),m=Dt(),[v,A]=qs(!1),{refresh:k}=s,{launch:S}=m;js(()=>{if(S===null||S==="absent")return;A(!1);let U=setInterval(()=>void k(),3e3),w=setTimeout(()=>{clearInterval(U),A(!0)},2e4);return()=>{clearInterval(U),clearTimeout(w)}},[S,k]);let W=Sl(c.app?.name,St(c.connectUrl)),L=a.loading||s.loading,D=In(s.machines),O=L?null:Cl({plan:a.plan,allowance:{remaining:a.remaining,included:a.included},connected:s.connected,online:s.online,quiet:D?le(D):null,error:t,predict:o,...r!==void 0?{allow:r}:{},at:n,waved:l});return{reason:O?.reason??null,visible:O!==null,title:O?.title??null,detail:O?.detail??null,meter:O?.meter??null,dismissible:O?.dismissible??!1,dismissed:l,dismiss:g,open:b,atTheWall:O?.atTheWall??!1,steps:W,stalled:O?.reason==="stalled"?{machine:D?le(D):null,ownCompute:O.ownCompute,wake:m.open,launch:m.launch,note:m.note,stuck:v,connectAnother:y}:null,loading:L}}function Ml(e,n){return{reason:"needed",title:n?"This plan runs on your own AI.":`These ${e}s run on your own AI.`,detail:`Connect a machine and your ${e}s run there, free, on access you already have.`,meter:null}}function Nl(e){return{reason:"preferred",title:"This plan prefers your own AI.",detail:`Connect a machine and your ${e}s run there instead, on access you already have.`,meter:null,dismissible:!0}}function Zs(e,n){return Un({unit:e.unit,ownUnit:e.own_unit??null,includedUnits:n,ownIncludedUnits:e.own_included_units??null,routePrefer:e.route_prefer})}function xl(e,n,t){let{remaining:r,included:o}=e;if(r===null||o===null||o===0||r>Math.ceil(o*t))return null;let a=sn({unit:n.unit,reward:n.connected_reward,includedUnits:n.connected_included_units,creditMicros:n.connected_credit*1e6})??Zs(n,o);return a?{reason:"running",title:r===0?`No ${Lt(n.unit)} left this month.`:`${Oe(n.unit,r)} left this month.`,detail:`${a}.`,meter:{left:r,of:o}}:null}function Sl(e,n){return[{lead:"Download Soba",detail:"",...n?{linksLead:"Get it for"}:{},links:n?xt.map(t=>({label:t.label,href:`${n}/download/${t.slug}`})):[]},{lead:"Connect compute",detail:"Press this, then approve the pairing when the app asks.",opens:!0,links:[]},{lead:"Let your AIs serve",detail:`It finds what is installed on that machine. Allow one, and ${e??"this app"} sends every run there.`,linksLead:"Nothing on it yet?",links:Ie.map(t=>({label:t.short,href:t.install}))}]}import{Fragment as Ks,jsx as re,jsxs as vn}from"react/jsx-runtime";function El(e){let{className:n,fallback:t=null}=e,r=zo({...e.at===void 0?{}:{at:e.at},...e.predict===void 0?{}:{predict:e.predict},...e.allow===void 0?{}:{allow:e.allow},error:e.error,errorGiven:"error"in e}),{connect:o}=K(),{theme:a}=_(),[s,c]=Pl(null),i=Rl(),l=re(Ks,{children:t});if(!r.visible)return l;if(r.stalled)return re(Xs,{className:n,theme:a,stalled:!0,children:re(Il,{title:r.title??"",detail:r.detail??"",stalled:r.stalled})});let d=s??r.atTheWall;return vn(Xs,{className:n,theme:a,children:[vn("div",{className:"sc-nudge-top",children:[vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:r.title}),re("p",{className:"sc-nudge-detail",children:r.detail}),vn("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more","aria-expanded":d,"aria-controls":i,onClick:()=>c(!d),children:[d?"Hide the details":"How it works",re(Ol,{})]})]}),r.dismissible?re("button",{type:"button",className:"sc-nudge-dismiss","aria-label":"Dismiss",title:"Dismiss",onClick:r.dismiss,children:re(Ll,{})}):null]}),d?re("ol",{className:"sc-nudge-steps",id:i,children:r.steps.map(g=>vn("li",{children:[g.opens?re("button",{type:"button",className:"sc-step-lead",onClick:()=>o.open("manual"),children:g.lead}):re("strong",{children:g.lead}),g.detail?re("span",{children:g.detail}):null,g.links.length>0?vn("span",{className:"sc-step-links",children:[g.linksLead,g.links.map(b=>re("a",{href:b.href,target:"_blank",rel:"noreferrer noopener",children:b.label},b.href))]}):null]},g.lead))}):null,re(zn,{variant:"primary"})]})}function Xs({className:e,theme:n,stalled:t,children:r}){return re("div",{className:e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill","data-theme":n,children:re("div",{className:t?"sc-nudge sc-nudge-stalled":"sc-nudge",children:r})})}function Il({title:e,detail:n,stalled:t}){return vn(Ks,{children:[re("div",{className:"sc-nudge-top",children:vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:e}),re("p",{className:"sc-nudge-detail",children:n}),t.note&&re("p",{className:"sc-nudge-note",children:t.note}),t.stuck&&re("p",{className:"sc-nudge-note",children:"The Soba app is open, but this machine still isn\u2019t reporting in. It may no longer be connected to this app."}),(t.launch==="absent"||t.stuck)&&re("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more",onClick:t.connectAnother,children:t.stuck?"Connect it again":"Connect another machine"})]})}),re("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:t.wake,children:"Open Soba"})]})}function Ll(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-x",children:re("path",{d:"m4.8 4.8 6.4 6.4M11.2 4.8l-6.4 6.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function Ol(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-chev",children:re("path",{d:"M4.5 6.5 8 10l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}var Tl=new Set(["delta","thinking","status","done","error"]);function lt(e){let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!="object")return null;let t=n,r=t.type==="event"?t.event:t;if(!r||typeof r!="object")return null;let o=r;if(typeof o.type!="string"||!Tl.has(o.type))return null;let a={type:o.type};return typeof o.text=="string"&&(a.text=o.text),typeof o.message=="string"&&(a.message=o.message),typeof o.tool=="string"&&(a.tool=o.tool),typeof o.tier=="string"&&(a.tier=o.tier),o.usage&&typeof o.usage=="object"&&(a.usage=o.usage),typeof o.session=="string"&&(a.session=o.session),typeof o.toolInput=="string"&&(a.toolInput=o.toolInput),o.git&&typeof o.git=="object"&&(a.git=o.git),o.turn&&typeof o.turn=="object"&&typeof o.turn.text=="string"&&(a.turn={text:o.turn.text}),typeof o.reason=="string"&&(a.reason=o.reason),typeof o.retryable=="boolean"&&(a.retryable=o.retryable),(o.state==="interrupted"||o.state==="resumed")&&(a.state=o.state),a}async function*Vo(e){let n=e.body;if(!n)throw new Error("That run response had no body to stream.");let t=(e.headers.get("content-type")??"").includes("ndjson"),r=n.getReader(),o=new TextDecoder,a="",s=[];try{for(;;){let i=await r.read();if(i.done)break;for(a+=o.decode(i.value,{stream:!0});;){let l=a.indexOf(`
3
+ `);if(l===-1)break;let d=$s(a.slice(0,l));if(a=a.slice(l+1),t){let g=d.trim()?lt(d):null;g&&(yield g);continue}if(d===""){let g=s.join(`
4
+ `);if(s=[],g==="[DONE]")return;let b=g?lt(g):null;b&&(yield b);continue}_s(d,s)}}!t&&a&&_s($s(a),s);let c=t?a.trim():s.join(`
5
+ `);if(c&&c!=="[DONE]"){let i=lt(c);i&&(yield i)}}finally{r.cancel().catch(()=>{})}}function _s(e,n){if(!e||e.startsWith(":"))return;let t=e.indexOf(":");if(t===-1||e.slice(0,t)!=="data")return;let r=e.slice(t+1);n.push(r.startsWith(" ")?r.slice(1):r)}function $s(e){return e.endsWith("\r")?e.slice(0,-1):e}async function Bl(e){let n="";for await(let t of e)if(t.type==="delta"&&t.text&&(n+=t.text),t.type==="error")throw new Error(t.message??"The run ended with an error.");return n}import{jsx as ea}from"react/jsx-runtime";function Gl({caption:e,disabled:n,className:t,...r}){let{theme:o}=_(),{options:a,selected:s,select:c,pickable:i,layout:l,ownInList:d,search:g}=Fn(r),b=K().connect.app;return i?ea("span",{className:"soba-connect sc-inline","data-theme":o,children:ea(Mt,{options:a,layout:l,ownInList:d,search:g,selected:s,onPick:c,...b?.name?{appName:b.name}:{},...e?{caption:e}:{},...n?{disabled:n}:{},...t?{className:t}:{}})}):null}import{jsx as Dl}from"react/jsx-runtime";function Wl(e){return Dl(Bn,{...e})}import{useState as Ul}from"react";import{useCallback as Hl,useState as Qo}from"react";function Jo(){let e=wn(),{plan:n}=K(),[t,r]=Qo(!1),[o,a]=Qo(null),[s,c]=Qo(null);return{redeem:Hl(async l=>{if(!e)return a("No session yet."),null;r(!0),a(null);try{let{reward:d}=await e.redeemCode(l);return c(d),await n.refresh(),d}catch(d){return a(d.message),null}finally{r(!1)}},[e,n]),busy:t,error:o,reward:s}}import{jsx as gr,jsxs as na}from"react/jsx-runtime";function Fl(e){return e.kind==="discount"?`${e.name} applied. It comes off at checkout.`:e.kind==="grant"?`${e.name} applied. The extra usage is yours now.`:`${e.name} applied. You're on it now.`}function zl({label:e="Apply",placeholder:n="Promo code",onRedeemed:t,className:r}){let{theme:o}=_(),{redeem:a,busy:s,error:c,reward:i}=Jo(),[l,d]=Ul(""),g=async()=>{if(!l.trim()||s)return;let b=await a(l);b&&(d(""),t?.(b))};return na("div",{className:r?`soba-connect ${r}`:"soba-connect","data-theme":o,children:[na("form",{className:"sc-redeem",onSubmit:b=>{b.preventDefault(),g()},children:[gr("input",{className:"sc-input",value:l,onChange:b=>d(b.target.value),placeholder:n,"aria-label":n,autoComplete:"off",spellCheck:!1}),gr("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:s||!l.trim(),children:s?"Checking\u2026":e})]}),c&&gr("p",{className:"sc-error",children:c}),!c&&i&&gr("p",{className:"sc-note",children:Fl(i)})]})}import{useEffect as Vl}from"react";var ta="data-soba-react",ra=!1;function Ht(){if(ra||typeof document>"u"||(ra=!0,document.querySelector(`style[${ta}]`)))return;let e=document.createElement("style");e.setAttribute(ta,""),e.textContent=`.soba-connect {
6
6
  --sc-ground: #ffffff;
7
7
  --sc-sheet: #ffffff;
8
8
  --sc-raised: #f6f6f7;
@@ -4486,7 +4486,7 @@ li.sc-plan-row.sc-plan-current {
4486
4486
  .sc-redeem + .sc-note {
4487
4487
  margin-top: 8px;
4488
4488
  }
4489
- `,document.head.appendChild(e)}import{jsx as nn,jsxs as Ut}from"react/jsx-runtime";function oa(e){if(!e)return null;let n=Vn(e);if(n==="payment_required"||n==="no_compute")return null;if(typeof e=="string")return e||null;let t=e,r=t.error?.message;return typeof r=="string"&&r?r:typeof t.message=="string"&&t.message?t.message:"The run ended with an error."}function Ql(){return Ut("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[nn("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),nn("circle",{cx:"8",cy:"11.6",r:"0.9",fill:"currentColor"}),nn("circle",{cx:"8",cy:"8",r:"6.4",stroke:"currentColor",strokeWidth:"1.3"})]})}function Jl({error:e,onRetry:n,onDismiss:t,title:r,className:o}){let a=oa(e),s=_();return Vl(()=>Ht(),[]),a?nn("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":s.theme,role:"alert",children:Ut("div",{className:"sc-card sc-limit sc-run-error",children:[Ut("div",{className:"sc-limit-head",children:[nn("span",{className:"sc-limit-mark sc-run-error-mark","aria-hidden":"true",children:nn(Ql,{})}),Ut("div",{children:[nn("h2",{className:"sc-limit-title",children:r??"That run did not finish"}),nn("p",{className:"sc-limit-body sc-run-error-message",children:a})]})]}),(t||n)&&Ut("div",{className:"sc-limit-actions",children:[t&&nn("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,children:"Dismiss"}),n&&nn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:n,children:"Try again"})]})]})}):null}import{useId as Yl,useState as sa}from"react";import{jsx as xe,jsxs as gr}from"react/jsx-runtime";function jl({reason:e}){return xe("span",{className:"sc-limit-mark","aria-hidden":"true",children:e==="no_compute"?xe(er,{}):xe(Me,{})})}function ql(e){let{error:n,variant:t="card",onDismiss:r,className:o}=e,a=Uo(n,{predict:e.predict??!("error"in e)}),s=Yl(),c=_();if(!a)return null;let i=xe(Zl,{offer:a,headingId:s,onDismiss:r});return t==="dialog"?xe(Pt,{open:!0,onClose:()=>r?.(),labelledBy:s,theme:c.theme,children:i}):xe("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":c.theme,children:i})}function Zl({offer:e,headingId:n,onDismiss:t}){let{compute:r}=K(),[o,a]=sa(!1),[s,c]=sa(null),i=e.reason==="no_compute"&&r.connected&&!r.online,l=i||e.connectOffer!==null||!r.connected,d=Dt();async function h(){a(!0),c(null);try{await e.upgrade()}catch(b){c(b.message)}finally{a(!1)}}return gr("div",{className:"sc-card sc-limit",children:[gr("div",{className:"sc-limit-head",children:[xe(jl,{reason:e.reason}),gr("div",{children:[xe("h2",{className:"sc-limit-title",id:n,children:e.title}),xe("p",{className:"sc-limit-body",children:e.body})]})]}),s&&xe("p",{className:"sc-error",children:s}),i&&d.note&&xe("p",{className:"sc-limit-note",children:d.note}),gr("div",{className:"sc-limit-actions",children:[t&&xe("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,disabled:o,children:"Not now"}),e.upgradeTo&&xe("button",{type:"button",className:l?"sc-btn":"sc-btn sc-btn-primary",onClick:()=>void h(),disabled:o,children:o?"Opening\u2026":e.upgradeTo.selectable?`Switch to ${e.upgradeTo.name}`:`${e.upgradeTo.name} for $${e.upgradeTo.price.toLocaleString()}/${e.upgradeTo.interval}`}),l&&xe("button",{type:"button",className:i?"sc-btn":"sc-btn sc-btn-primary",onClick:e.connect,disabled:o,children:i?"Connect another machine":"Connect compute"}),i&&xe("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:d.open,disabled:o,children:"Open Soba"})]})]})}import{useMemo as Xl}from"react";function Kl(e){let n={};for(let t of e??[])n[t.id]=t.value;return n}function Ft(){let{plan:e,compute:n,connect:t}=K();return Xl(()=>{let r=e.plan,o=e.current,a={plan:r,assignment:o,loading:e.loading,error:e.error,periodEnd:o?.period_end?new Date(o.period_end):null,features:o?.features??Kl(r?.features)};if(!r)return{...a,state:"none",trialDaysLeft:null,ceiling:null,raised:!1,uncounted:!1,used:0,remaining:null,percent:null,unlimited:!1,reward:null,summary:"Nothing is assigned to this account, so runs are bounded by whatever the app allows."};let s=ec(o?.trial_ends_at??null),c=r.connected_reward==="included"&&n.connected&&r.connected_included_units!==null,i=c?r.connected_included_units:r.included_units,l=n.connected,d=i===null,h=e.used??0,b=i===null?null:Math.max(0,i-h),y=i&&i>0?Math.min(100,Math.round(h/i*100)):null,m=i!==null&&h>=i,v=s!==null?"trial":d?"unlimited":m?r.overage==="meter"?"metered":"spent":"within";return{...a,state:v,trialDaysLeft:s,ceiling:i,raised:c,uncounted:l,used:h,remaining:b,percent:y,unlimited:d,reward:_l(r,c,n.connected,()=>t.open("manual")),summary:$l({plan:r,assignment:o,used:h,ceiling:i,trialDaysLeft:s,raised:c,uncounted:l,state:v})}},[e,n.connected,t])}function _l(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6});return o?{line:o,inForce:n,required:!1,connected:t,actionable:an(e.connected_reward)&&!t,open:r}:Ve(e.route_allow)&&!t?{line:"Nothing connected yet, so nothing can run.",inForce:!1,required:!0,connected:t,actionable:!0,open:r}:null}function $l(e){let{plan:n,assignment:t,used:r,ceiling:o,trialDaysLeft:a,raised:s,uncounted:c,state:i}=e,l=c?" Runs your own AI serves do not count toward it.":"";if(i==="trial"&&a!==null){let b=n.price===0?"it continues free":`it is $${n.price.toLocaleString()} a ${n.interval}`;return`${a} ${a===1?"day":"days"} left of your trial, then ${b}.`}if(i==="unlimited")return`${Oe(n.unit,r)} this period. No ceiling on this plan.`;if(i==="metered"){let b=r-(o??0);return n.overage_per_unit>0?`${Oe(n.unit,b)} past the allowance, billed at $${n.overage_per_unit} per ${Hn(n.unit)}.${l}`:`${Oe(n.unit,b)} past the allowance.${l}`}if(i==="spent")return t?.period_end?`Allowance spent. It comes back on ${aa(t.period_end)}.${l}`:`Allowance spent. It comes back at the start of the next period.${l}`;let d=Math.max(0,(o??0)-r),h=s?` Raised from ${Oe(n.unit,n.included_units??0)} while your own AI is connected.`:t?.period_end?` Resets ${aa(t.period_end)}.`:"";return`${Oe(n.unit,d)} of ${Oe(n.unit,o??0)} left.${h}${l}`}function ec(e){if(!e)return null;let n=new Date(e).getTime()-Date.now();return Number.isNaN(n)||n<=0?null:Math.max(1,Math.ceil(n/864e5))}function aa(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}import{Fragment as tc,jsx as Se,jsxs as Je}from"react/jsx-runtime";function Yo({heading:e="Current plan",showUsage:n=!0,showName:t=!0,className:r}){let o=Ft(),{theme:a}=_(),s=b=>Se("section",{className:r?`soba-connect sc-fill ${r}`:"soba-connect sc-fill","data-theme":a,children:Je("div",{className:"sc-card sc-current",children:[e&&Se("h2",{className:"sc-section-title",children:e}),b]})});if(o.error)return s(Se("p",{className:"sc-error",children:o.error.message}));if(o.loading)return s(Se("p",{className:"sc-note",children:"Loading\u2026"}));if(!o.plan)return s(Je("div",{className:"sc-current-main",children:[Se("p",{className:"sc-current-name",children:"No plan"}),Se("p",{className:"sc-sub",children:o.summary})]}));let{plan:c,trialDaysLeft:i,percent:l,unlimited:d,reward:h}=o;return s(Je(tc,{children:[Je("div",{className:"sc-current-grid",children:[(t||i!==null)&&Je("div",{className:"sc-current-main",children:[t?Je("p",{className:"sc-current-name",children:[c.name,i!==null&&Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})]}):i!==null&&Se("p",{className:"sc-current-trial",children:Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})}),t&&c.description&&Se("p",{className:"sc-sub",children:c.description})]}),n&&Je("div",{className:"sc-usage",children:[Je("div",{className:"sc-row-between",children:[Se("span",{className:"sc-fact-key",children:"Usage"}),Se("span",{className:l!==null&&l>=100?"sc-usage-figure sc-usage-over":"sc-usage-figure",children:d?"Unlimited":l===null?"Metered":`${l}% used`})]}),l!==null&&Se("div",{className:"sc-meter",role:"presentation",children:l>0&&Se("span",{className:l>=100?"sc-meter-fill sc-meter-full":"sc-meter-fill",style:{width:`${l}%`}})}),Se("p",{className:"sc-usage-line",children:o.summary})]})]}),h&&Je("div",{className:"sc-current-foot",children:[Se("p",{className:h.required?"sc-plan-reward-line sc-plan-reward-need":h.inForce?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-open",children:h.required?h.line:h.inForce?`In force: ${nc(h.line)}.`:h.line}),(h.actionable||h.connected)&&Se(zn,{})]})]}))}var nc=e=>e.charAt(0).toLowerCase()+e.slice(1);import{useCallback as rc,useMemo as oc,useState as ia}from"react";var sc={"user-hardware":"your own machine","user-subscription":"your own AI subscription","open-weights":"open models we host",frontier:"frontier models"},ac=new Set(["user-hardware","user-subscription"]);function jo(e={}){let{plan:n,compute:t,connect:r}=K(),[o,a]=ia(null),[s,c]=ia(null),{featured:i,onSelect:l,successUrl:d,cancelUrl:h}=e,b=rc(async m=>{a(m.id),c(null);try{if(m.contact_url)m.contact_url.startsWith("mailto:")?window.location.assign(m.contact_url):window.open(m.contact_url,"_blank","noopener");else if(m.selectable)await n.select(m.id);else if(l)l(m);else{let v=await n.checkout(m.id,{...d?{successUrl:d}:{},...h?{cancelUrl:h}:{}});window.location.assign(v);return}}catch(v){throw c(v.message),v}finally{(m.selectable||l||m.contact_url)&&a(null)}},[n,l,d,h]),y=oc(()=>n.plans.map(m=>{let v=n.current?.plan_id===m.id;return{plan:m,current:v,featured:i===m.id&&!v,price:ic(m),allowance:m.included_units===null?`Unlimited ${m.unit==="cost"?"usage":(m.unit==="run"||m.unit==="task")&&m.task_noun?m.task_noun:`${m.unit}s`}`:Ot(m.unit,m.included_units,m.task_noun),allowanceNote:lc(m),features:(()=>{let A=m.features_from?n.plans.find(k=>k.id===m.features_from):void 0;return A&&m.features_own?[{text:`Everything in ${A.name}`,included:!0},...dr(m.features_own)]:dr(m.features)})(),ownAllowance:Un({unit:m.unit,ownUnit:m.own_unit??null,includedUnits:m.included_units,ownIncludedUnits:m.own_included_units??null,routePrefer:m.route_prefer,taskNoun:m.task_noun}),computeLabel:m.route_allow===null?"any compute":m.route_allow.length===0?"no compute":null,compute:(m.route_allow??[]).map(A=>({costClass:A,label:sc[A]??A,owned:ac.has(A),runtimes:qr(A).map(k=>k.id)})),connect:cc(m,v,t.connected,()=>r.open("manual")),cta:{label:uc(m,v,o===m.id),disabled:v||o!==null,busy:o===m.id,take:()=>b(m)}}}),[n.plans,n.current,i,t.connected,r,o,b]);return{offers:y,current:y.find(m=>m.current)??null,loading:n.loading,error:n.error,failed:s}}function ic(e){return e.contact_url?{amount:"Talk to us",interval:null,free:!1}:{amount:`$${e.price.toLocaleString()}`,interval:e.interval,free:e.price===0}}function lc(e){let n=[];return e.included_units===null?n.push("No ceiling on this plan"):(n.push(`Included each ${e.interval}`),e.estimated_tasks&&n.push(`about ${e.estimated_tasks.toLocaleString("en-US")} ${e.task_noun??"runs"}`),e.overage==="meter"&&e.overage_per_unit>0?n.push(`then $${e.overage_per_unit} per ${Hn(e.unit)}`):e.included_units>0&&n.push("then it stops")),e.trial_days>0&&n.push(`${e.trial_days}-day trial`),n.join(" \xB7 ")}function cc(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6}),a=Ve(e.route_allow)&&!t;if(!o&&!a)return null;let s=an(e.connected_reward);return{key:o?"Connect your own":"To use this",line:o??(n?"Nothing connected yet, so nothing can run.":"Runs only on compute you connect."),reward:o!==null,actionable:n&&(s||a)&&!t,open:r}}function uc(e,n,t){return n?"Your plan":e.contact_url?"Talk to us":t?e.selectable?"Switching\u2026":"Opening\u2026":e.selectable?"Choose":`Subscribe for $${e.price.toLocaleString()}/${e.interval}`}import{jsx as C,jsxs as se}from"react/jsx-runtime";function br(e){return e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill"}function zt({onSelect:e,successUrl:n,cancelUrl:t,showCompute:r=!0,showConnect:o=!1,variant:a="cards",featured:s,className:c}){let{offers:i,loading:l,error:d,failed:h}=jo({...s?{featured:s}:{},...e?{onSelect:e}:{},...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),{theme:b}=_();if(d)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-error",children:d.message})})});if(l)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"Loading plans\u2026"})})});if(i.length===0)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"This app has no plans yet."})})});let y={showCompute:r,showConnect:o};return se("div",{className:br(c),"data-theme":b,"data-variant":a,children:[a==="rows"?C(pc,{offers:i,shelf:y}):a==="table"?C(mc,{offers:i,shelf:y}):C(dc,{offers:i,shelf:y}),h&&C("p",{className:"sc-error",children:h})]})}function dc({offers:e,shelf:n}){return C("div",{className:"sc-plans",children:e.map(t=>se("div",{className:la("sc-plan",t),children:[se("div",{className:"sc-row-between",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),C("p",{className:"sc-sub",children:t.plan.description}),C(Zo,{price:t.price,free:"forever"}),C(_o,{offer:t,shelf:n}),C(ca,{offer:t}),C("div",{className:"sc-plan-band",children:n.showCompute&&C(Ko,{offer:t})}),C("div",{className:"sc-plan-band",children:C(Xo,{offer:t})})]},t.plan.id))})}function pc({offers:e,shelf:n}){return C("ul",{className:"sc-plan-rows",children:e.map(t=>se("li",{className:la("sc-plan-row",t),children:[se("div",{className:"sc-row-main",children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),t.plan.description&&C("p",{className:"sc-sub",children:t.plan.description}),C(ca,{offer:t}),n.showCompute&&C(Ko,{offer:t,inline:!0}),C(Xo,{offer:t,inline:!0})]}),se("div",{className:"sc-row-side",children:[C(Zo,{price:t.price,free:"forever",small:!0}),C(_o,{offer:t,shelf:n})]})]},t.plan.id))})}function mc({offers:e,shelf:n}){let t=e.some(s=>s.plan.overage_per_unit>0),r=e.some(s=>s.plan.trial_days>0),o=e.some(s=>s.connect!==null),a=s=>[s.current?"sc-col-current":"",s.featured?"sc-col-featured":""].filter(Boolean).join(" ")||void 0;return C("div",{className:"sc-table-scroll",children:se("table",{className:"sc-plan-table",children:[C("thead",{children:se("tr",{children:[C("td",{}),e.map(s=>se("th",{scope:"col",className:a(s),children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:s.plan.name}),C(qo,{offer:s})]}),C(Zo,{price:s.price,small:!0})]},s.plan.id))]})}),se("tbody",{children:[se("tr",{children:[C("th",{scope:"row",children:"Included"}),e.map(s=>C("td",{className:a(s),children:s.allowance},s.plan.id))]}),t&&se("tr",{children:[C("th",{scope:"row",children:"Then"}),e.map(s=>C("td",{className:a(s),children:s.plan.overage_per_unit>0?`$${s.plan.overage_per_unit} / ${Hn(s.plan.unit)}`:C("span",{className:"sc-muted-cell",children:"Stops"})},s.plan.id))]}),r&&se("tr",{children:[C("th",{scope:"row",children:"Trial"}),e.map(s=>C("td",{className:a(s),children:s.plan.trial_days>0?`${s.plan.trial_days} days`:C("span",{className:"sc-muted-cell",children:"None"})},s.plan.id))]}),n.showCompute&&se("tr",{children:[C("th",{scope:"row",children:"Runs on"}),e.map(s=>C("td",{className:a(s),children:C(Ko,{offer:s,bare:!0})},s.plan.id))]}),o&&se("tr",{children:[C("th",{scope:"row",children:"Connect your own"}),e.map(s=>C("td",{className:a(s),children:C(Xo,{offer:s,bare:!0})},s.plan.id))]}),se("tr",{className:"sc-table-buy",children:[C("td",{}),e.map(s=>C("td",{className:a(s),children:C(_o,{offer:s,shelf:n})},s.plan.id))]})]})]})})}function la(e,n){return[e,n.current?"sc-plan-current":"",n.featured?"sc-plan-featured":""].filter(Boolean).join(" ")}function qo({offer:e}){return e.current?C("span",{className:"sc-plan-badge",children:"Current"}):e.featured?C("span",{className:"sc-plan-badge-soft",children:"Recommended"}):null}function Zo({price:e,small:n,free:t}){return se("p",{className:n?"sc-plan-price sc-plan-price-sm":"sc-plan-price",children:[C("span",{className:"sc-plan-amount",children:e.amount}),e.interval?se("span",{className:"sc-plan-interval",children:["/",e.interval]}):t&&C("span",{className:"sc-plan-interval sc-plan-after",children:t})]})}function ca({offer:e}){return se("p",{className:"sc-plan-allowance",children:[C("span",{className:"sc-plan-figure",children:e.allowance}),C("span",{className:"sc-plan-qualifier",children:e.allowanceNote}),e.ownAllowance&&C("span",{className:"sc-plan-qualifier",children:e.ownAllowance}),e.features.map(n=>C("span",{className:n.included?"sc-plan-qualifier sc-plan-feature":"sc-plan-qualifier sc-plan-feature sc-plan-feature-absent",children:n.text},n.text))]})}function Xo({offer:e,inline:n,bare:t}){let r=e.connect;if(!r)return t?C("span",{className:"sc-muted-cell",children:"None"}):null;let o=r.reward?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-need",a=r.actionable?se("button",{type:"button",className:`${o} sc-plan-reward-act`,"aria-label":"Connect compute",onClick:r.open,children:[C("span",{className:"sc-reward-said",children:r.line}),se("span",{className:"sc-reward-do","aria-hidden":!0,children:[C(Me,{className:"sc-reward-mark"}),"Connect compute"]})]}):C("p",{className:o,children:r.line});return t?a:C("div",{className:n?"sc-plan-reward sc-plan-reward-inline":"sc-plan-reward",children:a})}function Ko({offer:e,inline:n,bare:t}){let r=e.computeLabel?C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:C("li",{children:e.computeLabel})}):C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:e.compute.map(o=>se("li",{className:o.owned?"sc-compute-own":void 0,children:[o.label,C(fc,{runtimes:o.runtimes})]},o.costClass))});return t?r:se("div",{className:n?"sc-plan-compute sc-plan-compute-inline":"sc-plan-compute",children:[C("span",{className:"sc-fact-key",children:"Runs on"}),r]})}function _o({offer:e,shelf:n}){let t=e.connect;return n.showConnect&&t?.actionable?se("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-icon",onClick:t.open,children:[C(Me,{className:"sc-btn-mark"}),"Connect compute"]}):C("button",{type:"button",className:e.current?"sc-btn":"sc-btn sc-btn-primary",disabled:e.cta.disabled,onClick:()=>void e.cta.take().catch(()=>{}),children:e.cta.label})}function fc({runtimes:e}){return e.length===0?null:C("span",{className:"sc-compute-marks",children:e.map(n=>{let t=An[n];return t?C(t,{className:"sc-rt-mark"},n):null})})}import{jsx as $o,jsxs as ua}from"react/jsx-runtime";function hc({heading:e,plansHeading:n,showUsage:t=!0,showName:r=!0,className:o,...a}){let{plan:s,loading:c}=Ft(),{theme:i}=_(),l=n??(c?"Plans":s?"Change plan":"Choose a plan");return ua("div",{className:o?`soba-connect sc-fill sc-billing ${o}`:"soba-connect sc-fill sc-billing","data-theme":i,children:[$o(Yo,{...e===void 0?{}:{heading:e},showUsage:t,showName:r}),ua("section",{className:"sc-billing-plans",children:[l&&$o("h2",{className:"sc-section-title",children:l}),$o(zt,{...a})]})]})}import{useCallback as da,useState as pa}from"react";function es({plan:e,successUrl:n,cancelUrl:t,label:r}){let{plan:o}=K(),[a,s]=pa(!1),[c,i]=pa(null),l=da(()=>o.checkout(e.id,{...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),[o,e.id,n,t]),d=da(async()=>{s(!0),i(null);try{window.location.assign(await l())}catch(h){i(h.message),s(!1)}},[l]);return{label:a?"Opening\u2026":r??`Subscribe for $${e.price.toLocaleString()}/${e.interval}`,busy:a,error:c,buy:d,session:l}}import{jsx as ma,jsxs as bc}from"react/jsx-runtime";function gc({plan:e,successUrl:n,cancelUrl:t,label:r,className:o}){let{theme:a}=_(),s=es({plan:e,...n?{successUrl:n}:{},...t?{cancelUrl:t}:{},...r?{label:r}:{}});return bc("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":a,children:[ma("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:s.busy,onClick:()=>void s.buy(),children:s.label}),s.error&&ma("p",{className:"sc-error",children:s.error})]})}import{useState as yc}from"react";import{useMemo as Ac}from"react";function ns(e,n={}){let{plan:t}=K(),r=n.use??1;return Ac(()=>{let o=t.current,a=t.plan?.features?.find(i=>i.id===e),s=o?o.features??Object.fromEntries((t.plan?.features??[]).map(i=>[i.id,i.value])):null,c=bo({features:s,quantities:o?.quantities??{},ended:o?.ended??!1},e,r);return{...c,allowed:t.loading?!1:c.allowed,name:a?.name??e,unit:a?.unit??null,loading:t.loading,error:t.error,refresh:t.refresh}},[t.current,t.plan,t.loading,t.error,t.refresh,e,r])}import{Fragment as ts,jsx as kn,jsxs as fa}from"react/jsx-runtime";function wc({feature:e,use:n=1,children:t,fallback:r,loading:o=null,className:a}){let s=ns(e,{use:n});return s.loading?kn(ts,{children:o}):s.allowed?kn(ts,{children:t}):r!==void 0?kn(ts,{children:typeof r=="function"?r(s):r}):kn(vc,{view:s,className:a})}function ha(e){let n=e.unit||e.name.toLowerCase();switch(e.reason){case"no_plan":return`Pick a plan to use ${e.name.toLowerCase()}.`;case"plan_ended":return"Your plan has ended. Pick a plan to keep going.";case"limit_reached":return`Your plan includes ${e.limit} ${n}, and all ${e.limit} are in use.`;default:return`${e.name} isn't included in your plan.`}}function vc({view:e,className:n}){let{theme:t}=_(),[r,o]=yc(!1);return fa("section",{className:n?`soba-connect sc-fill ${n}`:"soba-connect sc-fill","data-theme":t,children:[fa("div",{className:"sc-card",children:[kn("p",{className:"sc-title",children:e.reason==="plan_ended"?"Plan ended":"Upgrade to continue"}),kn("p",{className:"sc-sub",children:ha(e)}),!r&&kn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>o(!0),children:"See plans"})]}),r&&kn(zt,{})]})}import{useCallback as Ue,useEffect as Ye,useMemo as Qn,useRef as ln,useState as ue}from"react";var kc="soba.session:";function ga(e){return!e.cacheKey||!e.endpoint?null:kc+JSON.stringify([e.endpoint,e.user??null,e.cacheKey])}function Cc(e){try{let n=globalThis.localStorage?.getItem(e);if(!n)return null;let t=JSON.parse(n);return typeof t.token!="string"||typeof t.expiresAt!="number"?null:{token:t.token,expiresAt:t.expiresAt}}catch{return null}}function Mc(e,n){try{n?globalThis.localStorage?.setItem(e,JSON.stringify(n)):globalThis.localStorage?.removeItem(e)}catch{}}var ba=6e4,Nc=1e4,Ar=class{#e;#n=null;#r=null;#t;#o=new Set;constructor(n){this.#t=n,this.#e=n.token??null;let t=ga(n),r=t&&!this.#e?Cc(t):null;r&&r.expiresAt-ba>Date.now()&&(this.#e=r.token,this.#n=r.expiresAt)}get token(){return this.#e}get expiresAt(){return this.#n}get canRefresh(){return!!this.#t.endpoint}get refreshAt(){return!this.canRefresh||this.#n===null?null:Math.max(Date.now()+Nc,this.#n-ba)}subscribe(n){return this.#o.add(n),()=>this.#o.delete(n)}async ensure(){return this.#e?this.#e:this.refresh()}async refresh(){if(this.#r)return this.#r;let n=this.#t.endpoint;if(!n)throw new Error("This Soba session cannot be refreshed. Pass `sessionEndpoint` so the provider can mint a new one.");let t=this.#t.fetchImpl??fetch.bind(globalThis);this.#r=(async()=>{let r=await t(n,{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(this.#t.user?{user:this.#t.user}:{})});if(!r.ok)throw new Error(`Could not start a Soba session (${r.status} from ${n}).`);let o=await r.json(),a=o.session??o.token;if(!a)throw new Error(`${n} answered without a \`session\`. See @soba-so/react's README.`);let s=o.expires_in??o.expiresIn;this.#e=a,this.#n=typeof s=="number"?Date.now()+s*1e3:null;let c=ga(this.#t);c&&Mc(c,this.#n===null?null:{token:a,expiresAt:this.#n});for(let i of this.#o)i();return a})();try{return await this.#r}finally{this.#r=null}}},ct=new Map,Aa=new WeakMap,xc=1;function Sc(e){if(e.token||!e.endpoint)return null;let n=0;return e.fetchImpl&&(n=Aa.get(e.fetchImpl)??xc++,Aa.set(e.fetchImpl,n)),JSON.stringify([e.endpoint,e.user??null,n,e.cacheKey??null])}function ya(e){let n=Sc(e);if(!n)return new Ar(e);let t=ct.get(n)??{holder:new Ar(e),users:0};return ct.set(n,t),t.holder}function wa(e){for(let n of ct.values())n.holder===e&&n.users++}function va(e){for(let[n,t]of ct)if(t.holder===e){setTimeout(()=>{--t.users<=0&&ct.get(n)===t&&ct.delete(n)},0);return}}function ka(e,n=fetch.bind(globalThis)){return async(t,r)=>{let o=await n(t,r);if(o.status!==401||!e.canRefresh)return o;let a;try{a=await e.refresh()}catch{return o}return n(t,Rc(r,a))}}function Rc(e,n){let t=new Headers(e?.headers);return t.set("authorization",`Bearer ${n}`),{...e,headers:t}}import{jsx as rs,jsxs as Lc}from"react/jsx-runtime";var Pc="https://soba.so",Ec=3e4;function Ic(e){let{children:n,session:t,sessionEndpoint:r,user:o,sessionCacheKey:a,runEndpoint:s,theme:c,initialMachines:i,initialConnect:l=null,initialPlans:d,initialCurrentPlan:h=null,baseUrl:b=Pc,pollMs:y=Ec,injectStyles:m=!0,modal:v=!0,fetchImpl:A,onError:k}=e,[S,W]=ue(t??null),[L,D]=ue(null),[O,U]=ue(l),[w,$]=ue(null),[j,ee]=ue(l===null),[ae,me]=ue(i??[]),[fe,P]=ue(null),[q,V]=ue(i===void 0),[Z,be]=ue(d??[]),[Y,he]=ue(h),[Ae,Te]=ue(null),[Pe,ne]=ue(d===void 0),[de,u]=ue(null),[R,I]=ue(null),[J,B]=ue(!0),[te,N]=ue(null),[H,ie]=ue(!1),Ee=ln(k);Ee.current=k;let je=Ue(p=>{D(p),Ee.current?.(p)},[]);Ye(()=>{m&&Ht()},[m]);let E=Qn(()=>ya({...t?{token:t}:{},...r?{endpoint:r}:{},...o?{user:o}:{},...A?{fetchImpl:A}:{},...a?{cacheKey:a}:{}}),[t,r,o,A,a]);Ye(()=>{let p=!0;wa(E);let M=E.subscribe(()=>{p&&W(E.token)});return!E.token&&!E.canRefresh?je(new Error("<SobaProvider> needs a `session` or a `sessionEndpoint`. A browser cannot mint one: that takes your secret key.")):E.ensure().then(()=>p&&W(E.token),Q=>p&&je(Q)),()=>{p=!1,M(),va(E)}},[E,je]),Ye(()=>{L&&(ee(!1),V(!1),ne(!1),B(!1),$(p=>p??L),P(p=>p??L),Te(p=>p??L))},[L]),Ye(()=>{let p=E.refreshAt;if(p===null)return;let M=()=>{E.refresh().catch(ye=>je(ye))},Q=()=>{document.hidden||(document.removeEventListener("visibilitychange",Q),M())},oe=setTimeout(()=>{typeof document<"u"&&document.hidden?document.addEventListener("visibilitychange",Q):M()},Math.max(0,p-Date.now()));return()=>{clearTimeout(oe),typeof document<"u"&&document.removeEventListener("visibilitychange",Q)}},[E,je,S]);let Cn=ln(l?.machines_url??null),G=Qn(()=>{if(!S)return null;let p=new ft({session:S,baseUrl:b,fetchImpl:ka(E,A??fetch.bind(globalThis))});return p.setMachinesUrl(Cn.current),p},[S,b,E,A]),cn=ln(l!==null);Ye(()=>{if(!G||cn.current)return;let p=!0;return ee(!0),G.context().then(M=>{p&&(U(M),$(null),ee(!1))},M=>{p&&($(M),ee(!1))}),()=>{p=!1}},[G]);let tn=Ue(async()=>{if(G)try{let p=await G.machines();me(Array.isArray(p)?p:[]),P(null)}catch(p){P(p)}finally{V(!1)}},[G]),ke=Ue(async()=>{if(G)try{let p=await G.plans();be(p.plans),he(p.current),Te(null)}catch(p){Te(p)}finally{ne(!1)}},[G]),Mn=ln(!1),[Nn,xn]=ue(!1),ss=ln(d!==void 0),un=ln(!1),Vt=Ue(()=>{Mn.current||(Mn.current=!0,un.current&&queueMicrotask(()=>{un.current&&xn(!0)}))},[]);Ye(()=>(un.current=!0,Mn.current&&xn(!0),()=>{un.current=!1}),[]),Ye(()=>{!G||!Nn||ss.current||ke()},[G,Nn,ke]);let dn=Ue(async()=>{if(G)try{u(await G.modelOptions()),I(null)}catch(p){I(p)}finally{B(!1)}},[G]),Jn=ln(!1),[ge,qe]=ue(!1),ut=Ue(()=>{Jn.current||(Jn.current=!0,un.current&&queueMicrotask(()=>{un.current&&qe(!0)}))},[]);Ye(()=>{Jn.current&&qe(!0)},[]);let Yn=cn.current||O!==null;Ye(()=>{w&&!Yn&&B(!1)},[w,Yn]),Ye(()=>{!G||!ge||!Yn||dn()},[G,ge,Yn,dn,Y?.plan_id]);let Qt=Ue(async p=>{if(!G)throw new Error("No session yet.");await G.selectPlan(p),await ke()},[G,ke]),Jt=Ue(async(p,M)=>{if(!G)throw new Error("No session yet.");let Q=await G.checkoutPlan(p,M);if(!Q.url)throw new Error("Checkout could not be started.");return Q.url},[G]),Yt=Ue(async()=>{if(!G)throw new Error("No session yet.");await G.leavePlan(),await ke()},[G,ke]),jn=ln(i!==void 0);Ye(()=>{if(!G)return;let p=He(tn,y,{immediate:!jn.current});return jn.current=!1,p},[G,tn,y]);let Sn=Ue((p="manual")=>{v&&(ie(!0),N(p))},[v]),jt=Ue(()=>N(null),[]),Rn=ln(ae);Rn.current=ae;let Be=Ue(async p=>{if(!s)throw new Error("Pass `runEndpoint` to <SobaProvider> to start runs from the browser. It is your own route: it holds your secret key, calls soba.run(), and forwards the stream.");let{signal:M,...Q}=p,ye=await(A??fetch.bind(globalThis))(s,{method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream"},credentials:"same-origin",body:JSON.stringify(Q),...M?{signal:M}:{}});if(!ye.ok){let pe=await ye.json().catch(()=>null),Xe=new Error(pe?.error?.message??`${s} answered ${ye.status}.`);Xe.status=ye.status,pe?.error?.code&&(Xe.code=pe.error.code),pe?.error&&(Xe.error=pe.error);let dt=Rn.current.length>0&&!Rn.current.some(Ca=>Ca.state!=="offline");throw ye.status===409&&dt&&Sn("no_compute"),Xe}let rn=Vo(ye);return async function*(){try{yield*rn}finally{Mn.current&&ke(),Jn.current&&dn()}}()},[s,A,ke,dn,Sn]),Ce=Qn(()=>Y?Z.find(p=>p.id===Y.plan_id)??null:null,[Z,Y]),pn=Qn(()=>Ce?Ce.connected_reward==="included"&&ae.length>0&&Ce.connected_included_units!==null?Ce.connected_included_units:Ce.included_units:null,[Ce,ae]),Ze=Qn(()=>({plans:Z,current:Y,plan:Ce,used:Y?.units_used??null,included:pn,remaining:pn!==null&&Y?Math.max(0,pn-Y.units_used):null,unlimited:Ce!==null&&pn===null,loading:Pe,error:Ae,select:Qt,checkout:Jt,leave:Yt,refresh:ke}),[Z,Y,Ce,pn,Pe,Ae,Qt,Jt,Yt,ke]),qt=Qn(()=>({providers:de?.providers??[],names:de?.names??[],layout:de?.layout??null,sizes:de?.sizes!==!1,rowsByLayout:de?.rowsByLayout??{},route:de?.route??null,loading:J,error:R,refresh:dn}),[de,J,R,dn]),yr=Qn(()=>({session:S,client:G,error:L,get plan(){return Vt(),Ze},get models(){return ut(),qt},compute:{machines:ae,connected:ae.length>0,online:ae.some(p=>p.state!=="offline"),loading:q,error:fe,refresh:tn},connect:{app:O?.app??null,command:O?.command??null,connectUrl:O?.connect_url??null,publishableKey:O?.publishable_key??null,loading:j,error:w,open:Sn,close:jt,isOpen:te!==null,hasModal:v},run:Be}),[S,G,L,Ze,Vt,qt,ut,te,Sn,jt,v,ae,q,fe,tn,O,j,w,Be]);return rs(Po.Provider,{value:G,children:rs(Eo.Provider,{value:{context:O,machines:q?void 0:ae,theme:c??O?.theme??"light"},children:Lc(Io.Provider,{value:yr,children:[n,v&&H&&rs(Gt,{open:te!==null,onOpenChange:p=>N(p?te??"manual":null),onConnected:()=>{tn()},...te==="payment_required"||te==="no_compute"?{reason:te}:{},...te==="pair"?{showStatus:!1}:{}})]})})})}function Oc(e){return e?Tc[e]??e:null}var Tc={"user-hardware":"your own computer","user-subscription":"your own AI plan","user-api-key":"your own API key","open-weights":"open models we host",frontier:"a frontier model we pay for"};async function Bc(e,n,t){let r=n.local;if(!r?.session||n.after)return null;let o=/\/v1\/runs\/([^/]+)\/events/.exec(e.url)?.[1];if(!o)return null;let a=`http://127.0.0.1:${r.port??47321}/v1/runs/${o}/events`,s=new AbortController,c=()=>s.abort();n.signal?.addEventListener("abort",c);let i=setTimeout(()=>s.abort(),r.timeoutMs??3e3);try{let l=await t(a,{headers:{authorization:`Bearer ${r.session}`,accept:"text/event-stream"},signal:s.signal});return l.ok?{url:a,bearer:r.session,open:l}:null}catch{return null}finally{clearTimeout(i),n.signal?.removeEventListener("abort",c)}}async function*Gc(e){let n=e.body;if(!n)return;let t=n.getReader(),r=new TextDecoder,o="",a=null,s=[];try{for(;;){let c=await t.read();if(c.done)return;o+=r.decode(c.value,{stream:!0});for(let i=o.indexOf(`
4489
+ `,document.head.appendChild(e)}import{jsx as nn,jsxs as Ut}from"react/jsx-runtime";function oa(e){if(!e)return null;let n=Vn(e);if(n==="payment_required"||n==="no_compute")return null;if(typeof e=="string")return e||null;let t=e,r=t.error?.message;return typeof r=="string"&&r?r:typeof t.message=="string"&&t.message?t.message:"The run ended with an error."}function Ql(){return Ut("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[nn("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),nn("circle",{cx:"8",cy:"11.6",r:"0.9",fill:"currentColor"}),nn("circle",{cx:"8",cy:"8",r:"6.4",stroke:"currentColor",strokeWidth:"1.3"})]})}function Jl({error:e,onRetry:n,onDismiss:t,title:r,className:o}){let a=oa(e),s=_();return Vl(()=>Ht(),[]),a?nn("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":s.theme,role:"alert",children:Ut("div",{className:"sc-card sc-limit sc-run-error",children:[Ut("div",{className:"sc-limit-head",children:[nn("span",{className:"sc-limit-mark sc-run-error-mark","aria-hidden":"true",children:nn(Ql,{})}),Ut("div",{children:[nn("h2",{className:"sc-limit-title",children:r??"That run did not finish"}),nn("p",{className:"sc-limit-body sc-run-error-message",children:a})]})]}),(t||n)&&Ut("div",{className:"sc-limit-actions",children:[t&&nn("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,children:"Dismiss"}),n&&nn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:n,children:"Try again"})]})]})}):null}import{useId as Yl,useState as sa}from"react";import{jsx as xe,jsxs as hr}from"react/jsx-runtime";function jl({reason:e}){return xe("span",{className:"sc-limit-mark","aria-hidden":"true",children:e==="no_compute"?xe(er,{}):xe(Me,{})})}function ql(e){let{error:n,variant:t="card",onDismiss:r,className:o}=e,a=Uo(n,{predict:e.predict??!("error"in e)}),s=Yl(),c=_();if(!a)return null;let i=xe(Zl,{offer:a,headingId:s,onDismiss:r});return t==="dialog"?xe(Pt,{open:!0,onClose:()=>r?.(),labelledBy:s,theme:c.theme,children:i}):xe("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":c.theme,children:i})}function Zl({offer:e,headingId:n,onDismiss:t}){let{compute:r}=K(),[o,a]=sa(!1),[s,c]=sa(null),i=e.reason==="no_compute"&&r.connected&&!r.online,l=i||e.connectOffer!==null||!r.connected,d=Dt();async function g(){a(!0),c(null);try{await e.upgrade()}catch(b){c(b.message)}finally{a(!1)}}return hr("div",{className:"sc-card sc-limit",children:[hr("div",{className:"sc-limit-head",children:[xe(jl,{reason:e.reason}),hr("div",{children:[xe("h2",{className:"sc-limit-title",id:n,children:e.title}),xe("p",{className:"sc-limit-body",children:e.body})]})]}),s&&xe("p",{className:"sc-error",children:s}),i&&d.note&&xe("p",{className:"sc-limit-note",children:d.note}),hr("div",{className:"sc-limit-actions",children:[t&&xe("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,disabled:o,children:"Not now"}),e.upgradeTo&&xe("button",{type:"button",className:l?"sc-btn":"sc-btn sc-btn-primary",onClick:()=>void g(),disabled:o,children:o?"Opening\u2026":e.upgradeTo.selectable?`Switch to ${e.upgradeTo.name}`:`${e.upgradeTo.name} for $${e.upgradeTo.price.toLocaleString()}/${e.upgradeTo.interval}`}),l&&xe("button",{type:"button",className:i?"sc-btn":"sc-btn sc-btn-primary",onClick:e.connect,disabled:o,children:i?"Connect another machine":"Connect compute"}),i&&xe("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:d.open,disabled:o,children:"Open Soba"})]})]})}import{useMemo as Xl}from"react";function Kl(e){let n={};for(let t of e??[])n[t.id]=t.value;return n}function Ft(){let{plan:e,compute:n,connect:t}=K();return Xl(()=>{let r=e.plan,o=e.current,a={plan:r,assignment:o,loading:e.loading,error:e.error,periodEnd:o?.period_end?new Date(o.period_end):null,features:o?.features??Kl(r?.features)};if(!r)return{...a,state:"none",trialDaysLeft:null,ceiling:null,raised:!1,uncounted:!1,used:0,remaining:null,percent:null,unlimited:!1,reward:null,summary:"Nothing is assigned to this account, so runs are bounded by whatever the app allows."};let s=ec(o?.trial_ends_at??null),c=r.connected_reward==="included"&&n.connected&&r.connected_included_units!==null,i=c?r.connected_included_units:r.included_units,l=n.connected,d=i===null,g=e.used??0,b=i===null?null:Math.max(0,i-g),y=i&&i>0?Math.min(100,Math.round(g/i*100)):null,m=i!==null&&g>=i,v=s!==null?"trial":d?"unlimited":m?r.overage==="meter"?"metered":"spent":"within";return{...a,state:v,trialDaysLeft:s,ceiling:i,raised:c,uncounted:l,used:g,remaining:b,percent:y,unlimited:d,reward:_l(r,c,n.connected,()=>t.open("manual")),summary:$l({plan:r,assignment:o,used:g,ceiling:i,trialDaysLeft:s,raised:c,uncounted:l,state:v})}},[e,n.connected,t])}function _l(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6});return o?{line:o,inForce:n,required:!1,connected:t,actionable:an(e.connected_reward)&&!t,open:r}:Ve(e.route_allow)&&!t?{line:"Nothing connected yet, so nothing can run.",inForce:!1,required:!0,connected:t,actionable:!0,open:r}:null}function $l(e){let{plan:n,assignment:t,used:r,ceiling:o,trialDaysLeft:a,raised:s,uncounted:c,state:i}=e,l=c?" Runs your own AI serves do not count toward it.":"";if(i==="trial"&&a!==null){let b=n.price===0?"it continues free":`it is $${n.price.toLocaleString()} a ${n.interval}`;return`${a} ${a===1?"day":"days"} left of your trial, then ${b}.`}if(i==="unlimited")return`${Oe(n.unit,r)} this period. No ceiling on this plan.`;if(i==="metered"){let b=r-(o??0);return n.overage_per_unit>0?`${Oe(n.unit,b)} past the allowance, billed at $${n.overage_per_unit} per ${Hn(n.unit)}.${l}`:`${Oe(n.unit,b)} past the allowance, billed by usage.${l}`}if(i==="spent")return t?.period_end?`Allowance spent. It comes back on ${aa(t.period_end)}.${l}`:`Allowance spent. It comes back at the start of the next period.${l}`;let d=Math.max(0,(o??0)-r),g=s?` Raised from ${Oe(n.unit,n.included_units??0)} while your own AI is connected.`:t?.period_end?` Resets ${aa(t.period_end)}.`:"";return`${Oe(n.unit,d)} of ${Oe(n.unit,o??0)} left.${g}${l}`}function ec(e){if(!e)return null;let n=new Date(e).getTime()-Date.now();return Number.isNaN(n)||n<=0?null:Math.max(1,Math.ceil(n/864e5))}function aa(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}import{Fragment as tc,jsx as Se,jsxs as Je}from"react/jsx-runtime";function Yo({heading:e="Current plan",showUsage:n=!0,showName:t=!0,className:r}){let o=Ft(),{theme:a}=_(),s=b=>Se("section",{className:r?`soba-connect sc-fill ${r}`:"soba-connect sc-fill","data-theme":a,children:Je("div",{className:"sc-card sc-current",children:[e&&Se("h2",{className:"sc-section-title",children:e}),b]})});if(o.error)return s(Se("p",{className:"sc-error",children:o.error.message}));if(o.loading)return s(Se("p",{className:"sc-note",children:"Loading\u2026"}));if(!o.plan)return s(Je("div",{className:"sc-current-main",children:[Se("p",{className:"sc-current-name",children:"No plan"}),Se("p",{className:"sc-sub",children:o.summary})]}));let{plan:c,trialDaysLeft:i,percent:l,unlimited:d,reward:g}=o;return s(Je(tc,{children:[Je("div",{className:"sc-current-grid",children:[(t||i!==null)&&Je("div",{className:"sc-current-main",children:[t?Je("p",{className:"sc-current-name",children:[c.name,i!==null&&Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})]}):i!==null&&Se("p",{className:"sc-current-trial",children:Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})}),t&&c.description&&Se("p",{className:"sc-sub",children:c.description})]}),n&&Je("div",{className:"sc-usage",children:[Je("div",{className:"sc-row-between",children:[Se("span",{className:"sc-fact-key",children:"Usage"}),Se("span",{className:l!==null&&l>=100?"sc-usage-figure sc-usage-over":"sc-usage-figure",children:d?"Unlimited":l===null?"Metered":`${l}% used`})]}),l!==null&&Se("div",{className:"sc-meter",role:"presentation",children:l>0&&Se("span",{className:l>=100?"sc-meter-fill sc-meter-full":"sc-meter-fill",style:{width:`${l}%`}})}),Se("p",{className:"sc-usage-line",children:o.summary})]})]}),g&&Je("div",{className:"sc-current-foot",children:[Se("p",{className:g.required?"sc-plan-reward-line sc-plan-reward-need":g.inForce?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-open",children:g.required?g.line:g.inForce?`In force: ${nc(g.line)}.`:g.line}),(g.actionable||g.connected)&&Se(zn,{})]})]}))}var nc=e=>e.charAt(0).toLowerCase()+e.slice(1);import{useCallback as rc,useMemo as oc,useState as ia}from"react";var sc={"user-hardware":"your own machine","user-subscription":"your own AI subscription","open-weights":"open models we host",frontier:"frontier models"},ac=new Set(["user-hardware","user-subscription"]);function jo(e={}){let{plan:n,compute:t,connect:r}=K(),[o,a]=ia(null),[s,c]=ia(null),{featured:i,onSelect:l,successUrl:d,cancelUrl:g}=e,b=rc(async m=>{a(m.id),c(null);try{if(m.contact_url)m.contact_url.startsWith("mailto:")?window.location.assign(m.contact_url):window.open(m.contact_url,"_blank","noopener");else if(m.selectable)await n.select(m.id);else if(l)l(m);else{let v=await n.checkout(m.id,{...d?{successUrl:d}:{},...g?{cancelUrl:g}:{}});window.location.assign(v);return}}catch(v){throw c(v.message),v}finally{(m.selectable||l||m.contact_url)&&a(null)}},[n,l,d,g]),y=oc(()=>n.plans.map(m=>{let v=n.current?.plan_id===m.id;return{plan:m,current:v,featured:i===m.id&&!v,price:ic(m),allowance:m.included_units===null?`Unlimited ${m.unit==="cost"?"usage":(m.unit==="run"||m.unit==="task")&&m.task_noun?m.task_noun:`${m.unit}s`}`:Ot(m.unit,m.included_units,m.task_noun),allowanceNote:lc(m),features:(()=>{let A=m.features_from?n.plans.find(k=>k.id===m.features_from):void 0;return A&&m.features_own?[{text:`Everything in ${A.name}`,included:!0},...dr(m.features_own)]:dr(m.features)})(),ownAllowance:Un({unit:m.unit,ownUnit:m.own_unit??null,includedUnits:m.included_units,ownIncludedUnits:m.own_included_units??null,routePrefer:m.route_prefer,taskNoun:m.task_noun}),computeLabel:m.route_allow===null?"any compute":m.route_allow.length===0?"no compute":null,compute:(m.route_allow??[]).map(A=>({costClass:A,label:sc[A]??A,owned:ac.has(A),runtimes:qr(A).map(k=>k.id)})),connect:cc(m,v,t.connected,()=>r.open("manual")),cta:{label:uc(m,v,o===m.id),disabled:v||o!==null,busy:o===m.id,take:()=>b(m)}}}),[n.plans,n.current,i,t.connected,r,o,b]);return{offers:y,current:y.find(m=>m.current)??null,loading:n.loading,error:n.error,failed:s}}function ic(e){return e.contact_url?{amount:"Talk to us",interval:null,free:!1}:{amount:`$${e.price.toLocaleString()}`,interval:e.interval,free:e.price===0}}function lc(e){let n=[];return e.included_units===null?n.push("No ceiling on this plan"):(n.push(`Included each ${e.interval}`),e.estimated_tasks&&n.push(`about ${e.estimated_tasks.toLocaleString("en-US")} ${e.task_noun??"runs"}`),e.overage==="meter"?n.push(e.overage_per_unit>0?`then $${e.overage_per_unit} per ${Hn(e.unit)}`:"then billed by usage"):e.included_units>0&&n.push("then it stops")),e.trial_days>0&&n.push(`${e.trial_days}-day trial`),n.join(" \xB7 ")}function cc(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6}),a=Ve(e.route_allow)&&!t;if(!o&&!a)return null;let s=an(e.connected_reward);return{key:o?"Connect your own":"To use this",line:o??(n?"Nothing connected yet, so nothing can run.":"Runs only on compute you connect."),reward:o!==null,actionable:n&&(s||a)&&!t,open:r}}function uc(e,n,t){return n?"Your plan":e.contact_url?"Talk to us":t?e.selectable?"Switching\u2026":"Opening\u2026":e.selectable?"Choose":`Subscribe for $${e.price.toLocaleString()}/${e.interval}`}import{jsx as C,jsxs as se}from"react/jsx-runtime";function br(e){return e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill"}function zt({onSelect:e,successUrl:n,cancelUrl:t,showCompute:r=!0,showConnect:o=!1,variant:a="cards",featured:s,className:c}){let{offers:i,loading:l,error:d,failed:g}=jo({...s?{featured:s}:{},...e?{onSelect:e}:{},...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),{theme:b}=_();if(d)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-error",children:d.message})})});if(l)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"Loading plans\u2026"})})});if(i.length===0)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"This app has no plans yet."})})});let y={showCompute:r,showConnect:o};return se("div",{className:br(c),"data-theme":b,"data-variant":a,children:[a==="rows"?C(pc,{offers:i,shelf:y}):a==="table"?C(mc,{offers:i,shelf:y}):C(dc,{offers:i,shelf:y}),g&&C("p",{className:"sc-error",children:g})]})}function dc({offers:e,shelf:n}){return C("div",{className:"sc-plans",children:e.map(t=>se("div",{className:la("sc-plan",t),children:[se("div",{className:"sc-row-between",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),C("p",{className:"sc-sub",children:t.plan.description}),C(Zo,{price:t.price,free:"forever"}),C(_o,{offer:t,shelf:n}),C(ca,{offer:t}),C("div",{className:"sc-plan-band",children:n.showCompute&&C(Ko,{offer:t})}),C("div",{className:"sc-plan-band",children:C(Xo,{offer:t})})]},t.plan.id))})}function pc({offers:e,shelf:n}){return C("ul",{className:"sc-plan-rows",children:e.map(t=>se("li",{className:la("sc-plan-row",t),children:[se("div",{className:"sc-row-main",children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),t.plan.description&&C("p",{className:"sc-sub",children:t.plan.description}),C(ca,{offer:t}),n.showCompute&&C(Ko,{offer:t,inline:!0}),C(Xo,{offer:t,inline:!0})]}),se("div",{className:"sc-row-side",children:[C(Zo,{price:t.price,free:"forever",small:!0}),C(_o,{offer:t,shelf:n})]})]},t.plan.id))})}function mc({offers:e,shelf:n}){let t=e.some(s=>s.plan.overage==="meter"),r=e.some(s=>s.plan.trial_days>0),o=e.some(s=>s.connect!==null),a=s=>[s.current?"sc-col-current":"",s.featured?"sc-col-featured":""].filter(Boolean).join(" ")||void 0;return C("div",{className:"sc-table-scroll",children:se("table",{className:"sc-plan-table",children:[C("thead",{children:se("tr",{children:[C("td",{}),e.map(s=>se("th",{scope:"col",className:a(s),children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:s.plan.name}),C(qo,{offer:s})]}),C(Zo,{price:s.price,small:!0})]},s.plan.id))]})}),se("tbody",{children:[se("tr",{children:[C("th",{scope:"row",children:"Included"}),e.map(s=>C("td",{className:a(s),children:s.allowance},s.plan.id))]}),t&&se("tr",{children:[C("th",{scope:"row",children:"Then"}),e.map(s=>C("td",{className:a(s),children:s.plan.overage_per_unit>0?`$${s.plan.overage_per_unit} / ${Hn(s.plan.unit)}`:s.plan.overage==="meter"?"By usage":C("span",{className:"sc-muted-cell",children:"Stops"})},s.plan.id))]}),r&&se("tr",{children:[C("th",{scope:"row",children:"Trial"}),e.map(s=>C("td",{className:a(s),children:s.plan.trial_days>0?`${s.plan.trial_days} days`:C("span",{className:"sc-muted-cell",children:"None"})},s.plan.id))]}),n.showCompute&&se("tr",{children:[C("th",{scope:"row",children:"Runs on"}),e.map(s=>C("td",{className:a(s),children:C(Ko,{offer:s,bare:!0})},s.plan.id))]}),o&&se("tr",{children:[C("th",{scope:"row",children:"Connect your own"}),e.map(s=>C("td",{className:a(s),children:C(Xo,{offer:s,bare:!0})},s.plan.id))]}),se("tr",{className:"sc-table-buy",children:[C("td",{}),e.map(s=>C("td",{className:a(s),children:C(_o,{offer:s,shelf:n})},s.plan.id))]})]})]})})}function la(e,n){return[e,n.current?"sc-plan-current":"",n.featured?"sc-plan-featured":""].filter(Boolean).join(" ")}function qo({offer:e}){return e.current?C("span",{className:"sc-plan-badge",children:"Current"}):e.featured?C("span",{className:"sc-plan-badge-soft",children:"Recommended"}):null}function Zo({price:e,small:n,free:t}){return se("p",{className:n?"sc-plan-price sc-plan-price-sm":"sc-plan-price",children:[C("span",{className:"sc-plan-amount",children:e.amount}),e.interval?se("span",{className:"sc-plan-interval",children:["/",e.interval]}):t&&C("span",{className:"sc-plan-interval sc-plan-after",children:t})]})}function ca({offer:e}){return se("p",{className:"sc-plan-allowance",children:[C("span",{className:"sc-plan-figure",children:e.allowance}),C("span",{className:"sc-plan-qualifier",children:e.allowanceNote}),e.ownAllowance&&C("span",{className:"sc-plan-qualifier",children:e.ownAllowance}),e.features.map(n=>C("span",{className:n.included?"sc-plan-qualifier sc-plan-feature":"sc-plan-qualifier sc-plan-feature sc-plan-feature-absent",children:n.text},n.text))]})}function Xo({offer:e,inline:n,bare:t}){let r=e.connect;if(!r)return t?C("span",{className:"sc-muted-cell",children:"None"}):null;let o=r.reward?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-need",a=r.actionable?se("button",{type:"button",className:`${o} sc-plan-reward-act`,"aria-label":"Connect compute",onClick:r.open,children:[C("span",{className:"sc-reward-said",children:r.line}),se("span",{className:"sc-reward-do","aria-hidden":!0,children:[C(Me,{className:"sc-reward-mark"}),"Connect compute"]})]}):C("p",{className:o,children:r.line});return t?a:C("div",{className:n?"sc-plan-reward sc-plan-reward-inline":"sc-plan-reward",children:a})}function Ko({offer:e,inline:n,bare:t}){let r=e.computeLabel?C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:C("li",{children:e.computeLabel})}):C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:e.compute.map(o=>se("li",{className:o.owned?"sc-compute-own":void 0,children:[o.label,C(fc,{runtimes:o.runtimes})]},o.costClass))});return t?r:se("div",{className:n?"sc-plan-compute sc-plan-compute-inline":"sc-plan-compute",children:[C("span",{className:"sc-fact-key",children:"Runs on"}),r]})}function _o({offer:e,shelf:n}){let t=e.connect;return n.showConnect&&t?.actionable?se("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-icon",onClick:t.open,children:[C(Me,{className:"sc-btn-mark"}),"Connect compute"]}):C("button",{type:"button",className:e.current?"sc-btn":"sc-btn sc-btn-primary",disabled:e.cta.disabled,onClick:()=>void e.cta.take().catch(()=>{}),children:e.cta.label})}function fc({runtimes:e}){return e.length===0?null:C("span",{className:"sc-compute-marks",children:e.map(n=>{let t=An[n];return t?C(t,{className:"sc-rt-mark"},n):null})})}import{jsx as $o,jsxs as ua}from"react/jsx-runtime";function gc({heading:e,plansHeading:n,showUsage:t=!0,showName:r=!0,className:o,...a}){let{plan:s,loading:c}=Ft(),{theme:i}=_(),l=n??(c?"Plans":s?"Change plan":"Choose a plan");return ua("div",{className:o?`soba-connect sc-fill sc-billing ${o}`:"soba-connect sc-fill sc-billing","data-theme":i,children:[$o(Yo,{...e===void 0?{}:{heading:e},showUsage:t,showName:r}),ua("section",{className:"sc-billing-plans",children:[l&&$o("h2",{className:"sc-section-title",children:l}),$o(zt,{...a})]})]})}import{useCallback as da,useState as pa}from"react";function es({plan:e,successUrl:n,cancelUrl:t,label:r}){let{plan:o}=K(),[a,s]=pa(!1),[c,i]=pa(null),l=da(()=>o.checkout(e.id,{...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),[o,e.id,n,t]),d=da(async()=>{s(!0),i(null);try{window.location.assign(await l())}catch(g){i(g.message),s(!1)}},[l]);return{label:a?"Opening\u2026":r??`Subscribe for $${e.price.toLocaleString()}/${e.interval}`,busy:a,error:c,buy:d,session:l}}import{jsx as ma,jsxs as bc}from"react/jsx-runtime";function hc({plan:e,successUrl:n,cancelUrl:t,label:r,className:o}){let{theme:a}=_(),s=es({plan:e,...n?{successUrl:n}:{},...t?{cancelUrl:t}:{},...r?{label:r}:{}});return bc("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":a,children:[ma("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:s.busy,onClick:()=>void s.buy(),children:s.label}),s.error&&ma("p",{className:"sc-error",children:s.error})]})}import{useState as yc}from"react";import{useMemo as Ac}from"react";function ns(e,n={}){let{plan:t}=K(),r=n.use??1;return Ac(()=>{let o=t.current,a=t.plan?.features?.find(i=>i.id===e),s=o?o.features??Object.fromEntries((t.plan?.features??[]).map(i=>[i.id,i.value])):null,c=bo({features:s,quantities:o?.quantities??{},ended:o?.ended??!1},e,r);return{...c,allowed:t.loading?!1:c.allowed,name:a?.name??e,unit:a?.unit??null,loading:t.loading,error:t.error,refresh:t.refresh}},[t.current,t.plan,t.loading,t.error,t.refresh,e,r])}import{Fragment as ts,jsx as kn,jsxs as fa}from"react/jsx-runtime";function wc({feature:e,use:n=1,children:t,fallback:r,loading:o=null,className:a}){let s=ns(e,{use:n});return s.loading?kn(ts,{children:o}):s.allowed?kn(ts,{children:t}):r!==void 0?kn(ts,{children:typeof r=="function"?r(s):r}):kn(vc,{view:s,className:a})}function ga(e){let n=e.unit||e.name.toLowerCase();switch(e.reason){case"no_plan":return`Pick a plan to use ${e.name.toLowerCase()}.`;case"plan_ended":return"Your plan has ended. Pick a plan to keep going.";case"limit_reached":return`Your plan includes ${e.limit} ${n}, and all ${e.limit} are in use.`;default:return`${e.name} isn't included in your plan.`}}function vc({view:e,className:n}){let{theme:t}=_(),[r,o]=yc(!1);return fa("section",{className:n?`soba-connect sc-fill ${n}`:"soba-connect sc-fill","data-theme":t,children:[fa("div",{className:"sc-card",children:[kn("p",{className:"sc-title",children:e.reason==="plan_ended"?"Plan ended":"Upgrade to continue"}),kn("p",{className:"sc-sub",children:ga(e)}),!r&&kn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>o(!0),children:"See plans"})]}),r&&kn(zt,{})]})}import{useCallback as Ue,useEffect as Ye,useMemo as Qn,useRef as ln,useState as ue}from"react";var kc="soba.session:";function ha(e){return!e.cacheKey||!e.endpoint?null:kc+JSON.stringify([e.endpoint,e.user??null,e.cacheKey])}function Cc(e){try{let n=globalThis.localStorage?.getItem(e);if(!n)return null;let t=JSON.parse(n);return typeof t.token!="string"||typeof t.expiresAt!="number"?null:{token:t.token,expiresAt:t.expiresAt}}catch{return null}}function Mc(e,n){try{n?globalThis.localStorage?.setItem(e,JSON.stringify(n)):globalThis.localStorage?.removeItem(e)}catch{}}var ba=6e4,Nc=1e4,Ar=class{#e;#n=null;#r=null;#t;#o=new Set;constructor(n){this.#t=n,this.#e=n.token??null;let t=ha(n),r=t&&!this.#e?Cc(t):null;r&&r.expiresAt-ba>Date.now()&&(this.#e=r.token,this.#n=r.expiresAt)}get token(){return this.#e}get expiresAt(){return this.#n}get canRefresh(){return!!this.#t.endpoint}get refreshAt(){return!this.canRefresh||this.#n===null?null:Math.max(Date.now()+Nc,this.#n-ba)}subscribe(n){return this.#o.add(n),()=>this.#o.delete(n)}async ensure(){return this.#e?this.#e:this.refresh()}async refresh(){if(this.#r)return this.#r;let n=this.#t.endpoint;if(!n)throw new Error("This Soba session cannot be refreshed. Pass `sessionEndpoint` so the provider can mint a new one.");let t=this.#t.fetchImpl??fetch.bind(globalThis);this.#r=(async()=>{let r=await t(n,{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(this.#t.user?{user:this.#t.user}:{})});if(!r.ok)throw new Error(`Could not start a Soba session (${r.status} from ${n}).`);let o=await r.json(),a=o.session??o.token;if(!a)throw new Error(`${n} answered without a \`session\`. See @soba-so/react's README.`);let s=o.expires_in??o.expiresIn;this.#e=a,this.#n=typeof s=="number"?Date.now()+s*1e3:null;let c=ha(this.#t);c&&Mc(c,this.#n===null?null:{token:a,expiresAt:this.#n});for(let i of this.#o)i();return a})();try{return await this.#r}finally{this.#r=null}}},ct=new Map,Aa=new WeakMap,xc=1;function Sc(e){if(e.token||!e.endpoint)return null;let n=0;return e.fetchImpl&&(n=Aa.get(e.fetchImpl)??xc++,Aa.set(e.fetchImpl,n)),JSON.stringify([e.endpoint,e.user??null,n,e.cacheKey??null])}function ya(e){let n=Sc(e);if(!n)return new Ar(e);let t=ct.get(n)??{holder:new Ar(e),users:0};return ct.set(n,t),t.holder}function wa(e){for(let n of ct.values())n.holder===e&&n.users++}function va(e){for(let[n,t]of ct)if(t.holder===e){setTimeout(()=>{--t.users<=0&&ct.get(n)===t&&ct.delete(n)},0);return}}function ka(e,n=fetch.bind(globalThis)){return async(t,r)=>{let o=await n(t,r);if(o.status!==401||!e.canRefresh)return o;let a;try{a=await e.refresh()}catch{return o}return n(t,Rc(r,a))}}function Rc(e,n){let t=new Headers(e?.headers);return t.set("authorization",`Bearer ${n}`),{...e,headers:t}}import{jsx as rs,jsxs as Lc}from"react/jsx-runtime";var Pc="https://soba.so",Ec=3e4;function Ic(e){let{children:n,session:t,sessionEndpoint:r,user:o,sessionCacheKey:a,runEndpoint:s,theme:c,initialMachines:i,initialConnect:l=null,initialPlans:d,initialCurrentPlan:g=null,baseUrl:b=Pc,pollMs:y=Ec,injectStyles:m=!0,modal:v=!0,fetchImpl:A,onError:k}=e,[S,W]=ue(t??null),[L,D]=ue(null),[O,U]=ue(l),[w,$]=ue(null),[j,ee]=ue(l===null),[ae,me]=ue(i??[]),[fe,P]=ue(null),[q,V]=ue(i===void 0),[Z,be]=ue(d??[]),[Y,ge]=ue(g),[Ae,Te]=ue(null),[Pe,ne]=ue(d===void 0),[de,u]=ue(null),[R,I]=ue(null),[J,B]=ue(!0),[te,N]=ue(null),[H,ie]=ue(!1),Ee=ln(k);Ee.current=k;let je=Ue(p=>{D(p),Ee.current?.(p)},[]);Ye(()=>{m&&Ht()},[m]);let E=Qn(()=>ya({...t?{token:t}:{},...r?{endpoint:r}:{},...o?{user:o}:{},...A?{fetchImpl:A}:{},...a?{cacheKey:a}:{}}),[t,r,o,A,a]);Ye(()=>{let p=!0;wa(E);let M=E.subscribe(()=>{p&&W(E.token)});return!E.token&&!E.canRefresh?je(new Error("<SobaProvider> needs a `session` or a `sessionEndpoint`. A browser cannot mint one: that takes your secret key.")):E.ensure().then(()=>p&&W(E.token),Q=>p&&je(Q)),()=>{p=!1,M(),va(E)}},[E,je]),Ye(()=>{L&&(ee(!1),V(!1),ne(!1),B(!1),$(p=>p??L),P(p=>p??L),Te(p=>p??L))},[L]),Ye(()=>{let p=E.refreshAt;if(p===null)return;let M=()=>{E.refresh().catch(ye=>je(ye))},Q=()=>{document.hidden||(document.removeEventListener("visibilitychange",Q),M())},oe=setTimeout(()=>{typeof document<"u"&&document.hidden?document.addEventListener("visibilitychange",Q):M()},Math.max(0,p-Date.now()));return()=>{clearTimeout(oe),typeof document<"u"&&document.removeEventListener("visibilitychange",Q)}},[E,je,S]);let Cn=ln(l?.machines_url??null),G=Qn(()=>{if(!S)return null;let p=new ft({session:S,baseUrl:b,fetchImpl:ka(E,A??fetch.bind(globalThis))});return p.setMachinesUrl(Cn.current),p},[S,b,E,A]),cn=ln(l!==null);Ye(()=>{if(!G||cn.current)return;let p=!0;return ee(!0),G.context().then(M=>{p&&(U(M),$(null),ee(!1))},M=>{p&&($(M),ee(!1))}),()=>{p=!1}},[G]);let tn=Ue(async()=>{if(G)try{let p=await G.machines();me(Array.isArray(p)?p:[]),P(null)}catch(p){P(p)}finally{V(!1)}},[G]),ke=Ue(async()=>{if(G)try{let p=await G.plans();be(p.plans),ge(p.current),Te(null)}catch(p){Te(p)}finally{ne(!1)}},[G]),Mn=ln(!1),[Nn,xn]=ue(!1),ss=ln(d!==void 0),un=ln(!1),Vt=Ue(()=>{Mn.current||(Mn.current=!0,un.current&&queueMicrotask(()=>{un.current&&xn(!0)}))},[]);Ye(()=>(un.current=!0,Mn.current&&xn(!0),()=>{un.current=!1}),[]),Ye(()=>{!G||!Nn||ss.current||ke()},[G,Nn,ke]);let dn=Ue(async()=>{if(G)try{u(await G.modelOptions()),I(null)}catch(p){I(p)}finally{B(!1)}},[G]),Jn=ln(!1),[he,qe]=ue(!1),ut=Ue(()=>{Jn.current||(Jn.current=!0,un.current&&queueMicrotask(()=>{un.current&&qe(!0)}))},[]);Ye(()=>{Jn.current&&qe(!0)},[]);let Yn=cn.current||O!==null;Ye(()=>{w&&!Yn&&B(!1)},[w,Yn]),Ye(()=>{!G||!he||!Yn||dn()},[G,he,Yn,dn,Y?.plan_id]);let Qt=Ue(async p=>{if(!G)throw new Error("No session yet.");await G.selectPlan(p),await ke()},[G,ke]),Jt=Ue(async(p,M)=>{if(!G)throw new Error("No session yet.");let Q=await G.checkoutPlan(p,M);if(!Q.url)throw new Error("Checkout could not be started.");return Q.url},[G]),Yt=Ue(async()=>{if(!G)throw new Error("No session yet.");await G.leavePlan(),await ke()},[G,ke]),jn=ln(i!==void 0);Ye(()=>{if(!G)return;let p=He(tn,y,{immediate:!jn.current});return jn.current=!1,p},[G,tn,y]);let Sn=Ue((p="manual")=>{v&&(ie(!0),N(p))},[v]),jt=Ue(()=>N(null),[]),Rn=ln(ae);Rn.current=ae;let Be=Ue(async p=>{if(!s)throw new Error("Pass `runEndpoint` to <SobaProvider> to start runs from the browser. It is your own route: it holds your secret key, calls soba.run(), and forwards the stream.");let{signal:M,...Q}=p,ye=await(A??fetch.bind(globalThis))(s,{method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream"},credentials:"same-origin",body:JSON.stringify(Q),...M?{signal:M}:{}});if(!ye.ok){let pe=await ye.json().catch(()=>null),Xe=new Error(pe?.error?.message??`${s} answered ${ye.status}.`);Xe.status=ye.status,pe?.error?.code&&(Xe.code=pe.error.code),pe?.error&&(Xe.error=pe.error);let dt=Rn.current.length>0&&!Rn.current.some(Ca=>Ca.state!=="offline");throw ye.status===409&&dt&&Sn("no_compute"),Xe}let rn=Vo(ye);return async function*(){try{yield*rn}finally{Mn.current&&ke(),Jn.current&&dn()}}()},[s,A,ke,dn,Sn]),Ce=Qn(()=>Y?Z.find(p=>p.id===Y.plan_id)??null:null,[Z,Y]),pn=Qn(()=>Ce?Ce.connected_reward==="included"&&ae.length>0&&Ce.connected_included_units!==null?Ce.connected_included_units:Ce.included_units:null,[Ce,ae]),Ze=Qn(()=>({plans:Z,current:Y,plan:Ce,used:Y?.units_used??null,included:pn,remaining:pn!==null&&Y?Math.max(0,pn-Y.units_used):null,unlimited:Ce!==null&&pn===null,loading:Pe,error:Ae,select:Qt,checkout:Jt,leave:Yt,refresh:ke}),[Z,Y,Ce,pn,Pe,Ae,Qt,Jt,Yt,ke]),qt=Qn(()=>({providers:de?.providers??[],names:de?.names??[],layout:de?.layout??null,sizes:de?.sizes!==!1,rowsByLayout:de?.rowsByLayout??{},route:de?.route??null,loading:J,error:R,refresh:dn}),[de,J,R,dn]),yr=Qn(()=>({session:S,client:G,error:L,get plan(){return Vt(),Ze},get models(){return ut(),qt},compute:{machines:ae,connected:ae.length>0,online:ae.some(p=>p.state!=="offline"),loading:q,error:fe,refresh:tn},connect:{app:O?.app??null,command:O?.command??null,connectUrl:O?.connect_url??null,publishableKey:O?.publishable_key??null,loading:j,error:w,open:Sn,close:jt,isOpen:te!==null,hasModal:v},run:Be}),[S,G,L,Ze,Vt,qt,ut,te,Sn,jt,v,ae,q,fe,tn,O,j,w,Be]);return rs(Po.Provider,{value:G,children:rs(Eo.Provider,{value:{context:O,machines:q?void 0:ae,theme:c??O?.theme??"light"},children:Lc(Io.Provider,{value:yr,children:[n,v&&H&&rs(Gt,{open:te!==null,onOpenChange:p=>N(p?te??"manual":null),onConnected:()=>{tn()},...te==="payment_required"||te==="no_compute"?{reason:te}:{},...te==="pair"?{showStatus:!1}:{}})]})})})}function Oc(e){return e?Tc[e]??e:null}var Tc={"user-hardware":"your own local model","user-subscription":"your own AI plan","user-api-key":"your own API key","open-weights":"open models we host",frontier:"a frontier model we pay for"};async function Bc(e,n,t){let r=n.local;if(!r?.session||n.after)return null;let o=/\/v1\/runs\/([^/]+)\/events/.exec(e.url)?.[1];if(!o)return null;let a=`http://127.0.0.1:${r.port??47321}/v1/runs/${o}/events`,s=new AbortController,c=()=>s.abort();n.signal?.addEventListener("abort",c);let i=setTimeout(()=>s.abort(),r.timeoutMs??3e3);try{let l=await t(a,{headers:{authorization:`Bearer ${r.session}`,accept:"text/event-stream"},signal:s.signal});return l.ok?{url:a,bearer:r.session,open:l}:null}catch{return null}finally{clearTimeout(i),n.signal?.removeEventListener("abort",c)}}async function*Gc(e){let n=e.body;if(!n)return;let t=n.getReader(),r=new TextDecoder,o="",a=null,s=[];try{for(;;){let c=await t.read();if(c.done)return;o+=r.decode(c.value,{stream:!0});for(let i=o.indexOf(`
4490
4490
  `);i!==-1;i=o.indexOf(`
4491
4491
  `)){let l=o.slice(0,i).replace(/\r$/,"");if(o=o.slice(i+1),l==="")s.length&&(yield{id:a,data:s.join(`
4492
- `)}),a=null,s=[];else if(l.startsWith("id:")){let d=Number(l.slice(3).trim());a=Number.isFinite(d)?d:null}else if(l.startsWith("data:")){let d=l.slice(5);s.push(d.startsWith(" ")?d.slice(1):d)}}}}finally{t.cancel().catch(()=>{})}}var os=(e,n)=>new Promise(t=>{let r=setTimeout(t,e);n?.addEventListener("abort",()=>{clearTimeout(r),t()})});async function*Wc(e,n={}){let t=n.fetchImpl??fetch.bind(globalThis),r=await Bc(e,n,t)??{url:e.url,bearer:e.token,open:null},o=n.maxRetries??6,a=n.after??0,s=0;for(;;){if(n.signal?.aborted)return;let c;try{c=r.open??await t(r.url,{headers:{authorization:`Bearer ${r.bearer}`,accept:"text/event-stream",...a?{"last-event-id":String(a)}:{}},...n.signal?{signal:n.signal}:{}}),r.open=null}catch(i){if(n.signal?.aborted)return;if(++s>o)throw i;await os(1e3*s,n.signal);continue}if(c.status===503&&s<o){s++,await os(Number(c.headers.get("retry-after")??3)*1e3,n.signal);continue}if(!c.ok){let i=`Could not read this run (${c.status}).`;try{let l=await c.json();l.error?.message&&(i=l.error.message)}catch{}throw new Error(i)}for await(let i of Gc(c)){i.id!==null&&(a=i.id),s=0;let l=lt(i.data);if(l&&(yield l,l.type==="done"||l.type==="error"))return}if(n.signal?.aborted)return;if(++s>o)throw new Error("Lost this run's stream and could not get it back.");await os(1e3*s,n.signal)}}export{sl as ComputeStatus,zn as ConnectButton,hl as ConnectCompute,Gt as ConnectModal,El as ConnectNudge,To as ConnectPill,Gl as ModelPicker,Wl as ProviderMark,zl as RedeemCode,Jl as RunError,ql as RunLimit,hc as SobaBilling,gc as SobaCheckout,Yo as SobaCurrentPlan,wc as SobaGate,zt as SobaPlans,Ic as SobaProvider,Bl as collectText,Bo as connectSays,ha as gateMessage,Ht as injectStyles,ol as modelLogo,lt as parseEvent,Vo as readEvents,oa as runErrorMessage,Vn as sobaErrorCode,Oc as tierLabel,es as useCheckout,Tt as useCompute,ul as useConnectButton,zo as useConnectNudge,Ft as useCurrentPlan,ns as useFeature,Go as useMachineRuns,Fn as useModel,Dt as useOpenSobaConnect,jo as usePlans,Jo as useRedeemCode,Uo as useRunLimit,K as useSoba,Wc as watchRun};
4492
+ `)}),a=null,s=[];else if(l.startsWith("id:")){let d=Number(l.slice(3).trim());a=Number.isFinite(d)?d:null}else if(l.startsWith("data:")){let d=l.slice(5);s.push(d.startsWith(" ")?d.slice(1):d)}}}}finally{t.cancel().catch(()=>{})}}var os=(e,n)=>new Promise(t=>{let r=setTimeout(t,e);n?.addEventListener("abort",()=>{clearTimeout(r),t()})});async function*Wc(e,n={}){let t=n.fetchImpl??fetch.bind(globalThis),r=await Bc(e,n,t)??{url:e.url,bearer:e.token,open:null},o=n.maxRetries??6,a=n.after??0,s=0;for(;;){if(n.signal?.aborted)return;let c;try{c=r.open??await t(r.url,{headers:{authorization:`Bearer ${r.bearer}`,accept:"text/event-stream",...a?{"last-event-id":String(a)}:{}},...n.signal?{signal:n.signal}:{}}),r.open=null}catch(i){if(n.signal?.aborted)return;if(++s>o)throw i;await os(1e3*s,n.signal);continue}if(c.status===503&&s<o){s++,await os(Number(c.headers.get("retry-after")??3)*1e3,n.signal);continue}if(!c.ok){let i=`Could not read this run (${c.status}).`;try{let l=await c.json();l.error?.message&&(i=l.error.message)}catch{}throw new Error(i)}for await(let i of Gc(c)){i.id!==null&&(a=i.id),s=0;let l=lt(i.data);if(l&&(yield l,l.type==="done"||l.type==="error"))return}if(n.signal?.aborted)return;if(++s>o)throw new Error("Lost this run's stream and could not get it back.");await os(1e3*s,n.signal)}}export{sl as ComputeStatus,zn as ConnectButton,gl as ConnectCompute,Gt as ConnectModal,El as ConnectNudge,To as ConnectPill,Gl as ModelPicker,Wl as ProviderMark,zl as RedeemCode,Jl as RunError,ql as RunLimit,gc as SobaBilling,hc as SobaCheckout,Yo as SobaCurrentPlan,wc as SobaGate,zt as SobaPlans,Ic as SobaProvider,Bl as collectText,Bo as connectSays,ga as gateMessage,Ht as injectStyles,ol as modelLogo,lt as parseEvent,Vo as readEvents,oa as runErrorMessage,Vn as sobaErrorCode,Oc as tierLabel,es as useCheckout,Tt as useCompute,ul as useConnectButton,zo as useConnectNudge,Ft as useCurrentPlan,ns as useFeature,Go as useMachineRuns,Fn as useModel,Dt as useOpenSobaConnect,jo as usePlans,Jo as useRedeemCode,Uo as useRunLimit,K as useSoba,Wc as watchRun};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soba-so/react",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Connect the AI your users already pay for, from your own React app.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://soba.so/docs/components",