import{t as e}from"./apiBase-SqS1USHn.js";function t(e){return e.replace(/\/+$/,``)}function n(e){let n=(e??``).trim();if(n=t(n),n===``)return n;let r=n.toLowerCase();return r.endsWith(`/v1/chat/completions`)?n:r.endsWith(`/v1`)?`${n}/chat/completions`:`${n}/v1/chat/completions`}function r(e){let t=e.useDirectVendor;return t===!0||t===`true`}function i(i){return r(i)?{url:n(i.directBaseUrl??``),bearer:(i.directApiKey??``).trim()}:{url:`${t(e())}/v1/chat/completions`,bearer:(i.cloudAccessToken??``).trim()}}function a(e){return!!e.cloudAccessToken?.trim()}function o(t){if(!e())throw Error(`扩展未配置服务地址：请使用正确的构建参数（VITE_API_BASE_URL）。`);if(!t.cloudAccessToken?.trim())throw Error(`请先登录账号：打开设置 → 账号 → 登录。`)}function s(e){return a(e)?r(e)?!!(e.model?.trim()&&(e.directBaseUrl??``).trim()&&(e.directApiKey??``).trim()):!0:!1}function c(e){return r(e)?(e.model??``).trim():`auto`}function l(e){return i(e).url}export{c as a,r as i,s as n,i as o,a as r,l as s,o as t};