1/** 2 * User-facing quota label for hosted simplifications (not BYOK). 3 * @param {{ usesHostedSimplify?: boolean, hasApiKey?: boolean, useHostedTokens?: boolean, purchasedCredits?: number, freeAllowanceRemaining?: number }} billing 4 * @returns {string|null} 5 */ 6export function usesHostedQuotaDisplay(billing = {}) { 7 if (billing.usesHostedSimplify != null) return Boolean(billing.usesHostedSimplify); 8 if (billing.useHostedTokens) return true; 9 return !billing.hasApiKey; 10} 11 12export function formatQuotaLabel(billing = {}) { 13 if (!usesHostedQuotaDisplay(billing)) return null; 14 15 const purchased = Number(billing.purchasedCredits || 0); 16 if (purchased > 0) { 17 return `${purchased} token${purchased === 1 ? "" : "s"} left`; 18 } 19 20 const free = Number(billing.freeAllowanceRemaining ?? 0); 21 return `${free} free token${free === 1 ? "" : "s"} left`; 22} 23 24/** @param {HTMLElement|null} el @param {string|null} label */ 25export function renderQuotaBadge(el, label) { 26 if (!el) return; 27 if (!label) { 28 el.textContent = ""; 29 el.hidden = true; 30 return; 31 } 32 el.textContent = label; 33 el.hidden = false; 34}
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.