dsh-coding-subscription-oauth 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -3
- package/INSTALL.md +26 -25
- package/README.de.md +4 -4
- package/README.es.md +4 -4
- package/README.fr.md +4 -4
- package/README.ja.md +4 -4
- package/README.ko.md +4 -4
- package/README.md +4 -4
- package/README.pt-BR.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh-CN.md +4 -4
- package/docs/02-architecture.md +5 -5
- package/docs/02-architecture.zh-CN.md +5 -5
- package/lib/client.js +3 -3
- package/lib/client.js.map +4 -4
- package/package.json +4 -4
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:"dsh-coding-subscription-oauth",factory:(require)=>{var module={exports:{}};var exports=module.exports;
|
|
2
|
-
var Rt=Object.defineProperty;var vo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var Ao=Object.prototype.hasOwnProperty;var ko=(e,t)=>{for(var n in t)Rt(e,n,{get:t[n],enumerable:!0})},Io=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of xo(t))!Ao.call(e,r)&&r!==n&&Rt(e,r,{get:()=>t[r],enumerable:!(o=vo(t,r))||o.enumerable});return e};var To=e=>Io(Rt({},"__esModule",{value:!0}),e);var ia={};ko(ia,{apply:()=>na,inject:()=>Zo,name:()=>Qo});module.exports=To(ia);var Re=require("react"),Bi=require("react-dom/client");function wn(e){if(typeof e!="object"||e===null)return;let t;try{let n=e.get;typeof n=="function"&&(t=n.call(e,"slots"))}catch{}if(t===void 0)try{t=e.slots}catch{}if(typeof t=="object"&&t!==null&&typeof t.inject=="function"&&typeof t.register=="function")return t}function vn(e){let t=e,n=t.locale,o=wn(e),c=[["client.effect",t.effect,"error"],["client.locale.register",n?.register,"error"],["client.locale.bind",n?.bind,"error"],["client.slots.inject",o?.inject,"warning"]].flatMap(([p,l,C])=>typeof l=="function"?[]:[{id:p,level:C,message:C==="warning"?`${p} is unavailable; the independent settings entry remains active`:`${p} is unavailable in the DSH client runtime`,expected:"function",actual:typeof l}]),d=Object.freeze([...c]);return Object.freeze({context:e,locale:e.locale,effect:e.effect,diagnostics:()=>d,assertCompatible(){let p=c.filter(l=>l.level==="error");if(p.length>0)throw new Error(`incompatible DSH client API: ${p.map(l=>l.id).join(", ")}`)},installSlots(p){let l=!1,C=!1,h=()=>{},I=R=>{let g=wn(R);return l||C||g===void 0?!1:(C=!0,h(),h=p.register(g),!0)};if(!I(e)){h=p.mountFallback();let R=t.inject;typeof R=="function"&&R.call(e,["slots"],g=>{I(g)})}e.effect(()=>()=>{l=!0,h()},"dsh-coding-subscription-oauth: independent settings entry")}})}var y=require("react");var Po="/plugins/dsh-grok-build/auth/status",Eo="/plugins/dsh-grok-build/auth/login",_o="/plugins/dsh-grok-build/auth/login/code",Oo="/plugins/dsh-grok-build/auth/login/cancel",Ro="/plugins/dsh-grok-build/auth/import",Lo="/plugins/dsh-grok-build/auth/logout",Go="/plugins/dsh-grok-build/auth/models",Lt="/plugins/dsh-grok-build/oauth/status",Gt="/plugins/dsh-grok-build/oauth/login",Ht="/plugins/dsh-grok-build/oauth/code",Ut="/plugins/dsh-grok-build/oauth/cancel",Dt="/plugins/dsh-grok-build/oauth/logout",Mt="/plugins/dsh-grok-build/oauth/models",Kt="/plugins/dsh-grok-build/oauth/sources",Nt="/plugins/dsh-grok-build/oauth/sources/preview",Bt="/plugins/dsh-grok-build/oauth/sources/commit",Ft="/plugins/dsh-grok-build/oauth/sources/cancel",Wt="/plugins/dsh-grok-build/capabilities",Vt="/plugins/dsh-grok-build/codex/usage",$t="/plugins/dsh-grok-build/imagine/credential-status",qt="/plugins/dsh-grok-build/gateway",zt="/plugins/dsh-grok-build/gateway/reveal",jt="/plugins/dsh-grok-build/gateway/rotate",ra=Object.freeze([Po,Eo,_o,Oo,Ro,Lo,Go,Lt,Gt,Ht,Ut,Dt,Mt,Kt,Nt,Bt,Ft,Wt,Vt,$t,qt,zt,jt]);var xn=Lt,An=Gt,kn=Ht,In=Ut,Tn=Dt,Pn=Mt,En="/plugins/dsh-grok-build/oauth/accounts/set-active",_n="/plugins/dsh-grok-build/oauth/accounts/remove",On=Kt,Rn=Nt,Ln=Bt,rt=Ft,Yt=Wt,Gn=Vt,Hn=$t,Je=qt,Un=zt,Dn=jt,Mn=1e3,We=3600*1e3,Xt=["grok","codex","kimi","claude"],Kn=["missing","unsafe","invalid","too_large"],Nn=["none","same_credential","same_account","different_account","unknown_account","unreadable_destination","unsafe_destination"],Bn=["import","reuse","overwrite","blocked"],Fn=["imported","unchanged","overwritten"],Jt={grok:"~/.grok/auth.json",codex:"~/.codex/auth.json",kimi:"~/.kimi/credentials/kimi-code.json",claude:"~/.claude/.credentials.json"},Wn={grok:"sourceKindGrok",codex:"sourceKindCodex",kimi:"sourceKindKimi",claude:"sourceKindClaude"},Vn={missing:"sourceReasonMissing",unsafe:"sourceReasonUnsafe",invalid:"sourceReasonInvalid",too_large:"sourceReasonTooLarge"},$n={none:"sourceConflictNone",same_credential:"sourceConflictSameCredential",same_account:"sourceConflictSameAccount",different_account:"sourceConflictDifferentAccount",unknown_account:"sourceConflictUnknownAccount",unreadable_destination:"sourceConflictUnreadableDestination",unsafe_destination:"sourceConflictUnsafeDestination"},qn={import:"sourceActionImport",reuse:"sourceActionReuse",overwrite:"sourceActionOverwrite",blocked:"sourceActionBlocked"},zn={imported:"sourceCommitImported",unchanged:"sourceCommitUnchanged",overwritten:"sourceCommitOverwritten"},Qt=[{key:"codexSearch",label:"capCodexSearch",hint:"capCodexSearchHint"},{key:"codexImages",label:"capCodexImages",hint:"capCodexImagesHint"},{key:"codexImageEdits",label:"capCodexImageEdits",hint:"capCodexImageEditsHint",requiresImages:!0},{key:"codexImagesAnyModel",label:"capCodexImagesAnyModel",hint:"capCodexImagesAnyModelHint",requiresImages:!0},{key:"codexUsage",label:"capCodexUsage",hint:"capCodexUsageHint"},{key:"codexFast",label:"capCodexFast",hint:"capCodexFastHint"},{key:"grokImagineImage",label:"capGrokImagineImage",hint:"capGrokImagineImageHint"},{key:"grokImagineVideo",label:"capGrokImagineVideo",hint:"capGrokImagineVideoHint"}],jn=[{key:"searchResults",label:"capSearchResults",hint:"capSearchResultsHint",min:1,max:20,scale:1},{key:"imageCount",label:"capImageCount",hint:"capImageCountHint",min:1,max:4,scale:1},{key:"videoArtifactTtlMs",label:"capVideoTtlHours",hint:"capVideoTtlHoursHint",min:1,max:168,scale:We}],Zt={none:"imagineSourceNone",env:"imagineSourceEnv",environment:"imagineSourceEnv","xai-api-key":"imagineSourceEnv",xai_api_key:"imagineSourceEnv","api-key":"imagineSourceApiKey",api_key:"imagineSourceApiKey",apikey:"imagineSourceApiKey",key:"imagineSourceApiKey",settings:"imagineSourceApiKey",oauth:"imagineSourceOAuth","oauth-access":"imagineSourceOAuth","grok-cli-key":"imagineSourceCliKey","cli-key":"imagineSourceCliKey"},Yn=[{slug:"grok",route:"grok-build",titleKey:"grokTitle",descriptionKey:"grokDescription",methods:["pkce","device"],recommended:"pkce",remoteRecommended:"device"},{slug:"codex",route:"codex-oauth",titleKey:"codexTitle",descriptionKey:"codexDescription",methods:["device","browser"],recommended:"device",remoteRecommended:"device"},{slug:"kimi",route:"kimi-code-oauth",titleKey:"kimiTitle",descriptionKey:"kimiDescription",methods:["device"],recommended:"device",remoteRecommended:"device"},{slug:"claude",route:"claude-code-oauth",titleKey:"claudeTitle",descriptionKey:"claudeDescription",methods:["browser"],recommended:"browser",remoteRecommended:"browser"}],Te=[{id:"accounts",label:"tabAccounts"},{id:"gateway",label:"tabGateway"},{id:"capabilities",label:"tabCapabilities"},{id:"about",label:"tabAbout"}],st=1024,dt=65535,Ve=18100,Xn=18999,Jn=new Set([22,53,3080,7890,9090,18080]),Qn=new Set(["preview_invalid","preview_expired","source_changed","destination_changed","confirm_required","unsafe_destination"]),Zn="0.8.0";function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ei(e){return e instanceof Error&&e.name==="PluginRequestError"&&"status"in e}function ti(e){return ei(e)?e.status===409||e.code==="SETTINGS_CONFLICT"||/conflict/iu.test(e.message):e instanceof Error&&/SETTINGS_CONFLICT|settings-conflict|changed since it was read/iu.test(e.message)}function ni(e){return ei(e)?e.code!==void 0&&Qn.has(e.code)?!0:e.status===404||e.status===410:!1}function lt(e,t=!1){fetch(rt,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({previewId:e}),...t?{keepalive:!0}:{}}).catch(()=>{})}async function U(e,t="GET",n){let o=await fetch(e,{method:t,headers:{accept:"application/json",...n===void 0?{}:{"content-type":"application/json"}},credentials:"same-origin",...n===void 0?{}:{body:JSON.stringify(n)}}),r=await o.json().catch(()=>{});if(!o.ok){let c=L(r)?r:void 0,d=c!==void 0&&typeof c.error=="string"?c.error:c!==void 0&&typeof c.message=="string"?c.message:`HTTP ${o.status}`,p=c!==void 0&&typeof c.code=="string"?c.code:void 0,l=new Error(d);throw l.name="PluginRequestError",l.status=o.status,p!==void 0&&(l.code=p),l}return r}async function ct(e){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}var $e="all 0.15s ease",en={display:"flex",flexDirection:"column",gap:16,width:"100%",maxWidth:780,minWidth:0},$={margin:0,fontSize:20,lineHeight:"28px",fontWeight:600,color:"var(--dsw-alias-label-primary)"},S={margin:0,fontSize:14,lineHeight:"22px",color:"var(--dsw-alias-label-secondary)"},oe={display:"flex",flexDirection:"column",gap:14,padding:"18px 20px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:12,background:"var(--dsw-alias-bg-module-platform)",transition:$e},ve={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},Ue={display:"flex",alignItems:"center",gap:9,fontSize:14,fontWeight:500,color:"var(--dsw-alias-label-primary)"},P={boxSizing:"border-box",minHeight:34,padding:"6px 14px",border:"1px solid var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.4))",borderRadius:18,background:"var(--dsw-alias-button-elevated-fill, var(--dsw-alias-bg-layer-1))",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.18)",font:"inherit",fontSize:14,fontWeight:500,cursor:"pointer",transition:$e},Y={...P,border:"none",background:"var(--dsw-alias-button-primary-fill)",color:"var(--dsw-alias-label-primary-foreground)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.28)",fontWeight:600},le={...P,minHeight:28,padding:"4px 10px",fontSize:13,borderRadius:8},Pe={...S,color:"var(--dsw-alias-state-error-primary)"},ya={...S,color:"var(--dsw-alias-state-success-primary, #22a06b)"},ut={...S,padding:"10px 12px",borderRadius:8,border:"1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e06c00) 35%, transparent)",background:"color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e06c00) 10%, transparent)",color:"var(--dsw-alias-label-primary)"},Ho={...S,padding:"10px 12px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)"},ii={...Ho,animation:"dsh-coding-oauth-fade-in 0.2s ease"},oi={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:20,letterSpacing:"0.08em",fontWeight:600,color:"var(--dsw-alias-label-primary)"},J={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},ai={...J,display:"block",fontSize:12,lineHeight:"18px",padding:"10px 12px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",overflowWrap:"anywhere",whiteSpace:"pre-wrap"},ri={color:"var(--dsw-alias-brand-primary)",wordBreak:"break-all"},xe={display:"flex",flexDirection:"column",gap:8,margin:0,padding:0,listStyle:"none"},pt={display:"flex",alignItems:"flex-start",gap:8,fontSize:14,color:"var(--dsw-alias-label-primary)"},De={boxSizing:"border-box",width:"100%",minHeight:34,padding:"6px 12px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",font:"inherit",fontSize:13,transition:$e},ae={display:"flex",flexDirection:"column",gap:8,padding:"12px 14px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},b={...S,fontSize:13},gt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},yt={display:"inline-flex",flexWrap:"wrap",gap:2,padding:3,borderRadius:10,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)"},Qe={...P,border:"none",borderRadius:8,boxShadow:"none",background:"transparent",minHeight:32,padding:"5px 12px",fontSize:13},ft={...Qe,background:"var(--dsw-alias-bg-module-platform)",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.12)",fontWeight:600},si={display:"flex",flexDirection:"column",gap:14,minWidth:0},di={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(320px, 100%), 1fr))",gap:14},mt={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:8},Me={...oe,minHeight:88,background:"linear-gradient(90deg, var(--dsw-alias-bg-layer-1) 0%, var(--dsw-alias-bg-module-platform) 50%, var(--dsw-alias-bg-layer-1) 100%)",backgroundSize:"200% 100%",animation:"dsh-coding-oauth-skeleton-pulse 1.4s ease-in-out infinite"},tn={display:"flex",alignItems:"flex-start",gap:10,fontSize:14,color:"var(--dsw-alias-label-secondary)"},bt={...tn,color:"var(--dsw-alias-label-primary)",fontWeight:500},nn={display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:"50%",flex:"0 0 auto",fontSize:12,fontWeight:600,background:"var(--dsw-alias-bg-layer-1)",border:"1px solid var(--dsw-alias-border-l2)",color:"var(--dsw-alias-label-secondary)"},ht={...nn,background:"var(--dsw-alias-button-primary-fill)",borderColor:"var(--dsw-alias-button-primary-fill)",color:"var(--dsw-alias-label-primary-foreground)"};function Uo(e){switch(e){case"success":return"var(--dsw-alias-state-success-primary, #22a06b)";case"error":return"var(--dsw-alias-state-error-primary, #d92d20)";case"warning":return"var(--dsw-alias-state-warn-primary, #e06c00)";case"info":return"var(--dsw-alias-brand-primary, #1677ff)";default:return"var(--dsw-alias-label-tertiary, #81858c)"}}function li(e){let t=Uo(e);return{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 10px",borderRadius:999,fontSize:12,fontWeight:600,lineHeight:"18px",color:t,background:`color-mix(in srgb, ${t} 14%, transparent)`,border:`1px solid color-mix(in srgb, ${t} 28%, transparent)`,whiteSpace:"nowrap"}}function Ae(e,t=!0){return{width:9,height:9,borderRadius:"50%",flex:"0 0 auto",background:t?e==="signed-in"||e==="available"?"var(--dsw-alias-state-success-primary, #22a06b)":e==="error"?"var(--dsw-alias-state-error-primary, #d92d20)":e==="signing-in"||e==="loading"?"var(--dsw-alias-brand-primary, #1677ff)":"var(--dsw-alias-label-tertiary, #81858c)":"var(--dsw-alias-label-tertiary, #81858c)"}}function ci(e,t=!0){return t?e==="signed-in"?"success":e==="error"?"error":e==="signing-in"?"info":"neutral":"neutral"}var Ce=require("react/jsx-runtime"),Do="https://github.com/lninghaha/dsh-coding-subscription-oauth#readme";function ui({t:e}){return(0,Ce.jsxs)("section",{style:oe,"aria-labelledby":"coding-oauth-about-title",children:[(0,Ce.jsx)("h3",{id:"coding-oauth-about-title",style:{...$,fontSize:16},children:e("aboutTitle")}),(0,Ce.jsx)("p",{style:{...ut,marginTop:12},children:e("termsWarning")}),(0,Ce.jsx)("p",{style:{...S,marginTop:12},children:e("remoteLoginHelp")}),(0,Ce.jsx)("p",{style:{...b,marginTop:12},children:e("pluginVersion",{version:Zn})}),(0,Ce.jsx)("p",{style:{...b,marginTop:8},children:e("aboutDocsHint")}),(0,Ce.jsx)("p",{style:{marginTop:8},children:(0,Ce.jsx)("a",{href:Do,target:"_blank",rel:"noreferrer",style:ri,children:e("aboutDocsLink")})})]})}var ze=require("react");function Mo(e,t){return t&&e.remoteRecommended!==void 0&&e.methods.includes(e.remoteRecommended)?e.remoteRecommended:e.recommended}function pi(e,t){let n=Mo(e,t),o=e.methods.filter(r=>r!==n);return e.methods.includes(n)?[n,...o]:[...e.methods]}function gi(e){return e===void 0||e.available||e.reason===void 0?!1:e.reason!=="missing"}function yi(e){return e===void 0||e.length===0?!1:e.every(t=>!t.available&&(t.reason===void 0||t.reason==="missing"))}function fi(e){return e?.some(t=>t.available)===!0}function Ct(e,t,n){return e==="device"?n?.remote===!0&&n.primary===!0?t("deviceLoginRemote"):t("deviceLogin"):t(e==="browser"?"browserLogin":"pkceLogin")}var Ze=require("react/jsx-runtime");function Ee({label:e,tone:t,providerStatus:n,installed:o=!0,showDot:r=!0}){let c=t??(n!==void 0?ci(n,o):"neutral");return(0,Ze.jsxs)("span",{style:li(c),role:"status",children:[r?(0,Ze.jsx)("span",{"aria-hidden":"true",style:{...Ae(n??(c==="success"?"signed-in":"signed-out"),o),width:7,height:7}}):null,(0,Ze.jsx)("span",{children:e})]})}function D(e){return typeof e=="string"&&e.length>0&&e.length<500?e:void 0}function ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function vt(e){return typeof e=="boolean"?e:void 0}function an(e){let t=ce(e);return t!==void 0&&t>=0&&t<=100?t:void 0}function mi(e){return Xt.includes(e)}function Ko(e){return Kn.includes(e)}function No(e){return Nn.includes(e)}function Bo(e){return Bn.includes(e)}function Fo(e){return Fn.includes(e)}function xt(e){return/eyJ[A-Za-z0-9_-]+\.|sk-[A-Za-z0-9_-]{8,}|Bearer\s+\S+/u.test(e)}function bi(e,t){let n=D(e);return n===void 0||xt(n)||n.length>180?Jt[t]:n}function Wo(e){let t=D(e);if(!(t===void 0||xt(t)))return t}function qe(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=e>1e12?e:e>1e9?e*1e3:void 0;if(t===void 0)return;let n=new Date(t).toLocaleString();return n.length>0?n:void 0}function Vo(e){if(!L(e)||typeof e.kind!="string"||!mi(e.kind))return;let t=e.kind,n=D(e.reason),o=ce(e.expiresAt);return{kind:t,displayPath:bi(e.displayPath,t),available:e.available===!0,...o===void 0?{}:{expiresAt:o},...n!==void 0&&Ko(n)?{reason:n}:{}}}function rn(e){return Xt.map(t=>e.find(o=>o.kind===t)??{kind:t,displayPath:Jt[t],available:!1,reason:"missing"})}function hi(e){let t=Array.isArray(e)?e:L(e)&&Array.isArray(e.sources)?e.sources:[];return rn(t.map(Vo).filter(n=>n!==void 0))}function Ci(e){if(!L(e))return;let t=D(e.previewId),n=D(e.kind);if(t===void 0||n===void 0||!mi(n))return;let o=D(e.conflict),r=D(e.action),c=ce(e.expiresAt),d=ce(e.ticketExpiresAt),p=Array.isArray(e.warnings)?e.warnings.map(Wo).filter(l=>l!==void 0):[];return{previewId:t,kind:n,displayPath:bi(e.displayPath,n),confirmOverwriteRequired:e.confirmOverwriteRequired===!0,warnings:p,...c===void 0?{}:{expiresAt:c},...d===void 0?{}:{ticketExpiresAt:d},...o!==void 0&&No(o)?{conflict:o}:{},...r!==void 0&&Bo(r)?{action:r}:{}}}function Si(e){if(!L(e))return;let t=D(e.action);return t!==void 0&&Fo(t)?t:void 0}function on(e,t,n,o){let r=ce(e);return r!==void 0&&Number.isInteger(r)&&r>=t&&r<=n?r:o}function sn(){return{codexSearch:!1,codexImages:!1,codexImageEdits:!1,codexImagesAnyModel:!1,codexUsage:!1,codexFast:!1,grokImagineImage:!1,grokImagineVideo:!1,searchResults:5,imageCount:1,videoArtifactTtlMs:168*We}}function $o(e){let t=L(e)?e:{};return{codexSearch:t.codexSearch===!0,codexImages:t.codexImages===!0,codexImageEdits:t.codexImageEdits===!0,codexImagesAnyModel:t.codexImagesAnyModel===!0,codexUsage:t.codexUsage===!0,codexFast:t.codexFast===!0,grokImagineImage:t.grokImagineImage===!0,grokImagineVideo:t.grokImagineVideo===!0,searchResults:on(t.searchResults,1,20,5),imageCount:on(t.imageCount,1,4,1),videoArtifactTtlMs:on(t.videoArtifactTtlMs,We,168*We,168*We)}}function dn(e){if(!L(e))return;let t=L(e.value)?e.value:e,n=ce(e.revision);if(!(n===void 0&&!L(e.value)&&e.writable===void 0))return{value:$o(t),revision:n??0,writable:e.writable===!0}}function St(e){if(!L(e))return;let t=an(e.usedPercent??e.used_percent),n=an(e.remainingPercent??e.remaining_percent),o=ce(e.windowSeconds??e.limit_window_seconds),r=ce(e.resetsAt??e.reset_at);if(!(t===void 0&&n===void 0&&o===void 0&&r===void 0))return{...t===void 0?{}:{usedPercent:t},...n===void 0?{}:{remainingPercent:n},...o!==void 0&&o>0?{windowSeconds:o}:{},...r===void 0?{}:{resetsAt:r}}}function wt(e,t){if(!L(e))return;let n=D(e.id)??D(e.metered_feature)??t,o=D(e.name)??D(e.limit_name),r=L(e.rate_limit)?e.rate_limit:e,c=Array.isArray(e.windows)?e.windows.map(St).filter(d=>d!==void 0):[St(r.primary_window),St(r.secondary_window),St(r)].filter(d=>d!==void 0);if(!(c.length===0&&o===void 0&&D(e.id)===void 0))return{id:n,windows:c,...o===void 0?{}:{name:o}}}function wi(e){if(!L(e))return;let t=L(e.usage)?e.usage:e,n=[],o=new Set,r=v=>{v===void 0||o.has(v.id)||(o.add(v.id),n.push(v))};Array.isArray(t.rateLimits)?t.rateLimits.forEach((v,_)=>r(wt(v,`limit-${String(_)}`))):(r(wt(t.rate_limit,"codex")),Array.isArray(t.additional_rate_limits)&&t.additional_rate_limits.forEach((v,_)=>r(wt(v,`extra-${String(_)}`))),r(wt(t.code_review_rate_limit,"code_review")));let c=L(t.credits)?t.credits:void 0,d=L(t.individualLimit)?t.individualLimit:L(t.spend_control)?L(t.spend_control.individual_limit)?t.spend_control.individual_limit:t.spend_control:void 0,p=L(t.resetCredits)?t.resetCredits.availableCount:L(t.rate_limit_reset_credits)?t.rate_limit_reset_credits.available_count:void 0,l=ce(p),C=ce(t.fetchedAt),h=vt(t.spendControlReached)??(L(t.spend_control)?vt(t.spend_control.reached):void 0),I=c===void 0?void 0:D(c.balance),R=d===void 0?void 0:D(d.limit),g=d===void 0?void 0:D(d.used),T=d===void 0?void 0:D(d.remaining),G=d===void 0?void 0:an(d.remainingPercent??d.remaining_percent),k=d===void 0?void 0:ce(d.resetsAt??d.reset_at);return{rateLimits:n,...c!==void 0&&typeof c.unlimited=="boolean"?{creditsUnlimited:c.unlimited}:{},...I===void 0?{}:{creditsBalance:I},...R===void 0?{}:{individualLimit:R},...g===void 0?{}:{individualUsed:g},...T===void 0?{}:{individualRemaining:T},...G===void 0?{}:{individualRemainingPercent:G},...k===void 0?{}:{individualResetsAt:k},...h===void 0?{}:{spendControlReached:h},...l!==void 0&&l>=0&&Number.isSafeInteger(l)?{resetCredits:l}:{},...C===void 0?{}:{fetchedAt:C}}}function vi(e){return e.rateLimits.some(t=>t.windows.length>0||t.name!==void 0)||e.creditsUnlimited!==void 0||e.creditsBalance!==void 0||e.individualLimit!==void 0||e.individualUsed!==void 0||e.individualRemaining!==void 0||e.individualRemainingPercent!==void 0||e.spendControlReached===!0||e.resetCredits!==void 0}function et(e){if(!L(e))return;let t=D(e.bind),n=ce(e.port);if(t===void 0||n===void 0)return;let o=Array.isArray(e.models)?e.models.filter(d=>typeof d=="string"&&d.length>0):[],r=D(e.model)??o[0]??null;o.length===0&&r!==null&&o.push(r);let c=e.keyAvailable===!0||e.keyConfigured===!0;return{enabled:e.enabled===!0,running:e.running===!0,bind:t,port:n,model:r,keyConfigured:c,keyAvailable:c,keyHint:D(e.keyHint)??"",models:o,warning:D(e.warning)??"",opencodeGoEnabled:e.opencodeGoEnabled===!0}}function tt(e,t){return`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${String(t)}`}function xi(e){for(let t=0;t<32;t+=1){let n=Xn-Ve+1,o=Ve+Math.floor(Math.random()*n);if(o!==e&&!Jn.has(o))return o}return e===Ve?Ve+1:Ve}function At(e){let t=Number(e);if(!(!Number.isInteger(t)||t<st||t>dt))return t}function Ai(e){if(!L(e))return;let t=vt(e.configured);if(t===void 0&&e.source===void 0&&e.writable===void 0)return;let n=D(e.source),o=vt(e.writable);return{configured:t===!0,...n===void 0||xt(n)?{}:{source:n},...o===void 0?{}:{writable:o}}}function ki(e,t){if(e===void 0)return t("imagineSourceUnknown");let n=Zt[e]??Zt[e.toLowerCase()];return n!==void 0?t(n):e.length<=40&&/^[a-z0-9._-]+$/iu.test(e)&&!xt(e)?e:t("imagineSourceUnknown")}function Ii(e){return e.status!=="signed-in"?{available:[],selected:[]}:{available:"available"in e?e.available:[],selected:"selected"in e?e.selected:[]}}var B=require("react/jsx-runtime");function Ti({t:e,preview:t,confirmOverwrite:n,sourcesBusy:o,onConfirmOverwriteChange:r,onCommit:c,onCancel:d}){let p=qe(t.expiresAt),l=qe(t.ticketExpiresAt);return(0,B.jsxs)("section",{id:`coding-oauth-source-preview-${t.kind}`,style:oe,"aria-labelledby":`coding-oauth-source-preview-title-${t.kind}`,"aria-live":"polite",tabIndex:-1,children:[(0,B.jsxs)("p",{id:`coding-oauth-source-preview-title-${t.kind}`,style:S,children:[e("sourcesPreviewTitle")," \xB7 ",e(Wn[t.kind])]}),(0,B.jsx)("p",{style:b,children:(0,B.jsx)("span",{style:J,children:t.displayPath})}),(0,B.jsx)("p",{style:S,children:e("sourcesConflict",{detail:e(t.conflict===void 0?"sourceConflictUnrecognized":$n[t.conflict])})}),(0,B.jsx)("p",{style:S,children:e("sourcesAction",{detail:e(t.action===void 0?"sourceActionUnrecognized":qn[t.action])})}),p===void 0?null:(0,B.jsx)("p",{style:b,children:e("sourcesPreviewExpires",{time:p})}),l===void 0?null:(0,B.jsx)("p",{style:b,children:e("sourcesTicketExpires",{time:l})}),t.warnings.length===0?null:(0,B.jsx)("ul",{style:{...xe,gap:4},"aria-label":e("sourcesWarnings"),children:t.warnings.map(C=>(0,B.jsx)("li",{style:b,children:C},C))}),t.confirmOverwriteRequired?(0,B.jsxs)("label",{style:pt,children:[(0,B.jsx)("input",{"aria-describedby":`coding-oauth-source-overwrite-hint-${t.kind}`,type:"checkbox",checked:n,disabled:o||t.action==="blocked",onChange:C=>{r(C.target.checked)}}),(0,B.jsxs)("span",{children:[e("sourcesConfirmOverwrite"),(0,B.jsx)("span",{id:`coding-oauth-source-overwrite-hint-${t.kind}`,style:{display:"block",...b},children:e("sourcesConfirmOverwriteHint")})]})]}):null,(0,B.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,B.jsx)("button",{type:"button",style:Y,disabled:o||t.action==="blocked"||t.confirmOverwriteRequired&&!n,onClick:c,children:e("sourcesCommit")}),(0,B.jsx)("button",{type:"button",style:P,disabled:o,onClick:d,children:e("sourcesCancelPreview")})]})]})}var Pi=require("react");var nt=require("react/jsx-runtime");function kt({message:e,dismissLabel:t,onDismiss:n,autoHideMs:o,tone:r="info"}){return(0,Pi.useEffect)(()=>{if(o===void 0||n===void 0)return;let d=window.setTimeout(n,o);return()=>{window.clearTimeout(d)}},[o,n]),(0,nt.jsxs)("div",{style:{...ii,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,borderLeft:`3px solid ${r==="success"?"var(--dsw-alias-state-success-primary, #22a06b)":"var(--dsw-alias-brand-primary, #1677ff)"}`},role:"status",children:[(0,nt.jsx)("p",{style:{...S,margin:0,color:"var(--dsw-alias-label-primary)"},children:e}),n===void 0||t===void 0?null:(0,nt.jsx)("button",{type:"button",style:P,onClick:n,children:t})]})}var q=require("react");var _e=require("react");var Ei=require("react/jsx-runtime");function Ke({text:e,idleLabel:t,copiedLabel:n,failedLabel:o,primary:r=!1,disabled:c=!1}){let[d,p]=(0,_e.useState)("idle"),l=(0,_e.useRef)(void 0);(0,_e.useEffect)(()=>()=>{l.current!==void 0&&window.clearTimeout(l.current)},[]);let C=(0,_e.useCallback)(async()=>{let I=await ct(e);p(I?"copied":"failed"),l.current!==void 0&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{p("idle"),l.current=void 0},2e3)},[e]),h=d==="copied"?n:d==="failed"?o:t;return(0,Ei.jsx)("button",{type:"button",style:r?Y:le,disabled:c||e.length===0,onClick:()=>{C()},children:h})}var Oe=require("react/jsx-runtime");function qo(e){return e>=90?"var(--dsw-alias-state-error-primary, #d92d20)":e>=75?"var(--dsw-alias-state-warn-primary, #e06c00)":"var(--dsw-alias-button-info-fill, var(--dsw-static-deepseek-500, #4f6ef7))"}function ln({value:e,label:t,meta:n}){let o=Math.max(0,Math.min(100,e));return(0,Oe.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t===void 0?null:(0,Oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,flexWrap:"wrap"},children:[(0,Oe.jsx)("span",{style:{...b,color:"var(--dsw-alias-label-primary)"},children:t}),n===void 0?null:(0,Oe.jsx)("span",{style:b,children:n})]}),(0,Oe.jsx)("div",{role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,style:{height:8,borderRadius:4,background:"var(--dsw-alias-border-l2)",overflow:"hidden"},children:(0,Oe.jsx)("div",{style:{width:`${String(o)}%`,height:"100%",borderRadius:4,background:qo(o),transition:"width 0.3s ease, background 0.3s ease"}})})]})}var a=require("react/jsx-runtime");function zo({t:e,activeMethod:t,userCode:n,url:o,popupBlocked:r}){let c=n!==void 0&&n.length>0,d=o!==void 0&&o.length>0,p=t!=="device";return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,a.jsxs)("div",{style:d?bt:tn,children:[(0,a.jsx)("span",{style:d?ht:nn,"aria-hidden":"true",children:"1"}),(0,a.jsx)("span",{children:e("signInStepOpen")})]}),d?(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,paddingLeft:32},children:[(0,a.jsx)("a",{href:o,target:"_blank",rel:"noreferrer",style:Y,children:e("openAuthUrl")}),(0,a.jsx)(Ke,{text:o,idleLabel:e("copy"),copiedLabel:e("copied"),failedLabel:e("copyFailed")})]}):null,r&&d?(0,a.jsx)("p",{style:b,children:e("popupBlocked")}):null,c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:bt,children:[(0,a.jsx)("span",{style:ht,"aria-hidden":"true",children:"2"}),(0,a.jsx)("span",{children:e("signInStepCode")})]}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,paddingLeft:32},children:[(0,a.jsx)("span",{style:oi,children:n}),(0,a.jsx)(Ke,{text:n,idleLabel:e("copyUserCode"),copiedLabel:e("copied"),failedLabel:e("copyFailed"),primary:!0})]})]}):null,(0,a.jsxs)("div",{style:bt,children:[(0,a.jsx)("span",{style:ht,"aria-hidden":"true",children:c?3:2}),(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,a.jsx)("span",{"aria-hidden":"true",style:{width:14,height:14,border:"2px solid var(--dsw-alias-brand-primary, #1677ff)",borderTopColor:"transparent",borderRadius:"50%",animation:"dsh-coding-oauth-spin 0.8s linear infinite"}}),e("signInStepWait")]})]}),p?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingLeft:32},children:(0,a.jsx)("p",{style:S,children:e(t==="browser"?"pasteBrowserCodeHint":"pasteCodeHint")})}):null]})}function _i({t:e,definition:t,providerStatus:n,busy:o,sourcesBusy:r,remote:c,codeInput:d,popupBlocked:p,expanded:l,source:C,showUsage:h,usage:I,usageError:R,usageLoading:g,onSignIn:T,onSignOut:G,onCancelLogin:k,onSubmitCode:v,onCodeChange:_,onToggleExpanded:M,onPreviewSource:V,onSaveModels:Z,onSetDefaultAccount:ue,onRemoveAccount:ee}){let[X,pe]=(0,q.useState)(!1),[W,me]=(0,q.useState)(""),[be,z]=(0,q.useState)(!1),ge=(0,q.useRef)(null),re=(0,q.useRef)(null),te=(0,q.useRef)(!1),he=pi(t,c),se=he[0]??t.recommended,x=he.filter(m=>m!==se),ke=n.status==="signed-in"?e("signedIn"):n.status==="signing-in"?e("signingIn"):n.status==="error"?e("requestFailed"):e("signedOut"),ye=n.status==="signing-in"?n.method:se,{available:O,selected:w}=(0,q.useMemo)(()=>Ii(n),[n]),[H,Se]=(0,q.useState)(w);(0,q.useEffect)(()=>{Se(w)},[w]),(0,q.useEffect)(()=>{n.status!=="signed-in"&&z(!1)},[n.status]),(0,q.useEffect)(()=>{if(be){re.current?.focus();return}if(te.current){if(te.current=!1,n.status==="signed-in"){ge.current?.focus();return}document.getElementById(`coding-oauth-login-${t.slug}`)?.focus()}},[t.slug,be,n.status]);let it=H.length!==w.length||H.some((m,K)=>m!==w[K]),Ie=t.slug==="grok"?n:void 0,j=gi(C),Le=(0,q.useMemo)(()=>{let m=W.trim().toLowerCase();return m.length===0?O:O.filter(K=>K.toLowerCase().includes(m))},[O,W]),Ge=t.slug==="codex"&&h?I?.individualRemainingPercent===void 0?I?.rateLimits[0]?.windows[0]?.usedPercent:100-I.individualRemainingPercent:void 0,ne=qe(I?.fetchedAt);return(0,a.jsxs)("div",{style:oe,children:[(0,a.jsxs)("div",{style:ve,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:{...$,fontSize:16},children:e(t.titleKey)}),n.status==="signed-in"&&!l?(0,a.jsxs)("p",{style:{...b,marginTop:4},children:[e("modelsSummary",{selected:w.length,total:O.length}),Ge===void 0?"":` \xB7 ${e("usageUsedShort",{value:`${String(Ge)}%`})}`]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{style:{...S,marginTop:4},children:e(t.descriptionKey)}),(0,a.jsx)("p",{style:{...S,marginTop:4},children:(0,a.jsx)("span",{style:J,children:t.route})})]})]}),(0,a.jsx)(Ee,{label:ke,providerStatus:n.status})]}),(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:n.status==="signed-in"?(0,a.jsxs)(a.Fragment,{children:[be?(0,a.jsxs)("fieldset",{style:{...ae,margin:0,minWidth:0},children:[(0,a.jsx)("legend",{style:gt,children:e("logoutConfirmTitle")}),(0,a.jsx)("p",{style:S,children:e("logoutConfirmHint")}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("button",{ref:re,type:"button",style:Y,disabled:o,onClick:()=>{te.current=!0,G()},children:e(o?"working":"logoutConfirmAction")}),(0,a.jsx)("button",{type:"button",style:P,disabled:o,onClick:()=>{te.current=!0,z(!1)},children:e("cancel")})]})]}):(0,a.jsx)("button",{ref:ge,type:"button",style:P,disabled:o,onClick:()=>z(!0),children:e("logout")}),(0,a.jsx)("button",{id:`coding-oauth-models-toggle-${t.slug}`,type:"button",style:P,"aria-expanded":l,"aria-controls":l?`coding-oauth-models-${t.slug}`:void 0,onClick:M,children:e(l?"collapseModels":"expandModels")}),C?.available===!0?(0,a.jsx)("button",{id:`coding-oauth-source-pull-${t.slug}`,type:"button",style:P,disabled:r,onClick:V,children:e("sourcesPullCopy")}):null]}):n.status==="signing-in"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",style:P,disabled:o,onClick:k,children:e("cancelLogin")}),x.length>0?(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{pe(m=>!m)},children:e(X?"hideOtherLoginMethods":"otherLoginMethods")}):null,X?x.map(m=>(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{T(m)},children:Ct(m,e,{remote:c,primary:!1})},m)):null]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{id:`coding-oauth-login-${t.slug}`,type:"button",style:Y,disabled:o,onClick:()=>{T(se)},children:o?e("working"):Ct(se,e,{remote:c,primary:!0})}),x.length>0?(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{pe(m=>!m)},children:e(X?"hideOtherLoginMethods":"otherLoginMethods")}):null,X?x.map(m=>(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{T(m)},children:Ct(m,e,{remote:c,primary:!1})},m)):null,C?.available===!0?(0,a.jsx)("button",{id:`coding-oauth-source-pull-${t.slug}`,type:"button",style:P,disabled:r,onClick:V,children:e("sourcesPullCopy")}):j&&C?.reason!==void 0?(0,a.jsx)("span",{style:b,children:e(Vn[C.reason])}):null]})}),n.status==="error"?(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},children:n.message}):null,n.status==="signing-in"?(0,a.jsx)(zo,{t:e,activeMethod:ye,userCode:n.userCode,url:n.url,popupBlocked:p}):null,n.status==="signing-in"&&ye!=="device"?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("label",{htmlFor:`coding-oauth-code-${t.slug}`,style:gt,children:e("pasteCodeLabel")}),(0,a.jsx)("input",{id:`coding-oauth-code-${t.slug}`,style:{...De,flex:"1 1 360px"},value:d,placeholder:e("pasteCodePlaceholder"),disabled:o,onChange:m=>{_(m.target.value)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),v())}}),(0,a.jsx)("button",{type:"button",style:Y,disabled:o||d.trim().length===0,onClick:v,children:e("submitCode")})]})}):null,n.status==="signed-in"&&l?(0,a.jsxs)("div",{id:`coding-oauth-models-${t.slug}`,style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},"data-accounts-list":t.slug,children:[(0,a.jsx)("p",{style:b,children:e("accountsListHint")}),n.accounts.length===0?(0,a.jsx)("p",{style:S,children:e("accountsEmpty")}):(0,a.jsx)("ul",{style:{...xe,margin:0,paddingLeft:0,listStyle:"none"},children:n.accounts.map(m=>{let K=m.id===n.activeAccountId,ie=m.label??m.accountId??m.id;return(0,a.jsxs)("li",{"data-account-id":m.id,style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",justifyContent:"space-between",padding:"6px 0",borderBottom:"1px solid var(--dsw-alias-border-subtle, #e5e5e5)"},children:[(0,a.jsxs)("span",{style:S,children:[ie,K?(0,a.jsxs)("span",{style:b,children:[" \xB7 ",e("accountActive")]}):null]}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[K?null:(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{ue(m.id)},children:e("accountSetDefault")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{ee(m.id)},children:e("accountRemove")})]})]},m.id)})})]}),(0,a.jsxs)("div",{style:ve,children:[(0,a.jsx)("h4",{style:{...$,fontSize:14},children:e("models")}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se([])},children:e("deselectAll")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se([...O])},children:e("selectAll")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se(O.length>0?[O[0]]:[])},children:e("resetModelsDefault")})]})]}),(0,a.jsx)("label",{htmlFor:`coding-oauth-model-filter-${t.slug}`,style:gt,children:e("modelFilterLabel",{provider:e(t.titleKey)})}),(0,a.jsx)("input",{id:`coding-oauth-model-filter-${t.slug}`,type:"search",style:De,value:W,placeholder:e("modelFilterPlaceholder"),disabled:o,onChange:m=>{me(m.target.value)}}),Ie?.status==="signed-in"?(0,a.jsx)("p",{style:S,children:Ie.catalogSource==="live"?e("catalogLive"):Ie.catalogSource==="cache"?e("catalogCache"):e("catalogFallback")}):null,(0,a.jsxs)("p",{style:S,children:[e("modelHint")," ",(0,a.jsxs)("span",{style:J,children:[t.route,"/<id>"]})]}),(0,a.jsx)("ul",{style:xe,children:Le.map(m=>{let K=H.includes(m);return(0,a.jsx)("li",{children:(0,a.jsxs)("label",{style:pt,children:[(0,a.jsx)("input",{type:"checkbox",checked:K,disabled:o,onChange:()=>{let ie=new Set(H);K?ie.delete(m):ie.add(m),Se([...O].filter(Be=>ie.has(Be)))}}),(0,a.jsx)("span",{style:J,children:m})]})},m)})}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,a.jsx)("button",{type:"button",style:Y,disabled:o||!it,onClick:()=>Z(H),children:e(o?"working":"applyModelDraft")}),it?(0,a.jsx)("span",{style:b,children:e("modelDraftPending")}):null]}),Le.length===0?(0,a.jsx)("p",{style:b,children:e("modelFilterPlaceholder")}):null,Ie?.status==="signed-in"&&Ie.catalogError!==void 0?(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},children:e("catalogError")}):null,t.slug==="codex"&&h?(0,a.jsxs)("div",{style:ae,children:[(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-label-primary)"},children:e("usageTitle")}),R===void 0?null:(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},role:"alert",children:R}),g&&I===void 0?(0,a.jsx)("p",{style:b,children:e("usageLoading")}):I===void 0||!vi(I)?(0,a.jsx)("p",{style:b,children:e("usageEmpty")}):(0,a.jsxs)(a.Fragment,{children:[ne===void 0?null:(0,a.jsx)("p",{style:b,children:e("usageFetchedAt",{time:ne})}),Ge!==void 0?(0,a.jsx)(ln,{value:Ge,label:e("usageRateLimit"),meta:e("usageUsed",{value:`${String(Ge)}%`})}):null,I.rateLimits.map(m=>{let K=m.windows[0],ie=K?.usedPercent,Be=qe(K?.resetsAt);return(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:ie===void 0?(0,a.jsx)("p",{style:b,children:m.name??e("usageRateLimit")}):(0,a.jsx)(ln,{value:ie,label:m.name??e("usageRateLimit"),meta:Be===void 0?e("usageUsed",{value:`${String(ie)}%`}):`${e("usageUsed",{value:`${String(ie)}%`})} \xB7 ${e("usageResets",{time:Be})}`})},m.id)})]})]}):null]}):null]})}var E=require("react/jsx-runtime");function Oi({t:e,status:t,remote:n,remoteTipDismissed:o,onDismissRemoteTip:r,sources:c,sourcesError:d,sourcesNotice:p,sourcesBusy:l,preview:C,confirmOverwrite:h,busyProvider:I,codeInputs:R,popupBlocked:g,expandedProviders:T,showUsage:G,usage:k,usageError:v,usageLoading:_,onSignIn:M,onSignOut:V,onCancelLogin:Z,onSubmitCode:ue,onCodeChange:ee,onToggleExpanded:X,onPreviewSource:pe,onSaveModels:W,onSetDefaultAccount:me,onRemoveAccount:be,onConfirmOverwriteChange:z,onCommitSource:ge,onCancelSourcePreview:re,onRefreshSources:te,onDismissSourcesNotice:he}){let se=(0,ze.useRef)(void 0);return(0,ze.useEffect)(()=>{if(C!==void 0){se.current=C.kind,document.getElementById(`coding-oauth-source-preview-${C.kind}`)?.focus();return}let x=se.current;x===void 0||l||(se.current=void 0,document.getElementById(`coding-oauth-source-pull-${x}`)?.focus())},[C,l]),t===void 0?(0,E.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,E.jsxs)("div",{style:Ue,children:[(0,E.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("loadingAccount")]})}):(0,E.jsxs)(E.Fragment,{children:[n&&!o?(0,E.jsx)(kt,{message:e("remoteAccountsTip"),dismissLabel:e("remoteTipDismiss"),onDismiss:r}):null,yi(c)?(0,E.jsx)(kt,{message:e("sourcesAllMissingHint"),dismissLabel:e("sourcesCheckAgain"),onDismiss:()=>{te()}}):null,fi(c)?(0,E.jsx)("p",{style:b,children:e("sourcesAvailableHint")}):null,d===void 0?null:(0,E.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},role:"alert",children:d}),p===void 0?null:(0,E.jsx)(kt,{message:p,tone:"success",autoHideMs:5e3,onDismiss:he},p),(0,E.jsxs)("div",{style:di,children:[Yn.map(x=>{let ke=t.providers[x.slug],ye=ke.status==="signing-in"||T[x.slug]===!0;return(0,E.jsxs)(ze.Fragment,{children:[(0,E.jsx)(_i,{t:e,definition:x,providerStatus:ke,busy:I===x.slug,sourcesBusy:l,remote:n,codeInput:R[x.slug]??"",popupBlocked:g[x.slug]===!0,expanded:ye,source:c?.find(O=>O.kind===x.slug),showUsage:G,usage:k,usageError:v,usageLoading:_,onSignIn:O=>{M(x.slug,O)},onSignOut:()=>{V(x.slug)},onCancelLogin:()=>{Z(x.slug)},onSubmitCode:()=>{ue(x.slug)},onCodeChange:O=>{ee(x.slug,O)},onToggleExpanded:()=>{X(x.slug)},onPreviewSource:()=>{pe(x.slug)},onSaveModels:O=>{W(x.slug,O)},onSetDefaultAccount:O=>{me(x.slug,O)},onRemoveAccount:O=>{be(x.slug,O)}}),C?.kind===x.slug?(0,E.jsx)("div",{style:{gridColumn:"1 / -1",minWidth:0},children:(0,E.jsx)(Ti,{t:e,preview:C,confirmOverwrite:h,sourcesBusy:l,onConfirmOverwriteChange:z,onCommit:ge,onCancel:re})}):null]},x.slug)}),(0,E.jsxs)("div",{style:oe,children:[(0,E.jsxs)("div",{style:ve,children:[(0,E.jsxs)("div",{children:[(0,E.jsx)("h3",{style:{...$,fontSize:16},children:e("antigravityTitle")}),(0,E.jsx)("p",{style:{...S,marginTop:4},children:e("antigravityDescription")}),(0,E.jsx)("p",{style:{...S,marginTop:4},children:(0,E.jsx)("span",{style:J,children:t.antigravity.route})})]}),(0,E.jsx)(Ee,{label:t.antigravity.installed?e("antigravityInstalled"):e("antigravityMissing"),tone:t.antigravity.installed?"success":"neutral",installed:t.antigravity.installed})]}),(0,E.jsx)("p",{style:S,children:e("antigravityCliHint")}),(0,E.jsx)("code",{style:{...J,fontSize:12,overflowWrap:"anywhere"},children:e("antigravityCliCommand")})]})]})]})}var cn=require("react/jsx-runtime"),jo=(e,t)=>({position:"relative",width:40,height:22,borderRadius:11,flex:"0 0 auto",background:e?"var(--dsw-alias-button-primary-fill)":"var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.45))",opacity:t?.5:1,cursor:t?"not-allowed":"pointer",transition:$e,border:"none",padding:0}),Yo=e=>({position:"absolute",top:2,left:e?20:2,width:18,height:18,borderRadius:"50%",background:e?"var(--dsw-alias-label-primary-foreground)":"var(--dsw-alias-button-elevated-fill)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.25)",transition:$e});function je({checked:e,disabled:t=!1,onChange:n,ariaLabel:o,ariaDescribedBy:r,id:c}){return(0,cn.jsx)("button",{id:c,type:"button",role:"switch","aria-checked":e,"aria-label":o,"aria-describedby":r,disabled:t,style:jo(e,t),onClick:()=>{t||n(!e)},children:(0,cn.jsx)("span",{"aria-hidden":"true",style:Yo(e)})})}var f=require("react/jsx-runtime");function Ri({t:e,capabilities:t,capabilitiesError:n,capabilitiesBusy:o,imagine:r,imagineError:c,codexSignedIn:d,onRetry:p,onOpenAccounts:l,onFocusDependency:C,onPatchCapability:h}){let I=Qt.filter(g=>!g.key.startsWith("grokImagine")),R=Qt.filter(g=>g.key.startsWith("grokImagine"));return(0,f.jsxs)("section",{style:oe,"aria-labelledby":"coding-oauth-capabilities-title",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{id:"coding-oauth-capabilities-title",style:{...$,fontSize:16},children:e("capabilitiesTitle")}),(0,f.jsx)("p",{style:{...S,marginTop:4},children:e("capabilitiesIntro")})]}),c===void 0?null:(0,f.jsxs)("div",{style:ae,role:"alert",children:[(0,f.jsx)("p",{style:Pe,children:c}),(0,f.jsx)("button",{type:"button",style:P,onClick:p,children:e("retry")})]}),r===void 0&&c===void 0?(0,f.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,f.jsxs)("div",{style:Ue,children:[(0,f.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("imagineLoading")]})}):r===void 0?null:(0,f.jsxs)("div",{id:"coding-oauth-imagine-credential",style:ae,tabIndex:-1,children:[(0,f.jsx)(Ee,{label:r.configured?e("imagineConfigured"):e("imagineNotConfigured"),tone:r.configured?"success":"neutral"}),(0,f.jsx)("p",{style:b,children:e("imagineSource",{source:ki(r.source,e)})})]}),n===void 0?null:(0,f.jsxs)("div",{style:ae,role:"alert",children:[(0,f.jsx)("p",{style:Pe,children:n}),(0,f.jsx)("button",{type:"button",style:P,onClick:p,children:e("retry")})]}),t===void 0&&n===void 0?(0,f.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,f.jsxs)("div",{style:Ue,children:[(0,f.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("capabilitiesLoading")]})}):t===void 0?null:(0,f.jsxs)("fieldset",{style:{border:0,margin:0,padding:0,minWidth:0},children:[(0,f.jsx)("legend",{style:{...S,position:"absolute",width:1,height:1,overflow:"hidden"},children:e("capabilitiesTitle")}),t.writable?null:(0,f.jsx)("p",{style:b,children:e("capabilitiesReadOnly")}),(0,f.jsx)("ul",{style:xe,children:I.map(g=>{let T=t.value[g.key],G=g.requiresImages===!0&&!t.value.codexImages,k=d?G?e("requiresCodexImages"):void 0:e("requiresCodexSignIn"),v=o||!t.writable||k!==void 0,_=`cap-switch-${g.key}`,M=d?G?{label:e("focusCodexImages"),action:()=>C("codexImages")}:void 0:{label:e("openCodexAccount"),action:()=>l("codex")};return(0,f.jsx)("li",{style:{opacity:k===void 0?1:.65,transition:"opacity 0.15s ease"},children:(0,f.jsxs)("div",{style:{...ve,alignItems:"flex-start"},children:[(0,f.jsxs)("label",{htmlFor:_,style:{flex:"1 1 360px",cursor:v?"default":"pointer"},children:[(0,f.jsx)("span",{style:{display:"block",fontSize:14,color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`cap-hint-${g.key}`,style:{display:"block",...b},children:k??e(g.hint)})]}),M===void 0?null:(0,f.jsx)("button",{type:"button",style:P,onClick:M.action,children:M.label}),(0,f.jsx)(je,{id:_,checked:T,disabled:v,ariaLabel:e(g.label),ariaDescribedBy:`cap-hint-${g.key}`,onChange:V=>{h(g.key,V)}})]})},g.key)})}),(0,f.jsx)("h4",{style:{...$,fontSize:14},children:e("imagineTitle")}),(0,f.jsx)("ul",{style:xe,children:R.map(g=>{let T=t.value[g.key],G=r?.configured===!0?void 0:e("requiresImagineCredential"),k=o||!t.writable||G!==void 0,v=`cap-switch-${g.key}`;return(0,f.jsx)("li",{children:(0,f.jsxs)("div",{style:{...ve,alignItems:"flex-start"},children:[(0,f.jsxs)("label",{htmlFor:v,style:{flex:"1 1 360px",cursor:k?"default":"pointer"},children:[(0,f.jsx)("span",{style:{display:"block",fontSize:14,color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`cap-hint-${g.key}`,style:{display:"block",...b},children:G??e(g.hint)})]}),G===void 0?null:(0,f.jsx)("button",{type:"button",style:P,onClick:()=>C("imagineCredential"),children:e("focusImagineCredential")}),(0,f.jsx)(je,{id:v,checked:T,disabled:k,ariaLabel:e(g.label),ariaDescribedBy:`cap-hint-${g.key}`,onChange:_=>{h(g.key,_)}})]})},g.key)})}),(0,f.jsxs)("div",{style:ae,children:[(0,f.jsx)("h4",{style:{...$,fontSize:14},children:e("capabilityLimitsTitle")}),(0,f.jsx)("p",{style:b,children:e("capabilityLimitsHint")}),(0,f.jsx)("ul",{style:xe,children:jn.map(g=>{let T=t.value[g.key]/g.scale,G=`cap-limit-${g.key}`;return(0,f.jsxs)("li",{style:ve,children:[(0,f.jsxs)("label",{htmlFor:G,style:{...S,flex:"1 1 360px"},children:[(0,f.jsx)("span",{style:{display:"block",color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`${G}-hint`,style:{display:"block",...b},children:e(g.hint)})]}),(0,f.jsx)("input",{id:G,type:"number",inputMode:"numeric",min:g.min,max:g.max,step:1,defaultValue:T,disabled:o||!t.writable,"aria-describedby":`${G}-hint`,style:{...De,width:112,flex:"0 0 112px"},onInput:k=>{k.currentTarget.setCustomValidity("")},onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(k.currentTarget.value=String(T),k.currentTarget.setCustomValidity(""))},onBlur:k=>{let v=k.currentTarget,_=Number(v.value);if(!Number.isInteger(_)||_<g.min||_>g.max){v.setCustomValidity(e("capabilityLimitInvalid",{min:g.min,max:g.max})),v.reportValidity();return}v.setCustomValidity("");let M=_*g.scale;M!==t.value[g.key]&&Promise.resolve(h(g.key,M)).then(V=>{V===!1&&v.isConnected&&(v.value=String(T))})}},`${g.key}-${String(t.revision)}-${String(T)}`)]},g.key)})})]})]})]})}var Q=require("react");function Li(e,t,n,o="<gateway-model>"){let r=n.length>0?n:"<your-gateway-key>";return{curl:`curl ${e}/chat/completions \\
|
|
2
|
+
var Rt=Object.defineProperty;var xo=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var ko=Object.prototype.hasOwnProperty;var Io=(e,t)=>{for(var n in t)Rt(e,n,{get:t[n],enumerable:!0})},To=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ao(t))!ko.call(e,r)&&r!==n&&Rt(e,r,{get:()=>t[r],enumerable:!(o=xo(t,r))||o.enumerable});return e};var Po=e=>To(Rt({},"__esModule",{value:!0}),e);var oa={};Io(oa,{apply:()=>ia,inject:()=>ea,name:()=>Zo});module.exports=Po(oa);var Re=require("react"),Fi=require("react-dom/client");function wn(e){if(typeof e!="object"||e===null)return;let t;try{let n=e.get;typeof n=="function"&&(t=n.call(e,"slots"))}catch{}if(t===void 0)try{t=e.slots}catch{}if(typeof t=="object"&&t!==null&&typeof t.inject=="function"&&typeof t.register=="function")return t}function vn(e){let t=e,n=t.locale,o=wn(e),c=[["client.effect",t.effect,"error"],["client.locale.register",n?.register,"error"],["client.locale.bind",n?.bind,"error"],["client.slots.inject",o?.inject,"warning"]].flatMap(([p,l,C])=>typeof l=="function"?[]:[{id:p,level:C,message:C==="warning"?`${p} is unavailable; the independent settings entry remains active`:`${p} is unavailable in the DSH client runtime`,expected:"function",actual:typeof l}]),d=Object.freeze([...c]);return Object.freeze({context:e,locale:e.locale,effect:e.effect,diagnostics:()=>d,assertCompatible(){let p=c.filter(l=>l.level==="error");if(p.length>0)throw new Error(`incompatible DSH client API: ${p.map(l=>l.id).join(", ")}`)},installSlots(p){let l=!1,C=!1,h=()=>{},I=R=>{let g=wn(R);return l||C||g===void 0?!1:(C=!0,h(),h=p.register(g),!0)};if(!I(e)){h=p.mountFallback();let R=t.inject;typeof R=="function"&&R.call(e,["slots"],g=>{I(g)})}e.effect(()=>()=>{l=!0,h()},"dsh-coding-subscription-oauth: independent settings entry")}})}var y=require("react");var Eo="/plugins/dsh-grok-build/auth/status",_o="/plugins/dsh-grok-build/auth/login",Oo="/plugins/dsh-grok-build/auth/login/code",Ro="/plugins/dsh-grok-build/auth/login/cancel",Lo="/plugins/dsh-grok-build/auth/import",Go="/plugins/dsh-grok-build/auth/logout",Ho="/plugins/dsh-grok-build/auth/models",Lt="/plugins/dsh-grok-build/oauth/status",Gt="/plugins/dsh-grok-build/oauth/login",Ht="/plugins/dsh-grok-build/oauth/code",Ut="/plugins/dsh-grok-build/oauth/cancel",Dt="/plugins/dsh-grok-build/oauth/logout",Mt="/plugins/dsh-grok-build/oauth/models",Kt="/plugins/dsh-grok-build/oauth/sources",Nt="/plugins/dsh-grok-build/oauth/sources/preview",Bt="/plugins/dsh-grok-build/oauth/sources/commit",Ft="/plugins/dsh-grok-build/oauth/sources/cancel",Wt="/plugins/dsh-grok-build/capabilities",Vt="/plugins/dsh-grok-build/codex/usage",$t="/plugins/dsh-grok-build/imagine/credential-status",qt="/plugins/dsh-grok-build/gateway",zt="/plugins/dsh-grok-build/gateway/reveal",jt="/plugins/dsh-grok-build/gateway/rotate",sa=Object.freeze([Eo,_o,Oo,Ro,Lo,Go,Ho,Lt,Gt,Ht,Ut,Dt,Mt,Kt,Nt,Bt,Ft,Wt,Vt,$t,qt,zt,jt]);var xn=Lt,An=Gt,kn=Ht,In=Ut,Tn=Dt,Pn=Mt,En="/plugins/dsh-grok-build/oauth/accounts/set-active",_n="/plugins/dsh-grok-build/oauth/accounts/remove",On=Kt,Rn=Nt,Ln=Bt,rt=Ft,Yt=Wt,Gn=Vt,Hn=$t,Je=qt,Un=zt,Dn=jt,Mn=1e3,We=3600*1e3,Xt=["grok","codex","kimi","claude"],Kn=["missing","unsafe","invalid","too_large"],Nn=["none","same_credential","same_account","different_account","unknown_account","unreadable_destination","unsafe_destination"],Bn=["import","reuse","overwrite","blocked"],Fn=["imported","unchanged","overwritten"],Jt={grok:"~/.grok/auth.json",codex:"~/.codex/auth.json",kimi:"~/.kimi/credentials/kimi-code.json",claude:"~/.claude/.credentials.json"},Wn={grok:"sourceKindGrok",codex:"sourceKindCodex",kimi:"sourceKindKimi",claude:"sourceKindClaude"},Vn={missing:"sourceReasonMissing",unsafe:"sourceReasonUnsafe",invalid:"sourceReasonInvalid",too_large:"sourceReasonTooLarge"},$n={none:"sourceConflictNone",same_credential:"sourceConflictSameCredential",same_account:"sourceConflictSameAccount",different_account:"sourceConflictDifferentAccount",unknown_account:"sourceConflictUnknownAccount",unreadable_destination:"sourceConflictUnreadableDestination",unsafe_destination:"sourceConflictUnsafeDestination"},qn={import:"sourceActionImport",reuse:"sourceActionReuse",overwrite:"sourceActionOverwrite",blocked:"sourceActionBlocked"},zn={imported:"sourceCommitImported",unchanged:"sourceCommitUnchanged",overwritten:"sourceCommitOverwritten"},Qt=[{key:"codexSearch",label:"capCodexSearch",hint:"capCodexSearchHint"},{key:"codexImages",label:"capCodexImages",hint:"capCodexImagesHint"},{key:"codexImageEdits",label:"capCodexImageEdits",hint:"capCodexImageEditsHint",requiresImages:!0},{key:"codexImagesAnyModel",label:"capCodexImagesAnyModel",hint:"capCodexImagesAnyModelHint",requiresImages:!0},{key:"codexUsage",label:"capCodexUsage",hint:"capCodexUsageHint"},{key:"codexFast",label:"capCodexFast",hint:"capCodexFastHint"},{key:"grokImagineImage",label:"capGrokImagineImage",hint:"capGrokImagineImageHint"},{key:"grokImagineVideo",label:"capGrokImagineVideo",hint:"capGrokImagineVideoHint"}],jn=[{key:"searchResults",label:"capSearchResults",hint:"capSearchResultsHint",min:1,max:20,scale:1},{key:"imageCount",label:"capImageCount",hint:"capImageCountHint",min:1,max:4,scale:1},{key:"videoArtifactTtlMs",label:"capVideoTtlHours",hint:"capVideoTtlHoursHint",min:1,max:168,scale:We}],Zt={none:"imagineSourceNone",env:"imagineSourceEnv",environment:"imagineSourceEnv","xai-api-key":"imagineSourceEnv",xai_api_key:"imagineSourceEnv","api-key":"imagineSourceApiKey",api_key:"imagineSourceApiKey",apikey:"imagineSourceApiKey",key:"imagineSourceApiKey",settings:"imagineSourceApiKey",oauth:"imagineSourceOAuth","oauth-access":"imagineSourceOAuth","grok-cli-key":"imagineSourceCliKey","cli-key":"imagineSourceCliKey"},Yn=[{slug:"grok",route:"grok-build",titleKey:"grokTitle",descriptionKey:"grokDescription",methods:["pkce","device"],recommended:"pkce",remoteRecommended:"device"},{slug:"codex",route:"codex-oauth",titleKey:"codexTitle",descriptionKey:"codexDescription",methods:["device","browser"],recommended:"device",remoteRecommended:"device"},{slug:"kimi",route:"kimi-code-oauth",titleKey:"kimiTitle",descriptionKey:"kimiDescription",methods:["device"],recommended:"device",remoteRecommended:"device"},{slug:"claude",route:"claude-code-oauth",titleKey:"claudeTitle",descriptionKey:"claudeDescription",methods:["browser"],recommended:"browser",remoteRecommended:"browser"}],Te=[{id:"accounts",label:"tabAccounts"},{id:"gateway",label:"tabGateway"},{id:"capabilities",label:"tabCapabilities"},{id:"about",label:"tabAbout"}],st=1024,dt=65535,Ve=18100,Xn=18999,Jn=new Set([22,53,3080,7890,9090,18080]),Qn=new Set(["preview_invalid","preview_expired","source_changed","destination_changed","confirm_required","unsafe_destination"]),Zn="0.8.1";function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ei(e){return e instanceof Error&&e.name==="PluginRequestError"&&"status"in e}function ti(e){return ei(e)?e.status===409||e.code==="SETTINGS_CONFLICT"||/conflict/iu.test(e.message):e instanceof Error&&/SETTINGS_CONFLICT|settings-conflict|changed since it was read/iu.test(e.message)}function ni(e){return ei(e)?e.code!==void 0&&Qn.has(e.code)?!0:e.status===404||e.status===410:!1}function lt(e,t=!1){fetch(rt,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({previewId:e}),...t?{keepalive:!0}:{}}).catch(()=>{})}async function U(e,t="GET",n){let o=await fetch(e,{method:t,headers:{accept:"application/json",...n===void 0?{}:{"content-type":"application/json"}},credentials:"same-origin",...n===void 0?{}:{body:JSON.stringify(n)}}),r=await o.json().catch(()=>{});if(!o.ok){let c=L(r)?r:void 0,d=c!==void 0&&typeof c.error=="string"?c.error:c!==void 0&&typeof c.message=="string"?c.message:`HTTP ${o.status}`,p=c!==void 0&&typeof c.code=="string"?c.code:void 0,l=new Error(d);throw l.name="PluginRequestError",l.status=o.status,p!==void 0&&(l.code=p),l}return r}async function ct(e){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function Uo(e,t){return t&&e.remoteRecommended!==void 0&&e.methods.includes(e.remoteRecommended)?e.remoteRecommended:e.recommended}function ii(e,t){let n=Uo(e,t),o=e.methods.filter(r=>r!==n);return e.methods.includes(n)?[n,...o]:[...e.methods]}function oi(e){return e===void 0||e.available||e.reason===void 0?!1:e.reason!=="missing"}function ai(e){return e===void 0||e.length===0?!1:e.every(t=>!t.available&&(t.reason===void 0||t.reason==="missing"))}function ri(e){return e?.some(t=>t.available)===!0}function ut(e,t,n){return e==="device"?n?.remote===!0&&n.primary===!0?t("deviceLoginRemote"):t("deviceLogin"):t(e==="browser"?"browserLogin":"pkceLogin")}function si(){typeof window<"u"&&window.dispatchEvent(new CustomEvent("usage-stats:open-settings",{detail:{tab:"accounts"}}))}var $e="all 0.15s ease",en={display:"flex",flexDirection:"column",gap:16,width:"100%",maxWidth:780,minWidth:0},$={margin:0,fontSize:20,lineHeight:"28px",fontWeight:600,color:"var(--dsw-alias-label-primary)"},S={margin:0,fontSize:14,lineHeight:"22px",color:"var(--dsw-alias-label-secondary)"},oe={display:"flex",flexDirection:"column",gap:14,padding:"18px 20px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:12,background:"var(--dsw-alias-bg-module-platform)",transition:$e},ve={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},Ue={display:"flex",alignItems:"center",gap:9,fontSize:14,fontWeight:500,color:"var(--dsw-alias-label-primary)"},P={boxSizing:"border-box",minHeight:34,padding:"6px 14px",border:"1px solid var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.4))",borderRadius:18,background:"var(--dsw-alias-button-elevated-fill, var(--dsw-alias-bg-layer-1))",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.18)",font:"inherit",fontSize:14,fontWeight:500,cursor:"pointer",transition:$e},Y={...P,border:"none",background:"var(--dsw-alias-button-primary-fill)",color:"var(--dsw-alias-label-primary-foreground)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.28)",fontWeight:600},le={...P,minHeight:28,padding:"4px 10px",fontSize:13,borderRadius:8},Pe={...S,color:"var(--dsw-alias-state-error-primary)"},ma={...S,color:"var(--dsw-alias-state-success-primary, #22a06b)"},pt={...S,padding:"10px 12px",borderRadius:8,border:"1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e06c00) 35%, transparent)",background:"color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e06c00) 10%, transparent)",color:"var(--dsw-alias-label-primary)"},Do={...S,padding:"10px 12px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)"},di={...Do,animation:"dsh-coding-oauth-fade-in 0.2s ease"},li={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:20,letterSpacing:"0.08em",fontWeight:600,color:"var(--dsw-alias-label-primary)"},J={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},ci={...J,display:"block",fontSize:12,lineHeight:"18px",padding:"10px 12px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",overflowWrap:"anywhere",whiteSpace:"pre-wrap"},ui={color:"var(--dsw-alias-brand-primary)",wordBreak:"break-all"},xe={display:"flex",flexDirection:"column",gap:8,margin:0,padding:0,listStyle:"none"},gt={display:"flex",alignItems:"flex-start",gap:8,fontSize:14,color:"var(--dsw-alias-label-primary)"},De={boxSizing:"border-box",width:"100%",minHeight:34,padding:"6px 12px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",font:"inherit",fontSize:13,transition:$e},ae={display:"flex",flexDirection:"column",gap:8,padding:"12px 14px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},b={...S,fontSize:13},yt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},ft={display:"inline-flex",flexWrap:"wrap",gap:2,padding:3,borderRadius:10,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)"},Qe={...P,border:"none",borderRadius:8,boxShadow:"none",background:"transparent",minHeight:32,padding:"5px 12px",fontSize:13},mt={...Qe,background:"var(--dsw-alias-bg-module-platform)",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.12)",fontWeight:600},pi={display:"flex",flexDirection:"column",gap:14,minWidth:0},gi={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(320px, 100%), 1fr))",gap:14},bt={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:8},Me={...oe,minHeight:88,background:"linear-gradient(90deg, var(--dsw-alias-bg-layer-1) 0%, var(--dsw-alias-bg-module-platform) 50%, var(--dsw-alias-bg-layer-1) 100%)",backgroundSize:"200% 100%",animation:"dsh-coding-oauth-skeleton-pulse 1.4s ease-in-out infinite"},tn={display:"flex",alignItems:"flex-start",gap:10,fontSize:14,color:"var(--dsw-alias-label-secondary)"},ht={...tn,color:"var(--dsw-alias-label-primary)",fontWeight:500},nn={display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:"50%",flex:"0 0 auto",fontSize:12,fontWeight:600,background:"var(--dsw-alias-bg-layer-1)",border:"1px solid var(--dsw-alias-border-l2)",color:"var(--dsw-alias-label-secondary)"},Ct={...nn,background:"var(--dsw-alias-button-primary-fill)",borderColor:"var(--dsw-alias-button-primary-fill)",color:"var(--dsw-alias-label-primary-foreground)"};function Mo(e){switch(e){case"success":return"var(--dsw-alias-state-success-primary, #22a06b)";case"error":return"var(--dsw-alias-state-error-primary, #d92d20)";case"warning":return"var(--dsw-alias-state-warn-primary, #e06c00)";case"info":return"var(--dsw-alias-brand-primary, #1677ff)";default:return"var(--dsw-alias-label-tertiary, #81858c)"}}function yi(e){let t=Mo(e);return{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 10px",borderRadius:999,fontSize:12,fontWeight:600,lineHeight:"18px",color:t,background:`color-mix(in srgb, ${t} 14%, transparent)`,border:`1px solid color-mix(in srgb, ${t} 28%, transparent)`,whiteSpace:"nowrap"}}function Ae(e,t=!0){return{width:9,height:9,borderRadius:"50%",flex:"0 0 auto",background:t?e==="signed-in"||e==="available"?"var(--dsw-alias-state-success-primary, #22a06b)":e==="error"?"var(--dsw-alias-state-error-primary, #d92d20)":e==="signing-in"||e==="loading"?"var(--dsw-alias-brand-primary, #1677ff)":"var(--dsw-alias-label-tertiary, #81858c)":"var(--dsw-alias-label-tertiary, #81858c)"}}function fi(e,t=!0){return t?e==="signed-in"?"success":e==="error"?"error":e==="signing-in"?"info":"neutral":"neutral"}var Ce=require("react/jsx-runtime"),Ko="https://github.com/lninghaha/dsh-coding-subscription-oauth#readme";function mi({t:e}){return(0,Ce.jsxs)("section",{style:oe,"aria-labelledby":"coding-oauth-about-title",children:[(0,Ce.jsx)("h3",{id:"coding-oauth-about-title",style:{...$,fontSize:16},children:e("aboutTitle")}),(0,Ce.jsx)("p",{style:{...pt,marginTop:12},children:e("termsWarning")}),(0,Ce.jsx)("p",{style:{...S,marginTop:12},children:e("remoteLoginHelp")}),(0,Ce.jsx)("p",{style:{...b,marginTop:12},children:e("pluginVersion",{version:Zn})}),(0,Ce.jsx)("p",{style:{...b,marginTop:8},children:e("aboutDocsHint")}),(0,Ce.jsx)("p",{style:{marginTop:8},children:(0,Ce.jsx)("a",{href:Ko,target:"_blank",rel:"noreferrer",style:ui,children:e("aboutDocsLink")})})]})}var ze=require("react");var Ze=require("react/jsx-runtime");function Ee({label:e,tone:t,providerStatus:n,installed:o=!0,showDot:r=!0}){let c=t??(n!==void 0?fi(n,o):"neutral");return(0,Ze.jsxs)("span",{style:yi(c),role:"status",children:[r?(0,Ze.jsx)("span",{"aria-hidden":"true",style:{...Ae(n??(c==="success"?"signed-in":"signed-out"),o),width:7,height:7}}):null,(0,Ze.jsx)("span",{children:e})]})}function D(e){return typeof e=="string"&&e.length>0&&e.length<500?e:void 0}function ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function vt(e){return typeof e=="boolean"?e:void 0}function an(e){let t=ce(e);return t!==void 0&&t>=0&&t<=100?t:void 0}function bi(e){return Xt.includes(e)}function No(e){return Kn.includes(e)}function Bo(e){return Nn.includes(e)}function Fo(e){return Bn.includes(e)}function Wo(e){return Fn.includes(e)}function xt(e){return/eyJ[A-Za-z0-9_-]+\.|sk-[A-Za-z0-9_-]{8,}|Bearer\s+\S+/u.test(e)}function hi(e,t){let n=D(e);return n===void 0||xt(n)||n.length>180?Jt[t]:n}function Vo(e){let t=D(e);if(!(t===void 0||xt(t)))return t}function qe(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=e>1e12?e:e>1e9?e*1e3:void 0;if(t===void 0)return;let n=new Date(t).toLocaleString();return n.length>0?n:void 0}function $o(e){if(!L(e)||typeof e.kind!="string"||!bi(e.kind))return;let t=e.kind,n=D(e.reason),o=ce(e.expiresAt);return{kind:t,displayPath:hi(e.displayPath,t),available:e.available===!0,...o===void 0?{}:{expiresAt:o},...n!==void 0&&No(n)?{reason:n}:{}}}function rn(e){return Xt.map(t=>e.find(o=>o.kind===t)??{kind:t,displayPath:Jt[t],available:!1,reason:"missing"})}function Ci(e){let t=Array.isArray(e)?e:L(e)&&Array.isArray(e.sources)?e.sources:[];return rn(t.map($o).filter(n=>n!==void 0))}function Si(e){if(!L(e))return;let t=D(e.previewId),n=D(e.kind);if(t===void 0||n===void 0||!bi(n))return;let o=D(e.conflict),r=D(e.action),c=ce(e.expiresAt),d=ce(e.ticketExpiresAt),p=Array.isArray(e.warnings)?e.warnings.map(Vo).filter(l=>l!==void 0):[];return{previewId:t,kind:n,displayPath:hi(e.displayPath,n),confirmOverwriteRequired:e.confirmOverwriteRequired===!0,warnings:p,...c===void 0?{}:{expiresAt:c},...d===void 0?{}:{ticketExpiresAt:d},...o!==void 0&&Bo(o)?{conflict:o}:{},...r!==void 0&&Fo(r)?{action:r}:{}}}function wi(e){if(!L(e))return;let t=D(e.action);return t!==void 0&&Wo(t)?t:void 0}function on(e,t,n,o){let r=ce(e);return r!==void 0&&Number.isInteger(r)&&r>=t&&r<=n?r:o}function sn(){return{codexSearch:!1,codexImages:!1,codexImageEdits:!1,codexImagesAnyModel:!1,codexUsage:!1,codexFast:!1,grokImagineImage:!1,grokImagineVideo:!1,searchResults:5,imageCount:1,videoArtifactTtlMs:168*We}}function qo(e){let t=L(e)?e:{};return{codexSearch:t.codexSearch===!0,codexImages:t.codexImages===!0,codexImageEdits:t.codexImageEdits===!0,codexImagesAnyModel:t.codexImagesAnyModel===!0,codexUsage:t.codexUsage===!0,codexFast:t.codexFast===!0,grokImagineImage:t.grokImagineImage===!0,grokImagineVideo:t.grokImagineVideo===!0,searchResults:on(t.searchResults,1,20,5),imageCount:on(t.imageCount,1,4,1),videoArtifactTtlMs:on(t.videoArtifactTtlMs,We,168*We,168*We)}}function dn(e){if(!L(e))return;let t=L(e.value)?e.value:e,n=ce(e.revision);if(!(n===void 0&&!L(e.value)&&e.writable===void 0))return{value:qo(t),revision:n??0,writable:e.writable===!0}}function St(e){if(!L(e))return;let t=an(e.usedPercent??e.used_percent),n=an(e.remainingPercent??e.remaining_percent),o=ce(e.windowSeconds??e.limit_window_seconds),r=ce(e.resetsAt??e.reset_at);if(!(t===void 0&&n===void 0&&o===void 0&&r===void 0))return{...t===void 0?{}:{usedPercent:t},...n===void 0?{}:{remainingPercent:n},...o!==void 0&&o>0?{windowSeconds:o}:{},...r===void 0?{}:{resetsAt:r}}}function wt(e,t){if(!L(e))return;let n=D(e.id)??D(e.metered_feature)??t,o=D(e.name)??D(e.limit_name),r=L(e.rate_limit)?e.rate_limit:e,c=Array.isArray(e.windows)?e.windows.map(St).filter(d=>d!==void 0):[St(r.primary_window),St(r.secondary_window),St(r)].filter(d=>d!==void 0);if(!(c.length===0&&o===void 0&&D(e.id)===void 0))return{id:n,windows:c,...o===void 0?{}:{name:o}}}function vi(e){if(!L(e))return;let t=L(e.usage)?e.usage:e,n=[],o=new Set,r=v=>{v===void 0||o.has(v.id)||(o.add(v.id),n.push(v))};Array.isArray(t.rateLimits)?t.rateLimits.forEach((v,_)=>r(wt(v,`limit-${String(_)}`))):(r(wt(t.rate_limit,"codex")),Array.isArray(t.additional_rate_limits)&&t.additional_rate_limits.forEach((v,_)=>r(wt(v,`extra-${String(_)}`))),r(wt(t.code_review_rate_limit,"code_review")));let c=L(t.credits)?t.credits:void 0,d=L(t.individualLimit)?t.individualLimit:L(t.spend_control)?L(t.spend_control.individual_limit)?t.spend_control.individual_limit:t.spend_control:void 0,p=L(t.resetCredits)?t.resetCredits.availableCount:L(t.rate_limit_reset_credits)?t.rate_limit_reset_credits.available_count:void 0,l=ce(p),C=ce(t.fetchedAt),h=vt(t.spendControlReached)??(L(t.spend_control)?vt(t.spend_control.reached):void 0),I=c===void 0?void 0:D(c.balance),R=d===void 0?void 0:D(d.limit),g=d===void 0?void 0:D(d.used),T=d===void 0?void 0:D(d.remaining),G=d===void 0?void 0:an(d.remainingPercent??d.remaining_percent),k=d===void 0?void 0:ce(d.resetsAt??d.reset_at);return{rateLimits:n,...c!==void 0&&typeof c.unlimited=="boolean"?{creditsUnlimited:c.unlimited}:{},...I===void 0?{}:{creditsBalance:I},...R===void 0?{}:{individualLimit:R},...g===void 0?{}:{individualUsed:g},...T===void 0?{}:{individualRemaining:T},...G===void 0?{}:{individualRemainingPercent:G},...k===void 0?{}:{individualResetsAt:k},...h===void 0?{}:{spendControlReached:h},...l!==void 0&&l>=0&&Number.isSafeInteger(l)?{resetCredits:l}:{},...C===void 0?{}:{fetchedAt:C}}}function xi(e){return e.rateLimits.some(t=>t.windows.length>0||t.name!==void 0)||e.creditsUnlimited!==void 0||e.creditsBalance!==void 0||e.individualLimit!==void 0||e.individualUsed!==void 0||e.individualRemaining!==void 0||e.individualRemainingPercent!==void 0||e.spendControlReached===!0||e.resetCredits!==void 0}function et(e){if(!L(e))return;let t=D(e.bind),n=ce(e.port);if(t===void 0||n===void 0)return;let o=Array.isArray(e.models)?e.models.filter(d=>typeof d=="string"&&d.length>0):[],r=D(e.model)??o[0]??null;o.length===0&&r!==null&&o.push(r);let c=e.keyAvailable===!0||e.keyConfigured===!0;return{enabled:e.enabled===!0,running:e.running===!0,bind:t,port:n,model:r,keyConfigured:c,keyAvailable:c,keyHint:D(e.keyHint)??"",models:o,warning:D(e.warning)??"",opencodeGoEnabled:e.opencodeGoEnabled===!0}}function tt(e,t){return`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${String(t)}`}function Ai(e){for(let t=0;t<32;t+=1){let n=Xn-Ve+1,o=Ve+Math.floor(Math.random()*n);if(o!==e&&!Jn.has(o))return o}return e===Ve?Ve+1:Ve}function At(e){let t=Number(e);if(!(!Number.isInteger(t)||t<st||t>dt))return t}function ki(e){if(!L(e))return;let t=vt(e.configured);if(t===void 0&&e.source===void 0&&e.writable===void 0)return;let n=D(e.source),o=vt(e.writable);return{configured:t===!0,...n===void 0||xt(n)?{}:{source:n},...o===void 0?{}:{writable:o}}}function Ii(e,t){if(e===void 0)return t("imagineSourceUnknown");let n=Zt[e]??Zt[e.toLowerCase()];return n!==void 0?t(n):e.length<=40&&/^[a-z0-9._-]+$/iu.test(e)&&!xt(e)?e:t("imagineSourceUnknown")}function Ti(e){return e.status!=="signed-in"?{available:[],selected:[]}:{available:"available"in e?e.available:[],selected:"selected"in e?e.selected:[]}}var B=require("react/jsx-runtime");function Pi({t:e,preview:t,confirmOverwrite:n,sourcesBusy:o,onConfirmOverwriteChange:r,onCommit:c,onCancel:d}){let p=qe(t.expiresAt),l=qe(t.ticketExpiresAt);return(0,B.jsxs)("section",{id:`coding-oauth-source-preview-${t.kind}`,style:oe,"aria-labelledby":`coding-oauth-source-preview-title-${t.kind}`,"aria-live":"polite",tabIndex:-1,children:[(0,B.jsxs)("p",{id:`coding-oauth-source-preview-title-${t.kind}`,style:S,children:[e("sourcesPreviewTitle")," \xB7 ",e(Wn[t.kind])]}),(0,B.jsx)("p",{style:b,children:(0,B.jsx)("span",{style:J,children:t.displayPath})}),(0,B.jsx)("p",{style:S,children:e("sourcesConflict",{detail:e(t.conflict===void 0?"sourceConflictUnrecognized":$n[t.conflict])})}),(0,B.jsx)("p",{style:S,children:e("sourcesAction",{detail:e(t.action===void 0?"sourceActionUnrecognized":qn[t.action])})}),p===void 0?null:(0,B.jsx)("p",{style:b,children:e("sourcesPreviewExpires",{time:p})}),l===void 0?null:(0,B.jsx)("p",{style:b,children:e("sourcesTicketExpires",{time:l})}),t.warnings.length===0?null:(0,B.jsx)("ul",{style:{...xe,gap:4},"aria-label":e("sourcesWarnings"),children:t.warnings.map(C=>(0,B.jsx)("li",{style:b,children:C},C))}),t.confirmOverwriteRequired?(0,B.jsxs)("label",{style:gt,children:[(0,B.jsx)("input",{"aria-describedby":`coding-oauth-source-overwrite-hint-${t.kind}`,type:"checkbox",checked:n,disabled:o||t.action==="blocked",onChange:C=>{r(C.target.checked)}}),(0,B.jsxs)("span",{children:[e("sourcesConfirmOverwrite"),(0,B.jsx)("span",{id:`coding-oauth-source-overwrite-hint-${t.kind}`,style:{display:"block",...b},children:e("sourcesConfirmOverwriteHint")})]})]}):null,(0,B.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,B.jsx)("button",{type:"button",style:Y,disabled:o||t.action==="blocked"||t.confirmOverwriteRequired&&!n,onClick:c,children:e("sourcesCommit")}),(0,B.jsx)("button",{type:"button",style:P,disabled:o,onClick:d,children:e("sourcesCancelPreview")})]})]})}var Ei=require("react");var nt=require("react/jsx-runtime");function kt({message:e,dismissLabel:t,onDismiss:n,autoHideMs:o,tone:r="info"}){return(0,Ei.useEffect)(()=>{if(o===void 0||n===void 0)return;let d=window.setTimeout(n,o);return()=>{window.clearTimeout(d)}},[o,n]),(0,nt.jsxs)("div",{style:{...di,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,borderLeft:`3px solid ${r==="success"?"var(--dsw-alias-state-success-primary, #22a06b)":"var(--dsw-alias-brand-primary, #1677ff)"}`},role:"status",children:[(0,nt.jsx)("p",{style:{...S,margin:0,color:"var(--dsw-alias-label-primary)"},children:e}),n===void 0||t===void 0?null:(0,nt.jsx)("button",{type:"button",style:P,onClick:n,children:t})]})}var q=require("react");var _e=require("react");var _i=require("react/jsx-runtime");function Ke({text:e,idleLabel:t,copiedLabel:n,failedLabel:o,primary:r=!1,disabled:c=!1}){let[d,p]=(0,_e.useState)("idle"),l=(0,_e.useRef)(void 0);(0,_e.useEffect)(()=>()=>{l.current!==void 0&&window.clearTimeout(l.current)},[]);let C=(0,_e.useCallback)(async()=>{let I=await ct(e);p(I?"copied":"failed"),l.current!==void 0&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{p("idle"),l.current=void 0},2e3)},[e]),h=d==="copied"?n:d==="failed"?o:t;return(0,_i.jsx)("button",{type:"button",style:r?Y:le,disabled:c||e.length===0,onClick:()=>{C()},children:h})}var Oe=require("react/jsx-runtime");function zo(e){return e>=90?"var(--dsw-alias-state-error-primary, #d92d20)":e>=75?"var(--dsw-alias-state-warn-primary, #e06c00)":"var(--dsw-alias-button-info-fill, var(--dsw-static-deepseek-500, #4f6ef7))"}function ln({value:e,label:t,meta:n}){let o=Math.max(0,Math.min(100,e));return(0,Oe.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t===void 0?null:(0,Oe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,flexWrap:"wrap"},children:[(0,Oe.jsx)("span",{style:{...b,color:"var(--dsw-alias-label-primary)"},children:t}),n===void 0?null:(0,Oe.jsx)("span",{style:b,children:n})]}),(0,Oe.jsx)("div",{role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,style:{height:8,borderRadius:4,background:"var(--dsw-alias-border-l2)",overflow:"hidden"},children:(0,Oe.jsx)("div",{style:{width:`${String(o)}%`,height:"100%",borderRadius:4,background:zo(o),transition:"width 0.3s ease, background 0.3s ease"}})})]})}var a=require("react/jsx-runtime");function jo({t:e,activeMethod:t,userCode:n,url:o,popupBlocked:r}){let c=n!==void 0&&n.length>0,d=o!==void 0&&o.length>0,p=t!=="device";return(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,a.jsxs)("div",{style:d?ht:tn,children:[(0,a.jsx)("span",{style:d?Ct:nn,"aria-hidden":"true",children:"1"}),(0,a.jsx)("span",{children:e("signInStepOpen")})]}),d?(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,paddingLeft:32},children:[(0,a.jsx)("a",{href:o,target:"_blank",rel:"noreferrer",style:Y,children:e("openAuthUrl")}),(0,a.jsx)(Ke,{text:o,idleLabel:e("copy"),copiedLabel:e("copied"),failedLabel:e("copyFailed")})]}):null,r&&d?(0,a.jsx)("p",{style:b,children:e("popupBlocked")}):null,c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:ht,children:[(0,a.jsx)("span",{style:Ct,"aria-hidden":"true",children:"2"}),(0,a.jsx)("span",{children:e("signInStepCode")})]}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,paddingLeft:32},children:[(0,a.jsx)("span",{style:li,children:n}),(0,a.jsx)(Ke,{text:n,idleLabel:e("copyUserCode"),copiedLabel:e("copied"),failedLabel:e("copyFailed"),primary:!0})]})]}):null,(0,a.jsxs)("div",{style:ht,children:[(0,a.jsx)("span",{style:Ct,"aria-hidden":"true",children:c?3:2}),(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,a.jsx)("span",{"aria-hidden":"true",style:{width:14,height:14,border:"2px solid var(--dsw-alias-brand-primary, #1677ff)",borderTopColor:"transparent",borderRadius:"50%",animation:"dsh-coding-oauth-spin 0.8s linear infinite"}}),e("signInStepWait")]})]}),p?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,paddingLeft:32},children:(0,a.jsx)("p",{style:S,children:e(t==="browser"?"pasteBrowserCodeHint":"pasteCodeHint")})}):null]})}function Oi({t:e,definition:t,providerStatus:n,busy:o,sourcesBusy:r,remote:c,codeInput:d,popupBlocked:p,expanded:l,source:C,showUsage:h,usage:I,usageError:R,usageLoading:g,onSignIn:T,onSignOut:G,onCancelLogin:k,onSubmitCode:v,onCodeChange:_,onToggleExpanded:M,onPreviewSource:V,onSaveModels:Z,onSetDefaultAccount:ue,onRemoveAccount:ee}){let[X,pe]=(0,q.useState)(!1),[W,me]=(0,q.useState)(""),[be,z]=(0,q.useState)(!1),ge=(0,q.useRef)(null),re=(0,q.useRef)(null),te=(0,q.useRef)(!1),he=ii(t,c),se=he[0]??t.recommended,x=he.filter(m=>m!==se),ke=n.status==="signed-in"?e("signedIn"):n.status==="signing-in"?e("signingIn"):n.status==="error"?e("requestFailed"):e("signedOut"),ye=n.status==="signing-in"?n.method:se,{available:O,selected:w}=(0,q.useMemo)(()=>Ti(n),[n]),[H,Se]=(0,q.useState)(w);(0,q.useEffect)(()=>{Se(w)},[w]),(0,q.useEffect)(()=>{n.status!=="signed-in"&&z(!1)},[n.status]),(0,q.useEffect)(()=>{if(be){re.current?.focus();return}if(te.current){if(te.current=!1,n.status==="signed-in"){ge.current?.focus();return}document.getElementById(`coding-oauth-login-${t.slug}`)?.focus()}},[t.slug,be,n.status]);let it=H.length!==w.length||H.some((m,K)=>m!==w[K]),Ie=t.slug==="grok"?n:void 0,j=oi(C),Le=(0,q.useMemo)(()=>{let m=W.trim().toLowerCase();return m.length===0?O:O.filter(K=>K.toLowerCase().includes(m))},[O,W]),Ge=t.slug==="codex"&&h?I?.individualRemainingPercent===void 0?I?.rateLimits[0]?.windows[0]?.usedPercent:100-I.individualRemainingPercent:void 0,ne=qe(I?.fetchedAt);return(0,a.jsxs)("div",{style:oe,children:[(0,a.jsxs)("div",{style:ve,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:{...$,fontSize:16},children:e(t.titleKey)}),n.status==="signed-in"&&!l?(0,a.jsxs)("p",{style:{...b,marginTop:4},children:[e("modelsSummary",{selected:w.length,total:O.length}),Ge===void 0?"":` \xB7 ${e("usageUsedShort",{value:`${String(Ge)}%`})}`]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{style:{...S,marginTop:4},children:e(t.descriptionKey)}),(0,a.jsx)("p",{style:{...S,marginTop:4},children:(0,a.jsx)("span",{style:J,children:t.route})})]})]}),(0,a.jsx)(Ee,{label:ke,providerStatus:n.status})]}),(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:n.status==="signed-in"?(0,a.jsxs)(a.Fragment,{children:[be?(0,a.jsxs)("fieldset",{style:{...ae,margin:0,minWidth:0},children:[(0,a.jsx)("legend",{style:yt,children:e("logoutConfirmTitle")}),(0,a.jsx)("p",{style:S,children:e("logoutConfirmHint")}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("button",{ref:re,type:"button",style:Y,disabled:o,onClick:()=>{te.current=!0,G()},children:e(o?"working":"logoutConfirmAction")}),(0,a.jsx)("button",{type:"button",style:P,disabled:o,onClick:()=>{te.current=!0,z(!1)},children:e("cancel")})]})]}):(0,a.jsx)("button",{ref:ge,type:"button",style:P,disabled:o,onClick:()=>z(!0),children:e("logout")}),(0,a.jsx)("button",{id:`coding-oauth-models-toggle-${t.slug}`,type:"button",style:P,"aria-expanded":l,"aria-controls":l?`coding-oauth-models-${t.slug}`:void 0,onClick:M,children:e(l?"collapseModels":"expandModels")}),C?.available===!0?(0,a.jsx)("button",{id:`coding-oauth-source-pull-${t.slug}`,type:"button",style:P,disabled:r,onClick:V,children:e("sourcesPullCopy")}):null]}):n.status==="signing-in"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",style:P,disabled:o,onClick:k,children:e("cancelLogin")}),x.length>0?(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{pe(m=>!m)},children:e(X?"hideOtherLoginMethods":"otherLoginMethods")}):null,X?x.map(m=>(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{T(m)},children:ut(m,e,{remote:c,primary:!1})},m)):null]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{id:`coding-oauth-login-${t.slug}`,type:"button",style:Y,disabled:o,onClick:()=>{T(se)},children:o?e("working"):ut(se,e,{remote:c,primary:!0})}),x.length>0?(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{pe(m=>!m)},children:e(X?"hideOtherLoginMethods":"otherLoginMethods")}):null,X?x.map(m=>(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{T(m)},children:ut(m,e,{remote:c,primary:!1})},m)):null,C?.available===!0?(0,a.jsx)("button",{id:`coding-oauth-source-pull-${t.slug}`,type:"button",style:P,disabled:r,onClick:V,children:e("sourcesPullCopy")}):j&&C?.reason!==void 0?(0,a.jsx)("span",{style:b,children:e(Vn[C.reason])}):null]})}),n.status==="error"?(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},children:n.message}):null,n.status==="signing-in"?(0,a.jsx)(jo,{t:e,activeMethod:ye,userCode:n.userCode,url:n.url,popupBlocked:p}):null,n.status==="signing-in"&&ye!=="device"?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("label",{htmlFor:`coding-oauth-code-${t.slug}`,style:yt,children:e("pasteCodeLabel")}),(0,a.jsx)("input",{id:`coding-oauth-code-${t.slug}`,style:{...De,flex:"1 1 360px"},value:d,placeholder:e("pasteCodePlaceholder"),disabled:o,onChange:m=>{_(m.target.value)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),v())}}),(0,a.jsx)("button",{type:"button",style:Y,disabled:o||d.trim().length===0,onClick:v,children:e("submitCode")})]})}):null,n.status==="signed-in"&&l?(0,a.jsxs)("div",{id:`coding-oauth-models-${t.slug}`,style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},"data-accounts-list":t.slug,children:[(0,a.jsx)("p",{style:b,children:e("accountsListHint")}),n.accounts.length===0?(0,a.jsx)("p",{style:S,children:e("accountsEmpty")}):(0,a.jsx)("ul",{style:{...xe,margin:0,paddingLeft:0,listStyle:"none"},children:n.accounts.map(m=>{let K=m.id===n.activeAccountId,ie=m.label??m.accountId??m.id;return(0,a.jsxs)("li",{"data-account-id":m.id,style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",justifyContent:"space-between",padding:"6px 0",borderBottom:"1px solid var(--dsw-alias-border-subtle, #e5e5e5)"},children:[(0,a.jsxs)("span",{style:S,children:[ie,K?(0,a.jsxs)("span",{style:b,children:[" \xB7 ",e("accountActive")]}):null]}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[K?null:(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{ue(m.id)},children:e("accountSetDefault")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{ee(m.id)},children:e("accountRemove")})]})]},m.id)})})]}),(0,a.jsxs)("div",{style:ve,children:[(0,a.jsx)("h4",{style:{...$,fontSize:14},children:e("models")}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se([])},children:e("deselectAll")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se([...O])},children:e("selectAll")}),(0,a.jsx)("button",{type:"button",style:le,disabled:o,onClick:()=>{Se(O.length>0?[O[0]]:[])},children:e("resetModelsDefault")})]})]}),(0,a.jsx)("label",{htmlFor:`coding-oauth-model-filter-${t.slug}`,style:yt,children:e("modelFilterLabel",{provider:e(t.titleKey)})}),(0,a.jsx)("input",{id:`coding-oauth-model-filter-${t.slug}`,type:"search",style:De,value:W,placeholder:e("modelFilterPlaceholder"),disabled:o,onChange:m=>{me(m.target.value)}}),Ie?.status==="signed-in"?(0,a.jsx)("p",{style:S,children:Ie.catalogSource==="live"?e("catalogLive"):Ie.catalogSource==="cache"?e("catalogCache"):e("catalogFallback")}):null,(0,a.jsxs)("p",{style:S,children:[e("modelHint")," ",(0,a.jsxs)("span",{style:J,children:[t.route,"/<id>"]})]}),(0,a.jsx)("ul",{style:xe,children:Le.map(m=>{let K=H.includes(m);return(0,a.jsx)("li",{children:(0,a.jsxs)("label",{style:gt,children:[(0,a.jsx)("input",{type:"checkbox",checked:K,disabled:o,onChange:()=>{let ie=new Set(H);K?ie.delete(m):ie.add(m),Se([...O].filter(Be=>ie.has(Be)))}}),(0,a.jsx)("span",{style:J,children:m})]})},m)})}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,a.jsx)("button",{type:"button",style:Y,disabled:o||!it,onClick:()=>Z(H),children:e(o?"working":"applyModelDraft")}),it?(0,a.jsx)("span",{style:b,children:e("modelDraftPending")}):null]}),Le.length===0?(0,a.jsx)("p",{style:b,children:e("modelFilterPlaceholder")}):null,Ie?.status==="signed-in"&&Ie.catalogError!==void 0?(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},children:e("catalogError")}):null,t.slug==="codex"&&h?(0,a.jsxs)("div",{style:ae,children:[(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-label-primary)"},children:e("usageTitle")}),R===void 0?null:(0,a.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},role:"alert",children:R}),g&&I===void 0?(0,a.jsx)("p",{style:b,children:e("usageLoading")}):I===void 0||!xi(I)?(0,a.jsx)("p",{style:b,children:e("usageEmpty")}):(0,a.jsxs)(a.Fragment,{children:[ne===void 0?null:(0,a.jsx)("p",{style:b,children:e("usageFetchedAt",{time:ne})}),Ge!==void 0?(0,a.jsx)(ln,{value:Ge,label:e("usageRateLimit"),meta:e("usageUsed",{value:`${String(Ge)}%`})}):null,I.rateLimits.map(m=>{let K=m.windows[0],ie=K?.usedPercent,Be=qe(K?.resetsAt);return(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:ie===void 0?(0,a.jsx)("p",{style:b,children:m.name??e("usageRateLimit")}):(0,a.jsx)(ln,{value:ie,label:m.name??e("usageRateLimit"),meta:Be===void 0?e("usageUsed",{value:`${String(ie)}%`}):`${e("usageUsed",{value:`${String(ie)}%`})} \xB7 ${e("usageResets",{time:Be})}`})},m.id)})]})]}):null]}):null]})}var E=require("react/jsx-runtime");function Ri({t:e,status:t,remote:n,remoteTipDismissed:o,onDismissRemoteTip:r,sources:c,sourcesError:d,sourcesNotice:p,sourcesBusy:l,preview:C,confirmOverwrite:h,busyProvider:I,codeInputs:R,popupBlocked:g,expandedProviders:T,showUsage:G,usage:k,usageError:v,usageLoading:_,onSignIn:M,onSignOut:V,onCancelLogin:Z,onSubmitCode:ue,onCodeChange:ee,onToggleExpanded:X,onPreviewSource:pe,onSaveModels:W,onSetDefaultAccount:me,onRemoveAccount:be,onConfirmOverwriteChange:z,onCommitSource:ge,onCancelSourcePreview:re,onRefreshSources:te,onDismissSourcesNotice:he}){let se=(0,ze.useRef)(void 0);return(0,ze.useEffect)(()=>{if(C!==void 0){se.current=C.kind,document.getElementById(`coding-oauth-source-preview-${C.kind}`)?.focus();return}let x=se.current;x===void 0||l||(se.current=void 0,document.getElementById(`coding-oauth-source-pull-${x}`)?.focus())},[C,l]),t===void 0?(0,E.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,E.jsxs)("div",{style:Ue,children:[(0,E.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("loadingAccount")]})}):(0,E.jsxs)(E.Fragment,{children:[n&&!o?(0,E.jsx)(kt,{message:e("remoteAccountsTip"),dismissLabel:e("remoteTipDismiss"),onDismiss:r}):null,ai(c)?(0,E.jsx)(kt,{message:e("sourcesAllMissingHint"),dismissLabel:e("sourcesCheckAgain"),onDismiss:()=>{te()}}):null,ri(c)?(0,E.jsx)("p",{style:b,children:e("sourcesAvailableHint")}):null,d===void 0?null:(0,E.jsx)("p",{style:{...S,color:"var(--dsw-alias-state-error-primary)"},role:"alert",children:d}),p===void 0?null:(0,E.jsx)(kt,{message:p,tone:"success",autoHideMs:5e3,onDismiss:he},p),(0,E.jsxs)("div",{style:gi,children:[Yn.map(x=>{let ke=t.providers[x.slug],ye=ke.status==="signing-in"||T[x.slug]===!0;return(0,E.jsxs)(ze.Fragment,{children:[(0,E.jsx)(Oi,{t:e,definition:x,providerStatus:ke,busy:I===x.slug,sourcesBusy:l,remote:n,codeInput:R[x.slug]??"",popupBlocked:g[x.slug]===!0,expanded:ye,source:c?.find(O=>O.kind===x.slug),showUsage:G,usage:k,usageError:v,usageLoading:_,onSignIn:O=>{M(x.slug,O)},onSignOut:()=>{V(x.slug)},onCancelLogin:()=>{Z(x.slug)},onSubmitCode:()=>{ue(x.slug)},onCodeChange:O=>{ee(x.slug,O)},onToggleExpanded:()=>{X(x.slug)},onPreviewSource:()=>{pe(x.slug)},onSaveModels:O=>{W(x.slug,O)},onSetDefaultAccount:O=>{me(x.slug,O)},onRemoveAccount:O=>{be(x.slug,O)}}),C?.kind===x.slug?(0,E.jsx)("div",{style:{gridColumn:"1 / -1",minWidth:0},children:(0,E.jsx)(Pi,{t:e,preview:C,confirmOverwrite:h,sourcesBusy:l,onConfirmOverwriteChange:z,onCommit:ge,onCancel:re})}):null]},x.slug)}),(0,E.jsxs)("div",{style:oe,children:[(0,E.jsxs)("div",{style:ve,children:[(0,E.jsxs)("div",{children:[(0,E.jsx)("h3",{style:{...$,fontSize:16},children:e("antigravityTitle")}),(0,E.jsx)("p",{style:{...S,marginTop:4},children:e("antigravityDescription")}),(0,E.jsx)("p",{style:{...S,marginTop:4},children:(0,E.jsx)("span",{style:J,children:t.antigravity.route})})]}),(0,E.jsx)(Ee,{label:t.antigravity.installed?e("antigravityInstalled"):e("antigravityMissing"),tone:t.antigravity.installed?"success":"neutral",installed:t.antigravity.installed})]}),(0,E.jsx)("p",{style:S,children:e("antigravityCliHint")}),(0,E.jsx)("code",{style:{...J,fontSize:12,overflowWrap:"anywhere"},children:e("antigravityCliCommand")})]})]})]})}var cn=require("react/jsx-runtime"),Yo=(e,t)=>({position:"relative",width:40,height:22,borderRadius:11,flex:"0 0 auto",background:e?"var(--dsw-alias-button-primary-fill)":"var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.45))",opacity:t?.5:1,cursor:t?"not-allowed":"pointer",transition:$e,border:"none",padding:0}),Xo=e=>({position:"absolute",top:2,left:e?20:2,width:18,height:18,borderRadius:"50%",background:e?"var(--dsw-alias-label-primary-foreground)":"var(--dsw-alias-button-elevated-fill)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.25)",transition:$e});function je({checked:e,disabled:t=!1,onChange:n,ariaLabel:o,ariaDescribedBy:r,id:c}){return(0,cn.jsx)("button",{id:c,type:"button",role:"switch","aria-checked":e,"aria-label":o,"aria-describedby":r,disabled:t,style:Yo(e,t),onClick:()=>{t||n(!e)},children:(0,cn.jsx)("span",{"aria-hidden":"true",style:Xo(e)})})}var f=require("react/jsx-runtime");function Li({t:e,capabilities:t,capabilitiesError:n,capabilitiesBusy:o,imagine:r,imagineError:c,codexSignedIn:d,onRetry:p,onOpenAccounts:l,onFocusDependency:C,onPatchCapability:h}){let I=Qt.filter(g=>!g.key.startsWith("grokImagine")),R=Qt.filter(g=>g.key.startsWith("grokImagine"));return(0,f.jsxs)("section",{style:oe,"aria-labelledby":"coding-oauth-capabilities-title",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{id:"coding-oauth-capabilities-title",style:{...$,fontSize:16},children:e("capabilitiesTitle")}),(0,f.jsx)("p",{style:{...S,marginTop:4},children:e("capabilitiesIntro")})]}),c===void 0?null:(0,f.jsxs)("div",{style:ae,role:"alert",children:[(0,f.jsx)("p",{style:Pe,children:c}),(0,f.jsx)("button",{type:"button",style:P,onClick:p,children:e("retry")})]}),r===void 0&&c===void 0?(0,f.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,f.jsxs)("div",{style:Ue,children:[(0,f.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("imagineLoading")]})}):r===void 0?null:(0,f.jsxs)("div",{id:"coding-oauth-imagine-credential",style:ae,tabIndex:-1,children:[(0,f.jsx)(Ee,{label:r.configured?e("imagineConfigured"):e("imagineNotConfigured"),tone:r.configured?"success":"neutral"}),(0,f.jsx)("p",{style:b,children:e("imagineSource",{source:Ii(r.source,e)})})]}),n===void 0?null:(0,f.jsxs)("div",{style:ae,role:"alert",children:[(0,f.jsx)("p",{style:Pe,children:n}),(0,f.jsx)("button",{type:"button",style:P,onClick:p,children:e("retry")})]}),t===void 0&&n===void 0?(0,f.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,f.jsxs)("div",{style:Ue,children:[(0,f.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("capabilitiesLoading")]})}):t===void 0?null:(0,f.jsxs)("fieldset",{style:{border:0,margin:0,padding:0,minWidth:0},children:[(0,f.jsx)("legend",{style:{...S,position:"absolute",width:1,height:1,overflow:"hidden"},children:e("capabilitiesTitle")}),t.writable?null:(0,f.jsx)("p",{style:b,children:e("capabilitiesReadOnly")}),(0,f.jsx)("ul",{style:xe,children:I.map(g=>{let T=t.value[g.key],G=g.requiresImages===!0&&!t.value.codexImages,k=d?G?e("requiresCodexImages"):void 0:e("requiresCodexSignIn"),v=o||!t.writable||k!==void 0,_=`cap-switch-${g.key}`,M=d?G?{label:e("focusCodexImages"),action:()=>C("codexImages")}:void 0:{label:e("openCodexAccount"),action:()=>l("codex")};return(0,f.jsx)("li",{style:{opacity:k===void 0?1:.65,transition:"opacity 0.15s ease"},children:(0,f.jsxs)("div",{style:{...ve,alignItems:"flex-start"},children:[(0,f.jsxs)("label",{htmlFor:_,style:{flex:"1 1 360px",cursor:v?"default":"pointer"},children:[(0,f.jsx)("span",{style:{display:"block",fontSize:14,color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`cap-hint-${g.key}`,style:{display:"block",...b},children:k??e(g.hint)})]}),M===void 0?null:(0,f.jsx)("button",{type:"button",style:P,onClick:M.action,children:M.label}),(0,f.jsx)(je,{id:_,checked:T,disabled:v,ariaLabel:e(g.label),ariaDescribedBy:`cap-hint-${g.key}`,onChange:V=>{h(g.key,V)}})]})},g.key)})}),(0,f.jsx)("h4",{style:{...$,fontSize:14},children:e("imagineTitle")}),(0,f.jsx)("ul",{style:xe,children:R.map(g=>{let T=t.value[g.key],G=r?.configured===!0?void 0:e("requiresImagineCredential"),k=o||!t.writable||G!==void 0,v=`cap-switch-${g.key}`;return(0,f.jsx)("li",{children:(0,f.jsxs)("div",{style:{...ve,alignItems:"flex-start"},children:[(0,f.jsxs)("label",{htmlFor:v,style:{flex:"1 1 360px",cursor:k?"default":"pointer"},children:[(0,f.jsx)("span",{style:{display:"block",fontSize:14,color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`cap-hint-${g.key}`,style:{display:"block",...b},children:G??e(g.hint)})]}),G===void 0?null:(0,f.jsx)("button",{type:"button",style:P,onClick:()=>C("imagineCredential"),children:e("focusImagineCredential")}),(0,f.jsx)(je,{id:v,checked:T,disabled:k,ariaLabel:e(g.label),ariaDescribedBy:`cap-hint-${g.key}`,onChange:_=>{h(g.key,_)}})]})},g.key)})}),(0,f.jsxs)("div",{style:ae,children:[(0,f.jsx)("h4",{style:{...$,fontSize:14},children:e("capabilityLimitsTitle")}),(0,f.jsx)("p",{style:b,children:e("capabilityLimitsHint")}),(0,f.jsx)("ul",{style:xe,children:jn.map(g=>{let T=t.value[g.key]/g.scale,G=`cap-limit-${g.key}`;return(0,f.jsxs)("li",{style:ve,children:[(0,f.jsxs)("label",{htmlFor:G,style:{...S,flex:"1 1 360px"},children:[(0,f.jsx)("span",{style:{display:"block",color:"var(--dsw-alias-label-primary)"},children:e(g.label)}),(0,f.jsx)("span",{id:`${G}-hint`,style:{display:"block",...b},children:e(g.hint)})]}),(0,f.jsx)("input",{id:G,type:"number",inputMode:"numeric",min:g.min,max:g.max,step:1,defaultValue:T,disabled:o||!t.writable,"aria-describedby":`${G}-hint`,style:{...De,width:112,flex:"0 0 112px"},onInput:k=>{k.currentTarget.setCustomValidity("")},onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(k.currentTarget.value=String(T),k.currentTarget.setCustomValidity(""))},onBlur:k=>{let v=k.currentTarget,_=Number(v.value);if(!Number.isInteger(_)||_<g.min||_>g.max){v.setCustomValidity(e("capabilityLimitInvalid",{min:g.min,max:g.max})),v.reportValidity();return}v.setCustomValidity("");let M=_*g.scale;M!==t.value[g.key]&&Promise.resolve(h(g.key,M)).then(V=>{V===!1&&v.isConnected&&(v.value=String(T))})}},`${g.key}-${String(t.revision)}-${String(T)}`)]},g.key)})})]})]})]})}var Q=require("react");function Gi(e,t,n,o="<gateway-model>"){let r=n.length>0?n:"<your-gateway-key>";return{curl:`curl ${e}/chat/completions \\
|
|
3
3
|
-H "Authorization: Bearer ${r}" \\
|
|
4
4
|
-H "Content-Type: application/json" \\
|
|
5
5
|
-d '{"model":"${o}","messages":[{"role":"user","content":"Hello"}]}'`,python:`from openai import OpenAI
|
|
@@ -19,7 +19,7 @@ api_key: ${r}
|
|
|
19
19
|
|
|
20
20
|
# Anthropic-compatible client
|
|
21
21
|
base_url: ${t}
|
|
22
|
-
api_key: ${r}`}}var u=require("react/jsx-runtime"),Ne=[{id:"curl",labelKey:"gatewaySnippetCurl"},{id:"python",labelKey:"gatewaySnippetPython"},{id:"ide",labelKey:"gatewaySnippetIde"}];function
|
|
22
|
+
api_key: ${r}`}}var u=require("react/jsx-runtime"),Ne=[{id:"curl",labelKey:"gatewaySnippetCurl"},{id:"python",labelKey:"gatewaySnippetPython"},{id:"ide",labelKey:"gatewaySnippetIde"}];function Hi({t:e,gateway:t,gatewayError:n,gatewayBusy:o,gatewayOnceKey:r,gatewayKeyVisible:c,gatewayRotateConfirm:d,gatewayRevealError:p,portDraft:l,copiedField:C,copyFailedField:h,onEnabledChange:I,onOpencodeGoEnabledChange:R,onRetry:g,onPortDraftChange:T,onApplyPort:G,onRandomPort:k,onCopyKey:v,onToggleKeyVisible:_,onRotateConfirm:M,onRotateCancel:V,onRotate:Z}){let[ue,ee]=(0,Q.useState)(!1),[X,pe]=(0,Q.useState)("curl"),W=(0,Q.useRef)(null),me=(0,Q.useRef)(null),be=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),ge=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ue){W.current?.focus();return}z.current&&(z.current=!1,document.getElementById("coding-oauth-gateway-enabled")?.focus())},[ue]),(0,Q.useEffect)(()=>{if(d){be.current?.focus();return}ge.current&&(ge.current=!1,me.current?.focus())},[d]);let re=At(l)!==void 0,te=t!==void 0&&l!==String(t.port),he=(0,Q.useMemo)(()=>{if(t===void 0||!c||r===void 0||t.models.length===0)return;let w=`${tt(t.bind,t.port)}/v1`,H=tt(t.bind,t.port);return Gi(w,H,r,t.models[0])},[t,c,r]),se=(w,H)=>h===w?e("copyFailed"):C===w?e("copied"):H??e("copy"),x=w=>{let H=Ne[w];H!==void 0&&(pe(H.id),document.getElementById(`coding-oauth-snippet-tab-${H.id}`)?.focus())},ke=w=>{let H=Ne.findIndex(Se=>Se.id===X);H<0||(w.key==="ArrowRight"||w.key==="ArrowDown"?(w.preventDefault(),x((H+1)%Ne.length)):w.key==="ArrowLeft"||w.key==="ArrowUp"?(w.preventDefault(),x((H-1+Ne.length)%Ne.length)):w.key==="Home"?(w.preventDefault(),x(0)):w.key==="End"&&(w.preventDefault(),x(Ne.length-1)))},ye=t===void 0?"":`${tt(t.bind,t.port)}/v1`,O=t===void 0?"":tt(t.bind,t.port);return(0,u.jsxs)("section",{style:oe,"aria-labelledby":"coding-oauth-gateway-title",children:[(0,u.jsxs)("div",{children:[(0,u.jsx)("h3",{id:"coding-oauth-gateway-title",style:{...$,fontSize:16},children:e("gatewayTitle")}),(0,u.jsx)("p",{style:{...S,marginTop:4},children:e("gatewayIntro")}),(0,u.jsx)("p",{style:{...pt,marginTop:8},children:e("gatewayWarning")}),(0,u.jsx)("p",{style:{...b,marginTop:8},children:e("gatewayLoopbackHint")})]}),n===void 0?null:(0,u.jsx)("p",{style:Pe,role:"alert",children:n}),p===void 0?null:(0,u.jsx)("p",{style:Pe,role:"alert",children:p}),t===void 0&&n===void 0?(0,u.jsx)("div",{style:Me,role:"status","aria-busy":"true",children:(0,u.jsxs)("div",{style:Ue,children:[(0,u.jsx)("span",{"aria-hidden":"true",style:Ae("loading")}),e("gatewayLoading")]})}):t===void 0?(0,u.jsxs)("div",{style:ae,role:"status",children:[(0,u.jsx)("p",{style:b,children:e("gatewayLoadFailed")}),(0,u.jsx)("button",{type:"button",style:P,onClick:g,children:e("retry")})]}):(0,u.jsxs)("div",{style:ae,children:[(0,u.jsx)(Ee,{label:t.running?e("gatewayRunning"):e("gatewayStopped"),tone:t.running?"success":"neutral"}),(0,u.jsx)("p",{style:b,children:t.models.length>0?e("gatewayModelsReady",{count:t.models.length,model:t.models[0]}):e("gatewayModelsUnavailable")}),(0,u.jsx)("p",{style:b,children:t.keyConfigured?e("gatewayKeyConfigured"):e("gatewayKeyNotConfigured")}),ue?(0,u.jsxs)("div",{style:ae,children:[(0,u.jsx)("p",{style:S,children:e("gatewayEnableConfirm")}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{ref:W,type:"button",style:Y,disabled:o,onClick:()=>{z.current=!0,ee(!1),I(!0)},children:e("gatewayEnableConfirmAction")}),(0,u.jsx)("button",{type:"button",style:P,disabled:o,onClick:()=>{z.current=!0,ee(!1)},children:e("gatewayEnableCancel")})]})]}):(0,u.jsxs)("label",{htmlFor:"coding-oauth-gateway-enabled",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,fontSize:14,color:"var(--dsw-alias-label-primary)"},children:[(0,u.jsx)("span",{children:e("gatewayEnabled")}),(0,u.jsx)(je,{id:"coding-oauth-gateway-enabled",checked:t.enabled,disabled:o,onChange:w=>{if(w){ee(!0);return}I(!1)}})]}),(0,u.jsxs)("label",{htmlFor:"coding-oauth-gateway-opencode-go",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,fontSize:14,color:"var(--dsw-alias-label-primary)",opacity:t.enabled?1:.6},children:[(0,u.jsx)("span",{children:e("gatewayOpencodeGoEnabled")}),(0,u.jsx)(je,{id:"coding-oauth-gateway-opencode-go",checked:t.opencodeGoEnabled,disabled:o||!t.enabled,onChange:R})]}),(0,u.jsx)("p",{style:b,children:e("gatewayOpencodeGoHint")}),(0,u.jsxs)("div",{children:[(0,u.jsx)("label",{htmlFor:"coding-oauth-gateway-port",style:{...S,color:"var(--dsw-alias-label-primary)"},children:e("gatewayPort")}),(0,u.jsx)("p",{id:"coding-oauth-gateway-port-hint",style:b,children:e("gatewayPortHint")}),!re&&l.length>0?(0,u.jsx)("p",{style:{...b,color:"var(--dsw-alias-state-error-primary)"},role:"alert",children:e("gatewayPortInvalid")}):null,(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:[(0,u.jsx)("input",{id:"coding-oauth-gateway-port",type:"number",inputMode:"numeric",min:st,max:dt,step:1,value:l,disabled:o,"aria-describedby":"coding-oauth-gateway-port-hint","aria-invalid":!re&&l.length>0,style:{...De,width:112,flex:"0 0 112px",borderColor:!re&&l.length>0?"var(--dsw-alias-state-error-primary)":"var(--dsw-alias-border-l2)"},onChange:w=>{T(w.target.value)},onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),G()),w.key==="Escape"&&T(String(t.port))}}),(0,u.jsx)("button",{type:"button",style:Y,disabled:o||!te||!re,onClick:G,children:e("gatewayPortApply")}),(0,u.jsx)("button",{type:"button",style:P,disabled:o,onClick:()=>{k(Ai(t.port))},children:e("gatewayPortRandom")})]})]}),(0,u.jsxs)("p",{style:bt,children:[(0,u.jsxs)("span",{style:b,children:[e("gatewayOpenAiUrl"),(0,u.jsx)("span",{style:{display:"block",...J},children:ye})]}),(0,u.jsx)(Ke,{text:ye,idleLabel:e("copy"),copiedLabel:e("copied"),failedLabel:e("copyFailed")})]}),(0,u.jsxs)("p",{style:bt,children:[(0,u.jsxs)("span",{style:b,children:[e("gatewayAnthropicUrl"),(0,u.jsx)("span",{style:{display:"block",...J},children:O})]}),(0,u.jsx)(Ke,{text:O,idleLabel:e("copy"),copiedLabel:e("copied"),failedLabel:e("copyFailed")})]}),(0,u.jsxs)("p",{style:bt,children:[(0,u.jsxs)("span",{style:b,children:[e("gatewayKeyHint"),(0,u.jsx)("span",{style:{display:"block",...J,overflowWrap:"anywhere"},children:c&&r!==void 0?r:t.keyHint||"\u2014"})]}),(0,u.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{type:"button",style:Y,disabled:o,onClick:v,children:se("key",e("gatewayCopyKey"))}),(0,u.jsx)("button",{type:"button",style:P,disabled:o,onClick:_,children:e(c?"gatewayHideKey":"gatewayShowKey")})]})]}),(0,u.jsx)("p",{style:b,children:e("gatewayKeyCopyHint")}),t.enabled&&he!==void 0?(0,u.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[(0,u.jsx)("h4",{style:{...$,fontSize:14},children:e("gatewaySnippetsTitle")}),(0,u.jsx)("div",{role:"tablist","aria-label":e("gatewaySnippetsTitle"),style:ft,onKeyDown:ke,children:Ne.map(w=>{let H=X===w.id;return(0,u.jsx)("button",{id:`coding-oauth-snippet-tab-${w.id}`,type:"button",role:"tab","aria-selected":H,"aria-controls":"coding-oauth-snippet-panel",tabIndex:H?0:-1,style:H?mt:Qe,onClick:()=>{pe(w.id)},children:e(w.labelKey)},w.id)})}),(0,u.jsx)("div",{id:"coding-oauth-snippet-panel",role:"tabpanel","aria-labelledby":`coding-oauth-snippet-tab-${X}`,children:(0,u.jsx)("code",{style:ci,children:he[X]})}),(0,u.jsx)(Ke,{text:he[X],idleLabel:e("copy"),copiedLabel:e("copied"),failedLabel:e("copyFailed")})]}):t.enabled?(0,u.jsx)("p",{style:b,children:e("gatewaySnippetsUnavailable")}):null,d?(0,u.jsxs)("div",{style:ae,children:[(0,u.jsx)("p",{style:S,children:e("gatewayRotateConfirm")}),(0,u.jsx)("p",{style:b,children:e("gatewayRotateConfirmHint")}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{ref:be,type:"button",style:Y,disabled:o,onClick:()=>{ge.current=!0,Z()},children:e("gatewayRotateConfirmAction")}),(0,u.jsx)("button",{type:"button",style:P,disabled:o,onClick:()=>{ge.current=!0,V()},children:e("gatewayRotateCancel")})]})]}):(0,u.jsx)("button",{ref:me,type:"button",style:P,disabled:o,onClick:M,children:e("gatewayRotate")})]})]})}var un=require("react/jsx-runtime");function Ui({t:e,activeTab:t,onChange:n,hints:o}){let r=p=>o?.find(l=>l.id===p)?.suffix,c=p=>{let l=Te[p];if(l===void 0)return;n(l.id),document.getElementById(`coding-oauth-tab-${l.id}`)?.focus()},d=p=>{let l=Te.findIndex(C=>C.id===t);l<0||(p.key==="ArrowRight"||p.key==="ArrowDown"?(p.preventDefault(),c((l+1)%Te.length)):p.key==="ArrowLeft"||p.key==="ArrowUp"?(p.preventDefault(),c((l-1+Te.length)%Te.length)):p.key==="Home"?(p.preventDefault(),c(0)):p.key==="End"&&(p.preventDefault(),c(Te.length-1)))};return(0,un.jsx)("div",{role:"tablist","aria-label":e("title"),style:ft,onKeyDown:d,children:Te.map(p=>{let l=t===p.id,C=r(p.id),h=C===void 0?e(p.label):`${e(p.label)} (${C})`;return(0,un.jsx)("button",{id:`coding-oauth-tab-${p.id}`,type:"button",role:"tab","aria-selected":l,"aria-controls":l?`coding-oauth-panel-${p.id}`:void 0,tabIndex:l?0:-1,style:l?mt:Qe,onClick:()=>{n(p.id)},children:h},p.id)})})}var Di="dsh-coding-oauth-micro-styles",Jo=`
|
|
23
23
|
@keyframes dsh-coding-oauth-skeleton-pulse {
|
|
24
24
|
0% { background-position: 200% 0; }
|
|
25
25
|
100% { background-position: -200% 0; }
|
|
@@ -51,5 +51,5 @@ api_key: ${r}`}}var u=require("react/jsx-runtime"),Ne=[{id:"curl",labelKey:"gate
|
|
|
51
51
|
flex-direction: column;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
`,pn=!1;function Di(){if(pn||typeof document>"u")return;if(document.getElementById(Ui)!==null){pn=!0;return}let e=document.createElement("style");e.id=Ui,e.textContent=Xo,document.head.appendChild(e),pn=!0}var F=require("react/jsx-runtime"),Mi="dsh-coding-oauth-remote-tip-dismissed";function Jo(){try{return globalThis.sessionStorage?.getItem(Mi)==="1"}catch{return!1}}function gn({t:e}){if(e===void 0)throw new Error("Coding OAuth settings requires its translation function");let[t,n]=(0,y.useState)(void 0),[o,r]=(0,y.useState)(void 0),[c,d]=(0,y.useState)(void 0),[p,l]=(0,y.useState)({}),[C,h]=(0,y.useState)({}),[I,R]=(0,y.useState)(void 0),[g,T]=(0,y.useState)(void 0),[G,k]=(0,y.useState)(!1),[v,_]=(0,y.useState)(void 0),M=(0,y.useRef)(void 0),V=(0,y.useRef)(0),Z=(0,y.useRef)(!0),[ue,ee]=(0,y.useState)(!1),[X,pe]=(0,y.useState)(void 0),[W,me]=(0,y.useState)(void 0),[be,z]=(0,y.useState)(void 0),[ge,re]=(0,y.useState)(!1),[te,he]=(0,y.useState)(!1),[se,x]=(0,y.useState)(void 0),[ke,ye]=(0,y.useState)(void 0),[O,w]=(0,y.useState)(!1),[H,Se]=(0,y.useState)(void 0),[it,Ie]=(0,y.useState)(void 0),[j,Le]=(0,y.useState)(void 0),[Ge,ne]=(0,y.useState)(void 0),[m,K]=(0,y.useState)(!1),[ie,Be]=(0,y.useState)(!1),[It,yn]=(0,y.useState)(void 0),[fn,Tt]=(0,y.useState)(!1),[Fi,Pt]=(0,y.useState)(!1),[Wi,Ye]=(0,y.useState)(void 0),[mn,ot]=(0,y.useState)(""),[de,bn]=(0,y.useState)("accounts"),[Vi,Et]=(0,y.useState)(void 0),[$i,_t]=(0,y.useState)(void 0),[qi,zi]=(0,y.useState)({}),[ji,Yi]=(0,y.useState)(Jo),Fe=(0,y.useRef)(void 0),Xi=t?.accessMode==="ssh-tunnel"||t?.accessMode==="trusted-https-proxy",we=(0,y.useCallback)(async()=>{try{let i=await U(xn);return n(i),r(void 0),i}catch(i){r(i instanceof Error?i.message:e("requestFailed"));return}},[e]),Xe=(0,y.useCallback)(async()=>{try{R(hi(await U(On))),T(void 0)}catch(i){R(rn([])),T(i instanceof Error?i.message:e("sourcesLoadFailed"))}},[e]),He=(0,y.useCallback)(async()=>{try{let i=dn(await U(Yt));return me(i??{value:sn(),revision:0,writable:!1}),z(void 0),i}catch(i){me({value:sn(),revision:0,writable:!1}),z(i instanceof Error?i.message:e("capabilitiesLoadFailed"));return}finally{he(!0)}},[e]),at=(0,y.useCallback)(async()=>{try{Le(et(await U(Je))),ne(void 0)}catch(i){ne(i instanceof Error?i.message:e("gatewayLoadFailed"))}finally{Be(!0)}},[e]),Ot=(0,y.useCallback)(async()=>{try{Se(Ai(await U(Hn))),Ie(void 0)}catch(i){Ie(i instanceof Error?i.message:e("imagineLoadFailed"))}},[e]),hn=(0,y.useCallback)(async()=>{w(!0);try{x(wi(await U(Gn))),ye(void 0)}catch(i){x(void 0),ye(i instanceof Error?i.message:e("usageUnavailable"))}finally{w(!1)}},[e]);(0,y.useEffect)(()=>{Di();let i=!0,s;return we().then(A=>{!i||A?.uiOwner==="hub"||(s=window.setTimeout(()=>{Xe()},0))}),()=>{i=!1,s!==void 0&&window.clearTimeout(s)}},[we,Xe]),(0,y.useEffect)(()=>{de==="capabilities"&&(te||He(),Ot())},[de,te,He,Ot]),(0,y.useEffect)(()=>{te||t?.providers.codex.status==="signed-in"&&He()},[te,He,t?.providers.codex.status]),(0,y.useEffect)(()=>{de!=="gateway"||ie||at()},[de,ie,at]),(0,y.useEffect)(()=>{M.current=v},[v]),(0,y.useEffect)(()=>(Z.current=!0,()=>{Z.current=!1,Fe.current!==void 0&&window.clearTimeout(Fe.current),V.current+=1;let i=M.current;i!==void 0&<(i.previewId,!0)}),[]),(0,y.useEffect)(()=>{if(!(t!==void 0&&Object.values(t.providers).some(A=>A.status==="signing-in")))return;let s=window.setInterval(()=>{we()},Mn);return()=>{window.clearInterval(s)}},[we,t]),(0,y.useEffect)(()=>{let i=t?.providers.codex.status==="signed-in";if(W?.value.codexUsage===!0&&i){hn();return}x(void 0),ye(void 0),w(!1)},[W?.value.codexUsage,hn,t?.providers.codex.status]),(0,y.useEffect)(()=>{j!==void 0&&ot(String(j.port))},[j]);let Ji=async(i,s)=>{let A=window.open("about:blank","_blank");A!==null&&(A.opener=null),d(i),r(void 0),h(N=>({...N,[i]:A===null}));try{let N=await U(An,"POST",{provider:i,method:s});A!==null&&A.location.replace(N.url),await we()}catch(N){A?.close(),r(N instanceof Error?N.message:e("requestFailed")),await we()}finally{d(void 0)}},Qi=async i=>{let s=p[i]?.trim()??"";if(s.length!==0){d(i);try{await U(kn,"POST",{provider:i,code:s}),l(A=>({...A,[i]:""})),await we()}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}}},Zi=async i=>{d(i);try{n(await U(In,"POST",{provider:i}))}catch(s){r(s instanceof Error?s.message:e("requestFailed"))}finally{d(void 0)}},eo=async i=>{d(i);try{n(await U(Tn,"POST",{provider:i}))}catch(s){r(s instanceof Error?s.message:e("requestFailed"))}finally{d(void 0)}},to=async(i,s)=>{d(i);try{n(await U(Pn,"POST",{provider:i,selected:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},no=async(i,s)=>{d(i);try{n(await U(En,"POST",{provider:i,accountId:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},io=async(i,s)=>{d(i);try{n(await U(_n,"POST",{provider:i,accountId:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},oo=async i=>{let s=++V.current,A=M.current;A!==void 0&&(M.current=void 0,_(void 0),lt(A.previewId)),k(!0),pe(void 0),ee(!1);try{let N=Ci(await U(Rn,"POST",{kind:i}));if(N===void 0)throw new Error(e("sourcesPreviewFailed"));if(!Z.current||s!==V.current){lt(N.previewId,!Z.current);return}M.current=N,_(N),T(void 0)}catch(N){if(!Z.current||s!==V.current)return;_(void 0),T(N instanceof Error?N.message:e("sourcesPreviewFailed"))}finally{Z.current&&s===V.current&&k(!1)}},ao=async()=>{if(v!==void 0&&v.action!=="blocked"&&!(v.confirmOverwriteRequired&&!ue)){k(!0);try{let i=await U(Ln,"POST",{kind:v.kind,previewId:v.previewId,confirmOverwrite:ue}),s=Si(i);M.current=void 0,_(void 0),ee(!1),pe(e("sourcesCommitSuccess",{action:s===void 0?"":e(zn[s])})),T(void 0),await Xe(),await we()}catch(i){ni(i)&&(M.current=void 0,_(void 0),ee(!1)),T(i instanceof Error?i.message:e("sourcesCommitFailed")),await Xe()}finally{k(!1)}}},ro=async()=>{if(v===void 0)return;let i=v.previewId;V.current+=1,M.current=void 0,_(void 0),ee(!1),k(!0);try{await U(rt,"POST",{previewId:i}),T(void 0)}catch(s){T(s instanceof Error?s.message:e("requestFailed"))}finally{k(!1)}},so=async(i,s)=>{if(W===void 0||!W.writable||i==="codexImageEdits"&&s===!0&&!W.value.codexImages||i==="codexImagesAnyModel"&&s===!0&&!W.value.codexImages)return!1;let A=i==="codexImages"&&s===!1?{codexImages:!1,codexImageEdits:!1,codexImagesAnyModel:!1}:{[i]:s};re(!0);try{let N=dn(await U(Yt,"PATCH",{expectedRevision:W.revision,patch:A}));return N!==void 0?me(N):await He(),z(void 0),!0}catch(N){return await He(),z(ti(N)?e("capabilitiesConflictRefreshed"):N instanceof Error?N.message:e("capabilitiesSaveFailed")),!1}finally{re(!1)}},lo=W?.value.codexUsage===!0&&t?.providers.codex.status==="signed-in",co=t===void 0?0:Object.values(t.providers).filter(i=>i.status==="signed-in").length,uo=(0,y.useMemo)(()=>{let i=[];if(t!==void 0){let s=Object.values(t.providers).filter(A=>A.status==="signed-in").length;s>0&&i.push({id:"accounts",suffix:String(s)})}return j?.running===!0&&i.push({id:"gateway",suffix:e("tabGatewayActive")}),i},[j?.running,t,e]),po=i=>{Fe.current!==void 0&&window.clearTimeout(Fe.current),Et(i),_t(void 0),Fe.current=window.setTimeout(()=>{Z.current&&(Et(void 0),_t(void 0)),Fe.current=void 0},2e3)},Cn=async(i,s)=>{if(await ct(s)){po(i);return}Et(void 0),_t(i)},Sn=async()=>{if(It!==void 0)return It;let i=await U(Un,"POST");if(typeof i.apiKey!="string"||i.apiKey.length===0)throw new Error(e("gatewayRevealFailed"));return yn(i.apiKey),i.apiKey},go=async()=>{try{let i=await Sn();await Cn("key",i),Ye(void 0)}catch{Ye(e("gatewayRevealFailed"))}},yo=async()=>{if(fn){Tt(!1);return}try{await Sn(),Tt(!0),Ye(void 0)}catch{Ye(e("gatewayRevealFailed"))}},fo=async()=>{let i=At(mn);if(i===void 0){ne(e("gatewayPortInvalid"));return}if(!(j!==void 0&&i===j.port)){K(!0);try{Le(et(await U(Je,"PATCH",{port:i}))??j),ne(void 0)}catch(s){ne(s instanceof Error?s.message:e("gatewaySaveFailed")),j!==void 0&&ot(String(j.port))}finally{K(!1)}}},mo=async()=>{K(!0);try{let i=await U(Dn,"POST");typeof i.apiKey=="string"&&yn(i.apiKey),Tt(!0),Pt(!1),Ye(void 0),await at()}catch(i){ne(i instanceof Error?i.message:e("gatewaySaveFailed"))}finally{K(!1)}},bo=i=>{K(!0),U(Je,"PATCH",{enabled:i}).then(s=>{Le(et(s)??j),ne(void 0)}).catch(s=>{ne(s instanceof Error?s.message:e("gatewaySaveFailed"))}).finally(()=>{K(!1)})},ho=i=>{K(!0),U(Je,"PATCH",{opencodeGoEnabled:i}).then(s=>{Le(et(s)??j),ne(void 0)}).catch(s=>{ne(s instanceof Error?s.message:e("gatewaySaveFailed"))}).finally(()=>{K(!1)})},Co=()=>{Yi(!0);try{globalThis.sessionStorage?.setItem(Mi,"1")}catch{}},So=()=>{bn("accounts"),window.setTimeout(()=>document.getElementById("coding-oauth-login-codex")?.focus(),0)},wo=i=>{let s=i==="codexImages"?"cap-switch-codexImages":"coding-oauth-imagine-credential";document.getElementById(s)?.focus()};return t?.uiOwner==="hub"?(0,F.jsxs)("section",{"data-dsh-coding-oauth":"compact",style:en,"aria-labelledby":"coding-oauth-settings-title",children:[(0,F.jsx)("h2",{id:"coding-oauth-settings-title",style:$,children:e("coinstallTitle")}),(0,F.jsx)("p",{style:S,children:e("coinstallSummary",{count:co})}),(0,F.jsx)("button",{type:"button",style:P,onClick:()=>window.dispatchEvent(new CustomEvent("usage-stats:open-dashboard")),children:e("coinstallOpenHub")})]}):(0,F.jsxs)("section",{"data-dsh-coding-oauth":"",style:en,"aria-labelledby":"coding-oauth-settings-title",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{id:"coding-oauth-settings-title",style:$,children:e("title")}),de==="accounts"?(0,F.jsx)("p",{style:{...S,marginTop:6},children:e("intro")}):null]}),o===void 0?null:(0,F.jsxs)("div",{role:"alert",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,F.jsx)("p",{style:Pe,children:o}),t===void 0?(0,F.jsx)("button",{type:"button",style:P,onClick:()=>{we()},children:e("retry")}):null]}),(0,F.jsx)(Hi,{t:e,activeTab:de,onChange:bn,hints:uo}),(0,F.jsxs)("div",{id:`coding-oauth-panel-${de}`,role:"tabpanel","aria-labelledby":`coding-oauth-tab-${de}`,style:si,children:[de==="accounts"&&!(t===void 0&&o!==void 0)?(0,F.jsx)(Oi,{t:e,status:t,remote:Xi,remoteTipDismissed:ji,onDismissRemoteTip:Co,sources:I,sourcesError:g,sourcesNotice:X,sourcesBusy:G,preview:v,confirmOverwrite:ue,busyProvider:c,codeInputs:p,popupBlocked:C,expandedProviders:qi,showUsage:lo===!0,usage:se,usageError:ke,usageLoading:O,onSignIn:(i,s)=>{Ji(i,s)},onSignOut:i=>{eo(i)},onCancelLogin:i=>{Zi(i)},onSubmitCode:i=>{Qi(i)},onCodeChange:(i,s)=>{l(A=>({...A,[i]:s}))},onToggleExpanded:i=>{zi(s=>({...s,[i]:s[i]!==!0}))},onPreviewSource:i=>{oo(i)},onSaveModels:(i,s)=>{to(i,s)},onSetDefaultAccount:(i,s)=>{no(i,s)},onRemoveAccount:(i,s)=>{io(i,s)},onConfirmOverwriteChange:ee,onCommitSource:()=>{ao()},onCancelSourcePreview:()=>{ro()},onRefreshSources:()=>{Xe()},onDismissSourcesNotice:()=>{pe(void 0)}}):null,de==="capabilities"?(0,F.jsx)(Ri,{t:e,capabilities:W,capabilitiesError:be,capabilitiesBusy:ge,imagine:H,imagineError:it,codexSignedIn:t?.providers.codex.status==="signed-in",onRetry:()=>{He(),Ot()},onOpenAccounts:So,onFocusDependency:wo,onPatchCapability:(i,s)=>so(i,s)}):null,de==="gateway"?(0,F.jsx)(Gi,{t:e,gateway:j,gatewayError:Ge,gatewayBusy:m,gatewayOnceKey:It,gatewayKeyVisible:fn,gatewayRotateConfirm:Fi,gatewayRevealError:Wi,portDraft:mn,copiedField:Vi,copyFailedField:$i,onRetry:()=>{at()},onEnabledChange:bo,onOpencodeGoEnabledChange:ho,onPortDraftChange:ot,onApplyPort:()=>{fo()},onRandomPort:i=>{ot(String(i))},onCopy:(i,s)=>{Cn(i,s)},onCopyKey:()=>{go()},onToggleKeyVisible:()=>{yo()},onRotateConfirm:()=>{Pt(!0)},onRotateCancel:()=>{Pt(!1)},onRotate:()=>{mo()}}):null,de==="about"?(0,F.jsx)(ui,{t:e}):null]})]})}var Ki={nav:"Coding OAuth",title:"Coding subscriptions",intro:"Use your own Grok Build, ChatGPT Codex, Kimi Code, and Claude Code subscriptions in dsh. API-key routes remain separate.",termsWarning:"These are unofficial third-party integrations with subscription services. Provider terms, quotas, regions, and account-risk policies still apply.",loadingAccount:"Loading accounts\u2026",signedOut:"Not signed in",signingIn:"Waiting for authorization\u2026",signedIn:"Signed in",requestFailed:"The account request failed.",retry:"Try again",cancel:"Cancel",logout:"Sign out",logoutConfirmTitle:"Confirm sign-out",logoutConfirmHint:"Sign out of this provider in dsh? Your provider account itself is not changed.",logoutConfirmAction:"Confirm sign-out",working:"Working\u2026",cancelLogin:"Cancel sign-in",deviceLogin:"Sign in with device code",deviceLoginRemote:"Sign in with device code (best for remote)",browserLogin:"Sign in in browser",pkceLogin:"Sign in with authorization code",userCode:"Enter this code when the provider asks:",openUrl:"Complete sign-in at:",popupBlocked:"The browser blocked the sign-in window. Open this URL manually:",pasteCodeHint:"Paste the authorization code or complete redirect URL returned by the provider. For local PKCE, use this only if the callback could not reach this DSH host:",pasteBrowserCodeHint:"Paste the authorization code or complete redirect URL returned by the provider to finish this browser sign-in:",pasteCodePlaceholder:"authorization code or complete redirect URL",pasteCodeLabel:"Authorization code or complete redirect URL",submitCode:"Submit code",importGrok:"Import from Grok CLI",importHint:"Copies ~/.grok/auth.json into dsh. A later dsh refresh may rotate the token and sign the Grok CLI out.",models:"Visible models",catalogLive:"From your current xAI account",catalogCache:"From the last successful xAI listing",catalogFallback:"Built-in Grok baseline (live listing unavailable)",catalogError:"Could not refresh the live Grok model list.",selectAll:"Show all",modelHint:"Checked models appear in the model picker as",grokTitle:"xAI Grok Build",grokDescription:"SuperGrok / X Premium coding subscription through the Grok Build endpoint.",codexTitle:"OpenAI Codex",codexDescription:"ChatGPT Plus/Pro Codex entitlement. Device code is recommended for a remote DSH host.",kimiTitle:"Kimi Code",kimiDescription:"Kimi Code membership through auth.kimi.com and api.kimi.com/coding; this is not the Moonshot API-key platform.",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth with Claude Code scopes and automatic refresh.",antigravityTitle:"Google Antigravity",antigravityDescription:"Provided by the separately pinned MIT dsh-agy plugin and exposed as the agy route.",antigravityInstalled:"Installed (CLI-managed)",antigravityMissing:"Not installed",antigravityCliHint:"The unauthenticated dsh-agy web export dashboard is disabled. Manage Google OAuth with the profile-local CLI when needed.",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"Pull a copy from official CLI files",sourcesIntro:"dsh can discover a local official CLI login and pull a one-way copy into its own store. Official CLI files stay read-only and are never modified.",sourcesReadOnlyHint:"This is a one-way pull of a copy. dsh does not update, replace, or write back the official CLI documents.",sourcesLoading:"Looking for official CLI login files\u2026",sourcesCheckAgain:"Check again",sourcesAvailable:"A readable copy is available",sourcesUnavailable:"No usable copy found",sourcesAllMissingHint:"No official CLI login files were found on this host. That is normal on a remote DSH machine \u2014 use device-code sign-in instead, or check again after logging in on this same host.",sourcesAvailableHint:"An official CLI login was found on this host. You can pull a one-way copy into dsh from a provider card.",sourcesPullCopy:"Pull a copy",remoteAccountsTip:"This Settings page looks remote (not loopback). Prefer device-code sign-in; browser pop-ups and local PKCE callbacks often fail from another machine.",remoteTipDismiss:"Dismiss",sourcesPreviewTitle:"Review this copy before saving it in dsh",sourcesPreviewExpires:"CLI credential expiry: {time}",sourcesTicketExpires:"This preview expires at {time}",sourcesConflict:"Stored dsh credential: {detail}",sourcesAction:"If you continue: {detail}",sourcesWarnings:"Notes",sourcesConfirmOverwrite:"Replace the credential already stored in dsh with this copy",sourcesConfirmOverwriteHint:"A different credential is already stored. Check the box, then confirm the pull.",sourcesCommit:"Confirm pull",sourcesCancelPreview:"Cancel preview",sourcesCommitSuccess:"Copied into dsh ({action}).",sourcesPreviewFailed:"Could not prepare a copy from that CLI file.",sourcesCommitFailed:"Could not save the copy in dsh.",sourcesLoadFailed:"Could not look for official CLI login files.",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"No official CLI file was found at the expected location.",sourceReasonUnsafe:"The official CLI file is not safe to read (permissions or file type).",sourceReasonInvalid:"The official CLI file is present but is not a usable OAuth login.",sourceReasonTooLarge:"The official CLI file is larger than the allowed read limit.",sourceConflictNone:"dsh has no stored credential yet",sourceConflictSameCredential:"same credential already stored",sourceConflictSameAccount:"same account, different credential",sourceConflictDifferentAccount:"a different account is already stored",sourceConflictUnknownAccount:"an existing credential is stored (account could not be compared)",sourceConflictUnreadableDestination:"the stored dsh credential could not be read",sourceConflictUnsafeDestination:"the stored dsh credential file is not safe to replace",sourceConflictUnrecognized:"the stored credential needs a review",sourceActionImport:"save this copy in dsh",sourceActionReuse:"keep the stored dsh credential (it already matches)",sourceActionOverwrite:"replace the stored dsh credential",sourceActionBlocked:"blocked \u2014 the stored dsh file cannot be replaced from here",sourceActionUnrecognized:"needs a review",sourceCommitImported:"saved",sourceCommitUnchanged:"already matched",sourceCommitOverwritten:"replaced",capabilitiesTitle:"Subscription capabilities",capabilitiesIntro:"Every switch starts off. Turning one on uses that vendor\u2019s subscription quota, not a separate API-key bill.",capabilitiesQuotaHint:"Search, images, edits, Fast, usage, and Grok Imagine all consume the matching subscription quota when they run.",capabilitiesReadOnly:"These switches are read-only in this deployment.",capabilitiesLoading:"Loading capability settings\u2026",capabilitiesLoadFailed:"Could not load capability settings.",capabilitiesSaveFailed:"Could not save that capability setting.",capabilitiesConflictRefreshed:"Those settings changed elsewhere. The page was refreshed; try again.",capabilityLimitsTitle:"Capability limits",capabilityLimitsHint:"Limits apply live to newly started operations and remain within the audited safety bounds.",capSearchResults:"Maximum search results",capSearchResultsHint:"Codex search returns at most this many results (1\u201320).",capImageCount:"Maximum images per call",capImageCountHint:"Codex and Imagine image tools can return at most this many images (1\u20134).",capVideoTtlHours:"Video artifact retention (hours)",capVideoTtlHoursHint:"Completed Imagine video artifacts are kept for 1\u2013168 hours. Lowering retention cleans older artifacts immediately; raising it applies to new artifacts.",capabilityLimitInvalid:"Enter a whole number from {min} through {max}.",capCodexSearch:"Codex subscription search",capCodexSearchHint:"Optional search using Codex quota.",capCodexImages:"Codex images",capCodexImagesHint:"Generate images with ChatGPT/Codex quota.",capCodexImageEdits:"Codex image edits",capCodexImageEditsHint:"Edit images; requires Codex images.",capCodexImagesAnyModel:"Allow any model to use image tools",capCodexImagesAnyModelHint:"Let non-Codex routes also call image generate/edit. Still uses your ChatGPT/Codex quota and requires Codex sign-in.",capCodexUsage:"Show Codex quota",capCodexUsageHint:"Show remaining quota on the Codex account card when available.",capCodexFast:"Fast requested",capCodexFastHint:"Publish the Fast route when the live catalog confirms priority eligibility.",capGrokImagineImage:"Grok Imagine images",capGrokImagineImageHint:"Needs a separate Imagine credential (not Grok OAuth alone).",capGrokImagineVideo:"Grok Imagine video",capGrokImagineVideoHint:"Needs a separate Imagine credential (not Grok OAuth alone).",usageTitle:"Codex quota",usageLoading:"Loading Codex quota\u2026",usageUnavailable:"Codex quota is not available right now.",usageEmpty:"The vendor did not return any displayable quota fields.",usageFetchedAt:"Last read: {time}",usageRateLimit:"Rate limit",usageWindow:"{seconds}s window",usageUsed:"Used {value}",usageRemaining:"Remaining {value}",usageResets:"Resets {time}",usageCredits:"Credits",usageCreditsUnlimited:"Unlimited credits",usageCreditsLimited:"Limited credits",usageBalance:"Balance {value}",usageIndividualLimit:"Individual limit",usageLimit:"Limit {value}",usageUsedAmount:"Used {value}",usageRemainingAmount:"Remaining {value}",usageSpendControlReached:"Spend control has been reached.",usageResetCredits:"Reset credits available: {value}",imagineTitle:"Grok Imagine credential",imagineIntro:"Official Imagine calls use an xAI API credential (for example $XAI_API_KEY). That key is separate from a Grok Build OAuth login and is never shown here.",imagineLoading:"Checking the Imagine credential\u2026",imagineLoadFailed:"Could not read the Imagine credential status.",imagineConfigured:"An Imagine credential is configured",imagineNotConfigured:"No Imagine credential is configured",imagineSource:"Source: {source}",imagineWritable:"This deployment can update the Imagine credential store.",imagineReadOnly:"This deployment cannot update the Imagine credential store.",imagineSourceNone:"none",imagineSourceEnv:"environment variable",imagineSourceApiKey:"stored API key",imagineSourceOAuth:"OAuth access (only if Imagine accepted it)",imagineSourceCliKey:"Grok CLI key field",imagineSourceUnknown:"configured (details withheld)",tabAccounts:"Accounts",tabCapabilities:"Capabilities",tabGateway:"Gateway",tabAbout:"About",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",modelsSummary:"{selected}/{total} models visible",expandModels:"Models",collapseModels:"Hide models",usageUsedShort:"Used {value}",gatewayTitle:"Local API gateway",gatewayIntro:"Loopback OpenAI/Anthropic-compatible server for your own tools. Off until you enable it.",gatewayWarning:"Exposes signed-in subscriptions as a local API. Can violate provider terms and uses quota.",gatewayLoopbackHint:"Binds to loopback only. Do not port-forward or expose this gateway on a public interface.",gatewayEnableConfirm:"Enable the local API gateway? It exposes your signed-in subscriptions to tools on this host and consumes provider quota.",gatewayEnableConfirmAction:"Confirm",gatewayEnableCancel:"Cancel",gatewayEnabled:"Enable local gateway",gatewayOpencodeGoEnabled:"Proxy chat to OpenCode Go",gatewayOpencodeGoHint:"When on, POST /v1/chat/completions is forwarded to OpenCode Go with a sticky session header. Set the gateway Bearer key to your OpenCode API key. Default off. Follow OpenCode terms; this still consumes your OpenCode quota.",gatewayBind:"Bind",gatewayPort:"Port",gatewayPortHint:"Integer from 1024 through 65535. Apply to save; Random fills a high port, then Apply.",gatewayPortApply:"Apply",gatewayPortRandom:"Random",gatewayPortInvalid:"Enter a whole port number from 1024 through 65535.",gatewayAddress:"Gateway address",gatewayOpenAiUrl:"OpenAI-compatible base URL",gatewayAnthropicUrl:"Anthropic-compatible base URL",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"Copy uses the current key. Rotate only if you want to invalidate existing clients.",gatewayCopyKey:"Copy key",gatewayShowKey:"Show",gatewayHideKey:"Hide",gatewayRevealFailed:"Could not read the current key.",gatewayRotateConfirm:"Rotate the key? Existing clients will stop working.",gatewayRotateConfirmHint:"This replaces the current Bearer key.",gatewayRotateConfirmAction:"Confirm rotate",gatewayRotateCancel:"Cancel",gatewayRunning:"Listening",gatewayStopped:"Not listening",gatewayRotate:"Rotate API key",gatewayRotated:"New key (shown once): {key}",gatewayLoadFailed:"Could not load gateway settings.",gatewaySaveFailed:"Could not update the gateway.",gatewayLoading:"Loading gateway settings\u2026",gatewayModelsReady:"{count} executable model(s) available. Snippets use {model}.",gatewayModelsUnavailable:"No signed-in provider currently exposes an executable gateway model.",gatewayKeyConfigured:"A real Bearer key is configured. Reveal it before copying an executable snippet.",gatewayKeyNotConfigured:"No Bearer key is configured yet.",remoteLoginHelp:"On a remote DSH host, open Settings here and use device-code sign-in for each provider. Complete the code on any browser that can reach the provider, then return to chat and pick the provider route model.",pluginVersion:"Plugin version {version}",aboutTitle:"About",aboutDocsHint:"See the plugin README and INSTALL docs in the repository for setup, supported providers, and gateway safety notes.",aboutDocsLink:"Open README on GitHub",otherLoginMethods:"Other sign-in methods",hideOtherLoginMethods:"Hide other methods",signInStepOpen:"Open the provider authorization page",signInStepCode:"Enter the device code when prompted",signInStepWait:"Waiting for authorization to complete",copyUserCode:"Copy code",openAuthUrl:"Open authorization page",modelFilterPlaceholder:"Filter models\u2026",modelFilterLabel:"Filter models for {provider}",applyModelDraft:"Apply model selection",modelDraftPending:"Selection changed locally. Apply once to save.",deselectAll:"Hide all",resetModelsDefault:"Reset selection",requiresCodexImages:"Turn on Codex images first.",requiresCodexSignIn:"Sign in to OpenAI Codex first.",requiresImagineCredential:"Configure the separate Grok Imagine credential first.",openCodexAccount:"Open Codex account",focusCodexImages:"Go to Codex images",focusImagineCredential:"View Imagine credential status",gatewaySnippetsTitle:"Quick setup snippets",gatewaySnippetsUnavailable:"Reveal the real key and sign in to at least one provider before snippets are shown.",gatewaySnippetCurl:"cURL",gatewaySnippetPython:"Python (OpenAI SDK)",gatewaySnippetIde:"IDE / client",tabAccountsSignedIn:"{count} signed in",coinstallTitle:"Managed by Usage Center",coinstallSummary:"Usage Center is the active OAuth owner. {count} provider account(s) are currently signed in.",coinstallOpenHub:"Open Usage Center",tabGatewayActive:"Running",accountsListHint:"Saved subscription accounts on this machine (tokens are never shown):",accountActive:"Default",accountSetDefault:"Set default",accountRemove:"Remove",accountsEmpty:"No saved accounts yet."},Ni={nav:"\u7F16\u7801 OAuth",title:"\u7F16\u7801\u8BA2\u9605\u8D26\u6237",intro:"\u5728 dsh \u4E2D\u4F7F\u7528\u81EA\u5DF1\u7684 Grok Build\u3001ChatGPT Codex\u3001Kimi Code \u548C Claude Code \u8BA2\u9605\uFF1B\u73B0\u6709 API-key \u8DEF\u7531\u7EE7\u7EED\u72EC\u7ACB\u4FDD\u7559\u3002",termsWarning:"\u8FD9\u4E9B\u662F\u8BA2\u9605\u670D\u52A1\u7684\u975E\u5B98\u65B9\u7B2C\u4E09\u65B9\u96C6\u6210\uFF0C\u4ECD\u53D7\u4F9B\u5E94\u5546\u6761\u6B3E\u3001\u914D\u989D\u3001\u5730\u533A\u9650\u5236\u548C\u8D26\u53F7\u98CE\u63A7\u7EA6\u675F\u3002",loadingAccount:"\u6B63\u5728\u52A0\u8F7D\u8D26\u6237\u2026",signedOut:"\u5C1A\u672A\u767B\u5F55",signingIn:"\u6B63\u5728\u7B49\u5F85\u6388\u6743\u2026",signedIn:"\u5DF2\u767B\u5F55",requestFailed:"\u8D26\u6237\u8BF7\u6C42\u5931\u8D25\u3002",retry:"\u91CD\u8BD5",cancel:"\u53D6\u6D88",logout:"\u9000\u51FA\u767B\u5F55",logoutConfirmTitle:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55",logoutConfirmHint:"\u786E\u5B9A\u5728 dsh \u4E2D\u9000\u51FA\u6B64\u4F9B\u5E94\u5546\uFF1F\u4F9B\u5E94\u5546\u8D26\u53F7\u672C\u8EAB\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",logoutConfirmAction:"\u786E\u8BA4\u9000\u51FA",working:"\u5904\u7406\u4E2D\u2026",cancelLogin:"\u53D6\u6D88\u767B\u5F55",deviceLogin:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55",deviceLoginRemote:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF08\u9002\u5408\u8FDC\u7A0B\uFF09",browserLogin:"\u5728\u6D4F\u89C8\u5668\u4E2D\u767B\u5F55",pkceLogin:"\u4F7F\u7528\u6388\u6743\u7801\u767B\u5F55",userCode:"\u4F9B\u5E94\u5546\u8981\u6C42\u8F93\u5165\u4EE3\u7801\u65F6\uFF0C\u8BF7\u8F93\u5165\uFF1A",openUrl:"\u8BF7\u5728\u6B64\u5B8C\u6210\u767B\u5F55\uFF1A",popupBlocked:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u767B\u5F55\u7A97\u53E3\uFF0C\u8BF7\u624B\u52A8\u6253\u5F00\uFF1A",pasteCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\u3002\u672C\u5730 PKCE \u4EC5\u5728\u56DE\u8C03\u65E0\u6CD5\u5230\u8FBE\u8FD9\u53F0 DSH \u4E3B\u673A\u65F6\u4F7F\u7528\uFF1A",pasteBrowserCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\uFF0C\u4EE5\u5B8C\u6210\u6B64\u6B21\u6D4F\u89C8\u5668\u767B\u5F55\uFF1A",pasteCodePlaceholder:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",pasteCodeLabel:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",submitCode:"\u63D0\u4EA4 code",importGrok:"\u4ECE Grok CLI \u5BFC\u5165",importHint:"\u628A ~/.grok/auth.json \u590D\u5236\u8FDB dsh\uFF1B\u4E4B\u540E dsh \u5237\u65B0 token \u53EF\u80FD\u8BA9 Grok CLI \u6389\u7EBF\u3002",models:"\u53EF\u89C1\u6A21\u578B",catalogLive:"\u6765\u81EA\u5F53\u524D xAI \u8D26\u53F7",catalogCache:"\u6765\u81EA\u4E0A\u4E00\u6B21\u6210\u529F\u62C9\u53D6\u7684 xAI \u5217\u8868",catalogFallback:"\u5185\u7F6E Grok \u57FA\u7EBF\u76EE\u5F55\uFF08\u7EBF\u4E0A\u5217\u8868\u4E0D\u53EF\u7528\uFF09",catalogError:"\u65E0\u6CD5\u5237\u65B0\u7EBF\u4E0A Grok \u6A21\u578B\u5217\u8868\u3002",selectAll:"\u5168\u90E8\u663E\u793A",modelHint:"\u52FE\u9009\u6A21\u578B\u4F1A\u4EE5\u8BE5\u524D\u7F00\u51FA\u73B0\u5728\u6A21\u578B\u9009\u62E9\u5668\uFF1A",grokTitle:"xAI Grok Build",grokDescription:"\u901A\u8FC7 Grok Build \u7AEF\u70B9\u4F7F\u7528 SuperGrok / X Premium \u7F16\u7801\u8BA2\u9605\u3002",codexTitle:"OpenAI Codex",codexDescription:"\u4F7F\u7528 ChatGPT Plus/Pro \u7684 Codex \u6743\u76CA\uFF1B\u8FDC\u7A0B DSH \u4E3B\u673A\u63A8\u8350\u8BBE\u5907\u7801\u767B\u5F55\u3002",kimiTitle:"Kimi Code",kimiDescription:"\u901A\u8FC7 auth.kimi.com \u4E0E api.kimi.com/coding \u4F7F\u7528 Kimi Code \u4F1A\u5458\uFF1B\u4E0D\u662F Moonshot API-key \u5F00\u653E\u5E73\u53F0\u3002",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth\uFF0C\u5305\u542B Claude Code scope \u548C\u81EA\u52A8\u5237\u65B0\u3002",antigravityTitle:"Google Antigravity",antigravityDescription:"\u7531\u5355\u72EC\u56FA\u5B9A\u7248\u672C\u7684 MIT \u5F00\u6E90 dsh-agy \u63D2\u4EF6\u63D0\u4F9B\uFF0C\u5BF9\u5916\u8DEF\u7531\u4E3A agy\u3002",antigravityInstalled:"\u5DF2\u5B89\u88C5\uFF08CLI \u7BA1\u7406\uFF09",antigravityMissing:"\u5C1A\u672A\u5B89\u88C5",antigravityCliHint:"\u4E3A\u907F\u514D\u66B4\u9732\u65E0\u8BA4\u8BC1\u7684\u51ED\u636E\u5BFC\u51FA\u9875\u9762\uFF0C\u9ED8\u8BA4\u7981\u7528 dsh-agy Web \u7BA1\u7406\u9875\uFF1B\u9700\u8981\u65F6\u4F7F\u7528 profile \u5185 CLI \u7BA1\u7406 Google OAuth\u3002",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"\u4ECE\u5B98\u65B9 CLI \u6587\u4EF6\u62C9\u53D6\u526F\u672C",sourcesIntro:"dsh \u53EF\u4EE5\u81EA\u52A8\u53D1\u73B0\u672C\u673A\u5B98\u65B9 CLI \u767B\u5F55\uFF0C\u5E76\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230\u81EA\u5DF1\u7684\u5B58\u50A8\u3002\u5B98\u65B9 CLI \u6587\u4EF6\u4FDD\u6301\u53EA\u8BFB\uFF0C\u7EDD\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",sourcesReadOnlyHint:"\u8FD9\u662F\u5355\u5411\u62C9\u53D6\u526F\u672C\u3002dsh \u4E0D\u4F1A\u66F4\u65B0\u3001\u8986\u76D6\u6216\u56DE\u5199\u5B98\u65B9 CLI \u6587\u6863\u3002",sourcesLoading:"\u6B63\u5728\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u2026",sourcesCheckAgain:"\u518D\u68C0\u67E5\u4E00\u6B21",sourcesAvailable:"\u53EF\u4EE5\u8BFB\u53D6\u4E00\u4EFD\u526F\u672C",sourcesUnavailable:"\u6CA1\u6709\u53EF\u7528\u7684\u526F\u672C",sourcesAllMissingHint:"\u8FD9\u53F0\u4E3B\u673A\u4E0A\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002\u8FDC\u7A0B DSH \u4E0A\u8FD9\u5F88\u5E38\u89C1\u2014\u2014\u8BF7\u6539\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u82E5\u5DF2\u5728\u672C\u673A CLI \u767B\u5F55\uFF0C\u53EF\u518D\u68C0\u67E5\u4E00\u6B21\u3002",sourcesAvailableHint:"\u672C\u673A\u53D1\u73B0\u4E86\u5B98\u65B9 CLI \u767B\u5F55\u3002\u53EF\u5728\u5BF9\u5E94\u8D26\u6237\u5361\u7247\u91CC\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230 dsh\u3002",sourcesPullCopy:"\u62C9\u53D6\u526F\u672C",remoteAccountsTip:"\u5F53\u524D Settings \u9875\u9762\u770B\u8D77\u6765\u662F\u8FDC\u7A0B\u8BBF\u95EE\uFF08\u975E\u672C\u673A\u56DE\u73AF\uFF09\u3002\u8BF7\u4F18\u5148\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u4ECE\u53E6\u4E00\u53F0\u673A\u5668\u6253\u5F00\u65F6\uFF0C\u6D4F\u89C8\u5668\u5F39\u7A97\u548C\u672C\u5730 PKCE \u56DE\u8C03\u7ECF\u5E38\u4F1A\u5931\u8D25\u3002",remoteTipDismiss:"\u77E5\u9053\u4E86",sourcesPreviewTitle:"\u5148\u6838\u5BF9\u8FD9\u4EFD\u526F\u672C\uFF0C\u518D\u5199\u5165 dsh",sourcesPreviewExpires:"CLI \u51ED\u636E\u5230\u671F\u65F6\u95F4\uFF1A{time}",sourcesTicketExpires:"\u6B64\u6B21\u9884\u89C8\u5C06\u4E8E {time} \u5931\u6548",sourcesConflict:"dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF1A{detail}",sourcesAction:"\u82E5\u7EE7\u7EED\uFF1A{detail}",sourcesWarnings:"\u8BF4\u660E",sourcesConfirmOverwrite:"\u7528\u8FD9\u4EFD\u526F\u672C\u66FF\u6362 dsh \u4E2D\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E",sourcesConfirmOverwriteHint:"dsh \u91CC\u5DF2\u6709\u53E6\u4E00\u4EFD\u51ED\u636E\u3002\u8BF7\u5148\u52FE\u9009\uFF0C\u518D\u786E\u8BA4\u62C9\u53D6\u3002",sourcesCommit:"\u786E\u8BA4\u62C9\u53D6",sourcesCancelPreview:"\u53D6\u6D88\u9884\u89C8",sourcesCommitSuccess:"\u5DF2\u590D\u5236\u5230 dsh\uFF08{action}\uFF09\u3002",sourcesPreviewFailed:"\u65E0\u6CD5\u4ECE\u8BE5 CLI \u6587\u4EF6\u51C6\u5907\u526F\u672C\u3002",sourcesCommitFailed:"\u65E0\u6CD5\u628A\u526F\u672C\u4FDD\u5B58\u5230 dsh\u3002",sourcesLoadFailed:"\u65E0\u6CD5\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"\u5728\u9884\u671F\u4F4D\u7F6E\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u6587\u4EF6\u3002",sourceReasonUnsafe:"\u5B98\u65B9 CLI \u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u65E0\u6CD5\u8BFB\u53D6\uFF08\u6743\u9650\u6216\u6587\u4EF6\u7C7B\u578B\uFF09\u3002",sourceReasonInvalid:"\u5B98\u65B9 CLI \u6587\u4EF6\u5B58\u5728\uFF0C\u4F46\u4E0D\u662F\u53EF\u7528\u7684 OAuth \u767B\u5F55\u3002",sourceReasonTooLarge:"\u5B98\u65B9 CLI \u6587\u4EF6\u8D85\u8FC7\u5141\u8BB8\u7684\u8BFB\u53D6\u4E0A\u9650\u3002",sourceConflictNone:"dsh \u5C1A\u672A\u4FDD\u5B58\u51ED\u636E",sourceConflictSameCredential:"\u5DF2\u4FDD\u5B58\u540C\u4E00\u4EFD\u51ED\u636E",sourceConflictSameAccount:"\u540C\u4E00\u8D26\u53F7\uFF0C\u4F46\u51ED\u636E\u4E0D\u540C",sourceConflictDifferentAccount:"\u5DF2\u4FDD\u5B58\u53E6\u4E00\u4E2A\u8D26\u53F7",sourceConflictUnknownAccount:"\u5DF2\u4FDD\u5B58\u51ED\u636E\uFF08\u65E0\u6CD5\u6BD4\u8F83\u8D26\u53F7\uFF09",sourceConflictUnreadableDestination:"\u65E0\u6CD5\u8BFB\u53D6 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceConflictUnsafeDestination:"dsh \u4E2D\u7684\u51ED\u636E\u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362",sourceConflictUnrecognized:"\u5DF2\u5B58\u51ED\u636E\u9700\u8981\u6838\u5BF9",sourceActionImport:"\u628A\u8FD9\u4EFD\u526F\u672C\u4FDD\u5B58\u5230 dsh",sourceActionReuse:"\u4FDD\u7559 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF08\u5185\u5BB9\u5DF2\u76F8\u540C\uFF09",sourceActionOverwrite:"\u66FF\u6362 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceActionBlocked:"\u5DF2\u963B\u6B62 \u2014 \u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362 dsh \u4E2D\u7684\u6587\u4EF6",sourceActionUnrecognized:"\u9700\u8981\u6838\u5BF9",sourceCommitImported:"\u5DF2\u4FDD\u5B58",sourceCommitUnchanged:"\u539F\u672C\u5C31\u76F8\u540C",sourceCommitOverwritten:"\u5DF2\u66FF\u6362",capabilitiesTitle:"\u8BA2\u9605\u80FD\u529B",capabilitiesIntro:"\u6240\u6709\u5F00\u5173\u9ED8\u8BA4\u5173\u95ED\u3002\u6253\u5F00\u540E\u6D88\u8017\u7684\u662F\u5BF9\u5E94\u4F9B\u5E94\u5546\u7684\u8BA2\u9605\u914D\u989D\uFF0C\u4E0D\u662F\u53E6\u4E00\u5957 API-key \u8D26\u5355\u3002",capabilitiesQuotaHint:"\u641C\u7D22\u3001\u51FA\u56FE\u3001\u6539\u56FE\u3001Fast\u3001\u989D\u5EA6\u5C55\u793A\u548C Grok Imagine \u5728\u5B9E\u9645\u8C03\u7528\u65F6\u90FD\u4F1A\u6D88\u8017\u5BF9\u5E94\u8BA2\u9605\u914D\u989D\u3002",capabilitiesReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E2D\u8FD9\u4E9B\u5F00\u5173\u4E3A\u53EA\u8BFB\u3002",capabilitiesLoading:"\u6B63\u5728\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u2026",capabilitiesLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesSaveFailed:"\u65E0\u6CD5\u4FDD\u5B58\u8BE5\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesConflictRefreshed:"\u8FD9\u4E9B\u8BBE\u7F6E\u5DF2\u5728\u522B\u5904\u88AB\u6539\u8FC7\u3002\u9875\u9762\u5DF2\u5237\u65B0\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002",capabilityLimitsTitle:"\u80FD\u529B\u9650\u5236",capabilityLimitsHint:"\u9650\u5236\u4F1A\u5B9E\u65F6\u5E94\u7528\u4E8E\u65B0\u53D1\u8D77\u7684\u64CD\u4F5C\uFF0C\u5E76\u59CB\u7EC8\u4FDD\u6301\u5728\u5DF2\u5BA1\u8BA1\u7684\u5B89\u5168\u8303\u56F4\u5185\u3002",capSearchResults:"\u6700\u591A\u641C\u7D22\u7ED3\u679C\u6570",capSearchResultsHint:"Codex \u641C\u7D22\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u6761\u7ED3\u679C\uFF081\u201320\uFF09\u3002",capImageCount:"\u5355\u6B21\u6700\u591A\u56FE\u7247\u6570",capImageCountHint:"Codex \u4E0E Imagine \u56FE\u7247\u5DE5\u5177\u5355\u6B21\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u5F20\u56FE\u7247\uFF081\u20134\uFF09\u3002",capVideoTtlHours:"\u89C6\u9891\u4EA7\u7269\u4FDD\u7559\u65F6\u95F4\uFF08\u5C0F\u65F6\uFF09",capVideoTtlHoursHint:"Imagine \u89C6\u9891\u4EA7\u7269\u4FDD\u7559 1\u2013168 \u5C0F\u65F6\uFF1B\u964D\u4F4E\u4FDD\u7559\u65F6\u95F4\u4F1A\u7ACB\u5373\u6E05\u7406\u8FC7\u671F\u65E7\u4EA7\u7269\uFF0C\u63D0\u9AD8\u53EA\u5F71\u54CD\u65B0\u4EA7\u7269\u3002",capabilityLimitInvalid:"\u8BF7\u8F93\u5165 {min} \u5230 {max} \u4E4B\u95F4\u7684\u6574\u6570\u3002",capCodexSearch:"Codex \u8BA2\u9605\u641C\u7D22",capCodexSearchHint:"\u53EF\u9009\u641C\u7D22\uFF0C\u6D88\u8017 Codex \u914D\u989D\u3002",capCodexImages:"Codex \u51FA\u56FE",capCodexImagesHint:"\u7528 ChatGPT/Codex \u914D\u989D\u51FA\u56FE\u3002",capCodexImageEdits:"Codex \u6539\u56FE",capCodexImageEditsHint:"\u6539\u56FE\uFF1B\u9700\u5148\u6253\u5F00 Codex \u51FA\u56FE\u3002",capCodexImagesAnyModel:"\u5141\u8BB8\u4EFB\u610F\u6A21\u578B\u8C03\u7528\u51FA\u56FE\u5DE5\u5177",capCodexImagesAnyModelHint:"\u975E Codex \u6E20\u9053\u7684\u6A21\u578B\u4E5F\u53EF\u8C03\u7528\u56FE\u7247\u751F\u6210/\u7F16\u8F91\u3002\u4ECD\u6D88\u8017 ChatGPT/Codex \u914D\u989D\uFF0C\u4E14\u9700\u767B\u5F55 Codex\u3002",capCodexUsage:"\u663E\u793A Codex \u989D\u5EA6",capCodexUsageHint:"\u6709\u6570\u636E\u65F6\u5728 Codex \u8D26\u6237\u5361\u7247\u4E0A\u663E\u793A\u5269\u4F59\u989D\u5EA6\u3002",capCodexFast:"\u5DF2\u8BF7\u6C42 Fast",capCodexFastHint:"\u5728\u7EBF\u76EE\u5F55\u786E\u8BA4\u4F18\u5148\u8D44\u683C\u540E\u53D1\u5E03 Fast \u8DEF\u7531\u3002",capGrokImagineImage:"Grok Imagine \u51FA\u56FE",capGrokImagineImageHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",capGrokImagineVideo:"Grok Imagine \u51FA\u89C6\u9891",capGrokImagineVideoHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",usageTitle:"Codex \u989D\u5EA6",usageLoading:"\u6B63\u5728\u52A0\u8F7D Codex \u989D\u5EA6\u2026",usageUnavailable:"\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6 Codex \u989D\u5EA6\u3002",usageEmpty:"\u4F9B\u5E94\u5546\u6CA1\u6709\u8FD4\u56DE\u53EF\u5C55\u793A\u7684\u989D\u5EA6\u5B57\u6BB5\u3002",usageFetchedAt:"\u6700\u8FD1\u8BFB\u53D6\uFF1A{time}",usageRateLimit:"\u901F\u7387\u9650\u5236",usageWindow:"{seconds} \u79D2\u7A97\u53E3",usageUsed:"\u5DF2\u7528 {value}",usageRemaining:"\u5269\u4F59 {value}",usageResets:"\u91CD\u7F6E\u65F6\u95F4 {time}",usageCredits:"\u79EF\u5206",usageCreditsUnlimited:"\u65E0\u9650\u79EF\u5206",usageCreditsLimited:"\u6709\u9650\u79EF\u5206",usageBalance:"\u4F59\u989D {value}",usageIndividualLimit:"\u4E2A\u4EBA\u989D\u5EA6",usageLimit:"\u4E0A\u9650 {value}",usageUsedAmount:"\u5DF2\u7528 {value}",usageRemainingAmount:"\u5269\u4F59 {value}",usageSpendControlReached:"\u5DF2\u8FBE\u5230\u652F\u51FA\u63A7\u5236\u4E0A\u9650\u3002",usageResetCredits:"\u53EF\u7528\u91CD\u7F6E\u6B21\u6570\uFF1A{value}",imagineTitle:"Grok Imagine \u51ED\u636E",imagineIntro:"\u5B98\u65B9 Imagine \u8C03\u7528\u4F7F\u7528 xAI API \u51ED\u636E\uFF08\u4F8B\u5982 $XAI_API_KEY\uFF09\u3002\u5B83\u4E0E Grok Build OAuth \u767B\u5F55\u4E0D\u662F\u540C\u4E00\u4EFD\u51ED\u636E\uFF0C\u8FD9\u91CC\u4E5F\u4E0D\u4F1A\u663E\u793A\u5BC6\u94A5\u3002",imagineLoading:"\u6B63\u5728\u68C0\u67E5 Imagine \u51ED\u636E\u2026",imagineLoadFailed:"\u65E0\u6CD5\u8BFB\u53D6 Imagine \u51ED\u636E\u72B6\u6001\u3002",imagineConfigured:"\u5DF2\u914D\u7F6E Imagine \u51ED\u636E",imagineNotConfigured:"\u5C1A\u672A\u914D\u7F6E Imagine \u51ED\u636E",imagineSource:"\u6765\u6E90\uFF1A{source}",imagineWritable:"\u5F53\u524D\u90E8\u7F72\u53EF\u4EE5\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E0D\u80FD\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineSourceNone:"\u65E0",imagineSourceEnv:"\u73AF\u5883\u53D8\u91CF",imagineSourceApiKey:"\u5DF2\u4FDD\u5B58\u7684 API key",imagineSourceOAuth:"OAuth access\uFF08\u4EC5\u5F53 Imagine \u63A5\u53D7\u65F6\uFF09",imagineSourceCliKey:"Grok CLI \u7684 key \u5B57\u6BB5",imagineSourceUnknown:"\u5DF2\u914D\u7F6E\uFF08\u7EC6\u8282\u4E0D\u5C55\u793A\uFF09",tabAccounts:"\u8D26\u6237",tabCapabilities:"\u80FD\u529B",tabGateway:"\u7F51\u5173",tabAbout:"\u5173\u4E8E",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",modelsSummary:"\u5DF2\u663E\u793A {selected}/{total} \u4E2A\u6A21\u578B",expandModels:"\u6A21\u578B",collapseModels:"\u6536\u8D77\u6A21\u578B",usageUsedShort:"\u5DF2\u7528 {value}",gatewayTitle:"\u672C\u5730 API \u7F51\u5173",gatewayIntro:"\u672C\u673A loopback \u4E0A\u7684 OpenAI/Anthropic \u517C\u5BB9\u670D\u52A1\uFF0C\u4F9B\u4F60\u81EA\u5DF1\u7684\u5DE5\u5177\u4F7F\u7528\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",gatewayWarning:"\u6253\u5F00\u540E\u4F1A\u628A\u5DF2\u767B\u5F55\u8BA2\u9605\u66B4\u9732\u6210\u672C\u5730 API\u3002\u53EF\u80FD\u8FDD\u53CD\u4F9B\u5E94\u5546\u6761\u6B3E\u5E76\u6D88\u8017\u914D\u989D\u3002",gatewayLoopbackHint:"\u4EC5\u7ED1\u5B9A\u672C\u673A\u56DE\u73AF\u5730\u5740\u3002\u8BF7\u52FF\u505A\u7AEF\u53E3\u8F6C\u53D1\uFF0C\u4E5F\u4E0D\u8981\u628A\u5B83\u66B4\u9732\u5230\u516C\u7F51\u3002",gatewayEnableConfirm:"\u8981\u542F\u7528\u672C\u5730 API \u7F51\u5173\u5417\uFF1F\u5B83\u4F1A\u628A\u5DF2\u767B\u5F55\u7684\u8BA2\u9605\u66B4\u9732\u7ED9\u672C\u673A\u5DE5\u5177\uFF0C\u5E76\u6D88\u8017\u4F9B\u5E94\u5546\u914D\u989D\u3002",gatewayEnableConfirmAction:"\u786E\u8BA4\u542F\u7528",gatewayEnableCancel:"\u53D6\u6D88",gatewayEnabled:"\u542F\u7528\u672C\u5730\u7F51\u5173",gatewayOpencodeGoEnabled:"\u5C06\u804A\u5929\u4EE3\u7406\u5230 OpenCode Go",gatewayOpencodeGoHint:"\u5F00\u542F\u540E\uFF0CPOST /v1/chat/completions \u4F1A\u8F6C\u53D1\u5230 OpenCode Go\uFF0C\u5E76\u5E26\u4E0A\u7C98\u6027\u4F1A\u8BDD\u5934\u3002\u8BF7\u628A\u7F51\u5173 Bearer key \u8BBE\u4E3A\u4F60\u7684 OpenCode API key\u3002\u9ED8\u8BA4\u5173\u95ED\u3002\u8BF7\u9075\u5B88 OpenCode \u6761\u6B3E\uFF1B\u4ECD\u4F1A\u6D88\u8017\u4F60\u7684 OpenCode \u914D\u989D\u3002",gatewayBind:"\u7ED1\u5B9A\u5730\u5740",gatewayPort:"\u7AEF\u53E3",gatewayPortHint:"1024\u201365535 \u7684\u6574\u6570\u3002\u6539\u5B8C\u70B9\u786E\u5B9A\u4FDD\u5B58\uFF1B\u968F\u673A\u4F1A\u586B\u4E00\u4E2A\u9AD8\u4F4D\u7AEF\u53E3\uFF0C\u4ECD\u9700\u786E\u5B9A\u3002",gatewayPortApply:"\u786E\u5B9A",gatewayPortRandom:"\u968F\u673A",gatewayPortInvalid:"\u8BF7\u8F93\u5165 1024 \u5230 65535 \u4E4B\u95F4\u7684\u6574\u6570\u7AEF\u53E3\u3002",gatewayAddress:"\u7F51\u5173\u5730\u5740",gatewayOpenAiUrl:"OpenAI \u517C\u5BB9\u5730\u5740",gatewayAnthropicUrl:"Anthropic \u517C\u5BB9\u5730\u5740",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"\u590D\u5236\u7684\u662F\u5F53\u524D key\u3002\u53EA\u6709\u8981\u4F5C\u5E9F\u5DF2\u6709\u5BA2\u6237\u7AEF\u65F6\u624D\u8F6E\u6362\u3002",gatewayCopyKey:"\u590D\u5236 key",gatewayShowKey:"\u663E\u793A",gatewayHideKey:"\u9690\u85CF",gatewayRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5F53\u524D key\u3002",gatewayRotateConfirm:"\u786E\u5B9A\u8F6E\u6362 key\uFF1F\u73B0\u6709\u5BA2\u6237\u7AEF\u5C06\u5931\u6548\u3002",gatewayRotateConfirmHint:"\u8FD9\u4F1A\u66FF\u6362\u5F53\u524D Bearer key\u3002",gatewayRotateConfirmAction:"\u786E\u8BA4\u8F6E\u6362",gatewayRotateCancel:"\u53D6\u6D88",gatewayRunning:"\u6B63\u5728\u76D1\u542C",gatewayStopped:"\u672A\u76D1\u542C",gatewayRotate:"\u8F6E\u6362 API key",gatewayRotated:"\u65B0 key\uFF08\u53EA\u663E\u793A\u4E00\u6B21\uFF09\uFF1A{key}",gatewayLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u3002",gatewaySaveFailed:"\u65E0\u6CD5\u66F4\u65B0\u7F51\u5173\u3002",gatewayLoading:"\u6B63\u5728\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u2026",gatewayModelsReady:"\u5F53\u524D\u6709 {count} \u4E2A\u53EF\u6267\u884C\u6A21\u578B\uFF0C\u914D\u7F6E\u7247\u6BB5\u4F7F\u7528 {model}\u3002",gatewayModelsUnavailable:"\u5F53\u524D\u6CA1\u6709\u5DF2\u767B\u5F55\u4F9B\u5E94\u5546\u63D0\u4F9B\u53EF\u6267\u884C\u7684\u7F51\u5173\u6A21\u578B\u3002",gatewayKeyConfigured:"\u5DF2\u914D\u7F6E\u771F\u5B9E Bearer key\uFF1B\u590D\u5236\u53EF\u6267\u884C\u7247\u6BB5\u524D\u8BF7\u5148\u8BFB\u53D6 key\u3002",gatewayKeyNotConfigured:"\u5C1A\u672A\u914D\u7F6E Bearer key\u3002",remoteLoginHelp:"\u5728\u8FDC\u7A0B DSH \u4E3B\u673A\u4E0A\uFF0C\u6253\u5F00\u6B64\u5904 Settings\uFF0C\u5BF9\u6BCF\u4E2A\u4F9B\u5E94\u5546\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\u3002\u5728\u80FD\u8BBF\u95EE\u4F9B\u5E94\u5546\u7684\u4EFB\u610F\u6D4F\u89C8\u5668\u5B8C\u6210\u9A8C\u8BC1\u7801\uFF0C\u518D\u56DE\u5230\u804A\u5929\u9009\u62E9\u5BF9\u5E94\u8DEF\u7531\u6A21\u578B\u3002",pluginVersion:"\u63D2\u4EF6\u7248\u672C {version}",aboutTitle:"\u5173\u4E8E",aboutDocsHint:"\u4ED3\u5E93\u4E2D\u7684 README \u4E0E INSTALL \u6587\u6863\u4ECB\u7ECD\u4E86\u5B89\u88C5\u6B65\u9AA4\u3001\u652F\u6301\u7684\u4F9B\u5E94\u5546\u4EE5\u53CA\u7F51\u5173\u5B89\u5168\u6CE8\u610F\u4E8B\u9879\u3002",aboutDocsLink:"\u5728 GitHub \u6253\u5F00 README",otherLoginMethods:"\u5176\u4ED6\u767B\u5F55\u65B9\u5F0F",hideOtherLoginMethods:"\u6536\u8D77\u5176\u4ED6\u65B9\u5F0F",signInStepOpen:"\u6253\u5F00\u4F9B\u5E94\u5546\u6388\u6743\u9875\u9762",signInStepCode:"\u5728\u63D0\u793A\u5904\u8F93\u5165\u8BBE\u5907\u7801",signInStepWait:"\u7B49\u5F85\u6388\u6743\u5B8C\u6210",copyUserCode:"\u590D\u5236\u8BBE\u5907\u7801",openAuthUrl:"\u6253\u5F00\u6388\u6743\u9875\u9762",modelFilterPlaceholder:"\u7B5B\u9009\u6A21\u578B\u2026",modelFilterLabel:"\u7B5B\u9009 {provider} \u7684\u6A21\u578B",applyModelDraft:"\u5E94\u7528\u6A21\u578B\u9009\u62E9",modelDraftPending:"\u9009\u62E9\u4EC5\u5728\u672C\u9875\u5F62\u6210\u8349\u7A3F\uFF0C\u70B9\u51FB\u5E94\u7528\u540E\u4E00\u6B21\u4FDD\u5B58\u3002",deselectAll:"\u5168\u90E8\u9690\u85CF",resetModelsDefault:"\u91CD\u7F6E\u9009\u62E9",requiresCodexImages:"\u9700\u5148\u5F00\u542F Codex \u51FA\u56FE\u3002",requiresCodexSignIn:"\u8BF7\u5148\u767B\u5F55 OpenAI Codex\u3002",requiresImagineCredential:"\u8BF7\u5148\u914D\u7F6E\u72EC\u7ACB\u7684 Grok Imagine \u51ED\u636E\u3002",openCodexAccount:"\u524D\u5F80 Codex \u8D26\u6237",focusCodexImages:"\u524D\u5F80 Codex \u51FA\u56FE\u5F00\u5173",focusImagineCredential:"\u67E5\u770B Imagine \u51ED\u636E\u72B6\u6001",gatewaySnippetsTitle:"\u5FEB\u901F\u914D\u7F6E\u7247\u6BB5",gatewaySnippetsUnavailable:"\u8BF7\u5148\u8BFB\u53D6\u771F\u5B9E key\uFF0C\u5E76\u81F3\u5C11\u767B\u5F55\u4E00\u4E2A\u4F9B\u5E94\u5546\uFF1B\u6EE1\u8DB3\u540E\u624D\u4F1A\u663E\u793A\u53EF\u6267\u884C\u914D\u7F6E\u7247\u6BB5\u3002",gatewaySnippetCurl:"cURL",gatewaySnippetPython:"Python (OpenAI SDK)",gatewaySnippetIde:"IDE / \u5BA2\u6237\u7AEF",tabAccountsSignedIn:"\u5DF2\u767B\u5F55 {count} \u4E2A",coinstallTitle:"\u5DF2\u7531\u7528\u91CF\u4E2D\u5FC3\u7EDF\u4E00\u7BA1\u7406",coinstallSummary:"\u7528\u91CF\u4E2D\u5FC3\u5F53\u524D\u8D1F\u8D23 OAuth \u8FD0\u884C\u65F6\uFF1B\u5DF2\u6709 {count} \u4E2A\u4F9B\u5E94\u5546\u8D26\u53F7\u767B\u5F55\u3002",coinstallOpenHub:"\u524D\u5F80\u7528\u91CF\u4E2D\u5FC3",tabGatewayActive:"\u8FD0\u884C\u4E2D",accountsListHint:"\u672C\u673A\u4FDD\u5B58\u7684\u8BA2\u9605\u8D26\u53F7\uFF08\u4ECE\u4E0D\u663E\u793A\u4EE4\u724C\uFF09\uFF1A",accountActive:"\u9ED8\u8BA4",accountSetDefault:"\u8BBE\u4E3A\u9ED8\u8BA4",accountRemove:"\u79FB\u9664",accountsEmpty:"\u5C1A\u65E0\u5DF2\u4FDD\u5B58\u8D26\u53F7\u3002"};var fe=require("react/jsx-runtime"),Qo="dsh-grok-build-client",Zo=["locale"];function ea({t:e}){let[t,n]=(0,Re.useState)(!1),o=(0,Re.useRef)(null),r=(0,Re.useRef)(null),c=(0,Re.useRef)(null);return(0,Re.useEffect)(()=>{if(!t)return;r.current?.focus();let d=c.current?.closest("[data-dsh-coding-oauth]")?.parentElement,p=d==null?[]:[...document.body.children].filter(h=>h!==d).map(h=>({element:h,hadInert:h.hasAttribute("inert"),value:h.getAttribute("inert")}));for(let{element:h}of p)h.setAttribute("inert","");let l=()=>[...c.current?.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]].filter(h=>h.getClientRects().length>0),C=h=>{if(h.key==="Escape"&&n(!1),h.key!=="Tab")return;let I=l();if(I.length===0){h.preventDefault(),c.current?.focus();return}let R=I[0],g=I.at(-1);h.shiftKey&&document.activeElement===R?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),R.focus())};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C);for(let{element:h,hadInert:I,value:R}of p)I?h.setAttribute("inert",R??""):h.removeAttribute("inert");o.current?.isConnected&&o.current.focus()}},[t]),(0,fe.jsxs)("div",{"data-dsh-coding-oauth":!0,children:[(0,fe.jsx)("button",{ref:o,type:"button",style:{position:"fixed",right:16,bottom:16,zIndex:30,padding:"10px 14px"},onClick:()=>n(!0),children:e("nav")}),t?(0,fe.jsx)("div",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"coding-oauth-independent-title",tabIndex:-1,style:{position:"fixed",inset:0,zIndex:31,overflow:"auto",padding:20,background:"var(--dsw-alias-bg-layer-1)"},children:(0,fe.jsxs)("div",{style:{width:"min(780px, 100%)",margin:"0 auto"},children:[(0,fe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:12,marginBottom:12},children:[(0,fe.jsx)("h2",{id:"coding-oauth-independent-title",style:{margin:0},children:e("title")}),(0,fe.jsx)("button",{ref:r,type:"button",onClick:()=>n(!1),"aria-label":e("cancel"),children:"\xD7"})]}),(0,fe.jsx)(gn,{t:e})]})}):null]})}function ta(e){if(typeof document>"u")return()=>{};let t=document.createElement("div");document.body.append(t);let n=(0,Bi.createRoot)(t);return n.render((0,fe.jsx)(ea,{t:e})),()=>{n.unmount(),t.remove()}}function na(e){let t=vn(e);t.assertCompatible();let n="settings.grok-build";t.effect(()=>t.locale.register(n,{zh:Ni,en:Ki}),"dsh-coding-subscription-oauth: settings copy");let o=t.locale.bind(n);t.installSlots({mountFallback:()=>ta(o),register:r=>r.inject("settings.section",()=>r.register({name:"settings.section",id:"grok-build",order:17,label:()=>o("nav"),inject:()=>({t:o})},gn))})}
|
|
54
|
+
`,pn=!1;function Mi(){if(pn||typeof document>"u")return;if(document.getElementById(Di)!==null){pn=!0;return}let e=document.createElement("style");e.id=Di,e.textContent=Jo,document.head.appendChild(e),pn=!0}var F=require("react/jsx-runtime"),Ki="dsh-coding-oauth-remote-tip-dismissed";function Qo(){try{return globalThis.sessionStorage?.getItem(Ki)==="1"}catch{return!1}}function gn({t:e}){if(e===void 0)throw new Error("Coding OAuth settings requires its translation function");let[t,n]=(0,y.useState)(void 0),[o,r]=(0,y.useState)(void 0),[c,d]=(0,y.useState)(void 0),[p,l]=(0,y.useState)({}),[C,h]=(0,y.useState)({}),[I,R]=(0,y.useState)(void 0),[g,T]=(0,y.useState)(void 0),[G,k]=(0,y.useState)(!1),[v,_]=(0,y.useState)(void 0),M=(0,y.useRef)(void 0),V=(0,y.useRef)(0),Z=(0,y.useRef)(!0),[ue,ee]=(0,y.useState)(!1),[X,pe]=(0,y.useState)(void 0),[W,me]=(0,y.useState)(void 0),[be,z]=(0,y.useState)(void 0),[ge,re]=(0,y.useState)(!1),[te,he]=(0,y.useState)(!1),[se,x]=(0,y.useState)(void 0),[ke,ye]=(0,y.useState)(void 0),[O,w]=(0,y.useState)(!1),[H,Se]=(0,y.useState)(void 0),[it,Ie]=(0,y.useState)(void 0),[j,Le]=(0,y.useState)(void 0),[Ge,ne]=(0,y.useState)(void 0),[m,K]=(0,y.useState)(!1),[ie,Be]=(0,y.useState)(!1),[It,yn]=(0,y.useState)(void 0),[fn,Tt]=(0,y.useState)(!1),[Wi,Pt]=(0,y.useState)(!1),[Vi,Ye]=(0,y.useState)(void 0),[mn,ot]=(0,y.useState)(""),[de,bn]=(0,y.useState)("accounts"),[$i,Et]=(0,y.useState)(void 0),[qi,_t]=(0,y.useState)(void 0),[zi,ji]=(0,y.useState)({}),[Yi,Xi]=(0,y.useState)(Qo),Fe=(0,y.useRef)(void 0),Ji=t?.accessMode==="ssh-tunnel"||t?.accessMode==="trusted-https-proxy",we=(0,y.useCallback)(async()=>{try{let i=await U(xn);return n(i),r(void 0),i}catch(i){r(i instanceof Error?i.message:e("requestFailed"));return}},[e]),Xe=(0,y.useCallback)(async()=>{try{R(Ci(await U(On))),T(void 0)}catch(i){R(rn([])),T(i instanceof Error?i.message:e("sourcesLoadFailed"))}},[e]),He=(0,y.useCallback)(async()=>{try{let i=dn(await U(Yt));return me(i??{value:sn(),revision:0,writable:!1}),z(void 0),i}catch(i){me({value:sn(),revision:0,writable:!1}),z(i instanceof Error?i.message:e("capabilitiesLoadFailed"));return}finally{he(!0)}},[e]),at=(0,y.useCallback)(async()=>{try{Le(et(await U(Je))),ne(void 0)}catch(i){ne(i instanceof Error?i.message:e("gatewayLoadFailed"))}finally{Be(!0)}},[e]),Ot=(0,y.useCallback)(async()=>{try{Se(ki(await U(Hn))),Ie(void 0)}catch(i){Ie(i instanceof Error?i.message:e("imagineLoadFailed"))}},[e]),hn=(0,y.useCallback)(async()=>{w(!0);try{x(vi(await U(Gn))),ye(void 0)}catch(i){x(void 0),ye(i instanceof Error?i.message:e("usageUnavailable"))}finally{w(!1)}},[e]);(0,y.useEffect)(()=>{Mi();let i=!0,s;return we().then(A=>{!i||A?.uiOwner==="hub"||(s=window.setTimeout(()=>{Xe()},0))}),()=>{i=!1,s!==void 0&&window.clearTimeout(s)}},[we,Xe]),(0,y.useEffect)(()=>{de==="capabilities"&&(te||He(),Ot())},[de,te,He,Ot]),(0,y.useEffect)(()=>{te||t?.providers.codex.status==="signed-in"&&He()},[te,He,t?.providers.codex.status]),(0,y.useEffect)(()=>{de!=="gateway"||ie||at()},[de,ie,at]),(0,y.useEffect)(()=>{M.current=v},[v]),(0,y.useEffect)(()=>(Z.current=!0,()=>{Z.current=!1,Fe.current!==void 0&&window.clearTimeout(Fe.current),V.current+=1;let i=M.current;i!==void 0&<(i.previewId,!0)}),[]),(0,y.useEffect)(()=>{if(!(t!==void 0&&Object.values(t.providers).some(A=>A.status==="signing-in")))return;let s=window.setInterval(()=>{we()},Mn);return()=>{window.clearInterval(s)}},[we,t]),(0,y.useEffect)(()=>{let i=t?.providers.codex.status==="signed-in";if(W?.value.codexUsage===!0&&i){hn();return}x(void 0),ye(void 0),w(!1)},[W?.value.codexUsage,hn,t?.providers.codex.status]),(0,y.useEffect)(()=>{j!==void 0&&ot(String(j.port))},[j]);let Qi=async(i,s)=>{let A=window.open("about:blank","_blank");A!==null&&(A.opener=null),d(i),r(void 0),h(N=>({...N,[i]:A===null}));try{let N=await U(An,"POST",{provider:i,method:s});A!==null&&A.location.replace(N.url),await we()}catch(N){A?.close(),r(N instanceof Error?N.message:e("requestFailed")),await we()}finally{d(void 0)}},Zi=async i=>{let s=p[i]?.trim()??"";if(s.length!==0){d(i);try{await U(kn,"POST",{provider:i,code:s}),l(A=>({...A,[i]:""})),await we()}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}}},eo=async i=>{d(i);try{n(await U(In,"POST",{provider:i}))}catch(s){r(s instanceof Error?s.message:e("requestFailed"))}finally{d(void 0)}},to=async i=>{d(i);try{n(await U(Tn,"POST",{provider:i}))}catch(s){r(s instanceof Error?s.message:e("requestFailed"))}finally{d(void 0)}},no=async(i,s)=>{d(i);try{n(await U(Pn,"POST",{provider:i,selected:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},io=async(i,s)=>{d(i);try{n(await U(En,"POST",{provider:i,accountId:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},oo=async(i,s)=>{d(i);try{n(await U(_n,"POST",{provider:i,accountId:s}))}catch(A){r(A instanceof Error?A.message:e("requestFailed"))}finally{d(void 0)}},ao=async i=>{let s=++V.current,A=M.current;A!==void 0&&(M.current=void 0,_(void 0),lt(A.previewId)),k(!0),pe(void 0),ee(!1);try{let N=Si(await U(Rn,"POST",{kind:i}));if(N===void 0)throw new Error(e("sourcesPreviewFailed"));if(!Z.current||s!==V.current){lt(N.previewId,!Z.current);return}M.current=N,_(N),T(void 0)}catch(N){if(!Z.current||s!==V.current)return;_(void 0),T(N instanceof Error?N.message:e("sourcesPreviewFailed"))}finally{Z.current&&s===V.current&&k(!1)}},ro=async()=>{if(v!==void 0&&v.action!=="blocked"&&!(v.confirmOverwriteRequired&&!ue)){k(!0);try{let i=await U(Ln,"POST",{kind:v.kind,previewId:v.previewId,confirmOverwrite:ue}),s=wi(i);M.current=void 0,_(void 0),ee(!1),pe(e("sourcesCommitSuccess",{action:s===void 0?"":e(zn[s])})),T(void 0),await Xe(),await we()}catch(i){ni(i)&&(M.current=void 0,_(void 0),ee(!1)),T(i instanceof Error?i.message:e("sourcesCommitFailed")),await Xe()}finally{k(!1)}}},so=async()=>{if(v===void 0)return;let i=v.previewId;V.current+=1,M.current=void 0,_(void 0),ee(!1),k(!0);try{await U(rt,"POST",{previewId:i}),T(void 0)}catch(s){T(s instanceof Error?s.message:e("requestFailed"))}finally{k(!1)}},lo=async(i,s)=>{if(W===void 0||!W.writable||i==="codexImageEdits"&&s===!0&&!W.value.codexImages||i==="codexImagesAnyModel"&&s===!0&&!W.value.codexImages)return!1;let A=i==="codexImages"&&s===!1?{codexImages:!1,codexImageEdits:!1,codexImagesAnyModel:!1}:{[i]:s};re(!0);try{let N=dn(await U(Yt,"PATCH",{expectedRevision:W.revision,patch:A}));return N!==void 0?me(N):await He(),z(void 0),!0}catch(N){return await He(),z(ti(N)?e("capabilitiesConflictRefreshed"):N instanceof Error?N.message:e("capabilitiesSaveFailed")),!1}finally{re(!1)}},co=W?.value.codexUsage===!0&&t?.providers.codex.status==="signed-in",uo=t===void 0?0:Object.values(t.providers).filter(i=>i.status==="signed-in").length,po=(0,y.useMemo)(()=>{let i=[];if(t!==void 0){let s=Object.values(t.providers).filter(A=>A.status==="signed-in").length;s>0&&i.push({id:"accounts",suffix:String(s)})}return j?.running===!0&&i.push({id:"gateway",suffix:e("tabGatewayActive")}),i},[j?.running,t,e]),go=i=>{Fe.current!==void 0&&window.clearTimeout(Fe.current),Et(i),_t(void 0),Fe.current=window.setTimeout(()=>{Z.current&&(Et(void 0),_t(void 0)),Fe.current=void 0},2e3)},Cn=async(i,s)=>{if(await ct(s)){go(i);return}Et(void 0),_t(i)},Sn=async()=>{if(It!==void 0)return It;let i=await U(Un,"POST");if(typeof i.apiKey!="string"||i.apiKey.length===0)throw new Error(e("gatewayRevealFailed"));return yn(i.apiKey),i.apiKey},yo=async()=>{try{let i=await Sn();await Cn("key",i),Ye(void 0)}catch{Ye(e("gatewayRevealFailed"))}},fo=async()=>{if(fn){Tt(!1);return}try{await Sn(),Tt(!0),Ye(void 0)}catch{Ye(e("gatewayRevealFailed"))}},mo=async()=>{let i=At(mn);if(i===void 0){ne(e("gatewayPortInvalid"));return}if(!(j!==void 0&&i===j.port)){K(!0);try{Le(et(await U(Je,"PATCH",{port:i}))??j),ne(void 0)}catch(s){ne(s instanceof Error?s.message:e("gatewaySaveFailed")),j!==void 0&&ot(String(j.port))}finally{K(!1)}}},bo=async()=>{K(!0);try{let i=await U(Dn,"POST");typeof i.apiKey=="string"&&yn(i.apiKey),Tt(!0),Pt(!1),Ye(void 0),await at()}catch(i){ne(i instanceof Error?i.message:e("gatewaySaveFailed"))}finally{K(!1)}},ho=i=>{K(!0),U(Je,"PATCH",{enabled:i}).then(s=>{Le(et(s)??j),ne(void 0)}).catch(s=>{ne(s instanceof Error?s.message:e("gatewaySaveFailed"))}).finally(()=>{K(!1)})},Co=i=>{K(!0),U(Je,"PATCH",{opencodeGoEnabled:i}).then(s=>{Le(et(s)??j),ne(void 0)}).catch(s=>{ne(s instanceof Error?s.message:e("gatewaySaveFailed"))}).finally(()=>{K(!1)})},So=()=>{Xi(!0);try{globalThis.sessionStorage?.setItem(Ki,"1")}catch{}},wo=()=>{bn("accounts"),window.setTimeout(()=>document.getElementById("coding-oauth-login-codex")?.focus(),0)},vo=i=>{let s=i==="codexImages"?"cap-switch-codexImages":"coding-oauth-imagine-credential";document.getElementById(s)?.focus()};return t?.uiOwner==="hub"?(0,F.jsxs)("section",{"data-dsh-coding-oauth":"compact",style:en,"aria-labelledby":"coding-oauth-settings-title",children:[(0,F.jsx)("h2",{id:"coding-oauth-settings-title",style:$,children:e("coinstallTitle")}),(0,F.jsx)("p",{style:S,children:e("coinstallSummary",{count:uo})}),(0,F.jsx)("button",{type:"button",style:P,onClick:si,children:e("coinstallManageAccounts")})]}):(0,F.jsxs)("section",{"data-dsh-coding-oauth":"",style:en,"aria-labelledby":"coding-oauth-settings-title",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{id:"coding-oauth-settings-title",style:$,children:e("title")}),de==="accounts"?(0,F.jsx)("p",{style:{...S,marginTop:6},children:e("intro")}):null]}),o===void 0?null:(0,F.jsxs)("div",{role:"alert",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,F.jsx)("p",{style:Pe,children:o}),t===void 0?(0,F.jsx)("button",{type:"button",style:P,onClick:()=>{we()},children:e("retry")}):null]}),(0,F.jsx)(Ui,{t:e,activeTab:de,onChange:bn,hints:po}),(0,F.jsxs)("div",{id:`coding-oauth-panel-${de}`,role:"tabpanel","aria-labelledby":`coding-oauth-tab-${de}`,style:pi,children:[de==="accounts"&&!(t===void 0&&o!==void 0)?(0,F.jsx)(Ri,{t:e,status:t,remote:Ji,remoteTipDismissed:Yi,onDismissRemoteTip:So,sources:I,sourcesError:g,sourcesNotice:X,sourcesBusy:G,preview:v,confirmOverwrite:ue,busyProvider:c,codeInputs:p,popupBlocked:C,expandedProviders:zi,showUsage:co===!0,usage:se,usageError:ke,usageLoading:O,onSignIn:(i,s)=>{Qi(i,s)},onSignOut:i=>{to(i)},onCancelLogin:i=>{eo(i)},onSubmitCode:i=>{Zi(i)},onCodeChange:(i,s)=>{l(A=>({...A,[i]:s}))},onToggleExpanded:i=>{ji(s=>({...s,[i]:s[i]!==!0}))},onPreviewSource:i=>{ao(i)},onSaveModels:(i,s)=>{no(i,s)},onSetDefaultAccount:(i,s)=>{io(i,s)},onRemoveAccount:(i,s)=>{oo(i,s)},onConfirmOverwriteChange:ee,onCommitSource:()=>{ro()},onCancelSourcePreview:()=>{so()},onRefreshSources:()=>{Xe()},onDismissSourcesNotice:()=>{pe(void 0)}}):null,de==="capabilities"?(0,F.jsx)(Li,{t:e,capabilities:W,capabilitiesError:be,capabilitiesBusy:ge,imagine:H,imagineError:it,codexSignedIn:t?.providers.codex.status==="signed-in",onRetry:()=>{He(),Ot()},onOpenAccounts:wo,onFocusDependency:vo,onPatchCapability:(i,s)=>lo(i,s)}):null,de==="gateway"?(0,F.jsx)(Hi,{t:e,gateway:j,gatewayError:Ge,gatewayBusy:m,gatewayOnceKey:It,gatewayKeyVisible:fn,gatewayRotateConfirm:Wi,gatewayRevealError:Vi,portDraft:mn,copiedField:$i,copyFailedField:qi,onRetry:()=>{at()},onEnabledChange:ho,onOpencodeGoEnabledChange:Co,onPortDraftChange:ot,onApplyPort:()=>{mo()},onRandomPort:i=>{ot(String(i))},onCopy:(i,s)=>{Cn(i,s)},onCopyKey:()=>{yo()},onToggleKeyVisible:()=>{fo()},onRotateConfirm:()=>{Pt(!0)},onRotateCancel:()=>{Pt(!1)},onRotate:()=>{bo()}}):null,de==="about"?(0,F.jsx)(mi,{t:e}):null]})]})}var Ni={nav:"Coding OAuth",title:"Coding subscriptions",intro:"Use your own Grok Build, ChatGPT Codex, Kimi Code, and Claude Code subscriptions in dsh. API-key routes remain separate.",termsWarning:"These are unofficial third-party integrations with subscription services. Provider terms, quotas, regions, and account-risk policies still apply.",loadingAccount:"Loading accounts\u2026",signedOut:"Not signed in",signingIn:"Waiting for authorization\u2026",signedIn:"Signed in",requestFailed:"The account request failed.",retry:"Try again",cancel:"Cancel",logout:"Sign out",logoutConfirmTitle:"Confirm sign-out",logoutConfirmHint:"Sign out of this provider in dsh? Your provider account itself is not changed.",logoutConfirmAction:"Confirm sign-out",working:"Working\u2026",cancelLogin:"Cancel sign-in",deviceLogin:"Sign in with device code",deviceLoginRemote:"Sign in with device code (best for remote)",browserLogin:"Sign in in browser",pkceLogin:"Sign in with authorization code",userCode:"Enter this code when the provider asks:",openUrl:"Complete sign-in at:",popupBlocked:"The browser blocked the sign-in window. Open this URL manually:",pasteCodeHint:"Paste the authorization code or complete redirect URL returned by the provider. For local PKCE, use this only if the callback could not reach this DSH host:",pasteBrowserCodeHint:"Paste the authorization code or complete redirect URL returned by the provider to finish this browser sign-in:",pasteCodePlaceholder:"authorization code or complete redirect URL",pasteCodeLabel:"Authorization code or complete redirect URL",submitCode:"Submit code",importGrok:"Import from Grok CLI",importHint:"Copies ~/.grok/auth.json into dsh. A later dsh refresh may rotate the token and sign the Grok CLI out.",models:"Visible models",catalogLive:"From your current xAI account",catalogCache:"From the last successful xAI listing",catalogFallback:"Built-in Grok baseline (live listing unavailable)",catalogError:"Could not refresh the live Grok model list.",selectAll:"Show all",modelHint:"Checked models appear in the model picker as",grokTitle:"xAI Grok Build",grokDescription:"SuperGrok / X Premium coding subscription through the Grok Build endpoint.",codexTitle:"OpenAI Codex",codexDescription:"ChatGPT Plus/Pro Codex entitlement. Device code is recommended for a remote DSH host.",kimiTitle:"Kimi Code",kimiDescription:"Kimi Code membership through auth.kimi.com and api.kimi.com/coding; this is not the Moonshot API-key platform.",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth with Claude Code scopes and automatic refresh.",antigravityTitle:"Google Antigravity",antigravityDescription:"Provided by the separately pinned MIT dsh-agy plugin and exposed as the agy route.",antigravityInstalled:"Installed (CLI-managed)",antigravityMissing:"Not installed",antigravityCliHint:"The unauthenticated dsh-agy web export dashboard is disabled. Manage Google OAuth with the profile-local CLI when needed.",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"Pull a copy from official CLI files",sourcesIntro:"dsh can discover a local official CLI login and pull a one-way copy into its own store. Official CLI files stay read-only and are never modified.",sourcesReadOnlyHint:"This is a one-way pull of a copy. dsh does not update, replace, or write back the official CLI documents.",sourcesLoading:"Looking for official CLI login files\u2026",sourcesCheckAgain:"Check again",sourcesAvailable:"A readable copy is available",sourcesUnavailable:"No usable copy found",sourcesAllMissingHint:"No official CLI login files were found on this host. That is normal on a remote DSH machine \u2014 use device-code sign-in instead, or check again after logging in on this same host.",sourcesAvailableHint:"An official CLI login was found on this host. You can pull a one-way copy into dsh from a provider card.",sourcesPullCopy:"Pull a copy",remoteAccountsTip:"This Settings page looks remote (not loopback). Prefer device-code sign-in; browser pop-ups and local PKCE callbacks often fail from another machine.",remoteTipDismiss:"Dismiss",sourcesPreviewTitle:"Review this copy before saving it in dsh",sourcesPreviewExpires:"CLI credential expiry: {time}",sourcesTicketExpires:"This preview expires at {time}",sourcesConflict:"Stored dsh credential: {detail}",sourcesAction:"If you continue: {detail}",sourcesWarnings:"Notes",sourcesConfirmOverwrite:"Replace the credential already stored in dsh with this copy",sourcesConfirmOverwriteHint:"A different credential is already stored. Check the box, then confirm the pull.",sourcesCommit:"Confirm pull",sourcesCancelPreview:"Cancel preview",sourcesCommitSuccess:"Copied into dsh ({action}).",sourcesPreviewFailed:"Could not prepare a copy from that CLI file.",sourcesCommitFailed:"Could not save the copy in dsh.",sourcesLoadFailed:"Could not look for official CLI login files.",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"No official CLI file was found at the expected location.",sourceReasonUnsafe:"The official CLI file is not safe to read (permissions or file type).",sourceReasonInvalid:"The official CLI file is present but is not a usable OAuth login.",sourceReasonTooLarge:"The official CLI file is larger than the allowed read limit.",sourceConflictNone:"dsh has no stored credential yet",sourceConflictSameCredential:"same credential already stored",sourceConflictSameAccount:"same account, different credential",sourceConflictDifferentAccount:"a different account is already stored",sourceConflictUnknownAccount:"an existing credential is stored (account could not be compared)",sourceConflictUnreadableDestination:"the stored dsh credential could not be read",sourceConflictUnsafeDestination:"the stored dsh credential file is not safe to replace",sourceConflictUnrecognized:"the stored credential needs a review",sourceActionImport:"save this copy in dsh",sourceActionReuse:"keep the stored dsh credential (it already matches)",sourceActionOverwrite:"replace the stored dsh credential",sourceActionBlocked:"blocked \u2014 the stored dsh file cannot be replaced from here",sourceActionUnrecognized:"needs a review",sourceCommitImported:"saved",sourceCommitUnchanged:"already matched",sourceCommitOverwritten:"replaced",capabilitiesTitle:"Subscription capabilities",capabilitiesIntro:"Every switch starts off. Turning one on uses that vendor\u2019s subscription quota, not a separate API-key bill.",capabilitiesQuotaHint:"Search, images, edits, Fast, usage, and Grok Imagine all consume the matching subscription quota when they run.",capabilitiesReadOnly:"These switches are read-only in this deployment.",capabilitiesLoading:"Loading capability settings\u2026",capabilitiesLoadFailed:"Could not load capability settings.",capabilitiesSaveFailed:"Could not save that capability setting.",capabilitiesConflictRefreshed:"Those settings changed elsewhere. The page was refreshed; try again.",capabilityLimitsTitle:"Capability limits",capabilityLimitsHint:"Limits apply live to newly started operations and remain within the audited safety bounds.",capSearchResults:"Maximum search results",capSearchResultsHint:"Codex search returns at most this many results (1\u201320).",capImageCount:"Maximum images per call",capImageCountHint:"Codex and Imagine image tools can return at most this many images (1\u20134).",capVideoTtlHours:"Video artifact retention (hours)",capVideoTtlHoursHint:"Completed Imagine video artifacts are kept for 1\u2013168 hours. Lowering retention cleans older artifacts immediately; raising it applies to new artifacts.",capabilityLimitInvalid:"Enter a whole number from {min} through {max}.",capCodexSearch:"Codex subscription search",capCodexSearchHint:"Optional search using Codex quota.",capCodexImages:"Codex images",capCodexImagesHint:"Generate images with ChatGPT/Codex quota.",capCodexImageEdits:"Codex image edits",capCodexImageEditsHint:"Edit images; requires Codex images.",capCodexImagesAnyModel:"Allow any model to use image tools",capCodexImagesAnyModelHint:"Let non-Codex routes also call image generate/edit. Still uses your ChatGPT/Codex quota and requires Codex sign-in.",capCodexUsage:"Show Codex quota",capCodexUsageHint:"Show remaining quota on the Codex account card when available.",capCodexFast:"Fast requested",capCodexFastHint:"Publish the Fast route when the live catalog confirms priority eligibility.",capGrokImagineImage:"Grok Imagine images",capGrokImagineImageHint:"Needs a separate Imagine credential (not Grok OAuth alone).",capGrokImagineVideo:"Grok Imagine video",capGrokImagineVideoHint:"Needs a separate Imagine credential (not Grok OAuth alone).",usageTitle:"Codex quota",usageLoading:"Loading Codex quota\u2026",usageUnavailable:"Codex quota is not available right now.",usageEmpty:"The vendor did not return any displayable quota fields.",usageFetchedAt:"Last read: {time}",usageRateLimit:"Rate limit",usageWindow:"{seconds}s window",usageUsed:"Used {value}",usageRemaining:"Remaining {value}",usageResets:"Resets {time}",usageCredits:"Credits",usageCreditsUnlimited:"Unlimited credits",usageCreditsLimited:"Limited credits",usageBalance:"Balance {value}",usageIndividualLimit:"Individual limit",usageLimit:"Limit {value}",usageUsedAmount:"Used {value}",usageRemainingAmount:"Remaining {value}",usageSpendControlReached:"Spend control has been reached.",usageResetCredits:"Reset credits available: {value}",imagineTitle:"Grok Imagine credential",imagineIntro:"Official Imagine calls use an xAI API credential (for example $XAI_API_KEY). That key is separate from a Grok Build OAuth login and is never shown here.",imagineLoading:"Checking the Imagine credential\u2026",imagineLoadFailed:"Could not read the Imagine credential status.",imagineConfigured:"An Imagine credential is configured",imagineNotConfigured:"No Imagine credential is configured",imagineSource:"Source: {source}",imagineWritable:"This deployment can update the Imagine credential store.",imagineReadOnly:"This deployment cannot update the Imagine credential store.",imagineSourceNone:"none",imagineSourceEnv:"environment variable",imagineSourceApiKey:"stored API key",imagineSourceOAuth:"OAuth access (only if Imagine accepted it)",imagineSourceCliKey:"Grok CLI key field",imagineSourceUnknown:"configured (details withheld)",tabAccounts:"Accounts",tabCapabilities:"Capabilities",tabGateway:"Gateway",tabAbout:"About",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",modelsSummary:"{selected}/{total} models visible",expandModels:"Models",collapseModels:"Hide models",usageUsedShort:"Used {value}",gatewayTitle:"Local API gateway",gatewayIntro:"Loopback OpenAI/Anthropic-compatible server for your own tools. Off until you enable it.",gatewayWarning:"Exposes signed-in subscriptions as a local API. Can violate provider terms and uses quota.",gatewayLoopbackHint:"Binds to loopback only. Do not port-forward or expose this gateway on a public interface.",gatewayEnableConfirm:"Enable the local API gateway? It exposes your signed-in subscriptions to tools on this host and consumes provider quota.",gatewayEnableConfirmAction:"Confirm",gatewayEnableCancel:"Cancel",gatewayEnabled:"Enable local gateway",gatewayOpencodeGoEnabled:"Proxy chat to OpenCode Go",gatewayOpencodeGoHint:"When on, POST /v1/chat/completions is forwarded to OpenCode Go with a sticky session header. Set the gateway Bearer key to your OpenCode API key. Default off. Follow OpenCode terms; this still consumes your OpenCode quota.",gatewayBind:"Bind",gatewayPort:"Port",gatewayPortHint:"Integer from 1024 through 65535. Apply to save; Random fills a high port, then Apply.",gatewayPortApply:"Apply",gatewayPortRandom:"Random",gatewayPortInvalid:"Enter a whole port number from 1024 through 65535.",gatewayAddress:"Gateway address",gatewayOpenAiUrl:"OpenAI-compatible base URL",gatewayAnthropicUrl:"Anthropic-compatible base URL",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"Copy uses the current key. Rotate only if you want to invalidate existing clients.",gatewayCopyKey:"Copy key",gatewayShowKey:"Show",gatewayHideKey:"Hide",gatewayRevealFailed:"Could not read the current key.",gatewayRotateConfirm:"Rotate the key? Existing clients will stop working.",gatewayRotateConfirmHint:"This replaces the current Bearer key.",gatewayRotateConfirmAction:"Confirm rotate",gatewayRotateCancel:"Cancel",gatewayRunning:"Listening",gatewayStopped:"Not listening",gatewayRotate:"Rotate API key",gatewayRotated:"New key (shown once): {key}",gatewayLoadFailed:"Could not load gateway settings.",gatewaySaveFailed:"Could not update the gateway.",gatewayLoading:"Loading gateway settings\u2026",gatewayModelsReady:"{count} executable model(s) available. Snippets use {model}.",gatewayModelsUnavailable:"No signed-in provider currently exposes an executable gateway model.",gatewayKeyConfigured:"A real Bearer key is configured. Reveal it before copying an executable snippet.",gatewayKeyNotConfigured:"No Bearer key is configured yet.",remoteLoginHelp:"On a remote DSH host, open Settings here and use device-code sign-in for each provider. Complete the code on any browser that can reach the provider, then return to chat and pick the provider route model.",pluginVersion:"Plugin version {version}",aboutTitle:"About",aboutDocsHint:"See the plugin README and INSTALL docs in the repository for setup, supported providers, and gateway safety notes.",aboutDocsLink:"Open README on GitHub",otherLoginMethods:"Other sign-in methods",hideOtherLoginMethods:"Hide other methods",signInStepOpen:"Open the provider authorization page",signInStepCode:"Enter the device code when prompted",signInStepWait:"Waiting for authorization to complete",copyUserCode:"Copy code",openAuthUrl:"Open authorization page",modelFilterPlaceholder:"Filter models\u2026",modelFilterLabel:"Filter models for {provider}",applyModelDraft:"Apply model selection",modelDraftPending:"Selection changed locally. Apply once to save.",deselectAll:"Hide all",resetModelsDefault:"Reset selection",requiresCodexImages:"Turn on Codex images first.",requiresCodexSignIn:"Sign in to OpenAI Codex first.",requiresImagineCredential:"Configure the separate Grok Imagine credential first.",openCodexAccount:"Open Codex account",focusCodexImages:"Go to Codex images",focusImagineCredential:"View Imagine credential status",gatewaySnippetsTitle:"Quick setup snippets",gatewaySnippetsUnavailable:"Reveal the real key and sign in to at least one provider before snippets are shown.",gatewaySnippetCurl:"cURL",gatewaySnippetPython:"Python (OpenAI SDK)",gatewaySnippetIde:"IDE / client",tabAccountsSignedIn:"{count} signed in",coinstallTitle:"Managed by Usage Center",coinstallSummary:"Usage Center is the active OAuth owner. {count} provider account(s) are currently signed in.",coinstallManageAccounts:"Manage subscription accounts",tabGatewayActive:"Running",accountsListHint:"Saved subscription accounts on this machine (tokens are never shown):",accountActive:"Default",accountSetDefault:"Set default",accountRemove:"Remove",accountsEmpty:"No saved accounts yet."},Bi={nav:"\u7F16\u7801 OAuth",title:"\u7F16\u7801\u8BA2\u9605\u8D26\u6237",intro:"\u5728 dsh \u4E2D\u4F7F\u7528\u81EA\u5DF1\u7684 Grok Build\u3001ChatGPT Codex\u3001Kimi Code \u548C Claude Code \u8BA2\u9605\uFF1B\u73B0\u6709 API-key \u8DEF\u7531\u7EE7\u7EED\u72EC\u7ACB\u4FDD\u7559\u3002",termsWarning:"\u8FD9\u4E9B\u662F\u8BA2\u9605\u670D\u52A1\u7684\u975E\u5B98\u65B9\u7B2C\u4E09\u65B9\u96C6\u6210\uFF0C\u4ECD\u53D7\u4F9B\u5E94\u5546\u6761\u6B3E\u3001\u914D\u989D\u3001\u5730\u533A\u9650\u5236\u548C\u8D26\u53F7\u98CE\u63A7\u7EA6\u675F\u3002",loadingAccount:"\u6B63\u5728\u52A0\u8F7D\u8D26\u6237\u2026",signedOut:"\u5C1A\u672A\u767B\u5F55",signingIn:"\u6B63\u5728\u7B49\u5F85\u6388\u6743\u2026",signedIn:"\u5DF2\u767B\u5F55",requestFailed:"\u8D26\u6237\u8BF7\u6C42\u5931\u8D25\u3002",retry:"\u91CD\u8BD5",cancel:"\u53D6\u6D88",logout:"\u9000\u51FA\u767B\u5F55",logoutConfirmTitle:"\u786E\u8BA4\u9000\u51FA\u767B\u5F55",logoutConfirmHint:"\u786E\u5B9A\u5728 dsh \u4E2D\u9000\u51FA\u6B64\u4F9B\u5E94\u5546\uFF1F\u4F9B\u5E94\u5546\u8D26\u53F7\u672C\u8EAB\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",logoutConfirmAction:"\u786E\u8BA4\u9000\u51FA",working:"\u5904\u7406\u4E2D\u2026",cancelLogin:"\u53D6\u6D88\u767B\u5F55",deviceLogin:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55",deviceLoginRemote:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF08\u9002\u5408\u8FDC\u7A0B\uFF09",browserLogin:"\u5728\u6D4F\u89C8\u5668\u4E2D\u767B\u5F55",pkceLogin:"\u4F7F\u7528\u6388\u6743\u7801\u767B\u5F55",userCode:"\u4F9B\u5E94\u5546\u8981\u6C42\u8F93\u5165\u4EE3\u7801\u65F6\uFF0C\u8BF7\u8F93\u5165\uFF1A",openUrl:"\u8BF7\u5728\u6B64\u5B8C\u6210\u767B\u5F55\uFF1A",popupBlocked:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u767B\u5F55\u7A97\u53E3\uFF0C\u8BF7\u624B\u52A8\u6253\u5F00\uFF1A",pasteCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\u3002\u672C\u5730 PKCE \u4EC5\u5728\u56DE\u8C03\u65E0\u6CD5\u5230\u8FBE\u8FD9\u53F0 DSH \u4E3B\u673A\u65F6\u4F7F\u7528\uFF1A",pasteBrowserCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\uFF0C\u4EE5\u5B8C\u6210\u6B64\u6B21\u6D4F\u89C8\u5668\u767B\u5F55\uFF1A",pasteCodePlaceholder:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",pasteCodeLabel:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",submitCode:"\u63D0\u4EA4 code",importGrok:"\u4ECE Grok CLI \u5BFC\u5165",importHint:"\u628A ~/.grok/auth.json \u590D\u5236\u8FDB dsh\uFF1B\u4E4B\u540E dsh \u5237\u65B0 token \u53EF\u80FD\u8BA9 Grok CLI \u6389\u7EBF\u3002",models:"\u53EF\u89C1\u6A21\u578B",catalogLive:"\u6765\u81EA\u5F53\u524D xAI \u8D26\u53F7",catalogCache:"\u6765\u81EA\u4E0A\u4E00\u6B21\u6210\u529F\u62C9\u53D6\u7684 xAI \u5217\u8868",catalogFallback:"\u5185\u7F6E Grok \u57FA\u7EBF\u76EE\u5F55\uFF08\u7EBF\u4E0A\u5217\u8868\u4E0D\u53EF\u7528\uFF09",catalogError:"\u65E0\u6CD5\u5237\u65B0\u7EBF\u4E0A Grok \u6A21\u578B\u5217\u8868\u3002",selectAll:"\u5168\u90E8\u663E\u793A",modelHint:"\u52FE\u9009\u6A21\u578B\u4F1A\u4EE5\u8BE5\u524D\u7F00\u51FA\u73B0\u5728\u6A21\u578B\u9009\u62E9\u5668\uFF1A",grokTitle:"xAI Grok Build",grokDescription:"\u901A\u8FC7 Grok Build \u7AEF\u70B9\u4F7F\u7528 SuperGrok / X Premium \u7F16\u7801\u8BA2\u9605\u3002",codexTitle:"OpenAI Codex",codexDescription:"\u4F7F\u7528 ChatGPT Plus/Pro \u7684 Codex \u6743\u76CA\uFF1B\u8FDC\u7A0B DSH \u4E3B\u673A\u63A8\u8350\u8BBE\u5907\u7801\u767B\u5F55\u3002",kimiTitle:"Kimi Code",kimiDescription:"\u901A\u8FC7 auth.kimi.com \u4E0E api.kimi.com/coding \u4F7F\u7528 Kimi Code \u4F1A\u5458\uFF1B\u4E0D\u662F Moonshot API-key \u5F00\u653E\u5E73\u53F0\u3002",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth\uFF0C\u5305\u542B Claude Code scope \u548C\u81EA\u52A8\u5237\u65B0\u3002",antigravityTitle:"Google Antigravity",antigravityDescription:"\u7531\u5355\u72EC\u56FA\u5B9A\u7248\u672C\u7684 MIT \u5F00\u6E90 dsh-agy \u63D2\u4EF6\u63D0\u4F9B\uFF0C\u5BF9\u5916\u8DEF\u7531\u4E3A agy\u3002",antigravityInstalled:"\u5DF2\u5B89\u88C5\uFF08CLI \u7BA1\u7406\uFF09",antigravityMissing:"\u5C1A\u672A\u5B89\u88C5",antigravityCliHint:"\u4E3A\u907F\u514D\u66B4\u9732\u65E0\u8BA4\u8BC1\u7684\u51ED\u636E\u5BFC\u51FA\u9875\u9762\uFF0C\u9ED8\u8BA4\u7981\u7528 dsh-agy Web \u7BA1\u7406\u9875\uFF1B\u9700\u8981\u65F6\u4F7F\u7528 profile \u5185 CLI \u7BA1\u7406 Google OAuth\u3002",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"\u4ECE\u5B98\u65B9 CLI \u6587\u4EF6\u62C9\u53D6\u526F\u672C",sourcesIntro:"dsh \u53EF\u4EE5\u81EA\u52A8\u53D1\u73B0\u672C\u673A\u5B98\u65B9 CLI \u767B\u5F55\uFF0C\u5E76\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230\u81EA\u5DF1\u7684\u5B58\u50A8\u3002\u5B98\u65B9 CLI \u6587\u4EF6\u4FDD\u6301\u53EA\u8BFB\uFF0C\u7EDD\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",sourcesReadOnlyHint:"\u8FD9\u662F\u5355\u5411\u62C9\u53D6\u526F\u672C\u3002dsh \u4E0D\u4F1A\u66F4\u65B0\u3001\u8986\u76D6\u6216\u56DE\u5199\u5B98\u65B9 CLI \u6587\u6863\u3002",sourcesLoading:"\u6B63\u5728\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u2026",sourcesCheckAgain:"\u518D\u68C0\u67E5\u4E00\u6B21",sourcesAvailable:"\u53EF\u4EE5\u8BFB\u53D6\u4E00\u4EFD\u526F\u672C",sourcesUnavailable:"\u6CA1\u6709\u53EF\u7528\u7684\u526F\u672C",sourcesAllMissingHint:"\u8FD9\u53F0\u4E3B\u673A\u4E0A\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002\u8FDC\u7A0B DSH \u4E0A\u8FD9\u5F88\u5E38\u89C1\u2014\u2014\u8BF7\u6539\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u82E5\u5DF2\u5728\u672C\u673A CLI \u767B\u5F55\uFF0C\u53EF\u518D\u68C0\u67E5\u4E00\u6B21\u3002",sourcesAvailableHint:"\u672C\u673A\u53D1\u73B0\u4E86\u5B98\u65B9 CLI \u767B\u5F55\u3002\u53EF\u5728\u5BF9\u5E94\u8D26\u6237\u5361\u7247\u91CC\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230 dsh\u3002",sourcesPullCopy:"\u62C9\u53D6\u526F\u672C",remoteAccountsTip:"\u5F53\u524D Settings \u9875\u9762\u770B\u8D77\u6765\u662F\u8FDC\u7A0B\u8BBF\u95EE\uFF08\u975E\u672C\u673A\u56DE\u73AF\uFF09\u3002\u8BF7\u4F18\u5148\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u4ECE\u53E6\u4E00\u53F0\u673A\u5668\u6253\u5F00\u65F6\uFF0C\u6D4F\u89C8\u5668\u5F39\u7A97\u548C\u672C\u5730 PKCE \u56DE\u8C03\u7ECF\u5E38\u4F1A\u5931\u8D25\u3002",remoteTipDismiss:"\u77E5\u9053\u4E86",sourcesPreviewTitle:"\u5148\u6838\u5BF9\u8FD9\u4EFD\u526F\u672C\uFF0C\u518D\u5199\u5165 dsh",sourcesPreviewExpires:"CLI \u51ED\u636E\u5230\u671F\u65F6\u95F4\uFF1A{time}",sourcesTicketExpires:"\u6B64\u6B21\u9884\u89C8\u5C06\u4E8E {time} \u5931\u6548",sourcesConflict:"dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF1A{detail}",sourcesAction:"\u82E5\u7EE7\u7EED\uFF1A{detail}",sourcesWarnings:"\u8BF4\u660E",sourcesConfirmOverwrite:"\u7528\u8FD9\u4EFD\u526F\u672C\u66FF\u6362 dsh \u4E2D\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E",sourcesConfirmOverwriteHint:"dsh \u91CC\u5DF2\u6709\u53E6\u4E00\u4EFD\u51ED\u636E\u3002\u8BF7\u5148\u52FE\u9009\uFF0C\u518D\u786E\u8BA4\u62C9\u53D6\u3002",sourcesCommit:"\u786E\u8BA4\u62C9\u53D6",sourcesCancelPreview:"\u53D6\u6D88\u9884\u89C8",sourcesCommitSuccess:"\u5DF2\u590D\u5236\u5230 dsh\uFF08{action}\uFF09\u3002",sourcesPreviewFailed:"\u65E0\u6CD5\u4ECE\u8BE5 CLI \u6587\u4EF6\u51C6\u5907\u526F\u672C\u3002",sourcesCommitFailed:"\u65E0\u6CD5\u628A\u526F\u672C\u4FDD\u5B58\u5230 dsh\u3002",sourcesLoadFailed:"\u65E0\u6CD5\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"\u5728\u9884\u671F\u4F4D\u7F6E\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u6587\u4EF6\u3002",sourceReasonUnsafe:"\u5B98\u65B9 CLI \u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u65E0\u6CD5\u8BFB\u53D6\uFF08\u6743\u9650\u6216\u6587\u4EF6\u7C7B\u578B\uFF09\u3002",sourceReasonInvalid:"\u5B98\u65B9 CLI \u6587\u4EF6\u5B58\u5728\uFF0C\u4F46\u4E0D\u662F\u53EF\u7528\u7684 OAuth \u767B\u5F55\u3002",sourceReasonTooLarge:"\u5B98\u65B9 CLI \u6587\u4EF6\u8D85\u8FC7\u5141\u8BB8\u7684\u8BFB\u53D6\u4E0A\u9650\u3002",sourceConflictNone:"dsh \u5C1A\u672A\u4FDD\u5B58\u51ED\u636E",sourceConflictSameCredential:"\u5DF2\u4FDD\u5B58\u540C\u4E00\u4EFD\u51ED\u636E",sourceConflictSameAccount:"\u540C\u4E00\u8D26\u53F7\uFF0C\u4F46\u51ED\u636E\u4E0D\u540C",sourceConflictDifferentAccount:"\u5DF2\u4FDD\u5B58\u53E6\u4E00\u4E2A\u8D26\u53F7",sourceConflictUnknownAccount:"\u5DF2\u4FDD\u5B58\u51ED\u636E\uFF08\u65E0\u6CD5\u6BD4\u8F83\u8D26\u53F7\uFF09",sourceConflictUnreadableDestination:"\u65E0\u6CD5\u8BFB\u53D6 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceConflictUnsafeDestination:"dsh \u4E2D\u7684\u51ED\u636E\u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362",sourceConflictUnrecognized:"\u5DF2\u5B58\u51ED\u636E\u9700\u8981\u6838\u5BF9",sourceActionImport:"\u628A\u8FD9\u4EFD\u526F\u672C\u4FDD\u5B58\u5230 dsh",sourceActionReuse:"\u4FDD\u7559 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF08\u5185\u5BB9\u5DF2\u76F8\u540C\uFF09",sourceActionOverwrite:"\u66FF\u6362 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceActionBlocked:"\u5DF2\u963B\u6B62 \u2014 \u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362 dsh \u4E2D\u7684\u6587\u4EF6",sourceActionUnrecognized:"\u9700\u8981\u6838\u5BF9",sourceCommitImported:"\u5DF2\u4FDD\u5B58",sourceCommitUnchanged:"\u539F\u672C\u5C31\u76F8\u540C",sourceCommitOverwritten:"\u5DF2\u66FF\u6362",capabilitiesTitle:"\u8BA2\u9605\u80FD\u529B",capabilitiesIntro:"\u6240\u6709\u5F00\u5173\u9ED8\u8BA4\u5173\u95ED\u3002\u6253\u5F00\u540E\u6D88\u8017\u7684\u662F\u5BF9\u5E94\u4F9B\u5E94\u5546\u7684\u8BA2\u9605\u914D\u989D\uFF0C\u4E0D\u662F\u53E6\u4E00\u5957 API-key \u8D26\u5355\u3002",capabilitiesQuotaHint:"\u641C\u7D22\u3001\u51FA\u56FE\u3001\u6539\u56FE\u3001Fast\u3001\u989D\u5EA6\u5C55\u793A\u548C Grok Imagine \u5728\u5B9E\u9645\u8C03\u7528\u65F6\u90FD\u4F1A\u6D88\u8017\u5BF9\u5E94\u8BA2\u9605\u914D\u989D\u3002",capabilitiesReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E2D\u8FD9\u4E9B\u5F00\u5173\u4E3A\u53EA\u8BFB\u3002",capabilitiesLoading:"\u6B63\u5728\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u2026",capabilitiesLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesSaveFailed:"\u65E0\u6CD5\u4FDD\u5B58\u8BE5\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesConflictRefreshed:"\u8FD9\u4E9B\u8BBE\u7F6E\u5DF2\u5728\u522B\u5904\u88AB\u6539\u8FC7\u3002\u9875\u9762\u5DF2\u5237\u65B0\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002",capabilityLimitsTitle:"\u80FD\u529B\u9650\u5236",capabilityLimitsHint:"\u9650\u5236\u4F1A\u5B9E\u65F6\u5E94\u7528\u4E8E\u65B0\u53D1\u8D77\u7684\u64CD\u4F5C\uFF0C\u5E76\u59CB\u7EC8\u4FDD\u6301\u5728\u5DF2\u5BA1\u8BA1\u7684\u5B89\u5168\u8303\u56F4\u5185\u3002",capSearchResults:"\u6700\u591A\u641C\u7D22\u7ED3\u679C\u6570",capSearchResultsHint:"Codex \u641C\u7D22\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u6761\u7ED3\u679C\uFF081\u201320\uFF09\u3002",capImageCount:"\u5355\u6B21\u6700\u591A\u56FE\u7247\u6570",capImageCountHint:"Codex \u4E0E Imagine \u56FE\u7247\u5DE5\u5177\u5355\u6B21\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u5F20\u56FE\u7247\uFF081\u20134\uFF09\u3002",capVideoTtlHours:"\u89C6\u9891\u4EA7\u7269\u4FDD\u7559\u65F6\u95F4\uFF08\u5C0F\u65F6\uFF09",capVideoTtlHoursHint:"Imagine \u89C6\u9891\u4EA7\u7269\u4FDD\u7559 1\u2013168 \u5C0F\u65F6\uFF1B\u964D\u4F4E\u4FDD\u7559\u65F6\u95F4\u4F1A\u7ACB\u5373\u6E05\u7406\u8FC7\u671F\u65E7\u4EA7\u7269\uFF0C\u63D0\u9AD8\u53EA\u5F71\u54CD\u65B0\u4EA7\u7269\u3002",capabilityLimitInvalid:"\u8BF7\u8F93\u5165 {min} \u5230 {max} \u4E4B\u95F4\u7684\u6574\u6570\u3002",capCodexSearch:"Codex \u8BA2\u9605\u641C\u7D22",capCodexSearchHint:"\u53EF\u9009\u641C\u7D22\uFF0C\u6D88\u8017 Codex \u914D\u989D\u3002",capCodexImages:"Codex \u51FA\u56FE",capCodexImagesHint:"\u7528 ChatGPT/Codex \u914D\u989D\u51FA\u56FE\u3002",capCodexImageEdits:"Codex \u6539\u56FE",capCodexImageEditsHint:"\u6539\u56FE\uFF1B\u9700\u5148\u6253\u5F00 Codex \u51FA\u56FE\u3002",capCodexImagesAnyModel:"\u5141\u8BB8\u4EFB\u610F\u6A21\u578B\u8C03\u7528\u51FA\u56FE\u5DE5\u5177",capCodexImagesAnyModelHint:"\u975E Codex \u6E20\u9053\u7684\u6A21\u578B\u4E5F\u53EF\u8C03\u7528\u56FE\u7247\u751F\u6210/\u7F16\u8F91\u3002\u4ECD\u6D88\u8017 ChatGPT/Codex \u914D\u989D\uFF0C\u4E14\u9700\u767B\u5F55 Codex\u3002",capCodexUsage:"\u663E\u793A Codex \u989D\u5EA6",capCodexUsageHint:"\u6709\u6570\u636E\u65F6\u5728 Codex \u8D26\u6237\u5361\u7247\u4E0A\u663E\u793A\u5269\u4F59\u989D\u5EA6\u3002",capCodexFast:"\u5DF2\u8BF7\u6C42 Fast",capCodexFastHint:"\u5728\u7EBF\u76EE\u5F55\u786E\u8BA4\u4F18\u5148\u8D44\u683C\u540E\u53D1\u5E03 Fast \u8DEF\u7531\u3002",capGrokImagineImage:"Grok Imagine \u51FA\u56FE",capGrokImagineImageHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",capGrokImagineVideo:"Grok Imagine \u51FA\u89C6\u9891",capGrokImagineVideoHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",usageTitle:"Codex \u989D\u5EA6",usageLoading:"\u6B63\u5728\u52A0\u8F7D Codex \u989D\u5EA6\u2026",usageUnavailable:"\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6 Codex \u989D\u5EA6\u3002",usageEmpty:"\u4F9B\u5E94\u5546\u6CA1\u6709\u8FD4\u56DE\u53EF\u5C55\u793A\u7684\u989D\u5EA6\u5B57\u6BB5\u3002",usageFetchedAt:"\u6700\u8FD1\u8BFB\u53D6\uFF1A{time}",usageRateLimit:"\u901F\u7387\u9650\u5236",usageWindow:"{seconds} \u79D2\u7A97\u53E3",usageUsed:"\u5DF2\u7528 {value}",usageRemaining:"\u5269\u4F59 {value}",usageResets:"\u91CD\u7F6E\u65F6\u95F4 {time}",usageCredits:"\u79EF\u5206",usageCreditsUnlimited:"\u65E0\u9650\u79EF\u5206",usageCreditsLimited:"\u6709\u9650\u79EF\u5206",usageBalance:"\u4F59\u989D {value}",usageIndividualLimit:"\u4E2A\u4EBA\u989D\u5EA6",usageLimit:"\u4E0A\u9650 {value}",usageUsedAmount:"\u5DF2\u7528 {value}",usageRemainingAmount:"\u5269\u4F59 {value}",usageSpendControlReached:"\u5DF2\u8FBE\u5230\u652F\u51FA\u63A7\u5236\u4E0A\u9650\u3002",usageResetCredits:"\u53EF\u7528\u91CD\u7F6E\u6B21\u6570\uFF1A{value}",imagineTitle:"Grok Imagine \u51ED\u636E",imagineIntro:"\u5B98\u65B9 Imagine \u8C03\u7528\u4F7F\u7528 xAI API \u51ED\u636E\uFF08\u4F8B\u5982 $XAI_API_KEY\uFF09\u3002\u5B83\u4E0E Grok Build OAuth \u767B\u5F55\u4E0D\u662F\u540C\u4E00\u4EFD\u51ED\u636E\uFF0C\u8FD9\u91CC\u4E5F\u4E0D\u4F1A\u663E\u793A\u5BC6\u94A5\u3002",imagineLoading:"\u6B63\u5728\u68C0\u67E5 Imagine \u51ED\u636E\u2026",imagineLoadFailed:"\u65E0\u6CD5\u8BFB\u53D6 Imagine \u51ED\u636E\u72B6\u6001\u3002",imagineConfigured:"\u5DF2\u914D\u7F6E Imagine \u51ED\u636E",imagineNotConfigured:"\u5C1A\u672A\u914D\u7F6E Imagine \u51ED\u636E",imagineSource:"\u6765\u6E90\uFF1A{source}",imagineWritable:"\u5F53\u524D\u90E8\u7F72\u53EF\u4EE5\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E0D\u80FD\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineSourceNone:"\u65E0",imagineSourceEnv:"\u73AF\u5883\u53D8\u91CF",imagineSourceApiKey:"\u5DF2\u4FDD\u5B58\u7684 API key",imagineSourceOAuth:"OAuth access\uFF08\u4EC5\u5F53 Imagine \u63A5\u53D7\u65F6\uFF09",imagineSourceCliKey:"Grok CLI \u7684 key \u5B57\u6BB5",imagineSourceUnknown:"\u5DF2\u914D\u7F6E\uFF08\u7EC6\u8282\u4E0D\u5C55\u793A\uFF09",tabAccounts:"\u8D26\u6237",tabCapabilities:"\u80FD\u529B",tabGateway:"\u7F51\u5173",tabAbout:"\u5173\u4E8E",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",modelsSummary:"\u5DF2\u663E\u793A {selected}/{total} \u4E2A\u6A21\u578B",expandModels:"\u6A21\u578B",collapseModels:"\u6536\u8D77\u6A21\u578B",usageUsedShort:"\u5DF2\u7528 {value}",gatewayTitle:"\u672C\u5730 API \u7F51\u5173",gatewayIntro:"\u672C\u673A loopback \u4E0A\u7684 OpenAI/Anthropic \u517C\u5BB9\u670D\u52A1\uFF0C\u4F9B\u4F60\u81EA\u5DF1\u7684\u5DE5\u5177\u4F7F\u7528\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",gatewayWarning:"\u6253\u5F00\u540E\u4F1A\u628A\u5DF2\u767B\u5F55\u8BA2\u9605\u66B4\u9732\u6210\u672C\u5730 API\u3002\u53EF\u80FD\u8FDD\u53CD\u4F9B\u5E94\u5546\u6761\u6B3E\u5E76\u6D88\u8017\u914D\u989D\u3002",gatewayLoopbackHint:"\u4EC5\u7ED1\u5B9A\u672C\u673A\u56DE\u73AF\u5730\u5740\u3002\u8BF7\u52FF\u505A\u7AEF\u53E3\u8F6C\u53D1\uFF0C\u4E5F\u4E0D\u8981\u628A\u5B83\u66B4\u9732\u5230\u516C\u7F51\u3002",gatewayEnableConfirm:"\u8981\u542F\u7528\u672C\u5730 API \u7F51\u5173\u5417\uFF1F\u5B83\u4F1A\u628A\u5DF2\u767B\u5F55\u7684\u8BA2\u9605\u66B4\u9732\u7ED9\u672C\u673A\u5DE5\u5177\uFF0C\u5E76\u6D88\u8017\u4F9B\u5E94\u5546\u914D\u989D\u3002",gatewayEnableConfirmAction:"\u786E\u8BA4\u542F\u7528",gatewayEnableCancel:"\u53D6\u6D88",gatewayEnabled:"\u542F\u7528\u672C\u5730\u7F51\u5173",gatewayOpencodeGoEnabled:"\u5C06\u804A\u5929\u4EE3\u7406\u5230 OpenCode Go",gatewayOpencodeGoHint:"\u5F00\u542F\u540E\uFF0CPOST /v1/chat/completions \u4F1A\u8F6C\u53D1\u5230 OpenCode Go\uFF0C\u5E76\u5E26\u4E0A\u7C98\u6027\u4F1A\u8BDD\u5934\u3002\u8BF7\u628A\u7F51\u5173 Bearer key \u8BBE\u4E3A\u4F60\u7684 OpenCode API key\u3002\u9ED8\u8BA4\u5173\u95ED\u3002\u8BF7\u9075\u5B88 OpenCode \u6761\u6B3E\uFF1B\u4ECD\u4F1A\u6D88\u8017\u4F60\u7684 OpenCode \u914D\u989D\u3002",gatewayBind:"\u7ED1\u5B9A\u5730\u5740",gatewayPort:"\u7AEF\u53E3",gatewayPortHint:"1024\u201365535 \u7684\u6574\u6570\u3002\u6539\u5B8C\u70B9\u786E\u5B9A\u4FDD\u5B58\uFF1B\u968F\u673A\u4F1A\u586B\u4E00\u4E2A\u9AD8\u4F4D\u7AEF\u53E3\uFF0C\u4ECD\u9700\u786E\u5B9A\u3002",gatewayPortApply:"\u786E\u5B9A",gatewayPortRandom:"\u968F\u673A",gatewayPortInvalid:"\u8BF7\u8F93\u5165 1024 \u5230 65535 \u4E4B\u95F4\u7684\u6574\u6570\u7AEF\u53E3\u3002",gatewayAddress:"\u7F51\u5173\u5730\u5740",gatewayOpenAiUrl:"OpenAI \u517C\u5BB9\u5730\u5740",gatewayAnthropicUrl:"Anthropic \u517C\u5BB9\u5730\u5740",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"\u590D\u5236\u7684\u662F\u5F53\u524D key\u3002\u53EA\u6709\u8981\u4F5C\u5E9F\u5DF2\u6709\u5BA2\u6237\u7AEF\u65F6\u624D\u8F6E\u6362\u3002",gatewayCopyKey:"\u590D\u5236 key",gatewayShowKey:"\u663E\u793A",gatewayHideKey:"\u9690\u85CF",gatewayRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5F53\u524D key\u3002",gatewayRotateConfirm:"\u786E\u5B9A\u8F6E\u6362 key\uFF1F\u73B0\u6709\u5BA2\u6237\u7AEF\u5C06\u5931\u6548\u3002",gatewayRotateConfirmHint:"\u8FD9\u4F1A\u66FF\u6362\u5F53\u524D Bearer key\u3002",gatewayRotateConfirmAction:"\u786E\u8BA4\u8F6E\u6362",gatewayRotateCancel:"\u53D6\u6D88",gatewayRunning:"\u6B63\u5728\u76D1\u542C",gatewayStopped:"\u672A\u76D1\u542C",gatewayRotate:"\u8F6E\u6362 API key",gatewayRotated:"\u65B0 key\uFF08\u53EA\u663E\u793A\u4E00\u6B21\uFF09\uFF1A{key}",gatewayLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u3002",gatewaySaveFailed:"\u65E0\u6CD5\u66F4\u65B0\u7F51\u5173\u3002",gatewayLoading:"\u6B63\u5728\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u2026",gatewayModelsReady:"\u5F53\u524D\u6709 {count} \u4E2A\u53EF\u6267\u884C\u6A21\u578B\uFF0C\u914D\u7F6E\u7247\u6BB5\u4F7F\u7528 {model}\u3002",gatewayModelsUnavailable:"\u5F53\u524D\u6CA1\u6709\u5DF2\u767B\u5F55\u4F9B\u5E94\u5546\u63D0\u4F9B\u53EF\u6267\u884C\u7684\u7F51\u5173\u6A21\u578B\u3002",gatewayKeyConfigured:"\u5DF2\u914D\u7F6E\u771F\u5B9E Bearer key\uFF1B\u590D\u5236\u53EF\u6267\u884C\u7247\u6BB5\u524D\u8BF7\u5148\u8BFB\u53D6 key\u3002",gatewayKeyNotConfigured:"\u5C1A\u672A\u914D\u7F6E Bearer key\u3002",remoteLoginHelp:"\u5728\u8FDC\u7A0B DSH \u4E3B\u673A\u4E0A\uFF0C\u6253\u5F00\u6B64\u5904 Settings\uFF0C\u5BF9\u6BCF\u4E2A\u4F9B\u5E94\u5546\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\u3002\u5728\u80FD\u8BBF\u95EE\u4F9B\u5E94\u5546\u7684\u4EFB\u610F\u6D4F\u89C8\u5668\u5B8C\u6210\u9A8C\u8BC1\u7801\uFF0C\u518D\u56DE\u5230\u804A\u5929\u9009\u62E9\u5BF9\u5E94\u8DEF\u7531\u6A21\u578B\u3002",pluginVersion:"\u63D2\u4EF6\u7248\u672C {version}",aboutTitle:"\u5173\u4E8E",aboutDocsHint:"\u4ED3\u5E93\u4E2D\u7684 README \u4E0E INSTALL \u6587\u6863\u4ECB\u7ECD\u4E86\u5B89\u88C5\u6B65\u9AA4\u3001\u652F\u6301\u7684\u4F9B\u5E94\u5546\u4EE5\u53CA\u7F51\u5173\u5B89\u5168\u6CE8\u610F\u4E8B\u9879\u3002",aboutDocsLink:"\u5728 GitHub \u6253\u5F00 README",otherLoginMethods:"\u5176\u4ED6\u767B\u5F55\u65B9\u5F0F",hideOtherLoginMethods:"\u6536\u8D77\u5176\u4ED6\u65B9\u5F0F",signInStepOpen:"\u6253\u5F00\u4F9B\u5E94\u5546\u6388\u6743\u9875\u9762",signInStepCode:"\u5728\u63D0\u793A\u5904\u8F93\u5165\u8BBE\u5907\u7801",signInStepWait:"\u7B49\u5F85\u6388\u6743\u5B8C\u6210",copyUserCode:"\u590D\u5236\u8BBE\u5907\u7801",openAuthUrl:"\u6253\u5F00\u6388\u6743\u9875\u9762",modelFilterPlaceholder:"\u7B5B\u9009\u6A21\u578B\u2026",modelFilterLabel:"\u7B5B\u9009 {provider} \u7684\u6A21\u578B",applyModelDraft:"\u5E94\u7528\u6A21\u578B\u9009\u62E9",modelDraftPending:"\u9009\u62E9\u4EC5\u5728\u672C\u9875\u5F62\u6210\u8349\u7A3F\uFF0C\u70B9\u51FB\u5E94\u7528\u540E\u4E00\u6B21\u4FDD\u5B58\u3002",deselectAll:"\u5168\u90E8\u9690\u85CF",resetModelsDefault:"\u91CD\u7F6E\u9009\u62E9",requiresCodexImages:"\u9700\u5148\u5F00\u542F Codex \u51FA\u56FE\u3002",requiresCodexSignIn:"\u8BF7\u5148\u767B\u5F55 OpenAI Codex\u3002",requiresImagineCredential:"\u8BF7\u5148\u914D\u7F6E\u72EC\u7ACB\u7684 Grok Imagine \u51ED\u636E\u3002",openCodexAccount:"\u524D\u5F80 Codex \u8D26\u6237",focusCodexImages:"\u524D\u5F80 Codex \u51FA\u56FE\u5F00\u5173",focusImagineCredential:"\u67E5\u770B Imagine \u51ED\u636E\u72B6\u6001",gatewaySnippetsTitle:"\u5FEB\u901F\u914D\u7F6E\u7247\u6BB5",gatewaySnippetsUnavailable:"\u8BF7\u5148\u8BFB\u53D6\u771F\u5B9E key\uFF0C\u5E76\u81F3\u5C11\u767B\u5F55\u4E00\u4E2A\u4F9B\u5E94\u5546\uFF1B\u6EE1\u8DB3\u540E\u624D\u4F1A\u663E\u793A\u53EF\u6267\u884C\u914D\u7F6E\u7247\u6BB5\u3002",gatewaySnippetCurl:"cURL",gatewaySnippetPython:"Python (OpenAI SDK)",gatewaySnippetIde:"IDE / \u5BA2\u6237\u7AEF",tabAccountsSignedIn:"\u5DF2\u767B\u5F55 {count} \u4E2A",coinstallTitle:"\u5DF2\u7531\u7528\u91CF\u4E2D\u5FC3\u7EDF\u4E00\u7BA1\u7406",coinstallSummary:"\u7528\u91CF\u4E2D\u5FC3\u5F53\u524D\u8D1F\u8D23 OAuth \u8FD0\u884C\u65F6\uFF1B\u5DF2\u6709 {count} \u4E2A\u4F9B\u5E94\u5546\u8D26\u53F7\u767B\u5F55\u3002",coinstallManageAccounts:"\u7BA1\u7406\u8BA2\u9605\u8D26\u53F7",tabGatewayActive:"\u8FD0\u884C\u4E2D",accountsListHint:"\u672C\u673A\u4FDD\u5B58\u7684\u8BA2\u9605\u8D26\u53F7\uFF08\u4ECE\u4E0D\u663E\u793A\u4EE4\u724C\uFF09\uFF1A",accountActive:"\u9ED8\u8BA4",accountSetDefault:"\u8BBE\u4E3A\u9ED8\u8BA4",accountRemove:"\u79FB\u9664",accountsEmpty:"\u5C1A\u65E0\u5DF2\u4FDD\u5B58\u8D26\u53F7\u3002"};var fe=require("react/jsx-runtime"),Zo="dsh-grok-build-client",ea=["locale"];function ta({t:e}){let[t,n]=(0,Re.useState)(!1),o=(0,Re.useRef)(null),r=(0,Re.useRef)(null),c=(0,Re.useRef)(null);return(0,Re.useEffect)(()=>{if(!t)return;r.current?.focus();let d=c.current?.closest("[data-dsh-coding-oauth]")?.parentElement,p=d==null?[]:[...document.body.children].filter(h=>h!==d).map(h=>({element:h,hadInert:h.hasAttribute("inert"),value:h.getAttribute("inert")}));for(let{element:h}of p)h.setAttribute("inert","");let l=()=>[...c.current?.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]].filter(h=>h.getClientRects().length>0),C=h=>{if(h.key==="Escape"&&n(!1),h.key!=="Tab")return;let I=l();if(I.length===0){h.preventDefault(),c.current?.focus();return}let R=I[0],g=I.at(-1);h.shiftKey&&document.activeElement===R?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),R.focus())};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C);for(let{element:h,hadInert:I,value:R}of p)I?h.setAttribute("inert",R??""):h.removeAttribute("inert");o.current?.isConnected&&o.current.focus()}},[t]),(0,fe.jsxs)("div",{"data-dsh-coding-oauth":!0,children:[(0,fe.jsx)("button",{ref:o,type:"button",style:{position:"fixed",right:16,bottom:16,zIndex:30,padding:"10px 14px"},onClick:()=>n(!0),children:e("nav")}),t?(0,fe.jsx)("div",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"coding-oauth-independent-title",tabIndex:-1,style:{position:"fixed",inset:0,zIndex:31,overflow:"auto",padding:20,background:"var(--dsw-alias-bg-layer-1)"},children:(0,fe.jsxs)("div",{style:{width:"min(780px, 100%)",margin:"0 auto"},children:[(0,fe.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:12,marginBottom:12},children:[(0,fe.jsx)("h2",{id:"coding-oauth-independent-title",style:{margin:0},children:e("title")}),(0,fe.jsx)("button",{ref:r,type:"button",onClick:()=>n(!1),"aria-label":e("cancel"),children:"\xD7"})]}),(0,fe.jsx)(gn,{t:e})]})}):null]})}function na(e){if(typeof document>"u")return()=>{};let t=document.createElement("div");document.body.append(t);let n=(0,Fi.createRoot)(t);return n.render((0,fe.jsx)(ta,{t:e})),()=>{n.unmount(),t.remove()}}function ia(e){let t=vn(e);t.assertCompatible();let n="settings.grok-build";t.effect(()=>t.locale.register(n,{zh:Bi,en:Ni}),"dsh-coding-subscription-oauth: settings copy");let o=t.locale.bind(n);t.installSlots({mountFallback:()=>na(o),register:r=>r.inject("settings.section",()=>r.register({name:"settings.section",id:"grok-build",order:17,label:()=>o("nav"),inject:()=>({t:o})},gn))})}
|
|
55
55
|
return module.exports;}});
|