{"version":3,"file":"auth-selector-status.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/auth-selector-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAC9B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAM5B,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,cAAc,GAAG,SAAS,EACtC,UAAU,CAAC,EAAE,UAAU,GACrB,qBAAqB,CAuBvB","sourcesContent":["import type { AuthCredential, AuthStatus } from \"../../../core/auth-storage.js\";\n\nexport type SelectorAuthType = \"oauth\" | \"api_key\";\n\nexport type AuthSelectorIndicator =\n\t| { kind: \"configured\"; label: string }\n\t| { kind: \"configured-other\"; label: string }\n\t| { kind: \"runtime\" }\n\t| { kind: \"environment\"; label: string }\n\t| { kind: \"fallback\" }\n\t| { kind: \"unconfigured\" };\n\nfunction getConfiguredLabel(authType: SelectorAuthType): string {\n\treturn authType === \"oauth\" ? \"subscription configured\" : \"api key configured\";\n}\n\nexport function getAuthSelectorIndicator(\n\tauthType: SelectorAuthType,\n\tcredential: AuthCredential | undefined,\n\tauthStatus?: AuthStatus,\n): AuthSelectorIndicator {\n\tif (credential) {\n\t\tconst label = getConfiguredLabel(credential.type);\n\t\treturn credential.type === authType ? { kind: \"configured\", label } : { kind: \"configured-other\", label };\n\t}\n\n\tif (authType === \"oauth\") {\n\t\treturn { kind: \"unconfigured\" };\n\t}\n\n\tif (authStatus?.source === \"runtime\") {\n\t\treturn { kind: \"runtime\" };\n\t}\n\n\tif (authStatus?.source === \"environment\") {\n\t\treturn { kind: \"environment\", label: authStatus.label ?? \"API key\" };\n\t}\n\n\tif (authStatus?.source === \"fallback\") {\n\t\treturn { kind: \"fallback\" };\n\t}\n\n\treturn { kind: \"unconfigured\" };\n}\n"]}