1import{_ as R}from"./CMN22CfM.js";import{d as N,H as B,X as $,a as M,y as d,N as c,am as b,K as p,V as e,an as _,e as F,f,h as k,W as C,ap as l,aq as o,ao as r,aX as q}from"./Cg4IAt1_.js";const V={key:0,class:"billing-widget","data-testid":"billing-widget"},W={key:0,class:"billing-widget__stat"},L={class:"billing-widget__value","data-testid":"credit-remaining"},O={class:"billing-widget__stat"},H={class:"billing-widget__value","data-testid":"unbilled-cost"},E={key:1,class:"billing-widget__alert","data-testid":"billing-hold-alert"},X=["disabled"],j={key:2,class:"billing-widget__processing","data-testid":"billing-processing"},z=N({__name:"ApiBillingSummaryWidget",setup(P){const a=B(),g=$(),u=M(!1),t=d(()=>{const s=a.apiBillingSubscription?.billingHoldReason;return typeof s=="string"?s:""}),i=d(()=>{const s=Number(a.apiBillingSubscription?.unbilledCents??0);return Number.isNaN(s)?0:Math.max(0,Math.trunc(s))}),v=d(()=>{const s=a.apiBillingSubscription?.billingStatus;return typeof s=="string"?s:""}),m=d(()=>{const s=Number(a.apiBillingSubscription?.creditRemainingCents??0);return Number.isNaN(s)?0:Math.max(0,Math.trunc(s))}),U=d(()=>m.value>0),S=d(()=>{const s=t.value;return!!(s==="invoiceOpen"||s==="paymentFailed"||v.value&&v.value!=="active")}),x=d(()=>{const s=t.value;return s==="thresholdInvoicing"||s==="monthEndInvoicing"}),I=d(()=>!a.hasAuthenticatedUser||a.isAnonymous||a.isApiBillingLoading?!1:a.hasActiveApiBilling),D=async()=>{if(!u.value){if(!a.hasAuthenticatedUser||a.isAnonymous){a.isLoginModalVisible=!0;return}u.value=!0;try{if(await F(),!f){await g.push("/developers/usage");return}const s=a.apiBillingSubscription?.openInvoice?.hostedInvoiceUrl;if(typeof s=="string"&&s){window.location.assign(s);return}const n=k(f,"create_api_billing_portal");try{const A=(await n({returnPath:"/developers/usage"}))?.data?.portalUrl;if(A){window.location.assign(A);return}}catch(h){console.warn("Failed to open API billing portal, falling back to app portal",h)}const y=(await k(f,"ext-firestore-stripe-payments-createPortalLink")({returnUrl:`${window.location.origin}/developers/usage`}))?.data?.url;if(y){window.location.assign(y);return}await g.push("/developers/usage")}catch(s){console.warn("Failed to open billing portal",s),await g.push("/developers/usage")}finally{u.value=!1}}},w=s=>{const n=Number(s)/100;return Number.isNaN(n)?"N/A":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(n)};return(s,n)=>I.value?(p(),c("section",V,[U.value?(p(),c("div",W,[n[0]||(n[0]=e("span",{class:"billing-widget__label"},"Credit left",-1)),e("span",L,_(w(m.value)),1)])):b("",!0),e("div",O,[n[1]||(n[1]=e("span",{class:"billing-widget__label"},"Unbilled",-1)),e("span",H,_(w(i.value)),1)]),S.value?(p(),c("div",E,[n[2]||(n[2]=e("span",{class:"billing-widget__alert-text"},"Billing action needed.",-1)),e("button",{type:"button",class:"billing-widget__alert-link",disabled:u.value,onClick:D},_(u.value?"Opening billing...":"Resolve billing"),9,X)])):x.value?(p(),c("div",j,[...n[3]||(n[3]=[e("span",{class:"billing-widget__processing-text"},"Preparing invoice...",-1)])])):b("",!0)])):b("",!0)}}),K=Object.assign(C(z,[["__scopeId","data-v-36eff666"]]),{__name:"ApiBillingSummaryWidget"}),T={class:"developers-page"},G={class:"page-header"},J={class:"header-actions"},Q={class:"header-buttons"},Y={key:0,class:"upgrade-section"},Z={class:"section-tabs","aria-label":"Developer sections"},ee={class:"tab-panel"},te=N({__name:"developers",setup(P){const a=B(),g=d(()=>!a?.hasAuthenticatedUser||a?.isAnonymous||a.isApiBillingLoading?!1:!a.hasActiveApiBilling);return(u,t)=>{const i=R,v=q;return p(),c("div",T,[e("header",G,[t[2]||(t[2]=e("div",{class:"header-copy"},[e("p",{class:"eyebrow"},"Developers"),e("h1",null,"Developer API dashboard"),e("p",{class:"lede"}," Manage Diffio API keys, review usage, and prepare billing from one place. ")],-1)),e("div",J,[l(K),e("div",Q,[l(i,{to:"/api-pricing/",class:"btn ghost"},{default:o(()=>[...t[0]||(t[0]=[r("API pricing",-1)])]),_:1}),l(i,{to:"/docs/overview/introduction/",class:"btn ghost"},{default:o(()=>[...t[1]||(t[1]=[r("Documentation",-1)])]),_:1})])])]),g.value?(p(),c("section",Y,[l(i,{to:{path:"/pricing",query:{upgradeSource:"apiDashboard"}},class:"upgrade-card"},{default:o(()=>[...t[3]||(t[3]=[e("div",{class:"upgrade-content"},[e("div",{class:"upgrade-icon","aria-hidden":"true"},[e("svg",{viewBox:"0 0 72 48",role:"presentation"},[e("path",{d:"M4 28c6 0 6-12 12-12s6 12 12 12 6-12 12-12 6 12 12 12 6-12 12-12",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"}),e("path",{d:"M4 38c6 0 6-8 12-8s6 8 12 8 6-8 12-8 6 8 12 8 6-8 12-8",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round",opacity:"0.6"})])]),e("div",{class:"upgrade-copy"},[e("p",{class:"upgrade-eyebrow"},"API access requires Dev plan"),e("h3",null," Upgrade to Dev plan to activate API access and get a one time $5 credit at upgrade. Credit card required. ")])],-1),e("div",{class:"upgrade-cta"},[e("span",{class:"upgrade-button"},[e("span",{class:"upgrade-button__label"}
1,"Upgrade to Dev plan")]),e("div",{class:"upgrade-meta"},[e("p",null,"No charge today."),e("p",null,"Pay as you go pricing.")])],-1)])]),_:1})])):b("",!0),e("nav",Z,[l(i,{to:"/developers/api-keys",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[4]||(t[4]=[r("API keys",-1)])]),_:1}),l(i,{to:"/developers/agent-keys",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[5]||(t[5]=[r("Agent keys",-1)])]),_:1}),l(i,{to:"/developers/models",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[6]||(t[6]=[r("Models",-1)])]),_:1}),l(i,{to:"/developers/webhooks",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[7]||(t[7]=[r("Webhooks",-1)])]),_:1}),l(i,{to:"/developers/usage",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[8]||(t[8]=[r("Usage",-1)])]),_:1}),l(i,{to:"/developers/billing",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[9]||(t[9]=[r("Billing",-1)])]),_:1}),l(i,{to:"/developers/analytics",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[10]||(t[10]=[r("Analytics",-1)])]),_:1}),l(i,{to:"/developers/request-log",class:"tab","active-class":"tab-active"},{default:o(()=>[...t[11]||(t[11]=[r("Request log",-1)])]),_:1})]),e("div",ee,[l(v)])])}}}),le=C(te,[["__scopeId","data-v-8a214c23"]]);export{le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.