import{c as e}from"./vscode-api-DjORcpSo.js";import{r as t}from"./lib-MoKmYgcO.js";import{t as n}from"./codex-api-error-C0Z_xLe-.js";function r(t,r,a){if(r===`transcription`){if(a instanceof e){if(a.status===429){let e=n(a);if(e!=null)return{message:e.message,canRetry:!1}}let e=a.message.toLowerCase();if(a.status===0||e.includes(`fetch failed`)||e.includes(`failed to fetch`)||e.includes(`network`))return{message:t.formatMessage(i.connectionError),canRetry:!0}}return{message:t.formatMessage(i.transcribeError),canRetry:!0}}let o=null;return a instanceof Error&&(o=a.name),typeof DOMException<`u`&&a instanceof DOMException&&(o=a.name),o===`NotAllowedError`||o===`SecurityError`?{message:t.formatMessage(i.microphonePermissionDenied),canRetry:!1}:o===`NotFoundError`||o===`DevicesNotFoundError`||o===`OverconstrainedError`||o===`ConstraintNotSatisfiedError`?{message:t.formatMessage(i.microphoneMissing),canRetry:!1}:o===`NotReadableError`||o===`TrackStartError`?{message:t.formatMessage(i.microphoneUnavailable),canRetry:!1}:o===`NotSupportedError`||o===`TypeError`?{message:t.formatMessage(i.unsupported),canRetry:!1}:{message:t.formatMessage(i.startError),canRetry:!1}}var i=t({connectionError:{id:`dictation.error.connection`,defaultMessage:`Check your connection and try again`,description:`Toast text shown when dictation audio transcription fails because of a connection problem`},microphoneMissing:{id:`dictation.error.microphoneMissing`,defaultMessage:`Connect a microphone to use dictation`,description:`Toast text shown when dictation cannot find an available microphone`},microphonePermissionDenied:{id:`dictation.error.microphonePermissionDenied`,defaultMessage:`Allow microphone access to use dictation`,description:`Toast text shown when dictation cannot start because microphone permission was denied`},microphoneUnavailable:{id:`dictation.error.microphoneUnavailable`,defaultMessage:`Close other apps using the microphone`,description:`Toast text shown when dictation cannot start because the microphone is unavailable`},startError:{id:`composer.dictation.startError`,defaultMessage:`Unable to start dictation`,description:`Toast text shown when dictation could not be started`},transcribeError:{id:`composer.dictation.transcribeError`,defaultMessage:`Unable to transcribe audio`,description:`Toast text shown when dictation audio transcription fails`},unsupported:{id:`dictation.error.unsupported`,defaultMessage:`Dictation is not available on this device`,description:`Toast text shown when dictation is not supported on the current device`}});export{r as t};
//# sourceMappingURL=dictation-error-message-CzId3MLD.js.map